:root {
    color-scheme: dark;
    --ink: #10171a;
    --ink-2: #182226;
    --ink-3: #223034;
    --panel: rgba(19, 28, 31, 0.96);
    --panel-soft: rgba(30, 42, 45, 0.88);
    --line: rgba(221, 190, 126, 0.18);
    --line-strong: rgba(221, 190, 126, 0.42);
    --gold: #d9b878;
    --gold-bright: #f1d79f;
    --paper: #e8dcc2;
    --paper-deep: #c9b894;
    --text: #f1eee7;
    --muted: #a5aaa5;
    --green: #7fc69d;
    --red: #e9857b;
    --shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
    font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
    background: #0c1214;
    color: var(--text);
}

button {
    color: inherit;
    font: inherit;
}

button:focus-visible, [role="button"]:focus-visible {
    outline: 2px solid var(--gold-bright);
    outline-offset: 3px;
}

.game-shell {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    min-height: 0;
    background:
        radial-gradient(ellipse at 12% -18%, rgba(94, 119, 104, 0.16), transparent 38%),
        linear-gradient(145deg, #111a1d, #0b1113 72%);
}

.topbar {
    position: relative;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    min-height: 76px;
    padding: 10px 22px;
    border-bottom: 1px solid var(--line-strong);
    background: linear-gradient(180deg, rgba(27, 38, 40, 0.98), rgba(16, 24, 27, 0.98));
    box-shadow: 0 5px 22px rgba(0,0,0,0.22);
}

.brand {
    display: flex;
    align-items: center;
    gap: 13px;
    min-width: 230px;
}

.brand-mark {
    display: grid;
    width: 43px;
    height: 43px;
    place-items: center;
    border: 1px solid rgba(241, 215, 159, 0.66);
    border-radius: 12px;
    background: linear-gradient(145deg, #dfc28d, #957344);
    color: #172023;
    font-family: Georgia, serif;
    font-size: 29px;
    box-shadow: inset 0 1px rgba(255,255,255,0.45), 0 4px 12px rgba(0,0,0,0.22);
}

.brand-title {
    color: var(--gold-bright);
    font-family: Georgia, "Palatino Linotype", serif;
    font-size: 23px;
    font-weight: 700;
    letter-spacing: 0.11em;
    line-height: 1.05;
}

.brand-subtitle {
    margin-top: 5px;
    color: #a8aa9e;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.22em;
}

.header-middle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(18px, 3vw, 42px);
    flex: 1;
}

.date-block { min-width: 100px; }

.date-label, .eyebrow {
    color: #9ca69f;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.17em;
    text-transform: uppercase;
}

.date-value {
    margin-top: 5px;
    color: var(--gold-bright);
    font-family: Georgia, serif;
    font-size: 17px;
    letter-spacing: 0.04em;
}

.morale-block { width: clamp(130px, 16vw, 218px); }

.morale-topline {
    display: flex;
    justify-content: space-between;
    margin-bottom: 7px;
    color: #c9c4b7;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.16em;
}

.morale-track {
    height: 7px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.09);
    border-radius: 99px;
    background: #080e10;
}

#morale-bar {
    width: 72%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #b98558, #e5c783);
    box-shadow: 0 0 11px rgba(214, 180, 115, 0.25);
    transition: width 180ms ease, background 180ms ease;
}
#morale-bar.is-low {
    background: linear-gradient(90deg, #a94343, #df8273);
    box-shadow: 0 0 11px rgba(220, 91, 82, 0.24);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 11px;
}

.control-button, .speed-button, .zoom-button, .zoom-preset {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    background: rgba(255,255,255,0.035);
    color: #d8d7cf;
    cursor: pointer;
    transition: background 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease;
}

.control-button:hover, .speed-button:hover, .zoom-button:hover, .zoom-preset:hover {
    border-color: var(--line-strong);
    background: rgba(217, 184, 120, 0.12);
    color: var(--gold-bright);
}

.control-button:active, .speed-button:active, .zoom-button:active, .zoom-preset:active {
    transform: translateY(1px);
}

.control-button {
    min-height: 35px;
    padding: 0 14px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.1em;
}

.control-button.is-paused {
    border-color: rgba(231, 133, 123, 0.5);
    background: rgba(130, 48, 43, 0.24);
    color: #ffc0b8;
}

.speed-group {
    display: flex;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(0,0,0,0.16);
}

