/* ===== GLOBAL STYLES ===== */
:root {
    /* Fantasy Medieval Color Palette */
    --bg-primary: #0d1117;           /* Deep Dark Stone */
    --bg-secondary: #1a2332;         /* Medieval Blue-Gray */
    --bg-tertiary: #2d3e52;          /* Stone Accent */
    --accent-primary: #c9302c;       /* Blood Red */
    --accent-secondary: #d4a574;     /* Gold */
    --accent-tertiary: #6b8e23;      /* Dark Green */
    --text-primary: #e8dcc8;         /* Parchment */
    --text-secondary: #9a8b77;       /* Faded Gold */
    --border-color: #1f2e3d;         /* Dark Edge */
    --success: #2d6a3e;              /* Forest Green */
    --warning: #d4a574;              /* Gold Warning */
    --danger: #8b2e1a;               /* Dark Red */
    --info: #2a5a8a;                 /* Deep Blue */
    --xp-color: #9370db;             /* Purple Mage */
    
    /* Fantasy Shadows */
    --shadow-glow: 0 0 20px rgba(201, 48, 44, 0.3);
    --shadow-heavy: 0 8px 32px rgba(0, 0, 0, 0.6);
}

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

body {
    font-family: 'Georgia', 'Garamond', serif;
    background: linear-gradient(135deg, #0a0e1a 0%, #1a2332 50%, #0d1117 100%);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 20px;
    position: relative;
}

/* Stone texture background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        repeating-linear-gradient(90deg, transparent, transparent 2px, rgba(255, 255, 255, 0.03) 2px, rgba(255, 255, 255, 0.03) 4px),
        repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(255, 255, 255, 0.02) 2px, rgba(255, 255, 255, 0.02) 4px);
    pointer-events: none;
    z-index: -1;
}

#game-container {
    max-width: 1200px;
    margin: 0 auto;
    background: var(--bg-secondary);
    border: 3px solid var(--accent-secondary);
    border-radius: 0;
    box-shadow: var(--shadow-heavy), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    overflow: hidden;
    position: relative;
}

/* Medieval border effect */
#game-container::before {
    content: '';
    position: absolute;
    top: -8px;
    left: -8px;
    right: -8px;
    bottom: -8px;
    background: linear-gradient(45deg, var(--accent-secondary), transparent, var(--accent-secondary));
    pointer-events: none;
    z-index: -1;
}

/* ===== HEADER ===== */
header {
    background: linear-gradient(180deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
    padding: 30px 20px;
    text-align: center;
    border-bottom: 3px solid var(--accent-secondary);
    position: relative;
    overflow: hidden;
}

header::before {
    content: '⚔️';
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 2rem;
    opacity: 0.3;
}

header::after {
    content: '🛡️';
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 2rem;
    opacity: 0.3;
}

header h1 {
    font-size: 2.8rem;
    margin-bottom: 5px;
    color: var(--accent-secondary);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7), 0 0 10px rgba(212, 165, 116, 0.3);
    letter-spacing: 3px;
    font-style: italic;
}

header h1::before {
    content: '« ';
    color: var(--accent-primary);
}

header h1::after {
    content: ' »';
    color: var(--accent-primary);
}

#version {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.5);
    padding: 8px 12px;
    border-radius: 0;
    border: 1px solid var(--accent-secondary);
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
}

/* ===== TAB NAVIGATION ===== */
.tab-nav {
    display: flex;
    background: linear-gradient(90deg, var(--bg-tertiary), var(--bg-secondary));
    border-bottom: 3px solid var(--accent-secondary);
}

.tab-btn {
    flex: 1;
    padding: 15px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 4px solid transparent;
    font-family: 'Georgia', serif;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    position: relative;
}

.tab-btn:hover {
    background: rgba(212, 165, 116, 0.05);
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--accent-secondary);
    border-bottom-color: var(--accent-primary);
    background: rgba(201, 48, 44, 0.1);
    box-shadow: inset 0 -3px 0 var(--accent-primary), var(--shadow-glow);
}

/* ===== TAB CONTENT ===== */
main {
    padding: 30px;
    min-height: 500px;
    background: var(--bg-secondary);
}

.tab-panel {
    display: none;
    animation: fadeIn 0.5s ease;
}

.tab-panel.active {
    display: block;
}

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

