/* techchase.css */

/* ── Tool nav pills (shared pattern with training/di pages) ──────────────────── */
.trainer-tools-row {
    display: flex;
    gap: 0.35rem;
}
.tc-tools-row {
    margin-bottom: 1rem;
}
.trainer-tool-link {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.35em 0.9em;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.5);
    text-decoration: none;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
    letter-spacing: 0.03em;
}
.trainer-tool-link:hover  { color: #fff; border-color: rgba(255,255,255,0.35); }
.trainer-tool-link.active { background: rgba(0,200,255,0.12); color: #00c8ff; border-color: rgba(0,200,255,0.4); }

/* [hidden] attr is overridden by any author-level display rule; these win via specificity */
.tc-settings-overlay[hidden],
.tc-gameover[hidden],
.tc-game-wrap[hidden] {
    display: none;
}

/* ── Layout ──────────────────────────────────────────────────────────────────── */
.tc-main {
    max-width: 1000px;
    margin: 0 auto;
    padding: calc(var(--nav-h) + 1.5rem) 1.5rem 5rem;
}

/* ── Top bar ─────────────────────────────────────────────────────────────────── */
.tc-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.tc-topbar-right {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-shrink: 0;
}
.tc-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin: 0;
    letter-spacing: -0.01em;
}

/* ── Connection status (matches visualizer pattern) ──────────────────────────── */
.tc-conn-status {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.15);
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    font-size: 0.72rem;
}
.tc-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ff3366;
    flex-shrink: 0;
    animation: tc-pulse 2s infinite;
}
.tc-status-dot.connected { background: #00ff88; animation: none; }
.tc-status-dot.pending   { background: #f59e0b; }
.tc-status-text { color: rgba(255,255,255,0.65); white-space: nowrap; }
.tc-dl-link {
    color: #00c8ff;
    text-decoration: none;
    font-weight: 600;
    padding-left: 0.4rem;
    border-left: 1px solid rgba(255,255,255,0.12);
    white-space: nowrap;
    transition: color 0.15s;
}
.tc-dl-link:hover { color: #fff; }
.tc-dl-link[hidden] { display: none; }

@keyframes tc-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.35; }
}

/* ── Settings button ─────────────────────────────────────────────────────────── */
.tc-settings-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.45);
    font-size: 1.05rem;
    width: 2rem;
    height: 2rem;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s, border-color 0.15s;
}
.tc-settings-btn:hover { color: #fff; border-color: rgba(255,255,255,0.3); }

/* ── Character select ────────────────────────────────────────────────────────── */
.tc-char-sel {
    text-align: center;
    padding-top: 2rem;
}
.tc-char-sel-hint {
    color: rgba(255,255,255,0.4);
    font-size: 0.8rem;
    margin-bottom: 1.25rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}
.tc-char-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    max-width: 600px;
    margin: 0 auto 1.5rem;
}
.tc-char-btn {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.6);
    padding: 0.9rem 0.5rem;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
    letter-spacing: 0.01em;
}
.tc-char-btn:hover {
    background: rgba(255,255,255,0.07);
    color: #fff;
    border-color: rgba(255,255,255,0.22);
    transform: translateY(-1px);
}
.tc-char-btn.active {
    background: rgba(0,200,255,0.12);
    color: #00c8ff;
    border-color: rgba(0,200,255,0.4);
}
.tc-char-note {
    color: rgba(255,255,255,0.28);
    font-size: 0.73rem;
    line-height: 1.6;
    max-width: 460px;
    margin: 0 auto;
}

/* ── Game area ───────────────────────────────────────────────────────────────── */
.tc-game-wrap {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
}

