/* Fawatim PD Studio - styles. Colours come from the palette chosen in core.js */
:root {
  --bg: #0e0e10; --surface: #18181b; --surface2: #222226; --ink: #f6f3ec; --muted: #a8a59c; --line: #2e2e33;
  --primary: #c9a646; --on-primary: #141414; --accent: #b9bdc6;
  --c1: #c9a646; --c2: #b9bdc6; --c3: #e07a5f; --c4: #6fb3a8; --c5: #8f86d9; --c6: #e3c16f;
  --ok: #3fb67b; --bad: #e0565b; --radius: 18px; --radius-sm: 12px;
  --shadow: 0 1px 0 rgba(255,255,255,.03), 0 8px 24px rgba(0,0,0,.18);
  --font-head: "Poppins", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-body: "Inter", 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(--ink); font-family: var(--font-body); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; min-height: 100vh; display: flex; flex-direction: column; }
h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.2; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); font-weight: 700; }
h2 { font-size: clamp(1.25rem, 3vw, 1.6rem); font-weight: 600; }
h3 { font-size: 1.1rem; font-weight: 600; }
p { margin: 0 0 .8em; }
a { color: var(--primary); }
button, input, select, textarea { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.hidden { display: none !important; }
main { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 20px 16px 40px; }
main.narrow { max-width: 560px; }
main.wide { max-width: 1500px; }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar .inner { max-width: 1500px; margin: 0 auto; display: flex; align-items: center; gap: 12px; padding: 10px 16px; min-height: 58px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); min-width: 0; }
.brand .mark { width: 34px; height: 34px; border-radius: 10px; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; flex: none; }
.brand > span { min-width: 0; overflow: hidden; }
.brand img { height: 26px; width: auto; }
.brand .name { font-family: var(--font-head); font-weight: 600; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand .sub { font-size: .75rem; color: var(--muted); display: block; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { flex: 1; }
.seg { display: inline-flex; background: var(--surface2); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: 5px 11px; border-radius: 999px; font-size: .8rem; font-weight: 600; cursor: pointer; color: var(--muted); min-height: 30px; }
.seg button.on { background: var(--primary); color: var(--on-primary); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: var(--surface2); color: var(--ink); padding: 10px 16px; border-radius: 999px; font-weight: 600; font-size: .95rem; cursor: pointer; min-height: 44px; text-decoration: none; transition: transform .08s ease, background .15s ease, border-color .15s; white-space: nowrap; }
.btn:hover { border-color: var(--primary); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 6px 12px; min-height: 36px; font-size: .85rem; }
.btn.icon { padding: 0; width: 44px; }
.btn.sm.icon { width: 36px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn svg, .ico { width: 18px; height: 18px; flex: none; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }

/* cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card.pad-lg { padding: 28px; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.tile { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 20px 14px; }
.tile .ic { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: color-mix(in srgb, var(--primary) 16%, transparent); color: var(--primary); }
.tile .ic svg { width: 24px; height: 24px; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: .75rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--surface2); border: 1px solid var(--line); color: var(--muted); }
.badge.gold { color: var(--primary); border-color: color-mix(in srgb, var(--primary) 40%, transparent); }
.badge.live { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }

/* forms */
label.f { display: block; font-size: .85rem; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.field { position: relative; }
.field + .field, .field + .row, .row + .field { margin-top: 14px; }
input:not([type]), input[type=text], input[type=password], input[type=number], input[type=url], select, textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 1rem; min-height: 46px; outline: none; transition: border-color .15s; }
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
.field.has-mic input, .field.has-mic textarea { padding-right: 52px; }
.mic { position: absolute; right: 6px; bottom: 6px; width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface2); display: grid; place-items: center; cursor: pointer; color: var(--muted); }
.mic.rec { background: var(--bad); color: #fff; border-color: var(--bad); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .65; } }
.code-input { font-family: var(--font-head); font-size: 2rem !important; text-align: center; letter-spacing: .3em; font-weight: 700; }

/* answer options */
.opts { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .opts.two { grid-template-columns: 1fr 1fr; } }
.opt { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; padding: 16px 18px; min-height: 64px; border-radius: 16px; border: 2px solid transparent; background: var(--surface2); cursor: pointer; font-weight: 600; font-size: 1.05rem; color: var(--ink); }
.opt .k { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-family: var(--font-head); font-weight: 700; flex: none; color: #fff; }
.opt:nth-child(6n+1) .k { background: #d1495b; } .opt:nth-child(6n+2) .k { background: #2e86ab; } .opt:nth-child(6n+3) .k { background: #c99a2e; }
.opt:nth-child(6n+4) .k { background: #3f9b6b; } .opt:nth-child(6n+5) .k { background: #7d5ba6; } .opt:nth-child(6n+6) .k { background: #e07a3f; }
.opt.sel { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 14%, var(--surface2)); }
.opt.right { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 18%, var(--surface2)); }
.opt.wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 14%, var(--surface2)); opacity: .9; }
.opt[disabled] { cursor: default; }
.scale { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.scale button { width: 52px; height: 52px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface2); font-weight: 700; font-size: 1.1rem; cursor: pointer; }
.scale button.sel { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.scale-labels { display: flex; justify-content: space-between; font-size: .8rem; color: var(--muted); margin-top: 8px; }

/* results */
.bars { display: grid; gap: 10px; }
.bar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; }
.bar .lbl { font-weight: 600; overflow-wrap: anywhere; }
.bar .val { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600; }
.bar .track { grid-column: 1 / -1; height: 14px; background: var(--surface2); border-radius: 999px; overflow: hidden; }
.bar .fill { height: 100%; border-radius: 999px; background: var(--primary); transition: width .5s ease; }
.bar.correct .fill { background: var(--ok); }
.bars.reveal .bar:not(.correct) .fill { background: color-mix(in srgb, var(--muted) 45%, transparent); }
.bar.correct .lbl::after { content: " \2713"; color: var(--ok); }
.bigstat { font-family: var(--font-head); font-size: 3rem; font-weight: 700; line-height: 1; color: var(--primary); }
.cloud { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px 16px; padding: 12px; min-height: 120px; }
.cloud span { font-family: var(--font-head); font-weight: 600; line-height: 1.1; transition: font-size .4s; }
.answers { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.answer { background: var(--surface2); border-radius: 14px; padding: 12px 14px; border: 1px solid var(--line); overflow-wrap: anywhere; }
.answer .who { font-size: .75rem; color: var(--muted); margin-top: 6px; }

/* idea wall */
.wall { display: grid; gap: 14px; grid-template-columns: repeat(var(--cols, 1), minmax(220px, 1fr)); overflow-x: auto; padding-bottom: 6px; }
.wall-col h4 { font-size: .9rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 10px; display: flex; justify-content: space-between; }
.wall-col .notes { display: grid; gap: 10px; }
.note { border-radius: 14px; padding: 12px 14px 10px; color: #1d1b16; position: relative; overflow-wrap: anywhere; box-shadow: 0 2px 0 rgba(0,0,0,.08); animation: pop .25s ease; }
@keyframes pop { from { transform: scale(.94); opacity: 0; } }
.note.yellow { background: #f7e08a; } .note.pink { background: #f5b8c6; } .note.blue { background: #a9d3f0; }
.note.green { background: #b9e3b4; } .note.orange { background: #f8c48f; } .note.purple { background: #d3c1f0; }
.note .meta { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: .75rem; color: rgba(0,0,0,.6); gap: 6px; }
.note .vote { border: 0; background: rgba(255,255,255,.55); border-radius: 999px; padding: 4px 10px; font-weight: 700; font-size: .8rem; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; color: #1d1b16; min-height: 30px; }
.note .vote.on { background: #1d1b16; color: #f7e08a; }
.note.is-hidden { opacity: .4; outline: 2px dashed rgba(0,0,0,.4); }
.swatches { display: flex; gap: 8px; }
.swatches button { width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.swatches button.on { border-color: var(--ink); }

/* leaderboard */
.lb { display: grid; gap: 8px; }
.lb .r { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 12px; background: var(--surface2); border-radius: 14px; padding: 10px 14px; border: 1px solid var(--line); }
.lb .r .pos { font-family: var(--font-head); font-weight: 700; color: var(--muted); text-align: center; }
.lb .r:nth-child(1) .pos { color: var(--primary); font-size: 1.3rem; }
.lb .r .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb .r .sc { font-variant-numeric: tabular-nums; font-weight: 700; }

/* timer */
.timer { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-head); font-weight: 700; font-variant-numeric: tabular-nums; }
.timer .ringwrap { width: 44px; height: 44px; }
.progress { height: 6px; border-radius: 999px; background: var(--surface2); overflow: hidden; }
.progress > div { height: 100%; background: var(--primary); transition: width .25s linear; }

/* toast, modal */
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
#toast .t { background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 14px; font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,.25); animation: pop .2s ease; text-align: center; }
#toast .t.err { background: var(--bad); color: #fff; }
.modal { position: fixed; inset: 0; z-index: 80; background: rgba(0,0,0,.55); display: grid; place-items: center; padding: 16px; }
.modal .box { width: min(640px, 100%); max-height: 90vh; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 22px; }
.modal .box.wide { width: min(900px, 100%); }

/* host layout */
.tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: none; border: 1px solid var(--line); background: var(--surface); padding: 8px 14px; border-radius: 999px; font-weight: 600; font-size: .9rem; cursor: pointer; color: var(--muted); min-height: 40px; display: inline-flex; align-items: center; gap: 6px; }
.tabs button.on { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.act-list { display: grid; gap: 8px; }
.act-item { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 12px; background: var(--surface2); border: 1px solid var(--line); border-radius: 14px; cursor: pointer; }
.act-item.on { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, var(--surface2)); }
.act-item .n { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--surface); color: var(--primary); }
.act-item .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act-item .ty { font-size: .75rem; color: var(--muted); }
.run { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 980px) { .run { grid-template-columns: 320px minmax(0, 1fr); } }
.sess-list { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.qr { background: #fff; border-radius: 14px; padding: 10px; display: inline-block; line-height: 0; }
.qr svg { width: 100%; height: auto; display: block; }
.joinbox { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.codebig { font-family: var(--font-head); font-weight: 700; font-size: 2.2rem; letter-spacing: .12em; color: var(--primary); }
.palettes { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.palettes button { border: 2px solid var(--line); border-radius: 14px; padding: 8px; background: var(--surface2); cursor: pointer; text-align: left; font-size: .8rem; font-weight: 600; }
.palettes button.on { border-color: var(--primary); }
.palettes .sw { display: flex; height: 22px; border-radius: 8px; overflow: hidden; margin-bottom: 6px; }
.palettes .sw i { flex: 1; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
.empty svg { width: 36px; height: 36px; opacity: .6; }
pre.ai { white-space: pre-wrap; font-family: var(--font-body); background: var(--surface2); border-radius: 14px; padding: 14px; border: 1px solid var(--line); margin: 0; }

/* projector */
body.screen main { max-width: none; padding: 3vh 4vw; }
body.screen .s-head { display: flex; justify-content: space-between; align-items: center; gap: 2vw; margin-bottom: 2.5vh; }
body.screen .s-q { font-family: var(--font-head); font-weight: 700; font-size: clamp(1.6rem, 3.6vw, 3.6rem); line-height: 1.15; margin: 0 0 3vh; }
body.screen .bar .lbl { font-size: clamp(1rem, 1.8vw, 1.8rem); }
body.screen .bar .val { font-size: clamp(1rem, 1.6vw, 1.6rem); }
body.screen .bar .track { height: clamp(16px, 2.6vh, 34px); }
body.screen .note { font-size: clamp(.95rem, 1.2vw, 1.3rem); }
body.screen .lb .r { padding: 1.4vh 1.4vw; font-size: clamp(1rem, 1.8vw, 1.9rem); grid-template-columns: 3.4vw minmax(0, 1fr) auto; }
body.screen .slide-body { font-size: clamp(1.1rem, 2vw, 2rem); max-width: 60ch; white-space: pre-line; }
body.screen .note, body.screen .names span { animation: none; }
.lobby { display: grid; gap: 4vw; grid-template-columns: 1fr; align-items: center; }
@media (min-width: 900px) { .lobby { grid-template-columns: auto 1fr; } }
.lobby .qr { width: min(36vh, 80vw); padding: 2vh; }
.names { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 2vh; }
.names span { background: var(--surface2); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; font-weight: 600; animation: pop .3s ease; }

/* footer */
footer.credit { text-align: center; padding: 18px 16px 22px; font-size: .72rem; color: color-mix(in srgb, var(--muted) 70%, transparent); }
footer.credit a { color: inherit; text-decoration: none; opacity: .8; }
footer.credit .staff { margin-left: 8px; opacity: .55; }

@media (max-width: 640px) { .wall { grid-template-columns: 1fr; overflow-x: visible; } }
@media (max-width: 520px) {
  .hide-sm { display: none; }
  .brand .sub { display: none; }
  .card { padding: 16px; }
  .topbar .inner { gap: 8px; padding: 8px 12px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
