:root {
  --bg: #0F1419;
  --bg-dark: #0A0E12;
  --bar: #121920;
  --surface: #1A222C;
  --surface2: #243040;
  --surface-dim: #161D25;
  --line: #34414F;
  --fg: #E6EDF3;
  --fg-soft: #C9D3DD;
  --muted: #8B98A5;
  --cursor: #3DDC97;
  --green-bg: #16302A;
  --amber: #FFC857;
  --amber-bg: #2A2416;
  --amber-warn: #2A2016;
  --blue: #5CB8FF;
  --purple: #B69CFF;
  --cyan: #56D4DD;
  --red: #FF8A8A;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  min-height: 100vh;
}

button { font-family: inherit; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
[hidden] { display: none !important; }

.mono { font-family: 'JetBrains Mono', Menlo, Consolas, monospace; }
.muted { color: var(--muted); }
.muted-sm { color: var(--muted); font-size: 14px; }
.green { color: var(--cursor); }
.amber { color: var(--amber); }
.blue { color: var(--blue); }
.purple { color: var(--purple); }

@keyframes pmblink { 0%,49%{opacity:1} 50%,100%{opacity:0} }
@keyframes pmpulse { 0%{box-shadow:0 0 0 0 rgba(255,200,87,.55)} 70%{box-shadow:0 0 0 12px rgba(255,200,87,0)} 100%{box-shadow:0 0 0 0 rgba(255,200,87,0)} }
@keyframes pmdance { 0%{transform:translateY(0) rotate(0)} 25%{transform:translateY(-10px) rotate(-8deg)} 50%{transform:translateY(0) rotate(0)} 75%{transform:translateY(-10px) rotate(8deg)} 100%{transform:translateY(0) rotate(0)} }

.pm-cursor { animation: pmblink 1.1s steps(1) infinite; }
.pm-now { animation: pmpulse 2s infinite; }
.pm-dance { animation: pmdance .9s ease-in-out infinite; }

.app-shell { min-height: 100vh; display: flex; flex-direction: column; }

/* Brand & cursors */
.brand { display: flex; align-items: center; gap: 12px; }
.brand-lg { gap: 16px; }
.brand-cursor { width: 14px; height: 28px; background: var(--cursor); border-radius: 2px; }
.brand-cursor-lg { width: 22px; height: 40px; background: var(--cursor); border-radius: 2px; }
.brand-cursor-md { width: 16px; height: 30px; background: var(--cursor); border-radius: 2px; }
.brand-cursor-sm { width: 10px; height: 20px; background: var(--cursor); border-radius: 1px; }
.brand-name { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 20px; letter-spacing: 1px; }
.brand-name-lg { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 42px; letter-spacing: 1px; }

/* Buttons & inputs */
.btn-primary {
  min-height: 48px; padding: 0 22px; background: var(--cursor); color: var(--bg);
  border: 0; border-radius: 10px; font-size: 17px; font-weight: 700; cursor: pointer;
}
.btn-primary.btn-sm { min-height: 38px; padding: 0 16px; font-size: 14px; border-radius: 8px; }
.btn-primary.btn-lg { min-height: 56px; padding: 0 32px; font-size: 19px; border-radius: 12px; }
.btn-primary:hover { filter: brightness(1.07); }
.btn-amber {
  min-height: 46px; padding: 0 18px; background: var(--amber); color: var(--bg);
  border: 0; border-radius: 8px; font-weight: 700; font-size: 16px; cursor: pointer;
}
.btn-amber-sm {
  min-height: 34px; padding: 0 12px; background: var(--amber); color: var(--bg);
  border: 0; border-radius: 8px; font-weight: 700; font-size: 13px; cursor: pointer;
}
.btn-outline {
  min-height: 46px; padding: 0 18px; background: transparent; color: var(--fg);
  border: 1px solid var(--line); border-radius: 10px; font-size: 16px; cursor: pointer;
}
.btn-outline.btn-lg-outline {
  min-height: 56px; padding: 0 24px; border-radius: 12px; font-size: 17px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 10px; background: rgba(15, 20, 25, 0.55);
}
.btn-outline.btn-lg-outline:hover { border-color: var(--cursor); background: rgba(26, 34, 44, 0.85); }
.btn-outline-sm {
  min-height: 36px; padding: 0 14px; background: transparent; color: var(--fg);
  border: 1px solid var(--line); border-radius: 8px; font-size: 14px; cursor: pointer;
}
.link-btn { background: transparent; border: 0; color: var(--blue); font-size: 15px; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
a.link-btn { text-decoration: none; }
a.link-btn:hover { text-decoration: underline; }

.mono-input, .text-input {
  width: 100%; height: 52px; padding: 0 16px; background: var(--bg); color: var(--fg);
  border: 2px solid var(--line); border-radius: 10px; font-size: 17px;
}
.mono-input { font-family: 'JetBrains Mono', monospace; }
.error-msg { color: var(--red); font-size: 14px; margin: 4px 0 0; }

/* Welcome — full-bleed dark-mode hero + bottom 4-card dock */
.welcome-screen {
  position: relative; width: 100%; min-height: 100dvh; overflow: hidden;
  display: flex; flex-direction: column;
}
.welcome-bg {
  position: absolute; top: 76px; right: 0; bottom: 0; left: 0; z-index: 0; pointer-events: none; overflow: hidden;
}
.welcome-bg-img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: right center;
}
.welcome-bg-scrim {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, var(--bg) 0%, transparent 48px),
    linear-gradient(90deg, rgba(10, 14, 18, 0.55) 0%, rgba(10, 14, 18, 0.25) 45%, transparent 75%);
}
.welcome-bg-grid {
  position: absolute; inset: 0; opacity: 0.22;
  background-image: radial-gradient(rgba(61, 220, 151, 0.25) 1px, transparent 1px);
  background-size: 28px 28px;
  -webkit-mask-image: linear-gradient(90deg, #000 0%, transparent 55%);
  mask-image: linear-gradient(90deg, #000 0%, transparent 55%);
}
.welcome-inner {
  position: relative; z-index: 2; max-width: 1380px; width: 100%; margin: 0 auto;
  padding: 22px 36px 28px; min-height: 100dvh;
  display: flex; flex-direction: column; justify-content: space-between; gap: 20px;
}
.welcome-top { display: flex; align-items: center; justify-content: space-between; }
.welcome-top-actions { display: flex; align-items: center; gap: 14px; }
.welcome-top .link-btn {
  color: var(--fg); font-weight: 600; padding: 7px 14px; border-radius: 8px;
  background: rgba(10, 14, 18, 0.65); border: 1px solid rgba(230, 237, 243, 0.22);
  backdrop-filter: blur(8px);
}
.welcome-top .link-btn:hover { text-decoration: none; border-color: var(--fg); background: rgba(10, 14, 18, 0.85); }
.welcome-hero {
  max-width: 680px; display: flex; flex-direction: column; gap: 12px;
  margin: auto 0; padding: 12px 0 44px;
}
.hero-eyebrow { font-size: 13px; letter-spacing: 2px; color: var(--muted); margin-bottom: 10px; }
.hero-hat-badge {
  position: relative; align-self: flex-start; display: inline-flex; align-items: center;
  padding: 8px 26px; background: var(--cursor); color: var(--bg); border-radius: 6px;
  font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: clamp(24px, 2.8vw, 34px);
  line-height: 1.1; transform: rotate(-2deg); box-shadow: 0 10px 30px rgba(61, 220, 151, 0.32);
}
.hero-hat-icon {
  position: absolute; top: -21px; left: 8px; transform: rotate(-10deg);
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.5));
}
.welcome-hero h1 { margin: 4px 0 0; font-family: 'Space Grotesk', sans-serif; font-size: clamp(48px, 5.6vw, 76px); line-height: 1.0; letter-spacing: -1px; }
.welcome-hero p { margin: 4px 0 0; font-size: 19px; line-height: 1.5; color: var(--fg-soft); max-width: 560px; }
.welcome-hero .hero-audience { margin: 2px 0 0; font-size: 17px; font-weight: 600; color: var(--fg); max-width: 560px; }
.welcome-cta { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 8px; }
.hero-trust { display: flex; flex-wrap: wrap; gap: 20px; margin-top: 4px; }
.trust-item { font-size: 14px; color: var(--muted); display: inline-flex; align-items: center; gap: 7px; }

