/* glishin role-play player. Same tokens as theme_glishin and the app: paper, ink, violet; Inter for text, Fredoka for
   display. Fonts are bundled (no external requests). Light only, like the app. */

@font-face { font-family: "Inter"; font-weight: 400; font-display: swap; src: url("fonts/inter-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 600; font-display: swap; src: url("fonts/inter-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Fredoka"; font-weight: 300 700; font-display: swap; src: url("fonts/fredoka-latin-wght-normal.woff2") format("woff2"); }

:root {
    --paper: #faf9f7;
    --card: #ffffff;
    --ink: #1b1a22;
    --ink-2: #4a4857;
    --ink-3: #6f6c7d;
    --line: #e7e4ee;
    --violet: #7c5cff;
    --violet-ink: #5a44d6;
    --violet-50: #f4f1ff;
    --violet-100: #e9e3ff;
    --success: #1f7a4d;
    --success-50: #e8f4ee;
    --warn-50: #fff6e5;
    --warn-ink: #7a4b00;
    --radius: 16px;
    --display: "Fredoka", "Inter", system-ui, sans-serif;
    --text: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
    background: var(--paper);
    color: var(--ink);
    font: 400 16px/1.5 var(--text);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }
h1, h2 { font-family: var(--display); font-weight: 600; letter-spacing: 0; margin: 0; }
h1 { font-size: 1.625rem; line-height: 1.2; }
h2 { font-size: 1.125rem; line-height: 1.3; }

#app { max-width: 560px; margin: 0 auto; min-height: 100%; }
.screen { min-height: 100dvh; display: flex; flex-direction: column; padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)); }

/* ---------------------------------------------------------------- setup */
.brand { display: flex; align-items: baseline; gap: .5rem; padding: .25rem 0 1.5rem; }
.wordmark { font-family: var(--display); font-weight: 600; font-size: 1.75rem; line-height: 1; }
.wordmark span { color: var(--violet); }
.brand-tag { font-size: .75rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }

#pick h1 { margin-bottom: 1rem; }
.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; }
.cards button {
    width: 100%; text-align: left; cursor: pointer;
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 1rem 1.125rem; display: grid; gap: .25rem;
    transition: border-color .15s, box-shadow .15s, transform .15s;
}
.cards button:hover { border-color: var(--violet); }
.cards button:active { transform: scale(.99); }
.cards button:focus-visible { outline: 3px solid var(--violet-100); border-color: var(--violet); }
.card-k { font-size: .75rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--violet-ink); }
.card-title { font-family: var(--display); font-weight: 600; font-size: 1.125rem; line-height: 1.3; }
.card-text { color: var(--ink-2); font-size: .9375rem; }

.sheet { display: grid; gap: 1rem; }
.kicker { margin: 0; font-size: .75rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--violet-ink); }
.setup { margin: 0; color: var(--ink-2); }
.goal { margin: 0; padding: .75rem 1rem; background: var(--violet-50); border-radius: 12px; }
.goal.small { padding: 0; background: none; font-size: .875rem; color: var(--ink-2); line-height: 1.4; }
.goal-k { font-size: .7rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--violet-ink); margin-right: .35rem; }
.field { display: grid; gap: .35rem; font-weight: 600; font-size: .9375rem; }
.field input {
    font-weight: 400; padding: .8rem 1rem; border: 1px solid var(--line); border-radius: 12px; background: var(--card);
    font-size: 1.0625rem; min-height: 48px;
}
.field input:focus { outline: 3px solid var(--violet-100); border-color: var(--violet); }
.help { margin: 0; color: var(--ink-3); font-size: .875rem; }
.privacy { margin: 0; color: var(--ink-3); font-size: .8125rem; display: flex; gap: .5rem; }
.privacy::before { content: ""; flex: none; width: 1rem; height: 1rem; margin-top: .15rem; border-radius: 50%; background: var(--success-50); box-shadow: inset 0 0 0 4px var(--success); }

