/* ═══════════════════════════════════════════════════════════════
   STARFALL TRAIL — Complete UI Redesign
   Design Philosophy: Warm amber + deep space blue, 
   mobile-first, no horizontal overflow, immersive cockpit feel
   ═══════════════════════════════════════════════════════════════ */

/* ── Design Tokens ── */
:root {
    --bg-void: #04060e;
    --panel-bg: rgba(8, 12, 24, 0.88);
    --panel-border: rgba(80, 140, 220, 0.15);
    --surface: rgba(15, 22, 42, 0.9);
    --surface-hover: rgba(25, 38, 70, 0.9);

    --text-primary: #c8d8f0;
    --text-secondary: #5a7099;
    --text-dim: #3a506b;

    --accent-cyan: #00d4ff;
    --accent-amber: #ffb347;
    --accent-green: #00ff88;
    --accent-red: #ff4466;
    --accent-purple: #a855f7;

    --glow-cyan: rgba(0, 212, 255, 0.4);
    --glow-amber: rgba(255, 179, 71, 0.4);
    --glow-green: rgba(0, 255, 136, 0.4);
    --glow-red: rgba(255, 68, 102, 0.4);

    --font-display: 'Orbitron', sans-serif;
    --font-body: 'Rajdhani', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;

    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── Reset & Base ── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--accent-cyan);
    border-radius: 4px;
}

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
}

body {
    background-color: var(--bg-void);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 16px;
    font-weight: 400;
    display: flex;
    justify-content: center;
    align-items: center;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: fixed;
    top: 0; left: 0;
    touch-action: manipulation;
    transition: background-image 0.8s ease;
    -webkit-font-smoothing: antialiased;
}

body::after {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at center, transparent 40%, rgba(4,6,14,0.6) 100%);
    pointer-events: none;
    z-index: 0;
}

/* ── Background Variants ── */
body.bg-menu      { background-image: url('../assets/main_menu_bg.png'); }
body.bg-ship      { background-image: url('../assets/ship_interior_bg.png'); }
body.bg-space-1   { background-image: url('../assets/space_bg_1.png'); }
body.bg-space-2   { background-image: url('../assets/space_bg_2.png'); }
body.bg-scavenge  { background-image: url('../assets/scavenge_bg.png'); }

/* ── Utility Classes ── */
.hidden { display: none !important; }
.text-green { color: var(--accent-green) !important; }
.text-red { color: var(--accent-red) !important; }
.text-muted { color: var(--text-secondary); }
.accent-value { color: var(--accent-green); font-weight: 700; }
.full-width { width: 100%; }

/* ══════════════════════════════════════════
   MAIN MENU
   ══════════════════════════════════════════ */
#main-menu-container {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    background: radial-gradient(ellipse at 50% 30%, rgba(0,60,120,0.15), transparent 70%);
    transition: opacity 0.6s var(--ease-out);
}

.menu-glow-ring {
    position: absolute;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    border: 1px solid rgba(0, 212, 255, 0.1);
    box-shadow: 0 0 80px rgba(0, 212, 255, 0.05), inset 0 0 80px rgba(0, 212, 255, 0.03);
    animation: ringPulse 4s ease-in-out infinite;
    pointer-events: none;
}