.welcome-free {
  text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 4px 0 6px; text-shadow: 0 2px 16px rgba(10, 14, 18, 0.9);
}
.welcome-free-title {
  font-family: 'Space Grotesk', sans-serif; font-weight: 700;
  font-size: clamp(24px, 2.4vw, 34px); line-height: 1.15; letter-spacing: -0.4px;
  color: var(--fg);
}
.welcome-free-sub {
  margin: 0; font-size: 17px; line-height: 1.45; color: var(--fg-soft);
}

.welcome-cards-dock {
  background: rgba(18, 25, 32, 0.78); backdrop-filter: blur(14px);
  border: 1px solid rgba(52, 65, 79, 0.85); border-radius: 18px; padding: 14px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}
.welcome-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.welcome-cards.welcome-cards-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.info-card {
  background: rgba(26, 34, 44, 0.88); border: 1px solid var(--line); border-radius: 13px;
  padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.info-card-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.card-art {
  flex-shrink: 0; width: 64px; height: 64px; border-radius: 14px;
  background: rgba(10, 14, 18, 0.75); border: 1px solid rgba(52, 65, 79, 0.8);
  display: inline-flex; align-items: center; justify-content: center;
}
.info-card p { margin: 0; font-size: 13.5px; line-height: 1.45; color: var(--fg-soft); }
.card-kicker { font-family: 'Space Grotesk', sans-serif; font-size: 16px; font-weight: 700; }
.welcome-contact { margin: -8px 0 0; text-align: center; font-size: 14px; color: var(--muted); }
.modal-contact { margin: 4px 0 0; font-size: 14px; color: var(--muted); }
.welcome-contact a, .modal-contact a { color: var(--cursor); text-decoration: none; }
.welcome-contact a:hover, .modal-contact a:hover { text-decoration: underline; }

/* Center screens (Login, Nick) */
.center-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
}
.login-box { width: 100%; max-width: 520px; display: flex; flex-direction: column; gap: 24px; }
.nick-box { width: 100%; max-width: 640px; display: flex; flex-direction: column; gap: 22px; }
.nick-title { margin: 0; font-family: 'Space Grotesk', sans-serif; font-size: 32px; }
.lead { margin: 0; font-size: 19px; line-height: 1.5; color: var(--fg-soft); }
.card-panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 24px; display: flex; flex-direction: column; gap: 12px;
}
.card-panel label { font-weight: 600; font-size: 17px; }
.login-notes { display: flex; flex-direction: column; gap: 6px; font-size: 15px; color: var(--muted); line-height: 1.5; }

.nick-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.nick-btn {
  min-height: 54px; border-radius: 12px; cursor: pointer; font-size: 16px; font-weight: 600;
  background: var(--surface); color: var(--fg); border: 2px solid var(--line);
}
.nick-btn.active { background: var(--green-bg); border-color: var(--cursor); }
.nick-warn { display: flex; align-items: center; gap: 10px; font-size: 15px; color: var(--muted); }

/* Topbar */
.app-view { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  height: 60px; flex-shrink: 0; padding: 0 28px; display: flex; align-items: center;
  justify-content: space-between; border-bottom: 1px solid var(--surface2); background: var(--bar);
}
.brand-btn {
  display: flex; align-items: center; gap: 10px; background: transparent;
  border: 0; color: var(--fg); cursor: pointer; padding: 8px 0;
}
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-code-icon, .topbar-code-label-short { display: none; }
.agent-pill { font-size: 16px; }
.diamond-pill {
  display: flex; align-items: center; gap: 6px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; font-weight: 600;
}

