:root {
    --bg-dark: #081626;
    --bg-panel: #11253a;
    --bg-card: #1a334c;
    --bg-hover: #254662;
    --border: #2a4c69;
    --border-light: #4f7ea6;
    --text: #eaf4ff;
    --text-muted: #9db8d5;
    --text-dim: #6f8ba9;
    --gold: #f8d362;
    --gold-dark: #b8892d;
    --red: #ff5555;
    --red-soft: #d64747;
    --green: #6de39f;
    --blue: #66beff;
    --purple: #8ea8ff;
    --orange: #f09a43;
    --cyan: #66e2dd;
    --pink: #f58bc2;
    --steel: #9fb0c8;

    --font-pixel: 'Press Start 2P', monospace;
    --font-body: 'VT323', monospace;
    --radius: 8px;
    --radius-lg: 14px;
}

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

/* Disable text selection globally for game feel */
*:not(input):not(textarea):not(select):not(option):not([contenteditable="true"]):not([contenteditable=""]):not(.allow-select) {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Allow normal selection in form/editable fields */
input,
textarea,
select,
option,
[contenteditable="true"],
[contenteditable=""] {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

html, body {
    height: 100vh; /* Fallback for older browsers */
    height: 100dvh;
    overflow: hidden;
    background:
        radial-gradient(circle at 15% 10%, rgba(102, 190, 255, 0.16), transparent 35%),
        radial-gradient(circle at 85% 85%, rgba(248, 211, 98, 0.14), transparent 32%),
        linear-gradient(180deg, #0b1f34 0%, #081626 65%, #06111c 100%);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 18px;
}

/* ===== GAME SHELL ===== */
.game-shell {
    display: grid;
    grid-template-rows: auto 1fr auto;
    height: 100vh;
    height: 100dvh;
    width: 100%;
    max-width: none;
    margin: 0;
    overflow: hidden;
}

.game-layout {
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
}

.character-panel {
    background: linear-gradient(180deg, rgba(10, 28, 46, 0.95), rgba(8, 20, 34, 0.95));
    border-bottom: 1px solid var(--border);
}

.play-panel {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.play-panel .main-content {
    flex: 1;
    min-height: 0;
}

/* ===== TOP BAR ===== */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--bg-panel);
    border-bottom: 2px solid var(--border);
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.top-bar-logo {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    image-rendering: pixelated;
}

.top-bar-title {
    font-family: var(--font-pixel);
    font-size: 10px;
    color: var(--gold);
    line-height: 1.4;
}

.top-bar-title small {
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--text-muted);
    display: block;
}

.top-bar-right {
    display: flex;
    gap: 8px;
}

.icon-btn {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    transition: all 0.15s;
}

.icon-btn:hover { background: var(--bg-hover); color: var(--text); }

/* ===== MAIN CONTENT ===== */
.main-content {
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

/* ===== CHARACTER HEADER ===== */
.char-header {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px;
    padding: 12px;
    background: linear-gradient(180deg, var(--bg-panel) 0%, var(--bg-dark) 100%);
    border-bottom: 1px solid var(--border);
}

.char-portrait {
    position: relative;
    width: 90px;
    height: 120px;
    background: var(--bg-card);
    border: 2px solid var(--border-light);
    border-radius: var(--radius);
    overflow: hidden;
}

.char-portrait img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    image-rendering: pixelated;
}

.char-portrait .rank-badge {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.85);
    text-align: center;
    font-family: var(--font-pixel);
    font-size: 7px;
    padding: 3px;
    color: var(--gold);
    letter-spacing: 0.5px;
}

.char-stats {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
}

.char-name {
    font-family: var(--font-pixel);
    font-size: 11px;
    color: var(--text);
    line-height: 1.3;
}

.char-name small {
    font-family: var(--font-body);
    font-size: 15px;
    color: var(--text-muted);
    display: block;
    margin-top: 2px;
}

.stat-bars {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.stat-row {
    display: grid;
    grid-template-columns: 70px 1fr 30px;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--text-muted);
}

.stat-bar {
    height: 10px;
    background: rgba(255,255,255,0.08);
    border-radius: 5px;
    overflow: hidden;
}

.stat-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.5s ease;
}

