:root {
  --bg: #0f1226;
  --bg2: #191d3a;
  --card: #222748;
  --text: #f4f5ff;
  --muted: #a9aed6;
  --accent: #ffcc33;
  --accent2: #ff4f7b;
  --ok: #2ecc71;
  --bad: #ff5b5b;
  --o0: #e74c3c;
  --o1: #3498db;
  --o2: #f1c40f;
  --o3: #2ecc71;
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .5em; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.hidden { display: none !important; }
.center { text-align: center; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.spacer { flex: 1; }

/* buttons and inputs */
.btn {
  display: inline-block; border: 0; border-radius: 999px; cursor: pointer;
  padding: 14px 26px; font-size: 1.05rem; font-weight: 700; text-decoration: none;
  background: var(--accent); color: #1b1b1b; transition: transform .08s ease, filter .15s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(.97); }
.btn.secondary { background: transparent; color: var(--text); box-shadow: inset 0 0 0 2px var(--muted); }
.btn.small { padding: 8px 14px; font-size: .9rem; }
.btn.danger { background: var(--bad); color: #fff; }
.btn:disabled { opacity: .5; cursor: default; }
label { display: block; font-weight: 600; margin: 18px 0 6px; }
input[type=text], input[type=url], input[type=email], input[type=number], textarea, select {
  width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid #3a4070;
  background: var(--bg2); color: var(--text); font: inherit;
}
textarea { min-height: 140px; resize: vertical; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.check input { margin-top: 5px; }
.card { background: var(--card); border-radius: var(--radius); padding: 22px; }
.error { color: var(--bad); font-weight: 600; }
.notice { background: #2c3260; border-left: 4px solid var(--accent); padding: 12px 14px; border-radius: 8px; }

/* header / footer */
.top { padding: 18px 0; }
.logo { font-weight: 900; font-size: 1.3rem; letter-spacing: -.02em; color: var(--text); text-decoration: none; }
.logo span { color: var(--accent); }
.lang-switch { color: var(--muted); font-size: .9rem; }
footer { padding: 40px 0; color: var(--muted); font-size: .9rem; }
footer a { color: var(--muted); }

/* landing */
.hero { padding: 40px 0 30px; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.4rem); font-weight: 900; letter-spacing: -.02em; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p.lead { font-size: 1.2rem; color: var(--muted); max-width: 640px; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin: 30px 0; }
.steps .card h3 { color: var(--accent); }
.compare { width: 100%; border-collapse: collapse; margin: 10px 0; }
.compare td, .compare th { padding: 10px; border-bottom: 1px solid #343a68; text-align: left; vertical-align: top; }
.price-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.price { font-size: 2rem; font-weight: 900; color: var(--accent); }
section { padding: 26px 0; }

/* editor */
.round { margin: 18px 0; }
.round-head { display: flex; gap: 10px; align-items: center; }
.q { background: var(--bg2); border-radius: 10px; padding: 14px; margin: 10px 0; }
.q .opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.q .opt { display: flex; gap: 6px; align-items: center; }
.q .opt input[type=text] { padding: 8px 10px; }
.q .tools { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.sticky-bar { position: sticky; bottom: 0; background: rgba(15,18,38,.95); padding: 12px 0; border-top: 1px solid #343a68; }

/* big screen (host) */
body.screen { overflow: hidden; }
.stage { height: 100vh; height: 100dvh; display: flex; flex-direction: column; padding: 2.5vh 3vw; }
.stage-top { display: flex; align-items: center; gap: 16px; font-size: 1.6vw; color: var(--muted); }
.stage-main { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; }
.stage-bottom { display: flex; gap: 10px; align-items: center; justify-content: flex-end; }
.big-title { font-size: 5vw; font-weight: 900; letter-spacing: -.02em; }
.huge { font-size: 7vw; font-weight: 900; color: var(--accent); }
.question-text { font-size: 3.4vw; font-weight: 800; max-width: 90vw; margin-bottom: 4vh; }
.answers { display: grid; grid-template-columns: 1fr 1fr; gap: 2vh 2vw; width: 90vw; }
.answer { display: flex; align-items: center; gap: 1.2vw; padding: 2.4vh 2vw; border-radius: var(--radius); font-size: 2.3vw; font-weight: 800; color: #fff; text-align: left; position: relative; overflow: hidden; }
.answer .shape { font-size: 2.6vw; }
.answer .count { margin-left: auto; font-size: 2vw; opacity: .9; }
.answer.dim { opacity: .25; }
.answer { cursor: default; user-select: none; }
.phone-hint-line { font-size: 1.5vw; color: var(--muted); margin-top: 2vh; }
.screen-hint { background: #2c3260; border-left: 4px solid var(--accent); padding: 10px 12px; border-radius: 8px; font-size: .95rem; margin-bottom: 12px; text-align: left; display: none; }
.answer.right { box-shadow: 0 0 0 6px #fff; }
.c0 { background: var(--o0); } .c1 { background: var(--o1); } .c2 { background: var(--o2); color: #222; } .c3 { background: var(--o3); }
.timer { font-size: 4vw; font-weight: 900; color: var(--accent); min-width: 6vw; text-align: center; }
.timer-bar { height: 1.2vh; background: #343a68; border-radius: 99px; width: 90vw; margin: 3vh 0 0; overflow: hidden; }
.timer-bar > div { height: 100%; background: var(--accent); width: 100%; transition: width .25s linear; }
.lobby { display: grid; grid-template-columns: auto 1fr; gap: 4vw; align-items: center; width: 90vw; text-align: left; }
.lobby img { width: 32vh; height: 32vh; background: #fff; border-radius: var(--radius); padding: 1.2vh; }
.join-url { font-size: 2.2vw; font-weight: 800; }
.join-code { font-size: 5vw; font-weight: 900; color: var(--accent); letter-spacing: .1em; }
.names { display: flex; flex-wrap: wrap; gap: 1vh 1vw; margin-top: 3vh; max-height: 30vh; overflow: hidden; }
.names span { background: var(--card); padding: .6vh 1.2vw; border-radius: 99px; font-size: 1.6vw; cursor: pointer; }
.names span:hover { text-decoration: line-through; }
.board { width: 70vw; text-align: left; }
.board .line { display: flex; gap: 2vw; align-items: center; padding: 1.4vh 2vw; background: var(--card); border-radius: 10px; margin: 1vh 0; font-size: 2.2vw; font-weight: 700; }
.board .line .rank { width: 4vw; color: var(--accent); }
.board .line .pts { margin-left: auto; }
.board .line .plus { color: var(--ok); font-size: 1.6vw; width: 8vw; text-align: right; }
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 2vw; margin-top: 4vh; }
.podium .step { background: var(--card); border-radius: var(--radius) var(--radius) 0 0; width: 20vw; padding: 2vh 1vw; text-align: center; }
.podium .step .name { font-size: 2.4vw; font-weight: 900; }
.podium .step .pts { color: var(--muted); font-size: 1.6vw; }
.podium .p1 { height: 34vh; background: linear-gradient(#ffcc33, #e0a800); color: #222; }
.podium .p1 .pts { color: #3a2e00; }
.podium .p2 { height: 26vh; }
.podium .p3 { height: 20vh; }
.host-line { font-size: 2.2vw; color: var(--accent); margin-top: 3vh; max-width: 85vw; font-weight: 700; }
.explanation { font-size: 1.6vw; color: var(--muted); margin-top: 1vh; }
.brand { position: fixed; bottom: 1.5vh; left: 2vw; color: var(--muted); font-size: 1.2vw; }
.brand b { color: var(--text); }
.start-overlay { position: fixed; inset: 0; background: rgba(15,18,38,.96); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; z-index: 10; text-align: center; padding: 16px; }

/* phone (player) */
.phone { min-height: 100vh; display: flex; flex-direction: column; padding: 16px; }
.phone header { display: flex; justify-content: space-between; color: var(--muted); font-size: .95rem; }
.phone main { flex: 1; display: flex; flex-direction: column; justify-content: center; text-align: center; gap: 14px; }
.phone .pq { font-size: 1.15rem; font-weight: 700; }
.pad { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pad button { min-height: 22vh; border: 0; border-radius: var(--radius); color: #fff; font-size: 1.05rem; font-weight: 800; padding: 10px; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
.pad button .shape { font-size: 2rem; }
.pad button.chosen { box-shadow: 0 0 0 5px #fff; }
.pad button:disabled:not(.chosen) { opacity: .35; }
.pad.two button { min-height: 30vh; }
.result { font-size: 2rem; font-weight: 900; }
.result.ok { color: var(--ok); }
.result.bad { color: var(--bad); }
.bigscore { font-size: 3rem; font-weight: 900; color: var(--accent); }

/* The big-screen view opened on a phone: readable text, controls always visible. */
@media (max-width: 800px) {
  body.screen { overflow: auto; }
  .stage { min-height: 100dvh; height: auto; padding: 12px 16px 90px; }
  .stage-top { font-size: .9rem; }
  .stage-bottom { position: fixed; left: 0; right: 0; bottom: 0; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: rgba(15,18,38,.96); border-top: 1px solid #343a68; z-index: 5; }
  .screen-hint { display: block; }
  .big-title { font-size: 2rem; }
  .huge { font-size: 2.6rem; }
  .question-text { font-size: 1.3rem; margin-bottom: 16px; }
  .answers { width: 100%; grid-template-columns: 1fr; gap: 8px; }
  .answer { font-size: 1.05rem; padding: 12px 14px; gap: 10px; }
  .answer .shape, .answer .count { font-size: 1.1rem; }
  .timer { font-size: 1.6rem; }
  .timer-bar { width: 100%; }
  .lobby { grid-template-columns: 1fr; width: 100%; text-align: center; gap: 12px; }
  .lobby img { width: 200px; height: 200px; margin: 0 auto; }
  .join-url { font-size: 1.1rem; } .join-code { font-size: 2.4rem; }
  .names span { font-size: .95rem; padding: 4px 10px; }
  .board { width: 100%; } .board .line { font-size: 1rem; }
  .board .line .plus { font-size: .85rem; width: auto; }
  .podium .step { width: 30vw; } .podium .step .name { font-size: 1.1rem; } .podium .step .pts { font-size: .85rem; }
  .host-line { font-size: 1.1rem; } .explanation, .phone-hint-line { font-size: .9rem; }
  .brand { display: none; }
  /* Inline vw sizes are made for projectors; override them on phones. */
  .stage-main .muted, .stage-main .notice, .stage-main .row { font-size: .9rem !important; }
  .stage-main .row { width: 100% !important; }
}

@media (max-width: 640px) {
  .q .opts { grid-template-columns: 1fr; }
  .hero { padding-top: 20px; }
}
