/* ==========================================================================
   SKIES OF ORON — Dark-fantasy cloud-river UI theme
   ========================================================================== */
:root {
    --oro-gold: #e8c468;
    --oro-parchment: #d9c9a3;
    --oro-aether: #6fd3e0;
    --oro-siren: #b06fe0;
    --oro-danger: #e06a5a;
    --oro-heal: #7fe0a0;
    --oro-bg-0: #0b0f19;
    --oro-bg-1: #16203a;
    --oro-panel: rgba(18, 24, 42, 0.92);
    --oro-panel-edge: rgba(232, 196, 104, 0.35);
    --oro-ink: #e8e6df;
    --oro-ink-dim: #9aa3b8;
    --oro-shadow: 0 10px 40px rgba(0, 0, 0, 0.55);
}

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

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--oro-bg-0);
    color: var(--oro-ink);
    font-family: Georgia, 'Iowan Old Style', 'Times New Roman', serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

#app {
    position: relative;
    width: 100%;
    height: 100dvh;
    min-height: 100%;
    overflow: hidden;
    background: radial-gradient(circle at 50% 30%, #1a2440 0%, #0b0f19 70%);
}

#game-container {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

#game-container canvas {
    display: block;
}

/* ---- Overlays (React UI layer) ----------------------------------------- */
.overlay {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    pointer-events: none;
}

.overlay > * {
    pointer-events: auto;
}

/* ---- Persistent Header -------------------------------------------------- */
.bonus-challenges-panel {
    position: absolute;
    left: 50%;
    bottom: 90px;
    transform: translateX(-50%);
    width: min(92vw, 480px);
    z-index: 60;
    pointer-events: auto;
}
.bonus-challenges-card {
    background: linear-gradient(160deg, rgba(30, 18, 8, 0.96), rgba(60, 30, 10, 0.96));
    border: 2px solid #F59E0B;
    border-radius: 12px;
    padding: 12px 14px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.55), 0 0 18px rgba(245, 158, 11, 0.35);
}
.bonus-challenges-head {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.bonus-challenges-head h3 {
    margin: 0;
    font-size: 15px;
    color: #FDE68A;
    flex: 1 1 auto;
}
.bonus-challenges-icon {
    font-size: 18px;
}
.bonus-challenges-days {
    font-size: 13px;
    color: #FCA5A5;
    font-weight: 700;
}
.days-remaining-display {
    color: #FCA5A5;
    font-weight: 800;
}
.bonus-challenges-sub {
    margin: 6px 0 8px;
    font-size: 12px;
    color: #FDE68A;
    opacity: 0.9;
}
.bonus-challenge-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 220px;
    overflow-y: auto;
}
.bonus-challenge-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 8px;
    padding: 8px 10px;
}
.bonus-challenge-item.bonus-challenge-done {
    opacity: 0.55;
}
.bonus-challenge-info {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
}
.challenge-title {
    font-size: 12.5px;
    font-weight: 700;
    color: #FFFFFF;
}
.challenge-desc {
    font-size: 11px;
    color: #D1D5DB;
}
.challenge-reward {
    font-size: 12px;
    font-weight: 800;
    color: #34D399;
    white-space: nowrap;
}
.btn-complete-challenge {
    background: #F59E0B;
    color: #1F2937;
    border: none;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 11.5px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}
.btn-complete-challenge:disabled {
    background: #6B7280;
    color: #D1D5DB;
    cursor: not-allowed;
}

#hud-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
    padding: 10px 18px;
    background: linear-gradient(180deg, rgba(11, 15, 25, 0.95), rgba(11, 15, 25, 0.55));
    border-bottom: 1px solid var(--oro-panel-edge);
    backdrop-filter: blur(6px);
    pointer-events: auto;
}

.hud-stat {
    display: flex;
    align-items: baseline;
    gap: 6px;
    font-size: 18px;
    letter-spacing: 0.5px;
}

.hud-icon {
    font-size: 20px;
    filter: drop-shadow(0 0 6px currentColor);
}

.hud-val {
    font-weight: bold;
    color: var(--oro-ink);
}

.hud-sub {
    font-size: 13px;
    color: var(--oro-ink-dim);
}

