:root {
  --bg: #0b0d10;
  --paper: #0f1318;
  --ink: #e8edf2;
  --muted: rgba(232, 237, 242, 0.72);
  --faint: rgba(232, 237, 242, 0.12);
  --line: rgba(232, 237, 242, 0.16);
  --accent: #ffcc66;
  --accent-2: #66d9ff;
  --bad: #ff6b6b;
  --ok: #78ffb3;
  --warn: #ffd56a;
  --radius: 18px;
  --shadow: 0 18px 55px rgba(0, 0, 0, 0.55);
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --serif: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  color: var(--ink);
  background: radial-gradient(1100px 700px at 70% -20%, rgba(255, 204, 102, 0.12), transparent 55%),
              radial-gradient(900px 600px at 10% 120%, rgba(102, 217, 255, 0.10), transparent 55%),
              linear-gradient(180deg, #07080a, #0b0d10 25%, #090b0e);
  font-family: var(--sans);
}

/* Film grain + faint rain streaks */
body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

body::before {
  background-image:
    radial-gradient(circle at 20% 30%, rgba(255,255,255,0.03), transparent 35%),
    radial-gradient(circle at 80% 60%, rgba(255,255,255,0.025), transparent 40%),
    radial-gradient(circle at 45% 80%, rgba(255,255,255,0.02), transparent 40%),
    repeating-linear-gradient(120deg, rgba(255,255,255,0.015) 0 1px, transparent 1px 7px);
  mix-blend-mode: overlay;
  opacity: 0.55;
  filter: blur(0.25px);
}

body::after {
  background-image: repeating-linear-gradient(
    100deg,
    rgba(255, 255, 255, 0.05) 0 1px,
    transparent 1px 14px
  );
  opacity: 0.06;
  transform: translateY(-10%);
  animation: rain 10s linear infinite;
}

html.reduced-motion body::after { animation: none; }

@keyframes rain {
  0% { transform: translateY(-10%); }
  100% { transform: translateY(10%); }
}

/* Full-page unlock feedback flash (green/red) */
html::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  opacity: 0;
  transition: opacity 180ms ease;
  background: transparent;
}

html.unlock-ok::before {
  opacity: 0.22;
  background: radial-gradient(900px 520px at 50% 30%, rgba(120, 255, 179, 0.55), transparent 60%),
              radial-gradient(1200px 700px at 50% 120%, rgba(120, 255, 179, 0.25), transparent 60%);
}

html.unlock-bad::before {
  opacity: 0.22;
  background: radial-gradient(900px 520px at 50% 30%, rgba(255, 107, 107, 0.55), transparent 60%),
              radial-gradient(1200px 700px at 50% 120%, rgba(255, 107, 107, 0.25), transparent 60%);
}

html.modal-open {
  overflow: hidden;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(6px);
}

.modal {
  width: min(720px, 100%);
  border-radius: 20px;
  border: 1px solid rgba(232, 237, 242, 0.18);
  background: linear-gradient(180deg, rgba(15, 19, 24, 0.98), rgba(10, 12, 15, 0.96));
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.7);
  padding: 16px;
  transform: translateY(6px) scale(0.98);
  opacity: 0;
  animation: modalIn 140ms ease-out forwards;
}

@keyframes modalIn {
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.modal h2 {
  margin: 0 0 10px;
  font-family: var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 12px;
  color: rgba(232, 237, 242, 0.88);
}

.modal p {
  margin: 0;
  line-height: 1.55;
  color: rgba(232, 237, 242, 0.9);
}

.modal.success {
  border-color: rgba(120, 255, 179, 0.6);
  background: linear-gradient(180deg, rgba(14, 26, 20, 0.98), rgba(9, 16, 12, 0.96));
  box-shadow:
    0 0 0 1px rgba(120, 255, 179, 0.22) inset,
    0 0 42px rgba(120, 255, 179, 0.34),
    0 30px 90px rgba(0, 0, 0, 0.7);
}

.modal.success h2 {
  color: rgba(190, 255, 221, 0.98);
}

.modal.success .btn.primary {
  border-color: rgba(120, 255, 179, 0.65);
  background: rgba(120, 255, 179, 0.12);
  box-shadow: 0 0 0 1px rgba(120, 255, 179, 0.2) inset;
}

.modal-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
  justify-content: flex-end;
}

