:root {
    --bg: #0a0a12;
    --panel: #12121e;
    --panel2: #1a1a2a;
    --ink: #e8e6f0;
    --dim: #8a88a0;
    --neon: #ff2d78;
    --neon2: #00e5ff;
    --gold: #ffd23f;
    --good: #3ddc84;
    --bad: #ff4d4d;
    --line: #2a2a3e;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: "Courier New", monospace;
    font-size: 15px;
    line-height: 1.45;
}

#stage {
    max-width: 900px;
    margin: 0 auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 100vh;
}

/* Top bar */
#topbar {
    display: flex;
    align-items: baseline;
    gap: 16px;
    padding: 8px 12px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 6px;
}

.brand {
    font-size: 20px;
    font-weight: bold;
    letter-spacing: 3px;
    color: var(--neon);
    text-shadow: 0 0 8px rgba(255, 45, 120, 0.5);
}

.date {
    color: var(--dim);
    font-size: 14px;
    transition: color 0.15s, text-shadow 0.15s;
}

.date.flash {
    color: var(--neon2);
    text-shadow: 0 0 10px rgba(0, 229, 255, 0.8);
}

.daycount {
    color: var(--neon);
    font-size: 13px;
    font-weight: bold;
    letter-spacing: 1px;
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 2px 8px;
    background: var(--panel2);
}

#topbar.tick {
    border-color: var(--neon2);
    box-shadow: 0 0 12px rgba(0, 229, 255, 0.25);
}

.money {
    margin-left: auto;
    font-size: 16px;
    color: var(--gold);
    font-weight: bold;
}

/* Stats bar */
#statsbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    padding: 8px 12px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 6px;
    align-items: center;
}

.stat {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

.stat .label {
    color: var(--dim);
    min-width: 70px;
}

.stat .bar {
    width: 90px;
    height: 8px;
    background: var(--panel2);
    border: 1px solid var(--line);
    border-radius: 4px;
    overflow: hidden;
}

.stat .bar i {
    display: block;
    height: 100%;
    background: var(--neon2);
    transition: width 0.3s;
}

.stat[data-stat="health"] .bar i { background: var(--good); }
.stat[data-stat="creativity"] .bar i { background: #b06cff; }
.stat[data-stat="happiness"] .bar i { background: var(--gold); }
.stat[data-stat="alertness"] .bar i { background: var(--neon2); }
.stat[data-stat="fame"] .bar i { background: var(--neon); }

.stat .val {
    min-width: 28px;
    text-align: right;
    color: var(--ink);
}

.addictions {
    font-size: 12px;
    color: var(--dim);
    margin-left: auto;
}

/* Canvas */
canvas {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 6;
    background: #05050a;
    border: 1px solid var(--line);
    border-radius: 6px;
    display: block;
}

/* Log */
#log {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 10px 12px;
    min-height: 180px;
    max-height: 320px;
    overflow-y: auto;
    font-size: 14px;
}

#log .entry {
    margin-bottom: 6px;
    padding-bottom: 6px;
    border-bottom: 1px dashed var(--line);
}

#log .entry:last-child {
    border-bottom: none;
}

#log .entry .stamp {
    color: var(--dim);
    font-size: 12px;
    margin-right: 8px;
}

#log .entry.good { color: var(--good); }
#log .entry.bad { color: var(--bad); }
#log .entry.neon { color: var(--neon); }
#log .entry.gold { color: var(--gold); }
#log .entry.dim { color: var(--dim); }

/* Actions */
#actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

#actions button,
#wizard button {
    background: var(--panel2);
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 8px 14px;
    font-family: "Courier New", monospace;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

#actions button:hover,
#wizard button:hover {
    background: #24243a;
    border-color: var(--neon);
}

#actions button:disabled,
#wizard button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

#actions button.primary {
    border-color: var(--neon);
    color: var(--neon);
}

/* Wizard */
#wizard {
    background: var(--panel);
    border: 1px solid var(--neon);
    border-radius: 6px;
    padding: 12px;
}

#wizard h3 {
    margin: 0 0 8px;
    color: var(--neon);
    font-size: 16px;
}

