/* ═══════════════════════════════════════════════════
   THE LAST MODDER — style.css
   All UI chrome, panels, start menu, overlays
═══════════════════════════════════════════════════ */

:root {
  --panel-bg:      rgba(6, 8, 14, 0.97);
  --panel-border:  #1e2d50;
  --panel-border2: #03050a;
  --text:          #d6e4ff;
  --text-dim:      #6a7a9a;
  --accent:        #c07030;
  --accent2:       #8aa4d8;
  --secret-color:  #e0a860;
}

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

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: #000;
  font-family: 'VT323', monospace;
  color: var(--text);
}

#game-root {
  width: 100%; height: 100%;
  display: grid;
  place-items: center;
  position: relative;
}

#game-root canvas {
  width: 100vw !important;
  height: 100vh !important;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* ══════════════════ START MENU ══════════════════ */

#start-menu {
  position: absolute; inset: 0;
  z-index: 20;
  display: grid; place-items: center;
  background: #000;
  font-family: 'VT323', monospace;
}

.menu-card {
  width: min(880px, 94vw);
  padding: 22px;
  background: #000;
  color: #d6def0;
  transform-origin: center top;
}

.menu-title {
  font-size: clamp(52px, 8vw, 88px);
  line-height: 1;
  color: #e38d99;
  text-align: center;
  margin-bottom: 4px;
  letter-spacing: 1px;
}

.menu-sub {
  font-size: 21px;
  color: #3a4a68;
  text-align: center;
  margin-bottom: 14px;
  letter-spacing: 3px;
}

.menu-preview {
  width: min(780px, 86vw);
  aspect-ratio: 16/9;
  margin: 0 auto 20px;
  position: relative;
  border: 4px solid #00114a;
  box-shadow: inset 0 0 0 2px #000b2f;
  background: #06087a;
  overflow: hidden;
  image-rendering: pixelated;
}