/* Map (scalable chaptered DAG) */
.map-layout {
  max-width: 1420px; width: 100%; margin: 0 auto; padding: 24px 28px;
  display: flex; gap: 24px; align-items: flex-start;
}
.map-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.next-mission-card {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px 24px;
}
.next-title { margin: 4px 0; font-family: 'Space Grotesk', sans-serif; font-size: 28px; }
.section-heading { margin: 0; font-family: 'Space Grotesk', sans-serif; font-size: 18px; color: var(--fg-soft); }
.map-header-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.course-map { display: flex; flex-direction: column; gap: 14px; }
.chapter-card {
  background: #121820; border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
}
.chapter-card.done { border-color: #265442; }
.chapter-card.active { border-color: #46576B; }
.chapter-head {
  width: 100%; background: var(--surface); border: 0; color: var(--fg); padding: 14px 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; text-align: left;
}
.chapter-head:hover { background: #1E2733; }
.chapter-head-left { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.chapter-pill {
  font-family: 'JetBrains Mono', monospace; font-size: 12px; font-weight: 700;
  padding: 3px 9px; border-radius: 999px; background: var(--surface2); color: var(--muted);
}
.chapter-card.done .chapter-pill { background: var(--green-bg); color: var(--cursor); }
.chapter-card.active .chapter-pill { background: var(--amber-bg); color: var(--amber); }
.chapter-title { font-family: 'Space Grotesk', sans-serif; font-size: 17px; font-weight: 700; }
.chapter-sub { font-size: 13px; color: var(--muted); }
.chapter-head-right { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); }

.dag-canvas { position: relative; padding: 22px 20px 24px; }
.dag-svg {
  position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1;
}
.dag-rows { position: relative; z-index: 2; display: flex; flex-direction: column; gap: 34px; }
.dag-row { display: flex; justify-content: center; align-items: flex-start; gap: 22px; flex-wrap: wrap; }
.dag-lanes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; align-items: start; }
.dag-lane {
  background: rgba(26, 34, 44, 0.45); border: 1px dashed #2B3746; border-radius: 14px;
  padding: 14px 16px 18px; display: flex; flex-direction: column; align-items: center; gap: 28px;
}
.dag-lane.lane-a { border-color: rgba(255, 200, 87, 0.35); }
.dag-lane.lane-b { border-color: rgba(92, 184, 255, 0.35); }
.lane-header {
  font-family: 'JetBrains Mono', monospace; font-size: 12px; font-weight: 700;
  letter-spacing: 1px; padding: 3px 10px; border-radius: 999px;
}
.lane-header.amber { background: rgba(255, 200, 87, 0.12); color: var(--amber); }
.lane-header.blue { background: rgba(92, 184, 255, 0.12); color: var(--blue); }

.dag-node {
  position: relative; width: 172px; min-height: 82px; padding: 11px 13px; border-radius: 12px;
  display: flex; flex-direction: column; gap: 6px; color: var(--fg); text-align: left;
  cursor: pointer; background: var(--surface); border: 1.5px solid var(--line);
  transition: transform .12s ease, border-color .15s ease;
}
.dag-node:hover:not(:disabled) { transform: translateY(-2px); }
.dag-node.done { background: var(--green-bg); border: 2px solid var(--cursor); }
.dag-node.now { background: var(--amber-bg); border: 2px solid var(--amber); }
.dag-node.lock { background: var(--surface-dim); opacity: 0.72; }
.dag-node.gate { width: 290px; align-items: center; text-align: center; border-width: 2px; }
.dag-node-top { display: flex; align-items: center; justify-content: space-between; width: 100%; gap: 6px; }
.dag-node-num { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--muted); }
.dag-node-icon {
  width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center;
  justify-content: center; font-size: 12px; font-weight: 700; background: var(--surface2); color: var(--muted);
}
.dag-node.done .dag-node-icon { background: var(--cursor); color: var(--bg); }
.dag-node.now .dag-node-icon { background: var(--amber); color: var(--bg); }
.dag-node-title { font-weight: 600; font-size: 14px; line-height: 1.3; }
.gate-keys { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 4px; }
.key-slot {
  font-family: 'JetBrains Mono', monospace; font-size: 11px; padding: 3px 8px;
  border-radius: 6px; background: var(--bg); border: 1px solid var(--line); color: var(--muted);
}
.key-slot.ready { border-color: var(--cursor); color: var(--cursor); background: var(--green-bg); }

.map-toast {
  background: var(--amber-warn); border: 1px solid var(--amber); border-radius: 10px;
  padding: 12px 16px; font-size: 14px; color: var(--fg);
}

.map-sidebar { width: 300px; flex-shrink: 0; display: flex; flex-direction: column; gap: 16px; }
.side-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 18px; display: flex; flex-direction: column; gap: 10px;
}
.side-head { display: flex; align-items: center; justify-content: space-between; }
.side-title { font-weight: 700; font-size: 16px; }
.diamond-text { font-size: 14px; color: var(--cyan); font-weight: 600; }
.passwords-list { display: flex; flex-direction: column; gap: 8px; }
.pw-badge-row { display: flex; justify-content: space-between; align-items: center; font-size: 14px; }
.pw-chip {
  font-family: 'JetBrains Mono', monospace; background: var(--amber); color: var(--bg);
  padding: 3px 8px; border-radius: 4px; font-weight: 700;
}
.shop-list { display: flex; flex-direction: column; }
.shop-row {
  display: flex; justify-content: space-between; align-items: center; font-size: 14px;
  padding: 8px 0; border-top: 1px solid var(--surface2);
}
.shop-buy-btn {
  background: transparent; border: 1px solid var(--line); color: var(--cyan);
  border-radius: 6px; padding: 3px 8px; font-weight: 600; cursor: pointer; font-size: 13px;
}
.shop-buy-btn.owned { color: var(--cursor); border-color: var(--cursor); cursor: default; }

