/* ============================================
   DOMINION - Turn-Based Strategy Game
   ============================================ */

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

:root {
    --bg-dark: #0f0f1a;
    --bg-panel: #1a1a2e;
    --bg-panel-hover: #22223a;
    --bg-header: #16213e;
    --border-color: #2a2a4a;
    --text-primary: #e0e0e0;
    --text-secondary: #8888aa;
    --text-muted: #555577;
    --accent: #4a9eff;
    --accent-hover: #6ab4ff;
    --green: #4caf50;
    --red: #e74c3c;
    --orange: #f39c12;
    --gold: #ffd700;
    --purple: #9b59b6;

    /* Resources */
    --food-color: #8bc34a;
    --wood-color: #795548;
    --stone-color: #9e9e9e;
    --iron-color: #607d8b;
    --gold-color: #ffc107;
    --rare-color: #e040fb;

    /* Player colors */
    --p1: #e74c3c;
    --p2: #3498db;
    --p3: #2ecc71;
    --p4: #f39c12;
    --p5: #9b59b6;
    --p6: #1abc9c;
    --p7: #e67e22;
    --p8: #e91e63;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow: hidden;
}

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

/* ========== HEADER ========== */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    z-index: 100;
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

header h1 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--gold);
}

.main-nav {
    display: flex;
    gap: 8px;
}

.nav-btn {
    padding: 6px 14px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-panel);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.85rem;
    text-decoration: none;
    transition: all 0.2s;
}

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

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

.back-btn {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.cache-btn {
    font-size: 0.75rem;
    opacity: 0.6;
}

/* ========== VIEWS ========== */
.view {
    display: none;
    flex: 1;
    overflow: hidden;
}

.view.active {
    display: flex;
    flex-direction: column;
}

/* ========== LOBBY VIEW ========== */
.lobby-container {
    display: flex;
    gap: 24px;
    padding: 24px;
    flex: 1;
    overflow-y: auto;
    max-width: 1000px;
    margin: 0 auto;
    width: 100%;
}

.lobby-panel {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    flex: 1;
}

.lobby-panel h2 {
    color: var(--gold);
    margin-bottom: 20px;
    font-size: 1.2rem;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-dark);
    color: var(--text-primary);
    font-size: 0.95rem;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent);
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--accent);
    color: white;
    width: 100%;
}

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

.btn-tech {
    background: var(--purple);
    color: white;
    width: 100%;
    margin-bottom: 8px;
}

.btn-tech:hover {
    opacity: 0.9;
}

.btn-end-turn {
    background: var(--green);
    color: white;
    width: 100%;
    font-size: 1rem;
    padding: 12px;
}

.btn-end-turn:hover {
    opacity: 0.9;
}

.btn-end-turn:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-danger {
    background: var(--red);
    color: white;
}

.btn-join {
    background: var(--green);
    color: white;
}

.btn-rejoin {
    background: var(--orange);
    color: white;
}

/* Games List */
.games-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.game-card {
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.game-card-info h4 {
    color: var(--text-primary);
    margin-bottom: 4px;
}

.game-card-info span {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

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

.empty-message {
    color: var(--text-muted);
    text-align: center;
    padding: 20px;
    font-style: italic;
}

/* ========== RESOURCE BAR ========== */
.resource-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    flex-wrap: wrap;
}

.resource {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--bg-panel);
    border-radius: 6px;
    font-size: 0.85rem;
    min-width: 80px;
}

.resource-icon {
    font-size: 1rem;
}

.resource-amount {
    font-weight: 700;
    color: var(--text-primary);
}

.resource-income {
    font-size: 0.7rem;
    color: var(--green);
}

.turn-info {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
}

#turn-number {
    color: var(--text-secondary);
}

.current-player {
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
    background: var(--bg-panel);
}

/* ========== GAME LAYOUT ========== */
.game-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.map-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    cursor: grab;
}

.map-container:active {
    cursor: grabbing;
}

#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* Minimap */
.minimap {
    position: absolute;
    bottom: 12px;
    left: 12px;
    width: 180px;
    height: 180px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: rgba(15, 15, 26, 0.9);
    cursor: pointer;
    z-index: 10;
}

