:root {
  --bg: #07100c;
  --panel: rgba(8, 20, 14, .92);
  --panel-2: rgba(15, 35, 23, .92);
  --text: #e8f5dc;
  --muted: #9ead99;
  --green: #8df26d;
  --acid: #c4ff3d;
  --amber: #f0b643;
  --red: #ff5f5f;
  --border: rgba(141, 242, 109, .28);
  --shadow: rgba(0, 0, 0, .55);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); color: var(--text); }
body {
  margin: 0;
  min-height: 100vh;
  font: 16px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(141, 242, 109, .15), transparent 34rem),
    linear-gradient(rgba(7, 16, 12, .90), rgba(7, 16, 12, .97)),
    var(--bg-image);
  background-size: cover;
  background-attachment: fixed;
}

.noise {
  pointer-events: none;
  position: fixed;
  inset: 0;
  opacity: .14;
  background-image: repeating-linear-gradient(0deg, transparent 0 2px, rgba(255,255,255,.04) 3px 4px);
}

.shell {
  width: min(1100px, calc(100% - 28px));
  margin: 0 auto;
  padding: 24px 0 70px;
}

a { color: var(--acid); }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
pre { white-space: pre-wrap; }

.topbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  margin: 0 0 20px;
}
.topbar a {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 12px;
  text-decoration: none;
  color: var(--text);
  background: rgba(0,0,0,.25);
}
.topbar a:hover { border-color: var(--acid); color: var(--acid); }

.panel, .login-card {
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: 0 24px 70px var(--shadow);
  border-radius: 20px;
  padding: 26px;
  margin: 20px 0;
  backdrop-filter: blur(10px);
}

.login-card { max-width: 560px; margin: 8vh auto; }
.terminal-head { margin: 28px 0 18px; }
.eyebrow, .stamp {
  color: var(--acid);
  letter-spacing: .18em;
  text-transform: uppercase;
  font-weight: 800;
  font-size: .78rem;
}
.danger-stamp { color: var(--red); }
h1 { margin: 6px 0 10px; font-size: clamp(2rem, 5vw, 4rem); line-height: .96; }
h2 { margin: 0 0 14px; }
.muted { color: var(--muted); }
.console-hint { color: var(--muted); font-size: .92rem; }

.stack { display: grid; gap: 16px; }
.inline-form { display: flex; gap: 14px; flex-wrap: wrap; align-items: end; }
label { display: grid; gap: 7px; color: var(--text); font-weight: 700; }
input, textarea {
  width: 100%;
  border: 1px solid rgba(141, 242, 109, .3);
  background: rgba(0,0,0,.35);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 14px;
  outline: none;
}
input:focus, textarea:focus { border-color: var(--acid); box-shadow: 0 0 0 3px rgba(196, 255, 61, .12); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(196, 255, 61, .55);
  color: #07100c;
  background: linear-gradient(180deg, var(--acid), var(--green));
  padding: 12px 18px;
  border-radius: 12px;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(141, 242, 109, .18);
}
.btn.secondary { color: var(--text); background: transparent; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.nav-actions { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }

.alert {
  border-radius: 14px;
  padding: 12px 14px;
  margin: 14px 0;
  border: 1px solid var(--border);
  background: rgba(141, 242, 109, .08);
}
.alert.success { border-color: rgba(141, 242, 109, .6); color: var(--green); }
.alert.warning { border-color: rgba(240, 182, 67, .65); color: var(--amber); background: rgba(240, 182, 67, .08); }
.alert.danger { border-color: rgba(255, 95, 95, .65); color: var(--red); background: rgba(255, 95, 95, .08); }

.countdown {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(2rem, 8vw, 5rem);
  color: var(--acid);
  text-shadow: 0 0 20px rgba(196, 255, 61, .25);
  margin: 18px 0;
}

.folder-preview, .status-row {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.status-row {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
  margin-bottom: 20px;
}
.folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}
.folder {
  display: grid;
  gap: 8px;
  min-height: 130px;
  text-decoration: none;
  color: var(--text);
  border: 1px solid var(--border);
  background: var(--panel-2);
  border-radius: 18px;
  padding: 20px;
  transition: transform .15s ease, border-color .15s ease;
}
.folder:hover { transform: translateY(-2px); border-color: var(--acid); }
.folder.disabled { opacity: .42; pointer-events: none; filter: grayscale(.6); }
.folder span { color: var(--muted); }

.hint-grid, .item-grid, .map-layers {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 20px 0;
}
.tiny-item, .choice-card, .map-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(0,0,0,.24);
  color: var(--text);
  padding: 14px;
}
.tiny-item { cursor: help; }
.choice-card { cursor: pointer; min-height: 76px; display: flex; align-items: center; gap: 10px; font-weight: 900; }
.choice-card.selected { border-color: var(--acid); box-shadow: inset 0 0 0 1px rgba(196, 255, 61, .45); }
.choice-card input { width: auto; }

