/* Watt Detective — WD-2 release polish. Midnight base, cyan evidence, amber clue,
   green confirmed, coral warning. Phone-first: 320 / 360 / 390 and up. */
.wd-page {
    --wd-midnight: #0b1220;
    --wd-panel: #111b2e;
    --wd-panel-2: #16233a;
    --wd-line: rgba(148, 190, 233, 0.22);
    --wd-text: #eaf2fb;
    --wd-muted: #a8bcd4;
    --wd-cyan: #46d5e8;
    --wd-amber: #f5b942;
    --wd-green: #4cd98a;
    --wd-coral: #ff7a6e;
    --wd-radius: 14px;
    background:
        radial-gradient(1200px 500px at 85% -10%, rgba(70, 213, 232, 0.10), transparent 60%),
        radial-gradient(900px 420px at -10% 30%, rgba(245, 185, 66, 0.07), transparent 55%),
        var(--wd-midnight);
    color: var(--wd-text);
    font-size: 1rem;
    line-height: 1.55;
}
.wd-shell { width: min(64rem, 100% - 2rem); margin-inline: auto; }
.wd-page h1, .wd-page h2, .wd-page h3 { color: var(--wd-text); margin: 0 0 0.55em; line-height: 1.18; }
.wd-page p { margin: 0 0 0.9em; }

/* Hero */
.wd-hero { padding: 3.2rem 0 2.2rem; }
.wd-eyebrow { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin-bottom: 1.1rem; }
.wd-badge {
    display: inline-block; padding: 0.32rem 0.7rem; border-radius: 999px;
    border: 1px solid rgba(245, 185, 66, 0.55); color: var(--wd-amber);
    font-size: 0.78rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
    background: rgba(245, 185, 66, 0.10);
}
.wd-eyebrow__name { color: var(--wd-cyan); font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; font-size: 0.82rem; }
.wd-hero h1 { font-size: clamp(1.9rem, 6.5vw, 3.1rem); letter-spacing: -0.01em; }
.wd-hero__copy { max-width: 38rem; color: var(--wd-muted); font-size: 1.06rem; }
.wd-hero__actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 1.3rem 0 1.1rem; }
.wd-disclosure {
    max-width: 40rem; font-size: 0.88rem; color: var(--wd-muted);
    border-left: 3px solid var(--wd-coral); padding-left: 0.75rem;
}

/* How it works */
.wd-how { padding: 1.6rem 0 2rem; border-top: 1px solid var(--wd-line); }
.wd-how:focus { outline: none; }
.wd-how h2 { font-size: 1.35rem; }
.wd-how__steps { margin: 0 0 0.9rem; padding-left: 1.2rem; color: var(--wd-muted); }
.wd-how__steps li { margin-bottom: 0.55rem; }
.wd-how__steps strong { color: var(--wd-text); }
.wd-how__note { color: var(--wd-muted); font-size: 0.92rem; }

/* Game frame */
.wd-game { padding: 1.2rem 0 3.4rem; border-top: 1px solid var(--wd-line); }
.wd-toolbar {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: 0.7rem; padding: 0.8rem; border: 1px solid var(--wd-line);
    border-radius: var(--wd-radius); background: var(--wd-panel);
}
.wd-toolbar__id { display: flex; flex-wrap: wrap; align-items: center; gap: 0.8rem; }
.wd-toolbar__id strong { letter-spacing: 0.05em; }
.wd-stat { color: var(--wd-muted); font-size: 0.88rem; }
.wd-stat b { color: var(--wd-cyan); font-size: 1rem; margin-left: 0.25rem; }
.wd-toolbar__actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.wd-status {
    display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.4rem;
    margin: 0.8rem 0; padding: 0.55rem 0.9rem; border-radius: 10px;
    background: rgba(70, 213, 232, 0.08); border: 1px solid rgba(70, 213, 232, 0.25);
    color: var(--wd-cyan); font-size: 0.92rem; font-weight: 600;
}

/* Buttons — every important control at least 48x48 */
.wd-button {
    display: inline-flex; flex-direction: column; justify-content: center; align-items: center;
    gap: 0.15rem; min-height: 48px; min-width: 48px; padding: 0.65rem 1.1rem;
    border-radius: 12px; border: 1px solid var(--wd-line);
    background: var(--wd-panel-2); color: var(--wd-text);
    font: inherit; font-weight: 600; text-align: center; text-decoration: none;
    cursor: pointer; transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}
