/* Sectorfall — Styles */

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

:root {
    --bg-dark: #0d0d0d;
    --bg-mid: #1a1a1a;
    --bg-light: #2a2a2a;
    --bg-panel: #1e1e1e;
    --text-primary: #d4d4d4;
    --text-dim: #888;
    --text-bright: #f0f0f0;
    --accent: #c4a035;
    --accent-dim: #8a7025;
    --danger: #a33;
    --success: #3a3;
    --warning: #a83;
    --border: #333;
    --tier1: #8a8a6a;
    --tier2: #4a8ab0;
    --tier3: #b04a8a;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: 'Courier New', monospace;
    font-size: 14px;
    overflow: hidden;
    height: 100vh;
}

/* ====== AUTH ====== */

.auth-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.game-title {
    color: var(--accent);
    font-size: 3rem;
    text-transform: uppercase;
    letter-spacing: 8px;
    margin-bottom: 5px;
}

.game-subtitle {
    color: var(--text-dim);
    font-size: 1rem;
    letter-spacing: 4px;
    margin-bottom: 40px;
}

.auth-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
}

.auth-tab {
    background: var(--bg-light);
    color: var(--text-dim);
    border: 1px solid var(--border);
    padding: 10px 30px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.auth-tab:first-child { border-radius: 4px 0 0 4px; }
.auth-tab:last-child { border-radius: 0 4px 4px 0; }

.auth-tab.active {
    background: var(--accent-dim);
    color: var(--text-bright);
    border-color: var(--accent);
}

#auth-form form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 300px;
}

#auth-form input {
    background: var(--bg-light);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 12px;
    font-family: inherit;
    font-size: 14px;
    border-radius: 4px;
}

#auth-form input:focus {
    outline: none;
    border-color: var(--accent);
}

#auth-form input::placeholder {
    color: var(--text-dim);
}

/* ====== BUTTONS ====== */

.btn-primary {
    background: var(--accent-dim);
    color: var(--text-bright);
    border: 1px solid var(--accent);
    padding: 12px;
    font-family: inherit;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 2px;
    cursor: pointer;
    border-radius: 4px;
    margin-top: 8px;
}

.btn-primary:hover {
    background: var(--accent);
    color: var(--bg-dark);
}

.btn-small {
    background: var(--bg-light);
    color: var(--text-dim);
    border: 1px solid var(--border);
    padding: 4px 10px;
    font-family: inherit;
    font-size: 11px;
    cursor: pointer;
    border-radius: 3px;
}

.btn-small:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}

.btn-action {
    background: var(--accent-dim);
    color: var(--text-bright);
    border: 1px solid var(--accent);
    padding: 6px 14px;
    font-family: inherit;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    border-radius: 3px;
}

.btn-action:hover {
    background: var(--accent);
    color: var(--bg-dark);
}

.btn-tiny {
    background: var(--bg-light);
    color: var(--text-dim);
    border: 1px solid var(--border);
    padding: 2px 8px;
    font-family: inherit;
    font-size: 10px;
    cursor: pointer;
    border-radius: 2px;
}

.btn-tiny:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}

.btn-tiny.danger:hover {
    border-color: var(--danger);
    color: var(--danger);
}

.error-msg {
    color: var(--danger);
    margin-top: 12px;
    font-size: 13px;
    min-height: 20px;
}

.empty-text {
    color: var(--text-dim);
    padding: 20px;
    text-align: center;
}

/* ====== GAME LAYOUT ====== */

.game-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.game-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: var(--bg-mid);
    border-bottom: 1px solid var(--border);
    min-height: 44px;
}

.header-left { display: flex; align-items: center; gap: 12px; }
.header-center { flex: 1; text-align: center; }
.header-right { display: flex; align-items: center; gap: 12px; }

.game-logo {
    color: var(--accent);
    font-size: 16px;
    font-weight: bold;
    letter-spacing: 3px;
}

.player-name { color: var(--text-primary); font-size: 13px; }
.player-level { color: var(--accent); font-size: 13px; }

.resource-bar {
    display: flex;
    gap: 16px;
    justify-content: center;
    font-size: 12px;
    color: var(--text-dim);
    flex-wrap: wrap;
}

.resource-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.res-label { color: var(--text-dim); }
.resource-item .amount { color: var(--text-primary); }

/* ====== NAVIGATION ====== */

.game-nav {
    display: flex;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border);
    padding: 0 16px;
}

.nav-btn {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-dim);
    padding: 10px 20px;
    font-family: inherit;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
}

.nav-btn:hover { color: var(--text-primary); }