.mail-folder h2 { display: flex; justify-content: space-between; gap: 14px; }
.mail-list { display: grid; gap: 12px; margin-bottom: 4px; }
.mail-row {
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  background: rgba(0,0,0,.18);
  padding: 16px;
  display: grid;
  gap: 4px;
  color: var(--text);
  text-decoration: none;
}
.mail-row:hover { border-color: var(--acid); transform: translateY(-1px); }
.mail-row.locked { opacity: .45; filter: grayscale(.6); }
.mail-row.read { background: rgba(141, 242, 109, .05); }
.mail-from, .mail-tags, .mail-meta { color: var(--muted); font-size: .92rem; }
.mail-tags { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.mail-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
  margin-bottom: 18px;
}

.mail-open {
  position: relative;
  overflow: hidden;
  min-height: 460px;
}
.mail-open.has-qr-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--qr-bg);
  background-repeat: no-repeat;
  background-position: right 26px center;
  background-size: min(52vw, 430px);
  opacity: .135;
  mix-blend-mode: screen;
  filter: contrast(1.15) saturate(.7);
  pointer-events: none;
}
.mail-paper { position: relative; z-index: 1; max-width: 760px; }
.mail-paper p { font-size: 1.05rem; }
.fragment-clue {
  display: grid;
  gap: 6px;
  border: 1px dashed var(--border);
  border-radius: 14px;
  padding: 14px;
  margin-top: 22px;
  background: rgba(0,0,0,.32);
  color: var(--muted);
}
.captcha-panel .stamp { margin-bottom: 10px; }

.attachment {
  border: 1px dashed var(--border);
  padding: 12px;
  border-radius: 12px;
  background: rgba(0,0,0,.24);
  margin-top: 20px;
}
.map-card { display: grid; gap: 10px; text-decoration: none; color: var(--text); }
.map-card img {
  width: 100%;
  aspect-ratio: 1.4;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.04);
}
.overlay-preview {
  position: relative;
  width: min(860px, 100%);
  aspect-ratio: 1.4;
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  background: rgba(0,0,0,.24);
  margin: 18px 0;
}
.overlay-preview img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: .76;
}
.dead-drop-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(260px, .9fr);
  gap: 20px;
  align-items: start;
}
.final-location {
  border: 1px solid var(--acid);
  border-radius: 16px;
  padding: 20px;
  color: var(--acid);
  background: rgba(196, 255, 61, .08);
  font-size: 1.25rem;
  font-weight: 900;
  margin: 18px 0;
}

@media (max-width: 760px) {
  .panel, .login-card { padding: 18px; }
  .inline-form { display: grid; }
  .dead-drop-grid { grid-template-columns: 1fr; }
  .mail-open.has-qr-bg::before { background-position: center bottom; background-size: 80vw; opacity: .11; }
}

/* Image-based Caustic security questions */
.captcha-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.choice-card.has-image {
  display: grid;
  grid-template-rows: auto 1fr;
  align-items: stretch;
  min-height: 230px;
  padding: 10px;
  position: relative;
}
.choice-card.has-image input {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: 2;
  width: auto;
}
.choice-img-wrap {
  display: block;
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(0,0,0,.35);
  aspect-ratio: 1.2;
}
.choice-img-wrap img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.choice-label {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 10px 6px 2px;
}
.choice-card.has-image:has(input:checked),
.choice-card:has(input:checked) {
  border-color: var(--acid);
  box-shadow: inset 0 0 0 1px rgba(196, 255, 61, .45), 0 0 24px rgba(196, 255, 61, .10);
}
@supports not selector(:has(input:checked)) {
  .choice-card.selected {
    border-color: var(--acid);
    box-shadow: inset 0 0 0 1px rgba(196, 255, 61, .45), 0 0 24px rgba(196, 255, 61, .10);
  }
}
