/* ── shellshock · monochrome ────────────────────────────────────────────────
   All colour comes from theme.css (shared, copied verbatim). This file adds no
   palette of its own: hierarchy is weight, border style and fill. */

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg);
    color: var(--text-primary);
    font-family: var(--sans);
    min-height: 100vh;
    min-height: 100dvh;
    padding: 20px 16px;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

code,
kbd {
    font-family: var(--mono);
    font-size: 0.88em;
}

code {
    background: var(--fill);
    border-radius: var(--radius-xs);
    padding: 1px 5px;
}

kbd {
    border: 1px solid var(--border-strong);
    border-bottom-width: 2px;
    border-radius: var(--radius-xs);
    padding: 0 5px;
    background: var(--bg-subtle);
}

.hidden {
    display: none !important;
}

.screen {
    width: 100%;
    display: flex;
    justify-content: center;
    animation: screen-in 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes screen-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
}

/* Sound toggle: same look as theme.js's button, parked to its left. */
.sound-toggle {
    position: fixed;
    top: 12px;
    right: 54px;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.sound-toggle:hover {
    background: var(--bg-muted);
    border-color: var(--border-strong);
    color: var(--text-primary);
}

.sound-toggle:focus-visible {
    outline: none;
    border-color: var(--text-primary);
    box-shadow: 0 0 0 2px var(--fill-strong);
}

.sound-toggle svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ── buttons ───────────────────────────────────────────────────────────── */
.btn {
    font-family: var(--mono);
    font-size: 0.95rem;
    font-weight: 600;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
    background: var(--bg);
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.btn:hover {
    background: var(--bg-muted);
    border-color: var(--text-primary);
}

.btn.primary {
    background: var(--text-primary);
    color: var(--text-inverse);
    border-color: var(--text-primary);
}

.btn.primary:hover {
    opacity: 0.88;
}

.chip {
    font-family: var(--mono);
    font-size: 0.78rem;
    padding: 5px 10px;
    border-radius: 999px;
    border: 1px dashed var(--border-strong);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
}

.chip.active {
    border-style: solid;
    border-color: var(--text-primary);
    background: var(--text-primary);
    color: var(--text-inverse);
}

/* ── menu ──────────────────────────────────────────────────────────────── */
.menu {
    width: 100%;
    max-width: 920px;
    padding: 28px 0 60px;
}

.tagline {
    text-align: center;
    color: var(--text-secondary);
    font-family: var(--mono);
    margin: 22px 0 14px;
    font-size: 0.95rem;
}

.demo {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 18px;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 34px;
}

.demo code {
    color: var(--text-primary);
}

.modes {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 40px;
}

.mode-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    background: var(--bg-subtle);
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.2s ease, box-shadow 0.2s ease;
}

@media (hover: hover) {
    .mode-card:hover {
        transform: translateY(-3px);
        border-color: var(--border-strong);
        box-shadow: var(--shadow-md);
    }
    .opp:hover {
        border-color: var(--text-primary);
    }
}

.btn:active,
.chip:active,
.opp:active {
    transform: translateY(1px);
}

.mode-card h2 {
    font-family: var(--mono);
    font-size: 1.05rem;
}

.mode-card p {
    color: var(--text-secondary);
    font-size: 0.88rem;
    flex: 1;
}

.section-h {
    font-family: var(--mono);
    font-size: 0.95rem;
    margin: 0 0 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

.section-h span {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 0.8rem;
    margin-left: 8px;
}

.roster {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-bottom: 40px;
}

.opp {
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
    text-align: left;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 12px;
    background: var(--bg);
    color: var(--text-primary);
    cursor: pointer;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 2px 8px;
    font-family: var(--sans);
}

.opp.active {
    border-style: solid;
    border-color: var(--text-primary);
    box-shadow: inset 0 0 0 1px var(--text-primary);
}

.opp-glyph {
    grid-row: span 2;
    font-family: var(--mono);
    font-weight: 700;
    font-size: 1.4rem;
    width: 34px;
    height: 34px;
    border-radius: var(--radius-xs);
    border: 2px solid var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.opp-name {
    font-family: var(--mono);
    font-weight: 700;
}

.opp-wpm {
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.opp-blurb {
    grid-column: 1 / -1;
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: 6px;
}

.how {
    list-style: none;
    display: grid;
    gap: 9px;
    margin-bottom: 40px;
    color: var(--text-secondary);
    font-size: 0.92rem;
    line-height: 1.5;
}

.how li {
    padding-left: 18px;
    position: relative;
}

.how li::before {
    content: "$";
    position: absolute;
    left: 0;
    font-family: var(--mono);
    color: var(--text-muted);
}

.how b {
    color: var(--text-primary);
    font-weight: 600;
}

/* ── man page move list ────────────────────────────────────────────────── */
.man-group {
    margin-bottom: 22px;
}

.man-group h3 {
    font-family: var(--mono);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.man-sub {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin: 2px 0 8px;
}

.man-row {
    display: grid;
    grid-template-columns: 170px 1fr;
    gap: 12px;
    padding: 7px 0;
    border-top: 1px solid var(--border);
    font-size: 0.86rem;
}

.man-row code {
    justify-self: start;
    font-weight: 600;
    background: none;
    padding: 0;
}

.man-desc {
    color: var(--text-secondary);
}

.man-frames {
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ── fight ─────────────────────────────────────────────────────────────── */
.fight {
    width: 100%;
    max-width: 1000px;
    padding-top: 30px;
}

.arena {
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg);
}

#stage {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 960 / 400;
}

.training-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    margin-top: 10px;
    font-family: var(--mono);
    font-size: 0.8rem;
}

.tb-label {
    color: var(--text-muted);
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tb-check {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    cursor: pointer;
}

.tb-check input {
    accent-color: var(--text-primary);
}

.terms {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 12px;
}

.term {
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--bg-subtle);
    font-family: var(--mono);
    font-size: 0.82rem;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.term.cpu {
    border-style: dashed;
}

.term-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.75rem;
}

.dots {
    display: flex;
    gap: 5px;
}

.dots i {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    border: 1px solid var(--border-strong);
}

.term-log {
    height: 132px;
    overflow-y: auto;
    padding: 8px 10px 0;
    line-height: 1.45;
    scrollbar-width: thin;
}

.ln {
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--text-secondary);
}

.ln.cmd {
    color: var(--text-primary);
    font-weight: 600;
}

.ln.err {
    color: var(--text-primary);
    text-decoration: underline dashed var(--text-muted);
    text-underline-offset: 3px;
}

.ln.ok {
    color: var(--text-primary);
}

.ln.dim {
    color: var(--text-muted);
}

.term-line {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px 10px;
    cursor: text;
}

.ps1 {
    font-weight: 700;
    white-space: nowrap;
}

.cmd-wrap {
    position: relative;
    flex: 1;
    min-width: 0;
    display: flex;
}

/* The hint layer sits exactly under the input: the typed part is invisible
   (it only reserves width), the rest is the faint suggestion. */
.ghost {
    position: absolute;
    inset: 0;
    pointer-events: none;
    white-space: pre;
    overflow: hidden;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: normal;
    display: flex;
    align-items: center;
}

.g-typed {
    visibility: hidden;
}

.g-rest {
    color: var(--text-muted);
    opacity: 0.55;
}

.g-desc {
    color: var(--text-muted);
    opacity: 0.55;
    font-weight: 400;
    font-size: 0.8rem;
    margin-left: 10px;
}

.hint-row {
    min-height: 1.5em;
    padding: 0 10px 8px;
    margin-top: -4px;
    font-size: 0.74rem;
    color: var(--text-muted);
    opacity: 0.8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hint-row b {
    color: var(--text-secondary);
    font-weight: 600;
}

.hint-toggle {
    cursor: pointer;
    margin-left: 4px;
}

.hint-toggle input {
    accent-color: var(--text-primary);
    vertical-align: -1px;
}

/* ── training command sheet ─────────────────────────────────────────── */
.cheat {
    margin-top: 14px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px 18px;
    font-family: var(--mono);
}

.cheat-group h4 {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 4px;
    font-weight: 600;
}

.cheat-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 3px 6px;
    margin: 0 -6px;
    border-radius: var(--radius-xs);
    border: 1px solid transparent;
    font-size: 0.8rem;
    transition: background 0.12s ease;
}

.cheat-row code {
    background: none;
    padding: 0;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
}

.cheat-row span {
    color: var(--text-muted);
    font-size: 0.74rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* while typing: candidates get a dashed outline, the exact match a solid one */
.cheat-row.match {
    border-style: dashed;
    border-color: var(--border-strong);
}

.cheat-row.exact {
    border-style: solid;
    border-color: var(--text-primary);
}

/* the move that just ran */
.cheat-row.used {
    background: var(--fill-strong);
}

.cheat.typing .cheat-row:not(.match):not(.exact) {
    opacity: 0.4;
}

#cmd {
    position: relative;
    flex: 1;
    min-width: 0;
    font: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    background: transparent;
    border: none;
    outline: none;
    caret-color: var(--text-primary);
}

.term.you:focus-within {
    border-color: var(--text-primary);
    box-shadow: 0 0 0 2px var(--fill-strong);
}

.cpu-line {
    font-size: 0.95rem;
    font-weight: 600;
    white-space: pre;
}

.caret {
    width: 8px;
    height: 1.05em;
    background: var(--text-muted);
    animation: blink 1s steps(1) infinite;
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}

.hint {
    margin-top: 10px;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ── overlays ──────────────────────────────────────────────────────────── */
.overlay {
    animation: overlay-in 0.22s ease-out;
    position: fixed;
    inset: 0;
    z-index: 100;
    background: var(--fill-strong);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

@keyframes overlay-in {
    from {
        opacity: 0;
    }
}

@keyframes panel-in {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.97);
    }
}

.panel {
    animation: panel-in 0.32s cubic-bezier(0.22, 1, 0.36, 1);
    background: var(--bg);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 26px;
    width: 100%;
    max-width: 480px;
    text-align: center;
    max-height: 90vh;
    overflow-y: auto;
}

.panel.wide {
    max-width: 760px;
    text-align: left;
}

.panel h2 {
    font-family: var(--mono);
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.panel p {
    color: var(--text-secondary);
    margin-bottom: 18px;
}

.row {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.panel.wide .row {
    justify-content: flex-start;
    margin-bottom: 22px;
}

/* ── narrow screens ────────────────────────────────────────────────────── */
@media (max-width: 760px) {
    .modes,
    .terms {
        grid-template-columns: 1fr;
    }
    .roster {
        grid-template-columns: repeat(2, 1fr);
    }
    .man-row {
        grid-template-columns: 1fr;
        gap: 2px;
    }
    .term-log {
        height: 96px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .caret,
    .screen,
    .overlay,
    .panel {
        animation: none;
    }
}