/* Episode view */
.ep-layout { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.ep-subbar {
  min-height: 62px; padding: 10px 28px; display: flex; flex-wrap: wrap; align-items: center;
  gap: 20px; border-bottom: 1px solid var(--surface2);
}
.ep-header-title { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 18px; }
.ep-steps { display: flex; flex-wrap: wrap; gap: 8px; }
.step-pill {
  display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px;
  border-radius: 999px; font-size: 15px; font-weight: 600; cursor: pointer;
  background: transparent; color: var(--muted); border: 1px solid var(--surface2);
}
.step-pill.active { background: var(--surface2); color: var(--fg); border-color: var(--blue); }
.step-pill.past { color: var(--cursor); border-color: #2D5A48; }
.step-pill:disabled { cursor: default; opacity: 0.65; }
.step-num {
  display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px;
  border-radius: 50%; font-size: 13px; background: var(--surface2); color: var(--muted);
}
.step-pill.active .step-num { background: var(--blue); color: var(--bg); }
.step-pill.past .step-num { background: var(--cursor); color: var(--bg); }

.ep-center {
  flex: 1; display: flex; align-items: center; justify-content: center; padding: 28px;
}
.quiz-box { width: 100%; max-width: 720px; display: flex; flex-direction: column; gap: 18px; }
.quiz-question { margin: 0; font-family: 'Space Grotesk', sans-serif; font-size: 28px; line-height: 1.3; }
.quiz-options { display: flex; flex-direction: column; gap: 10px; }
.quiz-opt {
  display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 12px 18px;
  border-radius: 12px; font-size: 17px; text-align: left; cursor: pointer;
  color: var(--fg); background: var(--surface); border: 2px solid var(--line);
}
.quiz-opt.ok { background: var(--green-bg); border-color: var(--cursor); }
.quiz-opt.wrong { background: var(--amber-warn); border-color: var(--amber); }
.feedback-ok {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  background: var(--green-bg); border: 1px solid var(--cursor); border-radius: 12px; padding: 14px 18px;
}
.feedback-warn {
  background: var(--amber-warn); border: 1px solid var(--amber); border-radius: 12px; padding: 14px 18px;
}

.film-wrap {
  width: min(100%, 1440px, calc((100dvh - 210px) * 16 / 9));
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.film-player {
  width: 100%; aspect-ratio: 16 / 9; background: var(--bg-dark); border: 1px solid var(--line);
  border-radius: 14px; overflow: hidden; display: flex; align-items: center; justify-content: center;
}
.film-player iframe { width: 100%; height: 100%; border: 0; }
.film-placeholder { text-align: center; padding: 28px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.film-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* Mission workspace */
.mission-layout {
  flex: 1; min-height: 0; padding: 18px 28px; display: flex; gap: 18px;
}
.mobile-keyboard-banner {
  display: none; background: var(--amber-warn); border: 1px solid var(--amber);
  border-radius: 14px; padding: 16px; gap: 12px; align-items: flex-start; font-size: 15px; line-height: 1.5;
}
.terminal-pane {
  flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg-dark);
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden; min-height: 480px;
}
.terminal-bar {
  height: 46px; flex-shrink: 0; padding: 0 14px; display: flex; align-items: center;
  justify-content: space-between; background: var(--surface); border-bottom: 1px solid var(--line);
}
.term-status { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--amber); }
.status-dot.on { background: var(--cursor); }
.term-actions { display: flex; gap: 8px; }
.terminal-body { flex: 1; padding: 8px; min-height: 420px; }

.mission-sidebar { width: 420px; flex-shrink: 0; display: flex; flex-direction: column; gap: 12px; }
.mission-checklist-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 16px 18px; display: flex; flex-direction: column; gap: 10px;
}
.mission-card-title { margin: 0; font-family: 'Space Grotesk', sans-serif; font-size: 20px; }
.mission-checks { display: flex; flex-direction: column; gap: 6px; list-style: none; margin: 0; padding: 0; }
.check-item {
  display: flex; align-items: flex-start; gap: 10px; background: transparent; border: 0;
  padding: 4px 0; color: var(--fg); text-align: left; cursor: default; font-size: 15px; line-height: 1.4;
  user-select: text;
}
.check-box {
  flex-shrink: 0; width: 22px; height: 22px; border-radius: 6px; display: inline-flex;
  align-items: center; justify-content: center; font-size: 14px; font-weight: 700;
  border: 2px solid #5A6878; color: transparent;
}
.check-item.checked .check-box { background: var(--cursor); color: var(--bg); border-color: var(--cursor); }
.check-item.checked .check-text { color: var(--muted); text-decoration: line-through; }

.mission-tools {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.btn-tool {
  min-height: 44px; padding: 0 10px; background: var(--surface2); color: var(--fg);
  border: 1px solid var(--line); border-radius: 10px; font-size: 14px; cursor: pointer;
}
.btn-tool:hover { border-color: var(--cursor); }
.btn-tool-riddle {
  grid-column: 1 / -1;
  background: rgba(255, 200, 87, 0.12);
  border-color: rgba(255, 200, 87, 0.55);
  color: var(--amber);
  font-weight: 600;
}
.btn-tool-riddle:hover { border-color: var(--amber); background: rgba(255, 200, 87, 0.2); }
.btn-tool-riddle.solved {
  background: rgba(61, 220, 151, 0.12);
  border-color: rgba(61, 220, 151, 0.55);
  color: var(--cursor);
}
.btn-tool-riddle.missed {
  background: var(--surface2);
  border-color: var(--line);
  color: var(--muted);
}

.modal-riddle-card { max-width: 500px; }
.riddle-options { display: flex; flex-direction: column; gap: 10px; }
.riddle-opt {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 52px; padding: 12px 16px; border-radius: 12px;
  font-size: 16px; font-weight: 500; text-align: left; cursor: pointer;
  color: var(--fg); background: var(--surface2); border: 2px solid var(--line);
  transition: border-color 0.15s, background 0.15s;
}
.riddle-opt:hover:not(:disabled) { border-color: var(--amber); }
.riddle-opt:disabled { cursor: default; opacity: 0.78; }
.riddle-opt.ok { background: var(--green-bg); border-color: var(--cursor); opacity: 1; }
.riddle-opt.wrong { background: var(--amber-warn); border-color: var(--amber); opacity: 1; }
.riddle-result {
  display: flex; flex-direction: column; gap: 8px;
  padding: 14px 16px; border-radius: 12px;
  background: var(--surface2); border: 1px solid var(--line);
}
.riddle-result.ok { background: var(--green-bg); border-color: var(--cursor); }
.riddle-result.wrong { background: var(--amber-warn); border-color: var(--amber); }
.riddle-result-status { font-weight: 700; font-size: 16px; color: var(--fg); }
.riddle-result-answer { font-size: 14px; color: var(--fg); }
.riddle-result-explanation { margin: 0; font-size: 14px; color: var(--fg-soft); line-height: 1.45; }
.riddle-result-progress { font-size: 13px; color: var(--amber); font-weight: 600; }
.badge-progress { font-size: 10px; color: var(--amber); font-weight: 600; }
.queue-pane {
  flex: 1; min-height: 420px; padding: 28px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 18px; text-align: center;
}
.queue-text {
  margin: 0; max-width: 520px; font-size: 18px; line-height: 1.55; color: var(--fg);
  font-weight: 500;
}
.idle-countdown-banner {
  background: var(--amber-warn); border-bottom: 1px solid var(--amber);
  padding: 10px 14px; font-size: 14.5px; font-weight: 600; color: var(--amber);
  text-align: center; flex-shrink: 0;
}
.mission-expiry-line {
  font-size: 13px; line-height: 1.45; color: var(--muted); text-align: center;
  padding: 4px 2px 0;
}
#modal-my-code .code-login-url a {
  color: var(--blue); text-decoration: none;
}
#modal-my-code .code-login-url a:hover {
  text-decoration: underline;
}
.hint-box {
  background: var(--amber-warn); border: 1px solid var(--amber); border-radius: 10px;
  padding: 12px 14px; font-size: 15px; line-height: 1.45;
}
.pw-card {
  margin-top: auto; background: var(--surface); border: 1px solid var(--amber);
  border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px;
}
.pw-card label { font-weight: 600; font-size: 15px; }
.pw-row { display: flex; gap: 8px; }
.pw-input { height: 46px; min-width: 0; flex: 1; text-transform: uppercase; }