.btn.danger {
  border-color: rgba(255, 107, 107, 0.35);
  background: rgba(255, 107, 107, 0.06);
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover { text-decoration: underline; }

.wrap {
  position: relative;
  z-index: 1;
  max-width: 1060px;
  margin: 0 auto;
  padding: 12px 10px 28px;
}

header.site {
  display: grid;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand h1 {
  margin: 0;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: var(--mono);
  font-size: 16px;
  color: rgba(232, 237, 242, 0.9);
}

.brand .tagline {
  margin: 0;
  font-family: var(--serif);
  color: var(--muted);
  font-style: italic;
}

nav.case-nav {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.nav-steps {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  padding: 0;
  margin: 0;
}

.nav-step a {
  display: block;
  padding: 10px 10px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  text-align: center;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.nav-step.is-current a {
  border-color: rgba(255, 204, 102, 0.65);
  background: rgba(255, 204, 102, 0.08);
  box-shadow: 0 0 0 1px rgba(255, 204, 102, 0.08) inset;
}

.nav-step.is-unlocked a:hover {
  transform: translateY(-1px);
  border-color: rgba(102, 217, 255, 0.55);
  background: rgba(102, 217, 255, 0.06);
}

.nav-step.is-locked a {
  opacity: 0.45;
  cursor: not-allowed;
}

.grid {
  margin-top: 8px;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 8px;
}

@media (max-width: 920px) {
  .grid { grid-template-columns: 1fr; }
  .nav-steps {
    display: flex;
    overflow-x: auto;
    padding-bottom: 6px;
    scroll-snap-type: x mandatory;
  }
  .nav-step { scroll-snap-align: start; }
  .nav-step a { min-width: 160px; }
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.015));
  box-shadow: var(--shadow);
  padding: 10px;
}

.case-title {
  margin: 0 0 6px;
  font-family: var(--serif);
  font-size: 28px;
  letter-spacing: 0.02em;
}

.case-sub {
  margin: 0 0 10px;
  color: var(--muted);
  font-family: var(--mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 12px;
}

.lede {
  margin: 0 0 14px;
  color: rgba(232, 237, 242, 0.86);
  line-height: 1.6;
}

.rule {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line), transparent);
  margin: 12px 0;
}

.img-slot {
  border-radius: 16px;
  overflow: hidden;
  border: 1px dashed rgba(232, 237, 242, 0.35);
  background: rgba(0, 0, 0, 0.25);
  aspect-ratio: 16 / 9;
  max-height: 260px;
}

.img-slot img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.img-caption {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  font-family: var(--mono);
}

.kicker {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 12px 0 0;
}

.pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 10px;
  font-family: var(--mono);
  font-size: 12px;
  color: rgba(232, 237, 242, 0.85);
  background: rgba(255, 255, 255, 0.02);
}

.pill strong {
  color: rgba(255, 204, 102, 0.9);
  font-weight: 700;
}

.side h3 {
  margin: 0 0 10px;
  font-family: var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 12px;
  color: rgba(232, 237, 242, 0.88);
}

ul.clean {
  margin: 0;
  padding-left: 18px;
  color: rgba(232, 237, 242, 0.82);
  line-height: 1.55;
}

.box {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.22);
}

.unlock {
  display: grid;
  gap: 10px;
}

.unlock label {
  font-family: var(--mono);
  font-size: 12px;
  color: rgba(232, 237, 242, 0.85);
}

.pw-field {
  display: flex;
  gap: 6px;
  align-items: center;
}

.pw-field input {
  flex: 1;
  min-width: 0;
  border-radius: 14px;
  padding: 10px 12px;
  border: 1px solid rgba(232, 237, 242, 0.22);
  background: rgba(15, 19, 24, 0.9);
  color: var(--ink);
  font-family: var(--mono);
  outline: none;
}

.pw-field input:focus {
  border-color: rgba(102, 217, 255, 0.7);
  box-shadow: 0 0 0 4px rgba(102, 217, 255, 0.12);
}

html.unlock-ok .pw-field input {
  border-color: rgba(120, 255, 179, 0.65);
  box-shadow: 0 0 0 4px rgba(120, 255, 179, 0.12);
}

html.unlock-bad .pw-field input {
  border-color: rgba(255, 107, 107, 0.65);
  box-shadow: 0 0 0 4px rgba(255, 107, 107, 0.12);
  animation: shake 240ms ease-in-out 1;
}

.pw-toggle {
  flex-shrink: 0;
  font-size: 11px;
  padding: 9px 10px;
}

@keyframes shake {
  0% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  50% { transform: translateX(4px); }
  75% { transform: translateX(-3px); }
  100% { transform: translateX(0); }
}

.btn-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

button, .btn {
  border-radius: 14px;
  padding: 9px 12px;
  border: 1px solid rgba(232, 237, 242, 0.22);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(232, 237, 242, 0.92);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.03em;
  cursor: pointer;
}

button:hover, .btn:hover {
  border-color: rgba(255, 204, 102, 0.65);
  background: rgba(255, 204, 102, 0.08);
  text-decoration: none;
}

.btn.primary {
  border-color: rgba(102, 217, 255, 0.55);
  background: rgba(102, 217, 255, 0.07);
}

.gate-status {
  margin: 0;
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid rgba(232, 237, 242, 0.16);
  background: rgba(255, 255, 255, 0.02);
  font-family: var(--mono);
  font-size: 12px;
  color: rgba(232, 237, 242, 0.82);
}

.gate-status.ok {
  border-color: rgba(120, 255, 179, 0.35);
  background: rgba(120, 255, 179, 0.06);
  color: rgba(190, 255, 221, 0.95);
}