/* ========== SIDEBAR ========== */
.sidebar {
    width: 280px;
    background: var(--bg-panel);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    flex-shrink: 0;
}

.panel {
    padding: 14px;
    border-bottom: 1px solid var(--border-color);
}

.panel h3 {
    color: var(--gold);
    font-size: 0.95rem;
    margin-bottom: 10px;
}

.hint {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-style: italic;
}

/* Hex Info */
.hex-info-content {
    font-size: 0.85rem;
}

.hex-terrain {
    font-weight: 600;
    text-transform: capitalize;
    margin-bottom: 6px;
}

.hex-resources {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.hex-resource-tag {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
}

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

.hex-building-item {
    padding: 4px 8px;
    background: var(--bg-dark);
    border-radius: 4px;
    font-size: 0.8rem;
}

/* Build Options */
.build-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.build-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.build-option:hover {
    border-color: var(--accent);
    background: var(--bg-panel-hover);
}

.build-option.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.build-option-name {
    font-size: 0.85rem;
    font-weight: 600;
}

.build-option-cost {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.build-option-cost.unaffordable {
    color: var(--red);
}

.build-option.expanded {
    border-color: var(--accent);
    background: var(--bg-panel-hover);
}

.build-option-effect {
    font-size: 0.75rem;
    color: var(--green);
    margin: 4px 0 2px;
    line-height: 1.3;
}

.build-option-production {
    font-size: 0.75rem;
    color: var(--gold);
    margin-bottom: 2px;
}

.btn-build-confirm {
    margin-top: 6px;
    width: 100%;
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    padding: 6px 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background 0.2s;
}

.btn-build-confirm:hover {
    background: var(--accent-hover);
}

/* ========== GAME LOG ========== */
.game-log {
    background: var(--bg-header);
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
    max-height: 200px;
}

.log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 14px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.log-header:hover {
    color: var(--text-primary);
}

.log-toggle {
    transition: transform 0.2s;
}

.game-log.collapsed .log-toggle {
    transform: rotate(-90deg);
}

.game-log.collapsed .log-entries {
    display: none;
}

.log-entries {
    max-height: 150px;
    overflow-y: auto;
    padding: 0 14px 8px;
}

.log-entry {
    padding: 3px 0;
    font-size: 0.8rem;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(42, 42, 74, 0.3);
}

.log-entry .log-turn {
    color: var(--text-muted);
    font-size: 0.7rem;
}

/* ========== TECH TREE MODAL ========== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px;
}

.modal-small {
    max-width: 400px;
    width: 90%;
}

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

.modal-header h2 {
    color: var(--gold);
    font-size: 1.2rem;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px 8px;
}

.modal-close:hover {
    color: var(--text-primary);
}

/* ========== HELP MODAL ========== */
.help-content {
    width: 90vw;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    padding: 0;
}

.help-content .modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.help-body {
    flex: 1;
    overflow-y: auto;
    padding: 0 24px 24px;
}

.help-section {
    padding: 20px 0;
    border-bottom: 1px solid rgba(42, 42, 74, 0.4);
}

.help-section:last-child {
    border-bottom: none;
}

.help-section h3 {
    color: var(--gold);
    font-size: 1.05rem;
    margin-bottom: 12px;
}

.help-section p {
    font-size: 0.88rem;
    line-height: 1.6;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.help-section ol,
.help-section ul {
    font-size: 0.88rem;
    line-height: 1.7;
    padding-left: 24px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.help-section li {
    margin-bottom: 4px;
}

.help-note {
    font-size: 0.78rem !important;
    color: var(--text-secondary) !important;
    font-style: italic;
    margin-top: 8px;
    padding-left: 12px;
    border-left: 2px solid var(--border-color);
}

/* Help cards */
.help-cards {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.help-card {
    flex: 1;
    min-width: 180px;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
}

.help-card-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--accent);
    margin-bottom: 6px;
}

.help-card p {
    font-size: 0.82rem !important;
    color: var(--text-secondary) !important;
    margin: 0;
}

/* Help tables */
.help-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    margin: 8px 0;
}

.help-table th {
    text-align: left;
    padding: 6px 10px;
    background: var(--bg-dark);
    color: var(--gold);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border-color);
}

.help-table td {
    padding: 5px 10px;
    border-bottom: 1px solid rgba(42, 42, 74, 0.3);
    color: var(--text-primary);
    vertical-align: top;
}

.help-table tr:hover td {
    background: rgba(74, 158, 255, 0.04);
}

.help-table-buildings td {
    font-size: 0.78rem;
}

/* Help 2-column grid */
.help-grid-2col {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 4px 16px;
    font-size: 0.85rem;
    padding: 8px 0;
}

.help-grid-2col div {
    padding: 3px 0;
}

/* Help button style */
.help-btn {
    font-size: 0.8rem;
}

/* Score Display */
.score-display {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--bg-panel);
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--gold);
    font-weight: 700;
}