/* Done */
.done-box { max-width: 620px; display: flex; flex-direction: column; align-items: center; gap: 20px; text-align: center; }
.kursor-big { width: 34px; height: 64px; background: var(--cursor); border-radius: 3px; }
.done-title { margin: 0; font-family: 'Space Grotesk', sans-serif; font-size: 40px; }
.unlocked-pill {
  display: flex; gap: 12px; align-items: center; background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; padding: 14px 20px;
}

/* Fork */
.fork-view { max-width: 860px; display: flex; flex-direction: column; align-items: center; gap: 24px; text-align: center; }
.fork-view h2 { margin: 0; font-family: 'Space Grotesk', sans-serif; font-size: 36px; }
.doors-row { display: flex; gap: 28px; flex-wrap: wrap; justify-content: center; }
.door-card {
  width: 360px; min-height: 310px; padding: 28px; border-radius: 18px; display: flex;
  flex-direction: column; align-items: center; gap: 16px; text-align: center; color: var(--fg);
  cursor: pointer; background: var(--surface); border: 2px solid var(--line);
}
.door-card.selected { background: #1F2733; border-width: 3px; border-color: var(--purple); }
.door-icon {
  width: 84px; height: 84px; border-radius: 20px; display: flex; align-items: center;
  justify-content: center; background: var(--bg); border: 2px solid var(--line);
}
.amber-border { border-color: var(--amber); }
.blue-border { border-color: var(--blue); }
.door-title { font-family: 'Space Grotesk', sans-serif; font-size: 28px; font-weight: 700; letter-spacing: 2px; }
.door-desc { font-size: 16px; color: var(--fg-soft); line-height: 1.5; }
.fork-chosen { display: flex; align-items: center; gap: 16px; }

/* Modals */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(5, 8, 11, 0.78); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-card {
  width: 100%; max-width: 480px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 24px; display: flex; flex-direction: column; gap: 16px;
}
.modal-wide { max-width: 760px; max-height: 85vh; overflow: auto; }
.modal-intro-card {
  max-width: min(1080px, calc((90dvh - 110px) * 16 / 9 + 48px));
  max-height: 92dvh;
  overflow: auto;
}
.modal-preview-card { max-width: 960px; height: 80vh; }
.modal-preview-card iframe { flex: 1; width: 100%; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.modal-card h3 { margin: 0; font-family: 'Space Grotesk', sans-serif; font-size: 22px; }
.modal-card p { margin: 0; color: var(--fg-soft); line-height: 1.5; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
.modal-header-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.slownik-content table { border-collapse: collapse; width: 100%; margin: 10px 0; }
.slownik-content th, .slownik-content td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; }
.slownik-content th { background: var(--surface2); }
.slownik-content code { background: var(--surface2); color: var(--cursor); padding: 1px 6px; border-radius: 4px; font-family: 'JetBrains Mono', monospace; }

.modal-locked-card { text-align: center; align-items: center; }
.locked-hero { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 4px; }
.locked-kursor { width: 18px; height: 34px; background: var(--amber); border-radius: 2px; }
.locked-badge { font-size: 30px; line-height: 1; }
.locked-funny { font-size: 16px; color: var(--fg); }
.locked-req {
  width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; font-size: 14px; color: var(--fg-soft); line-height: 1.45;
}
.modal-locked-card .modal-actions { width: 100%; justify-content: center; margin-top: 4px; }

/* Gamification: rank pill, XP bars, badges, arsenal, theme switcher, XP toast */
.rank-pill {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 12px; font-size: 13px;
}
.rank-badge { font-weight: 700; color: var(--fg); }
.rank-xp { color: var(--cursor); font-weight: 700; font-size: 12.5px; }

.xp-bar-track {
  width: 100%; height: 8px; background: var(--bg-dark); border: 1px solid var(--line);
  border-radius: 999px; overflow: hidden;
}
.xp-bar-fill {
  height: 100%; background: linear-gradient(90deg, var(--cursor), var(--blue));
  border-radius: 999px; transition: width 0.35s ease;
}

.badges-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px;
}
.badge-slot {
  background: var(--bg-dark); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 4px; text-align: center; display: flex; flex-direction: column;
  align-items: center; gap: 3px; opacity: 0.45; filter: grayscale(1);
  transition: transform 0.15s, border-color 0.15s, opacity 0.15s;
}
.badge-slot.unlocked {
  opacity: 1; filter: none; border-color: rgba(61, 220, 151, 0.55);
  background: rgba(22, 48, 42, 0.55);
}
.badge-icon { font-size: 20px; line-height: 1.1; }
.badge-name { font-size: 10.5px; color: var(--fg-soft); line-height: 1.15; }

.arsenal-summary-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding-top: 6px; border-top: 1px solid var(--line);
}
.arsenal-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px;
}
.arsenal-card {
  background: var(--bg-dark); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px; display: flex; flex-direction: column; gap: 4px; opacity: 0.5;
}
.arsenal-card.unlocked {
  opacity: 1; border-color: rgba(61, 220, 151, 0.5); background: rgba(22, 48, 42, 0.45);
}
.arsenal-cmd { font-family: 'JetBrains Mono', monospace; font-size: 15px; font-weight: 700; color: var(--cursor); }
.arsenal-card:not(.unlocked) .arsenal-cmd { color: var(--muted); }
.arsenal-desc { font-size: 12.5px; color: var(--fg-soft); line-height: 1.35; }

.shop-themes {
  display: flex; flex-wrap: wrap; gap: 6px; padding-top: 6px; border-top: 1px solid var(--line);
}
.theme-chip {
  padding: 5px 10px; border-radius: 8px; font-size: 12.5px; font-weight: 600; cursor: pointer;
  background: var(--bg-dark); color: var(--fg-soft); border: 1px solid var(--line);
}
.theme-chip.active { border-color: var(--cursor); color: var(--cursor); background: var(--green-bg); }

.xp-toast {
  position: fixed; top: 70px; right: 28px; bottom: auto; z-index: 80;
  background: var(--surface); border: 1px solid var(--cursor); border-radius: 12px;
  padding: 10px 16px; color: var(--fg); font-size: 14.5px; font-weight: 600;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(61, 220, 151, 0.18);
  display: flex; align-items: center; gap: 10px; max-width: 360px;
  pointer-events: none;
}
.xp-toast-xp { color: var(--cursor); font-family: 'JetBrains Mono', monospace; font-weight: 700; }