/* ── HUD ─────────────────────────────────────────────────────────────────────── */
.tc-hud {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 1rem;
    padding: 0 2px;
}
.tc-hud-label {
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255,255,255,0.3);
    display: block;
    margin-bottom: 0.15em;
}
.tc-stocks-wrap { flex: 1; }
.tc-stocks {
    display: flex;
    gap: 0.4rem;
}
.tc-stock {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    transition: all 0.25s;
}
.tc-stock.active {
    background: #00c8ff;
    border-color: rgba(0,200,255,0.4);
    box-shadow: 0 0 8px rgba(0,200,255,0.4);
}
.tc-score-wrap { text-align: center; }
.tc-score {
    font-size: 1.9rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.02em;
    line-height: 1;
}
.tc-change-char {
    font-size: 0.7rem;
    padding: 0.3em 0.75em;
}

/* ── Canvas ──────────────────────────────────────────────────────────────────── */
.tc-canvas-wrap {
    position: relative;
    width: 100%;
    border-radius: 14px;
    overflow: hidden;
    background: #0a0a0e;
    border: 1px solid rgba(255,255,255,0.07);
    box-shadow: 0 8px 40px rgba(0,0,0,0.5);
    aspect-ratio: 476 / 358;
}
#tcCanvas {
    display: block;
    width: 100%;
    height: 100%;
    image-rendering: auto;
}

/* ── Feedback ────────────────────────────────────────────────────────────────── */
.tc-feedback {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    font-size: 3rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-shadow: 0 2px 20px rgba(0,0,0,0.9);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.08s, transform 0.08s;
}
.tc-feedback.active {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* ── Input legend ────────────────────────────────────────────────────────────── */
.tc-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.9rem;
    justify-content: center;
    width: 100%;
    padding: 0 2px;
}
.tc-hint {
    font-size: 0.72rem;
    color: rgba(255,255,255,0.38);
    display: flex;
    align-items: center;
    gap: 0.3rem;
}
.tc-hint-key {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.65);
    border-radius: 4px;
    padding: 0.1em 0.45em;
    font-size: 0.7rem;
    font-family: monospace;
    font-weight: 700;
}

/* ── Game over overlay ───────────────────────────────────────────────────────── */
.tc-gameover {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.7);
    border-radius: 14px;
    z-index: 10;
    backdrop-filter: blur(4px);
}
.tc-gameover-inner {
    text-align: center;
    padding: 1.75rem 2rem;
    border-radius: 14px;
    min-width: 280px;
    max-width: 400px;
    width: 90%;
    max-height: 90%;
    overflow-y: auto;
}
.tc-gameover-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(255,255,255,0.4);
    margin-bottom: 0.3rem;
}
.tc-gameover-score {
    font-size: 4rem;
    font-weight: 900;
    color: #fff;
    line-height: 1;
    margin-bottom: 1.25rem;
    letter-spacing: -0.03em;
}
.tc-gameover-btns {
    display: flex;
    gap: 0.6rem;
    justify-content: center;
    margin-top: 1rem;
}

/* ── Username submit ─────────────────────────────────────────────────────────── */
.tc-submit-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}
.tc-username-input {
    flex: 1;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 7px;
    color: #fff;
    font-size: 0.82rem;
    padding: 0.45em 0.7em;
    outline: none;
    min-width: 0;
}
.tc-username-input:focus {
    border-color: rgba(0,200,255,0.5);
    background: rgba(255,255,255,0.08);
}
.tc-submit-btn { padding: 0.45em 0.9em; white-space: nowrap; }
.tc-submit-msg {
    font-size: 0.72rem;
    color: #ff3366;
    min-height: 1em;
    margin-bottom: 0.75rem;
}

/* ── Leaderboard ─────────────────────────────────────────────────────────────── */
.tc-lb-wrap { margin-bottom: 1rem; }
.tc-lb-title {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255,255,255,0.35);
    margin-bottom: 0.5rem;
}
.tc-lb-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    text-align: left;
}
.tc-lb-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.5rem;
    border-radius: 6px;
    font-size: 0.78rem;
    background: rgba(255,255,255,0.03);
}
.tc-lb-mine {
    background: rgba(0,200,255,0.1);
    border: 1px solid rgba(0,200,255,0.2);
    color: #00c8ff;
}
.tc-lb-rank {
    width: 1.4rem;
    text-align: right;
    color: rgba(255,255,255,0.3);
    font-size: 0.7rem;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}
