@font-face { font-family: 'Lilita One'; src: url(fonts/lilita-one.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Nunito'; src: url(fonts/nunito.woff2) format('woff2'); font-weight: 200 1000; font-display: swap; }

:root {
  --bg: #FFF8F0; --card: #FFFFFF; --soft: #F8FAFC; --line: #E8ECF0;
  --accent: #FF6B35; --accent2: #FFD166; --accent3: #06D6A0; --accent4: #118AB2; --red: #EF476F;
  --text: #2D3047; --muted: #7A8496; --warm: #FFF3EE; --warn-bg: #FFF8F0; --warn: #7B5800;
  --ok-bg: #E8FDF5; --ok: #0B7A5A; --bad-bg: #FFF0F3;
  --shadow: 0 8px 32px rgba(45, 48, 71, .13); --radius: 20px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1A1C2B; --card: #262940; --soft: #20223A; --line: #3A3E5C;
    --text: #F2F3F8; --muted: #A3AAC0; --warm: #3A2A28; --warn-bg: #33301F; --warn: #F5D88A;
    --ok-bg: #173A33; --ok: #5DE3B8; --bad-bg: #3D2230;
    --shadow: 0 8px 32px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Nunito', system-ui, sans-serif; background: var(--bg); color: var(--text);
  min-height: 100vh; min-height: 100dvh; overflow-x: hidden;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
body::before { content: ''; position: fixed; width: 500px; height: 500px; background: radial-gradient(circle, #FFD16644 0%, transparent 70%); top: -100px; right: -100px; border-radius: 50%; pointer-events: none; z-index: 0; }
body::after { content: ''; position: fixed; width: 400px; height: 400px; background: radial-gradient(circle, #06D6A033 0%, transparent 70%); bottom: -80px; left: -80px; border-radius: 50%; pointer-events: none; z-index: 0; }

.app { position: relative; z-index: 1; max-width: 640px; margin: 0 auto; padding: 12px 16px 40px; }
header { text-align: center; padding: 16px 0 12px; }
header h1 { font-family: 'Lilita One', cursive; font-size: clamp(2.2rem, 9vw, 3rem); color: var(--accent); text-shadow: 3px 3px 0 #FFD166; line-height: 1; font-weight: 400; }
header p { color: var(--muted); font-size: .95rem; margin-top: 6px; font-weight: 700; }
.net-pill { display: inline-block; margin-top: 8px; font-size: .75rem; font-weight: 800; padding: 3px 10px; border-radius: 50px; background: var(--bad-bg); color: var(--red); }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px 20px; margin-bottom: 16px; animation: slideUp .35s cubic-bezier(.22, 1, .36, 1); }
.card.center { text-align: center; }
@keyframes slideUp { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
h2 { font-family: 'Lilita One', cursive; font-weight: 400; font-size: 1.5rem; margin-bottom: 4px; }
.title { font-family: 'Lilita One', cursive; font-size: 1.5rem; margin-bottom: 8px; }
.sub { color: var(--muted); font-size: .92rem; font-weight: 600; line-height: 1.55; }
.big-emoji { font-size: 3.4rem; margin-bottom: 10px; line-height: 1; }
.sep { height: 1px; background: var(--line); margin: 16px 0; }

.topline { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.counter { font-size: .78rem; font-weight: 800; color: var(--muted); letter-spacing: 1px; text-transform: uppercase; }
.scorebar { display: flex; gap: 6px; }
.pill { background: var(--card); border-radius: 50px; padding: 5px 12px; font-weight: 800; font-size: .85rem; box-shadow: var(--shadow); }
.pill.ok { color: var(--accent3); } .pill.bad { color: var(--red); } .pill.left { color: var(--muted); }
.badge { display: inline-block; background: var(--accent); color: white; font-weight: 800; font-size: .75rem; letter-spacing: 1.2px; text-transform: uppercase; padding: 5px 14px; border-radius: 50px; }

.label { font-size: .8rem; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); display: block; margin: 0 0 8px; }
.word-box { background: var(--soft); border-radius: 14px; padding: 16px; margin-bottom: 16px; text-align: center; }
.mystery { font-family: 'Lilita One', cursive; font-size: clamp(2rem, 10vw, 3.2rem); line-height: 1.1; color: var(--accent); word-break: break-word; }
.warn { background: var(--bad-bg); border-radius: 12px; padding: 8px 14px; margin-bottom: 14px; font-size: .85rem; font-weight: 800; color: var(--red); text-align: center; }
.hint { background: var(--warn-bg); border-radius: 12px; padding: 10px 14px; margin: 12px 0; font-size: .82rem; color: var(--warn); font-weight: 700; line-height: 1.5; }
.okbox { background: var(--ok-bg); border-radius: 14px; padding: 12px 16px; margin-bottom: 16px; text-align: center; color: var(--ok); font-weight: 700; font-size: .88rem; }

input.field, select.field {
  width: 100%; padding: 13px 14px; border: 2.5px solid var(--line); border-radius: 14px; background: var(--soft);
  font-family: inherit; font-size: 1.15rem; font-weight: 800; color: var(--text); outline: none; text-align: center;
}
input.field:focus, select.field:focus { border-color: var(--accent4); background: var(--card); }
input.upper { text-transform: uppercase; }
select.field { font-size: 1rem; text-align: left; appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M6 8L0 0h12z' fill='%238892A4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
input.code { font-family: 'Lilita One', cursive; font-size: 2rem; letter-spacing: 8px; text-transform: uppercase; }

.btn { padding: 13px 22px; border-radius: 50px; border: none; cursor: pointer; font-family: inherit; font-weight: 800; font-size: 1rem; transition: transform .12s, opacity .12s; display: inline-flex; align-items: center; justify-content: center; gap: 6px; color: var(--text); text-decoration: none; }
.btn:active { transform: scale(.96); }
.btn.wide { width: 100%; }
.btn.small { padding: 8px 14px; font-size: .85rem; }
.btn-primary { background: var(--accent); color: white; box-shadow: 0 4px 14px rgba(255, 107, 53, .35); }
.btn-secondary { background: var(--card); border: 2px solid var(--line); }
.btn-success { background: var(--accent3); color: white; }
.btn-blue { background: var(--accent4); color: white; }
.btn-danger { background: var(--red); color: white; }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; justify-content: center; }
.row > .btn { flex: 1 1 auto; }
.stack { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }

.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 16px 0; }
.mode { padding: 16px 10px; border-radius: 16px; border: 2.5px solid var(--line); background: var(--card); cursor: pointer; text-align: center; font-family: inherit; color: var(--text); }
.mode:active { transform: scale(.97); }
.mode .ic { font-size: 2rem; display: block; margin-bottom: 6px; }
.mode b { font-size: 1rem; display: block; }
.mode small { font-size: .78rem; color: var(--muted); font-weight: 700; display: block; margin-top: 2px; }
.mode:disabled { opacity: .45; }

.rules { background: var(--soft); border-radius: 14px; padding: 14px 16px; }
.rules summary { font-size: .82rem; font-weight: 800; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); cursor: pointer; }
.rules ol { padding-left: 18px; font-size: .9rem; line-height: 1.7; font-weight: 600; margin-top: 10px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip { padding: 6px 14px; border-radius: 50px; font-weight: 800; font-size: .85rem; background: var(--ok-bg); color: var(--ok); border: 2px solid var(--accent3); }
.chip.host { background: var(--warm); color: var(--accent); border-color: var(--accent); }
.chip.away { opacity: .45; border-style: dashed; }
.chip.done { background: var(--accent3); color: white; }

.choices { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.choice { min-width: 52px; height: 48px; padding: 0 12px; border-radius: 14px; border: 2.5px solid var(--line); background: var(--card); font-family: 'Lilita One', cursive; font-size: 1.2rem; cursor: pointer; color: var(--text); }
.choice.on { border-color: var(--accent); background: var(--warm); color: var(--accent); }

.names { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.name-row { display: flex; gap: 8px; align-items: center; }
.name-row input { font-size: 1rem; text-align: left; padding: 11px 14px; }
.name-row .num { width: 28px; text-align: center; font-weight: 800; color: var(--muted); }
.icon-btn { width: 44px; height: 44px; flex: none; border-radius: 12px; border: 2px solid var(--line); background: var(--card); font-size: 1.1rem; cursor: pointer; color: var(--text); }

.clues { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; padding: 6px 0; }
.clue { padding: 10px 18px; border-radius: 50px; font-weight: 800; font-size: 1.1rem; letter-spacing: .5px; background: linear-gradient(135deg, #118AB2, #06D6A0); color: white; box-shadow: 0 4px 14px rgba(6, 214, 160, .3); border: none; font-family: inherit; animation: pop .3s both; display: inline-flex; flex-direction: column; align-items: center; line-height: 1.15; }
.clue small { font-size: .68rem; font-weight: 700; opacity: .85; letter-spacing: 0; text-transform: none; }
button.clue { cursor: pointer; }
.clue.off { background: var(--soft); color: var(--muted); box-shadow: none; text-decoration: line-through; border: 2px dashed var(--line); }
@keyframes pop { from { opacity: 0; transform: scale(.7); } to { opacity: 1; transform: none; } }

.result { text-align: center; padding: 16px; border-radius: var(--radius); animation: pop .35s both; }
.result.correct { background: var(--ok-bg); border: 2px solid var(--accent3); }
.result.wrong { background: var(--bad-bg); border: 2px solid var(--red); }
.result.skip { background: var(--soft); border: 2px solid var(--line); }
.result .e { font-size: 2.8rem; display: block; }
.result .t { font-weight: 800; font-size: 1.15rem; margin-top: 4px; }
.result .s { font-size: .88rem; color: var(--muted); margin-top: 4px; font-weight: 700; }

.room-code { font-family: 'Lilita One', cursive; font-size: 3rem; color: var(--accent); letter-spacing: 10px; background: var(--warm); border-radius: 16px; padding: 12px; margin: 10px 0; user-select: all; }
.dots span { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin: 0 3px; animation: bounce .8s infinite; }
.dots span:nth-child(2) { animation-delay: .15s; } .dots span:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 80%, 100% { transform: scale(.8); opacity: .5; } 40% { transform: scale(1.2); opacity: 1; } }

.stats { display: flex; justify-content: center; gap: 12px; margin: 16px 0; }
.stat { padding: 12px 18px; border-radius: 16px; text-align: center; min-width: 88px; }
.stat b { font-family: 'Lilita One', cursive; font-size: 2.4rem; font-weight: 400; display: block; line-height: 1.1; }
.stat span { font-size: .75rem; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; }
.stat.ok { background: var(--ok-bg); color: var(--ok); } .stat.bad { background: var(--bad-bg); color: var(--red); }
.wordlist { font-size: .85rem; font-weight: 700; color: var(--muted); line-height: 1.6; margin-top: 6px; }

.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 12px 20px; border-radius: 14px; font-weight: 800; font-size: .9rem; z-index: 1000; max-width: calc(100% - 32px); text-align: center; animation: pop .25s both; }
.banner { background: var(--card); border: 2px dashed var(--line); border-radius: 14px; padding: 10px 14px; margin-bottom: 14px; font-size: .85rem; font-weight: 700; color: var(--muted); display: flex; gap: 10px; align-items: center; }
.banner button { margin-left: auto; background: none; border: none; font-size: 1.1rem; cursor: pointer; color: var(--muted); }
.reconnect { background: var(--warn-bg); color: var(--warn); border-radius: 12px; padding: 8px 12px; font-size: .85rem; font-weight: 800; text-align: center; margin-bottom: 12px; }
.footer { text-align: center; font-size: .75rem; color: var(--muted); font-weight: 700; margin-top: 18px; }
.footer a { color: inherit; }

.confetti-wrap { position: fixed; inset: 0; pointer-events: none; z-index: 999; overflow: hidden; }
.confetti-piece { position: absolute; top: -20px; border-radius: 2px; animation: fall 1.4s ease-in forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; } }