.stat-fill.integrity { background: linear-gradient(90deg, var(--green), #88ff88); }
.stat-fill.popularity { background: linear-gradient(90deg, var(--blue), #88ccff); }
.stat-fill.health { background: linear-gradient(90deg, var(--red), #ff8888); }

.char-resources {
    display: flex;
    gap: 12px;
    margin-top: 4px;
}

.resource {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 16px;
    color: var(--gold);
}

.resource .icon { font-size: 14px; }
.resource .val { font-family: var(--font-pixel); font-size: 9px; }

/* ===== LEGACY OVERVIEW ===== */
.legacy-hero {
    margin: 12px;
    padding: 14px;
    border: 3px solid var(--gold-dark);
    border-radius: 12px;
    background:
        linear-gradient(180deg, rgba(5, 14, 24, 0.32), rgba(7, 20, 33, 0.78)),
        linear-gradient(135deg, #0f3e66, #133155 45%, #1b2f45);
    box-shadow:
        inset 0 0 0 2px #0b2135,
        0 10px 24px rgba(4, 10, 18, 0.45);
}

.legacy-kicker {
    display: inline-block;
    margin-bottom: 8px;
    padding: 4px 8px;
    font-family: var(--font-pixel);
    font-size: 8px;
    color: #0b2338;
    background: linear-gradient(180deg, #f7d87a, #d9ac41);
    border: 1px solid #8f6a23;
    border-radius: 8px;
}

.legacy-hero h2 {
    font-family: var(--font-pixel);
    font-size: 11px;
    color: #fff2bb;
    line-height: 1.5;
    margin-bottom: 8px;
}

.legacy-hero p {
    color: #d9ebff;
    font-size: 18px;
    line-height: 1.35;
}

.command-hero h2 {
    font-size: 14px;
}

.legacy-score-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-top: 12px;
}

.legacy-score-row div {
    border: 1px solid #355f86;
    border-radius: 8px;
    background: rgba(8, 24, 40, 0.7);
    padding: 8px;
    text-align: center;
}

.legacy-score-row strong {
    display: block;
    font-family: var(--font-pixel);
    color: var(--gold);
    font-size: 10px;
    margin-bottom: 3px;
}

.legacy-score-row span {
    color: #a8c4e3;
    font-size: 14px;
}

.compact-section {
    padding-top: 0;
}

.command-strip {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 0 12px 12px;
}

.command-tile {
    min-height: 72px;
    padding: 10px;
    border: 2px solid #3d6687;
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(26, 66, 98, 0.96), rgba(16, 42, 66, 0.96));
    color: #dff0ff;
    font-family: var(--font-body);
    text-align: left;
    cursor: pointer;
    box-shadow: inset 0 0 0 1px rgba(121, 178, 219, 0.16);
    transition: transform 0.12s, border-color 0.18s, filter 0.18s;
}

.command-tile:hover {
    border-color: var(--gold-dark);
    filter: brightness(1.05);
    transform: translateY(-1px);
}

.command-tile span,
.next-rank-card span,
.focus-copy span,
.dossier-banner span {
    display: block;
    color: #96c4e7;
    font-size: 15px;
}

.command-tile strong,
.next-rank-card strong,
.event-signal-card strong {
    display: block;
    color: #fff2bb;
    font-family: var(--font-pixel);
    font-size: 9px;
    line-height: 1.45;
    margin-top: 3px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.dashboard-card {
    margin: 0;
}

.focus-list {
    display: grid;
    gap: 8px;
}

.focus-item {
    padding: 9px;
    border: 1px solid #355e80;
    border-radius: 8px;
    background: rgba(11, 30, 49, 0.72);
}

.focus-copy {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}

.focus-copy strong {
    color: #ecf7ff;
    font-family: var(--font-pixel);
    font-size: 9px;
}

.focus-track {
    height: 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.focus-track div {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--blue), var(--cyan));
}

.focus-item.good .focus-track div { background: linear-gradient(90deg, #59cb82, #9ef1bd); }
.focus-item.warn .focus-track div { background: linear-gradient(90deg, #d8a447, #ffe099); }
.focus-item.bad .focus-track div { background: linear-gradient(90deg, #cf4d55, #ff8a91); }

.next-rank-card {
    min-height: 128px;
    padding: 12px;
    border: 1px solid #795d2c;
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(71, 52, 17, 0.72), rgba(25, 37, 45, 0.72)),
        #152b3e;
}

.next-rank-card p {
    margin-top: 8px;
    color: #d6e9fa;
    font-size: 17px;
    line-height: 1.3;
}

.career-rail {
    display: grid;
    gap: 8px;
}

.career-node {
    display: grid;
    grid-template-columns: 34px 1fr;
    gap: 10px;
    align-items: center;
    border: 1px solid #315879;
    border-radius: 9px;
    padding: 8px;
    background: rgba(13, 29, 46, 0.66);
}

.career-node strong {
    display: block;
    font-family: var(--font-pixel);
    font-size: 8px;
    color: #d7ecff;
    margin-bottom: 2px;
}

.career-node small {
    font-size: 14px;
    color: #9ebcdb;
}

.career-node.active {
    border-color: var(--gold-dark);
    box-shadow: inset 0 0 0 1px rgba(248, 211, 98, 0.22);
}

.career-node.done {
    border-color: #4f8b64;
}

.career-node.locked {
    opacity: 0.8;
}

.career-dot {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    border: 1px solid #678bb2;
    background: #122f4b;
    color: #d8edff;
    display: grid;
    place-items: center;
    font-family: var(--font-pixel);
    font-size: 8px;
}

.career-node.done .career-dot {
    border-color: #4f8b64;
    background: #1a3e2c;
    color: #aaf1c4;
}

.career-node.active .career-dot {
    border-color: #b6842b;
    background: #3f2d10;
    color: #ffdf85;
}

/* ===== MAP SECTION ===== */
.map-section {
    padding: 12px;
}

.section-title {
    font-family: var(--font-pixel);
    font-size: 9px;
    color: var(--text-muted);
    margin-bottom: 10px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.kaltim-map-container {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.kaltim-map-container svg {
    width: 100%;
    height: 100%;
}

.map-command-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.map-dossier .info-grid {
    grid-template-columns: 1fr 1fr;
}

.dossier-banner {
    margin-bottom: 10px;
    padding: 12px;
    border: 2px solid #426f92;
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(21, 75, 100, 0.78), rgba(69, 51, 20, 0.72)),
        #17324a;
}

.dossier-banner strong {
    display: block;
    margin-top: 3px;
    color: #fff2bb;
    font-family: var(--font-pixel);
    font-size: 10px;
    line-height: 1.45;
}

.map-region {
    fill: #2a3a2a;
    stroke: var(--border-light);
    stroke-width: 1.5;
    cursor: pointer;
    transition: fill 0.2s, stroke 0.2s;
}

.map-region:hover {
    fill: #3a5a3a;
    stroke: var(--gold);
}

.map-region.owned {
    fill: #2a4a5a;
    stroke: var(--cyan);
}

.map-region.selected {
    fill: #3a5a3a;
    stroke: var(--gold);
    stroke-width: 2.5;
    filter: drop-shadow(0 0 6px rgba(255,215,64,0.4));
}

.map-label {
    font-family: var(--font-pixel);
    font-size: 6px;
    fill: var(--text-muted);
    pointer-events: none;
    text-anchor: middle;
}

.map-ocean {
    fill: #0a1525;
}

/* ===== EVENT PANEL ===== */
.event-panel {
    padding: 12px;
}

.event-stage {
    position: relative;
}

.event-balance-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.event-polarity {
    flex: 1;
    padding: 8px 10px;
    border: 2px solid #204668;
    border-radius: 10px;
    text-align: center;
    font-family: var(--font-pixel);
    font-size: 8px;
    line-height: 1.45;
    text-transform: uppercase;
}

.event-polarity.left {
    color: #abdcff;
    background: linear-gradient(180deg, #14395a, #102e49);
    box-shadow: inset 0 0 0 1px #3e6f98;
}

.event-polarity.right {
    color: #ffe1a6;
    background: linear-gradient(180deg, #4b3714, #3a2a11);
    border-color: #7f5f2a;
    box-shadow: inset 0 0 0 1px #b68a3b;
}

.event-card {
    position: relative;
    background:
        linear-gradient(180deg, rgba(9, 20, 33, 0.95), rgba(6, 14, 24, 0.95)),
        var(--bg-card);
    border: 3px solid var(--gold-dark);
    border-radius: 12px;
    overflow: hidden;
    box-shadow:
        inset 0 0 0 2px #11304c,
        0 16px 26px rgba(6, 16, 28, 0.45);
}

.dialog-card::before,
.dialog-card::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: linear-gradient(135deg, #f2cc72, #a2742a);
    border: 1px solid #5e4318;
}

.dialog-card::before {
    left: 14px;
    bottom: 14px;
}

.dialog-card::after {
    right: 14px;
    top: 58px;
}

.event-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: linear-gradient(180deg, rgba(248, 211, 98, 0.14), rgba(248, 211, 98, 0.04));
    border-bottom: 1px solid #2c4b67;
}

.event-icon {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    background: linear-gradient(180deg, #214467, #132f49);
    border: 2px solid #6798c4;
    border-radius: var(--radius);
    font-size: 22px;
}

.event-title {
    font-family: var(--font-pixel);
    font-size: 9px;
    color: var(--gold);
    line-height: 1.4;
}

.event-title small {
    font-family: var(--font-body);
    font-size: 15px;
    color: #c0d8ef;
    display: block;
    margin-top: 2px;
}

.event-flavor {
    margin: 12px 12px 0;
    padding: 8px 10px;
    border: 1px solid #476b8f;
    border-left: 4px solid var(--gold-dark);
    background: rgba(12, 33, 52, 0.7);
    color: #d8eaff;
    font-family: var(--font-body);
    font-size: 16px;
    letter-spacing: 0.03em;
}
.event-body {
    padding: 12px;
    font-size: 18px;
    color: #e7f3ff;
    line-height: 1.5;
}

.event-choices {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 12px 12px;
}

.choice-btn {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    background: linear-gradient(180deg, #193750, #132d43);
    border: 2px solid #325874;
    border-radius: var(--radius);
    color: #e8f3ff;
    font-family: var(--font-body);
    font-size: 17px;
    text-align: left;
    cursor: pointer;
    transition: transform 0.12s, filter 0.2s, box-shadow 0.2s;
}

.choice-btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.06);
    box-shadow: 0 4px 12px rgba(2, 10, 18, 0.35);
}

.choice-btn:active {
    transform: scale(0.98);
}

.choice-label {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    background: var(--bg-card);
    border: 2px solid var(--border-light);
    border-radius: 50%;
    font-family: var(--font-pixel);
    font-size: 9px;
    color: #f6df9a;
    flex-shrink: 0;
}

.choice-copy {
    line-height: 1.35;
}

.choice-btn.clean {
    background: linear-gradient(180deg, #1f63a3, #174f86);
    border-color: #5fb8ff;
}

.choice-btn.clean .choice-label {
    border-color: #88d5ff;
    color: #9fe1ff;
}

.choice-btn.corrupt {
    background: linear-gradient(180deg, #7c5a1f, #624618);
    border-color: #e3b85f;
}

.choice-btn.corrupt .choice-label {
    border-color: #f3d083;
    color: #ffe6ad;
}

.choice-btn.neutral {
    background: linear-gradient(180deg, #516076, #434f63);
    border-color: #b8c7dd;
}

.choice-btn.neutral .choice-label {
    border-color: #dde8fa;
    color: #f0f6ff;
}

.event-impact-note {
    margin-top: 8px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 2px solid #40628a;
    background: linear-gradient(180deg, #112d47, #0f2740);
    color: #d9ecff;
    font-size: 18px;
    text-align: center;
    line-height: 1.35;
}

.event-signal-card {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 2px solid var(--gold-dark);
    border-radius: 10px;
    background:
        linear-gradient(180deg, rgba(53, 42, 16, 0.8), rgba(12, 31, 48, 0.9)),
        var(--bg-card);
}

.event-signal-icon {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    border: 2px solid #d5a84b;
    background: #17324b;
    font-size: 24px;
}

.event-signal-card .section-title {
    margin-bottom: 3px;
}

.event-signal-card p {
    color: #c8dff5;
    font-size: 16px;
    line-height: 1.25;
    margin-top: 3px;
}

.signal-open-btn {
    min-width: 68px;
    min-height: 42px;
    padding: 8px 10px;
    border: 2px solid #7b5b22;
    border-radius: 8px;
    background: linear-gradient(180deg, #f7d67b, #ca9638);
    color: #162536;
    font-family: var(--font-pixel);
    font-size: 8px;
    cursor: pointer;
}

.event-modal {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: grid;
    place-items: center;
    padding: 14px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
}

.event-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.event-modal-backdrop {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 50% 22%, rgba(248, 211, 98, 0.12), transparent 32%),
        rgba(3, 9, 15, 0.82);
    backdrop-filter: blur(3px);
}

.event-modal-card {
    position: relative;
    width: min(760px, 100%);
    max-height: min(86vh, 760px);
    overflow-y: auto;
    border: 3px solid #284f70;
    border-radius: 12px;
    background: linear-gradient(180deg, #0c2338, #071522);
    box-shadow:
        inset 0 0 0 2px rgba(108, 169, 218, 0.18),
        0 22px 42px rgba(0, 0, 0, 0.58);
    transform: translateY(8px) scale(0.98);
    transition: transform 0.18s ease;
}

.event-modal.active .event-modal-card {
    transform: translateY(0) scale(1);
}

.event-close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    width: 36px;
    height: 36px;
    border: 2px solid #4d7396;
    border-radius: 8px;
    background: rgba(8, 22, 36, 0.88);
    color: #e8f4ff;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

/* ===== REGION INFO ===== */
.region-info {
    padding: 12px;
}

.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.info-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px;
}

.info-card .label {
    font-size: 13px;
    color: var(--text-dim);
    margin-bottom: 3px;
}

.info-card .value {
    font-family: var(--font-pixel);
    font-size: 10px;
    color: var(--text);
}

.info-card .value.good { color: var(--green); }
.info-card .value.bad { color: var(--red); }
.info-card .value.gold { color: var(--gold); }

/* ===== BOTTOM NAV ===== */
.bottom-nav {
    display: flex;
    background: var(--bg-panel);
    border-top: 2px solid var(--border);
}

.desktop-nav {
    display: none;
}

.mobile-nav {
    display: flex;
}

.nav-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 10px 4px;
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-family: var(--font-body);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
    border-top: 3px solid transparent;
}

.nav-tab .nav-icon {
    font-size: 20px;
}

.nav-tab:hover { color: var(--text-muted); }

.nav-tab.active {
    color: var(--gold);
    border-top-color: var(--gold);
    background: rgba(255,215,64,0.05);
}

@media (min-width: 1024px) {
    .game-shell {
        grid-template-rows: auto 1fr;
        background:
            radial-gradient(circle at 14% 12%, rgba(102, 190, 255, 0.08), transparent 32%),
            radial-gradient(circle at 90% 92%, rgba(248, 211, 98, 0.08), transparent 26%),
            #071322;
        padding: 10px;
        gap: 10px;
    }

    .top-bar {
        border: 2px solid #2f5f84;
        border-radius: 12px;
        background:
            linear-gradient(180deg, rgba(21, 58, 91, 0.95), rgba(12, 35, 58, 0.95)),
            #12304b;
        box-shadow:
            inset 0 0 0 2px rgba(97, 156, 204, 0.22),
            0 12px 18px rgba(0, 0, 0, 0.35);
        padding: 10px 14px;
    }

    .top-bar-logo {
        width: 40px;
        height: 40px;
        border: 1px solid rgba(255, 255, 255, 0.22);
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    }

    .top-bar-right .icon-btn {
        border: 2px solid #456b8e;
        background: linear-gradient(180deg, rgba(14, 37, 59, 0.95), rgba(9, 24, 39, 0.95));
        color: #d8ecff;
    }

    .top-bar-right .icon-btn:hover {
        border-color: var(--gold-dark);
        color: #ffe9aa;
    }

    .game-layout {
        display: grid;
        grid-template-columns: minmax(320px, 390px) minmax(0, 1fr);
        gap: 14px;
        padding: 2px;
    }

    .character-panel {
        border: 3px solid #2d6188;
        border-radius: 14px;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        min-height: 0;
        position: relative;
        background:
            linear-gradient(180deg, rgba(13, 33, 53, 0.97), rgba(9, 22, 37, 0.96)),
            #10273d;
        box-shadow:
            inset 0 0 0 2px rgba(88, 160, 219, 0.22),
            0 14px 24px rgba(0, 0, 0, 0.36);
    }

    .character-panel::before {
        content: '';
        position: absolute;
        inset: 0;
        pointer-events: none;
        background:
            linear-gradient(135deg, rgba(255, 215, 114, 0.06), transparent 28%),
            radial-gradient(circle at 85% 10%, rgba(102, 190, 255, 0.09), transparent 32%);
    }

    .character-panel .char-header {
        grid-template-columns: 1fr;
        gap: 14px;
        padding: 18px 16px 16px;
        border-bottom: 1px solid #2c5370;
        background: linear-gradient(180deg, #12375b 0%, #0c2743 100%);
    }

    .character-panel .char-portrait {
        width: 180px;
        height: 220px;
        margin: 0 auto;
        border: 3px solid #6ca9da;
        box-shadow:
            inset 0 0 0 2px rgba(8, 24, 38, 0.6),
            0 10px 16px rgba(0, 0, 0, 0.38);
    }

    .character-panel .char-stats {
        gap: 10px;
        padding: 10px;
        border: 1px solid #3a6285;
        border-radius: 10px;
        background: rgba(10, 29, 47, 0.62);
    }

    .character-panel .stat-row {
        grid-template-columns: 92px 1fr 36px;
        font-size: 18px;
        color: #cde5fb;
    }

    .character-panel .char-resources {
        justify-content: flex-start;
        flex-wrap: wrap;
        row-gap: 6px;
        column-gap: 10px;
    }

    .play-panel {
        border: 3px solid #2d6188;
        border-radius: 14px;
        overflow: hidden;
        background:
            linear-gradient(180deg, rgba(13, 39, 63, 0.96), rgba(9, 27, 44, 0.97)),
            #102e4a;
        box-shadow:
            inset 0 0 0 2px rgba(88, 160, 219, 0.22),
            0 14px 24px rgba(0, 0, 0, 0.34);
    }

    .play-panel .main-content {
        padding: 8px;
    }

    .play-panel #tab-content {
        max-width: 1400px;
        margin: 0 auto;
    }

    .desktop-nav {
        display: flex;
        flex-direction: column;
        gap: 10px;
        border-top: 1px solid #2f5a7a;
        background: rgba(8, 25, 41, 0.84);
        padding: 14px 12px;
        margin-top: auto;
    }

    .desktop-nav .nav-tab {
        border: 2px solid #3e678c;
        border-radius: 11px;
        border-top-width: 2px;
        background: linear-gradient(180deg, rgba(20, 54, 84, 0.9), rgba(13, 36, 58, 0.9));
        color: #d7ecff;
        flex-direction: row;
        justify-content: flex-start;
        gap: 11px;
        padding: 13px 11px;
        font-size: 18px;
        box-shadow: inset 0 0 0 1px rgba(126, 176, 219, 0.18);
    }

    .desktop-nav .nav-tab .nav-icon {
        font-size: 22px;
    }

    .desktop-nav .nav-tab.active {
        border-color: var(--gold-dark);
        background: linear-gradient(180deg, rgba(248, 211, 98, 0.24), rgba(248, 211, 98, 0.1));
        box-shadow:
            inset 0 0 0 1px rgba(255, 233, 166, 0.35),
            0 8px 14px rgba(0, 0, 0, 0.2);
    }

    .play-panel .section-title {
        margin-bottom: 12px;
        letter-spacing: 1.1px;
    }

    .play-panel .event-panel,
    .play-panel .region-info,
    .play-panel .map-section {
        padding: 16px;
    }

    .command-strip {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        padding: 0 16px 16px;
    }

    .command-tile {
        min-height: 86px;
        padding: 12px;
    }

    .dashboard-grid {
        grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
        padding: 0 16px 6px;
    }

    .map-command-grid {
        grid-template-columns: minmax(460px, 1.2fr) minmax(320px, 0.8fr);
        align-items: start;
    }

    .map-dossier {
        padding-left: 0;
    }

    .play-panel .info-grid {
        grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
        gap: 10px;
    }

    .play-panel .info-card {
        padding: 12px;
        border-color: #3a6386;
        background: linear-gradient(180deg, rgba(20, 51, 78, 0.88), rgba(13, 35, 56, 0.88));
    }

    .budget-panel {
        grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
        gap: 12px;
        padding: 12px;
    }

    .budget-row {
        grid-template-columns: 124px minmax(0, 1fr) 48px;
        font-size: 18px;
    }

    .budget-actions {
        grid-template-columns: 1fr 1fr;
    }

    .mobile-nav {
        display: none;
    }
}

/* ===== RESULT OVERLAY ===== */
.result-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);
    display: grid;
    place-items: center;
    z-index: 100;
    padding: 20px;
}

.result-card {
    max-width: 400px;
    width: 100%;
    background:
        linear-gradient(180deg, rgba(11, 25, 40, 0.96), rgba(8, 17, 30, 0.96)),
        var(--bg-card);
    border: 3px solid var(--gold-dark);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    box-shadow:
        inset 0 0 0 2px #163651,
        0 16px 30px rgba(0, 0, 0, 0.45);
}

.result-card p {
    font-size: 18px;
    color: var(--text);
    line-height: 1.5;
    margin-bottom: 15px;
}

.result-card button {
    padding: 10px 30px;
    background: linear-gradient(180deg, #f6d478, #cd9d3f);
    border: 2px solid #7a5822;
    border-radius: 8px;
    color: #162230;
    font-family: var(--font-pixel);
    font-size: 9px;
    cursor: pointer;
}

/* ===== IDLE / EMPTY STATES ===== */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-dim);
}

.empty-state .big-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.empty-state p {
    font-size: 18px;
    line-height: 1.5;
}

/* ===== CREATE CHARACTER ===== */
.create-panel {
    padding: 20px;
    text-align: center;
}

.create-panel h2 {
    font-family: var(--font-pixel);
    font-size: 12px;
    color: var(--gold);
    margin-bottom: 20px;
}

.create-panel input,
.create-panel select {
    width: 100%;
    padding: 12px;
    margin-bottom: 12px;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 20px;
    text-align: center;
}

.create-panel input:focus,
.create-panel select:focus {
    outline: none;
    border-color: var(--gold-dark);
}

.create-panel .primary-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--gold-dark), var(--gold));
    border: none;
    border-radius: var(--radius);
    color: var(--bg-dark);
    font-family: var(--font-pixel);
    font-size: 10px;
    cursor: pointer;
    transition: transform 0.1s;
}

.create-panel .primary-btn:active { transform: scale(0.97); }

/* ===== LOGIN PAGE ===== */
.login-shell {
    height: 100vh;
    height: 100dvh;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 14px 16px 74px;
    overflow: hidden;
    background:
        linear-gradient(rgba(6, 18, 31, 0.44), rgba(6, 18, 31, 0.60)),
        url('../img/kantor_gubernur.png') center/cover no-repeat;
}

.login-overlay {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 18% 22%, rgba(116, 216, 255, 0.24), transparent 34%),
        radial-gradient(circle at 81% 16%, rgba(253, 218, 114, 0.2), transparent 28%),
        linear-gradient(180deg, rgba(7, 20, 34, 0.12), rgba(7, 20, 34, 0.52));
    pointer-events: none;
}

.login-brand,
.login-stage,
.login-footer-note {
    position: relative;
    z-index: 1;
}

.login-shell .logo {
    width: min(520px, 90vw);
    max-width: 100%;
    image-rendering: pixelated;
}

.martin-badge {
    animation: badgeFloat 3.2s ease-in-out infinite;
    filter: drop-shadow(0 14px 18px rgba(0, 0, 0, 0.38));
}

.login-brand {
    width: min(560px, 100%);
    text-align: center;
    margin-top: 46px;
    margin-bottom: 18px;
}

.login-stage {
    width: min(560px, 100%);
    margin-top: 22px;
}

.login-center {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.login-box {
    width: 100%;
    background:
        linear-gradient(180deg, rgba(10, 24, 40, 0.95), rgba(8, 18, 31, 0.95)),
        var(--bg-panel);
    border: 3px solid var(--gold-dark);
    border-radius: 13px;
    box-shadow:
        inset 0 0 0 2px #1f4060,
        0 14px 24px rgba(0, 0, 0, 0.4);
    padding: 14px 14px 12px;
}

.auth-title {
    font-family: var(--font-pixel);
    color: #ffe9a2;
    font-size: 9px;
    text-align: center;
    margin-bottom: 10px;
}

.login-box input {
    width: 100%;
    padding: 12px;
    margin-bottom: 9px;
    background: rgba(15, 41, 64, 0.9);
    border: 2px solid #47759c;
    border-radius: 10px;
    color: #ecf6ff;
    font-family: var(--font-body);
    font-size: 24px;
    text-align: center;
}

.login-box input:focus {
    outline: none;
    border-color: #86d5ff;
    box-shadow: 0 0 0 2px rgba(120, 207, 255, 0.25);
}

.login-box .primary-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(180deg, #ffd772, #d09b3b);
    border: 2px solid #7d5921;
    border-radius: 10px;
    color: #1a2835;
    font-family: var(--font-pixel);
    font-size: 9px;
    cursor: pointer;
    margin-top: 4px;
}

.login-box .toggle-link {
    display: block;
    margin-top: 10px;
    text-align: center;
    color: #bfe0ff;
    cursor: pointer;
    font-size: 22px;
}

.login-box .toggle-link:hover { color: #fff0bc; }

.login-msg {
    margin-top: 2px;
    min-height: 26px;
    text-align: center;
    font-size: 22px;
    color: #fff0c0;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
}

.pwa-cta {
    position: fixed;
    bottom: 30px;
    top: auto;
    left: 50%;
    transform: translateX(-50%);
    z-index: 500;
    width: calc(100% - 20px);
    max-width: 480px;
    padding: 8px 10px;
    border: 2px solid rgba(255,215,98,0.5);
    border-radius: 12px;
    background: linear-gradient(135deg, #152d44 0%, #1a3a54 100%);
    box-shadow: 0 6px 24px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.08);
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 8px;
    transition: transform 0.35s cubic-bezier(0.34,1.2,0.64,1);
}

.pwa-hidden {
    transform: translateX(-50%) translateY(150%) !important;
    pointer-events: none;
}

.pwa-slide-in {
    transform: translateX(-50%) translateY(0) !important;
}

.pwa-slide-out {
    transform: translateX(-50%) translateY(150%) !important;
}

/* Hapus .is-hidden lama, sudah diganti class-based */
.pwa-cta.is-hidden { display: none; }


.pwa-cta-content strong {
    display: block;
    font-family: var(--font-pixel);
    font-size: 7px;
    line-height: 1.5;
    color: var(--gold);
}

.pwa-cta-content span {
    display: block;
    margin-top: 3px;
    font-size: 14px;
    line-height: 1.3;
    color: var(--text-muted);
}

.pwa-install-btn {
    padding: 9px 13px;
    border: 1px solid var(--gold-dark);
    border-radius: 10px;
    background: linear-gradient(180deg, var(--gold), #c8892a);
    color: #1a1a0a;
    font-family: var(--font-pixel);
    font-size: 7px;
    cursor: pointer;
    white-space: nowrap;
    transition: filter 0.15s;
}

.pwa-install-btn:active { filter: brightness(0.9); }

.pwa-dismiss-btn {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 50%;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    flex-shrink: 0;
    transition: background 0.15s;
}

.pwa-dismiss-btn:active { background: rgba(255,255,255,0.18); }

/* Mobile tweak – keep banner compact without clipping */
@media (max-width: 600px) {
    .pwa-cta {
        bottom: 24px;
        top: auto;
        padding: 8px 10px;
        width: calc(100% - 12px);
    }
    .pwa-cta-content strong {
        font-size: 6px;
    }
    .pwa-cta-content span {
        font-size: 11px;
    }
    .pwa-install-btn {
        padding: 8px 10px;
        font-size: 6px;
    }
    .pwa-dismiss-btn {
        width: 26px;
        height: 26px;
        font-size: 16px;
    }
}

.login-legal {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 4px;
    z-index: 2;
    margin-top: 0;
    padding: 0 10px;
    text-align: center;
    color: #d4e9ff;
    font-size: 14px;
    line-height: 1.3;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
}

.audio-gate {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: grid;
    place-items: center;
    padding: 16px;
    background: rgba(3, 11, 19, 0.76);
    backdrop-filter: blur(2px);
}

.audio-gate.hidden {
    display: none;
}

.audio-gate-card {
    width: min(460px, 100%);
    border: 3px solid var(--gold-dark);
    border-radius: 12px;
    background:
        linear-gradient(180deg, rgba(10, 24, 40, 0.96), rgba(8, 18, 31, 0.96)),
        var(--bg-panel);
    box-shadow:
        inset 0 0 0 2px #1f4060,
        0 18px 28px rgba(0, 0, 0, 0.45);
    padding: 16px;
    text-align: center;
}

.audio-gate-title {
    font-family: var(--font-pixel);
    color: #ffe9a2;
    font-size: 9px;
    margin-bottom: 10px;
}

.audio-gate-card p {
    font-size: 22px;
    color: #e8f4ff;
    line-height: 1.2;
    margin-bottom: 12px;
}

.audio-gate-card .primary-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(180deg, #ffd772, #d09b3b);
    border: 2px solid #7d5921;
    border-radius: 10px;
    color: #1a2835;
    font-family: var(--font-pixel);
    font-size: 8px;
    cursor: pointer;
}

.audio-gate-card small {
    display: block;
    margin-top: 10px;
    color: #c8dff5;
    font-size: 15px;
}

.login-footer-note {
    width: min(920px, 100%);
    text-align: center;
    font-family: var(--font-pixel);
    font-size: 8px;
    line-height: 1.4;
    color: #e8f6ff;
    border: 2px solid #4a6f95;
    border-radius: 10px;
    padding: 8px 10px;
    background: rgba(10, 28, 46, 0.72);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.28);
}

@keyframes idleBobA {
    0% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-4px) rotate(-0.5deg); }
    50% { transform: translateY(-7px) rotate(0deg); }
    75% { transform: translateY(-4px) rotate(0.45deg); }
    100% { transform: translateY(0) rotate(0deg); }
}

@keyframes idleBobB {
    0% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-3px) rotate(0.4deg); }
    50% { transform: translateY(-6px) rotate(0deg); }
    75% { transform: translateY(-3px) rotate(-0.4deg); }
    100% { transform: translateY(0) rotate(0deg); }
}

@keyframes badgeFloat {
    0% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-6px) rotate(-0.5deg); }
    50% { transform: translateY(-12px) rotate(0deg); }
    75% { transform: translateY(-6px) rotate(0.5deg); }
    100% { transform: translateY(0) rotate(0deg); }
}

@media (max-width: 1180px) {
    .login-stage {
        width: min(560px, 100%);
    }
}

@media (max-width: 900px) {
    .login-shell {
        justify-content: flex-start;
        gap: 8px;
        padding-top: 104px;
        padding-bottom: 78px;
    }

    .login-stage {
        width: min(560px, 100%);
        margin-top: 30px;
    }

    .login-brand {
        margin-top: 0;
        margin-bottom: 22px;
    }

    .pwa-cta {
        width: min(680px, calc(100% - 12px));
        bottom: 50px;
    }

    .pwa-cta-content span {
        font-size: 16px;
    }
}

@media (max-width: 460px) {
    .login-shell {
        padding: 118px 8px 84px;
    }

    .login-box .toggle-link,
    .login-msg {
        font-size: 18px;
    }

    .audio-gate-card p {
        font-size: 18px;
    }

    .audio-gate-card small {
        font-size: 15px;
    }

    .pwa-cta {
        grid-template-columns: 1fr;
        bottom: 46px;
        gap: 8px;
        padding: 8px 8px;
    }

    .pwa-cta-content strong {
        font-size: 8px;
    }

    .pwa-cta-content span {
        font-size: 16px;
    }

    .pwa-install-btn {
        width: 100%;
        font-size: 8px;
    }

    .login-legal {
        font-size: 12px;
        bottom: 4px;
    }

    .auth-title {
        font-size: 8px;
    }

    .login-footer-note {
        font-size: 7px;
    }

    .legacy-score-row {
        grid-template-columns: 1fr;
    }

    .event-balance-row {
        flex-direction: column;
    }

    .event-polarity {
        font-size: 8px;
    }
}

/* ===== TYPOGRAPHY BOOST ===== */
html, body {
    font-size: 20px;
}

.top-bar-title {
    font-size: 13px;
}

.top-bar-title small {
    font-size: 17px;
}

.char-name {
    font-size: 14px;
}

.char-name small {
    font-size: 18px;
}

.stat-row {
    font-size: 16px;
}

.resource {
    font-size: 18px;
}

.resource .val {
    font-size: 11px;
}

.section-title {
    font-size: 11px;
}

.legacy-kicker {
    font-size: 9px;
}

.legacy-hero h2 {
    font-size: 13px;
}

.legacy-hero p {
    font-size: 22px;
}

.legacy-score-row strong {
    font-size: 12px;
}

.legacy-score-row span {
    font-size: 16px;
}

.career-node strong {
    font-size: 9px;
}

.career-node small {
    font-size: 16px;
}

.career-dot {
    font-size: 9px;
}

.event-title {
    font-size: 11px;
}

.event-title small {
    font-size: 18px;
}

.event-flavor {
    font-size: 18px;
}

.event-body {
    font-size: 22px;
}

.choice-btn {
    font-size: 21px;
}

.choice-label {
    font-size: 10px;
}

.event-impact-note {
    font-size: 20px;
}

.info-card .label {
    font-size: 15px;
}

.info-card .value {
    font-size: 12px;
}

.nav-tab {
    font-size: 15px;
}

.create-panel h2 {
    font-size: 14px;
}

.create-panel input,
.create-panel select {
    font-size: 24px;
}

.create-panel .primary-btn {
    font-size: 11px;
}

.result-card p {
    font-size: 21px;
}

.result-card button {
    font-size: 10px;
}

.empty-state p {
    font-size: 20px;
}





.audio-gate-title {
    font-size: 10px;
}

.audio-gate-card p {
    font-size: 24px;
}

.audio-gate-card small {
    font-size: 16px;
}

.building-name {
    font-size: 10px;
}

.building-name small {
    font-size: 16px;
}

.building-desc {
    font-size: 16px;
}

.building-cost {
    font-size: 14px;
}

/* ===== SCROLLBAR ===== */
.main-content::-webkit-scrollbar { width: 6px; }
.main-content::-webkit-scrollbar-track { background: transparent; }
.main-content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ===== CITYCRAFT & BUILDINGS ===== */
.building-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.building-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.building-info {
    flex: 1;
}

.building-name {
    font-family: var(--font-pixel);
    font-size: 8px;
    color: var(--gold);
    margin-bottom: 4px;
}

.building-name small {
    color: var(--text-dim);
    font-family: var(--font-body);
    font-size: 14px;
}

.building-desc {
    font-size: 14px;
    color: var(--text);
    margin-bottom: 4px;
    line-height: 1.2;
}

.building-cost {
    font-size: 12px;
    color: var(--text-muted);
}

.budget-panel {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    border: 1px solid #3a6386;
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(18, 50, 76, 0.84), rgba(10, 30, 48, 0.88)),
        var(--bg-card);
    padding: 10px;
}

.budget-controls {
    display: grid;
    gap: 9px;
}

.budget-row {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr) 42px;
    align-items: center;
    gap: 8px;
    color: #cfe6fb;
    font-size: 16px;
}

.budget-row input[type="range"] {
    width: 100%;
    accent-color: var(--gold);
}

.budget-row strong,
.budget-total strong,
.budget-forecast-head strong,
.budget-impact-grid strong {
    font-family: var(--font-pixel);
    font-size: 9px;
    color: #fff2bb;
}

.budget-total {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 9px;
    border: 1px solid #476b8f;
    border-radius: 8px;
    background: rgba(8, 24, 40, 0.7);
    color: #b9d5ef;
}

.budget-total.good {
    border-color: #52986d;
}

.budget-total.bad {
    border-color: #b86a5c;
}

.budget-forecast {
    display: grid;
    gap: 10px;
    padding: 10px;
    border: 1px solid #80622c;
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(69, 52, 19, 0.58), rgba(17, 35, 52, 0.72)),
        #132b42;
}

.budget-forecast-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    color: #d6e9fa;
}

.budget-impact-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px;
}