@media (max-width: 1120px) {
  .main-nodes { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .map-layout { flex-direction: column; }
  .map-sidebar { width: 100%; flex-direction: row; flex-wrap: wrap; }
  .side-card { flex: 1; min-width: 260px; }
}

@media (max-width: 900px) {
  .welcome-bg { inset: 0; opacity: 0.35; }
  .welcome-bg-img { width: 100%; object-position: center top; }
  .welcome-inner { padding: 18px 16px 24px; max-width: 100%; overflow-x: clip; }
  .welcome-top { flex-wrap: wrap; gap: 10px; }
  .welcome-top-actions { flex-wrap: wrap; gap: 8px; }
  .welcome-hero { max-width: 100%; width: 100%; min-width: 0; padding: 12px 0; }
  .hero-eyebrow { font-size: 11.5px; letter-spacing: 1px; line-height: 1.4; }
  .hero-hat-badge { padding: 7px 18px; font-size: clamp(20px, 6vw, 28px); max-width: 100%; }
  .welcome-hero h1 { font-size: clamp(34px, 10vw, 48px); overflow-wrap: break-word; }
  .welcome-hero p { font-size: 16px; max-width: 100%; }
  .welcome-hero .hero-audience { font-size: 15px; max-width: 100%; }
  .welcome-cta { width: 100%; }
  .welcome-cta .btn-lg, .welcome-cta .btn-lg-outline { max-width: 100%; }
  .hero-trust { gap: 10px 16px; }
  .trust-item { max-width: 100%; }
  .welcome-free { width: 100%; padding: 8px 0 4px; }
  .welcome-free-title { font-size: clamp(22px, 6.4vw, 28px); }
  .welcome-free-sub { font-size: 15px; }
  .welcome-cards-dock { width: 100%; min-width: 0; padding: 10px; }
  .welcome-cards, .welcome-cards.welcome-cards-4 { grid-template-columns: 1fr; }
  .info-card { min-width: 0; padding: 14px; }
  .card-art { width: 52px; height: 52px; }
  .nick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dag-lanes { grid-template-columns: 1fr; }
  .dag-node { width: 100%; max-width: 280px; }
  .mission-layout { flex-direction: column; padding: 16px 16px 84px; }
  .mobile-keyboard-banner { display: flex; }
  .terminal-pane { display: none; }
  .mission-sidebar { width: 100%; }
  .ep-center { padding: 16px; }
  .film-wrap { width: 100%; }
  .xp-toast {
    top: auto; bottom: 16px; left: 16px; right: 16px;
    max-width: calc(100vw - 32px); justify-content: center;
  }
}

@media (max-width: 600px) {
  .ep-subbar { padding: 10px 16px; gap: 10px 14px; }
  .welcome-top-actions { width: 100%; justify-content: space-between; }
  .welcome-top .link-btn { padding: 6px 10px; font-size: 13px; }
  .welcome-top .btn-sm { padding: 6px 12px; font-size: 13px; }
  .welcome-cta .btn-lg, .welcome-cta .btn-lg-outline { width: 100%; justify-content: center; }
}

/* Waitlist form & standalone pages (/prywatnosc, /waitlist/*) */
.login-waitlist-hint {
  margin: 4px 0 0; font-size: 14.5px; line-height: 1.5; color: var(--fg-soft);
  text-align: center;
}
.wl-inline-link {
  display: inline; padding: 0; font-size: inherit; font-weight: 600;
  color: var(--cursor); text-align: center;
}
.modal-contact a, .wl-role-hint a, .wl-check a, .wl-page-card a { color: var(--blue); }

.wl-form { display: flex; flex-direction: column; gap: 14px; }
.wl-field { display: flex; flex-direction: column; gap: 6px; }
.wl-field label, .wl-fieldset legend { font-size: 14px; font-weight: 600; color: var(--fg); }
.wl-label-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.wl-input { height: 46px; font-size: 16px; }
.wl-textarea {
  width: 100%; padding: 10px 14px; background: var(--bg); color: var(--fg);
  border: 2px solid var(--line); border-radius: 10px; font-family: inherit;
  font-size: 15px; line-height: 1.45; resize: vertical;
}
.wl-textarea:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

.wl-fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.wl-radios { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.wl-radio {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  background: var(--bg); border: 1.5px solid var(--line); border-radius: 10px;
  cursor: pointer; font-size: 14.5px; color: var(--fg);
}
.wl-radio:has(input:checked) { border-color: var(--cursor); background: var(--green-bg); }
.wl-radio input { accent-color: var(--cursor); width: 16px; height: 16px; margin: 0; flex-shrink: 0; }
.wl-role-hint { font-size: 13px; color: var(--muted); line-height: 1.45; margin: 0; }

.wl-checks { display: flex; flex-direction: column; gap: 10px; }
.wl-check {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 14px; color: var(--fg-soft); line-height: 1.4; cursor: pointer;
}
.wl-check input { accent-color: var(--cursor); width: 17px; height: 17px; margin: 2px 0 0; flex-shrink: 0; }

/* Honeypot: visually hidden off-screen for humans, present in DOM for bots */
.wl-hp {
  position: absolute; left: -10000px; top: auto; width: 1px; height: 1px;
  overflow: hidden; pointer-events: none;
}

.wl-form-actions { margin-top: 4px; }
.wl-form-actions .btn-primary:disabled { opacity: 0.6; cursor: wait; }
.wl-done { display: flex; flex-direction: column; gap: 16px; }
.wl-done-msg {
  padding: 14px 16px; background: var(--green-bg); border: 1px solid rgba(61, 220, 151, 0.5);
  border-radius: 10px; color: var(--fg); font-size: 15.5px; line-height: 1.5;
}

/* Standalone pages: /prywatnosc, /waitlist/confirm, /waitlist/decide */
.wl-page-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 28px 16px;
}
.wl-page-card {
  width: 100%; max-width: 600px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 28px; display: flex; flex-direction: column; gap: 16px;
}
.wl-brand-link { text-decoration: none; color: var(--fg); align-self: flex-start; }
.wl-page-card h1 { margin: 4px 0 0; font-family: 'Space Grotesk', sans-serif; font-size: 26px; line-height: 1.25; }
.wl-page-card h2 { margin: 0 0 8px; font-family: 'Space Grotesk', sans-serif; font-size: 18px; color: var(--fg); }
.wl-lead { margin: 0; color: var(--fg-soft); line-height: 1.55; }
.wl-info-box {
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  padding: 16px 18px; display: flex; flex-direction: column; gap: 8px;
}
.wl-info-box p { margin: 0; color: var(--fg-soft); line-height: 1.5; }
.wl-info-box ul { margin: 4px 0; padding-left: 20px; color: var(--fg-soft); line-height: 1.55; }
.wl-details {
  display: grid; grid-template-columns: 130px 1fr; gap: 8px 14px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  padding: 16px; margin: 0;
}
.wl-details dt { color: var(--muted); font-size: 14px; font-weight: 600; }
.wl-details dd { margin: 0; color: var(--fg); font-size: 15px; word-break: break-word; }
.wl-decide-form { display: flex; gap: 12px; padding-top: 4px; }
.btn-danger {
  min-height: 48px; padding: 0 22px; background: transparent; color: var(--red);
  border: 1.5px solid var(--red); border-radius: 10px; font-size: 17px; font-weight: 700; cursor: pointer;
}
.btn-danger:hover { background: rgba(255, 138, 138, 0.12); }
.wl-page-footer { padding-top: 8px; border-top: 1px solid var(--line); }

@media (max-width: 520px) {
  .wl-radios { grid-template-columns: 1fr; }
  .wl-details { grid-template-columns: 1fr; gap: 4px; }
  .wl-details dt { margin-top: 8px; }
  .wl-details dt:first-child { margin-top: 0; }
  .wl-form-actions { flex-direction: column-reverse; }
  .wl-form-actions button { width: 100%; }
  .wl-page-card { padding: 20px 16px; }
}

/* Adult Panel (/dorosly/panel) & Kid Claim (/z/<token>) */
.wl-btn-link {
  display: inline-flex; align-items: center; justify-content: center;
  text-decoration: none;
}
.wl-page-card a.btn-primary { color: var(--bg); }
.wl-full-btn { width: 100%; }
.code-big {
  font-size: clamp(22px, 4vw, 32px); font-weight: 700; letter-spacing: 1px;
  text-align: center; padding: 18px 16px; background: var(--bg);
  border: 2px solid var(--cursor); border-radius: 12px; color: var(--cursor);
  word-break: break-word; user-select: all;
}
.code-actions-row {
  display: flex; gap: 12px; flex-wrap: wrap;
}
.code-actions-row > * { flex: 1; min-width: 140px; }
.code-login-url { word-break: break-all; font-size: 13.5px; }

.panel-topbar {
  height: auto; min-height: 58px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 28px; background: var(--bar); border-bottom: 1px solid var(--line);
  gap: 10px 16px; flex-wrap: wrap;
}
.panel-topbar-right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.panel-main {
  width: 100%; max-width: 960px; margin: 0 auto; padding: 28px 20px 56px;
  display: flex; flex-direction: column; gap: 22px;
}
.panel-header h1 { margin: 0 0 6px; font-family: 'Space Grotesk', sans-serif; font-size: 30px; }
.panel-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 20px 22px; display: flex; flex-direction: column; gap: 14px;
}
.panel-card h2, .panel-links-section h2 {
  margin: 0; font-family: 'Space Grotesk', sans-serif; font-size: 19px;
}
.panel-create-form {
  display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap;
}
.panel-field-name { flex: 1 1 240px; }
.panel-field-count { width: 130px; }
.panel-field-btn { flex: 0 0 auto; }
.panel-links-section { display: flex; flex-direction: column; gap: 14px; }
.panel-links { display: flex; flex-direction: column; gap: 16px; }
.panel-link-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}
.panel-link-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.panel-link-name { margin: 0; font-family: 'Space Grotesk', sans-serif; font-size: 20px; word-break: break-word; }
.panel-link-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.panel-badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 700;
}
.panel-badge.active { background: var(--green-bg); color: var(--cursor); border: 1px solid rgba(61, 220, 151, 0.45); }
.panel-badge.inactive { background: var(--surface2); color: var(--muted); border: 1px solid var(--line); }
.panel-no-kids { margin: 0; }