.speed-button {
    min-width: 37px;
    height: 34px;
    border: 0;
    border-right: 1px solid var(--line);
    border-radius: 0;
    font-family: Georgia, serif;
    font-size: 13px;
}
.speed-button:last-child { border-right: 0; }
.speed-button.is-active {
    background: linear-gradient(180deg, #e8cf9d, #c9a66a);
    color: #202728;
    font-weight: 800;
}

.game-layout {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.world-stage {
    position: relative;
    flex: 1;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    background:
        radial-gradient(ellipse at 50% 45%, rgba(85, 112, 87, 0.08), transparent 62%),
        #0c1415;
}

#canvas {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    cursor: grab;
    touch-action: none;
}
#canvas:active { cursor: grabbing; }
.card-dragging #canvas { cursor: copy; }

.stage-topline {
    position: absolute;
    top: 17px;
    left: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    pointer-events: none;
}

.stage-chip {
    padding: 7px 10px;
    border: 1px solid rgba(224, 204, 165, 0.18);
    border-radius: 7px;
    background: rgba(12, 19, 21, 0.78);
    color: #c8c2b4;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.13em;
    backdrop-filter: blur(10px);
}

.stage-chip strong { color: var(--gold-bright); }

.zoom-panel {
    position: absolute;
    top: 16px;
    right: 17px;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px;
    border: 1px solid rgba(221, 190, 126, 0.24);
    border-radius: 11px;
    background: rgba(13, 21, 23, 0.9);
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
}

.zoom-button {
    width: 30px;
    height: 30px;
    border-radius: 7px;
    font-size: 17px;
}
.zoom-presets {
    display: flex;
    gap: 4px;
    padding-left: 5px;
    border-left: 1px solid var(--line);
}
.zoom-preset {
    min-width: 29px;
    height: 29px;
    padding: 0 7px;
    border-radius: 6px;
    color: #999e98;
    font-size: 9px;
    font-weight: 800;
}
.zoom-preset.is-active {
    border-color: rgba(217,184,120,0.7);
    background: rgba(217,184,120,0.18);
    color: var(--gold-bright);
}

.placement-status {
    position: absolute;
    top: 67px;
    left: 50%;
    min-width: 178px;
    transform: translateX(-50%);
    padding: 8px 13px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(13, 21, 23, 0.84);
    color: #b9b6aa;
    text-align: center;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.15em;
    pointer-events: none;
    backdrop-filter: blur(12px);
}
.placement-status[data-valid="true"] {
    border-color: rgba(127,198,157,0.6);
    color: #a3e1bd;
}
.placement-status[data-valid="false"] {
    border-color: rgba(233,133,123,0.6);
    color: #f0a39a;
}

.minimap-frame {
    position: absolute;
    right: 19px;
    bottom: 19px;
    padding: 7px;
    border: 1px solid rgba(221, 190, 126, 0.42);
    border-radius: 12px;
    background: rgba(12, 19, 21, 0.9);
    box-shadow: var(--shadow);
}
.minimap-heading {
    display: flex;
    justify-content: space-between;
    padding: 2px 3px 7px;
    color: #b9b2a2;
    font-size: 8px;
    font-weight: 800;
    letter-spacing: 0.18em;
}
.minimap-heading span:last-child { color: var(--gold); }
#minimap {
    display: block;
    width: 146px;
    height: 146px;
    border: 1px solid rgba(215, 203, 173, 0.12);
    border-radius: 5px;
    background: #14251f;
}

.hint-box {
    position: absolute;
    bottom: 24px;
    left: 20px;
    width: min(250px, 35%);
    padding: 13px 15px;
    border: 1px solid rgba(221,190,126,0.28);
    border-radius: 9px;
    background: rgba(14, 22, 24, 0.9);
    color: #d5c9ae;
    cursor: pointer;
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}
.hint-box.hidden { display: none; }
.hint-title {
    display: flex;
    justify-content: space-between;
    margin-bottom: 7px;
    color: var(--gold-bright);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.18em;
}
#hint-text { color: #b7b7aa; font-size: 11px; line-height: 1.45; }