/* Population Display */
.pop-display {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--bg-panel);
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--text-primary);
    font-weight: 700;
}

.pop-display.over-cap {
    color: var(--red);
}

/* Build Section Labels */
.build-section-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
    margin-bottom: 2px;
}

/* Tech Tree Modal - Updated */
.tech-tree-content {
    width: 95vw;
    max-width: none;
    height: 85vh;
    display: flex;
    flex-direction: column;
    padding: 16px;
}

.tech-tree-viewport {
    flex: 1;
    min-height: 0;
    margin-bottom: 12px;
}

.tech-detail {
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    max-height: 200px;
    overflow-y: auto;
    flex-shrink: 0;
}

.tech-detail h4 {
    color: var(--accent);
    margin-bottom: 8px;
}

.tech-detail-header {
    margin-bottom: 4px;
}

.tech-detail-cost,
.tech-detail-unlocks,
.tech-detail-prereqs {
    font-size: 0.85rem;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.btn-research {
    background: var(--accent);
    color: white;
    margin-top: 10px;
}

/* ========== VISUAL TECH TREE (VTT) ========== */
.vtt-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--bg-dark);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.vtt-viewport {
    width: 100%;
    height: 100%;
    overflow: hidden;
    cursor: grab;
    position: relative;
}

.vtt-viewport:active {
    cursor: grabbing;
}

.vtt-canvas-layer {
    position: absolute;
    top: 0;
    left: 0;
    will-change: transform;
}

/* SVG Connections */
.vtt-connections {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 0;
}

.vtt-connection {
    fill: none;
    stroke-width: 2.5;
    stroke-linecap: round;
}

.vtt-conn-complete {
    stroke: var(--green);
    stroke-opacity: 0.8;
}

.vtt-conn-available {
    stroke: var(--accent);
    stroke-opacity: 0.6;
    stroke-dasharray: 6 3;
}

.vtt-conn-locked {
    stroke: var(--border-color);
    stroke-opacity: 0.35;
    stroke-dasharray: 4 4;
}

/* Age Headers */
.vtt-age-header {
    position: absolute;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 8px 0;
    border-bottom: 2px solid rgba(255, 215, 0, 0.3);
    text-align: center;
    z-index: 1;
}

/* Tech Nodes */
.vtt-node {
    position: absolute;
    background: var(--bg-panel);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    display: flex;
    overflow: hidden;
    z-index: 2;
    user-select: none;
}

.vtt-node:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 12px rgba(74, 158, 255, 0.2);
}

.vtt-node.selected {
    border-color: var(--gold);
    box-shadow: 0 0 16px rgba(255, 215, 0, 0.3);
}

/* Status-specific styles */
.vtt-status-researched {
    border-color: var(--green);
    background: rgba(76, 175, 80, 0.12);
}

.vtt-status-partial {
    border-color: var(--orange);
    background: rgba(243, 156, 18, 0.08);
    border-style: solid;
}

.vtt-status-researching {
    border-color: var(--orange);
    background: rgba(243, 156, 18, 0.12);
    animation: vtt-pulse 2s ease-in-out infinite;
}

.vtt-status-available {
    border-color: var(--accent);
    background: rgba(74, 158, 255, 0.08);
}

.vtt-status-locked {
    opacity: 0.45;
}

@keyframes vtt-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(243, 156, 18, 0.3); }
    50% { box-shadow: 0 0 14px 4px rgba(243, 156, 18, 0.15); }
}

