@font-face { font-family: Nunito; src: url("/fonts/Nunito.woff2") format("woff2"); font-weight: 200 900; font-display: swap; }
:root {
  --bg: #fff8e7; --ink: #1a2332; --ink-soft: #4a5566; --sun: #ffd100; --sun-soft: #fff3b0;
  --red: #e31c3d; --red-soft: #ffd6dc; --sky: #1ea7e1; --sky-soft: #d4f0fc; --grass: #2e9b3d; --grass-soft: #d8f5dc;
  --orange: #ff7a00; --orange-soft: #ffe0c2; --card: #fff; --edge: #f0d59a; --night: #16213a; --night-2: #22305a;
  --radius: 20px; --shadow: 0 6px 0 rgba(26,35,50,.12), 0 10px 24px rgba(26,35,50,.08);
  --font: Nunito, ui-rounded, "Arial Rounded MT Bold", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font); color: var(--ink); line-height: 1.4; min-height: 100vh; overflow-x: hidden;
  background: radial-gradient(700px 360px at 0% -10%, #fff3b0 0%, transparent 55%), radial-gradient(600px 320px at 100% 0%, #d4f0fc 0%, transparent 50%), var(--bg);
  -webkit-tap-highlight-color: transparent;
}
body.is-night { background: radial-gradient(500px 300px at 80% -5%, #34477e 0%, transparent 60%), var(--night); color: #f3f6ff; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.boot { text-align: center; padding: 40px; }
.wrap { max-width: 480px; margin: 0 auto; padding: 14px 16px 24px; }
.wrap.home { padding-bottom: 40px; }
h1, h2, h3 { margin: 0; line-height: 1.15; font-weight: 900; }
h1 { font-size: 30px; }
h2 { font-size: 23px; }
h3 { font-size: 18px; }
p { margin: 6px 0; }
.muted { color: var(--ink-soft); }
body.is-night .muted { color: #b8c3e0; }
.small { font-size: 14px; }
.center { text-align: center; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrapit { flex-wrap: wrap; }
.grow { flex: 1; }
.stack > * + * { margin-top: 12px; }
.icon { width: 1em; height: 1em; vertical-align: -0.12em; }

/* top bar */
.top { display: flex; align-items: center; gap: 10px; padding: 6px 0 12px; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 900; font-size: 19px; text-decoration: none; color: inherit; }
.logo svg { width: 34px; height: 34px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; background: var(--card); border: 2px solid var(--ink); font-weight: 800; font-size: 14px; }
body.is-night .chip { background: var(--night-2); border-color: #5b6ea8; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--grass); display: inline-block; }
.dot.off { background: #b8bfc9; }
.dot.warn { background: var(--orange); }

/* cards & buttons */
.card { background: var(--card); border: 2.5px solid var(--ink); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
body.is-night .card { background: var(--night-2); border-color: #4a5d96; box-shadow: none; }
.card + .card, .card + .sec, .sec + .card { margin-top: 14px; }
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 58px; padding: 12px 18px;
  border: 2.5px solid var(--ink); border-radius: 16px; background: var(--sun); color: var(--ink); font-weight: 900; font-size: 19px;
  box-shadow: 0 5px 0 var(--ink); transition: transform .06s, box-shadow .06s; text-decoration: none; user-select: none;
}
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.red { background: var(--red); color: #fff; }
.btn.sky { background: var(--sky); color: #fff; }
.btn.green { background: var(--grass); color: #fff; }
.btn.orange { background: var(--orange); color: #fff; }
.btn.white { background: #fff; }
.btn.ghost { background: transparent; box-shadow: none; border-style: dashed; min-height: 48px; font-size: 16px; }
body.is-night .btn.ghost { border-color: #8fa0d0; color: #f3f6ff; }
.btn.sm { min-height: 44px; font-size: 16px; padding: 8px 14px; border-radius: 12px; box-shadow: 0 3px 0 var(--ink); width: auto; }
.btn.huge { min-height: 96px; font-size: 30px; border-radius: 22px; }
.link { background: none; border: 0; padding: 8px; text-decoration: underline; font-weight: 700; color: inherit; }

/* home */
.hero { text-align: center; padding: 8px 4px 6px; }
.hero h1 { font-size: 33px; }
.hero h1 em { font-style: normal; color: var(--red); }
.hero p { font-size: 17px; }
.gamecard { display: grid; grid-template-columns: 76px 1fr; gap: 12px; align-items: center; }
.gamecard .art { width: 76px; height: 76px; border-radius: 18px; border: 2.5px solid var(--ink); display: grid; place-items: center; }
.gamecard .art svg { width: 62px; height: 62px; }
.gamecard .btn { grid-column: 1 / -1; }
.tag { display: inline-block; font-size: 13px; font-weight: 800; padding: 2px 9px; border-radius: 999px; background: var(--sun-soft); border: 1.5px solid var(--ink); }
.bg-red { background: var(--red-soft); } .bg-sky { background: var(--sky-soft); } .bg-sun { background: var(--sun-soft); } .bg-grass { background: var(--grass-soft); } .bg-orange { background: var(--orange-soft); }
.codebox { display: flex; gap: 10px; }
.codebox input { flex: 1; min-width: 0; height: 58px; border: 2.5px solid var(--ink); border-radius: 16px; text-align: center; font-size: 28px; font-weight: 900; letter-spacing: .3em; text-transform: uppercase; background: #fff; }
.codebox .btn { width: auto; flex: 0 0 auto; }
.soon { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.soon span { font-size: 14px; font-weight: 700; padding: 5px 10px; border-radius: 999px; border: 2px dashed #c9b37a; background: #fffdf5; }
.sec { margin-top: 26px; }
.sec-title { font-size: 14px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); margin: 0 0 8px 4px; }
.rules-card { background: #fffdf5; border-style: dashed; box-shadow: none; }
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper button { width: 44px; height: 44px; border-radius: 12px; border: 2.5px solid var(--ink); background: #fff; font-size: 24px; font-weight: 900; line-height: 1; }
.stepper output { min-width: 34px; text-align: center; font-size: 22px; font-weight: 900; }
.field { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; }
.field + .field { border-top: 1.5px solid #f0e2bd; }
body.is-night .field + .field { border-top-color: #3a4a7a; }
.field label, .field .lbl { font-weight: 800; }
.field .hint { display: block; font-weight: 600; font-size: 13px; color: var(--ink-soft); }
.toggle { position: relative; width: 58px; height: 34px; border-radius: 999px; border: 2.5px solid var(--ink); background: #e6e1d4; flex: 0 0 auto; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 23px; height: 23px; border-radius: 50%; background: #fff; border: 2px solid var(--ink); transition: left .15s; }
.toggle[aria-pressed="true"] { background: var(--grass); }
.toggle[aria-pressed="true"]::after { left: 26px; }
footer { text-align: center; font-size: 13px; color: var(--ink-soft); margin-top: 28px; }

/* text input */
.input { width: 100%; height: 58px; border: 2.5px solid var(--ink); border-radius: 16px; padding: 0 16px; font-size: 20px; font-weight: 800; background: #fff; color: var(--ink); }
.input:focus, .codebox input:focus { outline: 4px solid var(--sky); outline-offset: 1px; }

/* lobby */
.roomcode { text-align: center; }
.roomcode .letters { font-size: 58px; font-weight: 900; letter-spacing: .14em; line-height: 1; margin: 6px 0 2px; padding-left: .14em; }
.roomcode .letters span { display: inline-block; }
.roomcode .letters span:nth-child(1) { color: var(--red); } .roomcode .letters span:nth-child(2) { color: var(--sky); }
.roomcode .letters span:nth-child(3) { color: var(--grass); } .roomcode .letters span:nth-child(4) { color: var(--orange); }
.qr { display: block; width: 190px; height: 190px; margin: 10px auto 0; border: 2.5px solid var(--ink); border-radius: 14px; background: #fff; padding: 6px; }
.players { list-style: none; margin: 0; padding: 0; }
.players li { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.players li + li { border-top: 1.5px solid #f0e2bd; }
body.is-night .players li + li { border-top-color: #3a4a7a; }
.av { width: 40px; height: 40px; border-radius: 50%; border: 2.5px solid var(--ink); display: grid; place-items: center; font-weight: 900; font-size: 18px; flex: 0 0 auto; color: var(--ink); }
.av.c0 { background: var(--sun); } .av.c1 { background: var(--sky); } .av.c2 { background: var(--red-soft); } .av.c3 { background: var(--grass-soft); } .av.c4 { background: var(--orange); } .av.c5 { background: var(--sky-soft); }
.av.dead { background: #c7ccd6 !important; text-decoration: line-through; }
.pname { font-weight: 800; font-size: 17px; }
.kick { border: 2px solid var(--ink); background: #fff; border-radius: 10px; font-weight: 800; padding: 6px 10px; font-size: 14px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg button { border: 2.5px solid var(--ink); border-radius: 16px; background: #fff; padding: 10px 8px; font-weight: 900; font-size: 17px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.seg button svg { width: 46px; height: 46px; }
.seg button[aria-pressed="true"] { background: var(--sun); box-shadow: 0 4px 0 var(--ink); }
.dock { position: sticky; bottom: 0; z-index: 5; margin: 16px -16px 0; padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); background: var(--bg); box-shadow: 0 -8px 16px rgba(255, 248, 231, .95); }
body.is-night .dock { background: var(--night); box-shadow: 0 -8px 16px rgba(22, 33, 58, .95); }
.dock .note { text-align: center; font-weight: 800; font-size: 15px; margin-bottom: 8px; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-weight: 800; font-size: 13px; border: 2px solid var(--ink); background: #fff; }
body.is-night .pill { background: var(--night-2); border-color: #6b7fb8; }

/* game shared */
.banner { border-radius: var(--radius); padding: 14px 16px; border: 2.5px solid var(--ink); font-weight: 800; }
.timer { font-size: 46px; font-weight: 900; text-align: center; font-variant-numeric: tabular-nums; line-height: 1; }
.timer.low { color: var(--red); animation: pulse 1s infinite; }
@keyframes pulse { 50% { transform: scale(1.06); } }
.phase-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.choice { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 10px 12px; min-height: 60px; border: 2.5px solid var(--ink); border-radius: 16px; background: #fff; font-weight: 800; font-size: 18px; color: var(--ink); }
.choice + .choice { margin-top: 10px; }
.choice[aria-pressed="true"] { background: var(--sun); box-shadow: 0 4px 0 var(--ink); }
.choice[disabled] { opacity: .45; }
body.is-night .choice { background: #2b3a6a; color: #f3f6ff; border-color: #6b7fb8; }
body.is-night .choice[aria-pressed="true"] { background: var(--red); border-color: #fff; box-shadow: 0 4px 0 #0b1226; }
.choice .who { margin-left: auto; display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.bar { height: 10px; border-radius: 999px; background: #efe6cf; overflow: hidden; margin-top: 6px; }
.bar > i { display: block; height: 100%; background: var(--red); border-radius: 999px; }
.votecount { font-size: 22px; font-weight: 900; min-width: 30px; text-align: right; }

/* role card */
.rolecard { position: relative; height: 330px; border-radius: 26px; border: 3px solid var(--ink); overflow: hidden; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: none; box-shadow: var(--shadow); }
.rolecard .cover, .rolecard .face { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 18px; text-align: center; }
.rolecard .cover { background: repeating-linear-gradient(45deg, #ffd100 0 18px, #ffc400 18px 36px); }
.rolecard .cover .eye { width: 92px; height: 92px; border-radius: 50%; background: #fff; border: 3px solid var(--ink); display: grid; place-items: center; }
.rolecard .cover b { font-size: 24px; }
.rolecard .face { visibility: hidden; }
.rolecard.peek .face { visibility: visible; }
.rolecard.peek .cover { visibility: hidden; }
.face.mafia { background: var(--red); color: #fff; } .face.doctor { background: var(--grass); color: #fff; }
.face.detective { background: var(--sky); color: #fff; } .face.villager { background: var(--sun); color: var(--ink); }
.face .rname { font-size: 44px; font-weight: 900; }
.face .ricon { width: 96px; height: 96px; border-radius: 50%; background: #fff; border: 3px solid var(--ink); display: grid; place-items: center; color: var(--ink); }
.face .ricon svg { width: 70px; height: 70px; }
.mini-peek { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 14px; border: 2.5px dashed currentColor; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: none; font-weight: 800; }
.mini-peek .secret { visibility: hidden; }
.mini-peek.peek .secret { visibility: visible; }
.result { padding: 14px; border-radius: 16px; font-weight: 900; font-size: 20px; text-align: center; border: 2.5px solid #fff; }
.result.bad { background: var(--red); color: #fff; } .result.good { background: var(--grass); color: #fff; }
.moon { width: 58px; height: 58px; }
.verdict { text-align: center; padding: 26px 16px; }
.verdict .big { font-size: 34px; font-weight: 900; margin: 8px 0; }

/* fishbowl */
.wordcard { background: #fff; border: 3px solid var(--ink); border-radius: 26px; min-height: 210px; display: grid; place-items: center; text-align: center; padding: 20px; font-size: 40px; font-weight: 900; line-height: 1.1; box-shadow: var(--shadow); word-break: break-word; }
.teamrow { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 16px; border: 2.5px solid var(--ink); }
.teamrow + .teamrow { margin-top: 8px; }
.teamrow .score { margin-left: auto; font-size: 30px; font-weight: 900; }
.team-sun { background: var(--sun); } .team-sky { background: var(--sky); color: #fff; } .team-red { background: var(--red); color: #fff; } .team-grass { background: var(--grass); color: #fff; }
.teamrow .members { font-size: 14px; font-weight: 700; opacity: .9; }
.tbadge { display: inline-block; padding: 2px 10px; border-radius: 999px; border: 2px solid var(--ink); font-weight: 900; font-size: 14px; }
.check { color: var(--grass); font-weight: 900; }
.wordlist { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.wordlist span { padding: 4px 10px; border-radius: 999px; background: var(--grass-soft); border: 2px solid var(--ink); font-weight: 800; font-size: 14px; }

#toast { position: fixed; left: 50%; top: 14px; transform: translate(-50%, -160%); visibility: hidden; background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 14px; font-weight: 800; transition: transform .25s; z-index: 50; max-width: 92vw; }
#toast.show { transform: translate(-50%, 0); visibility: visible; }
.offline-bar { background: var(--orange); color: #fff; text-align: center; font-weight: 800; padding: 6px; border-radius: 12px; margin-bottom: 10px; }

.banner + .card, .card + .banner { margin-top: 12px; }
.banner.sky { background: var(--sky); color: #fff; }
.verdict .av { margin: 0 auto; width: 64px; height: 64px; font-size: 28px; }