.nav-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* ====== MAIN CONTENT ====== */

.game-main {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: var(--bg-dark);
}

.view-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-dim);
    font-size: 18px;
    letter-spacing: 2px;
}

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-dim);
}

/* ====== STATUS BAR ====== */

.status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 16px;
    background: var(--bg-mid);
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-dim);
}

/* ====== COMPOUND VIEW ====== */

.compound-view {
    max-width: 900px;
    margin: 0 auto;
}

.compound-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.compound-header h2 {
    color: var(--accent);
    font-size: 18px;
    letter-spacing: 2px;
}

.compound-stats {
    display: flex;
    gap: 16px;
    color: var(--text-dim);
    font-size: 12px;
}

.building {
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.building-floor {
    display: flex;
    border-bottom: 1px solid var(--border);
}

.building-floor:last-child {
    border-bottom: none;
}

.floor-label {
    width: 80px;
    padding: 8px;
    background: var(--bg-mid);
    color: var(--text-dim);
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    border-right: 1px solid var(--border);
}

.floor-rooms {
    flex: 1;
    display: flex;
}

.room {
    flex: 1;
    padding: 10px;
    border-right: 1px solid var(--border);
    min-height: 70px;
    position: relative;
}

.room:last-child { border-right: none; }

.room.rubble {
    background: #1a1515;
}

.room.cleared {
    background: #1a1a15;
}

.room.built {
    background: #151a15;
}

.room-name {
    font-size: 11px;
    color: var(--text-primary);
    text-transform: capitalize;
    margin-bottom: 2px;
}

.room-status {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.room.rubble .room-status { color: var(--danger); }
.room.cleared .room-status { color: var(--warning); }
.room.built .room-status { color: var(--success); }

.room-info {
    font-size: 9px;
    color: var(--text-dim);
}

.room-actions {
    margin-top: 4px;
}

/* Survivor panel */

.survivor-panel {
    margin-top: 20px;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 12px;
}

.survivor-panel h3 {
    color: var(--accent);
    font-size: 14px;
    margin-bottom: 8px;
}

.survivor-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.survivor-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 8px;
    background: var(--bg-light);
    border-radius: 2px;
    font-size: 12px;
}

.survivor-row.idle { border-left: 2px solid var(--text-dim); }
.survivor-row.assigned_zone { border-left: 2px solid var(--accent); }
.survivor-row.assigned_room { border-left: 2px solid var(--success); }

.survivor-id { color: var(--text-dim); width: 30px; }
.survivor-status { flex: 1; }

/* ====== CITY MAP VIEW ====== */

.city-view {
    display: flex;
    gap: 16px;
    height: 400px;
}

.city-map-container {
    flex: 2;
    position: relative;
    background: var(--bg-mid);
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.city-map {
    width: 100%;
    height: 100%;
    position: relative;
    background:
        linear-gradient(to bottom, rgba(13,13,10,0.4), rgba(13,13,10,0.4)),
        url('/assets/city-map.png') center/cover no-repeat;
}

.zone-marker {
    position: absolute;
    transform: translate(-50%, -50%);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.15s;
    border: 2px solid var(--border);
    background: var(--bg-light);
    font-size: 14px;
}

.zone-marker:hover {
    transform: translate(-50%, -50%) scale(1.3);
    z-index: 10;
}

.zone-marker.capturable { border-color: var(--accent-dim); }
.zone-marker.neutral { border-color: var(--text-dim); }
.zone-marker.solo_mission { border-color: var(--warning); }
.zone-marker.controlled { border-color: var(--danger); background: rgba(170,50,50,0.3); }
.zone-marker.cleared { border-color: var(--success); }

.zone-icon { line-height: 1; }

/* Zone detail panel */

.zone-detail-panel {
    flex: 1;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 12px;
    overflow-y: auto;
    min-width: 250px;
}

.zone-detail-empty {
    color: var(--text-dim);
    text-align: center;
    padding: 40px 0;
}

.zone-detail-content h3 {
    color: var(--accent);
    font-size: 16px;
    margin-bottom: 8px;
}

.zone-desc {
    color: var(--text-dim);
    font-size: 12px;
    margin-bottom: 12px;
    line-height: 1.4;
}

.zone-stats {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
}

.zone-stat {
    font-size: 12px;
    display: flex;
    justify-content: space-between;
}

.zone-stat span:first-child {
    color: var(--text-dim);
}

.zone-progress {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 11px;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: var(--bg-dark);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    transition: width 0.3s;
}

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

/* Zone list */

.zone-list {
    margin-top: 16px;
}

.zone-group-label {
    color: var(--accent);
    font-size: 13px;
    padding: 8px 0 4px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
}

.zone-list-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    cursor: pointer;
    font-size: 12px;
    border-radius: 2px;
}

.zone-list-item:hover { background: var(--bg-light); }

.zone-list-icon { font-size: 16px; width: 24px; text-align: center; }
.zone-list-name { flex: 1; }
.zone-list-danger { color: var(--danger); font-size: 11px; width: 80px; }
.zone-list-resource { color: var(--text-dim); font-size: 11px; width: 100px; }
.zone-list-garrison { color: var(--text-dim); font-size: 11px; }

/* ====== CHARACTER VIEW ====== */

.character-view {
    max-width: 800px;
    margin: 0 auto;
}

.char-header {
    margin-bottom: 20px;
}

.char-header h2 {
    color: var(--accent);
    font-size: 18px;
    letter-spacing: 2px;
    margin-bottom: 10px;
}

.char-level {
    display: flex;
    align-items: center;
    gap: 12px;
}

.level-badge {
    background: var(--accent-dim);
    color: var(--text-bright);
    padding: 4px 12px;
    border-radius: 3px;
    font-size: 14px;
    font-weight: bold;
}

.xp-bar {
    flex: 1;
    height: 12px;
    background: var(--bg-light);
    border-radius: 6px;
    overflow: hidden;
    max-width: 300px;
}

.xp-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-dim), var(--accent));
    transition: width 0.3s;
}