.panel-table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.panel-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.panel-table th, .panel-table td {
  padding: 10px 10px; border-top: 1px solid var(--line); text-align: left; white-space: nowrap;
}
.panel-table th { color: var(--muted); font-weight: 600; font-size: 12.5px; border-top: 0; }
.panel-table tr.kid-revoked td { opacity: 0.6; }
.panel-kid-actions { display: flex; align-items: center; gap: 8px; }
.btn-danger-sm {
  min-height: 36px; padding: 0 12px; background: transparent; color: var(--red);
  border: 1px solid rgba(255, 138, 138, 0.6); border-radius: 8px; font-size: 13.5px; cursor: pointer;
}
.btn-danger-sm:hover { background: rgba(255, 138, 138, 0.12); }

@media (max-width: 600px) {
  .panel-topbar { padding: 12px 16px; }
  .panel-main { padding: 18px 14px 40px; }
  .panel-card { padding: 16px; }
  .panel-field-name, .panel-field-count, .panel-field-btn { width: 100%; flex: 1 1 100%; }
  .panel-field-btn button { width: 100%; }
  .code-actions-row { flex-direction: column; }
}

/* Panel: bookmark hint under the quota line */
.panel-bookmark-hint { margin: 8px 0 0; line-height: 1.5; }
.panel-bookmark-hint a { color: var(--blue); }

/* Panel kids table -> stacked cards on phones (desktop table unchanged) */
@media (max-width: 600px) {
  .panel-table-wrap { overflow-x: visible; }
  .panel-table, .panel-table tbody, .panel-table tr, .panel-table td { display: block; width: 100%; }
  .panel-table thead { display: none; }
  .panel-table tr {
    background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
    padding: 12px 14px; margin-top: 10px;
  }
  .panel-table td {
    border-top: 0; padding: 4px 0; white-space: normal;
    display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  }
  .panel-table td[data-label]::before {
    content: attr(data-label); color: var(--muted); font-family: 'IBM Plex Sans', sans-serif;
    font-size: 13px; font-weight: 600;
  }
  .panel-table td.kid-name {
    justify-content: flex-start; font-weight: 700; font-size: 15.5px; padding-bottom: 6px;
  }
  .panel-table td.panel-kid-actions { flex-direction: column; align-items: stretch; gap: 8px; padding-top: 10px; }
  .panel-table td.panel-kid-actions button { width: 100%; min-height: 42px; }
}