@keyframes ringPulse {
    0%, 100% { transform: scale(1); opacity: 0.4; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.main-title {
    font-family: var(--font-display);
    font-size: clamp(2.8rem, 10vw, 5.5rem);
    font-weight: 900;
    color: var(--text-primary);
    text-align: center;
    line-height: 1;
    letter-spacing: 0.15em;
    text-shadow: 0 0 40px var(--glow-cyan), 0 0 80px rgba(0,212,255,0.15);
    position: relative;
    z-index: 1;
}

.title-accent {
    color: var(--accent-cyan);
    display: block;
    font-size: 1.4em;
    letter-spacing: 0.3em;
}

.main-subtitle {
    font-family: var(--font-body);
    font-size: clamp(0.9rem, 2.5vw, 1.2rem);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3em;
    margin-top: 16px;
    font-weight: 300;
    position: relative;
    z-index: 1;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 48px;
    position: relative;
    z-index: 1;
}

.menu-btn {
    min-width: 280px;
    padding: 16px 32px !important;
    font-size: 1.1rem !important;
    letter-spacing: 0.1em;
}

.resume-btn {
    border-color: var(--accent-green) !important;
    color: var(--accent-green) !important;
}
.resume-btn:hover:not(:disabled) {
    background: rgba(0, 255, 136, 0.1) !important;
    box-shadow: 0 0 20px var(--glow-green) !important;
}

/* ══════════════════════════════════════════
   OVERLAY PANELS (Modals)
   ══════════════════════════════════════════ */
.overlay-panel {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--panel-bg);
    backdrop-filter: blur(20px) saturate(1.4);
    -webkit-backdrop-filter: blur(20px) saturate(1.4);
    z-index: 50;
    padding: 24px;
    padding-top: max(24px, env(safe-area-inset-top));
    padding-bottom: max(24px, env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    animation: panelSlideUp 0.4s var(--ease-out);
}

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

.overlay-panel h2 {
    font-family: var(--font-display);
    font-size: clamp(1.1rem, 4vw, 1.5rem);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent-cyan);
    padding-bottom: 10px;
    border-bottom: 1px solid var(--panel-border);
}

/* ══════════════════════════════════════════
   DIFFICULTY CARDS
   ══════════════════════════════════════════ */
.diff-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
    gap: 16px;
    margin-top: 16px;
}

.diff-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 28px 20px;
    background: var(--surface);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s var(--ease-out);
    color: var(--text-primary);
    font-family: var(--font-body);
}

.diff-card:hover {
    border-color: var(--accent-cyan);
    background: var(--surface-hover);
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 212, 255, 0.15);
}

.diff-label {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: var(--accent-cyan);
}

.diff-value {
    font-family: var(--font-mono);
    font-size: 1.3rem;
    color: var(--accent-green);
}

.diff-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-align: center;
}

.diff-card--hard {
    border-color: rgba(255, 68, 102, 0.3);
}
.diff-card--hard .diff-label { color: var(--accent-red); }
.diff-card--hard:hover {
    border-color: var(--accent-red);
    box-shadow: 0 8px 24px var(--glow-red);
}

/* ══════════════════════════════════════════
   HIRE PANEL
   ══════════════════════════════════════════ */
.hire-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--font-mono);
    font-size: 0.95rem;
    padding: 8px 0;
}

.hire-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
    gap: 12px;
    flex: 1;
    overflow-y: auto;
}

.hire-footer {
    padding-top: 12px;
    border-top: 1px solid var(--panel-border);
    display: flex;
    justify-content: flex-end;
}

.loading-pulse {
    color: var(--accent-cyan);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

/* ══════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════ */
.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--surface);
    border: 1px solid var(--panel-border);
    color: var(--text-primary);
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.25s var(--ease-out);
    position: relative;
    overflow: hidden;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}

.action-btn:active:not(:disabled) {
    transform: scale(0.97);
}

.action-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.primary-btn {
    border-color: rgba(0, 212, 255, 0.4);
    color: var(--accent-cyan);
}
.primary-btn:hover:not(:disabled) {
    background: rgba(0, 212, 255, 0.1);
    border-color: var(--accent-cyan);
    box-shadow: 0 0 16px var(--glow-cyan);
}

.danger-btn {
    border-color: rgba(255, 68, 102, 0.4);
    color: var(--accent-red);
}
.danger-btn:hover:not(:disabled) {
    background: rgba(255, 68, 102, 0.1);
    border-color: var(--accent-red);
    box-shadow: 0 0 16px var(--glow-red);
}

.save-btn {
    background: none;
    border: 1px solid var(--panel-border);
    color: var(--text-secondary);
    font-size: 1.2rem;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}
.save-btn:hover {
    border-color: var(--accent-amber);
    color: var(--accent-amber);
    box-shadow: 0 0 12px var(--glow-amber);
}

.btn-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ══════════════════════════════════════════
   GAME CONTAINER — Desktop 2-column, Mobile stacked
   ══════════════════════════════════════════ */