.tunnel-bg {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(180deg, rgba(0,0,0,.34), rgba(0,0,0,.34)),
    linear-gradient(180deg, #0b1b9b 0%, #060a5a 100%);
}

.tunnel-scan {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: repeating-linear-gradient(
    180deg,
    transparent 0 2px,
    rgba(255,255,255,0.045) 2px 3px
  );
  opacity: 0.42;
}

.tunnel-fog {
  position: absolute;
  inset: 0;
  z-index: 3;
  background:
    radial-gradient(ellipse at 50% 55%, rgba(126, 154, 255, 0.18) 0%, rgba(30, 40, 92, 0.08) 38%, rgba(6, 7, 22, 0.62) 100%),
    linear-gradient(180deg, rgba(0,0,0,0.05), rgba(0,0,0,0.35));
  mix-blend-mode: screen;
  animation: tunnel-breathe 5s ease-in-out infinite;
}

.tunnel-ceiling,
.tunnel-floor {
  position: absolute;
  left: 50%;
  z-index: 4;
  width: 84%;
  height: 34%;
  transform: translateX(-50%);
  background:
    linear-gradient(180deg, #5a589d 0%, #444386 100%);
  border: 3px solid #111235;
  box-shadow:
    inset 0 0 0 2px #6f6cc4,
    inset 0 -2px 0 0 #37356d,
    inset 0 2px 0 0 #6866b0;
}

.tunnel-ceiling {
  top: -7%;
  clip-path: polygon(0 0, 100% 0, 67% 100%, 33% 100%);
}

.tunnel-floor {
  bottom: -7%;
  clip-path: polygon(33% 0, 67% 0, 100% 100%, 0 100%);
}

.tunnel-left-wall,
.tunnel-right-wall {
  position: absolute;
  z-index: 5;
  top: 14%;
  bottom: 14%;
  width: 34%;
  background:
    radial-gradient(circle at 18% 12%, rgba(255,255,255,.35) 0 1px, transparent 1px 10px),
    radial-gradient(circle at 76% 82%, rgba(14,17,58,.9) 0 1px, transparent 1px 9px),
    repeating-linear-gradient(180deg, transparent 0 24px, #171a45 24px 27px),
    repeating-linear-gradient(90deg, #171a45 0 2px, transparent 2px 36px),
    repeating-linear-gradient(90deg, transparent 0 18px, #171a45 18px 20px, transparent 20px 54px),
    linear-gradient(180deg, #d5d6df 0%, #9f9fac 100%);
  border: 3px solid #111235;
  box-shadow:
    inset 0 0 0 2px #d8d7e0,
    inset 0 0 0 4px #888796;
}

.tunnel-left-wall {
  left: -4%;
  clip-path: polygon(0 0, 100% 25%, 100% 75%, 0 100%);
}

.tunnel-right-wall {
  right: -4%;
  clip-path: polygon(0 25%, 100% 0, 100% 100%, 0 75%);
}

.tunnel-left-wall::after,
.tunnel-right-wall::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(0,0,0,.18), transparent 36%, transparent 64%, rgba(0,0,0,.22));
  pointer-events: none;
}

.tunnel-back {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 7;
  width: 28%;
  height: 44%;
  transform: translate(-50%, -50%);
  background:
    radial-gradient(circle at 12% 22%, rgba(255,255,255,.28) 0 1px, transparent 1px 8px),
    radial-gradient(circle at 78% 76%, rgba(16,19,62,.95) 0 1px, transparent 1px 8px),
    repeating-linear-gradient(180deg, transparent 0 36px, #151844 36px 39px),
    repeating-linear-gradient(90deg, #151844 0 2px, transparent 2px 56px),
    repeating-linear-gradient(90deg, transparent 0 28px, #151844 28px 30px, transparent 30px 84px),
    linear-gradient(180deg, #5b59a2 0%, #44427f 100%);
  border: 3px solid #111235;
  box-shadow:
    inset 0 0 0 2px #6f6cc4,
    inset 0 0 0 4px #4b4895;
}

.tunnel-exit {
  position: absolute;
  left: 50%;
  top: 36%;
  z-index: 14;
  transform: translateX(-50%);
  font-family: 'VT323', monospace;
  font-size: clamp(14px, 1.9vw, 22px);
  letter-spacing: 2px;
  color: #ffffff;
  background: #9a2121;
  border: 2px solid #ffffff;
  padding: 1px 10px;
  line-height: 1.1;
  box-shadow: 0 0 0 2px #111235, 0 0 10px rgba(220,40,40,0.45);
  text-shadow: 1px 1px 0 #7a1a1a;
  animation: exit-flicker 2.2s steps(2, end) infinite;
}

.tunnel-void {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 13;
  width: 8.5%;
  height: 26%;
  transform: translate(-50%, -50%);
  background: #010109;
  border: 3px solid #0a0a1e;
  box-shadow:
    0 0 0 2px #aeb0c6,
    0 0 0 5px #111235;
}

.menu-preview::before,
.menu-preview::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  z-index: 16;
  height: 4px;
  background: #0f0f30;
  opacity: 0.85;
}

.menu-preview::before { top: 0; }
.menu-preview::after { bottom: 0; }

.menu-preview > .tunnel-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(0,0,0,0.62) 100%);
  pointer-events: none;
}

.menu-preview-label {
  position: absolute; bottom: 10px; left: 0; right: 0;
  z-index: 17;
  text-align: center;
  font-family: 'VT323', monospace;
  font-size: 18px; color: #1b1b56; letter-spacing: 3px;
  text-shadow: 1px 0 #05061b, -1px 0 #05061b;
  animation: blink-dim 2s step-end infinite;
}
@keyframes blink-dim { 0%,100%{opacity:1} 50%{opacity:0.2} }
@keyframes tunnel-breathe { 0%,100%{opacity:0.78} 50%{opacity:1} }
@keyframes exit-flicker { 0%,100%{opacity:1} 50%{opacity:.72} }

.menu-menu {
  width: min(780px, 86vw);
  margin: 6px auto 0;
  display: flex; justify-content: center; align-items: flex-start; gap: 120px;
}
.menu-col { display: grid; gap: 12px; min-width: 240px; }
.menu-btn {
  font-family: 'VT323', monospace;
  font-size: clamp(44px, 4.6vw, 76px);
  padding: 2px 0; text-align: left;
  color: #4a5a7a; border: 0; background: transparent;
  cursor: pointer; line-height: 0.94; white-space: nowrap;
  transition: color 0.08s;
}
.menu-btn.active, .menu-btn:hover { color: #d8e5fa; }

.menu-foot {
  margin-top: 10px; font-size: 21px;
  color: #3a4a62; text-align: center; letter-spacing: 1px;
}

.options-panel {
  width: min(780px, 86vw);
  margin: 14px auto 0;
  padding: 12px 16px;
  border: 2px solid #1e3060;
  background: rgba(6, 10, 22, 0.96);
  display: none;
}
.options-panel.show { display: block; }
.opt-row {
  display: grid;
  grid-template-columns: 160px 1fr 56px;
  gap: 10px; align-items: center;
  color: #b0c0e0; font-size: 26px; margin-bottom: 8px;
}
.opt-row input[type="range"] { width: 100%; accent-color: #7a94c8; }

/* ══════════════════ OVERLAY ROOT ══════════════════ */

#overlay-root {
  position: absolute; inset: 0;
  z-index: 15; pointer-events: none;
}

/* ══════════════════ PANELS ══════════════════ */

.game-panel {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: min(680px, 88vw);
  max-height: 74vh; overflow-y: auto;
  border: 2px solid var(--panel-border);
  outline: 1px solid var(--panel-border2);
  background: var(--panel-bg);
  box-shadow: 0 24px 64px rgba(0,0,0,0.8);
  color: var(--text);
  font-family: 'VT323', monospace;
  padding: 16px 20px;
  display: none; pointer-events: auto;
}
.panel-wide { width: min(860px, 94vw); }

.panel-title {
  font-size: 38px; line-height: 1;
  color: #b87040;
  border-bottom: 1px solid #1a2840;
  padding-bottom: 8px; margin-bottom: 12px;
}
.panel-body p {
  font-size: 24px; color: #c0d4ff;
  margin-bottom: 6px; line-height: 1.1;
}
.panel-body kbd {
  font-family: 'VT323', monospace;
  font-size: 22px; color: #d8e8ff;
  background: rgba(30,45,80,0.6);
  border: 1px solid #3a5080;
  padding: 0 6px; border-radius: 2px;
}

/* ══════════════════ JOURNAL ══════════════════ */

.journal-header {
  display: flex; align-items: center;
  justify-content: space-between; margin-bottom: 10px;
}
.journal-header span { font-size: 19px; color: var(--text-dim); }
.journal-filters { display: flex; gap: 6px; }
.jfilter {
  font-family: 'VT323', monospace; font-size: 19px;
  padding: 2px 10px;
  background: rgba(10,18,34,0.8); border: 1px solid #25406a;
  color: #6a7a9a; cursor: pointer;
}
.jfilter.active, .jfilter:hover { color: var(--text); border-color: #4a70b0; }

.panel-journal-list {
  display: grid; gap: 5px;
  max-height: 52vh; overflow-y: auto; padding-right: 4px;
}
.panel-journal-item {
  font-size: 20px; color: #c0d4ff;
  border-left: 2px solid #25406a;
  padding: 3px 8px; line-height: 1.15;
  font-family: 'Crimson Text', serif;
}
.panel-journal-item.is-secret {
  border-left-color: var(--secret-color);
  color: #dfc090;
}

/* ══════════════════ FORUM ══════════════════ */

.forum-layout {
  display: grid; grid-template-columns: 240px 1fr;
  gap: 10px; max-height: 56vh;
}
.forum-threads {
  border: 1px solid #1e3050; padding: 8px;
  overflow-y: auto; background: rgba(6,10,20,0.7);
}
.forum-thread-btn {
  width: 100%;
  background: rgba(8,14,28,0.6); border: 1px solid #162440;
  color: #7a8aaa; font-family: 'VT323', monospace; font-size: 20px;
  text-align: left; padding: 5px 8px; margin-bottom: 5px;
  cursor: pointer; display: block; line-height: 1.15;
}
.forum-thread-btn:hover, .forum-thread-btn.active {
  color: var(--text); border-color: #4a70b0;
  background: rgba(16,26,50,0.9);
}
.forum-right { display: flex; flex-direction: column; gap: 8px; overflow: hidden; }
.forum-post {
  flex: 1; border: 1px solid #1e3050; padding: 10px 14px;
  overflow-y: auto; min-height: 200px;
  font-family: 'Crimson Text', serif; font-size: 19px;
  line-height: 1.45; color: #d0dfff;
  white-space: pre-wrap; background: rgba(6,10,20,0.8);
}
.forum-action-btn {
  border: 1px solid #1e3050; background: rgba(8,14,28,0.9);
  color: var(--text); font-family: 'VT323', monospace;
  font-size: 22px; padding: 4px 14px;
  cursor: pointer; align-self: flex-start;
}
.forum-action-btn:hover { border-color: #4a70b0; color: #fff; }
.forum-type-label { font-size: 18px; color: var(--text-dim); margin-bottom: 5px; }
.forum-type-input {
  width: 100%; background: rgba(6,10,20,0.9); border: 1px solid #1e3050;
  color: var(--text); font-family: 'Crimson Text', serif; font-size: 18px;
  padding: 8px; resize: none; outline: none; display: block;
}
.forum-type-input:focus { border-color: #4a70b0; }

/* ══════════════════ MISC UI ══════════════════ */

#photo-indicator {
  position: absolute; top: 28px; left: 50%;
  transform: translateX(-50%);
  font-family: 'VT323', monospace; font-size: 21px;
  color: #fff; background: rgba(0,0,0,0.75);
  border: 1px solid #555; padding: 4px 18px;
  pointer-events: none; display: none;
}

#controls-fab {
  position: absolute; right: 28px; bottom: 236px;
  z-index: 16;
  font-family: 'VT323', monospace; font-size: 27px;
  color: var(--text); border: 2px solid #1e3050;
  background: rgba(6,10,22,0.92); padding: 4px 12px;
  cursor: pointer; pointer-events: auto;
}
#controls-fab:hover { color: #fff; border-color: #4a70b0; }

/* ══════════════════ SCROLLBARS ══════════════════ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #06080e; }
::-webkit-scrollbar-thumb { background: #1e3050; }
::-webkit-scrollbar-thumb:hover { background: #4a70b0; }