.tab-panel h2 {
    margin-bottom: 25px;
    color: var(--accent-secondary);
    font-size: 2rem;
    border-bottom: 2px solid var(--accent-primary);
    padding-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.tab-panel h3 {
    margin-bottom: 15px;
    color: var(--text-primary);
    font-size: 1.4rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.tab-panel h4 {
    margin-bottom: 10px;
    color: var(--accent-secondary);
    font-size: 1.1rem;
    font-style: italic;
}

/* ===== IDLE TAB ===== */

.resource-panel {
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
    padding: 20px;
    border-radius: 0;
    margin-bottom: 20px;
    border: 2px solid var(--accent-secondary);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.resource-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.resource-item {
    background: var(--bg-secondary);
    padding: 15px;
    border-radius: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 2px solid var(--accent-secondary);
    transition: all 0.3s ease;
    position: relative;
}

.resource-item::before {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    bottom: -1px;
    background: linear-gradient(135deg, var(--accent-secondary), transparent);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.resource-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border-color: var(--accent-primary);
}

.resource-icon {
    font-size: 2rem;
    filter: drop-shadow(0 0 3px rgba(212, 165, 116, 0.3));
}

.resource-info {
    display: flex;
    flex-direction: column;
}

.resource-name {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 600;
}

.resource-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--accent-secondary);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.auto-run-panel {
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
    padding: 20px;
    border-radius: 0;
    margin-bottom: 20px;
    border: 2px solid var(--accent-secondary);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.auto-run-controls {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.auto-run-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-radius: 0;
    border-left: 3px solid var(--accent-secondary);
}

.info-label {
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.9rem;
}

.status-active {
    color: var(--success);
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.9rem;
}

.status-inactive {
    color: var(--text-secondary);
}

.stats-panel {
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
    padding: 20px;
    border-radius: 0;
    margin-bottom: 20px;
    border: 2px solid var(--accent-secondary);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.stat-item {
    background: var(--bg-secondary);
    padding: 15px;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
    border: 2px solid var(--accent-secondary);
    transition: all 0.3s ease;
}

.stat-item:hover {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-primary);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.stat-value.success {
    color: var(--success);
}

.stat-value.danger {
    color: var(--danger);
}

.history-panel {
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
    padding: 20px;
    border-radius: 0;
    border: 2px solid var(--accent-secondary);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.run-history {
    max-height: 300px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.run-entry {
    background: var(--bg-secondary);
    padding: 12px;
    border-radius: 0;
    border-left: 4px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: slideIn 0.3s ease;
    transition: all 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.run-entry.success {
    border-left-color: var(--success);
    background: rgba(45, 106, 62, 0.1);
}

.run-entry.failure {
    border-left-color: var(--danger);
    background: rgba(139, 46, 26, 0.1);
}

.run-entry:hover {
    box-shadow: inset 0 0 10px rgba(212, 165, 116, 0.1);
}

.run-entry-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.run-entry-icon {
    font-size: 1.5rem;
    filter: drop-shadow(0 0 3px rgba(212, 165, 116, 0.2));
}

.run-entry-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.run-entry-result {
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-primary);
}

.run-entry-rewards {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.run-entry-time {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ===== HERO TAB ===== */

.hero-panel {
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
    padding: 25px;
    border-radius: 0;
    margin-bottom: 20px;
    border: 2px solid var(--accent-secondary);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

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

.hero-avatar {
    font-size: 4.5rem;
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-radius: 0;
    border: 3px solid var(--accent-primary);
    box-shadow: 0 0 20px var(--shadow-glow), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    position: relative;
}

.hero-avatar::before {
    content: '';
    position: absolute;
    top: -8px;
    left: -8px;
    right: -8px;
    bottom: -8px;
    border: 2px solid var(--accent-secondary);
    opacity: 0.3;
}

.hero-title h3 {
    font-size: 2rem;
    color: var(--accent-secondary);
    margin-bottom: 5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.hero-level {
    font-size: 1.2rem;
    color: var(--accent-primary);
    font-weight: bold;
}

.xp-section {
    margin-top: 20px;
}

.xp-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.xp-bar-container {
    width: 100%;
    height: 25px;
    background: var(--bg-secondary);
    border-radius: 0;
    overflow: hidden;
    border: 2px solid var(--accent-secondary);
    position: relative;
    box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.5);
}

.xp-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--xp-color), #b59bff);
    border-radius: 0;
    transition: width 0.5s ease;
    box-shadow: 0 0 10px rgba(147, 112, 219, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    position: relative;
}

.hero-stats-panel {
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
    padding: 20px;
    border-radius: 0;
    margin-bottom: 20px;
    border: 2px solid var(--accent-secondary);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.hero-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.stat-card {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: 0;
    display: flex;
    align-items: center;
    gap: 15px;
    border: 2px solid var(--accent-secondary);
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
    border-color: var(--accent-primary);
}

.stat-icon {
    font-size: 2.5rem;
    filter: drop-shadow(0 0 3px rgba(212, 165, 116, 0.3));
}

.stat-details {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.stat-name {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-primary);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.hero-info-panel {
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
    padding: 20px;
    border-radius: 0;
    border: 2px solid var(--accent-secondary);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.info-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 0;
    border-left: 3px solid var(--accent-secondary);
}

.info-label {
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    font-size: 0.9rem;
}

.info-value {
    color: var(--text-primary);
    font-weight: bold;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* ===== UPGRADES TAB ===== */

.upgrades-intro {
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-size: 1.1rem;
    text-align: center;
}

.upgrade-resources {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
    border-radius: 0;
    border: 2px solid var(--accent-secondary);
}

.upgrade-resource-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    background: var(--bg-secondary);
    border-radius: 0;
    border: 2px solid var(--accent-secondary);
    transition: all 0.3s ease;
}

.upgrade-resource-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.upgrade-resource-icon {
    font-size: 1.8rem;
    filter: drop-shadow(0 0 3px rgba(212, 165, 116, 0.3));
}

.upgrade-resource-value {
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--accent-secondary);
    min-width: 60px;
    text-align: left;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.upgrade-category {
    margin-bottom: 40px;
}

.category-title {
    color: var(--accent-secondary);
    font-size: 1.5rem;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.upgrades-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.upgrade-card {
    background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary));
    border: 2px solid var(--accent-secondary);
    border-radius: 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: all 0.3s ease;
    position: relative;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.upgrade-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    border-color: var(--accent-primary);
}

.upgrade-card.cannot-afford {
    opacity: 0.5;
}

.upgrade-card.max-level {
    border-color: var(--success);
    background: linear-gradient(135deg, rgba(45, 106, 62, 0.1) 0%, var(--bg-secondary) 100%);
}

.upgrade-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.upgrade-icon {
    font-size: 2.5rem;
    filter: drop-shadow(0 0 3px rgba(212, 165, 116, 0.3));
}

.upgrade-title {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.upgrade-name {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--text-primary);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.upgrade-level {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.upgrade-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.4;
    margin: 0;
}

.upgrade-effect {
    color: var(--accent-secondary);
    font-size: 0.85rem;
    min-height: 20px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.upgrade-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 12px;
    border-top: 2px solid var(--border-color);
}

.upgrade-cost {
    font-size: 0.95rem;
    font-weight: bold;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-upgrade {
    padding: 8px 16px;
    background: var(--success);
    color: white;
    border: 2px solid var(--success);
    border-radius: 0;
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.btn-upgrade:hover:not(:disabled) {
    background: #1a4d2a;
    border-color: #1a4d2a;
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(45, 106, 62, 0.5);
}

.btn-upgrade:disabled,
.btn-upgrade.disabled {
    background: var(--border-color);
    border-color: var(--border-color);
    cursor: not-allowed;
    opacity: 0.5;
}

.max-level-text {
    color: var(--success);
    font-weight: bold;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ===== MANUAL RUN TAB ===== */

.difficulty-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
    padding: 20px;
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
    border: 2px solid var(--accent-secondary);
}

.difficulty-btn {
    padding: 15px 20px;
    border: 2px solid var(--accent-secondary);
    border-radius: 0;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: 'Georgia', serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.difficulty-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-glow), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.difficulty-btn.selected {
    border-color: var(--accent-primary);
    background: linear-gradient(135deg, rgba(201, 48, 44, 0.2), rgba(201, 48, 44, 0.05));
    box-shadow: 0 0 20px var(--shadow-glow), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
}

.difficulty-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ===== ACHIEVEMENTS TAB ===== */

.achievement-header-panel {
    background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary));
    padding: 25px;
    border-radius: 0;
    margin-bottom: 30px;
    border: 2px solid var(--accent-secondary);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.achievement-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    justify-content: center;
}

.achievement-stat-card {
    flex: 1;
    max-width: 300px;
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: 0;
    display: flex;
    align-items: center;
    gap: 15px;
    border: 2px solid var(--accent-secondary);
    transition: all 0.3s ease;
}

.achievement-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.achievement-stat-icon {
    font-size: 3rem;
    filter: drop-shadow(0 0 5px rgba(212, 165, 116, 0.3));
}

.achievement-stat-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.achievement-stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.achievement-stat-value {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--accent-secondary);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.achievement-progress-bar {
    width: 100%;
    height: 30px;
    background: var(--bg-secondary);
    border-radius: 0;
    overflow: hidden;
    border: 2px solid var(--accent-secondary);
}

.achievement-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    transition: width 0.5s ease;
    box-shadow: 0 0 15px var(--shadow-glow), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.achievement-category {
    margin-bottom: 40px;
}

.achievement-category-title {
    color: var(--accent-secondary);
    font-size: 1.5rem;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.achievement-card {
    background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary));
    border: 2px solid var(--accent-secondary);
    border-radius: 0;
    padding: 20px;
    display: flex;
    gap: 15px;
    transition: all 0.3s ease;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.achievement-card.unlocked {
    border-color: var(--success);
    background: linear-gradient(135deg, rgba(45, 106, 62, 0.1) 0%, var(--bg-secondary) 100%);
}

.achievement-card.locked {
    opacity: 0.7;
}

.achievement-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.achievement-icon {
    font-size: 3.5rem;
    flex-shrink: 0;
    filter: drop-shadow(0 0 3px rgba(212, 165, 116, 0.3));
}

.achievement-icon.grayscale {
    filter: grayscale(100%) drop-shadow(0 0 3px rgba(212, 165, 116, 0.1));
    opacity: 0.5;
}

.achievement-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.achievement-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.achievement-name {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--text-primary);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.achievement-check {
    font-size: 1.2rem;
}

.achievement-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.4;
    margin: 0;
}

.achievement-reward {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-radius: 0;
    margin-top: 5px;
    border-left: 3px solid var(--accent-secondary);
}

.achievement-reward-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.achievement-reward-value {
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--accent-secondary);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.achievement-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 5px;
}

.achievement-progress-bar-small {
    flex: 1;
    height: 8px;
    background: var(--bg-secondary);
    border-radius: 0;
    overflow: hidden;
    border: 1px solid var(--accent-secondary);
}

.achievement-progress-fill-small {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    transition: width 0.5s ease;
}

.achievement-progress-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: bold;
    min-width: 40px;
    text-align: right;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.achievement-unlocked-date {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-style: italic;
    margin-top: 5px;
}

/* Achievement Notifications */
.achievement-notification {
    position: fixed;
    top: 80px;
    right: -400px;
    background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary));
    border: 3px solid var(--success);
    border-radius: 0;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(45, 106, 62, 0.4);
    z-index: 10000;
    transition: right 0.3s ease;
    min-width: 350px;
    animation: pulse 1s ease-in-out;
}

.achievement-notification.show {
    right: 20px;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.achievement-notification-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.achievement-notification-icon {
    font-size: 4rem;
    animation: bounce 0.6s ease-in-out;
    filter: drop-shadow(0 0 5px rgba(212, 165, 116, 0.5));
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.achievement-notification-text {
    flex: 1;
}

.achievement-notification-title {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--success);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.achievement-notification-name {
    font-size: 1rem;
    color: var(--text-primary);
}

/* ===== SETTINGS TAB ===== */

.settings-panel {
    background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary));
    padding: 25px;
    border-radius: 0;
    margin-bottom: 25px;
    border: 2px solid var(--accent-secondary);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.settings-section {
    margin-bottom: 30px;
}

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

.settings-description {
    color: var(--text-secondary);
    margin-bottom: 15px;
    line-height: 1.5;
}

.save-textarea {
    width: 100%;
    min-height: 120px;
    padding: 12px;
    background: var(--bg-secondary);
    border: 2px solid var(--accent-secondary);
    border-radius: 0;
    color: var(--text-primary);
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    resize: vertical;
    margin-top: 10px;
    margin-bottom: 10px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.save-textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 10px var(--shadow-glow), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.save-textarea::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

/* ===== BUTTONS ===== */
.btn {
    padding: 12px 24px;
    border: 2px solid;
    border-radius: 0;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: 'Georgia', serif;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

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

.btn-primary:hover {
    background: #a02420;
    border-color: #a02420;
    transform: translateY(-2px);
    box-shadow: 0 0 20px var(--shadow-glow), 0 4px 8px rgba(0, 0, 0, 0.3);
}

.btn-success {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.btn-success:hover {
    background: #1a4d2a;
    border-color: #1a4d2a;
    transform: translateY(-2px);
    box-shadow: 0 0 20px rgba(45, 106, 62, 0.5), 0 4px 8px rgba(0, 0, 0, 0.3);
}

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

.btn-danger:hover {
    background: #691e11;
    border-color: #691e11;
    transform: translateY(-2px);
    box-shadow: 0 0 20px rgba(139, 46, 26, 0.5), 0 4px 8px rgba(0, 0, 0, 0.3);
}

.btn-primary:active,
.btn-success:active,
.btn-danger:active {
    transform: translateY(0);
}

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

/* ===== CANVAS CONTAINER ===== */
#dungeon-canvas-container {
    background: var(--bg-primary);
    border: 2px solid var(--accent-secondary);
    border-radius: 0;
    padding: 10px;
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.8);
}

#dungeon-canvas {
    border-radius: 0;
    background: #050505;
    border: 1px solid var(--border-color);
}

/* ===== FOOTER ===== */
footer {
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    padding: 15px;
    text-align: center;
    border-top: 3px solid var(--accent-secondary);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

footer a {
    color: var(--accent-secondary);
    text-decoration: none;
    transition: all 0.3s ease;
    font-weight: 600;
}

footer a:hover {
    color: var(--accent-primary);
    text-decoration: underline;
    text-shadow: 0 0 10px rgba(201, 48, 44, 0.3);
}

/* ===== UTILITY CLASSES ===== */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-secondary);
    font-style: italic;
}

.mt-2 {
    margin-top: 20px;
}

.mb-2 {
    margin-bottom: 20px;
}

/* ===== SCROLLBAR ===== */
.run-history::-webkit-scrollbar {
    width: 8px;
}

.run-history::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 0;
}

.run-history::-webkit-scrollbar-thumb {
    background: var(--accent-secondary);
    border-radius: 0;
}

.run-history::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

/* ===== TOAST NOTIFICATIONS ===== */

.toast {
    position: fixed;
    top: 80px;
    right: -450px;
    background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary));
    border: 3px solid var(--accent-secondary);
    border-radius: 0;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    z-index: 10000;
    transition: right 0.3s ease;
    min-width: 350px;
    max-width: 400px;
    opacity: 0;
}

.toast.toast-visible {
    right: 20px;
    opacity: 1;
    animation: slideInRight 0.3s ease, pulseGlow 1s ease-in-out;
}

.toast.toast-hiding {
    right: -450px;
    opacity: 0;
}

@keyframes slideInRight {
    from {
        right: -450px;
        opacity: 0;
    }
    to {
        right: 20px;
        opacity: 1;
    }
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6); }
    50% { box-shadow: 0 8px 32px rgba(212, 165, 116, 0.4), 0 0 40px rgba(212, 165, 116, 0.2); }
}

.toast-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.toast-message {
    flex: 1;
    font-size: 1rem;
    color: var(--text-primary);
    line-height: 1.5;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    border-radius: 0;
}

.toast-close:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
}

