@font-face { font-family: "CM Display"; src: url("../assets/fonts/Fraunces.ttf") format("truetype"); font-weight: 100 900; font-display: swap; }
:root {
  --bg: #120e17; --bg2: #1c1622; --card: #221b29; --line: #3a2f43;
  --text: #f5eef7; --muted: #b3a6b8;
  --pink: #ff6fae; --pink-d: #c23c7c; --pink-soft: #ffd1e6;
  --blue: #4fa3ff; --blue-d: #1f63b8; --blue-soft: #cfe6ff;
  --sq-light: #ece3e9; --sq-dark: #9c8b99;
  --danger: #ff5a5f;
  --radius: 16px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: "CM Display", Georgia, "Times New Roman", serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); }
body {
  background: radial-gradient(120% 60% at 0% 0%, rgba(255,111,174,.16), transparent 60%),
              radial-gradient(120% 60% at 100% 100%, rgba(79,163,255,.16), transparent 60%), var(--bg);
  background-size: cover; background-attachment: fixed;
  overscroll-behavior: none; -webkit-user-select: none; user-select: none;
}
textarea { -webkit-user-select: text; user-select: text; }
#app { max-width: 560px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; }
.screen { padding: max(14px, env(safe-area-inset-top)) 14px max(18px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; min-height: 100dvh; }
h1, h2, h3 { margin: 0; }
h2 { font-size: 18px; letter-spacing: .2px; }
p { line-height: 1.45; margin: 0; }
.muted { color: var(--muted); } .small { font-size: 13px; } .center { text-align: center; }

/* brand */
.brand { text-align: center; padding: 8px 0 2px; }
.brand .company { font-size: 13px; letter-spacing: 3px; text-transform: uppercase; color: var(--muted); }
.brand .presents { font-size: 12px; font-style: italic; color: var(--muted); margin: 2px 0; }
.brand .title { font-family: var(--display); font-size: 42px; font-weight: 700; line-height: 1;
  background: linear-gradient(90deg, var(--pink), #fff 50%, var(--blue)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand.big { padding-top: 10vh; } .brand.big .title { font-size: 56px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.brand.has-logo { padding: 4px 0 0; }
.brand .logo-full { display: block; margin: 0 auto; width: min(250px, 66vw); height: auto; filter: drop-shadow(0 6px 18px rgba(224, 24, 92, .25)); }
.brand.has-logo.big { padding-top: 4vh; } .brand.has-logo.big .logo-full { width: min(340px, 88vw); }
.mini-brand.has-logo { display: flex; align-items: center; gap: 6px; height: 42px; }
.mini-brand .mini-mark { height: 40px; width: auto; }
.mini-brand .mini-word { height: 30px; width: auto; }
.brand .logo { max-width: 220px; max-height: 90px; display: block; margin: 0 auto; }
.brand .title-art { max-width: 90%; max-height: 120px; display: block; margin: 0 auto; }

.card { background: color-mix(in srgb, var(--card) 92%, transparent); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 10px; }

/* buttons */
.btn { appearance: none; border: 1px solid var(--line); background: var(--bg2); color: var(--text); font: 600 16px var(--font);
  border-radius: 12px; padding: 13px 16px; cursor: pointer; text-align: center; text-decoration: none; display: inline-block; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.wide { width: 100%; }
.btn.primary { background: linear-gradient(90deg, var(--pink-d), var(--blue-d)); border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn.link { background: none; border: none; color: var(--muted); text-decoration: underline; font-weight: 500; font-size: 14px; padding: 6px; }
.icon-btn { background: var(--bg2); border: 1px solid var(--line); color: var(--text); width: 42px; height: 42px; border-radius: 12px; font-size: 20px; cursor: pointer; }

/* gate */
.gate .card { margin-top: 24px; align-items: stretch; text-align: center; }
.badge18 { align-self: center; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 22px;
  border: 3px solid var(--pink); box-shadow: 0 0 0 3px var(--blue) inset; }

/* setup */
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.opt { appearance: none; background: var(--bg2); border: 1px solid var(--line); color: var(--text); border-radius: 12px; padding: 12px 10px; font: 600 15px var(--font); cursor: pointer; }
.opt small { display: block; font-weight: 400; font-size: 12px; color: var(--muted); margin-top: 3px; }
.opt.on { border-color: transparent; background: linear-gradient(135deg, rgba(255,111,174,.35), rgba(79,163,255,.35)); box-shadow: 0 0 0 2px #fff3 inset; }
.opt:disabled { opacity: .45; }
.sides { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.side { display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: 12px; border: 1px solid var(--line); }
.side img { width: 40px; height: 40px; } .side small { display: block; color: var(--muted); font-size: 12px; }
.side.pink { background: rgba(255,111,174,.12); border-color: rgba(255,111,174,.5); }
.side.blue { background: rgba(79,163,255,.12); border-color: rgba(79,163,255,.5); }
table.times { width: 100%; border-collapse: collapse; font-size: 14px; }
table.times th, table.times td { padding: 6px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.times th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; }
table.times .hl { color: #fff; background: rgba(255,255,255,.06); font-weight: 600; }
table.qc td:first-child { width: 34%; }
textarea { width: 100%; background: var(--bg2); color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 10px; font: 15px var(--font); resize: vertical; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; }
.check input { margin-top: 3px; accent-color: var(--pink); }
.confirm-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn.confirm.pink { border-color: var(--pink); color: var(--pink-soft); }
.btn.confirm.blue { border-color: var(--blue); color: var(--blue-soft); }
.btn.confirm.pink.on { background: var(--pink-d); color: #fff; }
.btn.confirm.blue.on { background: var(--blue-d); color: #fff; }

/* board */
.topbar { display: flex; justify-content: space-between; align-items: center; }
.mini-brand span { display: block; font-size: 10px; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); }
.mini-brand b { font-family: var(--display); font-size: 22px; }
.player-row { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; padding: 6px 10px; border-radius: 12px; border: 1px solid transparent; min-height: 40px; }
.player-row .dot-ind { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.player-row.pink .dot-ind { background: var(--pink); } .player-row.blue .dot-ind { background: var(--blue); }
.player-row.active.pink { border-color: var(--pink); background: rgba(255,111,174,.12); }
.player-row.active.blue { border-color: var(--blue); background: rgba(79,163,255,.12); }
.tray { display: flex; flex-wrap: wrap; margin-left: auto; }
.tray img { width: 20px; height: 20px; margin-left: -4px; }
.board { display: grid; grid-template-columns: repeat(8, 1fr); width: 100%; aspect-ratio: 1; border-radius: 10px; overflow: hidden;
  box-shadow: 0 10px 40px rgba(0,0,0,.5), 0 0 0 2px var(--line); }
.sq { position: relative; border: 0; padding: 0; margin: 0; aspect-ratio: 1; display: grid; place-items: center; cursor: pointer; }
.sq.light { background: var(--sq-light); } .sq.dark { background: var(--sq-dark); }
.sq img { width: 88%; height: 88%; pointer-events: none; filter: drop-shadow(0 1px 1px rgba(0,0,0,.35)); }
.sq.last::before { content: ""; position: absolute; inset: 0; background: rgba(255, 214, 90, .38); }
.sq.sel::before { content: ""; position: absolute; inset: 0; background: rgba(255, 214, 90, .7); }
.sq.dot::after { content: ""; position: absolute; width: 28%; height: 28%; border-radius: 50%; background: rgba(30, 20, 40, .45); }
.sq.cap::after { content: ""; position: absolute; inset: 4%; border-radius: 50%; border: 5px solid rgba(30, 20, 40, .45); }
.sq.check { background: radial-gradient(circle, #ff3b3b 0%, #ff3b3bbb 40%, transparent 75%), var(--sq-light); }
.sq img { position: relative; z-index: 1; }
.cf, .cr { position: absolute; font-size: 10px; font-weight: 700; color: rgba(40,25,45,.55); z-index: 2; }
.cf { right: 3px; bottom: 1px; } .cr { left: 3px; top: 1px; }
.status { display: flex; justify-content: center; gap: 8px; align-items: center; min-height: 36px; }
.turn-pill, .check-pill { padding: 7px 16px; border-radius: 999px; font-weight: 700; }
.turn-pill.pink { background: var(--pink); color: #3a0820; } .turn-pill.blue { background: var(--blue); color: #061d3d; }
.check-pill { background: var(--danger); color: #fff; animation: pulse 1s infinite alternate; }
@keyframes pulse { to { transform: scale(1.06); } }
.foot { text-align: center; }

/* task */
.task-head { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.task-piece { width: 64px; height: 64px; flex: none; filter: drop-shadow(0 3px 8px rgba(0,0,0,.5)); }
.kicker { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 1.5px; }
.task-head h2 { font-family: var(--display); font-size: 28px; }
.roles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.role { border-radius: 12px; padding: 8px 10px; border: 1px solid; }
.role small { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 1px; }
.role.pink { border-color: var(--pink); background: rgba(255,111,174,.12); } .role.blue { border-color: var(--blue); background: rgba(79,163,255,.12); }
.task-text { font-size: 18px; line-height: 1.5; }
.task-text.big { font-family: var(--display); font-size: 26px; }
.timer-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.ring { --p: 1; width: 168px; height: 168px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--pink) 0turn, var(--blue) calc(var(--p) * 1turn), #ffffff14 calc(var(--p) * 1turn)); }
.timer { width: 146px; height: 146px; border-radius: 50%; background: var(--bg); display: grid; place-items: center; font: 700 44px var(--font); font-variant-numeric: tabular-nums; }
.task-screen.done .timer { color: var(--danger); animation: pulse .3s infinite alternate; }
.btn.start { font-size: 20px; padding: 16px; }

/* finished */
.finished h2 { font-family: var(--display); font-size: 30px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 6px 0; }
.stats div { background: var(--bg2); border-radius: 12px; padding: 10px; }
.stats b { font-size: 24px; display: block; } .stats small { color: var(--muted); }

/* modal */
.modal-back { position: fixed; inset: 0; background: rgba(5,3,8,.7); display: grid; place-items: center; padding: 16px; z-index: 50; backdrop-filter: blur(4px); }
.modal { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; width: min(440px, 100%); max-height: 90vh; overflow: auto; display: flex; flex-direction: column; gap: 10px; }
.modal-actions { display: flex; flex-direction: column; gap: 8px; }
.promo-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; }
.promo-pic img { width: 100%; max-width: 64px; } .promo-pic small, .promo-pic em { display: block; font-size: 11px; color: var(--muted); }
.modal-actions .promo-btn { display: inline-block; }
.modal:has(.promo-row) .modal-actions { display: grid; grid-template-columns: repeat(4, 1fr); }
.modal:has(.promo-row) .modal-actions .ghost { grid-column: 1 / -1; }
.btn.promo-btn { padding: 10px 4px; font-size: 13px; }
.btn.promo-btn.pink { border-color: var(--pink); } .btn.promo-btn.blue { border-color: var(--blue); }

.debug { position: fixed; bottom: 4px; left: 4px; font-size: 10px; background: #ff0; color: #000; padding: 2px 6px; border-radius: 4px; z-index: 60; }

/* rook (untimed) */
.untimed { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; padding: 18px 12px; border: 2px dashed var(--line); border-radius: var(--radius); }
.untimed b { font-size: 20px; } .untimed span { color: var(--muted); font-size: 14px; }
.rook-banner { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 12px; font-weight: 700; font-size: 14px;
  background: linear-gradient(90deg, rgba(255,111,174,.25), rgba(79,163,255,.25)); border: 1px solid #ffffff33; animation: glow 1.6s infinite alternate; }
.rook-banner img { width: 26px; height: 26px; flex: none; }
@keyframes glow { to { box-shadow: 0 0 16px rgba(255,111,174,.35); } }
.closed .card { margin-top: 24px; }

/* two phones */
.seg.lobby .btn { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 8px; }
.seg.lobby .btn small { font-weight: 400; font-size: 11px; opacity: .8; }
.join-form { display: flex; gap: 8px; margin-top: 10px; }
.join-form input { flex: 1; min-width: 0; font: 700 26px/1 var(--display); letter-spacing: 6px; text-align: center; text-transform: uppercase;
  background: var(--bg2); color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.join-form input:focus { outline: 2px solid var(--pink); }
.room { text-align: center; border: 1px dashed var(--line); border-radius: 14px; padding: 10px 12px; margin: 10px 0 6px; }
.room > small { text-transform: uppercase; letter-spacing: 2px; font-size: 11px; color: var(--muted); }
.room-code { font: 800 44px/1.1 var(--display); letter-spacing: 10px; padding-left: 10px; color: var(--pink-soft); user-select: all; }
.room p { margin: 6px 0; }
.net-status { font-size: 13px; color: var(--muted); }
.net-status.connected { color: #7be0a4; }
.small-h { font-size: 13px; margin: 12px 0 6px; color: var(--muted); text-transform: uppercase; letter-spacing: 1.5px; }
.side.mine { box-shadow: 0 0 0 2px currentColor inset; }
.side .you, .player-row .you, .role .you { display: inline-block; font-style: normal; font-size: 10px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase;
  background: rgba(255,255,255,.12); border-radius: 6px; padding: 1px 6px; margin-left: 6px; vertical-align: middle; }
.side .you { margin: 4px 0 0; }
.btn.confirm.static { display: flex; align-items: center; justify-content: center; opacity: .75; cursor: default; }
.net-banner { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 8px; justify-content: center; text-align: center;
  padding: 8px 12px; font-size: 13px; font-weight: 600; background: #3a2a10; color: #ffe2a8; border-bottom: 1px solid #8a6a2a; }
.net-banner.waiting { background: #1d2333; color: #cfe0ff; border-color: #3e5a8a; }
.net-banner .spinner { width: 12px; height: 12px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .9s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.draw-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; justify-content: center; padding: 8px 10px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--bg2); font-size: 14px; font-weight: 600; }
.draw-bar .btn { padding: 6px 12px; min-height: 0; font-size: 13px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; transition: .25s; z-index: 200;
  background: #000c; color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; pointer-events: none; max-width: 90vw; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* back to all games (naughtydice.com home) */
.home-row { display: flex; justify-content: flex-start; margin-bottom: -4px; }
.home-link { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 6px 12px 6px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg2); color: var(--text); font: 600 14px var(--font); text-decoration: none; white-space: nowrap; }
.home-link .arrow { font-size: 16px; line-height: 1; color: var(--pink-soft); }
.home-link:hover, .home-link:focus-visible { border-color: var(--pink); outline: none; }
.top-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.topbar .home-link { min-height: 42px; border-radius: 12px; }
@media (max-width: 340px) { .topbar .home-link .lbl { display: none; } .topbar .home-link { padding: 6px 12px; } }

/* pre-game shower tip (setup screen) */
.fresh-tip { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--radius);
  border: 1px dashed rgba(255,111,174,.55); background: linear-gradient(90deg, rgba(255,111,174,.12), rgba(79,163,255,.12)); }
.fresh-tip .tip-icon { font-size: 24px; line-height: 1; flex: none; }
.fresh-tip p { font-size: 14px; } .fresh-tip b { color: var(--pink-soft); }