/* Category Stripe */
.vtt-category-stripe {
    width: 6px;
    flex-shrink: 0;
    border-radius: 6px 0 0 6px;
}

/* Node Content */
.vtt-node-content {
    flex: 1;
    padding: 6px 10px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 0;
}

.vtt-node-top {
    display: flex;
    align-items: center;
    gap: 6px;
}

.vtt-node-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.vtt-node-name {
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vtt-node-mid {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 3px 0;
}

/* Level Dots */
.vtt-level-dots {
    display: flex;
    gap: 3px;
}

.vtt-level-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1.5px solid var(--text-muted);
    display: inline-block;
}

.vtt-level-dot.filled {
    background: var(--green);
    border-color: var(--green);
}

/* Score */
.vtt-node-score {
    font-size: 0.7rem;
    color: var(--gold);
    font-weight: 600;
}

.vtt-node-bot {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.vtt-node-turns {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Status Badges */
.vtt-status-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
}

.vtt-badge-done {
    color: var(--green);
}

.vtt-badge-partial {
    color: var(--orange);
    background: rgba(243, 156, 18, 0.15);
}

.vtt-badge-researching {
    color: var(--orange);
}

.vtt-badge-available {
    color: var(--accent);
    background: rgba(74, 158, 255, 0.15);
}

/* Building Requirement Tag */
.vtt-node-req {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 2px;
    padding: 1px 4px;
    background: rgba(42, 42, 74, 0.5);
    border-radius: 3px;
    display: inline-block;
}

/* Zoom Controls */
.vtt-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 10;
}

.vtt-zoom-btn {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-panel);
    color: var(--text-primary);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.vtt-zoom-btn:hover {
    background: var(--bg-panel-hover);
}

/* Legend */
.vtt-legend {
    position: absolute;
    bottom: 10px;
    left: 10px;
    display: flex;
    gap: 12px;
    padding: 6px 12px;
    background: rgba(26, 26, 46, 0.9);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    z-index: 10;
    flex-wrap: wrap;
}

.vtt-legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: capitalize;
}

.vtt-legend-swatch {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    display: inline-block;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(243, 156, 18, 0.3); }
    50% { box-shadow: 0 0 12px 4px rgba(243, 156, 18, 0.15); }
}

/* ========== HEX HOVER TOOLTIP ========== */
.hex-tooltip {
    position: fixed;
    z-index: 500;
    pointer-events: none;
    background: rgba(15, 15, 26, 0.95);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 14px;
    max-width: 260px;
    min-width: 160px;
    font-size: 0.8rem;
    color: var(--text-primary);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.15s ease;
    display: none;
}

.hex-tooltip.visible {
    display: block;
    opacity: 1;
}

.hex-tooltip .tt-terrain {
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.hex-tooltip .tt-owner {
    font-size: 0.8rem;
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border-color);
}

.hex-tooltip .tt-section-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    margin-top: 6px;
    margin-bottom: 2px;
}

.hex-tooltip .tt-resources {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 4px;
}

.hex-tooltip .tt-res-tag {
    padding: 1px 6px;
    background: rgba(42, 42, 74, 0.5);
    border-radius: 3px;
    font-size: 0.75rem;
}

.hex-tooltip .tt-buildings {
    margin-bottom: 4px;
}

.hex-tooltip .tt-building-line {
    font-size: 0.78rem;
    padding: 1px 0;
}

.hex-tooltip .tt-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 4px;
}

.resource-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    display: none;
}

@media (min-width: 900px) {
    .resource-label {
        display: inline;
    }
}

