:root {
    --stone: #0a0e17;
    --stone-light: #151c2b;
    --iron: #2d3748;
    --iron-dark: #1a202c;
    --amber: #ff8c00;
    --amber-dim: #92400e;
    --amber-glow: rgba(255, 140, 0, 0.2);
    --parchment-text: #e2e8f0;
    --ink-dim: #94a3b8;
    --success: #10b981;
    --danger: #ef4444;
    --radius: 2px;
    --font-mono: 'JetBrains Mono', monospace;
    --transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: var(--stone);
    color: var(--parchment-text);
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    line-height: 1.6;
}

.no-select { user-select: none; }

#app { display: flex; height: 100vh; width: 100vw; }

/* Tab Panels */
.tab-panel { 
    display: none; 
    max-width: 1200px; 
    margin: 0 auto; 
    opacity: 0;
    transform: translateY(10px);
}
.tab-panel.active { 
    display: block; 
    animation: tabEnter 0.5s forwards cubic-bezier(0.19, 1, 0.22, 1); 
}
@keyframes tabEnter { to { opacity: 1; transform: translateY(0); } }

/* Screen Shake */
.shake-layer.shaking { animation: screenShake 0.4s cubic-bezier(.36,.07,.19,.97) both; }
@keyframes screenShake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}

.clickable-card:active { transform: scale(0.98); animation: cardShake 0.2s; }
@keyframes cardShake { 0% { transform: scale(0.98) rotate(0); } 50% { transform: scale(0.98) rotate(1deg); } 100% { transform: scale(0.98) rotate(0); } }

/* Candlelight Flicker */
.candle-title { position: relative; display: inline-block; }
.candle-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 0;
    width: 100%;
    height: 15px;
    background: radial-gradient(ellipse at center, var(--amber-glow) 0%, transparent 70%);
    animation: flicker 4s infinite;
}
@keyframes flicker {
    0%, 100% { opacity: 0.6; transform: scaleX(1); }
    50% { opacity: 0.9; transform: scaleX(1.1); }
    70% { opacity: 0.7; transform: scaleX(0.95); }
}

/* Floating Particles */
#particle-container { position: fixed; pointer-events: none; top: 0; left: 0; width: 100%; height: 100%; z-index: 1000; }
.float-particle {
    position: absolute;
    color: var(--amber);
    font-weight: 800;
    font-family: var(--font-mono);
    font-size: 1.1rem;
    pointer-events: none;
    text-shadow: 0 0 10px rgba(0,0,0,0.8);
    animation: floatUpFade 0.8s forwards ease-out;
}
@keyframes floatUpFade {
    0% { transform: translateY(0) rotate(0) scale(1); opacity: 1; }
    100% { transform: translateY(-80px) rotate(15deg) scale(0.8); opacity: 0; }
}

/* Sidebar */
.sidebar {
    width: 270px;
    min-width: 270px;
    background-color: #05070a;
    border-right: 1px solid var(--iron);
    display: flex;
    flex-direction: column;
    padding: 30px 0;
}
.sidebar-header { padding: 0 24px; margin-bottom: 48px; display: flex; align-items: center; gap: 16px; }
.brand-seal { color: var(--amber); }
.brand-seal .lucide { width: 32px; height: 32px; filter: drop-shadow(0 0 10px var(--amber-glow)); }
.brand-title { font-family: var(--font-mono); font-size: 1.2rem; font-weight: 800; letter-spacing: 4px; }
.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.nav-btn {
    background: none; border: none; padding: 14px 28px; color: var(--ink-dim); display: flex; align-items: center; gap: 16px;
    font-size: 0.85rem; font-weight: 700; cursor: pointer; transition: var(--transition); text-align: left; text-transform: uppercase;
    letter-spacing: 1px; border-left: 4px solid transparent;
}
.nav-btn:hover { background-color: var(--stone-light); color: var(--parchment-text); }
.nav-btn.active { background-color: rgba(255, 140, 0, 0.04); color: var(--amber); border-left-color: var(--amber); }

/* Resource Ledger */
.resource-ledger {
    height: 90px;
    background-color: #080b11;
    border-bottom: 1px solid var(--iron);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 12px;
}
.ledger-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--stone-light);
    border: 1px solid var(--iron);
    padding: 8px 14px;
    border-radius: var(--radius);
    min-width: 155px;
}
.ledger-icon { width: 16px; height: 16px; color: var(--ink-dim); }
.ledger-meta { display: flex; flex-direction: column; flex: 1; }
.res-val { font-family: var(--font-mono); font-size: 0.95rem; font-weight: 800; color: var(--parchment-text); }
.res-rate { font-size: 0.6rem; color: var(--success); font-weight: 800; }
.res-label { font-size: 0.55rem; text-transform: uppercase; color: var(--ink-dim); }