.primary {
    border: 0; border-radius: 999px; background: var(--violet-ink); color: #fff; font-weight: 600;
    min-height: 52px; padding: 0 1.5rem; cursor: pointer; font-size: 1.0625rem;
}
.primary:hover { background: #4b36c4; }
.primary:focus-visible, .ghost:focus-visible, .icon-btn:focus-visible, .mic:focus-visible, .link:focus-visible { outline: 3px solid var(--violet-100); outline-offset: 2px; }
.primary.small { min-height: 44px; font-size: .9375rem; padding: 0 1.1rem; }
.ghost {
    border: 1px solid var(--line); background: var(--card); border-radius: 999px; min-height: 44px; padding: 0 1rem;
    font-weight: 600; font-size: .9375rem; cursor: pointer; color: var(--ink-2);
}
.ghost.nudge { border-color: var(--violet); color: var(--violet-ink); background: var(--violet-50); }
.ghost.wide { width: 100%; min-height: 52px; }
.link { background: none; border: 0; padding: 0; color: var(--violet-ink); font-weight: 600; cursor: pointer; justify-self: start; font-size: .9375rem; }

/* ---------------------------------------------------------------- call */
#call { padding-bottom: 0; }
.call-head { display: flex; gap: .5rem; align-items: flex-start; padding-bottom: .75rem; border-bottom: 1px solid var(--line); }
.call-titles { display: grid; gap: .2rem; min-width: 0; }
.call-head h1 { font-size: 1.25rem; }
.icon-btn {
    flex: none; width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent; cursor: pointer;
    display: grid; place-items: center; color: var(--ink);
}
.icon-btn:hover { background: var(--violet-50); }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.replay svg path:first-child { fill: currentColor; stroke: none; }

.stage { flex: 1; display: grid; align-content: start; gap: 1rem; padding: 1.25rem 0 1rem; }
.speaker { display: grid; grid-template-columns: auto 1fr auto; gap: .75rem; align-items: start; }
.avatar {
    width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center;
    background: var(--violet-100); color: var(--violet-ink); font-family: var(--display); font-weight: 600; font-size: 1.375rem;
    box-shadow: 0 0 0 0 rgba(124, 92, 255, .35);
}
.speaker.talking .avatar { animation: talk 1.2s ease-out infinite; }
@keyframes talk { 0% { box-shadow: 0 0 0 0 rgba(124, 92, 255, .35); } 100% { box-shadow: 0 0 0 12px rgba(124, 92, 255, 0); } }
.speaker-name { font-size: .8125rem; font-weight: 600; color: var(--ink-3); margin-bottom: .25rem; }
.bubble {
    margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: 4px var(--radius) var(--radius) var(--radius);
    padding: .75rem 1rem; font-size: 1.1875rem; line-height: 1.45; font-weight: 600; min-height: 3rem;
}
.bubble.fresh { animation: rise .25s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.board {
    margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .875rem 1rem 1rem;
}
.board figcaption { font-size: .75rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: .5rem; }
.board ol { list-style: none; margin: 0; padding: 0; display: grid; gap: .1rem; }
.board li { display: flex; align-items: center; gap: .6rem; padding: .35rem 0; color: var(--ink-2); border-bottom: 1px dashed var(--line); }
.board li:last-child { border-bottom: 0; }
.board li .n { width: 1.25rem; font-variant-numeric: tabular-nums; color: var(--ink-3); font-size: .875rem; }
.board li.me { color: var(--ink); font-weight: 600; font-size: 1.125rem; }
.board li.me .val { padding: .1rem .5rem; margin-left: -.5rem; border-radius: 8px; background: var(--warn-50); color: var(--warn-ink); letter-spacing: .02em; }
.board li.me .val.empty { background: var(--violet-50); color: var(--ink-3); font-weight: 400; }
.board li.me.ok .val { background: var(--success-50); color: var(--success); }
.board li.me .mark { margin-left: auto; font-size: .8125rem; font-weight: 600; color: var(--success); }
.board li.me .val.changed { animation: flash .5s ease-out; }
@keyframes flash { from { box-shadow: 0 0 0 3px var(--violet); } to { box-shadow: 0 0 0 0 transparent; } }
.gloss { margin: .5rem 0 0; font-size: .8125rem; color: var(--ink-3); }

.you { margin: 0; justify-self: end; max-width: 85%; background: var(--violet-ink); color: #fff; border-radius: var(--radius) 4px var(--radius) var(--radius); padding: .6rem .9rem; display: grid; gap: .1rem; }
.you .who { font-size: .7rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; opacity: .75; }
.hint { margin: 0; background: var(--warn-50); color: var(--warn-ink); border-radius: 12px; padding: .7rem .9rem; font-size: .9375rem; }

.controls {
    position: sticky; bottom: 0; background: linear-gradient(to bottom, rgba(250, 249, 247, 0), var(--paper) 18%);
    padding: 1.25rem 0 max(16px, env(safe-area-inset-bottom)); display: grid; gap: .6rem; justify-items: center;
}
.status { margin: 0; min-height: 1.5em; color: var(--ink-2); font-size: .9375rem; text-align: center; }
.control-row { width: 100%; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: .75rem; }
.control-row .ghost { justify-self: start; }
.mic {
    --level: 0; position: relative; width: 76px; height: 76px; border-radius: 50%; border: 0; cursor: pointer;
    background: var(--violet-ink); color: #fff; display: grid; place-items: center;
    box-shadow: 0 6px 18px rgba(90, 68, 214, .3); transition: background .15s, transform .1s, opacity .15s;
}
.mic svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; position: relative; }
.mic svg rect { fill: currentColor; stroke: none; }
.mic:active { transform: scale(.96); }
.mic:disabled { background: #b9b4cc; box-shadow: none; cursor: default; }
.mic .ring { position: absolute; inset: 0; border-radius: 50%; background: var(--violet); opacity: 0; transform: scale(1); transition: transform .08s linear, opacity .2s; }
.mic.on { background: #c0263a; box-shadow: 0 6px 18px rgba(192, 38, 58, .3); }
.mic.on .ring { opacity: .22; background: #c0263a; transform: scale(calc(1 + var(--level) * .45)); }
.mic.on svg rect { rx: 1; }
.type-form { width: 100%; display: flex; gap: .5rem; }
.type-form input { flex: 1; min-width: 0; padding: .7rem 1rem; border: 1px solid var(--line); border-radius: 999px; background: var(--card); font-size: 1rem; min-height: 44px; }
.type-form input:focus { outline: 3px solid var(--violet-100); border-color: var(--violet); }

/* ---------------------------------------------------------------- result */
#result { justify-content: center; }
.result-card { display: grid; gap: 1rem; }
.result-mark { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--success-50); color: var(--success); font-size: 2rem; font-weight: 600; }
.result-mark.not { background: var(--violet-50); color: var(--violet-ink); }
.board.compact { padding: .75rem 1rem; }
.tips { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.tips li { background: var(--violet-50); border-radius: 12px; padding: .75rem 1rem; }
.tips li.none { background: var(--success-50); color: var(--success); }
#result .primary { width: 100%; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