#wizard .wiz-step {
    margin-bottom: 10px;
}

#wizard .wiz-step .wiz-label {
    color: var(--dim);
    font-size: 13px;
    margin-bottom: 6px;
}

#wizard .wiz-options {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

#wizard .wiz-options button.selected {
    border-color: var(--neon2);
    color: var(--neon2);
}

#wizard .wiz-nav {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

/* Event modal */
#eventModal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

.event-box {
    background: var(--panel);
    border: 1px solid var(--neon);
    border-radius: 8px;
    padding: 20px;
    max-width: 520px;
    width: 90%;
    box-shadow: 0 0 30px rgba(255, 45, 120, 0.2);
}

#eventText {
    font-size: 15px;
    line-height: 1.5;
    margin-bottom: 16px;
    color: var(--ink);
}

#eventChoices {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#eventChoices button {
    text-align: left;
}

.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 600px) {
    .stat .bar { width: 60px; }
    .stat .label { min-width: 0; }
    #topbar { flex-wrap: wrap; }
    .money { margin-left: 0; }
    .charts-btn { font-size: 12px; padding: 2px 8px; }
}

/* Charts button */
.charts-btn {
    background: var(--panel2);
    color: var(--neon2);
    border: 1px solid var(--neon);
    border-radius: 4px;
    padding: 4px 10px;
    font-family: "Courier New", monospace;
    font-size: 13px;
    font-weight: bold;
    letter-spacing: 1px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.charts-btn:hover {
    background: var(--neon);
    color: var(--bg);
    border-color: var(--neon2);
    box-shadow: 0 0 10px rgba(255, 45, 120, 0.3);
}

/* Charts modal */
#chartsModal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    padding: 12px;
}

.charts-box {
    background: var(--panel);
    border: 1px solid var(--neon);
    border-radius: 8px;
    padding: 16px;
    max-width: 720px;
    width: 100%;
    box-shadow: 0 0 30px rgba(255, 45, 120, 0.2);
    display: flex;
    flex-direction: column;
    max-height: 80vh;
}

.charts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
}

.charts-title {
    font-size: 16px;
    font-weight: bold;
    letter-spacing: 1px;
    color: var(--neon);
    text-shadow: 0 0 8px rgba(255, 45, 120, 0.5);
}

/* Chart section headers (Singles / Albums) */
.chart-section-title {
    font-size: 14px;
    font-weight: bold;
    letter-spacing: 1px;
    color: var(--neon2);
    padding: 6px 0;
    border-bottom: 1px solid var(--line);
    margin-top: 8px;
}

/* Muted rows for player entries outside the top 10 */
.chart-row.muted {
    opacity: 0.45;
    border-left: 2px dashed var(--neon);
}

.charts-close {
    background: var(--panel2);
    color: var(--dim);
    border: 1px solid var(--line);
    border-radius: 4px;
    width: 28px;
    height: 28px;
    font-family: "Courier New", monospace;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.15s;
}

.charts-close:hover {
    background: var(--neon);
    color: var(--bg);
    border-color: var(--neon2);
}

#chartsList {
    flex: 1;
    overflow-y: auto;
}

/* Chart rows */
.chart-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 0;
    border-bottom: 1px dashed var(--line);
    font-size: 13px;
}

.chart-row:last-child {
    border-bottom: none;
}

.chart-row.player {
    background: rgba(255, 45, 120, 0.08);
    border-left: 2px solid var(--neon);
}

.chart-pos {
    color: var(--neon2);
    font-weight: bold;
    min-width: 28px;
    font-size: 13px;
}

.chart-pos:nth-child(3) {
    color: var(--gold);
}

.chart-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.chart-title {
    color: var(--ink);
    font-size: 13px;
}

.chart-artist {
    color: var(--dim);
    font-size: 11px;
}

.chart-weeks {
    color: var(--dim);
    font-size: 11px;
    min-width: 30px;
    text-align: right;
}

.charts-empty {
    color: var(--dim);
    font-size: 13px;
    padding: 24px;
    text-align: center;
}