.hud-audio {
    margin-left: auto;
    background: rgba(232, 196, 104, 0.12);
    border: 1px solid var(--oro-panel-edge);
    color: var(--oro-gold);
    padding: 6px 14px;
    border-radius: 20px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    transition: background 0.2s;
}

.hud-audio:hover {
    background: rgba(232, 196, 104, 0.25);
}

/* ---- Gold progress ------------------------------------------------------ */
.gold-progress {
    position: absolute;
    top: 58px;
    left: 18px;
    right: 18px;
    height: 6px;
    z-index: 19;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid rgba(232, 196, 104, 0.2);
}

.gold-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #b8860b, var(--oro-gold));
    box-shadow: 0 0 12px var(--oro-gold);
    transition: width 0.5s ease;
}

/* ---- Paid Hint Button ------------------------------------------------ */
.hint-btn {
    position: absolute;
    top: 8px;
    right: 18px;
    z-index: 30;
    pointer-events: auto;
    background: linear-gradient(180deg, #2a3a52, #16202e);
    border: 1px solid var(--oro-gold, #e8c468);
    color: var(--oro-gold, #e8c468);
    font-size: 13px;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 16px;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(232, 196, 104, 0.15);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.hint-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 16px rgba(232, 196, 104, 0.35);
}
.hint-btn:active {
    transform: translateY(0);
}

/* ---- Contextual Hint Banner ------------------------------------------------ */
.hint-banner {
    position: absolute;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 25;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    background: rgba(10, 18, 32, 0.92);
    border: 1px solid var(--hint-color, #6fd3e0);
    border-radius: 20px;
    box-shadow: 0 0 16px rgba(111, 211, 224, 0.2), inset 0 0 20px rgba(111, 211, 224, 0.04);
    animation: hint-pulse 3s ease-in-out infinite;
    max-width: 90%;
    pointer-events: none;
}
.hint-icon {
    font-size: 18px;
    line-height: 1;
    flex-shrink: 0;
}
.hint-text {
    font-size: 13px;
    color: #e8e4dc;
    letter-spacing: 0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
@keyframes hint-pulse {
    0%, 100% { box-shadow: 0 0 16px rgba(111, 211, 224, 0.2); }
    50% { box-shadow: 0 0 24px var(--hint-color, #6fd3e0); }
}

/* ---- Panels (shared) ---------------------------------------------------- */
.menu-card,
.port-panel,
.sailing-card,
.combat-panel,
.finished-card {
    background: var(--oro-panel);
    border: 1px solid var(--oro-panel-edge);
    border-radius: 14px;
    box-shadow: var(--oro-shadow), inset 0 0 40px rgba(111, 211, 224, 0.05);
    padding: 28px;
    max-width: 720px;
    width: 100%;
    max-height: calc(100dvh - 90px);
    overflow-y: auto;
    backdrop-filter: blur(4px);
}

/* ---- Start screen ------------------------------------------------------- */
.overlay-menu {
    background: radial-gradient(circle at 50% 40%, rgba(111, 211, 224, 0.08), transparent 60%);
}

.menu-card {
    text-align: center;
    max-width: 620px;
}

.title {
    font-family: 'Noto Sans Ethiopic', Georgia, 'Iowan Old Style', 'Times New Roman', serif;
    font-size: 46px;
    letter-spacing: 3px;
    color: var(--oro-gold);
    text-shadow: 0 0 24px rgba(232, 196, 104, 0.5);
    margin-bottom: 14px;
}

.lore-quote {
    font-style: italic;
    color: var(--oro-parchment);
    font-size: 17px;
    line-height: 1.6;
    margin-bottom: 22px;
    padding: 0 10px;
}

.menu-sub {
    color: var(--oro-ink-dim);
    margin-bottom: 14px;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-size: 13px;
}

.difficulty-row {
    display: flex;
    gap: 14px;
    justify-content: center;
    flex-wrap: wrap;
}

.diff-btn {
    flex: 1 1 150px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 18px 14px;
    background: rgba(22, 32, 58, 0.8);
    border: 1px solid var(--oro-panel-edge);
    border-radius: 10px;
    color: var(--oro-ink);
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.15s, border-color 0.2s, box-shadow 0.2s;
}

.diff-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.diff-easy:hover { border-color: var(--oro-heal); }
.diff-medium:hover { border-color: var(--oro-aether); }
.diff-hard:hover { border-color: var(--oro-danger); }

.diff-label {
    font-size: 19px;
    font-weight: bold;
    color: var(--oro-gold);
}

.diff-detail {
    font-size: 14px;
    color: var(--oro-ink);
}

.diff-blurb {
    font-size: 12px;
    color: var(--oro-ink-dim);
    font-style: italic;
}

/* ---- Port hub ----------------------------------------------------------- */
.overlay-port {
    align-items: flex-start;
    padding-top: 78px;
}

.port-panel {
    max-width: 760px;
}

.port-header {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 4px;
}

.port-name {
    font-size: 30px;
    color: var(--oro-gold);
    text-shadow: 0 0 16px rgba(232, 196, 104, 0.4);
}

.port-specialty {
    font-size: 14px;
    color: var(--oro-aether);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.port-tip {
    color: var(--oro-ink-dim);
    font-style: italic;
    margin-bottom: 18px;
    font-size: 15px;
}

.market-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}

.market-card {
    background: rgba(22, 32, 58, 0.7);
    border: 1px solid rgba(232, 196, 104, 0.18);
    border-radius: 10px;
    padding: 12px;
}

.market-card-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.market-glyph {
    font-size: 22px;
    filter: drop-shadow(0 0 6px currentColor);
}

.market-name {
    font-size: 17px;
    font-weight: bold;
}

.market-owned {
    margin-left: auto;
    color: var(--oro-ink-dim);
    font-size: 14px;
}

.market-origin-lock {
    font-size: 11px;
    color: #fca5a5;
    background: rgba(248, 113, 113, 0.12);
    border: 1px solid rgba(248, 113, 113, 0.3);
    border-radius: 6px;
    padding: 3px 6px;
    margin-bottom: 8px;
    text-align: center;
}

.market-prices {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--oro-ink-dim);
    margin-bottom: 10px;
}

.market-actions {
    display: flex;
    gap: 8px;
}

.cargo-line {
    text-align: center;
    color: var(--oro-parchment);
    font-size: 14px;
    margin: 6px 0 16px;
    letter-spacing: 0.5px;
}

/* ---- Buttons ------------------------------------------------------------ */
.btn {
    flex: 1;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    color: #0b0f19;
    font-weight: bold;
    transition: filter 0.15s, transform 0.1s, opacity 0.2s;
}

.btn:active {
    transform: scale(0.96);
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    filter: grayscale(0.5);
}

.btn-buy { background: var(--oro-aether); }
.btn-buy:hover:not(:disabled) { filter: brightness(1.15); }
.btn-sell { background: var(--oro-gold); }
.btn-sell:hover:not(:disabled) { filter: brightness(1.15); }

.btn-refuel {
    background: rgba(111, 211, 224, 0.15);
    color: var(--oro-aether);
    border: 1px solid var(--oro-aether);
    padding: 10px;
    width: 100%;
    flex: none;
}
.btn-refuel:hover:not(:disabled) { background: rgba(111, 211, 224, 0.28); }

.btn-rest {
    background: rgba(127, 224, 160, 0.15);
    color: var(--oro-heal);
    border: 1px solid var(--oro-heal);
    padding: 10px;
    width: 100%;
    flex: none;
    margin-top: 8px;
}
.btn-rest:hover:not(:disabled) { background: rgba(127, 224, 160, 0.28); }

.market-day-countdown {
    background: rgba(245, 158, 11, 0.1);
    border-color: #f59e0b;
    color: #f59e0b;
}

.market-day-banner {
    margin-top: 10px;
    padding: 10px 14px;
    border-radius: 10px;
    background: rgba(232, 196, 104, 0.15);
    border: 1px solid var(--oro-gold);
    color: var(--oro-gold);
    font-size: 14px;
    text-align: center;
    font-weight: bold;
}

.hud-calendar {
    color: var(--oro-parchment);
}
.hud-calendar-urgent {
    color: var(--oro-danger);
    animation: pulse-urgent 1.2s infinite;
}
@keyframes pulse-urgent {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.55; }
}

.speed-grade-badge {
    margin: 14px auto 0;
    padding: 12px 18px;
    border-radius: 10px;
    background: rgba(232, 196, 104, 0.12);
    border: 1px solid var(--oro-panel-edge);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    max-width: 380px;
}
.speed-grade-tier {
    font-size: 20px;
    font-weight: bold;
    color: var(--oro-gold);
}
.speed-grade-detail {
    font-size: 13px;
    color: var(--oro-ink-dim);
}

/* ---- Navigation --------------------------------------------------------- */
.nav-section h3 {
    color: var(--oro-siren);
    letter-spacing: 1px;
    margin-bottom: 10px;
    font-size: 16px;
    text-transform: uppercase;
}

.nav-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.btn-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: rgba(176, 111, 224, 0.14);
    border: 1px solid var(--oro-siren);
    color: var(--oro-ink);
    padding: 12px;
    flex: none;
}

.btn-nav:hover:not(:disabled) { background: rgba(176, 111, 224, 0.3); }

.nav-name { font-size: 17px; font-weight: bold; color: var(--oro-parchment); }
.nav-cost { font-size: 12px; color: var(--oro-ink-dim); }

.port-actions { margin-top: 6px; }

/* ---- Sailing ------------------------------------------------------------ */
.sailing-card {
    text-align: center;
    max-width: 460px;
}

.sailing-card h2 {
    color: var(--oro-aether);
    margin-bottom: 8px;
    font-size: 26px;
}

.sailing-sub {
    color: var(--oro-ink-dim);
    font-style: italic;
    margin-bottom: 20px;
}

.sailing-spinner {
    width: 54px;
    height: 54px;
    margin: 0 auto;
    border: 4px solid rgba(111, 211, 224, 0.2);
    border-top-color: var(--oro-aether);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Combat ------------------------------------------------------------- */
.overlay-combat {
    align-items: flex-end;
    padding-bottom: 20px;
}

.combat-panel {
    max-width: 820px;
    width: 100%;
    background: linear-gradient(180deg, rgba(18, 24, 42, 0.55), rgba(18, 24, 42, 0.95));
}

.enemy-bar-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.enemy-label {
    color: var(--oro-siren);
    font-weight: bold;
    white-space: nowrap;
    text-shadow: 0 0 10px rgba(176, 111, 224, 0.5);
}

.enemy-bar {
    flex: 1;
    height: 16px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--oro-siren);
}

.enemy-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #6a2a8a, var(--oro-siren));
    box-shadow: 0 0 14px var(--oro-siren);
    transition: width 0.4s ease;
}

.enemy-hp-text {
    font-size: 14px;
    color: var(--oro-ink-dim);
    white-space: nowrap;
}

.combat-message {
    text-align: center;
    font-style: italic;
    color: var(--oro-parchment);
    min-height: 24px;
    margin-bottom: 10px;
    font-size: 16px;
}

.player-stats {
    display: flex;
    gap: 18px;
    justify-content: center;
    margin-bottom: 14px;
    font-size: 15px;
    flex-wrap: wrap;
}

.stat-energy { color: var(--oro-gold); }
.stat-shield { color: var(--oro-aether); }
.stat-hp { color: var(--oro-danger); }
.stat-deck { color: var(--oro-ink-dim); font-size: 13px; }

.combat-hand {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.card {
    position: relative;
    width: 132px;
    min-height: 150px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px 10px;
    background: linear-gradient(160deg, rgba(30, 40, 66, 0.95), rgba(16, 22, 40, 0.98));
    border: 1px solid var(--card-color, var(--oro-panel-edge));
    border-radius: 10px;
    color: var(--oro-ink);
    cursor: pointer;
    font-family: inherit;
    text-align: center;
    transition: transform 0.15s, box-shadow 0.2s;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

.card:hover:not(:disabled) {
    transform: translateY(-8px) scale(1.03);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.6), 0 0 18px var(--card-color, var(--oro-gold));
}

.card-disabled {
    opacity: 0.45;
    cursor: not-allowed;
    filter: grayscale(0.4);
}

.card-cost {
    position: absolute;
    top: 8px;
    left: 8px;
    background: var(--card-color, var(--oro-gold));
    color: #0b0f19;
    font-weight: bold;
    font-size: 13px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-name {
    margin-top: 18px;
    font-size: 15px;
    font-weight: bold;
    color: var(--card-color, var(--oro-gold));
}

.card-text {
    font-size: 12px;
    color: var(--oro-ink-dim);
    line-height: 1.4;
    flex: 1;
}

.card-hotkey {
    position: absolute;
    bottom: 6px;
    right: 8px;
    font-size: 11px;
    color: var(--oro-ink-dim);
}

.btn-end-turn {
    display: block;
    margin: 0 auto;
    background: rgba(232, 196, 104, 0.15);
    color: var(--oro-gold);
    border: 1px solid var(--oro-gold);
    padding: 10px 28px;
    width: auto;
    flex: none;
    font-size: 15px;
}

.btn-end-turn:hover:not(:disabled) { background: rgba(232, 196, 104, 0.3); }

/* ---- Finished ----------------------------------------------------------- */
.finished-card {
    text-align: center;
    max-width: 520px;
}

.finished-title {
    font-size: 34px;
    margin-bottom: 14px;
    color: var(--oro-gold);
    text-shadow: 0 0 20px rgba(232, 196, 104, 0.5);
}

.finished-sub {
    color: var(--oro-parchment);
    font-size: 17px;
    line-height: 1.6;
    margin-bottom: 24px;
}

.btn-restart {
    background: var(--oro-aether);
    color: #0b0f19;
    border: none;
    padding: 12px 32px;
    width: auto;
    flex: none;
    font-size: 16px;
}

.btn-restart:hover { filter: brightness(1.15); }

/* ---- Toast -------------------------------------------------------------- */
.toast {
    position: absolute;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 40;
    background: rgba(11, 15, 25, 0.95);
    border: 1px solid var(--oro-panel-edge);
    color: var(--oro-parchment);
    padding: 12px 22px;
    border-radius: 24px;
    font-size: 15px;
    box-shadow: var(--oro-shadow);
    animation: toast-in 0.3s ease;
    max-width: 90vw;
    text-align: center;
}

@keyframes toast-in {
    from { opacity: 0; transform: translate(-50%, 12px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

/* ---- How to Play: HUD + Menu buttons ------------------------------------ */
.hud-rules-btn {
    margin-left: auto;
    background: rgba(176, 111, 224, 0.14);
    border: 1px solid var(--oro-siren);
    color: var(--oro-parchment);
    padding: 6px 14px;
    border-radius: 20px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    transition: background 0.2s;
}

.hud-rules-btn:hover {
    background: rgba(176, 111, 224, 0.3);
}

.hud-rules-btn + .hud-audio {
    margin-left: 0;
}

.btn-rules {
    display: block;
    margin: 22px auto 0;
    background: rgba(176, 111, 224, 0.16);
    color: var(--oro-parchment);
    border: 1px solid var(--oro-siren);
    padding: 12px 30px;
    border-radius: 24px;
    width: auto;
    flex: none;
    font-size: 16px;
    letter-spacing: 0.5px;
    transition: background 0.2s, transform 0.15s;
}

.btn-rules:hover {
    background: rgba(176, 111, 224, 0.32);
    transform: translateY(-2px);
}

/* ---- How to Play: Modal ------------------------------------------------- */
.rules-modal {
    position: absolute;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(5, 8, 16, 0.78);
    backdrop-filter: blur(4px);
    animation: rules-fade 0.25s ease;
}

@keyframes rules-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

.rules-card {
    background: var(--oro-panel);
    border: 1px solid var(--oro-panel-edge);
    border-radius: 16px;
    box-shadow: var(--oro-shadow), inset 0 0 50px rgba(176, 111, 224, 0.06);
    padding: 26px 28px;
    max-width: 820px;
    width: 100%;
    max-height: calc(100dvh - 60px);
    overflow-y: auto;
}

.rules-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(232, 196, 104, 0.25);
}

.rules-head h2 {
    font-size: 26px;
    color: var(--oro-gold);
    text-shadow: 0 0 18px rgba(232, 196, 104, 0.4);
}

.rules-close {
    background: rgba(224, 106, 90, 0.16);
    border: 1px solid var(--oro-danger);
    color: var(--oro-danger);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    flex: none;
    transition: background 0.2s;
}

.rules-close:hover {
    background: rgba(224, 106, 90, 0.34);
}

.rules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}

.rules-section {
    background: rgba(22, 32, 58, 0.7);
    border: 1px solid rgba(232, 196, 104, 0.16);
    border-radius: 12px;
    padding: 16px 18px;
}

.rules-section h3 {
    color: var(--oro-aether);
    font-size: 17px;
    margin-bottom: 10px;
    letter-spacing: 0.3px;
}

.rules-section p {
    color: var(--oro-ink);
    font-size: 14.5px;
    line-height: 1.6;
    margin-bottom: 8px;
}

.rules-section p:last-child {
    margin-bottom: 0;
}

.rules-section ul {
    list-style: none;
    padding: 0;
    margin: 0 0 8px;
}

.rules-section li {
    color: var(--oro-ink-dim);
    font-size: 14px;
    line-height: 1.5;
    padding: 3px 0 3px 14px;
    position: relative;
}

.rules-section li::before {
    content: '◆';
    position: absolute;
    left: 0;
    color: var(--oro-siren);
    font-size: 9px;
    top: 7px;
}

.rules-section strong {
    color: var(--oro-gold);
}

.rules-section kbd {
    display: inline-block;
    background: rgba(11, 15, 25, 0.9);
    border: 1px solid var(--oro-panel-edge);
    border-radius: 5px;
    padding: 1px 7px;
    margin: 0 2px;
    font-family: inherit;
    font-size: 13px;
    color: var(--oro-parchment);
}

.btn-rules-close {
    margin: 0 auto;
}

/* ---- Merkato (Addis Ababa) — Grand Market hub styling -------------------- */
.merkato-badge {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(200, 90, 50, 0.35), rgba(255, 209, 0, 0.22));
    border: 1px solid var(--oro-gold);
    color: var(--oro-gold);
    font-size: 12px;
    letter-spacing: 1px;
    text-transform: uppercase;
    white-space: nowrap;
    text-shadow: 0 0 8px rgba(232, 196, 104, 0.5);
}

.port-panel-merkato {
    border-color: rgba(255, 209, 0, 0.5);
    box-shadow: var(--oro-shadow), inset 0 0 50px rgba(255, 209, 0, 0.07);
}

.port-panel-merkato .port-name {
    background: linear-gradient(90deg, #ffd100, #e8c468, #c85a32);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: none;
}

.bunna-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 14px;
    padding: 10px 14px;
    border-radius: 10px;
    background: rgba(107, 63, 29, 0.28);
    border: 1px solid rgba(232, 196, 104, 0.4);
    color: var(--oro-parchment);
    font-size: 14px;
    line-height: 1.5;
}

.bunna-icon {
    font-size: 22px;
    flex-shrink: 0;
    filter: drop-shadow(0 0 6px rgba(232, 196, 104, 0.6));
}

.btn-nav-merkato {
    background: linear-gradient(160deg, rgba(255, 209, 0, 0.18), rgba(200, 90, 50, 0.22));
    border-color: var(--oro-gold);
    box-shadow: 0 0 14px rgba(255, 209, 0, 0.18);
}

.btn-nav-merkato:hover:not(:disabled) {
    background: linear-gradient(160deg, rgba(255, 209, 0, 0.32), rgba(200, 90, 50, 0.34));
}

.btn-nav-merkato .nav-name { color: var(--oro-gold); }
.nav-star { color: #ffd100; text-shadow: 0 0 8px rgba(255, 209, 0, 0.7); }

/* ---- Responsive --------------------------------------------------------- */
@media (max-width: 640px) {
    .title { font-size: 34px; }
    .hud-stat { font-size: 15px; }
    #hud-header { gap: 12px; padding: 8px 12px; }
    .card { width: 108px; min-height: 132px; }
    .card-name { font-size: 13px; }
    .menu-card, .port-panel, .combat-panel { padding: 18px; }
    .overlay-port { padding-top: 70px; }
    /* Mobile: thumb-reachable 56px touch targets on trade & travel buttons */
    .btn { min-height: 56px; }
    .btn-nav { min-height: 60px; }
    .market-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
    .nav-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
    .merkato-badge { font-size: 11px; padding: 2px 8px; }
    .bunna-banner { font-size: 13px; }
}