.budget-impact-grid div {
    min-height: 54px;
    padding: 8px 6px;
    border: 1px solid #4a6682;
    border-radius: 8px;
    background: rgba(8, 24, 40, 0.66);
    text-align: center;
}

.budget-impact-grid span,
.budget-note {
    display: block;
    color: #9ebcdb;
    font-size: 14px;
}

.budget-impact-grid strong {
    display: block;
    margin-top: 5px;
}

.budget-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.budget-btn {
    min-height: 42px;
    padding: 9px 10px;
    border-radius: 8px;
    font-family: var(--font-pixel);
    font-size: 8px;
    cursor: pointer;
}

.budget-btn.primary {
    border: 2px solid #7b5b22;
    background: linear-gradient(180deg, #f7d67b, #ca9638);
    color: #162536;
}

.budget-btn.secondary {
    border: 2px solid #4d7396;
    background: linear-gradient(180deg, #1d4d75, #163c5e);
    color: #e2f2ff;
}

.budget-btn.disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

@media (min-width: 1024px) {
    .budget-panel {
        grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
        gap: 12px;
        padding: 12px;
    }

    .budget-row {
        grid-template-columns: 124px minmax(0, 1fr) 48px;
        font-size: 18px;
    }

    .budget-actions {
        grid-template-columns: 1fr 1fr;
    }
}

button.disabled {
    background: var(--bg-hover) !important;
    color: var(--text-dim) !important;
    border-color: var(--border) !important;
    cursor: not-allowed;
}

/* ===== DIPLOMACY ===== */
.diplomacy-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.diplomacy-actions button {
    flex: 1;
    padding: 8px;
    font-family: var(--font-pixel);
    font-size: 8px;
    border-radius: var(--radius);
    cursor: pointer;
}

.btn-bribe {
    background: var(--bg-panel);
    border: 1px solid var(--gold);
    color: var(--gold);
}

.btn-sabotage {
    background: var(--bg-panel);
    border: 1px solid var(--red);
    color: var(--red);
}

/* ===== GEAR BUTTON (LOGIN PAGE) ===== */
.gear-btn {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 200;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: transform 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}

.gear-btn:active { transform: rotate(45deg) scale(0.9); }
.gear-btn svg { filter: drop-shadow(0 1px 4px rgba(0,0,0,0.6)); }

/* ===== NATIVE BACKDROP ===== */
.nd-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 300;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.nd-backdrop.active {
    display: block;
    opacity: 1;
}

/* ===== BOTTOM SHEET MODAL ===== */
.nd-modal {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 400;
    background: #1c2d3e;
    border-radius: 20px 20px 0 0;
    padding: 0 0 32px 0;
    transform: translateY(100%);
    transition: transform 0.32s cubic-bezier(0.34, 1.12, 0.64, 1);
    box-shadow: 0 -4px 32px rgba(0,0,0,0.6);
    max-height: 80vh;
    overflow-y: auto;
}

.nd-modal.active {
    transform: translateY(0);
}

.nd-modal-handle {
    width: 44px;
    height: 4px;
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
    margin: 12px auto 0;
}

.nd-modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px 12px;
    font-family: var(--font-pixel);
    font-size: 9px;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

/* ===== SETTINGS ROWS ===== */
.nd-setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    min-height: 60px;
}

.nd-setting-label {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 16px;
    color: #e0ecff;
}

.nd-setting-label span:first-child { font-size: 18px; }

.nd-clickable { cursor: pointer; }
.nd-clickable:active { background: rgba(255,255,255,0.06); }

/* ===== VOLUME CONTROL ===== */
.nd-volume-control {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    max-width: 220px;
    justify-content: flex-end;
}

.nd-mute-btn {
    background: rgba(255,255,255,0.1);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s;
}

.nd-mute-btn:active { background: rgba(255,255,255,0.2); }
.nd-mute-btn.muted { color: var(--text-dim); background: rgba(255,255,255,0.05); }

.nd-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    border-radius: 2px;
    background: linear-gradient(
        to right,
        var(--gold) 0%,
        var(--gold) var(--vol-pct, 30%),
        rgba(255,255,255,0.15) var(--vol-pct, 30%),
        rgba(255,255,255,0.15) 100%
    );
    outline: none;
    cursor: pointer;
}

