/* Diwali Game 2026. Night-sky base from the NowOnline palette, lit by marigold and diya flame. */
@font-face { font-family: 'Urbanist'; src: url('/fonts/Urbanist-Bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Urbanist'; src: url('/fonts/Urbanist-ExtraBold.ttf') format('truetype'); font-weight: 800; font-display: swap; }
@font-face { font-family: 'Urbanist'; src: url('/fonts/Urbanist-Black.ttf') format('truetype'); font-weight: 900; font-display: swap; }
@font-face { font-family: 'Lexend'; src: url('/fonts/Lexend-Light.ttf') format('truetype'); font-weight: 300; font-display: swap; }
@font-face { font-family: 'Lexend'; src: url('/fonts/Lexend-Regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Lexend'; src: url('/fonts/Lexend-SemiBold.ttf') format('truetype'); font-weight: 600; font-display: swap; }

:root {
  color-scheme: dark;
  --night: #08182C;
  --sky: #0C2340;
  --sky-2: #13305A;
  --marigold: #F5B83D;
  --flame: #FF7A1A;
  --rangoli: #E8457A;
  --aqua: #69CAA7;
  --cream: #FFF4DC;
  --muted: #B9C3D0;
  --line: rgba(245, 184, 61, 0.28);
  --head: 'Urbanist', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --body: 'Lexend', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background-color: var(--night);
  background-image:
    radial-gradient(circle at 12% 18%, rgba(245, 184, 61, 0.10) 0 2px, transparent 3px),
    radial-gradient(circle at 78% 9%, rgba(255, 122, 26, 0.10) 0 2px, transparent 3px),
    radial-gradient(circle at 64% 72%, rgba(245, 184, 61, 0.08) 0 2px, transparent 3px),
    linear-gradient(160deg, var(--night) 0%, var(--sky) 100%);
  background-size: 180px 180px, 240px 240px, 300px 300px, 100% 100%;
  background-attachment: fixed;
  color: var(--cream);
  font-family: var(--body);
  font-weight: 300;
  line-height: 1.5;
}
h1, h2 { font-family: var(--head); font-weight: 900; line-height: 1.1; margin: 0 0 12px; letter-spacing: -0.01em; }
p { margin: 0 0 12px; }
button, input, select { font: inherit; }
:focus-visible { outline: 3px solid var(--marigold); outline-offset: 3px; }
[hidden] { display: none !important; }

.btn {
  appearance: none; border: 1px solid var(--line); background: var(--sky-2); color: var(--cream);
  padding: 12px 18px; border-radius: 12px; cursor: pointer; font-weight: 400;
}
.btn:hover:not(:disabled) { border-color: var(--marigold); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: var(--marigold); color: var(--night); border-color: var(--marigold); font-weight: 600; }
.btn.danger { background: #8B1E3F; border-color: var(--rangoli); }
.btn.block { width: 100%; padding: 16px; font-size: 1.05rem; }

.net { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); background: var(--rangoli); color: #fff; padding: 8px 16px; border-radius: 999px; font-size: 0.9rem; z-index: 50; }

/* ---------------- player (phone) ---------------- */
.player { padding-bottom: env(safe-area-inset-bottom, 0px); }
.p-head {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px; background: rgba(8, 24, 44, 0.92); border-bottom: 1px solid var(--line);
}
.diya-mark { width: 28px; height: 28px; }
.diya-mark .flame { fill: var(--flame); }
.diya-mark .bowl { fill: var(--marigold); }
.p-title { font-family: var(--head); font-weight: 800; font-size: 1.15rem; }
.p-me { margin-left: auto; color: var(--marigold); font-weight: 400; }
.p-main { max-width: 560px; margin: 0 auto; padding: 18px 16px 24px; }
.screen-title { font-size: 2rem; }
.kicker { color: var(--marigold); font-weight: 400; margin-bottom: 6px; }
.q { font-size: 1.6rem; font-weight: 800; }
.lead { font-size: 1.15rem; }
.muted { color: var(--muted); }
.win { font-family: var(--head); font-weight: 900; font-size: 1.6rem; color: var(--marigold); }
.notice { background: rgba(232, 69, 122, 0.18); border: 1px solid var(--rangoli); border-radius: 12px; padding: 10px 14px; }
.card { background: rgba(19, 48, 90, 0.55); border: 1px solid var(--line); border-radius: 18px; padding: 20px; margin: 14px 0; }
.card h1 { font-size: 1.8rem; }
.cert-title { font-family: var(--head); font-weight: 900; font-size: 1.5rem; color: var(--marigold); margin-bottom: 4px; }

.tbar { height: 8px; background: rgba(255, 255, 255, 0.08); border-radius: 999px; overflow: hidden; margin: 6px 0 14px; }
.tbar span { display: block; height: 100%; background: linear-gradient(90deg, var(--flame), var(--marigold)); transform-origin: left center; }

.picker { display: flex; flex-direction: column; gap: 12px; }
.search { width: 100%; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--sky); color: var(--cream); font-size: 1rem; }
.search::placeholder { color: var(--muted); }
.names { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.name {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left;
  padding: 14px; min-height: 52px; border-radius: 12px; border: 1px solid var(--line); background: rgba(12, 35, 64, 0.8); color: var(--cream); cursor: pointer; font-size: 1rem;
}
.name small { color: var(--muted); font-size: 0.75rem; }
.name.on { background: var(--marigold); color: var(--night); border-color: var(--marigold); font-weight: 600; }
.name:disabled { opacity: 0.4; cursor: not-allowed; }
.sticky { position: sticky; bottom: 0; padding: 12px 0 calc(8px + env(safe-area-inset-bottom, 0px)); background: linear-gradient(transparent, var(--night) 35%); }

/* ---------------- host (big screen, 16:9) ---------------- */
.host { overflow: hidden; }
.stage { height: 100vh; padding: 5vh 5vw 9vh; display: flex; flex-direction: column; justify-content: center; }
.host .lead { font-size: clamp(1.2rem, 2.2vw, 2.2rem); }
.host .lead.wide { max-width: 60ch; }
.hero { font-size: clamp(3rem, 7vw, 7.5rem); }
.hero.small { font-size: clamp(2.4rem, 4.6vw, 5rem); }
.host .kicker { font-size: clamp(1.1rem, 1.6vw, 1.8rem); margin: 0; }
.host .sub { color: var(--muted); font-size: clamp(1rem, 1.4vw, 1.5rem); }
.counter { color: var(--muted); font-size: clamp(1rem, 1.6vw, 1.8rem); margin: 0; }

.pin { max-width: 420px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; text-align: center; }
.pin input { padding: 16px; font-size: 1.4rem; text-align: center; border-radius: 12px; border: 1px solid var(--line); background: var(--sky); color: var(--cream); }
.pin .err { color: var(--rangoli); min-height: 1.5em; }

.lobby { display: grid; grid-template-columns: 1fr auto; grid-template-rows: 1fr auto; gap: 3vh 4vw; height: 100%; align-items: center; }
.lobby .url { font-family: var(--head); font-weight: 800; font-size: clamp(1.4rem, 2.6vw, 3rem); color: var(--marigold); }
.lobby .count { font-size: clamp(1.1rem, 1.8vw, 2rem); }
.join-count { display: flex; align-items: center; gap: 1.6vw; margin-top: 2vh; }
.join-num { font-family: var(--head); font-weight: 900; font-size: clamp(4rem, 9vw, 10rem); line-height: 0.9; color: var(--marigold); text-shadow: 0 0 40px rgba(255, 122, 26, 0.45); font-variant-numeric: tabular-nums; }
.join-num.bump { animation: bump 0.45s cubic-bezier(0.2, 1.6, 0.4, 1); }
@keyframes bump { 0% { transform: scale(1.25); } 100% { transform: scale(1); } }
.join-label { font-size: clamp(1.1rem, 1.8vw, 2rem); line-height: 1.3; }
.lobby-num { font-family: var(--head); font-weight: 900; font-size: 3.4rem; line-height: 1; color: var(--marigold); margin: 0; font-variant-numeric: tabular-nums; }
.qr { background: #FFF8E7; padding: 1.4vw; border-radius: 24px; box-shadow: 0 0 0 6px var(--marigold), 0 0 80px rgba(245, 184, 61, 0.35); }
.qr img { display: block; width: min(34vw, 52vh); height: auto; }
.chips { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; max-height: 18vh; overflow: hidden; }
.chip { padding: 6px 14px; border-radius: 999px; background: rgba(245, 184, 61, 0.14); border: 1px solid var(--line); font-size: clamp(0.9rem, 1.1vw, 1.2rem); }

.question { display: grid; grid-template-columns: 1fr minmax(180px, 22vw); grid-template-areas: 'k t' 's t' 'q t' 'c t'; align-content: center; column-gap: 4vw; row-gap: 1vh; height: 100%; }
.question .kicker { grid-area: k; } .question .sub { grid-area: s; } .question .q-big { grid-area: q; } .question .counter { grid-area: c; } .question .timer { grid-area: t; }
.q-big { font-size: clamp(2.4rem, 5.2vw, 6rem); max-width: 22ch; margin: 2vh 0 3vh; }

.timer { display: flex; flex-direction: column; align-items: center; align-self: center; }
.diya { width: 100%; max-width: 22vw; height: auto; overflow: visible; }
.diya-glow { fill: var(--marigold); opacity: 0.6; filter: blur(18px); }
.diya-flame { transform-origin: 100px 150px; transform-box: view-box; }
.f-outer { fill: var(--flame); }
.f-inner { fill: var(--marigold); }
.diya-bowl { fill: #C8642A; }
.diya-rim { fill: var(--marigold); }
.secs { font-family: var(--head); font-weight: 900; font-size: clamp(2.4rem, 4vw, 4.5rem); line-height: 1; margin-top: 1vh; font-variant-numeric: tabular-nums; }
body.out .secs { color: var(--rangoli); }

.reveal, .finale, .summary, .board, .intro { display: flex; flex-direction: column; justify-content: center; height: 100%; }
.reveal .sub { font-size: clamp(1.2rem, 2vw, 2.2rem); color: var(--cream); max-width: 40ch; }
.award { font-size: clamp(3rem, 7vw, 8rem); color: var(--marigold); text-shadow: 0 0 40px rgba(255, 122, 26, 0.45); margin: 2vh 0 4vh; }
.lamps { display: flex; gap: 2vw; align-items: flex-end; }
.lamp { flex: 1; max-width: 28vw; display: flex; flex-direction: column; gap: 6px; padding: 2.4vh 2vw; border-radius: 22px; border: 1px solid var(--line); background: rgba(19, 48, 90, 0.6); }
.lamp.place-1, .lamp.won { border-color: var(--marigold); background: linear-gradient(180deg, rgba(245, 184, 61, 0.28), rgba(19, 48, 90, 0.7)); box-shadow: 0 0 60px rgba(245, 184, 61, 0.28); }
.lamp.place-1 { order: 0; padding-top: 4vh; padding-bottom: 4vh; }
.lamp-name { font-family: var(--head); font-weight: 900; font-size: clamp(1.6rem, 3.4vw, 3.8rem); }
.lamp-votes { color: var(--muted); font-size: clamp(1rem, 1.5vw, 1.6rem); }

.picture { display: grid; grid-template-columns: 56vw 1fr; gap: 3vw; align-items: center; height: 100%; }
.frame-box { width: 56vw; height: 80vh; display: flex; align-items: center; justify-content: center; }
.frame { position: relative; overflow: hidden; border-radius: 28px; border: 4px solid var(--marigold); box-shadow: 0 0 80px rgba(245, 184, 61, 0.3); background: var(--sky); opacity: 0; }
.frame.ready { opacity: 1; }
.frame img { position: absolute; max-width: none; display: block; }
.frame.reveal, .frame.reveal img { transition: width 1.8s cubic-bezier(0.2, 0.7, 0.1, 1), height 1.8s cubic-bezier(0.2, 0.7, 0.1, 1), left 1.8s cubic-bezier(0.2, 0.7, 0.1, 1), top 1.8s cubic-bezier(0.2, 0.7, 0.1, 1); }
.side { display: flex; flex-direction: column; gap: 1.5vh; }
.side .diya { max-width: 16vw; }
.hint-big { font-size: clamp(2rem, 3.6vw, 4.2rem); color: var(--cream); }
.answer { font-size: clamp(3rem, 7vw, 8rem); color: var(--marigold); text-shadow: 0 0 40px rgba(255, 122, 26, 0.45); }

.awards { list-style: none; padding: 0; margin: 2vh 0; columns: 2; column-gap: 4vw; }
.awards li { break-inside: avoid; display: flex; justify-content: space-between; gap: 2vw; padding: 1vh 0; border-bottom: 1px solid var(--line); font-size: clamp(1rem, 1.5vw, 1.7rem); }
.a-title { color: var(--marigold); font-weight: 400; }
.a-name { font-family: var(--head); font-weight: 800; text-align: right; }
.finale .lamps { margin: 2vh 0 4vh; }

.board ol { list-style: none; padding: 0; margin: 2vh 0 0; max-width: 1100px; }
.board li { display: grid; grid-template-columns: 4ch 1fr auto; gap: 2vw; align-items: baseline; padding: 1.1vh 0; border-bottom: 1px solid var(--line); font-size: clamp(1.2rem, 2.2vw, 2.4rem); }
.board li:nth-child(-n+3) .b-name { color: var(--marigold); }
.rank { color: var(--muted); font-variant-numeric: tabular-nums; }
.b-name { font-family: var(--head); font-weight: 800; }
.b-score { font-variant-numeric: tabular-nums; }

.controls { position: fixed; left: 0; right: 0; bottom: 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 16px; background: rgba(8, 24, 44, 0.9); border-top: 1px solid var(--line); z-index: 20; }
.controls .btn { padding: 8px 14px; font-size: 0.9rem; }
.controls .hint { margin-left: auto; color: var(--muted); font-size: 0.85rem; }
.admin { background: var(--sky); color: var(--cream); border: 1px solid var(--marigold); border-radius: 18px; padding: 24px; width: min(520px, 92vw); }
.admin::backdrop { background: rgba(0, 0, 0, 0.6); }
.admin label { display: block; margin: 16px 0 6px; color: var(--muted); }
.admin .row { display: flex; gap: 8px; }
.admin .row.end { justify-content: flex-end; margin-top: 20px; }
.admin select, .admin input { flex: 1; padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--night); color: var(--cream); }

.wishes { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; height: 100%; gap: 2vh; }
.wishes .hero { color: var(--marigold); text-shadow: 0 0 50px rgba(255, 122, 26, 0.45); margin: 0; }
.wishes .lead { max-width: 46ch; margin: 0 auto; }
.wishes.thanks .hero { color: var(--cream); max-width: 18ch; }
.saal { font-family: var(--head); font-weight: 900; font-size: clamp(2rem, 3.6vw, 4rem); color: var(--cream); margin: 1vh 0 0; }
.lamp-row { display: flex; gap: 3vw; align-items: flex-end; margin: 1vh 0; }
.lamp-row .diya { width: 8vw; max-width: none; }
.flicker { animation: flicker 1.6s ease-in-out infinite; }
@keyframes flicker { 0%, 100% { transform: scale(1, 1); } 40% { transform: scale(0.94, 1.07); } 70% { transform: scale(1.04, 0.95); } }

@media (prefers-reduced-motion: reduce) {
  .join-num.bump { animation: none; }
  .flicker { animation: none; }
  .frame.reveal, .frame.reveal img { transition: none; }
}
@media (max-aspect-ratio: 4/3) {
  .lobby, .question, .picture { grid-template-columns: 1fr; grid-template-areas: none; }
  .question > * { grid-area: auto !important; }
  .frame-box { width: 90vw; height: 50vh; }
}