.wd-button:hover { border-color: var(--wd-cyan); }
.wd-button:focus-visible { outline: 3px solid var(--wd-cyan); outline-offset: 2px; }
.wd-button[disabled] { opacity: 0.45; cursor: not-allowed; }
.wd-primary { background: var(--wd-cyan); border-color: var(--wd-cyan); color: #06222a; width: 100%; font-size: 1.05rem; }
.wd-primary:hover:not([disabled]) { transform: translateY(-1px); }
.wd-ghost { border-color: rgba(234, 242, 251, 0.35); background: transparent; }
.wd-toolbtn { padding: 0.55rem 0.85rem; font-size: 0.88rem; }

/* Panels */
.wd-panel {
    margin-top: 0.4rem; padding: 1.25rem; border: 1px solid var(--wd-line);
    border-radius: var(--wd-radius); background: var(--wd-panel);
}
.wd-kicker {
    color: var(--wd-amber); font-size: 0.78rem; font-weight: 700;
    letter-spacing: 0.14em; text-transform: uppercase; margin-bottom: 0.5rem;
}
.wd-lede { color: var(--wd-muted); }
.wd-hint { color: var(--wd-muted); font-size: 0.88rem; margin: 0.55rem 0 0; }
.wd-panel__actions { margin-top: 1.1rem; }

/* Assist cue — in-flow, above the active choice group */
.wd-cue {
    padding: 0.7rem 0.9rem; border-radius: 10px; margin: 0 0 0.9rem;
    background: rgba(76, 217, 138, 0.10); border: 1px solid rgba(76, 217, 138, 0.4);
    color: var(--wd-green); font-size: 0.94rem; font-weight: 600;
}
.is-assist-target { box-shadow: 0 0 0 3px var(--wd-green); }

/* Case cards */
.wd-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.9rem; margin-top: 0.5rem; }
.wd-card {
    display: flex; flex-direction: column; gap: 0.35rem; padding: 1rem;
    border: 1px solid var(--wd-line); border-radius: 12px; background: var(--wd-panel-2);
}
.wd-card h3 { font-size: 1.05rem; margin-bottom: 0.15rem; }
.wd-card p { color: var(--wd-muted); font-size: 0.92rem; flex: 1; }
.wd-card.is-selected { border-color: var(--wd-green); background: rgba(76, 217, 138, 0.08); }
.wd-card__choose { width: 100%; }
.wd-card.is-selected .wd-card__choose { border-color: var(--wd-green); color: var(--wd-green); font-weight: 700; }

/* Investigation */
.wd-step { font-size: 1.35rem; }
.wd-rail { display: flex; gap: 0.35rem; margin: 0.2rem 0 1rem; }
.wd-rail span { height: 8px; flex: 1; border-radius: 999px; background: rgba(148, 190, 233, 0.18); }
.wd-rail span.is-done { background: var(--wd-cyan); }
.wd-rail span.is-current { background: rgba(70, 213, 232, 0.45); outline: 1px solid var(--wd-cyan); }
.wd-room { font-size: 1.15rem; color: var(--wd-cyan); }
.wd-latest {
    margin: 0 0 1rem; padding: 0.85rem 1rem; border-radius: 12px;
    background: rgba(245, 185, 66, 0.10); border: 1px solid rgba(245, 185, 66, 0.5);
}
.wd-latest__tag {
    display: inline-block; margin-bottom: 0.3rem; color: var(--wd-amber);
    font-size: 0.78rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
}
.wd-latest p { margin: 0; font-size: 1.02rem; }
.wd-tools { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.7rem; }
.wd-tool { align-items: flex-start; text-align: left; padding: 0.85rem 1rem; }
.wd-tool strong { font-size: 0.99rem; }
.wd-tool small { color: var(--wd-muted); font-weight: 400; font-size: 0.85rem; }

/* Case notebook */
.wd-history { margin-top: 1.2rem; padding-top: 0.9rem; border-top: 1px solid var(--wd-line); }
.wd-history h3 { font-size: 0.95rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--wd-muted); }
.wd-history ol { margin: 0; padding: 0; list-style: none; counter-reset: wd-clue; }
.wd-history li {
    counter-increment: wd-clue; position: relative; padding: 0.5rem 0 0.5rem 2.3rem;
    border-bottom: 1px dashed rgba(148, 190, 233, 0.16); font-size: 0.93rem; color: var(--wd-muted);
}
.wd-history li strong { color: var(--wd-text); }
.wd-history li::before {
    content: counter(wd-clue); position: absolute; left: 0; top: 0.55rem;
    width: 1.6rem; height: 1.6rem; border-radius: 50%; display: grid; place-items: center;
    background: rgba(70, 213, 232, 0.14); border: 1px solid rgba(70, 213, 232, 0.4);
    color: var(--wd-cyan); font-size: 0.8rem; font-weight: 700;
}

