/* Redacted — minimalist case-file look. */

:root {
    --bg: #0f1115;
    --panel: #171a20;
    --panel-2: #1e222a;
    --ink: #e9ebef;
    --muted: #8c93a1;
    --line: #2a2f38;
    --redact: #05060a;
    --accent: #f4c95d;
    --accent-soft: rgba(244, 201, 93, 0.16);
    --good: #7ee0a8;
    --bad: #ff7a6b;
    --radius: 12px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    background: var(--bg);
    color: var(--ink);
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-text-size-adjust: 100%;
    overscroll-behavior: none;
}

body {
    background-image: radial-gradient(1200px 700px at 50% -10%, #1a1e26 0%, var(--bg) 55%);
}

#app {
    min-height: 100%;
    display: flex;
    flex-direction: column;
    max-width: 760px;
    margin: 0 auto;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.hidden { display: none !important; }

/* ------------------------------------------------------------- header */
.hud {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px 8px;
}
.hud-left, .hud-right { display: flex; align-items: baseline; gap: 6px; min-width: 74px; }
.hud-right { justify-content: flex-end; }
.hud-k { font-size: 10px; letter-spacing: 0.16em; color: var(--muted); }
.hud-v { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.hud-mid { flex: 1; }
.timebar {
    height: 6px;
    background: var(--line);
    border-radius: 99px;
    overflow: hidden;
}
.timebar i {
    display: block;
    height: 100%;
    width: 100%;
    background: var(--accent);
    border-radius: 99px;
    transition: width 0.3s linear, background 0.3s;
}
.timebar i.low { background: var(--bad); }
.timebar i.reveal { background: var(--good); }

/* -------------------------------------------------------------- stage */
#stage {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 8px 16px 16px;
}

.play {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding-top: 8px;
}

/* ----------------------------------------------------------- sentence */
.sentence {
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(20px, 5.4vw, 30px);
    line-height: 1.9;
    letter-spacing: 0.01em;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 4px 8px;
    padding: 18px 16px;
    background: linear-gradient(180deg, #1b1f27 0%, #15181e 100%);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}
.sentence .w { color: var(--ink); align-self: center; }

.blank {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 0 4px;
    border-radius: 6px;
    cursor: default;
    vertical-align: middle;
    font-family: inherit;
}
.blank-main {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.4em;
    padding: 1px 8px 2px;
    border-radius: 5px;
    background: #0a0c11;
    color: #f4f5f7;
    border: 1px solid #2f3641;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.6);
}
.blank.mine { cursor: pointer; }
.blank.mine .blank-main { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent-soft); }
.blank.mine.empty .blank-main { color: var(--muted); }
.blank.theirs .blank-main { background: #0d1016; border-style: dashed; border-color: #3a424f; color: #c4c9d2; }
.blank-cap {
    font-family: ui-sans-serif, system-ui, sans-serif;
    font-size: 9.5px;
    letter-spacing: 0.04em;
    color: var(--muted);
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}
.blank-cap:empty { display: none; }
.blank.flagged .blank-main { border-color: var(--bad); box-shadow: 0 0 0 2px rgba(255, 122, 107, 0.22); animation: shake 0.35s; }
.blank.mismatch { cursor: pointer; }
.blank.mismatch .blank-main { border-color: var(--bad); }
.blank.nudgeable .blank-main { transition: box-shadow 0.15s, border-color 0.15s, transform 0.08s; }
.blank.nudgeable:hover .blank-main,
.blank.nudgeable:focus-visible .blank-main {
    border-color: var(--bad);
    box-shadow: 0 0 0 3px rgba(255, 122, 107, 0.22);
}
.blank.nudgeable:active .blank-main { transform: scale(0.97); }
.nudge-bang {
    position: absolute;
    top: -9px;
    right: -9px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--bad);
    color: #1a0d0b;
    font-weight: 800;
    font-size: 12px;
    line-height: 18px;
    text-align: center;
    font-family: ui-sans-serif, system-ui, sans-serif;
    animation: pop 0.5s ease-in-out infinite alternate;
}
.blank.ok .blank-main { background: #123024; border-color: var(--good); color: #d6ffe8; box-shadow: none; }
.blank.bad .blank-main { background: #3a1512; border-color: var(--bad); color: #ffd9d3; box-shadow: none; }
.blank.ok .blank-cap { color: var(--good); }
.blank.bad .blank-cap { color: var(--bad); }

/* -------------------------------------------------------- my word cards */
.my-words { display: flex; flex-direction: column; gap: 12px; }
.my-words.dim { opacity: 0.5; pointer-events: none; }
.word-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px 12px 14px;
}
.word-card.bump { animation: bump 0.4s; border-color: var(--accent); }
.word-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.word-label { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.word-warn { font-size: 11px; color: var(--bad); font-weight: 600; }
.options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.option {
    font: inherit;
    font-size: 16px;
    padding: 12px 10px;
    border-radius: 9px;
    border: 1px solid var(--line);
    background: var(--panel-2);
    color: var(--ink);
    cursor: pointer;
    transition: transform 0.08s, border-color 0.15s, background 0.15s;
    min-height: 46px;
}
.option:hover { border-color: #3d4553; }
.option:active { transform: scale(0.97); }
.option.selected {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: #ffe9ab;
    font-weight: 700;
}

/* --------------------------------------------------------------- foot */
.play-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: auto;
    padding-top: 8px;
}
.partner-status { font-size: 13px; color: var(--muted); }
.partner-status.ready { color: var(--good); font-weight: 600; }
.ready-btn { min-width: 130px; }
.btn.ready-btn.on { background: var(--good); border-color: var(--good); color: #08210f; }

/* --------------------------------------------------------------- flash */
.flash {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding-bottom: 110px;
    gap: 4px;
    pointer-events: none;
    opacity: 0;
    transform: scale(0.96);
    transition: opacity 0.18s, transform 0.18s;
    z-index: 5;
}
.flash.show { opacity: 1; transform: scale(1); }
.flash-word { font-size: clamp(30px, 10vw, 54px); font-weight: 800; letter-spacing: 0.06em; }
.flash-word.good { color: var(--good); text-shadow: 0 0 30px rgba(126, 224, 168, 0.35); }
.flash-word.bad { color: var(--bad); }
.flash-pts { font-size: 20px; color: var(--accent); font-weight: 700; }

/* -------------------------------------------------------------- panels */
.overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    z-index: 10;
}
.panel {
    width: 100%;
    max-width: 460px;
    background: linear-gradient(180deg, #1a1e25 0%, #14171d 100%);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 26px 22px 24px;
    text-align: center;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
    animation: rise 0.25s ease-out;
    max-height: 92vh;
    overflow-y: auto;
}
.brand {
    font-size: clamp(38px, 12vw, 58px);
    font-weight: 800;
    letter-spacing: 0.14em;
    color: var(--ink);
    position: relative;
    display: inline-block;
}
.brand::after {
    content: "";
    position: absolute;
    left: 2%;
    right: 2%;
    top: 52%;
    height: 0.34em;
    background: var(--redact);
    transform: translateY(-50%);
    box-shadow: 0 0 0 2px rgba(244, 201, 93, 0.25);
}
.brand.small { font-size: 26px; letter-spacing: 0.18em; }
.tagline { color: var(--muted); margin: 10px 0 22px; font-size: 15px; }
.howto { text-align: left; display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.howto-row { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.45; color: #c6ccd6; }
.howto-row b { color: var(--accent); }
.chip {
    flex: 0 0 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    line-height: 22px;
}
.lobby-hint { margin-top: 14px; font-size: 12px; color: var(--muted); }

.btn {
    font: inherit;
    font-weight: 700;
    letter-spacing: 0.06em;
    font-size: 14px;
    padding: 14px 20px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--panel-2);
    color: var(--ink);
    cursor: pointer;
    transition: transform 0.08s, background 0.15s, border-color 0.15s;
    width: 100%;
}
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #201803; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.primary:disabled { opacity: 0.5; }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.tiny { width: auto; padding: 8px 14px; font-size: 12px; }

/* ------------------------------------------------------------- waiting */
.wait-title { font-size: 17px; font-weight: 600; margin-bottom: 4px; }
.wait-sub { font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-bottom: 14px; }
.dots i { font-style: normal; animation: blink 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: 0.2s; }
.dots i:nth-child(3) { animation-delay: 0.4s; }
.practice { background: #12151b; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 14px; margin-bottom: 16px; }
.practice-prompt { font-family: Georgia, serif; font-size: 17px; line-height: 1.6; margin-bottom: 12px; color: #dfe3e9; }
.practice-blank { background: var(--redact); padding: 0 6px; border-radius: 4px; }
.practice-blank.solved { background: #123024; color: var(--good); }
.practice-options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.practice-result { margin-top: 10px; font-size: 13px; min-height: 18px; color: var(--accent); }

/* ------------------------------------------------------------- results */
.result-kicker { font-size: 11px; letter-spacing: 0.2em; color: var(--muted); margin-bottom: 6px; }
.result-score { font-size: clamp(52px, 16vw, 76px); font-weight: 800; color: var(--accent); line-height: 1; font-variant-numeric: tabular-nums; }
.result-sub { color: var(--muted); font-size: 14px; margin-top: 6px; }
.result-summary { margin: 16px 0; font-size: 15px; line-height: 1.5; color: #d3d8e0; }
.stats { display: flex; gap: 8px; margin-bottom: 20px; }
.stat { flex: 1; background: #12151b; border: 1px solid var(--line); border-radius: 9px; padding: 10px 6px; }
.stat-k { display: block; font-size: 9.5px; letter-spacing: 0.1em; color: var(--muted); margin-bottom: 4px; }
.stat-v { font-size: 18px; font-weight: 700; }
.result-actions { display: flex; flex-direction: column; gap: 10px; }
.result-wait { margin-top: 14px; font-size: 13px; color: var(--muted); }
.goodbye-msg { margin: 14px 0 22px; color: #c6ccd6; }

/* -------------------------------------------------------------- banner */
.pause-banner {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: #2a2113;
    border: 1px solid #5a4a22;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 13px;
    color: #ffdca0;
    z-index: 8;
}
.pause-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); animation: pop 0.8s infinite alternate; }
.pause-banner .btn { margin-left: auto; }
.toast {
    position: absolute;
    left: 50%;
    bottom: 20px;
    transform: translateX(-50%);
    background: #22262e;
    border: 1px solid var(--line);
    color: var(--ink);
    padding: 10px 16px;
    border-radius: 999px;
    font-size: 13px;
    z-index: 20;
}

/* ------------------------------------------------------------ controls */
.controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 16px calc(12px + env(safe-area-inset-bottom));
}
.reactions { display: flex; gap: 4px; }
.reaction {
    font: inherit;
    font-size: 20px;
    line-height: 1;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid transparent;
    background: transparent;
    cursor: pointer;
}
.reaction:hover { background: var(--panel); border-color: var(--line); }
.controls-right { display: flex; align-items: center; gap: 6px; }

.emoji-float {
    position: absolute;
    bottom: 26%;
    font-size: 30px;
    animation: floatUp 1.5s ease-out forwards;
    pointer-events: none;
    z-index: 15;
}

/* ------------------------------------------------------------ anims */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes blink { 0%, 60%, 100% { opacity: 0.25; } 25% { opacity: 1; } }
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
}
@keyframes pop { from { transform: scale(0.9); } to { transform: scale(1.15); } }
@keyframes bump {
    0% { transform: scale(1); }
    40% { transform: scale(1.02); }
    100% { transform: scale(1); }
}
@keyframes floatUp {
    0% { opacity: 0; transform: translateY(10px) scale(0.8); }
    15% { opacity: 1; }
    100% { opacity: 0; transform: translateY(-120px) scale(1.15); }
}

@media (max-width: 420px) {
    .sentence { font-size: 21px; padding: 14px 12px; }
    .blank-cap { font-size: 9px; }
    .stats { gap: 6px; }
}