.xp-text {
    color: var(--text-dim);
    font-size: 11px;
    white-space: nowrap;
}

.char-sections {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.char-stats-panel,
.char-gear-panel,
.char-currencies {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 14px;
}

.char-stats-panel h3,
.char-gear-panel h3,
.char-currencies h3 {
    color: var(--accent);
    font-size: 13px;
    margin-bottom: 10px;
    letter-spacing: 1px;
}

.stat-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

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

.stat-name {
    width: 80px;
    font-size: 12px;
    color: var(--text-dim);
}

.stat-bar {
    flex: 1;
    height: 8px;
    background: var(--bg-dark);
    border-radius: 4px;
    overflow: hidden;
}

.stat-fill {
    height: 100%;
    background: var(--accent);
}

.stat-value {
    width: 30px;
    text-align: right;
    font-size: 13px;
    color: var(--text-bright);
}

.unallocated {
    margin-top: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px;
    background: rgba(196, 160, 53, 0.1);
    border: 1px solid var(--accent-dim);
    border-radius: 3px;
    font-size: 12px;
    color: var(--accent);
}

/* Gear slots */

.gear-slots {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.gear-slot {
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 3px;
    background: var(--bg-dark);
}

.gear-slot.filled { border-color: var(--accent-dim); }
.gear-slot.filled.tier-1 { border-color: var(--tier1); }
.gear-slot.filled.tier-2 { border-color: var(--tier2); }
.gear-slot.filled.tier-3 { border-color: var(--tier3); }

.gear-slot-label {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dim);
    margin-bottom: 2px;
}

.gear-item-name {
    font-size: 13px;
    color: var(--text-bright);
}

.gear-tier {
    font-size: 10px;
    color: var(--text-dim);
}

.gear-stats {
    font-size: 11px;
    color: var(--success);
    margin-top: 2px;
}

.gear-empty-text {
    color: var(--text-dim);
    font-size: 12px;
}

/* Currencies */

.currency-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.currency-item {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
}

.currency-val {
    color: var(--accent);
    font-weight: bold;
}

/* ====== INVENTORY VIEW ====== */

.inventory-view {
    max-width: 900px;
    margin: 0 auto;
}

.inventory-view h2 {
    color: var(--accent);
    font-size: 18px;
    letter-spacing: 2px;
    margin-bottom: 16px;
}

.item-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
}

.item-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 12px;
    position: relative;
}

.item-card.tier-1 { border-left: 3px solid var(--tier1); }
.item-card.tier-2 { border-left: 3px solid var(--tier2); }
.item-card.tier-3 { border-left: 3px solid var(--tier3); }

.item-card.equipped {
    background: rgba(196, 160, 53, 0.05);
    border-color: var(--accent-dim);
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.item-name {
    font-size: 13px;
    color: var(--text-bright);
}

.item-tier {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 1px 6px;
    border-radius: 2px;
}

.item-card.tier-1 .item-tier { color: var(--tier1); }
.item-card.tier-2 .item-tier { color: var(--tier2); }
.item-card.tier-3 .item-tier { color: var(--tier3); }

.item-slot {
    font-size: 10px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.item-stats {
    font-size: 11px;
    color: var(--success);
    margin: 4px 0;
}

.item-desc {
    font-size: 10px;
    color: var(--text-dim);
    line-height: 1.3;
    margin-bottom: 8px;
}

.item-actions {
    display: flex;
    gap: 6px;
}

.equipped-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--accent-dim);
    color: var(--text-bright);
    font-size: 8px;
    padding: 1px 5px;
    border-radius: 2px;
    letter-spacing: 1px;
}

