/* =============================================================
   MAP.CSS: styles for the Quest Map page only
   =============================================================
   Used by: index.html (the hero screens and the map).
   Goes with: css/site.css, which has the colors, buttons and
   pop-up look both pages share. index.html links site.css FIRST
   and this file after it, so rules here win when both say something.

   Sections:
     1. The page (body, width)
     2. Header
     3. World hint and buttons
     4. Worlds
     5. Cards
     6. Locked worlds and the padlock
     7. Details pop-up
     8. Footer and toast
     9. Hero screens (title, new hero, continue ...)
    10. Top bar: who is playing
    11. Secret mode
   ============================================================= */


/* ---------- 1. THE PAGE ---------- */
/* (The colors, the font and the dark background are in site.css.) */
body {
  padding: 32px 16px 64px;
  /* two soft glows, pink top-left and cyan top-right */
  background-image:
    radial-gradient(circle at 15% 0%, #2a0f3a 0%, transparent 40%),
    radial-gradient(circle at 85% 10%, #0f2f3a 0%, transparent 40%);
}

.wrap { max-width: 1200px; margin: 0 auto; }

/* ---------- 2. HEADER ---------- */
h1 {
  font-family: "Press Start 2P", monospace;
  font-size: clamp(20px, 4.5vw, 38px);
  line-height: 1.4;
  margin: 0 0 12px;
  background: linear-gradient(90deg, var(--pink), var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.subtitle { color: var(--muted); font-size: 17px; margin: 0 0 24px; max-width: 640px; line-height: 1.5; }

/* The small line under the main heading: "The Map of Worlds" */
.tagline { color: var(--cyan); font-size: 16px; letter-spacing: 2px; text-transform: uppercase; margin: 0 0 16px; }
.screen .tagline { text-align: center; }

/* ---------- 3. WORLD HINT: how far to the next world? ---------- */
.world-hint {
  background: var(--panel);
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

/* A button that can't be clicked yet (e.g. "Start my journey" before
   "I wrote it down" is ticked). The other buttons are in site.css. */
.btn:disabled { background: #252c4d; color: var(--muted); cursor: not-allowed; }

/* ---------- 4. WORLDS ---------- */
.world { margin: 48px 0; }
.world-head {
  border-left: 6px solid var(--world-color);
  padding: 4px 0 4px 16px;
  margin-bottom: 18px;
}
.world-num {
  font-family: "Press Start 2P", monospace;
  font-size: 12px;
  color: var(--world-color);
}
.world-head h2 {
  font-family: "Press Start 2P", monospace;
  font-size: clamp(16px, 3vw, 22px);
  margin: 10px 0 8px;
}
.world-head p { margin: 0; color: var(--muted); }
/* An extra line under a world's heading, like "Secret world: best after World 5." */
.world-head p.world-note { margin-top: 6px; color: var(--world-color); font-size: 14px; }
.world-lock {
  display: none;
  margin-top: 10px;
  font-family: "Press Start 2P", monospace;
  font-size: 10px;
  color: var(--muted);
}
.world.locked .world-lock { display: inline-block; }
.world.locked .world-head { border-left-color: var(--border); }

/* A world that just opened glows for a moment (see js/map.js, section 4) */
.world.just-opened { animation: just-opened 1.6s ease-out; }
@keyframes just-opened {
  0%   { box-shadow: -8px 0 40px var(--world-color); }
  100% { box-shadow: none; }
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}

/* ---------- 5. CARDS ---------- */
.card {
  position: relative;
  background: var(--panel);
  border: 2px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.card:hover, .card:focus-visible {
  transform: translateY(-4px);
  border-color: var(--world-color);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  outline: none;
}
.card canvas { display: block; width: 100%; height: auto; background: #05060d; }
.card .info { padding: 12px 14px 16px; }
.card h3 { font-family: "Press Start 2P", monospace; font-size: 12px; line-height: 1.6; margin: 0 0 8px; }
.card p { margin: 8px 0 0; color: var(--muted); font-size: 14px; line-height: 1.45; }

.meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tag { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: #20264a; color: var(--text); }
.tag.ct { background: #3a1430; color: #ff9be8; }
.tag.guide { background: #12351c; color: #7dff7a; }

/* badges in the top-left corner of a card */
.badge {
  position: absolute;
  top: 10px; left: 10px;
  font-family: "Press Start 2P", monospace;
  font-size: 9px;
  padding: 6px 8px;
  border-radius: 6px;
}
.badge.start { background: var(--pink); color: #fff; }
.badge.cleared { background: var(--gold); color: #000; display: none; }
.card.cleared .badge.cleared { display: block; }
.card.cleared .badge.start { display: none; }
.card.cleared { border-color: var(--gold); }

/* ---------- 6. LOCKED WORLDS ---------- */
/* locked worlds: grey, dark, with a BIG pixel padlock on top */
.lock {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 2;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(5, 6, 13, 0.72);
}
.world.locked .lock { display: flex; }
.lock svg {
  width: 42%;
  max-width: 130px;
  height: auto;
  image-rendering: pixelated;
  filter: drop-shadow(4px 4px 0 #000);
  animation: wobble 1.6s steps(2) infinite;   /* steps(2) = jerky, like an old game */
}
.lock span {
  font-family: "Press Start 2P", monospace;
  font-size: 12px;
  color: var(--gold);
  text-shadow: 2px 2px 0 #000;
  letter-spacing: 2px;
}
@keyframes wobble {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
.world.locked .card canvas { filter: grayscale(1) brightness(0.45); }
.world.locked .card .info { opacity: 0.45; }

/* ---------- 7. DETAILS POP-UP ---------- */
/* The rest of the pop-up look is in site.css.
   The border takes the world's color (pink if there is none). */
dialog {
  border: 2px solid var(--world-color, var(--pink));
  padding: 0;
  max-width: 560px;
}
dialog canvas { display: block; width: 100%; height: auto; background: #05060d; }
.dlg-body { padding: 18px 20px 20px; }
.dlg-body h2 { font-family: "Press Start 2P", monospace; font-size: 16px; line-height: 1.5; margin: 0 0 8px; }
.dlg-body h4 { margin: 18px 0 6px; font-size: 14px; color: var(--cyan); text-transform: uppercase; letter-spacing: 1px; }
.dlg-body ul { margin: 0; padding-left: 20px; line-height: 1.6; }
.dlg-body p { line-height: 1.5; }
/* "You'll need: classes ✗ · arrays ✗ (Purple Rain)" (js/map.js, section 5) */
.needs { font-size: 14px; color: var(--muted); }
.needs b { color: var(--text); }
.buttons { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; }

/* ---------- 8. FOOTER + TOAST ---------- */
footer { margin-top: 56px; color: var(--muted); font-size: 14px; line-height: 1.6; max-width: 680px; }
footer code { background: #20264a; padding: 2px 6px; border-radius: 4px; color: var(--cyan); }

#toast {
  position: fixed;
  left: 50%; bottom: 24px;
  transform: translateX(-50%) translateY(140px);
  background: var(--gold);
  color: #000;
  font-family: "Press Start 2P", monospace;
  font-size: 11px;
  line-height: 1.6;
  padding: 14px 18px;
  border-radius: 10px;
  transition: transform 0.3s;
  z-index: 10;
  max-width: calc(100% - 32px);
}
#toast.show { transform: translateX(-50%) translateY(0); }

/* ---------- 9. HERO SCREENS (title, new hero, continue ...) ---------- */
.screen { max-width: 720px; margin: 0 auto; }
.screen h1 { text-align: center; }
.center { text-align: center; }
.muted { color: var(--muted); }
.panel {
  background: var(--panel);
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 28px 24px;
  margin-top: 24px;
}
.panel h2 { font-family: "Press Start 2P", monospace; font-size: 16px; line-height: 1.5; margin: 0 0 14px; }
.panel p { line-height: 1.55; }
.row { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 20px; }
.btn.ghost { background: none; color: var(--muted); text-decoration: underline; padding: 8px; }

.text-input {
  width: 100%;
  font: 600 16px Inter, sans-serif;
  background: var(--bg);
  color: var(--text);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 13px 14px;
}
.text-input:focus { outline: none; border-color: var(--cyan); }
.text-input.code { font: 14px "Press Start 2P", monospace; text-transform: uppercase; color: var(--gold); letter-spacing: 1px; }
.small-label { display: block; font-size: 13px; color: var(--muted); margin: 0 0 6px; }

/* two big buttons side by side (title screen, "Is this your own computer?") */
.choices { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin-top: 28px; }
.choice {
  text-align: left;
  background: var(--panel);
  color: var(--text);
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 22px;
  cursor: pointer;
  font: inherit;
  transition: transform 0.1s, border-color 0.1s;
}
.choice:hover, .choice:focus-visible { transform: translateY(-3px); border-color: var(--cyan); outline: none; }
.choice .big { font-size: 34px; }
.choice b { display: block; font-family: "Press Start 2P", monospace; font-size: 13px; margin: 12px 0 8px; line-height: 1.5; }
.choice span { color: var(--muted); font-size: 14px; }

/* the three word tiles: POWER, ANIMAL, PLACE */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 22px 0 10px; }
.tile {
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 16px 6px 12px;
  text-align: center;
  min-height: 110px;
}
.tile .icon { font-size: 32px; height: 40px; }
.tile .word { font-family: "Press Start 2P", monospace; font-size: clamp(9px, 2.6vw, 13px); margin-top: 10px; color: var(--border); word-break: break-word; }
.tile .kind { font-size: 11px; color: var(--muted); margin-top: 8px; text-transform: uppercase; letter-spacing: 1px; }
.tile.revealed { border-color: var(--gold); animation: pop 0.35s ease-out; }
.tile.revealed .word { color: var(--gold); }
.tile.known { border-color: var(--muted); }      /* NEUTRAL on purpose: "in the list", not "right" */
.tile.known .word { color: var(--text); }
.tile.unknown .word { color: var(--muted); }
@keyframes pop {
  0% { transform: scale(0.6); opacity: 0; }
  70% { transform: scale(1.08); }
  100% { transform: scale(1); opacity: 1; }
}
.hero-title { text-align: center; font-size: 19px; margin: 8px 0 0; min-height: 28px; }
.hero-title b { color: var(--cyan); }

.typo { font-size: 14px; color: var(--gold); text-align: center; min-height: 20px; margin: 6px 0 0; line-height: 1.9; }
.typo button { font: inherit; font-weight: 600; color: var(--cyan); background: none; border: none; padding: 0; text-decoration: underline; cursor: pointer; }
.error { color: #ff5d6c; font-size: 14px; min-height: 20px; margin-top: 10px; text-align: center; }

.note {
  background: #2b220055;
  border: 2px dashed var(--gold);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.5;
  margin-top: 18px;
}
.check { display: flex; gap: 12px; align-items: flex-start; margin-top: 18px; cursor: pointer; font-size: 15px; }
.check input { width: 22px; height: 22px; accent-color: var(--gold); margin: 0; flex: none; }

/* ---------- 10. TOP BAR: who is playing ---------- */
.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  background: var(--panel);
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 10px 14px;
  margin-bottom: 24px;
}
.hero-badge { display: flex; gap: 10px; align-items: center; }
.hero-badge .icon { font-size: 28px; }
.hero-badge b { display: block; font-size: 15px; }
.hero-badge small { color: var(--muted); font-size: 12px; }
.topbar-buttons { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.remember-pill {
  font: 12px Inter, sans-serif;
  padding: 6px 10px;
  border: none;
  border-radius: 999px;
  background: var(--border);
  color: var(--muted);
  cursor: pointer;
}
.remember-pill:hover { color: var(--text); }
.logout-code { font: 13px "Press Start 2P", monospace; color: var(--gold); line-height: 1.6; text-align: center; }

/* ---------- 11. 🤫 SECRET MODE ---------- */
.party canvas { animation: rainbow 2s linear infinite; }
@keyframes rainbow { to { filter: hue-rotate(360deg); } }
