/* Backrooms aesthetic — yellow wallpaper, damp fluorescent, monospace creeping text */
:root {
    --wallpaper: #d6b65a;
    --wallpaper-dim: #8a7430;
    --carpet: #2b2415;
    --ceiling: #efe4b3;
    --ink: #1a160a;
    --fluorescent: #fff4c2;
    --danger: #c92a2a;
    --soft-shadow: 0 0 24px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--wallpaper);
    color: var(--ink);
    font-family: 'Courier New', 'Consolas', monospace;
    line-height: 1.55;
    overflow-x: hidden;
}

/* Repeating wallpaper pattern — emulates the classic yellow wallpaper without an image asset */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    background-color: var(--wallpaper);
    background-image:
        radial-gradient(circle at 20% 30%, rgba(0,0,0,0.08) 0, transparent 30%),
        radial-gradient(circle at 75% 65%, rgba(0,0,0,0.10) 0, transparent 35%),
        radial-gradient(circle at 50% 90%, rgba(0,0,0,0.07) 0, transparent 35%);
    opacity: 0.55;
    pointer-events: none;
}

header.site {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: rgba(20, 16, 0, 0.86);
    color: var(--fluorescent);
    border-bottom: 4px solid var(--wallpaper-dim);
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: var(--soft-shadow);
}

header.site h1 {
    margin: 0;
    font-size: 1.4rem;
    letter-spacing: 0.08em;
    text-shadow: 0 0 6px rgba(255, 244, 194, 0.4);
}

nav.site ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

nav.site a {
    display: inline-block;
    padding: 0.4rem 0.85rem;
    color: var(--fluorescent);
    text-decoration: none;
    border: 1px solid transparent;
    transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
    font-size: 0.95rem;
}

nav.site a:hover,
nav.site a:focus {
    background: var(--wallpaper);
    color: var(--ink);
    border-color: var(--wallpaper-dim);
    outline: none;
}

nav.site a.active {
    background: var(--wallpaper-dim);
    color: #1a160a;
}

main {
    max-width: 920px;
    margin: 2rem auto;
    padding: 0 1.5rem 2rem;
}

section.card {
    background: rgba(20, 16, 0, 0.78);
    color: var(--fluorescent);
    padding: 1.5rem 1.75rem;
    margin: 1.5rem 0;
    border: 1px solid var(--wallpaper-dim);
    border-left: 6px solid var(--wallpaper);
    box-shadow: var(--soft-shadow);
}

section.card h2,
section.card h3 {
    color: #fff8d6;
    letter-spacing: 0.04em;
    margin-top: 0;
}

.hero {
    padding: 3.5rem 1.75rem 4rem;
    text-align: center;
    background: linear-gradient(180deg, rgba(0,0,0,0.55), rgba(0,0,0,0.85));
    color: #fff8d6;
    border-bottom: 6px solid var(--wallpaper);
}

.hero h2 {
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    letter-spacing: 0.18em;
    margin: 0 0 0.5rem;
    text-shadow: 0 0 12px rgba(255, 244, 194, 0.55);
}

.hero p {
    max-width: 640px;
    margin: 0.5rem auto 1.5rem;
    color: var(--fluorescent);
    opacity: 0.94;
}

.btn {
    display: inline-block;
    padding: 0.85rem 1.6rem;
    background: var(--wallpaper);
    color: var(--ink);
    text-decoration: none;
    font-weight: bold;
    letter-spacing: 0.1em;
    border: 2px solid var(--ink);
    box-shadow: 4px 4px 0 var(--ink);
    transition: transform 100ms ease, box-shadow 100ms ease;
    cursor: pointer;
}

.btn:hover, .btn:focus {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 var(--ink);
    outline: none;
}

.btn.danger {
    background: var(--danger);
    color: #fff8d6;
}

.timeline {
    list-style: none;
    margin: 1rem 0 0;
    padding: 0;
    border-left: 3px solid var(--wallpaper);
}

.timeline li {
    position: relative;
    padding: 0.75rem 1rem 1rem 1.5rem;
    margin-left: 0.5rem;
}

.timeline li::before {
    content: '';
    position: absolute;
    left: -0.85rem;
    top: 1.1rem;
    width: 14px;
    height: 14px;
    background: var(--wallpaper);
    border: 2px solid #1a160a;
    box-shadow: 0 0 8px rgba(255, 244, 194, 0.55);
}