/* Saves modal */
#savesModal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    padding: 12px;
}

.saves-box {
    background: var(--panel);
    border: 1px solid var(--neon);
    border-radius: 8px;
    padding: 16px;
    max-width: 720px;
    width: 100%;
    box-shadow: 0 0 30px rgba(255, 45, 120, 0.2);
    display: flex;
    flex-direction: column;
    max-height: 80vh;
}

.saves-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
}

.saves-title {
    font-size: 16px;
    font-weight: bold;
    letter-spacing: 1px;
    color: var(--neon);
    text-shadow: 0 0 8px rgba(255, 45, 120, 0.5);
}

#savesList {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.save-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--panel2);
    font-size: 13px;
}

.save-row.active {
    border-color: var(--neon2);
    box-shadow: 0 0 8px rgba(0, 229, 255, 0.15);
}

.save-num {
    color: var(--neon2);
    font-weight: bold;
    min-width: 64px;
    font-size: 12px;
    letter-spacing: 1px;
}

.save-info {
    flex: 1;
    color: var(--ink);
}

.save-actions {
    display: flex;
    gap: 6px;
}

.save-actions button {
    background: var(--panel);
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 4px 10px;
    font-family: "Courier New", monospace;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.save-actions button:hover {
    background: #24243a;
    border-color: var(--neon);
}

.save-actions button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Highscore modal */
#hsModal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    padding: 12px;
}

.hs-box {
    background: var(--panel);
    border: 1px solid var(--neon);
    border-radius: 8px;
    padding: 20px;
    max-width: 500px;
    width: 100%;
    box-shadow: 0 0 30px rgba(255, 45, 120, 0.2);
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: center;
}

.hs-header {
    display: flex;
    justify-content: center;
}

.hs-title {
    font-size: 20px;
    font-weight: bold;
    color: var(--neon);
}

#hsPrompt {
    font-size: 15px;
    color: var(--ink);
    padding: 10px;
}

#hsInitials {
    display: flex;
    justify-content: center;
    gap: 16px;
    padding: 10px;
}

.hs-initial {
    font-family: "Courier New", monospace;
    font-size: 28px;
    font-weight: bold;
    color: var(--gold);
    min-width: 40px;
    text-align: center;
    background: var(--panel2);
    padding: 4px 8px;
    border-radius: 4px;
}

.hs-initial.active {
    background: var(--neon);
    color: var(--bg);
}

#hsInstructions {
    font-size: 11px;
    color: var(--dim);
    padding: 8px;
    line-height: 1.5;
}

/* Career modal */
#careerModal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    padding: 12px;
}

.career-box {
    background: var(--panel);
    border: 1px solid var(--neon);
    border-radius: 8px;
    padding: 16px;
    max-width: 580px;
    width: 100%;
    box-shadow: 0 0 30px rgba(255, 45, 120, 0.2);
    display: flex;
    flex-direction: column;
    max-height: 80vh;
}

.career-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
}

.career-title {
    font-size: 16px;
    font-weight: bold;
    letter-spacing: 1px;
    color: var(--neon);
    text-shadow: 0 0 8px rgba(255, 45, 120, 0.5);
}

#careerList {
    flex: 1;
    overflow-y: auto;
    padding-right: 4px;
}

.career-section {
    margin-bottom: 10px;
}

.career-section h4 {
    font-size: 14px;
    font-weight: bold;
    letter-spacing: 1px;
    color: var(--neon2);
    padding: 6px 0;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    gap: 6px;
}

.career-icon {
    color: var(--gold);
}

.career-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    font-size: 13px;
}

.career-label {
    color: var(--dim);
}

.career-value {
    color: var(--ink);
    font-weight: bold;
    text-align: right;
}

.career-row.emphasized .career-value {
    color: var(--gold);
}

.career-row.bad .career-value {
    color: var(--bad);
}

.career-divider {
    height: 1px;
    background: var(--line);
    margin: 8px 0;
}

.career-sub {
    color: var(--gold);
    font-size: 12px;
    padding: 2px 0 2px 12px;
}