.gate-status.bad {
  border-color: rgba(255, 107, 107, 0.35);
  background: rgba(255, 107, 107, 0.06);
  color: rgba(255, 215, 215, 0.95);
}

.gate-status.warn {
  border-color: rgba(255, 213, 106, 0.35);
  background: rgba(255, 213, 106, 0.05);
  color: rgba(255, 241, 206, 0.95);
}

@media (max-height: 760px) {
  .img-slot { max-height: 200px; }
  .case-title { font-size: 26px; }
  .wrap { padding-bottom: 20px; }
  .footer { display: none; }
}

.footer {
  margin-top: 18px;
  color: rgba(232, 237, 242, 0.55);
  font-family: var(--mono);
  font-size: 11px;
  text-align: center;
}

.noscript {
  margin-top: 14px;
  border: 1px solid rgba(255, 107, 107, 0.35);
  border-radius: 16px;
  padding: 12px 14px;
  background: rgba(255, 107, 107, 0.06);
  color: rgba(255, 215, 215, 0.95);
  font-family: var(--mono);
  font-size: 12px;
}

/* ═══════════════════════════════════════════
   Level 7 — Aztec Ruins Theme
   ═══════════════════════════════════════════ */

body[data-page="7"] {
  background:
    linear-gradient(180deg, rgba(10, 14, 8, 0.72), rgba(10, 14, 8, 0.65)),
    url("images/background.png") center / cover fixed no-repeat;
  color: #d4c5a0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

body[data-page="7"] .wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 480px;
  width: 100%;
  text-align: center;
}

body[data-page="7"] .grid {
  grid-template-columns: 1fr;
  justify-items: center;
  width: 100%;
}

body[data-page="7"] .card.side {
  width: 100%;
  max-width: 420px;
}

body[data-page="7"] .brand {
  justify-content: center;
}

body[data-page="7"] .unlock {
  text-align: left;
}

body[data-page="7"] .btn-row {
  justify-content: center;
}

body[data-page="7"]::before {
  background-image:
    radial-gradient(circle at 30% 20%, rgba(201, 168, 76, 0.06), transparent 40%),
    radial-gradient(circle at 70% 70%, rgba(160, 82, 45, 0.05), transparent 40%);
  opacity: 0.4;
}

body[data-page="7"]::after {
  background-image: none;
  animation: none;
}

body[data-page="7"] header.site {
  border-color: rgba(201, 168, 76, 0.3);
  background: linear-gradient(180deg, rgba(26, 20, 10, 0.85), rgba(18, 14, 8, 0.9));
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(201, 168, 76, 0.1);
}

body[data-page="7"] .brand h1 {
  color: #c9a84c;
}

body[data-page="7"] .card {
  border-color: rgba(201, 168, 76, 0.25);
  background: linear-gradient(180deg, rgba(26, 20, 10, 0.88), rgba(18, 14, 8, 0.92));
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(201, 168, 76, 0.08);
}

body[data-page="7"] .side h3 {
  color: #c9a84c;
}

body[data-page="7"] .box {
  border-color: rgba(201, 168, 76, 0.2);
  background: rgba(18, 14, 8, 0.6);
}

body[data-page="7"] .unlock label {
  color: rgba(212, 197, 160, 0.85);
}

body[data-page="7"] .pw-field input {
  border: 2px solid rgba(201, 168, 76, 0.35);
  background: rgba(18, 14, 8, 0.85);
  color: #d4c5a0;
}

body[data-page="7"] .pw-field input:focus {
  border-color: rgba(201, 168, 76, 0.75);
  box-shadow: 0 0 0 4px rgba(201, 168, 76, 0.15), 0 0 20px rgba(201, 168, 76, 0.08);
}

body[data-page="7"] button,
body[data-page="7"] .btn {
  border-color: rgba(201, 168, 76, 0.3);
  background: rgba(201, 168, 76, 0.06);
  color: rgba(212, 197, 160, 0.92);
}

body[data-page="7"] button:hover,
body[data-page="7"] .btn:hover {
  border-color: rgba(201, 168, 76, 0.7);
  background: rgba(201, 168, 76, 0.14);
}

body[data-page="7"] .gate-status {
  border-color: rgba(201, 168, 76, 0.2);
  background: rgba(201, 168, 76, 0.04);
  color: rgba(212, 197, 160, 0.82);
}

body[data-page="7"] .gate-status.ok {
  border-color: rgba(120, 200, 100, 0.4);
  background: rgba(120, 200, 100, 0.08);
  color: rgba(180, 230, 170, 0.95);
}

body[data-page="7"] .gate-status.bad {
  border-color: rgba(200, 80, 60, 0.4);
  background: rgba(200, 80, 60, 0.08);
  color: rgba(240, 180, 170, 0.95);
}

body[data-page="7"] .gate-status.warn {
  border-color: rgba(201, 168, 76, 0.4);
  background: rgba(201, 168, 76, 0.08);
  color: rgba(230, 215, 170, 0.95);
}
