:root {
  --bg: #10131f;
  --panel: #1a1f33;
  --line: #2e3654;
  --text: #eef0f8;
  --muted: #9aa3c0;
  --main: #3b4bd8;
  --main-dark: #2a36a5;
  --gold: #ffc940;
  --good: #1f9d61;
  --bad: #d64545;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  top: 0 !important;
}
a { color: var(--gold); }
h1 { font-size: 1.7rem; margin: .4em 0; }
h2 { margin: 0 0 .6em; }
h3 { margin: 0 0 .3em; color: var(--gold); }

.top {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 10px 20px; background: var(--panel); border-bottom: 1px solid var(--line);
}
.logo { font-weight: 800; font-size: 1.4rem; color: var(--text); text-decoration: none; }
.logo span { color: var(--gold); }
#nav { display: flex; align-items: center; gap: 14px; margin-left: auto; flex-wrap: wrap; }
#nav a { text-decoration: none; color: var(--text); }
#nav a.gold { color: var(--gold); font-weight: 600; }
.who { color: var(--muted); font-size: .9rem; }
.badge { background: var(--gold); color: #222; border-radius: 99px; padding: 2px 10px; font-size: .8rem; font-weight: 700; }
#google_translate_element { min-height: 26px; }
#google_translate_element .goog-te-gadget { color: var(--muted); font-size: 11px; }
#google_translate_element select { padding: 4px; border-radius: 6px; }

main { max-width: 1200px; margin: 0 auto; padding: 20px; min-height: 70vh; }
.foot { text-align: center; color: var(--muted); padding: 24px; font-size: .9rem; }

.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.row.center { justify-content: center; }
.row.wrap, .wrap { flex-wrap: wrap; }
.muted { color: var(--muted); }
.small-text { font-size: .85rem; }
.center-text { text-align: center; }
.scroll-x { overflow-x: auto; }

.btn {
  display: inline-block; border: 0; border-radius: 8px; padding: 9px 16px;
  background: var(--main); color: #fff !important; font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--main-dark); }
.btn.small { padding: 5px 10px; font-size: .88rem; }
.btn.big { padding: 13px 26px; font-size: 1.1rem; }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--line); }
.btn.danger { background: var(--bad); }
.btn.good { background: var(--good); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.narrow { max-width: 440px; margin: 30px auto; }
.list { display: grid; gap: 10px; margin-top: 12px; }
.msg { background: #232a45; border-left: 4px solid var(--gold); padding: 10px 14px; border-radius: 6px; margin: 10px 0; }
.msg.bad { border-color: var(--bad); }
.msg.good { border-color: var(--good); }

label { display: block; margin: 12px 0; font-weight: 600; }
input, textarea, select {
  font: inherit; color: var(--text); background: #0d1020; border: 1px solid var(--line);
  border-radius: 8px; padding: 9px 10px;
}
label > input, label > textarea { display: block; width: 100%; margin-top: 5px; font-weight: 400; }
label.check { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-weight: 400; }

.hero { text-align: center; padding: 50px 10px 30px; }
.hero h1 { font-size: 2.5rem; }
.hero p { max-width: 640px; margin: 0 auto 24px; color: var(--muted); font-size: 1.15rem; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-top: 20px; }

.price { font-size: 3.4rem; font-weight: 800; color: var(--gold); }
.ticks { list-style: none; padding: 0; text-align: left; max-width: 300px; margin: 16px auto; }
.ticks li { padding: 4px 0 4px 26px; position: relative; }
.ticks li::before { content: "\2713"; color: var(--good); position: absolute; left: 0; font-weight: 800; }
.pay { margin: 18px 0; }
.pay:empty { display: none; }
.btn:disabled { opacity: .6; cursor: wait; }
.info { margin-top: 44px; }
.info > h2 { font-size: 1.5rem; text-align: center; margin-bottom: .8em; }
.steps { max-width: 760px; margin: 0 auto; padding-left: 1.3em; }
.steps li { margin: 10px 0; color: var(--muted); }
.steps strong { color: var(--text); }
.features .card .btn { margin-top: 6px; }
.faq details { max-width: 760px; margin: 8px auto; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; }
.faq summary { cursor: pointer; font-weight: 700; }
.faq p { color: var(--muted); margin: 8px 0 0; }

.promo { display: block; text-decoration: none; color: #2a1c00 !important; background: linear-gradient(90deg, #ffc940, #ff9d3b); border-radius: 10px; padding: 10px 16px; margin: 12px auto; text-align: center; max-width: 760px; }
.promo .code { background: #2a1c00; color: #ffc940; border-radius: 5px; padding: 1px 7px; font-weight: 800; letter-spacing: .04em; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 22px 0; align-items: stretch; }
.plan { text-align: center; display: flex; flex-direction: column; gap: 6px; align-items: center; position: relative; }
.plan.picked { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold); }
.plan.deal { border-color: var(--gold); padding-top: 34px; }
.plan .btn { margin-top: auto; }
.plan-games { font-weight: 700; }
.plan-price { font-size: 2rem; font-weight: 800; color: var(--gold); }
.plan-price s, .total s { color: var(--muted); font-size: .6em; font-weight: 600; }
.total s { font-size: 1em; }
.ribbon { position: absolute; top: 0; left: 0; right: 0; background: var(--gold); color: #2a1c00; font-size: .78rem; font-weight: 800; padding: 4px; border-radius: 11px 11px 0 0; }
.checkout { max-width: 460px; margin: 0 auto; }
.total { font-size: 1.15rem; }

/* Editor */
.title-input { font-size: 1.4rem; font-weight: 700; flex: 1; min-width: 220px; }
.toolbar { margin: 14px 0; }
.picker { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 6px 0; }
.picker-label { font-weight: 600; }
.picker-label:empty { display: none; }
.thumb { height: 44px; max-width: 90px; object-fit: contain; border-radius: 4px; background: #fff; }
.edit-grid { display: grid; gap: 8px; padding-bottom: 8px; }
.edit-cat { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
.cat-name { width: 100%; font-weight: 700; }
.edit-cell {
  min-height: 92px; border-radius: 10px; border: 1px dashed var(--line); background: #151a2c; color: var(--muted);
  font: inherit; cursor: pointer; padding: 8px; display: flex; flex-direction: column; gap: 4px; text-align: left; overflow: hidden;
}
.edit-cell.filled { border-style: solid; background: var(--main-dark); color: #fff; }
.edit-cell:hover { border-color: var(--gold); }
.cell-value { color: var(--gold); font-weight: 800; }
.cell-text { font-size: .85rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.overlay { position: fixed; inset: 0; background: rgba(5, 7, 15, .8); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 20px; width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; }

/* Play */
.board { display: grid; gap: 8px; padding: 8px; border-radius: 14px; background: #0a0d1a; background-size: cover; background-position: center; }
.board-cat {
  background: var(--main-dark); border-radius: 8px; padding: 10px 6px; text-align: center; font-weight: 800;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  font-size: clamp(.7rem, 1.5vw, 1.2rem); text-transform: uppercase; overflow-wrap: anywhere; min-height: 70px;
}
.board-cat img { max-height: 70px; max-width: 100%; object-fit: contain; }
.board-cell {
  background: var(--main); color: var(--gold); border: 0; border-radius: 8px; cursor: pointer;
  font: inherit; font-weight: 800; font-size: clamp(1.1rem, 3.2vw, 2.6rem); min-height: clamp(40px, calc((100vh - 330px) / var(--rows, 5)), 110px);
}
.board-cell:hover { filter: brightness(1.2); }
.board-cell.used { color: transparent; background: #1b2142; }
.board-cell.empty { background: transparent; cursor: default; }
.board.has-bg .board-cat, .board.has-bg .board-cell:not(.empty) { opacity: .9; }

.teams { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; align-items: center; margin: 16px 0; }
.team { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px; text-align: center; min-width: 130px; }
.team-name { width: 120px; text-align: center; padding: 4px; font-weight: 700; }
.team-name-fixed { font-weight: 700; }
.team-score { font-size: 1.6rem; font-weight: 800; color: var(--gold); }

.clue-screen { position: fixed; inset: 0; background: var(--main-dark); z-index: 60; display: flex; flex-direction: column; padding: 18px; gap: 10px; overflow: auto; }
.clue-head { text-align: center; font-weight: 800; color: var(--gold); text-transform: uppercase; font-size: 1.2rem; }
.clue-label { color: var(--gold); font-weight: 800; text-transform: uppercase; }
.clue-body { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; text-align: center; min-height: 200px; }
.clue-text { font-size: clamp(1.5rem, 4.5vw, 3.6rem); font-weight: 700; white-space: pre-wrap; overflow-wrap: anywhere; }
.clue-img { max-width: 90%; max-height: 50vh; object-fit: contain; border-radius: 8px; }
.clue-screen .teams { margin: 4px 0; }

.board.dense { gap: 4px; }
.board.dense .board-cat { font-size: clamp(.55rem, 1vw, .95rem); padding: 6px 3px; }
.board.dense .board-cell { font-size: clamp(.9rem, 2.2vw, 2rem); }
label.check select { padding: 5px 8px; }

/* Print preview */
.sheets { display: flex; flex-direction: column; align-items: center; gap: 18px; margin-top: 16px; }
.sheet { background: #fff; color: #111; width: 200mm; padding: 6mm; border-radius: 4px; }
.sheet h1 { text-align: center; margin: 0 0 5mm; color: #111; }
.pboard { display: grid; gap: 2mm; padding: 2mm; background-size: cover; background-position: center; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.pboard-cat {
  border: .6mm solid #1b2466; background: #1b2466; color: #fff; border-radius: 2mm; padding: 2mm; text-align: center; font-weight: 800;
  text-transform: uppercase; font-size: 10pt; overflow-wrap: anywhere; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1mm; min-height: 18mm;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.pboard-cat img { max-height: 16mm; max-width: 100%; object-fit: contain; }
.pboard-cell { border: .6mm solid #1b2466; background: #fff; border-radius: 2mm; height: 26mm; display: flex; align-items: center; justify-content: center; font-size: 24pt; font-weight: 800; color: #1b2466; }
.board-sheet.dense .pboard { gap: 1mm; }
.board-sheet.dense .pboard-cat { font-size: 6.5pt; padding: 1mm; }
.pboard.has-bg .pboard-cell { background: rgba(255, 255, 255, .8); }

.pcards { display: grid; grid-template-columns: 90mm 90mm; grid-auto-rows: 62mm; width: 180mm; margin: 0 auto; }
.pcard { border: .3mm dashed #888; padding: 3mm; display: flex; flex-direction: column; overflow: hidden; }
.pcard.blank { border-color: transparent; }
.pcard-head { display: flex; justify-content: space-between; gap: 3mm; font-size: 8.5pt; font-weight: 800; text-transform: uppercase; color: #1b2466; border-bottom: .3mm solid #1b2466; padding-bottom: 1mm; }
.pcard.back .pcard-head { color: #8a5a00; border-color: #8a5a00; }
.pcard-body { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2mm; text-align: center; font-weight: 600; white-space: pre-wrap; overflow-wrap: anywhere; }
.pcard-body img { max-width: 100%; max-height: 30mm; min-height: 0; object-fit: contain; flex-shrink: 1; }

@media (max-width: 700px) {
  main { padding: 12px; }
  .hero h1 { font-size: 1.8rem; }
  .sheets { align-items: flex-start; overflow-x: auto; }
}

@page { size: auto; margin: 8mm; }
@media print {
  body { background: #fff; color: #111; }
  .no-print, .skiptranslate, #goog-gt-tt { display: none !important; }
  main { max-width: none; padding: 0; margin: 0; min-height: 0; }
  .sheets { display: block; margin: 0; }
  .sheet { width: auto; padding: 0; border-radius: 0; break-after: page; page-break-after: always; }
  .sheet:last-child { break-after: auto; page-break-after: auto; }
  .card-sheet { padding-top: 4mm; }
}