.tc-lb-name { flex: 1; font-weight: 600; }
.tc-lb-score { font-variant-numeric: tabular-nums; color: rgba(255,255,255,0.6); }
.tc-lb-empty { color: rgba(255,255,255,0.3); font-size: 0.75rem; text-align: center; padding: 0.5rem; }

/* ── Settings overlay ────────────────────────────────────────────────────────── */
.tc-settings-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.tc-settings-inner {
    width: 100%;
    max-width: 500px;
    border-radius: 14px;
    padding: 1.5rem;
    max-height: 90vh;
    overflow-y: auto;
}
.tc-settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}
.tc-settings-header h2 { margin: 0; font-size: 1.05rem; }
.tc-settings-close {
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.4);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
}
.tc-settings-close:hover { color: #fff; }

.tc-bind-list { display: flex; flex-direction: column; gap: 0.5rem; }
.tc-bind-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.6rem;
    background: rgba(255,255,255,0.03);
    border-radius: 7px;
    border: 1px solid rgba(255,255,255,0.06);
}
.tc-bind-action { flex: 1; font-size: 0.8rem; color: rgba(255,255,255,0.6); }
.tc-bind-current {
    font-family: monospace;
    font-size: 0.75rem;
    color: #00c8ff;
    min-width: 7rem;
    text-align: right;
}
.tc-bind-btn, .tc-bind-reset {
    font-size: 0.7rem;
    padding: 0.22em 0.6em;
    border-radius: 5px;
    cursor: pointer;
    white-space: nowrap;
}
.tc-bind-btn { background: rgba(0,200,255,0.1); border: 1px solid rgba(0,200,255,0.3); color: #00c8ff; }
.tc-bind-btn:hover { background: rgba(0,200,255,0.2); }
.tc-bind-reset { background: transparent; border: 1px solid rgba(255,255,255,0.12); color: rgba(255,255,255,0.4); }
.tc-bind-reset:hover { color: #fff; border-color: rgba(255,255,255,0.3); }

.tc-latency-row { flex-wrap: wrap; }
.tc-latency-ctrl { display: flex; align-items: center; gap: 0.5rem; }
.tc-latency-ctrl input[type=range] { accent-color: #00c8ff; }

/* ── Shared button styles ────────────────────────────────────────────────────── */
.btn-primary {
    background: #00c8ff;
    color: #000;
    border: none;
    padding: 0.5rem 1.1rem;
    border-radius: 8px;
    font-weight: 800;
    font-size: 0.82rem;
    cursor: pointer;
    letter-spacing: 0.02em;
    transition: filter 0.15s;
}
.btn-primary:hover { filter: brightness(1.1); }
.btn-primary:disabled { opacity: 0.5; cursor: default; }
.btn-ghost {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.18);
    color: rgba(255,255,255,0.6);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s;
}
.btn-ghost:hover { border-color: rgba(255,255,255,0.35); color: #fff; }

.glass-panel {
    background: rgba(18,18,28,0.92);
    border: 1px solid rgba(255,255,255,0.08);
    backdrop-filter: blur(16px);
}

/* ── Responsive ──────────────────────────────────────────────────────────────── */
@media (max-width: 540px) {
    .tc-char-grid { grid-template-columns: repeat(2, 1fr); }
    .tc-gameover-score { font-size: 3rem; }
    .tc-feedback { font-size: 2.2rem; }
}

/* Credit footer */
.tc-credit {
    text-align: center;
    padding: 10px;
    font-size: 0.72rem;
    color: rgba(255,255,255,0.22);
}
.tc-credit a {
    color: rgba(255,255,255,0.35);
    text-decoration: none;
}
.tc-credit a:hover {
    color: rgba(255,255,255,0.6);
    text-decoration: underline;
}