/* Conclusion */
.wd-group-label { margin-top: 1.1rem; font-size: 1rem; color: var(--wd-amber); }
.wd-count { color: var(--wd-muted); font-size: 0.9rem; font-weight: 600; }
.wd-notice {
    padding: 0.7rem 0.9rem; border-radius: 10px; margin: 0 0 0.9rem;
    background: rgba(255, 122, 110, 0.10); border: 1px solid rgba(255, 122, 110, 0.5);
    color: var(--wd-coral); font-size: 0.93rem; font-weight: 600;
}
.wd-options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.6rem; }
.wd-choice { flex-direction: row; justify-content: space-between; gap: 0.7rem; text-align: left; padding: 0.7rem 0.95rem; }
.wd-choice__label { flex: 1; }
.wd-state { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--wd-muted); white-space: nowrap; }
.wd-choice.is-selected { border-color: var(--wd-green); background: rgba(76, 217, 138, 0.10); }
.wd-choice.is-selected .wd-state { color: var(--wd-green); }

/* Result */
.wd-result { text-align: left; }
.wd-ring {
    width: 138px; height: 138px; border-radius: 50%; margin: 0.4rem 0 0.9rem;
    background: conic-gradient(var(--wd-cyan) calc(var(--wd-score, 0) * 1%), rgba(148, 190, 233, 0.14) 0);
    display: grid; place-items: center;
}
.wd-ring__inner {
    width: 108px; height: 108px; border-radius: 50%; background: var(--wd-panel);
    display: grid; place-items: center; align-content: center; text-align: center;
}
.wd-ring b { font-size: 2.2rem; line-height: 1; color: var(--wd-text); }
.wd-ring small { color: var(--wd-muted); }
.wd-rank { color: var(--wd-amber); font-size: 1.45rem; }
.wd-summary { color: var(--wd-muted); max-width: 44rem; }
.wd-result h3 { margin-top: 1rem; font-size: 0.92rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--wd-cyan); }
.wd-scores { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.6rem; margin: 1.1rem 0; }
.wd-scores div {
    padding: 0.75rem; border: 1px solid var(--wd-line); border-radius: 12px;
    background: var(--wd-panel-2); font-size: 0.85rem; color: var(--wd-muted);
    display: flex; flex-direction: column; gap: 0.2rem;
}
.wd-scores b { font-size: 1.45rem; color: var(--wd-text); }
.wd-result__actions { display: grid; gap: 0.6rem; }

/* Large text assist */
html.is-large-text .wd-page { font-size: 1.14rem; }
html.is-large-text .wd-button { font-size: 1.05em; }

/* High contrast assist — never colour alone */
html.is-high-contrast .wd-page {
    --wd-midnight: #000; --wd-panel: #000; --wd-panel-2: #0a0a0a;
    --wd-line: #fff; --wd-text: #fff; --wd-muted: #f2f2f2;
    --wd-cyan: #7ef4ff; --wd-amber: #ffd76e; --wd-green: #7dffb2; --wd-coral: #ff9d94;
    background: #000;
}
html.is-high-contrast .wd-page .wd-button { border-width: 2px; }
html.is-high-contrast .wd-page .wd-primary { color: #000; }
html.is-high-contrast .wd-page .wd-card.is-selected,
html.is-high-contrast .wd-page .wd-choice.is-selected { border-width: 3px; }
html.is-high-contrast .wd-page .is-assist-target { box-shadow: 0 0 0 4px var(--wd-green); }

/* Motion preferences */
@media (prefers-reduced-motion: reduce) {
    .wd-page *, .wd-page *::before, .wd-page *::after {
        transition: none !important; animation: none !important;
    }
}

/* Phone-first: 390 / 360 / 320 */
@media (max-width: 700px) {
    .wd-shell { width: min(64rem, 100% - 1.6rem); }
    .wd-cards { grid-template-columns: 1fr; }
    .wd-scores { grid-template-columns: repeat(2, 1fr); }
    .wd-toolbar__actions { width: 100%; }
    .wd-toolbtn { flex: 1 1 auto; }
}
@media (max-width: 480px) {
    .wd-hero { padding-top: 2.4rem; }
    .wd-hero__actions { flex-direction: column; align-items: stretch; }
    .wd-hero__actions .wd-button { width: 100%; }
    .wd-tools { grid-template-columns: 1fr; }
    .wd-options { grid-template-columns: 1fr; }
    .wd-panel { padding: 1rem; }
    .wd-choice { flex-direction: column; align-items: flex-start; gap: 0.25rem; }
}
@media (max-width: 340px) {
    .wd-shell { width: min(64rem, 100% - 1.2rem); }
    .wd-scores { grid-template-columns: 1fr 1fr; gap: 0.45rem; }
    .wd-ring { width: 120px; height: 120px; }
    .wd-ring__inner { width: 92px; height: 92px; }
}