#game-container {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    z-index: 1;
    transition: opacity 0.5s var(--ease-out);
}

/* ── Status Bar ── */
#status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: rgba(4, 6, 14, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--panel-border);
    gap: 8px;
    z-index: 10;
    flex-shrink: 0;
}

.stat-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.stat-row-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.stat-chip {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: rgba(15, 22, 42, 0.8);
    border: 1px solid var(--panel-border);
    border-radius: 20px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    white-space: nowrap;
}

.stat-icon {
    font-size: 0.7rem;
    opacity: 0.6;
}

.stat-label {
    color: var(--text-secondary);
    font-weight: 400;
}

.stat-value {
    color: var(--accent-cyan);
    font-weight: 600;
}

.stat-hull .stat-value { color: var(--accent-green); }
.stat-fuel .stat-value { color: var(--accent-amber); }
.stat-food .stat-value { color: var(--accent-purple); }
.stat-scrap .stat-value { color: var(--accent-cyan); }
.stat-sector .stat-value { color: var(--text-primary); font-size: 0.85rem; }

.warning-text { color: var(--accent-amber) !important; }
.critical-text { color: var(--accent-red) !important; }

/* ── Main Content: Viewport + Sidebar ── */
#main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

#viewport {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow-y: auto;
    position: relative;
    background: rgba(4, 6, 14, 0.4);
}

#intel-panel {
    width: 280px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: rgba(4, 6, 14, 0.75);
    backdrop-filter: blur(8px);
    border-left: 1px solid var(--panel-border);
    overflow-y: auto;
}

/* ── Narrative ── */
#narrative-box {
    flex: 1;
    min-height: 120px;
    margin-bottom: 16px;
}

.flavor-text {
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--text-primary);
    animation: fadeIn 0.5s var(--ease-out);
}

.narrative-transition {
    opacity: 0.5;
    transition: opacity 0.4s;
}

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

/* ── Choices ── */
#choices-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.choice-btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid var(--panel-border);
    border-left: 3px solid var(--accent-cyan);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.2s var(--ease-out);
    -webkit-tap-highlight-color: transparent;
}

.choice-btn:hover:not(:disabled) {
    background: var(--surface-hover);
    border-left-color: var(--accent-amber);
    transform: translateX(4px);
    box-shadow: -4px 0 16px var(--glow-amber);
}

.choice-btn:active:not(:disabled) {
    transform: translateX(2px) scale(0.99);
}

.choice-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.choice-cost {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-family: var(--font-mono);
    flex-shrink: 0;
    margin-left: 12px;
}

/* ══════════════════════════════════════════
   SIDEBAR PANELS
   ══════════════════════════════════════════ */
.panel-section {
    padding: 14px 16px;
    border-bottom: 1px solid var(--panel-border);
    display: flex;
    flex-direction: column;
}

.panel-section:last-child {
    flex: 1;
    border-bottom: none;
}

.panel-section h3 {
    font-family: var(--font-display);
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

/* Crew List */
#crew-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.crew-member {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    background: var(--surface);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    border-left: 3px solid var(--accent-cyan);
    transition: border-color 0.2s;
}

.crew-member.dead {
    border-left-color: var(--accent-red);
    opacity: 0.4;
    text-decoration: line-through;
}

.crew-health-bar {
    width: 50px;
    height: 4px;
    background: rgba(255,255,255,0.08);
    border-radius: 2px;
    overflow: hidden;
}

.crew-health-fill {
    height: 100%;
    background: var(--accent-green);
    border-radius: 2px;
    transition: width 0.3s var(--ease-out);
}

/* Inventory */
#inventory-list {
    list-style: none;
    font-size: 0.8rem;
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Logs */
#log-window {
    flex: 1;
    background: rgba(0,0,0,0.3);
    padding: 8px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-dim);
    overflow-y: auto;
    border-radius: var(--radius-sm);
    max-height: 200px;
}

#log-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.log-entry.critical { color: var(--accent-red); }
.log-entry.warning { color: var(--accent-amber); }
.log-entry.positive { color: var(--accent-green); }

/* ══════════════════════════════════════════
   CREW GRID (Feeding, Away Team)
   ══════════════════════════════════════════ */