.side-panel {
    display: flex;
    flex: 0 0 352px;
    flex-direction: column;
    min-width: 320px;
    max-width: 390px;
    min-height: 0;
    border-left: 1px solid var(--line-strong);
    background: linear-gradient(180deg, #1a2528, #111a1d 78%);
    box-shadow: -10px 0 28px rgba(0,0,0,0.15);
}

.resource-section {
    padding: 16px 17px 14px;
    border-bottom: 1px solid var(--line);
    background: rgba(8, 14, 16, 0.24);
}
.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 11px;
    color: #a9aa9d;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.18em;
}
.section-heading .subtle { color: #6f7c78; font-size: 8px; letter-spacing: 0.12em; }
.resource-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.resource-card {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
    padding: 10px 11px;
    border: 1px solid rgba(221,190,126,0.12);
    border-radius: 9px;
    background: rgba(255,255,255,0.035);
}
.resource-symbol {
    display: grid;
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    place-items: center;
    border-radius: 7px;
    background: rgba(255,255,255,0.055);
    font-size: 15px;
}
.resource-copy { min-width: 0; flex: 1; }
.resource-value {
    color: #f0e7d2;
    font-family: Georgia, serif;
    font-size: 17px;
    font-variant-numeric: tabular-nums;
    line-height: 1.05;
}
.resource-name {
    margin-top: 4px;
    color: #8d9992;
    font-size: 8px;
    font-weight: 800;
    letter-spacing: 0.14em;
}
.resource-income {
    align-self: flex-start;
    color: #8bc6a0;
    font-family: Georgia, serif;
    font-size: 11px;
    white-space: nowrap;
}
.resource-card.wood .resource-symbol { color: #91c69a; }
.resource-card.stone .resource-symbol { color: #bdc8cc; }
.resource-card.gold .resource-symbol { color: #edc777; }
.resource-card.food .resource-symbol { color: #d9ae72; }

.card-section {
    padding: 16px 17px 14px;
    border-bottom: 1px solid var(--line);
}
.card-section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.card-section-title {
    color: var(--gold);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.18em;
}
.skip-button {
    padding: 6px 9px;
    border: 1px solid rgba(211, 126, 112, 0.25);
    border-radius: 6px;
    background: rgba(134, 55, 47, 0.13);
    color: #d69a8f;
    cursor: pointer;
    font-size: 8px;
    font-weight: 800;
    letter-spacing: 0.08em;
}
.skip-button:hover { background: rgba(134,55,47,0.27); color: #ffc0b7; }

.card-container {
    position: relative;
    display: flex;
    min-height: 190px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 18px 18px 16px;
    border: 1px solid rgba(220, 190, 132, 0.55);
    border-radius: 14px;
    background:
        radial-gradient(circle at 50% 0%, rgba(236, 205, 150, 0.14), transparent 55%),
        linear-gradient(145deg, #334044, #202c30 62%, #172225);
    color: var(--paper);
    cursor: grab;
    touch-action: none;
    user-select: none;
    box-shadow: inset 0 1px rgba(255,255,255,0.08), 0 9px 23px rgba(0,0,0,0.2);
    transition: border-color 150ms ease, transform 150ms ease, opacity 150ms ease, box-shadow 150ms ease;
}
.card-container::before {
    position: absolute;
    inset: 7px;
    border: 1px solid rgba(221,190,126,0.12);
    border-radius: 9px;
    content: "";
    pointer-events: none;
}
.card-container.is-unavailable {
    border-color: rgba(233, 133, 123, 0.52);
}
.card-container.is-unavailable .card-instruction {
    color: #e9a198;
}
.card-container:hover {
    border-color: rgba(241,215,159,0.85);
    box-shadow: inset 0 1px rgba(255,255,255,0.1), 0 12px 28px rgba(0,0,0,0.3);
}
.card-container.is-dragging {
    opacity: 0.48;
    transform: scale(0.98);
    border-style: dashed;
}
.card-icon {
    display: grid;
    width: 55px;
    height: 55px;
    place-items: center;
    margin-bottom: 8px;
    border: 1px solid rgba(221,190,126,0.25);
    border-radius: 15px;
    background: rgba(6,12,14,0.24);
    font-size: 31px;
}
.card-name {
    color: #f1dcae;
    font-family: Georgia, serif;
    font-size: 19px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-align: center;
}
.card-desc {
    max-width: 235px;
    margin-top: 6px;
    color: #b8c0b9;
    font-size: 10px;
    line-height: 1.4;
    text-align: center;
}
.card-play-tag {
    position: absolute;
    top: 13px;
    right: -28px;
    width: 100px;
    transform: rotate(35deg);
    padding: 4px 0;
    background: #c5a66d;
    color: #1a2223;
    text-align: center;
    font-size: 8px;
    font-weight: 900;
    letter-spacing: 0.17em;
}
.card-costs {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 13px;
}
.card-cost {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #d8d0bd;
    font-size: 10px;
    font-variant-numeric: tabular-nums;
}
.card-instruction {
    margin-top: 8px;
    color: #8c9a91;
    text-align: center;
    font-size: 8px;
    font-weight: 800;
    letter-spacing: 0.12em;
}

.tabs {
    display: flex;
    gap: 4px;
    padding: 12px 17px 0;
    border-bottom: 1px solid var(--line);
}
.tab-button {
    position: relative;
    flex: 1;
    padding: 11px 4px 12px;
    border: 0;
    border-radius: 7px 7px 0 0;
    background: transparent;
    color: #89948e;
    cursor: pointer;
    font-size: 8px;
    font-weight: 800;
    letter-spacing: 0.12em;
}
.tab-button:hover { color: #ded1b5; background: rgba(255,255,255,0.03); }
.tab-button.is-active {
    background: rgba(217,184,120,0.08);
    color: var(--gold-bright);
}
.tab-button.is-active::after {
    position: absolute;
    right: 8px;
    bottom: -1px;
    left: 8px;
    height: 2px;
    border-radius: 9px;
    background: var(--gold);
    content: "";
}

.tab-content {
    flex: 1;
    min-height: 100px;
    overflow: auto;
    padding: 14px 17px;
    color: #d5d5ca;
    scrollbar-color: #4d5a58 transparent;
    scrollbar-width: thin;
}
.event-list { display: flex; flex-direction: column; gap: 9px; }
.empty-state { padding: 16px 8px; color: #89958e; font-size: 10px; text-align: center; }
.event-row {
    display: grid;
    grid-template-columns: 42px 1fr;
    gap: 9px;
    padding: 7px 8px;
    border-left: 2px solid var(--event-color, #9c947e);
    border-radius: 0 6px 6px 0;
    background: rgba(255,255,255,0.025);
    font-size: 10px;
    line-height: 1.35;
}
.event-tick { color: #78837d; font-family: monospace; font-size: 9px; }
.stat-heading {
    margin: 2px 0 10px;
    color: var(--gold-bright);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.14em;
}
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat-cell {
    padding: 9px;
    border: 1px solid rgba(221,190,126,0.1);
    border-radius: 8px;
    background: rgba(255,255,255,0.025);
}
.stat-label { color: #89958e; font-size: 8px; letter-spacing: 0.08em; }
.stat-value { margin-top: 5px; color: #eee0c4; font-family: Georgia, serif; font-size: 17px; }
.tech-list { display: flex; flex-direction: column; gap: 8px; }
.tech-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 1px solid rgba(221,190,126,0.12);
    border-radius: 9px;
    background: rgba(5,11,13,0.24);
    cursor: pointer;
}
.tech-item:hover { border-color: var(--line-strong); background: rgba(217,184,120,0.06); }
.tech-item.is-unlocked { border-color: rgba(127,198,157,0.36); background: rgba(42,101,72,0.12); cursor: default; }
.tech-icon { width: 31px; text-align: center; font-size: 23px; }
.tech-copy { flex: 1; min-width: 0; }
.tech-name-row { display: flex; align-items: center; justify-content: space-between; gap: 7px; }
.tech-name { color: #e8dec9; font-size: 10px; font-weight: 800; }
.tech-cost { color: var(--gold); font-family: monospace; font-size: 9px; white-space: nowrap; }
.tech-description { margin-top: 4px; color: #929f97; font-size: 9px; line-height: 1.35; }
.tech-unlocked { color: var(--green); font-size: 8px; font-weight: 800; letter-spacing: 0.09em; }

.panel-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 42px;
    padding: 0 17px;
    border-top: 1px solid var(--line);
    background: rgba(5,10,12,0.35);
    color: #87918b;
    font-family: monospace;
    font-size: 9px;
}
.panel-footer strong { color: var(--gold); font-weight: 700; }
.footer-help {
    display: grid;
    width: 23px;
    height: 23px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: transparent;
    color: var(--gold);
    cursor: pointer;
}

#floating-messages {
    position: absolute;
    top: 80px;
    left: 50%;
    display: flex;
    transform: translateX(-50%);
    flex-direction: column;
    gap: 7px;
    pointer-events: none;
}

#card-drag-ghost {
    position: fixed;
    z-index: 100;
    display: none;
    align-items: center;
    gap: 9px;
    min-width: 150px;
    padding: 9px 12px;
    border: 1px solid rgba(241,215,159,0.75);
    border-radius: 10px;
    background: rgba(17,27,30,0.94);
    color: #f2dfb7;
    box-shadow: 0 12px 35px rgba(0,0,0,0.38);
    pointer-events: none;
    backdrop-filter: blur(12px);
}
#card-drag-ghost.is-visible { display: flex; }
.drag-ghost-icon { font-size: 23px; }
.drag-ghost-name { font-size: 9px; font-weight: 900; letter-spacing: 0.09em; }

.big-message {
    position: fixed;
    z-index: 120;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(4,9,11,0.78);
    backdrop-filter: blur(8px);
}
.big-message.hidden { display: none; }
.big-message-card {
    width: min(520px, 92vw);
    padding: 38px 35px;
    border: 1px solid rgba(221,190,126,0.6);
    border-radius: 18px;
    background:
        radial-gradient(circle at 50% 0%, rgba(214,180,115,0.15), transparent 55%),
        linear-gradient(145deg, #263438, #121c1f);
    box-shadow: 0 24px 90px rgba(0,0,0,0.52);
    text-align: center;
}
#big-title {
    color: var(--gold-bright);
    font-family: Georgia, serif;
    font-size: clamp(28px, 5vw, 44px);
    font-weight: 700;
    line-height: 1.1;
}
#big-subtitle {
    margin: 15px 0 26px;
    color: #b5beb6;
    font-size: 13px;
    line-height: 1.5;
}
.message-button {
    min-height: 40px;
    padding: 0 20px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: rgba(217,184,120,0.1);
    color: var(--gold-bright);
    cursor: pointer;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.15em;
}
.message-button:hover { background: rgba(217,184,120,0.2); }

@media (max-width: 1050px) {
    .side-panel { flex-basis: 318px; min-width: 300px; }
    .brand { min-width: 190px; }
    .header-middle { gap: 16px; }
    .topbar { padding-right: 14px; padding-left: 14px; gap: 12px; }
}
@media (max-width: 790px) {
    .topbar { min-height: 66px; flex-wrap: wrap; gap: 8px; padding: 8px 11px; }
    .brand { min-width: auto; flex: 1; }
    .brand-mark { width: 36px; height: 36px; font-size: 24px; }
    .brand-title { font-size: 18px; }
    .header-middle { order: 3; flex-basis: 100%; justify-content: flex-start; }
    .header-actions { gap: 6px; }
    .game-layout { flex-direction: column; }
    .world-stage { flex: 1 1 55%; min-height: 250px; }
    .side-panel {
        flex: 0 0 42%;
        width: 100%;
        max-width: none;
        min-width: 0;
        border-top: 1px solid var(--line-strong);
        border-left: 0;
    }
    .resource-section { padding: 9px 12px; }
    .resource-grid { grid-template-columns: repeat(4, 1fr); gap: 5px; }
    .resource-card { padding: 6px; gap: 5px; }
    .resource-symbol { width: 22px; height: 22px; flex-basis: 22px; font-size: 12px; }
    .resource-income { display: none; }
    .resource-value { font-size: 14px; }
    .card-section { padding: 9px 12px; }
    .card-container { min-height: 115px; flex-direction: row; gap: 10px; padding: 11px; }
    .card-icon { width: 40px; height: 40px; flex: 0 0 40px; margin: 0; font-size: 23px; }
    .card-name { font-size: 15px; }
    .card-desc { max-width: 180px; margin-top: 3px; }
    .card-costs { gap: 8px; margin-top: 6px; }
    .card-play-tag { display: none; }
    .card-instruction { display: none; }
    .tabs { padding: 5px 12px 0; }
    .tab-content { padding: 8px 12px; }
    .panel-footer { min-height: 32px; }
    .minimap-frame { right: 10px; bottom: 10px; }
    #minimap { width: 104px; height: 104px; }
    .zoom-panel { top: 9px; right: 9px; gap: 4px; padding: 5px; }
    .zoom-preset { min-width: 25px; height: 25px; }
    .stage-topline { top: 10px; left: 10px; }
    .placement-status { top: 53px; }
}
@media (max-width: 480px) {
    .brand-subtitle, .morale-block { display: none; }
    .brand-title { font-size: 15px; }
    .control-button { min-height: 31px; padding: 0 9px; font-size: 8px; }
    .speed-button { min-width: 29px; height: 30px; }
    .world-stage { min-height: 220px; }
    .side-panel { flex-basis: 46%; }
    .resource-name { font-size: 7px; }
    .date-value { font-size: 13px; }
}


/* ── Version 2.0: player shell, card hand, settings and realm issues ── */
.player-chip {
    display:flex;align-items:center;gap:7px;padding:7px 10px;
    border:1px solid rgba(221,190,126,.18);border-radius:8px;
    color:#dfd1b6;background:rgba(255,255,255,.035);
    font-size:9px;font-weight:800;letter-spacing:.08em;white-space:nowrap;
}
.hand-dock {
    position:absolute;z-index:12;left:50%;bottom:14px;transform:translateX(-50%);
    width:min(780px,calc(100% - 300px));padding:9px 12px 10px;
    border:1px solid rgba(221,190,126,.42);border-radius:13px;
    background:rgba(12,19,21,.91);box-shadow:0 14px 36px rgba(0,0,0,.38);
    backdrop-filter:blur(15px);
}
.hand-dock-heading {display:flex;align-items:center;gap:10px;padding:0 3px 7px;color:#d9bd83;font-size:8px;font-weight:900;letter-spacing:.18em}
.hand-dock-heading span:nth-child(2){color:#f1e8d2}
.hand-help {margin-left:auto;color:#83928a;font-size:7px}
.card-hand {display:flex;justify-content:center;gap:8px;min-height:88px}
.hand-card {
    display:flex;flex:1 1 0;min-width:0;max-width:138px;min-height:82px;
    flex-direction:column;align-items:center;justify-content:center;gap:3px;
    padding:7px 5px;border:1px solid rgba(220,190,132,.25);border-radius:9px;
    background:linear-gradient(150deg,rgba(58,72,72,.97),rgba(25,37,39,.98));
    color:#e9ddc2;cursor:grab;touch-action:none;user-select:none;
    transition:transform 130ms ease,border-color 130ms ease,background 130ms ease,box-shadow 130ms ease;
}
.hand-card:hover {transform:translateY(-5px);border-color:rgba(241,215,159,.8);box-shadow:0 8px 18px rgba(0,0,0,.3)}
.hand-card.is-selected {transform:translateY(-7px);border-color:#e1bf7f;background:linear-gradient(150deg,#5a5948,#2e3937);box-shadow:0 0 0 1px rgba(225,191,127,.25),0 10px 22px rgba(0,0,0,.35)}
.hand-card:active {cursor:grabbing}
.hand-card-icon {font-size:22px;line-height:1.1}
.hand-card-name {max-width:100%;overflow:hidden;color:#f4e3bb;font-family:Georgia,serif;font-size:9px;font-weight:800;letter-spacing:.05em;text-overflow:ellipsis;white-space:nowrap}
.hand-card-category {max-width:100%;overflow:hidden;color:#95a39b;font-size:7px;letter-spacing:.08em;text-overflow:ellipsis;white-space:nowrap;text-transform:uppercase}
.card-instruction {display:none}
.screen-overlay {
    position:fixed;z-index:1000;inset:0;display:grid;place-items:center;overflow:auto;
    padding:24px;background:rgba(5,10,12,.86);backdrop-filter:blur(12px);
}
.screen-overlay.hidden {display:none}
.start-panel,.modal-panel {
    width:min(620px,94vw);padding:34px;border:1px solid rgba(221,190,126,.5);
    border-radius:19px;background:
    radial-gradient(circle at 50% 0%,rgba(214,180,115,.14),transparent 48%),
    linear-gradient(145deg,#263438,#121c1f);
    box-shadow:0 28px 100px rgba(0,0,0,.6);color:#e9e1d0;
}
.start-panel {text-align:center}
.start-emblem {display:grid;place-items:center;width:58px;height:58px;margin:0 auto 13px;border:1px solid rgba(241,215,159,.6);border-radius:15px;background:linear-gradient(145deg,#e1c28a,#957344);color:#1c2828;font-family:Georgia,serif;font-size:36px}
.start-kicker {color:#c9ad75;font-size:9px;font-weight:900;letter-spacing:.23em}
.start-panel h1 {margin:12px 0 6px;color:#f1d79f;font-family:Georgia,serif;font-size:clamp(32px,6vw,49px);letter-spacing:.13em}
.start-panel h1 span {color:#b49a6e}
.start-lead {margin:8px 0 23px;color:#b1bdb5;font-size:12px;line-height:1.5}
.start-form {display:flex;flex-direction:column;gap:9px;max-width:410px;margin:0 auto;text-align:left}
.start-form label {margin-top:6px;color:#c7b893;font-size:8px;font-weight:900;letter-spacing:.16em}
.start-form input {
    width:100%;min-height:39px;padding:0 12px;border:1px solid rgba(221,190,126,.28);border-radius:7px;
    outline:none;background:rgba(5,11,13,.5);color:#f0e8d7;font:inherit;font-size:12px;
}
.start-form input:focus {border-color:#d7b676;box-shadow:0 0 0 2px rgba(215,182,118,.13)}
.seed-row {display:flex;gap:8px}.seed-row input{flex:1;min-width:0}
.primary-button,.secondary-button,.text-button {
    min-height:40px;padding:0 15px;border-radius:7px;cursor:pointer;
    font-size:9px;font-weight:900;letter-spacing:.12em;transition:background 130ms ease,border-color 130ms ease;
}
.primary-button {margin-top:10px;border:1px solid #edcf91;background:linear-gradient(180deg,#e4c78e,#b69258);color:#1b2525}
.primary-button:hover {background:linear-gradient(180deg,#f0d7a3,#c5a36b)}
.secondary-button {border:1px solid rgba(221,190,126,.35);background:rgba(255,255,255,.04);color:#e2d2b1}
.secondary-button:hover {background:rgba(221,190,126,.12)}
.secondary-button:disabled {opacity:.42;cursor:not-allowed}
.text-button {border:0;background:transparent;color:#a9b6ae}
.text-button:hover {color:#f1d79f}
.profile-note {margin:6px 0 3px;color:#819089;font-size:9px;line-height:1.5}
.start-footer {margin-top:22px;color:#687b73;font-size:7px;font-weight:800;letter-spacing:.14em}
.status-message {min-height:18px;margin-top:11px;color:#f0bb83;font-size:10px}
.status-message.is-visible {color:#e5c78a}
.modal-panel {width:min(560px,94vw);padding:26px}
.modal-heading {display:flex;align-items:flex-start;justify-content:space-between;margin-bottom:20px}
.modal-heading h2,.event-panel h2 {margin:6px 0 0;color:#f1d79f;font-family:Georgia,serif;font-size:27px}
.modal-close {width:32px;height:32px;border:1px solid rgba(221,190,126,.22);border-radius:7px;background:transparent;color:#d9c9a8;font-size:22px;cursor:pointer}
.setting-row {display:flex;align-items:center;justify-content:space-between;gap:18px;padding:14px 0;border-bottom:1px solid rgba(221,190,126,.13)}
.setting-row strong {display:block;color:#e7ddc9;font-size:11px}
.setting-row small {display:block;margin-top:4px;color:#87968e;font-size:9px;line-height:1.4}
.volume-setting input {width:150px;accent-color:#d6b77e}
.toggle {position:relative;width:42px;height:24px;flex:0 0 42px}
.toggle input {position:absolute;opacity:0}
.toggle span {position:absolute;inset:0;border:1px solid rgba(221,190,126,.3);border-radius:30px;background:#111b1c;cursor:pointer}
.toggle span:before {position:absolute;top:3px;left:3px;width:16px;height:16px;border-radius:50%;background:#87918b;content:"";transition:transform 140ms ease,background 140ms ease}
.toggle input:checked+span {background:rgba(177,143,83,.35);border-color:#d4b477}
.toggle input:checked+span:before {transform:translateX(18px);background:#f1d79f}
.shortcut-list {margin:20px 0}
.shortcut-list h3 {margin:0 0 8px;color:#c9ad75;font-size:8px;letter-spacing:.17em}
.shortcut-list>div {display:flex;align-items:center;justify-content:space-between;padding:7px 0;border-bottom:1px solid rgba(221,190,126,.08);color:#aab5ad;font-size:10px}
kbd {padding:4px 6px;border:1px solid rgba(221,190,126,.2);border-radius:5px;background:rgba(0,0,0,.2);color:#e9d7b2;font:8px monospace}
.event-overlay {z-index:1100}
.event-panel {width:min(540px,94vw);text-align:left}
.event-panel h2 {font-size:30px}
.event-panel p {margin:12px 0 20px;color:#b6c0b7;font-size:12px;line-height:1.55}
.event-choices {display:flex;flex-direction:column;gap:9px}
.event-choice {display:flex;flex-direction:column;gap:5px;padding:13px 15px;border:1px solid rgba(221,190,126,.28);border-radius:8px;background:rgba(5,12,14,.35);color:#e9ddc2;text-align:left;cursor:pointer}
.event-choice:hover {border-color:#dfbd7e;background:rgba(217,184,120,.11)}
.event-choice strong {font-size:11px}.event-choice span {color:#95a49b;font-size:9px}
.action-toast {position:fixed;z-index:1200;bottom:24px;left:50%;transform:translate(-50%,12px);padding:9px 15px;border:1px solid rgba(221,190,126,.3);border-radius:8px;background:rgba(13,21,23,.95);color:#e7d4ad;font-size:9px;font-weight:900;letter-spacing:.12em;opacity:0;pointer-events:none;transition:opacity 150ms ease,transform 150ms ease}
.action-toast.is-visible {transform:translate(-50%,0);opacity:1}
.trade-summary {display:flex;justify-content:space-between;gap:8px;margin-bottom:7px;color:#c9ad75;font-size:8px;font-weight:900;letter-spacing:.13em}
.trade-summary strong {color:#f1d79f}
.trade-note {margin-bottom:12px;color:#82928a;font-size:9px;line-height:1.4}
.trade-partners {display:flex;flex-direction:column;gap:10px}
.trade-partner {padding:10px;border:1px solid rgba(221,190,126,.14);border-radius:8px;background:rgba(255,255,255,.025)}
.trade-partner-head {display:flex;justify-content:space-between;gap:8px;margin-bottom:8px}
.trade-partner-head strong {display:block;color:#e7dcc4;font-size:10px}
.trade-partner-head small {display:block;margin-top:3px;color:#82928a;font-size:8px}
.trade-treasury {color:#d8b979;font-size:8px;white-space:nowrap}
.trade-resource {display:flex;align-items:center;justify-content:space-between;gap:8px;padding:7px 0;border-top:1px solid rgba(221,190,126,.08)}
.trade-resource strong {display:block;color:#c9c5b6;font-size:8px;letter-spacing:.1em}
.trade-resource small {display:block;margin-top:3px;color:#84938b;font-size:8px}
.trade-actions {display:flex;gap:5px}
.trade-actions button {min-height:25px;padding:0 7px;border:1px solid rgba(221,190,126,.2);border-radius:5px;background:rgba(217,184,120,.06);color:#dcc794;font-size:7px;font-weight:900;cursor:pointer}
.trade-actions button:hover {background:rgba(217,184,120,.18);border-color:#d5b87e}
@media(max-width:1050px) {
    .hand-dock {width:min(700px,calc(100% - 270px))}
}
@media(max-width:790px) {
    .player-chip {display:none}
    .hand-dock {width:calc(100% - 22px);bottom:8px;padding:6px}
    .card-hand {gap:4px;min-height:65px}
    .hand-card {min-height:62px;padding:5px 3px}
    .hand-card-icon {font-size:17px}
    .hand-card-name {font-size:7px}
    .hand-card-category {font-size:6px}
    .hand-help {display:none}
    .hint-box {bottom:90px}
    .side-panel {max-height:46%}
}
@media(max-width:480px) {
    .header-actions {gap:3px}
    .header-actions .control-button {padding:0 6px;font-size:7px}
    .header-actions .speed-button {min-width:25px}
    .hand-dock-heading {font-size:7px}
    .hand-card-category {display:none}
    .hand-card {min-height:54px}
    .side-panel {flex-basis:48%}
}

.price-chart {display:flex;flex-direction:column;gap:7px;margin:10px 0 13px;padding:9px;border:1px solid rgba(221,190,126,.12);border-radius:8px;background:rgba(0,0,0,.12)}
.price-chart-row {display:grid;grid-template-columns:44px 1fr 42px;align-items:end;gap:8px}
.price-chart-row>strong {align-self:center;color:#9ba79d;font-size:8px;letter-spacing:.1em}
.price-chart-row>b {align-self:center;color:#e4c78d;font-family:Georgia,serif;font-size:10px;text-align:right}
.price-bars {display:flex;align-items:end;gap:3px;height:50px;padding:3px 0 0;border-bottom:1px solid rgba(221,190,126,.15)}
.price-bar {flex:1;min-width:3px;border-radius:2px 2px 0 0;background:linear-gradient(180deg,#e2c182,#8b7246);opacity:.78}
.price-bar:last-child {background:linear-gradient(180deg,#f1d79f,#b68d4e);opacity:1}