/* ====== MODAL ====== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal {
    background: var(--bg-panel);
    border: 1px solid var(--accent-dim);
    border-radius: 6px;
    padding: 20px;
    min-width: 300px;
}

.modal h3 {
    color: var(--accent);
    font-size: 16px;
    margin-bottom: 16px;
}

.allocate-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.alloc-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.alloc-row label {
    width: 100px;
    font-size: 12px;
    color: var(--text-dim);
}

.alloc-row input {
    width: 60px;
    background: var(--bg-light);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 4px 8px;
    font-family: inherit;
    font-size: 13px;
    border-radius: 3px;
    text-align: center;
}

.alloc-remaining {
    color: var(--accent);
    font-size: 13px;
    padding: 8px 0;
    text-align: center;
}

/* ====== RESPONSIVE ====== */

@media (max-width: 768px) {
    .game-title { font-size: 2rem; letter-spacing: 4px; }
    .game-nav { overflow-x: auto; }
    .nav-btn { padding: 8px 12px; font-size: 11px; white-space: nowrap; }
    .resource-bar { font-size: 11px; gap: 8px; }
    .game-header { padding: 6px 10px; }
    #auth-form form { width: 280px; }

    .city-view { flex-direction: column; height: auto; }
    .city-map-container { height: 300px; }
    .zone-detail-panel { min-width: auto; }

    .char-sections { grid-template-columns: 1fr; }
    .item-grid { grid-template-columns: 1fr; }

    .compound-header { flex-direction: column; align-items: flex-start; gap: 8px; }
    .floor-label { width: 60px; font-size: 9px; }
}

/* ====== CRAFTING VIEW ====== */

.crafting-view { max-width: 900px; margin: 0 auto; }
.crafting-view h2 { color: var(--accent); font-size: 18px; letter-spacing: 2px; margin-bottom: 16px; }

.craft-queue { margin-bottom: 20px; }
.craft-queue h3 { color: var(--accent); font-size: 13px; margin-bottom: 8px; }

.craft-queue-item {
    display: flex; align-items: center; gap: 12px;
    padding: 8px 12px; background: var(--bg-panel); border: 1px solid var(--border);
    border-radius: 3px; margin-bottom: 4px; font-size: 12px;
}
.craft-queue-item.done { border-color: var(--success); }
.craft-name { flex: 1; }
.craft-timer { color: var(--text-dim); }
.craft-queue-item.done .craft-timer { color: var(--success); }

.craft-recipes h3 { color: var(--accent); font-size: 13px; margin-bottom: 8px; }
.craft-cost { font-size: 10px; color: var(--warning); margin: 4px 0; }
.craft-time { font-size: 10px; color: var(--text-dim); margin-bottom: 6px; }

/* ====== ALLIANCE VIEW ====== */

.alliance-view { max-width: 800px; margin: 0 auto; }
.alliance-view h2 { color: var(--accent); font-size: 18px; letter-spacing: 2px; }

.alliance-header { margin-bottom: 16px; }
.alliance-stats {
    display: flex; gap: 16px; flex-wrap: wrap;
    font-size: 12px; color: var(--text-dim); margin-top: 8px;
}

.alliance-create {
    display: flex; gap: 10px; margin-top: 20px; align-items: center;
}
.alliance-create input {
    background: var(--bg-light); border: 1px solid var(--border); color: var(--text-primary);
    padding: 8px 12px; font-family: inherit; font-size: 13px; border-radius: 3px; flex: 1;
}

.alliance-sections {
    display: flex; flex-direction: column; gap: 16px;
}

.alliance-members, .alliance-zones, .alliance-actions {
    background: var(--bg-panel); border: 1px solid var(--border);
    border-radius: 4px; padding: 14px;
}

.alliance-members h3, .alliance-zones h3, .alliance-actions h3 {
    color: var(--accent); font-size: 13px; margin-bottom: 10px;
}