/* Command Buttons (Levy) */
.command-btn {
    background: var(--iron-dark);
    border: 1px solid var(--iron);
    color: var(--ink-dim);
    font-size: 0.6rem;
    font-weight: 800;
    padding: 4px 8px;
    cursor: pointer;
    text-transform: uppercase;
    border-radius: 2px;
    transition: var(--transition);
}
.command-btn:hover { color: var(--amber); border-color: var(--amber); background: #000; }

/* Realm Viewport */
.realm-view { flex: 1; display: flex; flex-direction: column; min-width: 0; position: relative; }
.parchment-viewport { flex: 1; overflow-y: auto; background-image: radial-gradient(circle at 50% 50%, #15202e 0%, #0a0e17 100%); padding: 48px; }

/* Statue Pedestal */
.statue-pedestal {
    width: 100%;
    height: 300px;
    background: radial-gradient(circle at bottom, rgba(255,140,0,0.1) 0%, transparent 70%);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    margin-bottom: 40px;
    border-bottom: 2px solid var(--iron);
}
.statue-spotlight {
    position: absolute;
    bottom: 0;
    width: 150px;
    height: 30px;
    background: radial-gradient(ellipse at center, var(--amber-glow) 0%, transparent 80%);
    animation: flicker 5s infinite;
}
.pixel-monument {
    width: 256px;
    height: 256px;
    image-rendering: pixelated;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: bottom center;
    z-index: 2;
    animation: statueFloat 6s ease-in-out infinite;
}
@keyframes statueFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.pedestal-base {
    padding: 8px 32px;
    background: #000;
    border: 1px solid var(--iron);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--ink-dim);
    text-transform: uppercase;
    letter-spacing: 3px;
    margin-bottom: -15px;
}

/* Workshop */
.pantheon-layout { display: grid; grid-template-columns: 350px 1fr; gap: 24px; align-items: start; }
.religion-btn {
    width: 100%;
    background: var(--stone);
    border: 1px solid var(--iron);
    padding: 16px;
    margin-bottom: 12px;
    text-align: left;
    cursor: pointer;
    transition: var(--transition);
}
.religion-btn:hover { border-color: var(--ink-dim); }
.religion-btn.active { border-color: var(--amber); background: rgba(255,140,0,0.05); }
.religion-btn h4 { font-size: 0.9rem; color: var(--amber); margin-bottom: 4px; }
.religion-btn p { font-size: 0.75rem; color: var(--ink-dim); }

.monument-workshop { background: var(--stone-light); padding: 32px; }
.canvas-container { 
    position: relative; 
    width: 320px; 
    height: 320px; 
    margin: 20px auto; 
    background: #000; 
    border: 2px solid var(--iron);
    cursor: crosshair;
}
#statue-canvas { width: 100%; height: 100%; image-rendering: pixelated; position: absolute; z-index: 5; }
.grid-overlay {
    position: absolute; inset: 0; z-index: 10; pointer-events: none;
    background-image: linear-gradient(to right, rgba(255,255,255,0.05) 1px, transparent 1px),
                      linear-gradient(to bottom, rgba(255,255,255,0.05) 1px, transparent 1px);
    background-size: 5px 5px;
}
.grid-overlay.hidden { display: none; }

.workshop-controls { display: flex; flex-direction: column; gap: 20px; align-items: center; }
.palette-group { display: flex; gap: 8px; }
.palette-color { width: 32px; height: 32px; border: 1px solid var(--iron); cursor: pointer; transition: 0.2s; position: relative; }
.palette-color.active { border-color: #fff; transform: scale(1.1); box-shadow: 0 0 10px rgba(255,255,255,0.2); }
.palette-color.eraser { display: flex; align-items: center; justify-content: center; background: #222; }

.blueprint-selector { margin-top: 32px; text-align: center; border-top: 1px solid var(--iron); padding-top: 20px; }
.blueprint-selector p { font-size: 0.7rem; color: var(--ink-dim); margin-bottom: 12px; text-transform: uppercase; }
.blueprints { display: flex; justify-content: center; gap: 12px; }
.bp-btn { width: 40px; height: 40px; background: #000; border: 1px solid var(--iron); color: var(--ink-dim); cursor: pointer; }
.bp-btn:hover { color: var(--amber); border-color: var(--amber); }

/* Cards & Layout */
.hall-layout { display: flex; flex-direction: column; gap: 24px; }
.chamber-card { background: var(--stone-light); border: 1px solid var(--iron); padding: 24px; position: relative; }
.iron-banded { border: 1px solid var(--iron); box-shadow: inset 0 0 10px rgba(0,0,0,0.5); }
.chamber-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 24px; }
.action-btn {
    background: var(--iron-dark); border: 1px solid var(--iron); color: var(--parchment-text); padding: 14px;
    font-size: 0.85rem; font-weight: 800; text-transform: uppercase; cursor: pointer; transition: var(--transition);
    letter-spacing: 1.5px; width: 100%;
}
.action-btn:hover:not(:disabled) { border-color: var(--amber); color: var(--amber); box-shadow: 0 0 20px var(--amber-glow); }
.action-btn.danger:hover { color: var(--danger); border-color: var(--danger); box-shadow: 0 0 20px rgba(239, 68, 68, 0.2); }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--iron); }