.crew-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 180px), 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

.crew-card {
    background: var(--surface);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-md);
    padding: 14px;
    cursor: pointer;
    transition: all 0.25s var(--ease-out);
}

.crew-card:hover {
    border-color: var(--accent-cyan);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 212, 255, 0.1);
}

.crew-card.selected {
    border-color: var(--accent-cyan);
    background: rgba(0, 212, 255, 0.08);
    box-shadow: 0 0 12px var(--glow-cyan);
}

/* ══════════════════════════════════════════
   SCAVENGING
   ══════════════════════════════════════════ */
.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255,255,255,0.05);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-bar .fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-cyan), var(--accent-green));
    border-radius: 4px;
    transition: width 0.5s var(--ease-out);
    box-shadow: 0 0 12px var(--glow-cyan);
}

.scavenge-log {
    flex: 1;
    background: rgba(0,0,0,0.3);
    padding: 12px;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-secondary);
    overflow-y: auto;
    max-height: 40vh;
}

/* ══════════════════════════════════════════
   SUMMARY BOX
   ══════════════════════════════════════════ */
.summary-box {
    background: var(--surface);
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--panel-border);
}

.summary-box h3 {
    font-family: var(--font-display);
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.summary-box ul {
    list-style: none;
    font-size: 0.9rem;
    line-height: 1.8;
}

.summary-divider {
    height: 1px;
    background: var(--panel-border);
    margin: 14px 0;
}

/* ══════════════════════════════════════════
   CHAT
   ══════════════════════════════════════════ */
.chat-bio {
    font-size: 0.85rem;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--panel-border);
}

.chat-history {
    flex: 1;
    background: rgba(0,0,0,0.25);
    padding: 12px;
    border-radius: var(--radius-sm);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 40vh;
    min-height: 150px;
}

.chat-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    line-height: 1.5;
    animation: fadeIn 0.3s var(--ease-out);
}

.chat-msg.player {
    background: rgba(0, 212, 255, 0.08);
    border: 1px solid rgba(0, 212, 255, 0.2);
    align-self: flex-end;
    border-radius: var(--radius-md) var(--radius-md) var(--radius-sm) var(--radius-md);
}

.chat-msg.npc {
    background: rgba(255, 179, 71, 0.08);
    border: 1px solid rgba(255, 179, 71, 0.2);
    align-self: flex-start;
    border-radius: var(--radius-md) var(--radius-md) var(--radius-md) var(--radius-sm);
}

.chat-input-row {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.chat-input-row input {
    flex: 1;
    background: var(--surface);
    border: 1px solid var(--panel-border);
    color: var(--text-primary);
    padding: 10px 14px;
    font-family: var(--font-body);
    font-size: 0.95rem;
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color 0.2s;
}

.chat-input-row input:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 8px var(--glow-cyan);
}

.system-msg {
    font-size: 0.75rem;
    color: var(--text-dim);
    font-family: var(--font-mono);
    margin-top: 4px;
}

/* ══════════════════════════════════════════
   ENDGAME
   ══════════════════════════════════════════ */
.endgame-title {
    text-align: center;
    font-size: clamp(1.8rem, 6vw, 3rem) !important;
    border: none !important;
    padding-bottom: 0 !important;
    margin-bottom: 8px;
}

.endgame-message {
    text-align: center;
    font-size: 1rem;
    margin-bottom: 16px;
    color: var(--text-secondary);
}

.score-box {
    background: var(--surface);
    padding: 20px;
    border-radius: var(--radius-md);
    border: 1px solid var(--panel-border);
    text-align: center;
}

.score-details {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    margin-top: 12px;
    line-height: 1.8;
    color: var(--text-secondary);
}

.score-total {
    font-family: var(--font-display);
    font-size: clamp(2rem, 8vw, 3.5rem);
    color: var(--accent-cyan);
    text-shadow: 0 0 20px var(--glow-cyan);
    margin-top: 12px;
}

/* ══════════════════════════════════════════
   TRADE
   ══════════════════════════════════════════ */
.trade-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

