:root {
    --glow: #00ff41;
    --bg: #050505;
    --stone: #1a1a1a;
    --text: #c0c0c0;
    --font-main: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
    --font-fantasy: "Cinzel", "Almendra", Georgia, "Times New Roman", serif;
}

body { 
    font-family: var(--font-main); 
    background: #080808; 
    color: var(--text); 
    margin: 0; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
    touch-action: manipulation;
    background-image: 
        radial-gradient(circle at 50% 50%, transparent 0%, rgba(0,0,0,0.85) 100%),
        url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="250" height="250"><filter id="stone"><feTurbulence type="fractalNoise" baseFrequency="0.4" numOctaves="4" stitchTiles="stitch"/><feColorMatrix type="saturate" values="0"/><feComponentTransfer><feFuncR type="linear" slope="0.03"/><feFuncG type="linear" slope="0.03"/><feFuncB type="linear" slope="0.03"/></feComponentTransfer></filter><rect width="250" height="250" filter="url(%23stone)"/></svg>');
    background-attachment: fixed;
}

body::after {
    content: "";
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle, transparent 40%, black 150%);
    pointer-events: none;
    z-index: 5;
}

.page-fade-in {
    animation: fadeIn 0.8s ease-out forwards;
}

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

.container { 
    max-width: 900px; 
    width: 95%; 
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 2rem 1rem;
    box-sizing: border-box;
    position: relative;
    z-index: 10;
}

h1 { 
    font-family: var(--font-fantasy);
    font-size: 2.2rem; 
    font-weight: 700; 
    letter-spacing: 4px; 
    color: var(--glow); 
    text-shadow: 0 0 15px rgba(0,255,0,0.6); 
    margin: 0 0 1.5rem 0;
    text-align: center;
    text-transform: uppercase;
}

.flicker {
    animation: flicker 4s infinite;
}

@keyframes flicker {
    0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% { opacity: 1; }
    20%, 24%, 55% { opacity: 0.8; }
}

.btn {
    font-family: var(--font-fantasy);
    background: transparent;
    border: 2px solid var(--glow);
    color: var(--glow);
    padding: 0.8rem 2rem;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 700;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0,255,0,0.1);
    margin: 0.5rem;
}

.btn:hover {
    background: var(--glow);
    color: #000;
    box-shadow: 0 0 20px var(--glow);
    transform: scale(1.05);
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Game Mode specific */
.game-mode .container {
    justify-content: center;
}

@media (max-height: 700px) {
    .game-mode .container { justify-content: flex-start; }
}

.hud {
    display: flex;
    justify-content: center;
    width: 100%;
    max-width: 400px;
    margin-bottom: 1rem;
    font-family: var(--font-fantasy);
    font-size: 0.8rem;
    color: var(--glow);
    text-shadow: 0 0 5px var(--glow);
}

.description { 
    font-size: 1.1rem; 
    line-height: 1.6; 
    color: #aaa; 
    margin: 1.5rem 0; 
    font-style: italic; 
    text-align: center;
    min-height: 4rem;
}

.victory { 
    color: #ffd700; 
    font-size: 2.2rem; 
    font-family: var(--font-fantasy);
    font-weight: bold; 
    text-shadow: 0 0 20px rgba(255,215,0,0.8); 
    margin: 2rem 0; 
    text-align: center;
}

.controls { 
    display: flex; 
    gap: 1rem; 
    justify-content: center; 
    margin-top: 2rem; 
    width: 100%; 
}

.btn.disabled { 
    color: #333; 
    border-color: #222; 
    pointer-events: none; 
    opacity: 0.4; 
}

.game-view-container {
    border: 1px solid #333;
    padding: 5px;
    background: #000;
    box-shadow: 0 0 30px rgba(0,0,0,1);
    margin-bottom: 1rem;
}

.history-info {
    margin-top: 2rem;
    font-size: 0.6rem;
    color: #444;
    text-transform: uppercase;
    letter-spacing: 1px;
}

@media (max-width: 600px) {
    .btn .btn-text { display: none; }
    .btn .btn-icon { display: inline; font-size: 2rem; }
    .controls { gap: 1rem; width: 100%; max-width: 350px; }
    .btn { padding: 1.5rem 0; flex: 1; display: flex; align-items: center; justify-content: center; }
    .hud { font-size: 0.7rem; }
    h1 { font-size: 1.6rem; }
}

@media (min-width: 601px) {
    .btn .btn-icon { display: none; }
}

/* Status Page specific */
.status-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    width: 100%;
}

.stat-panel {
    background: rgba(0, 20, 0, 0.8);
    border: 1px solid var(--glow);
    padding: 1.5rem;
    flex: 1;
    min-width: 300px;
    box-shadow: inset 0 0 15px rgba(0, 255, 65, 0.1);
}

.stat-panel h2 {
    font-family: var(--font-fantasy);
    color: var(--glow);
    font-size: 1.2rem;
    margin-top: 0;
    border-bottom: 1px solid #333;
    padding-bottom: 0.5rem;
}

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th { text-align: left; padding: 0.5rem; color: #666; font-size: 0.7rem; text-transform: uppercase; }
td { padding: 0.5rem; border-bottom: 1px solid #222; }

.heatmap-container {
    display: grid;
    gap: 2px;
    background: #000;
    padding: 15px;
    border: 1px solid var(--glow);
    margin: 1.5rem auto;
    overflow: auto;
    max-width: 95vw;
    width: fit-content;
    box-shadow: 0 0 20px rgba(0,255,0,0.1);
}

.cell {
    width: 15px;
    height: 15px;
    border-radius: 1px;
}

.crawler-tag {
    color: #ff3333;
    font-size: 0.6rem;
    border: 1px solid #ff3333;
    padding: 1px 4px;
    border-radius: 3px;
    margin-left: 5px;
}

.human-tag {
    color: #00ffcc;
    font-size: 0.6rem;
    border: 1px solid #00ffcc;
    padding: 1px 4px;
    border-radius: 3px;
    margin-left: 5px;
    text-shadow: 0 0 5px rgba(0, 255, 204, 0.5);
}

.duration {
    color: #ffd700;
    font-weight: bold;
}

/* Start Page specific */
.story { 
    max-width: 600px; 
    text-align: center; 
    line-height: 1.8; 
    color: #888; 
    font-style: italic;
    margin: 2rem 0;
}
.start-btn {
    margin-top: 3rem;
}

.cell.wall { background: #111; }
.cell.target { background: #ffd700; box-shadow: 0 0 10px gold; z-index: 10; }
.stats-container {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    justify-content: center;
    width: 100%;
    max-width: 1200px;
    margin-top: 2rem;
}