.member-row {
    display: flex; align-items: center; gap: 10px;
    padding: 4px 0; font-size: 12px; border-bottom: 1px solid var(--border);
}
.member-row:last-child { border-bottom: none; }
.member-role {
    width: 70px; font-size: 9px; text-transform: uppercase; letter-spacing: 1px;
    padding: 2px 6px; border-radius: 2px; text-align: center;
}
.role-leader { background: var(--accent-dim); color: var(--text-bright); }
.role-co_leader { background: #4a4a8a; color: var(--text-bright); }
.role-officer { background: #4a6a4a; color: var(--text-bright); }
.role-member { background: var(--bg-light); color: var(--text-dim); }
.member-name { flex: 1; }
.member-level { color: var(--text-dim); }
.member-row select {
    background: var(--bg-light); border: 1px solid var(--border); color: var(--text-primary);
    font-family: inherit; font-size: 10px; padding: 2px; border-radius: 2px;
}

.zone-tag {
    display: inline-block; padding: 3px 10px;
    background: var(--accent-dim); color: var(--text-bright);
    border-radius: 3px; font-size: 11px; margin: 2px;
}

.action-row {
    display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
}
.action-row input {
    background: var(--bg-light); border: 1px solid var(--border); color: var(--text-primary);
    padding: 6px 10px; font-family: inherit; font-size: 12px; border-radius: 3px; flex: 1;
}
.action-row label { font-size: 12px; color: var(--text-dim); }

/* ============================================================
   MISSIONS VIEW
   ============================================================ */
.missions-view { padding: 1rem; }
.missions-view h2 { color: var(--accent); margin-bottom: 1rem; }
.missions-view h3 { color: var(--text); margin: 1rem 0 0.5rem; border-bottom: 1px solid var(--border); padding-bottom: 0.25rem; }

.missions-active { margin-bottom: 1.5rem; }

.mission-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
}
.mission-card.done { border-color: var(--accent); box-shadow: 0 0 8px rgba(76, 175, 80, 0.3); }
.mission-card.in-progress { border-color: #ff9800; }

.mission-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.mission-zone { font-weight: bold; color: var(--text); font-size: 1rem; }
.mission-danger { color: #ff5252; font-size: 0.8rem; font-family: monospace; }

.mission-info { display: flex; gap: 1rem; font-size: 0.8rem; color: var(--muted); margin-bottom: 0.5rem; }
.mission-timer { text-align: center; margin: 0.5rem 0; }
.mission-countdown { font-size: 1.5rem; font-family: monospace; color: #ff9800; font-weight: bold; }
.mission-ready { font-size: 1.2rem; color: var(--accent); font-weight: bold; animation: pulse 1.5s infinite; }

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

.missions-history { margin-bottom: 1.5rem; }
.mission-history-item {
    display: flex; gap: 1rem; align-items: center;
    padding: 0.4rem 0.6rem; background: var(--surface); border-radius: 4px; margin-bottom: 0.25rem;
    font-size: 0.85rem;
}
.mission-history-item.completed { border-left: 3px solid var(--accent); }
.mission-history-item.failed { border-left: 3px solid #ff5252; }
.mission-status-badge { font-weight: bold; font-size: 0.75rem; padding: 0.1rem 0.4rem; border-radius: 3px; }
.completed .mission-status-badge { background: rgba(76,175,80,0.2); color: var(--accent); }
.failed .mission-status-badge { background: rgba(255,82,82,0.2); color: #ff5252; }

.zone-help { color: var(--muted); font-size: 0.85rem; margin-bottom: 0.75rem; }
.zone-help strong { color: var(--text); }
.warning-text { color: #ff9800; font-size: 0.85rem; margin-bottom: 0.5rem; }

.mission-zone-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 0.75rem;
}

.mission-zone-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.75rem;
}

.mz-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.mz-name { font-weight: bold; color: var(--text); }
.mz-danger { font-family: monospace; color: #ff5252; font-size: 0.8rem; }

.mz-info { display: flex; flex-wrap: wrap; gap: 0.5rem; font-size: 0.8rem; color: var(--muted); margin-bottom: 0.5rem; }
.mz-progress { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; font-size: 0.8rem; }
.mz-progress .progress-bar { flex: 1; }

.mission-zone-card .btn-action { width: 100%; }


/* ============================================================
   CHAT VIEW
   ============================================================ */
.chat-view { display: flex; flex-direction: column; height: calc(100vh - 200px); min-height: 400px; padding: 0.5rem; }

.chat-tabs { display: flex; gap: 0; margin-bottom: 0; }
.chat-tab {
    padding: 0.5rem 1.5rem; background: var(--surface); border: 1px solid var(--border);
    border-bottom: none; color: var(--muted); cursor: pointer; font-size: 0.85rem;
    border-radius: 6px 6px 0 0;
}
.chat-tab.active { background: var(--bg); color: var(--accent); border-color: var(--accent); }

.chat-messages {
    flex: 1; overflow-y: auto; background: var(--surface); border: 1px solid var(--border);
    padding: 0.75rem; font-size: 0.85rem; line-height: 1.5;
}

.chat-msg { padding: 0.15rem 0; }
.chat-msg.mine .chat-user { color: var(--accent); }
.chat-time { color: var(--muted); font-size: 0.7rem; margin-right: 0.5rem; font-family: monospace; }
.chat-user { color: #4fc3f7; font-weight: bold; }
.chat-text { color: var(--text); word-break: break-word; }

.chat-input-row { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.chat-input-row input {
    flex: 1; padding: 0.5rem; background: var(--surface); border: 1px solid var(--border);
    color: var(--text); border-radius: 4px; font-size: 0.9rem;
}
.chat-input-row input:focus { border-color: var(--accent); outline: none; }
.chat-input-row .btn-action { white-space: nowrap; }


/* ============================================================
   ARENA VIEW
   ============================================================ */
.arena-view { padding: 1rem; }
.arena-view h2 { color: var(--accent); margin-bottom: 1rem; }

.arena-stats {
    display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem;
}
.arena-stat {
    background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
    padding: 0.75rem 1.25rem; text-align: center; min-width: 120px;
}
.stat-label { display: block; color: var(--muted); font-size: 0.75rem; text-transform: uppercase; }
.stat-val { display: block; font-size: 1.5rem; font-weight: bold; color: var(--text); margin-top: 0.25rem; }

.arena-fight { text-align: center; margin: 1.5rem 0; }
.btn-large { padding: 0.75rem 2rem; font-size: 1.1rem; }

.arena-section { margin-bottom: 1.5rem; }
.arena-section h3 { color: var(--text); border-bottom: 1px solid var(--border); padding-bottom: 0.25rem; margin-bottom: 0.5rem; }

.arena-match {
    display: flex; gap: 1rem; align-items: center; padding: 0.4rem 0.6rem;
    background: var(--surface); border-radius: 4px; margin-bottom: 0.25rem; font-size: 0.85rem;
}
.arena-match.win { border-left: 3px solid var(--accent); }
.arena-match.loss { border-left: 3px solid #ff5252; }
.match-result { font-weight: bold; width: 40px; }
.win .match-result { color: var(--accent); }
.loss .match-result { color: #ff5252; }
.match-opponent { flex: 1; }
.match-power { color: var(--muted); font-family: monospace; }
.match-elo { font-weight: bold; width: 80px; text-align: right; }

.leaderboard { font-size: 0.85rem; }
.lb-row {
    display: flex; gap: 1rem; align-items: center; padding: 0.35rem 0.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.lb-row.me { background: rgba(76,175,80,0.1); border-left: 3px solid var(--accent); }
.lb-rank { width: 40px; font-weight: bold; color: var(--muted); }
.lb-name { flex: 1; }
.lb-elo { font-family: monospace; color: var(--accent); }
.lb-level { color: var(--muted); }

/* ============================================================
   TERRITORY VIEW
   ============================================================ */
.territory-view { padding: 1rem; }
.territory-view h2 { color: var(--accent); margin-bottom: 1rem; }
.territory-section { margin-bottom: 1.5rem; }
.territory-section h3 { color: var(--text); border-bottom: 1px solid var(--border); padding-bottom: 0.25rem; margin-bottom: 0.75rem; }

.territory-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0.75rem;
}

.territory-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 0.75rem;
}
.territory-card.secure { border-color: var(--accent); }
.territory-card.at_risk { border-color: #ff9800; }

.tc-header { display: flex; justify-content: space-between; margin-bottom: 0.5rem; }
.tc-name { font-weight: bold; }
.tc-status { font-size: 0.75rem; padding: 0.1rem 0.4rem; border-radius: 3px; }
.tc-status.secure { background: rgba(76,175,80,0.2); color: var(--accent); }
.tc-status.at_risk { background: rgba(255,152,0,0.2); color: #ff9800; }

.tc-info { display: flex; flex-wrap: wrap; gap: 0.5rem; font-size: 0.8rem; color: var(--muted); margin-bottom: 0.5rem; }
.tc-actions { display: flex; gap: 0.5rem; }

.siege-card {
    background: var(--surface); border: 2px solid #ff5252; border-radius: 6px; padding: 0.75rem; margin-bottom: 0.75rem;
}
.siege-card.defender { border-color: #4fc3f7; }
.siege-header { display: flex; justify-content: space-between; margin-bottom: 0.5rem; }
.siege-zone { font-weight: bold; font-size: 1.1rem; }
.siege-side { font-size: 0.8rem; font-weight: bold; padding: 0.1rem 0.5rem; border-radius: 3px; }
.attacker .siege-side { background: rgba(255,82,82,0.2); color: #ff5252; }
.defender .siege-side { background: rgba(79,195,247,0.2); color: #4fc3f7; }
.siege-versus { font-size: 0.9rem; color: var(--muted); margin-bottom: 0.5rem; text-align: center; }
.siege-power { display: flex; justify-content: space-around; font-size: 0.85rem; margin-bottom: 0.5rem; }
.siege-timer { text-align: center; margin: 0.5rem 0; }
.siege-my { font-size: 0.8rem; color: var(--muted); text-align: center; margin-bottom: 0.5rem; }
.siege-actions { display: flex; gap: 0.5rem; justify-content: center; }

.territory-zone-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 0.6rem;
}
.territory-zone-card.controlled { border-color: #ff5252; }
.tz-header { display: flex; justify-content: space-between; margin-bottom: 0.3rem; }
.tz-name { font-weight: bold; font-size: 0.9rem; }
.tz-danger { color: #ff5252; font-family: monospace; }
.tz-info { display: flex; gap: 0.5rem; font-size: 0.75rem; color: var(--muted); margin-bottom: 0.3rem; }
.tz-actions { display: flex; gap: 0.5rem; }


/* ============================================================
   SHOP VIEW
   ============================================================ */
.shop-view { padding: 1rem; }
.shop-view h2 { color: var(--accent); margin-bottom: 1rem; }
.shop-section { margin-bottom: 1.5rem; }
.shop-section h3 { color: var(--text); border-bottom: 1px solid var(--border); padding-bottom: 0.25rem; margin-bottom: 0.75rem; }

.shop-currencies { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.currency-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
    padding: 0.75rem 1.5rem; text-align: center;
}
.curr-label { display: block; color: var(--muted); font-size: 0.75rem; text-transform: uppercase; }
.curr-val { display: block; font-size: 1.5rem; font-weight: bold; color: var(--accent); margin-top: 0.25rem; }

.gacha-pools { display: flex; gap: 1rem; flex-wrap: wrap; }
.gacha-card {
    background: var(--surface); border: 2px solid var(--accent); border-radius: 8px;
    padding: 1rem; text-align: center; min-width: 200px;
}
.gacha-name { font-weight: bold; margin-bottom: 0.75rem; }

.pvp-shop { display: flex; flex-direction: column; gap: 0.5rem; }
.pvp-item {
    display: flex; justify-content: space-between; align-items: center;
    background: var(--surface); padding: 0.5rem 0.75rem; border-radius: 4px;
}
.pvp-item-name { font-size: 0.9rem; }

/* ============================================================
   RESEARCH VIEW
   ============================================================ */
.research-view { padding: 1rem; }
.research-view h2 { color: var(--accent); margin-bottom: 0.5rem; }
.research-info { color: var(--muted); font-size: 0.85rem; margin-bottom: 1rem; }

.research-branch { margin-bottom: 1.5rem; }
.research-branch h3 { color: var(--text); border-bottom: 1px solid var(--border); padding-bottom: 0.25rem; margin-bottom: 0.75rem; }

.tech-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.75rem;
}

.tech-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 0.75rem;
}
.tech-card.completed { border-color: var(--accent); opacity: 0.8; }
.tech-card.researching { border-color: #ff9800; box-shadow: 0 0 8px rgba(255,152,0,0.3); }
.tech-card.available { border-color: #4fc3f7; }
.tech-card.locked { opacity: 0.5; }

.tech-header { display: flex; justify-content: space-between; margin-bottom: 0.5rem; }
.tech-name { font-weight: bold; font-size: 0.9rem; }
.tech-tier { color: var(--muted); font-family: monospace; }

.tech-desc { font-size: 0.8rem; color: var(--muted); margin-bottom: 0.5rem; }
.tech-time { font-size: 0.75rem; color: var(--muted); margin-bottom: 0.5rem; }
.tech-timer { font-size: 1.2rem; font-family: monospace; color: #ff9800; font-weight: bold; text-align: center; margin: 0.5rem 0; }
.tech-status-badge { font-size: 0.75rem; padding: 0.15rem 0.5rem; border-radius: 3px; text-align: center; }
.tech-status-badge.completed { background: rgba(76,175,80,0.2); color: var(--accent); }
.tech-locked { font-size: 0.75rem; color: var(--muted); text-align: center; font-style: italic; }

.tech-card .btn-action { width: 100%; margin-top: 0.25rem; }

/* ============================================================
   SCOUTING INTEL
   ============================================================ */
.zone-intel {
    background: rgba(79,195,247,0.08); border: 1px solid rgba(79,195,247,0.3);
    border-radius: 6px; padding: 0.75rem; margin: 0.75rem 0;
}
.zone-intel h4 { color: #4fc3f7; margin-bottom: 0.5rem; font-size: 0.9rem; }
.zone-intel h5 { color: var(--accent); margin: 0.5rem 0 0.25rem; font-size: 0.8rem; }
.advanced-intel {
    background: rgba(76,175,80,0.08); border: 1px solid rgba(76,175,80,0.3);
    border-radius: 4px; padding: 0.5rem; margin-top: 0.5rem;
}
.zone-intel .btn-tiny { margin-top: 0.5rem; }

/* ============================================================
   UI POLISH — Responsive, Transitions, Toasts
   ============================================================ */

/* Responsive nav — horizontal scroll on mobile */
.game-nav {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.game-nav::-webkit-scrollbar { height: 3px; }
.game-nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.nav-btn { white-space: nowrap; flex-shrink: 0; }

/* Responsive header */
@media (max-width: 768px) {
    .game-header { flex-wrap: wrap; padding: 6px 10px; gap: 4px; }
    .resource-bar { gap: 8px; font-size: 11px; }
    .resource-item { gap: 2px; }
    .nav-btn { padding: 8px 12px; font-size: 11px; }
    .game-main { padding: 10px; }
    .game-logo { font-size: 14px; letter-spacing: 2px; }

    /* Stack header vertically */
    .header-left, .header-right { font-size: 12px; }

    /* Full-width cards */
    .tech-grid { grid-template-columns: 1fr; }
    .gacha-pools { flex-direction: column; }
    .shop-currencies { flex-direction: column; }

    /* Zone detail side-by-side becomes stacked */
    .city-view { flex-direction: column; }
    .zone-detail-panel { min-height: 200px; }
}

@media (max-width: 480px) {
    .game-title { font-size: 1.8rem; letter-spacing: 4px; }
    .game-subtitle { font-size: 0.8rem; }
    #auth-form form { width: 100%; max-width: 300px; }
    .compound-stats { flex-wrap: wrap; }
}

/* Smooth transitions */
.btn-action, .btn-primary, .btn-small, .btn-tiny {
    transition: all 0.15s ease;
}
.nav-btn {
    transition: color 0.15s ease, border-color 0.15s ease;
}
.tech-card, .gacha-card, .zone-marker {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.tech-card:hover, .gacha-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* Disabled buttons */
.btn-action:disabled, .btn-primary:disabled, .btn-tiny:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* Progress bar animation */
.progress-fill {
    transition: width 0.5s ease;
}

/* Pulsing animation for active research/missions */
@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 5px rgba(255,152,0,0.2); }
    50% { box-shadow: 0 0 15px rgba(255,152,0,0.4); }
}
.tech-card.researching { animation: pulse-glow 2s infinite; }

@keyframes pulse-mission {
    0%, 100% { box-shadow: 0 0 5px rgba(79,195,247,0.2); }
    50% { box-shadow: 0 0 15px rgba(79,195,247,0.4); }
}
.mission-card.active { animation: pulse-mission 2s infinite; }

/* Toast notifications */
.toast-container {
    position: fixed;
    top: 60px;
    right: 16px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}
.toast {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    color: var(--text-primary);
    padding: 10px 16px;
    border-radius: 4px;
    font-family: inherit;
    font-size: 13px;
    max-width: 350px;
    pointer-events: auto;
    animation: toast-in 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.info { border-left-color: #4fc3f7; }
.toast-fade-out { animation: toast-out 0.3s ease forwards; }

@keyframes toast-in {
    from { opacity: 0; transform: translateX(100px); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes toast-out {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(100px); }
}

/* Online status indicator */
.ws-status {
    width: 8px; height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 4px;
}
.ws-status.connected { background: var(--success); }
.ws-status.disconnected { background: var(--danger); }

/* Loading spinner */
.spinner {
    display: inline-block;
    width: 16px; height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Scrollbar styling */
.game-main::-webkit-scrollbar { width: 6px; }
.game-main::-webkit-scrollbar-track { background: var(--bg-dark); }
.game-main::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.game-main::-webkit-scrollbar-thumb:hover { background: var(--accent-dim); }