.timeline .date {
    font-weight: bold;
    color: #fff8d6;
    letter-spacing: 0.05em;
}

.post-block {
    background: #0c0c08;
    color: #d9d9c8;
    padding: 1rem 1.25rem;
    border: 1px solid #2b2415;
    border-left: 6px solid #6b5f33;
    font-family: 'Courier New', monospace;
    margin: 1rem 0;
    box-shadow: inset 0 0 22px rgba(0, 0, 0, 0.75);
}

.post-block .op {
    color: #8f8734;
    font-weight: bold;
}

.post-block .greentext {
    color: #6c8e3b;
}

.entity-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
}

.entity-grid article {
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid var(--wallpaper-dim);
    padding: 1rem 1.1rem;
    box-shadow: var(--soft-shadow);
}

.entity-grid article h3 {
    color: #fff8d6;
    margin: 0 0 0.25rem;
}

.entity-grid article p {
    color: var(--fluorescent);
    margin: 0.25rem 0;
    font-size: 0.95rem;
}

footer.site {
    text-align: center;
    padding: 1.5rem 1rem;
    background: rgba(0, 0, 0, 0.85);
    color: var(--wallpaper-dim);
    font-size: 0.85rem;
    border-top: 4px solid var(--wallpaper-dim);
}

/* Game page styling */
#game-shell {
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: #000;
    height: 100vh;
    width: 100vw;
}

#three-canvas {
    position: fixed;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    z-index: 1;
    display: block;
}

#hud {
    position: fixed;
    inset: 0;
    pointer-events: none;
    color: var(--fluorescent);
    font-family: 'Courier New', monospace;
    letter-spacing: 0.08em;
    text-shadow: 0 0 8px rgba(0, 0, 0, 0.9);
    z-index: 5;
}

#hud .corner {
    position: absolute;
    padding: 0.7rem 1rem;
}

#hud .tl { top: 0.6rem; left: 0.6rem; }
#hud .tr { top: 0.6rem; right: 0.6rem; text-align: right; }
#hud .bl { bottom: 0.6rem; left: 0.6rem; }
#hud .br { bottom: 0.6rem; right: 0.6rem; text-align: right; }

#sanity-bar {
    width: 220px;
    height: 14px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid var(--wallpaper-dim);
    overflow: hidden;
    margin-top: 0.4rem;
}

#sanity-bar > div {
    height: 100%;
    background: linear-gradient(90deg, #c92a2a 0 30%, #ffd166 30% 65%, #6c8e3b 65% 100%);
    transition: width 120ms ease;
}

#prompt {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.78);
    color: var(--fluorescent);
    text-align: center;
    padding: 1.5rem;
    z-index: 10;
}

#prompt .panel {
    max-width: 520px;
    background: rgba(20, 16, 0, 0.85);
    border: 1px solid var(--wallpaper-dim);
    padding: 1.75rem 2rem;
    box-shadow: var(--soft-shadow);
}

#prompt h2 {
    margin-top: 0;
    letter-spacing: 0.18em;
    color: #fff8d6;
}

#prompt ul {
    text-align: left;
    line-height: 1.7;
    color: var(--fluorescent);
}

#prompt .btn {
    pointer-events: auto;
}

#minimap {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    width: 180px;
    height: 180px;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid var(--wallpaper-dim);
    box-shadow: var(--soft-shadow);
    z-index: 4;
}

#minimap.hidden { display: none; }

#endscreen {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: rgba(0, 0, 0, 0.92);
    color: var(--fluorescent);
    z-index: 11;
    padding: 1.5rem;
}

#endscreen.show { display: flex; }

#endscreen h2 {
    color: #fff8d6;
    letter-spacing: 0.18em;
    margin-top: 0;
}

#endscreen.lose h2 { color: var(--danger); }
#endscreen.win h2 { color: var(--fluorescent); }

a.btn-link {
    color: inherit;
}

/* Static TV noise for end screens */
.flicker {
    animation: flicker 5.5s infinite;
}

@keyframes flicker {
    0%, 95%, 100% { opacity: 1; }
    96% { opacity: 0.7; }
    97% { opacity: 1; }
    98% { opacity: 0.55; }
}