/* Toast Types */
.toast-victory {
    border-color: var(--success);
    background: linear-gradient(135deg, rgba(45, 106, 62, 0.2) 0%, var(--bg-secondary) 100%);
}

.toast-victory .toast-message {
    color: #7fffa2;
    font-weight: bold;
}

.toast-error {
    border-color: var(--danger);
    background: linear-gradient(135deg, rgba(139, 46, 26, 0.2) 0%, var(--bg-secondary) 100%);
}

.toast-error .toast-message {
    color: #ff9999;
}

.toast-achievement {
    border-color: var(--success);
    background: linear-gradient(135deg, rgba(45, 106, 62, 0.2) 0%, var(--bg-secondary) 100%);
}

.toast-achievement .toast-message {
    color: var(--accent-secondary);
    font-weight: bold;
}

.toast-info {
    border-color: var(--info);
    background: linear-gradient(135deg, rgba(42, 90, 138, 0.2) 0%, var(--bg-secondary) 100%);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    header h1 {
        font-size: 2rem;
    }

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

    main {
        padding: 15px;
    }

    .auto-run-controls {
        flex-direction: column;
    }

    .resource-grid,
    .stats-grid,
    .hero-stats-grid {
        grid-template-columns: 1fr;
    }

    .hero-avatar {
        font-size: 3rem;
        width: 70px;
        height: 70px;
    }

    .hero-title h3 {
        font-size: 1.5rem;
    }

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

    .upgrade-resources {
        flex-wrap: wrap;
        gap: 15px;
    }

    .upgrade-resource-item {
        flex: 1;
        min-width: 120px;
    }

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

    .achievement-stats {
        flex-direction: column;
    }

    .achievement-stat-card {
        max-width: none;
    }

    .achievement-notification {
        min-width: 300px;
        top: 60px;
    }

    .achievement-notification.show {
        right: 10px;
    }

    .difficulty-selector {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .toast {
        min-width: 300px;
        max-width: calc(100vw - 40px);
        top: 60px;
    }
    
    .toast.toast-visible {
        right: 10px;
    }
}