/* /dla-doroslych */
html { scroll-behavior: smooth; }
.adults-topbar a { text-decoration: none; }
.adults-nav { display: flex; gap: 18px; flex-wrap: wrap; }
.adults-nav a { color: var(--fg-soft); font-size: 15px; font-weight: 600; }
.adults-nav a:hover { color: var(--cursor); }
.adults-main {
  width: 100%; max-width: 920px; margin: 0 auto; padding: 44px 20px 64px;
  display: flex; flex-direction: column; gap: 48px;
}
.adults-hero { display: flex; flex-direction: column; gap: 16px; }
.adults-hero h1 {
  margin: 0; font-family: 'Space Grotesk', sans-serif; font-size: clamp(28px, 4.6vw, 44px);
  line-height: 1.15; overflow-wrap: anywhere;
}
.adults-sub { margin: 0; font-size: 19px; color: var(--fg-soft); line-height: 1.5; }
.adults-cta { display: flex; gap: 12px; flex-wrap: wrap; padding-top: 6px; }
.adults-cta a { text-decoration: none; }
.adults-cta .btn-lg-outline { color: var(--fg); }
.adults-section { display: flex; flex-direction: column; gap: 16px; }
.adults-anchor { scroll-margin-top: 20px; }
.adults-section h2 { margin: 0; font-family: 'Space Grotesk', sans-serif; font-size: 26px; }
.adults-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.adults-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 18px 20px; display: flex; flex-direction: column; gap: 8px;
}
.adults-card p { margin: 0; color: var(--fg-soft); line-height: 1.55; }
.adults-steps { margin: 0; padding: 0; list-style: none; counter-reset: step; display: flex; flex-direction: column; gap: 12px; }
.adults-steps li {
  counter-increment: step; position: relative; padding: 14px 18px 14px 62px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  color: var(--fg-soft); line-height: 1.55;
}
.adults-steps li::before {
  content: counter(step); position: absolute; left: 16px; top: 12px;
  width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--green-bg); color: var(--cursor); font-family: 'JetBrains Mono', monospace; font-weight: 700;
}
.adults-note { margin: 0; color: var(--fg-soft); line-height: 1.55; }
.adults-list { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 10px; color: var(--fg-soft); line-height: 1.55; }
.adults-list li::marker { color: var(--cursor); }
.adults-list strong { color: var(--fg); }
.adults-section a:not(.btn-primary):not(.link-btn) { color: var(--blue); }
.adults-form-main {
  width: 100%; max-width: 660px; margin: 0 auto; padding: 44px 20px 64px;
  display: flex; flex-direction: column; gap: 24px;
}
.adults-page-h1 {
  margin: 0; font-family: 'Space Grotesk', sans-serif; font-size: clamp(26px, 4vw, 34px);
  line-height: 1.2;
}
.adults-session-cta { max-width: 620px; }
.adults-session-cta a { text-decoration: none; }
.adults-back-link { margin: 4px 0 0; }
.adults-bottom-cta { padding-top: 4px; }
.adults-form-card { max-width: 620px; }
.adults-form-title { margin: 0; font-family: 'Space Grotesk', sans-serif; font-size: 20px; }
.adults-small { margin: 0; line-height: 1.5; }
.adults-contact { align-items: center; text-align: center; gap: 8px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 24px; }
.adults-contact p { margin: 0; }
.adults-contact a:not(.link-btn) { color: var(--cursor); }
.welcome-contact-sep { margin: 0 6px; }

@media (max-width: 600px) {
  #modal-intro.modal-backdrop { padding: 10px; }
  .modal-intro-card { width: 100%; max-width: 100%; padding: 14px; gap: 12px; }
  .modal-intro-card h3 { font-size: 18px; }
  .adults-main { padding: 28px 16px 48px; gap: 36px; }
  .adults-form-main { padding: 28px 16px 48px; }
  .adults-grid { grid-template-columns: 1fr; }
  .adults-cta a { width: 100%; justify-content: center; text-align: center; }
  .adults-sub { font-size: 17px; }
  .adults-section h2 { font-size: 22px; }
  .adults-nav { gap: 14px; }
  .adults-form-card .wl-form-actions button { width: 100%; }
}

/* „Słowniczek i karta misji” modal */
.karta-card h4, .karta-heading { margin: 14px 0 8px; font-family: 'Space Grotesk', sans-serif; font-size: 18px; }
.karta-card h4:first-child { margin-top: 0; }
.karta-card p { margin: 6px 0; line-height: 1.55; color: var(--fg-soft); }
.karta-card ol, .karta-card ul { margin: 8px 0; padding-left: 24px; line-height: 1.55; color: var(--fg-soft); }
.karta-card li { margin: 4px 0; }
.karta-card strong { color: var(--fg); }
.slownik-content { overflow-wrap: anywhere; }
.karta-slownik td, .karta-slownik th { overflow-wrap: anywhere; }
@media (max-width: 600px) {
  .slownik-content th, .slownik-content td { padding: 6px; font-size: 13.5px; }
}

.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

@media (max-width: 900px) {
  .topbar { padding: 0 16px; }
  .topbar-right { gap: 10px; }
}
@media (max-width: 600px) {
  .topbar-code-btn .topbar-code-icon { display: inline-block; flex-shrink: 0; }
  .topbar-code-btn .topbar-code-label-full { display: none; }
  .topbar-code-btn .topbar-code-label-short { display: inline; }
}

/* Kid top bar on phones: two rows instead of pushing the page sideways. Row 1: brand,
   Kod and Wyloguj; row 2: rank + XP, nick (shortened with … if long), diamonds. Nothing is hidden. */
@media (max-width: 600px) {
  .topbar { height: auto; min-height: 56px; padding: 8px 16px; flex-wrap: wrap; gap: 6px 8px; }
  .topbar-right { display: contents; }
  .topbar .brand-btn { order: 0; padding: 4px 0; }
  .topbar-right #topbar-my-code-btn {
    order: 1; margin-left: auto; min-height: 34px; padding: 0 10px;
    display: inline-flex; align-items: center; gap: 5px;
  }
  .topbar-right #logout-btn { order: 1; margin-left: 0; min-height: 34px; padding: 0 12px; }
  .topbar::after { content: ""; order: 2; flex-basis: 100%; height: 0; }
  .topbar .rank-pill, .topbar .agent-pill, .topbar .diamond-pill { order: 3; }
  .rank-pill { padding: 4px 10px; font-size: 12px; gap: 8px; }
  .rank-xp { font-size: 12px; }
  .agent-pill {
    font-size: 14px; min-width: 0; max-width: 34vw;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .diamond-pill { padding: 4px 10px; font-size: 14px; }
  /* map: the „next mission” card stacks (long titles such as „Instrukcja obsługi” wrap) */
  .next-mission-card { flex-direction: column; align-items: stretch; padding: 16px; }
  .next-mission-card > div { min-width: 0; }
  .next-title { font-size: 24px; overflow-wrap: anywhere; }
  .next-mission-card .btn-lg { width: 100%; }
  .map-header-row { flex-wrap: wrap; }
}