.nd-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--gold);
    cursor: pointer;
    box-shadow: 0 0 6px rgba(248,211,98,0.5);
}

.nd-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--gold);
    border: none;
    cursor: pointer;
}

.nd-vol-val {
    font-family: var(--font-pixel);
    font-size: 9px;
    color: var(--text-muted);
    min-width: 24px;
    text-align: right;
}

/* ===== DIVIDER ===== */
.nd-divider {
    height: 1px;
    background: rgba(255,255,255,0.07);
    margin: 0 20px;
}

/* ===== ABOUT CONTENT ===== */
.nd-about-logo {
    display: flex;
    justify-content: center;
    padding: 20px 0 10px;
}

.nd-about-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 20px;
}

.nd-about-label {
    font-size: 14px;
    color: var(--text-dim);
    flex-shrink: 0;
}

.nd-about-val {
    font-family: var(--font-pixel);
    font-size: 8px;
    color: var(--text);
    text-align: right;
    line-height: 1.5;
}

/* ===== CLOSE BUTTON ===== */
.nd-close-btn {
    display: block;
    width: calc(100% - 40px);
    margin: 20px auto 0;
    padding: 13px;
    background: linear-gradient(180deg, #c1272d, #a01e23);
    border: none;
    border-radius: 12px;
    color: #fff;
    font-family: var(--font-pixel);
    font-size: 9px;
    cursor: pointer;
    transition: filter 0.15s;
    letter-spacing: 1px;
}

.nd-close-btn:active { filter: brightness(0.85); }