/* ========== COLOR PICKER ========== */
.color-picker {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.color-swatch {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.2s;
}

.color-swatch:hover {
    transform: scale(1.15);
}

.color-swatch.selected {
    border-color: white;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

/* ========== NOTIFICATION ========== */
.notification {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    z-index: 2000;
    transition: all 0.3s;
    background: var(--accent);
    color: white;
}

.notification.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(-20px);
}

.notification.success {
    background: var(--green);
}

.notification.error {
    background: var(--red);
}

.notification.warning {
    background: var(--orange);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .lobby-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        max-height: 40vh;
        border-left: none;
        border-top: 1px solid var(--border-color);
    }

    .game-layout {
        flex-direction: column;
    }

    .resource-bar {
        gap: 2px;
    }

    .resource {
        min-width: 60px;
        padding: 3px 6px;
        font-size: 0.75rem;
    }

    .minimap {
        width: 120px;
        height: 120px;
    }

    header h1 {
        font-size: 1rem;
    }

    /* Mobile touch target improvements (min ~44px) */
    .build-option {
        padding: 10px 14px;
        min-height: 44px;
    }

    .build-category-header {
        padding: 10px 12px;
        min-height: 44px;
    }

    .btn-build-confirm {
        padding: 10px 14px;
        font-size: 0.85rem;
        min-height: 44px;
    }

    .btn-unit-move,
    .btn-unit-attack {
        padding: 6px 12px !important;
        font-size: 0.75rem !important;
        min-height: 36px;
    }

    .raze-option {
        min-height: 44px;
    }

    .btn-small {
        padding: 8px 14px;
        min-height: 40px;
    }

    .nav-btn {
        padding: 8px 14px;
        min-height: 40px;
    }

    .modal-close {
        padding: 8px 12px;
        font-size: 1.8rem;
        min-height: 44px;
        min-width: 44px;
    }

    .game-card {
        padding: 14px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .game-card-actions {
        flex-wrap: wrap;
    }

    .game-card-actions .btn {
        min-height: 40px;
    }

    .vtt-zoom-btn {
        width: 40px;
        height: 40px;
    }
}

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ========== REJOIN PICKER MODAL ========== */
.rejoin-player-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-rejoin-player {
    display: block;
    width: 100%;
    padding: 10px 16px;
    text-align: left;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.95rem;
}

.btn-rejoin-player:hover {
    background: var(--bg-panel-hover);
    border-color: var(--accent);
}

/* ========== MILITARY UNIT STYLES ========== */
.hex-units-section {
    margin-top: 4px;
}

.hex-unit-item {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    padding: 5px 8px;
    margin-bottom: 4px;
    border-left: 3px solid var(--border-color);
}

.unit-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.82rem;
}

.unit-hp-bar {
    position: relative;
    height: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 5px;
    margin-top: 3px;
    overflow: hidden;
}

.unit-hp-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.3s;
}

.unit-hp-text {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.55rem;
    line-height: 10px;
    color: #fff;
    text-shadow: 0 0 2px rgba(0,0,0,0.8);
}

.unit-actions {
    display: flex;
    gap: 4px;
    margin-top: 4px;
    align-items: center;
}

.btn-unit-move {
    background: var(--accent) !important;
    color: #fff !important;
    padding: 2px 8px !important;
    font-size: 0.7rem !important;
    border-radius: 4px !important;
}

.btn-unit-move:hover {
    background: var(--accent-hover) !important;
}

.btn-unit-attack {
    background: var(--red) !important;
    color: #fff !important;
    padding: 2px 8px !important;
    font-size: 0.7rem !important;
    border-radius: 4px !important;
}

.btn-unit-attack:hover {
    background: #c0392b !important;
}

.unit-stats-mini {
    font-size: 0.65rem;
    color: var(--text-secondary);
    margin-top: 1px;
}

/* ========== BUILD CATEGORY HEADERS ========== */
.build-category-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    margin-top: 4px;
    background: var(--bg-header);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.2s;
    user-select: none;
}

.build-category-header:hover {
    background: var(--bg-panel-hover);
    color: var(--text-primary);
}

.build-category-arrow {
    font-size: 0.6rem;
    color: var(--text-muted);
}

.build-category-count {
    margin-left: auto;
    font-size: 0.7rem;
    color: var(--accent);
    background: rgba(74, 158, 255, 0.15);
    padding: 1px 6px;
    border-radius: 10px;
}

.build-category-items {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-left: 4px;
    margin-top: 4px;
    border-left: 2px solid var(--border-color);
}

/* Raze section */
.raze-header {
    border-color: rgba(231, 76, 60, 0.4);
    margin-top: 8px;
}

.raze-header:hover {
    border-color: var(--red);
}

.raze-option {
    border-color: rgba(231, 76, 60, 0.3) !important;
}

.raze-option:hover {
    border-color: var(--red) !important;
    background: rgba(231, 76, 60, 0.08) !important;
}
