/* Shared tokens, nav, hero, tabs and the code viewer are in shared/site.css. */

/* ======= Hero ======= */

.github-link {
    display: inline-flex;
    align-items: center;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--accent);
    text-decoration: none;
    margin-top: 20px;
    transition: opacity 0.2s;
    letter-spacing: 0.03em;
}

.github-link:hover {
    opacity: 0.75;
}

/* ======= How to Run ======= */

.run-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px 28px;
}

.run-card p {
    font-family: var(--font-mono);
    color: var(--muted);
    font-size: 0.875rem;
    margin-bottom: 16px;
    line-height: 1.6;
}

.run-card pre {
    margin: 0;
}

.run-card code {
    font-family: var(--font-mono);
    font-size: 0.82rem;
}

/* ======= Playable Classes ======= */

.class-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.class-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 24px;
    transition: border-color 0.2s;
}

.class-card:hover {
    border-color: var(--accent);
}

.class-icon {
    font-size: 1.8rem;
    display: block;
    margin-bottom: 12px;
}

.class-card h3 {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 8px;
    color: var(--text);
}

.class-stats {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--muted);
    margin-bottom: 10px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.class-special-badge {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    background: var(--accent-glow);
    color: var(--accent);
    border: 1px solid rgba(255,107,43,0.3);
    border-radius: 4px;
    padding: 2px 8px;
    margin-bottom: 8px;
}

.class-special-desc {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: var(--muted);
    margin-bottom: 8px;
    line-height: 1.5;
}

.class-flavor {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--muted);
    font-style: italic;
}

/* ======= OOP Architecture ======= */

.arch-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 28px 32px;
}

.arch-intro {
    font-family: var(--font-mono);
    color: var(--muted);
    font-size: 0.875rem;
    margin-bottom: 24px;
    line-height: 1.6;
}

.arch-tree {
    margin-bottom: 28px;
}

.arch-node {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 700;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 14px;
    margin-bottom: 8px;
    color: var(--text);
}

.arch-node.root {
    border-color: rgba(255,107,43,0.4);
    color: var(--accent);
}

.arch-node.leaf {
    font-size: 0.78rem;
    font-weight: 400;
    opacity: 0.8;
}

.arch-badge {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    text-transform: uppercase;
    background: rgba(255,255,255,0.06);
    border-radius: 4px;
    padding: 2px 6px;
    color: var(--muted);
}

.arch-badge.iface {
    background: rgba(255,107,43,0.1);
    color: var(--accent);
}

.arch-branches {
    padding-left: 24px;
    border-left: 1px solid var(--border);
    margin-left: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 8px;
}

.arch-branch {
    display: flex;
    flex-direction: column;
}

.arch-node-desc {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: var(--muted);
    margin: 4px 0 8px 4px;
    line-height: 1.5;
}

.arch-subbranches {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding-left: 16px;
    border-left: 1px solid var(--border);
    margin-left: 8px;
}

.arch-features {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 4px;
}

.arch-feature {
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
}

.arch-feature-label {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--accent);
    margin-bottom: 4px;
}

.arch-feature-desc {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: var(--muted);
    line-height: 1.5;
}

/* ======= Dungeon Rooms ======= */

.rooms-row {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.rooms-row::-webkit-scrollbar {
    height: 4px;
}

.rooms-row::-webkit-scrollbar-track {
    background: transparent;
}

.rooms-row::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.room-card {
    flex-shrink: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
    min-width: 100px;
    text-align: center;
}

.room-card.boss {
    border-color: rgba(255,107,43,0.5);
    background: rgba(255,107,43,0.05);
}

.room-card.battle {
    border-color: rgba(255,107,43,0.15);
}

.room-icon {
    font-size: 1.3rem;
    display: block;
    margin-bottom: 6px;
}

.room-num {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--muted);
    display: block;
    margin-bottom: 2px;
    letter-spacing: 0.08em;
}

.room-name {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text);
    font-weight: 400;
    display: block;
    line-height: 1.3;
}

.room-type-badge {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
    margin-top: 4px;
}

.room-card.boss .room-type-badge {
    color: var(--accent);
}

/* ======= Code Explorer ======= */

.code-explorer {
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
}

.tab-bar {
    display: flex;
    overflow-x: auto;
    background: rgba(255,255,255,0.02);
    border-bottom: 1px solid var(--border);
    scrollbar-width: none;
}

.tab-bar::-webkit-scrollbar {
    display: none;
}

.tab {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--muted);
    background: none;
    border: none;
    padding: 12px 18px;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.2s;
    border-bottom: 2px solid transparent;
    letter-spacing: 0.05em;
}

.tab.active {
    color: var(--text);
    border-bottom-color: var(--accent);
}

.tab:hover:not(.active) {
    color: var(--text);
}