.trade-arena {
    display: flex;
    gap: 12px;
    flex: 1;
    min-height: 0;
}

.trade-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.trade-column h4 {
    font-family: var(--font-display);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.trade-divider {
    display: flex;
    align-items: center;
    color: var(--text-dim);
    font-size: 1.2rem;
    padding: 0 4px;
}

.trade-grid {
    flex: 1;
    overflow-y: auto;
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-sm);
    padding: 8px;
    background: rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 35vh;
}

.trade-item {
    padding: 10px 12px;
    background: var(--surface);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
    font-size: 0.85rem;
}

.trade-item:hover {
    border-color: var(--accent-cyan);
    background: var(--surface-hover);
}

/* ══════════════════════════════════════════
   COMBAT
   ══════════════════════════════════════════ */
.combat-arena {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 16px;
    gap: 12px;
}

.combatant {
    flex: 1;
    text-align: center;
}

.combatant h3 {
    font-family: var(--font-display);
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    margin-bottom: 8px;
}

.player-combatant h3 { color: var(--accent-cyan); }
.npc-combatant h3 { color: var(--accent-red); }

.combat-vs {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 900;
    color: var(--accent-red);
    text-shadow: 0 0 12px var(--glow-red);
    flex-shrink: 0;
}

.health-bar {
    width: 100%;
    height: 10px;
    background: rgba(255,255,255,0.06);
    border-radius: 5px;
    overflow: hidden;
}

.health-bar .fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, var(--accent-green), #44ff88);
    border-radius: 5px;
    transition: width 0.4s var(--ease-out);
}

.combat-log {
    background: rgba(0,0,0,0.3);
    padding: 10px;
    border-radius: var(--radius-sm);
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-secondary);
    max-height: 25vh;
}

.combat-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr));
    gap: 8px;
}

/* ══════════════════════════════════════════
   MOBILE RESPONSIVE (max-width: 768px)
   ══════════════════════════════════════════ */
@media (max-width: 768px) {

    /* Stack layout vertically */
    #main-content {
        flex-direction: column;
    }

    #viewport {
        padding: 16px;
        flex: 1;
        min-height: 0;
    }

    /* Sidebar becomes a collapsible bottom drawer */
    #intel-panel {
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--panel-border);
        max-height: 35vh;
        overflow-y: auto;
        flex-shrink: 0;
    }

    /* Smaller stat chips */
    .stat-chip {
        padding: 3px 7px;
        font-size: 0.68rem;
    }

    .stat-icon { display: none; }

    /* Overlay panels: full-screen takeover on mobile */
    .overlay-panel {
        padding: 16px;
        border-radius: 0;
    }

    /* Difficulty grid: single column on very small */
    .diff-grid {
        grid-template-columns: 1fr;
    }

    /* Trade side-by-side becomes stacked */
    .trade-arena {
        flex-direction: column;
    }

    .trade-divider {
        transform: rotate(90deg);
        padding: 4px 0;
    }

    .trade-grid {
        max-height: 25vh;
    }

    /* Combat: tighter spacing */
    .combat-arena {
        padding: 12px;
        gap: 8px;
    }

    .combat-vs {
        font-size: 1rem;
    }

    .combat-actions-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Menu adjustments */
    .menu-glow-ring {
        width: 280px;
        height: 280px;
    }

    .menu-btn {
        min-width: 240px;
    }

    /* Choices smaller tap targets still comfortable */
    .choice-btn {
        padding: 12px 14px;
        font-size: 0.9rem;
    }

    /* Logs tighter */
    #log-window {
        max-height: 120px;
    }
}

/* Ultra-small screens (under 400px) */
@media (max-width: 400px) {
    .stat-label { display: none; }
    .stat-chip { padding: 3px 6px; }
    
    #intel-panel {
        max-height: 30vh;
    }

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

/* Large screens: constrain width for readability */
@media (min-width: 1400px) {
    #viewport {
        padding: 32px 48px;
    }

    .flavor-text {
        font-size: 1.15rem;
        max-width: 800px;
    }

    #intel-panel {
        width: 320px;
    }
}

/* Scanlines are now removed for clean design */
.scanlines { display: none; }