.code-panels {
    background: var(--code-bg);
}

.code-panel {
    display: none;
}

.code-panel.active {
    display: block;
}

.code-panel pre {
    margin: 0;
    padding: 24px;
    overflow-x: auto;
    max-height: 560px;
    overflow-y: auto;
}

.code-panel code {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    line-height: 1.6;
}

.hljs {
    background: transparent !important;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {

    .class-grid {
        grid-template-columns: 1fr;
    }

    .arch-features {
        grid-template-columns: 1fr;
    }

    .arch-card {
        padding: 20px;
    }

    .rooms-row {
        gap: 8px;
    }
}

/* ═══════════════════════════════════════════════════════
   HEROFIGHT: GAME UI
═══════════════════════════════════════════════════════ */

/* ─── Wrapper ────────────────────────────────────────── */
.game-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 60px;
}

/* ─── Screens ────────────────────────────────────────── */
.g-screen { display: none; flex-direction: column; }
.g-screen--active { display: flex; }

/* ─── Title screen ───────────────────────────────────── */
#g-title {
    align-items: center;
    justify-content: center;
    min-height: 340px;
    background: radial-gradient(ellipse at 60% 40%, rgba(255,107,43,0.07) 0%, transparent 65%);
}
.g-title-content { text-align: center; padding: 48px 24px; }
.g-eyebrow {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.16em;
    margin-bottom: 12px;
}
.g-logo {
    font-family: var(--font-display);
    font-size: clamp(2.8rem, 7vw, 5rem);
    font-weight: 800;
    letter-spacing: -0.04em;
    color: var(--text);
    margin-bottom: 10px;
    line-height: 1;
}
.g-tagline {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--muted);
    margin-bottom: 32px;
}

/* ─── Primary button ─────────────────────────────────── */
.g-btn-primary {
    display: inline-flex;
    align-items: center;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--on-accent);
    background: var(--accent);
    border: none;
    padding: 12px 32px;
    border-radius: 8px;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.15s;
}
.g-btn-primary:hover { opacity: 0.88; transform: translateY(-1px); }

/* ─── Char select ────────────────────────────────────── */
#g-select { align-items: center; justify-content: center; min-height: 420px; }
.g-select-content {
    padding: 32px 24px;
    width: 100%;
    max-width: 620px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}
.g-section-title {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    text-align: center;
}
.g-name-row { width: 100%; }
.g-name-input {
    width: 100%;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
    font-family: var(--font-mono);
    font-size: 0.88rem;
    color: var(--text);
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}
.g-name-input:focus { border-color: var(--accent); }
.g-name-input::placeholder { color: var(--muted); }
.g-class-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    width: 100%;
}
.g-class-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px 10px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    gap: 4px;
}
.g-class-card:hover,
.g-class-card--active { border-color: var(--accent); background: var(--accent-glow); }
.g-class-icon { font-size: 1.5rem; margin-bottom: 4px; }
.g-class-name {
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text);
}
.g-class-stats {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--muted);
}
.g-class-special {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--accent);
    background: var(--accent-glow);
    border: 1px solid rgba(255,107,43,0.2);
    border-radius: 4px;
    padding: 2px 8px;
    margin-top: 2px;
}
.g-class-flavor {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--muted);
    font-style: italic;
    margin-top: 2px;
}

/* ─── Main game layout ───────────────────────────────── */
#g-main { min-height: 500px; }

.g-room-bar {
    display: flex;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    scrollbar-width: none;
}
.g-room-bar::-webkit-scrollbar { display: none; }
.g-room-dot {
    flex: 1;
    min-width: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 4px 8px;
    border-right: 1px solid var(--border);
    opacity: 0.3;
    transition: opacity 0.3s, background 0.3s;
}
.g-room-dot:last-child { border-right: none; }
.g-room-dot.is-done    { opacity: 0.4; }
.g-room-dot.is-current { opacity: 1; background: rgba(255,107,43,0.05); }
.g-room-dot.is-boss.is-current { background: rgba(220,60,60,0.07); }
.g-room-dot-icon  { font-size: 0.9rem; margin-bottom: 3px; }
.g-room-dot-name  {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    text-align: center;
    line-height: 1.25;
}
.g-room-dot.is-current .g-room-dot-name { color: var(--accent); }

.g-main-layout {
    display: grid;
    grid-template-columns: 180px 1fr;
}

/* ─── Player panel ───────────────────────────────────── */
.g-player-panel {
    padding: 16px 14px;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-height: 440px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.g-panel-header { display: flex; justify-content: space-between; align-items: center; }
.g-player-class {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent);
}
.g-player-level { font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted); }
.g-player-name {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.g-hp-section { display: flex; flex-direction: column; gap: 5px; }
.g-hp-label {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--muted);
}
.g-hp-track {
    height: 6px;
    background: rgba(255,255,255,0.07);
    border-radius: 3px;
    overflow: hidden;
}
.g-hp-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.4s ease, background 0.4s ease;
}
.g-stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.g-stat {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 5px 8px;
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.g-stat-lbl {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}
.g-stat-val {
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text);
}
.g-inv { margin-top: 2px; }
.g-inv-label {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
    margin-bottom: 6px;
}
.g-inv-item {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--muted);
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 3px 7px;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.g-inv-empty {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--muted);
    opacity: 0.45;
}

/* ─── Action area ────────────────────────────────────── */
.g-action-area { display: flex; flex-direction: column; overflow: hidden; }
.g-room-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.g-room-badge {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 3px 10px;
    border-radius: 100px;
    border: 1px solid;
    flex-shrink: 0;
}
.g-badge-battle   { color: var(--accent);   border-color: rgba(255,107,43,0.35);  background: rgba(255,107,43,0.08);  }
.g-badge-boss     { color: #e55;            border-color: rgba(220,60,60,0.4);    background: rgba(220,60,60,0.07);   }
.g-badge-treasure { color: #f5c542;         border-color: rgba(245,197,66,0.35);  background: rgba(245,197,66,0.07);  }
.g-badge-shop     { color: #7ec8e3;         border-color: rgba(126,200,227,0.3);  background: rgba(126,200,227,0.06); }
.g-badge-rest     { color: #7dd87d;         border-color: rgba(125,216,125,0.3);  background: rgba(125,216,125,0.06); }
.g-room-name {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
}

/* ─── Enemy card ─────────────────────────────────────── */
.g-enemy-card {
    margin: 12px 16px 0;
    background: rgba(220,60,60,0.04);
    border: 1px solid rgba(220,60,60,0.14);
    border-radius: 10px;
    padding: 12px 14px;
    flex-shrink: 0;
}
.g-hidden { display: none !important; }
.g-enemy-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.g-enemy-name   { font-family: var(--font-display); font-size: 0.9rem; font-weight: 700; color: var(--text); }
.g-enemy-hp-txt { font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted); }
.g-enemy-hp-track {
    height: 5px;
    background: rgba(255,255,255,0.07);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}
.g-enemy-hp-fill { height: 100%; background: #e55; border-radius: 3px; transition: width 0.4s ease; }
.g-enemy-stats { font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted); }

/* ─── Battle log ─────────────────────────────────────── */
.g-log {
    flex: 1;
    padding: 10px 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 3px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.06) transparent;
    min-height: 120px;
    max-height: 220px;
}
.g-log p      { margin: 0; font-family: var(--font-mono); font-size: 0.875rem; line-height: 1.55; }
.g-log-sys    { color: var(--muted); }
.g-log-atk    { color: #ff9060; }
.g-log-enemy  { color: #cc7070; }
.g-log-ok     { color: #7dd87d; }
.g-log-info   { color: var(--text); opacity: 0.75; }
.g-crit       { color: #ffe066; font-weight: 700; }

/* ─── Action buttons ─────────────────────────────────── */
.g-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}
.g-btn {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    color: rgba(255,255,255,0.65);
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 8px 14px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
    white-space: nowrap;
}
.g-btn:hover          { color: var(--text); border-color: rgba(255,255,255,0.22); background: rgba(255,255,255,0.07); }
.g-btn--accent        { color: var(--accent); border-color: rgba(255,107,43,0.3); background: rgba(255,107,43,0.07); }
.g-btn--accent:hover  { background: rgba(255,107,43,0.14); border-color: rgba(255,107,43,0.5); }
.g-btn--off           { opacity: 0.28; cursor: not-allowed; pointer-events: none; }

/* ─── End screen ─────────────────────────────────────── */
#g-end { align-items: center; justify-content: center; min-height: 340px; }
.g-end-content   { text-align: center; padding: 48px 24px; }
.g-end-eyebrow   { font-family: var(--font-mono); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.16em; margin-bottom: 12px; }
.g-end--defeat  .g-end-eyebrow { color: #e55; }
.g-end--victory .g-end-eyebrow { color: var(--accent); }
.g-end-title {
    font-family: var(--font-display);
    font-size: clamp(2rem, 5vw, 3.2rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text);
    margin-bottom: 12px;
}
.g-end-stats { font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted); margin-bottom: 28px; }

@media (max-width: 640px) {
    .g-main-layout { grid-template-columns: 1fr; }
    .g-player-panel {
        border-right: none;
        border-bottom: 1px solid var(--border);
        min-height: auto;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 10px;
    }
    .g-stat-grid { grid-template-columns: repeat(5, 1fr); }
    .g-class-row { grid-template-columns: 1fr; }
    .g-log { max-height: 150px; }
}
