@font-face { font-family: "DM Sans"; src: url("/assets/fonts/dm-sans-400.ttf") format("truetype"); font-style: normal; font-weight: 400; font-display: swap; }
@font-face { font-family: "DM Sans"; src: url("/assets/fonts/dm-sans-500.ttf") format("truetype"); font-style: normal; font-weight: 500; font-display: swap; }
@font-face { font-family: "DM Sans"; src: url("/assets/fonts/dm-sans-600.ttf") format("truetype"); font-style: normal; font-weight: 600; font-display: swap; }
@font-face { font-family: "DM Sans"; src: url("/assets/fonts/dm-sans-700.ttf") format("truetype"); font-style: normal; font-weight: 700; font-display: swap; }
@font-face { font-family: "Manrope"; src: url("/assets/fonts/manrope-500.ttf") format("truetype"); font-style: normal; font-weight: 500; font-display: swap; }
@font-face { font-family: "Manrope"; src: url("/assets/fonts/manrope-600.ttf") format("truetype"); font-style: normal; font-weight: 600; font-display: swap; }
@font-face { font-family: "Manrope"; src: url("/assets/fonts/manrope-700.ttf") format("truetype"); font-style: normal; font-weight: 700; font-display: swap; }
@font-face { font-family: "Manrope"; src: url("/assets/fonts/manrope-800.ttf") format("truetype"); font-style: normal; font-weight: 800; font-display: swap; }

:root {
  --bg: #f4f5f6;
  --surface: #ffffff;
  --surface-soft: #eef0f2;
  --ink: #17202a;
  --text: #35414d;
  --muted: #71808d;
  --line: #dfe3e7;
  --line-strong: #cbd1d7;
  --brand: #dc3328;
  --brand-dark: #b5221b;
  --dark: #18212b;
  --success: #16805c;
  --warning: #b66a12;
  --danger: #c63128;
  --shadow-sm: 0 6px 18px rgba(23, 32, 42, .07);
  --shadow-lg: 0 24px 70px rgba(23, 32, 42, .12);
}

[data-theme="dark"] {
  --bg: #11161c;
  --surface: #192129;
  --surface-soft: #222c36;
  --ink: #f3f5f7;
  --text: #c8d0d7;
  --muted: #92a0ac;
  --line: #303b46;
  --line-strong: #46515c;
  --dark: #0d1217;
  --shadow-sm: 0 6px 18px rgba(0, 0, 0, .18);
  --shadow-lg: 0 24px 70px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }

html { min-height: 100%; scroll-behavior: smooth; }

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "DM Sans", ui-sans-serif, system-ui, sans-serif;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea { font: inherit; letter-spacing: 0; }
button { border: 0; color: inherit; }
a { color: inherit; text-decoration: none; }
svg { width: 20px; height: 20px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.skip-link { position: fixed; z-index: 200; top: 8px; left: 8px; padding: 10px 14px; background: var(--ink); color: var(--surface); transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }

.app-header {
  position: sticky;
  z-index: 80;
  top: 0;
  height: 72px;
  display: grid;
  grid-template-columns: minmax(190px, 1fr) max-content minmax(680px, 1fr);
  align-items: center;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(18px);
}

.brand-button, .nav-button, .icon-button, .profile-button, .mobile-nav button, .text-button, .back-button {
  cursor: pointer;
  background: transparent;
}

.brand-button { justify-self: start; display: inline-flex; align-items: center; gap: 10px; padding: 0; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 7px; background: var(--brand); color: white; font: 800 20px/1 "Manrope", sans-serif; }
.brand-word { color: var(--ink); font: 800 19px/1 "Manrope", sans-serif; }
.brand-logo { width: 132px; height: auto; display: block; object-fit: contain; }

.main-nav { height: 100%; display: flex; align-items: center; gap: 6px; min-width: max-content; }
.nav-button { min-width: 100px; height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 7px; color: var(--muted); font-size: 14px; font-weight: 700; white-space: nowrap; }
.nav-button:hover, .nav-button.is-active { background: var(--surface-soft); color: var(--ink); }
.nav-button.is-active svg { color: var(--brand); }

.header-actions { justify-self: end; display: flex; align-items: center; gap: 8px; min-width: max-content; }
.header-language { height: 40px; display: inline-flex; align-items: center; gap: 5px; padding: 0 7px 0 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--ink); }
.header-language svg { width: 17px; height: 17px; color: var(--muted); }
.header-language select { width: 39px; min-height: 36px; padding: 0; border: 0; outline: 0; background: transparent; color: var(--ink); cursor: pointer; font-size: 12px; font-weight: 800; }
.header-language:focus-within { border-color: var(--brand); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 16%, transparent); }
.header-level { height: 40px; display: inline-flex; align-items: center; gap: 5px; padding: 0 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--ink); }
.header-level svg { width: 16px; color: var(--brand); }
.header-level select { width: 86px; min-height: 36px; padding: 0; border: 0; outline: 0; background: transparent; color: var(--ink); cursor: pointer; font-size: 11px; font-weight: 800; }
.header-level:focus-within { border-color: var(--brand); box-shadow: 0 0 0 2px color-mix(in srgb,var(--brand) 16%,transparent); }
.streak-chip, .xp-chip { height: 38px; display: inline-flex; align-items: center; gap: 6px; padding: 0 11px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); font-size: 13px; }
.streak-chip svg { color: var(--brand); }
.xp-chip svg { color: #2788d8; }
.streak-chip strong, .xp-chip strong { color: var(--ink); }
.streak-chip span, .xp-chip span { color: var(--muted); }
.icon-button { width: 40px; height: 40px; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.icon-button:hover { border-color: var(--line-strong); background: var(--surface-soft); }
.profile-button { height: 40px; display: inline-flex; align-items: center; gap: 7px; padding: 0 10px 0 5px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--ink); font-size: 12px; font-weight: 800; }
.profile-button > span { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--dark); color: white; font-size: 10px; }
.profile-button em { font-style: normal; }
.profile-button:hover { background: var(--surface-soft); }
.profile-button.is-guest-cta { padding: 0 13px; color: var(--brand); }
.profile-button.is-guest-cta svg { width: 17px; height: 17px; }

#app-main { min-height: calc(100vh - 72px); }
.app-view { display: none; }
.app-view.is-active { display: block; }
.page-wrap { width: min(1180px, calc(100% - 48px)); margin: 0 auto; }
.mobile-nav { display: none; }

.kicker { display: inline-block; color: var(--brand); font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.city-heading, .simple-heading { display: flex; justify-content: space-between; gap: 40px; padding: 44px 0 26px; }
.city-heading h1, .simple-heading h1, .world-title-block h1 { margin: 7px 0 10px; color: var(--ink); font: 800 42px/1.05 "Manrope", sans-serif; }
.city-heading p, .simple-heading p, .world-title-block p { max-width: 680px; margin: 0; font-size: 17px; line-height: 1.55; }

.rank-panel { width: 250px; align-self: center; padding: 15px 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow-sm); }
.home-status { width: 250px; display: grid; gap: 10px; align-self: center; }
.home-status .rank-panel { width: 100%; }
.home-certificate { display: grid; grid-template-columns: 28px 1fr auto; gap: 8px; align-items: center; padding: 10px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--muted); }
.home-certificate > svg { width: 23px; color: var(--muted); }
.home-certificate span { display: grid; gap: 2px; min-width: 0; }
.home-certificate strong { color: var(--ink); font-size: 11px; }
.home-certificate small { font-size: 9px; line-height: 1.25; }
.home-certificate a { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 6px; background: var(--brand); color: white; }
.home-certificate a svg { width: 15px; }
.home-certificate.is-earned { border-color: var(--brand); box-shadow: 0 6px 18px color-mix(in srgb, var(--brand) 12%, transparent); }
.home-certificate.is-earned > svg { color: var(--brand); }
.rank-panel > span, .rank-panel small { color: var(--muted); font-size: 11px; }
.rank-panel strong { display: block; margin: 2px 0 10px; color: var(--ink); font: 700 17px/1.3 "Manrope", sans-serif; }
.slim-progress { height: 6px; overflow: hidden; border-radius: 99px; background: var(--surface-soft); }
.slim-progress i { display: block; height: 100%; border-radius: inherit; background: var(--brand); }
.rank-panel small { display: block; margin-top: 7px; }

.city-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; }
.city-map { position: relative; min-height: 610px; overflow: hidden; border: 1px solid #293641; border-radius: 8px; background: #25323d; box-shadow: var(--shadow-lg); isolation: isolate; }
.city-map::before { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px); background-size: 36px 36px; opacity: .7; }
.city-map::after { content: ""; position: absolute; inset: 38px; border: 1px dashed rgba(255,255,255,.08); border-radius: 50%; }
.map-skyline { position: absolute; z-index: -1; background: #1d2831; opacity: .9; }
.skyline-a { left: -4%; bottom: 8%; width: 42%; height: 28%; clip-path: polygon(0 48%, 8% 48%, 8% 31%, 16% 31%, 16% 55%, 24% 55%, 24% 20%, 31% 20%, 31% 48%, 38% 48%, 38% 11%, 47% 11%, 47% 60%, 57% 60%, 57% 36%, 67% 36%, 67% 55%, 77% 55%, 77% 25%, 86% 25%, 86% 50%, 100% 50%, 100% 100%, 0 100%); }
.skyline-b { right: -3%; top: 4%; width: 36%; height: 31%; clip-path: polygon(0 52%, 9% 52%, 9% 28%, 20% 28%, 20% 60%, 31% 60%, 31% 15%, 43% 15%, 43% 48%, 54% 48%, 54% 4%, 64% 4%, 64% 53%, 74% 53%, 74% 33%, 84% 33%, 84% 57%, 100% 57%, 100% 100%, 0 100%); }
.river { position: absolute; z-index: -1; left: 42%; top: -10%; width: 14%; height: 125%; border: 20px solid #315167; border-top: 0; border-bottom: 0; transform: rotate(13deg); opacity: .7; }
.road { position: absolute; z-index: -1; height: 12px; border: 1px solid rgba(255,255,255,.1); background: #3a4650; }
.road::after { content: ""; position: absolute; left: 0; right: 0; top: 5px; border-top: 1px dashed rgba(255,255,255,.22); }
.road-a { width: 86%; left: 7%; top: 47%; transform: rotate(-4deg); }
.road-b { width: 64%; left: -7%; top: 58%; transform: rotate(42deg); }
.road-c { width: 69%; right: -8%; top: 56%; transform: rotate(-39deg); }

.district { position: absolute; z-index: 3; left: var(--x); top: var(--y); width: 156px; min-height: 128px; display: grid; grid-template-columns: 48px 1fr; gap: 10px; align-items: start; padding: 12px; border: 1px solid rgba(255,255,255,.12); border-radius: 8px; background: rgba(18, 25, 32, .92); color: white; cursor: pointer; text-align: left; transform: translate(-50%, -50%); box-shadow: 0 16px 30px rgba(0,0,0,.22); transition: transform .2s ease, border-color .2s ease; }
.district:hover, .district:focus-visible { border-color: var(--world); transform: translate(-50%, -53%); outline: none; }
.district-building { width: 48px; height: 58px; display: grid; place-items: center; border-radius: 7px; background: var(--world); box-shadow: 0 8px 20px color-mix(in srgb, var(--world) 35%, transparent); }
.district-building svg { width: 25px; height: 25px; }
.district-copy { min-width: 0; display: grid; gap: 2px; }
.district-copy small { color: rgba(255,255,255,.58); font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.district-copy strong { font: 700 13px/1.25 "Manrope", sans-serif; }
.district-copy em { color: var(--world); font-size: 11px; font-style: normal; font-weight: 800; }
.district-progress { grid-column: 1 / -1; height: 5px; overflow: hidden; border-radius: 99px; background: rgba(255,255,255,.12); }
.district-progress i { display: block; height: 100%; background: var(--world); }
.city-legend { position: absolute; z-index: 4; left: 18px; right: 18px; bottom: 16px; display: flex; justify-content: space-between; align-items: center; color: rgba(255,255,255,.72); font-size: 11px; }
.city-legend span { display: inline-flex; align-items: center; gap: 7px; }
.city-legend span i { width: 26px; border-top: 1px dashed rgba(255,255,255,.45); }
.city-legend strong { color: white; }

.next-mission { min-height: 610px; display: flex; flex-direction: column; padding: 22px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow-sm); }
.mission-top { display: flex; justify-content: space-between; color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.mission-top svg { width: 22px; height: 22px; }
.mission-world { display: grid; gap: 5px; margin-top: 48px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.mission-world span, .mission-body small { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.mission-world strong { color: var(--ink); font: 700 22px/1.2 "Manrope", sans-serif; }
.mission-body { margin-top: 24px; }
.mission-body h2 { margin: 8px 0; color: var(--ink); font: 800 30px/1.08 "Manrope", sans-serif; }
.mission-body p { margin: 0; line-height: 1.5; }
.next-mission .primary-button { margin-top: auto; }

.primary-button, .secondary-button, .danger-button { min-height: 46px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; padding: 0 17px; border-radius: 7px; cursor: pointer; font-weight: 700; }
.primary-button { background: var(--brand); color: white; }
.primary-button:hover { background: var(--brand-dark); }
.primary-button:disabled { cursor: not-allowed; opacity: .45; }
.secondary-button { border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); }
.secondary-button:hover { background: var(--surface-soft); }
.danger-button { background: transparent; color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 35%, var(--line)); }
.text-button { min-height: 38px; color: var(--muted); font-size: 13px; font-weight: 700; }
.text-button:hover { color: var(--ink); }
.full { width: 100%; }
.lesson-actions { display: flex; align-items: center; gap: 8px; }
.hint-button span { color: var(--warning); font-size: 11px; }
.hint-stack { display: grid; gap: 8px; margin-top: 12px; }
.hint-item { display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: start; padding: 12px; border: 1px solid color-mix(in srgb, var(--warning) 32%, var(--line)); border-radius: 7px; background: color-mix(in srgb, var(--warning) 7%, var(--surface)); }
.hint-item > span { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--warning); color: white; font-weight: 800; }
.hint-item p { margin: 3px 0 0; line-height: 1.5; }

.world-strip { padding: 54px 0 70px; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 30px; margin-bottom: 17px; }
.section-heading h2 { margin: 5px 0 0; color: var(--ink); font: 700 25px/1.2 "Manrope", sans-serif; }
.section-heading > span { color: var(--muted); font-size: 13px; }
.world-summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.world-summary { min-height: 78px; display: grid; grid-template-columns: 42px 1fr auto; gap: 12px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; text-align: left; }
.world-summary:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); }
.world-summary > svg { width: 42px; height: 42px; padding: 10px; border-radius: 7px; background: color-mix(in srgb, var(--accent) 12%, var(--surface)); color: var(--accent); }
.world-summary span { display: grid; gap: 3px; }
.world-summary strong { color: var(--ink); }
.world-summary small { color: var(--muted); }
.world-summary em { color: var(--accent); font-style: normal; font-weight: 800; }

.world-cover { padding-top: 28px; }
.back-button { display: inline-flex; align-items: center; gap: 7px; padding: 7px 0; color: var(--muted); font-weight: 700; }
.back-button:hover { color: var(--ink); }
.world-cover-grid { display: grid; grid-template-columns: 1fr 390px; gap: 60px; align-items: end; padding: 34px 0 42px; }
.world-title-block .kicker { color: var(--accent); }
.world-title-block h1 { max-width: 680px; font-size: 50px; }
.world-content { padding-bottom: 80px; }

.level-selector { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.level-selector button, .level-selector > div { min-height: 78px; display: grid; grid-template-columns: 32px 1fr; grid-template-rows: auto auto; column-gap: 10px; align-content: center; padding: 10px 13px; border-radius: 7px; background: transparent; text-align: left; }
.level-selector button { cursor: pointer; }
.level-selector button:hover { background: var(--surface-soft); }
.level-selector .is-active { background: var(--accent-soft); color: var(--ink); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent); }
.level-selector .is-done { background: color-mix(in srgb, var(--success) 8%, var(--surface)); }
.level-selector .is-locked { opacity: .52; }
.level-selector button > span, .level-selector > div > span { grid-row: 1 / 3; width: 32px; height: 32px; display: grid; place-items: center; align-self: center; border-radius: 50%; background: var(--surface-soft); color: var(--muted); font-weight: 800; }
.level-selector .is-active > span { background: var(--accent); color: white; }
.level-selector .is-done > span { background: var(--success); color: white; }
.level-selector strong { color: var(--ink); }
.level-selector small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.district:disabled, .world-summary:disabled, .route-item:disabled { cursor: not-allowed; filter: grayscale(.75); opacity: .48; box-shadow: none; }

.story-brief { display: grid; grid-template-columns: 1fr 180px; gap: 30px; align-items: center; margin: 18px 0 42px; padding: 24px 26px; border-left: 4px solid var(--accent); border-radius: 0 8px 8px 0; background: var(--accent-soft); }
.story-brief > div > span { color: var(--accent); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.story-brief h2 { margin: 4px 0 7px; color: var(--ink); font: 700 24px/1.2 "Manrope", sans-serif; }
.story-brief p { max-width: 780px; margin: 0; line-height: 1.5; }
.story-progress strong { display: block; color: var(--ink); font: 800 28px/1 "Manrope", sans-serif; }
.story-progress span { color: var(--muted); font-size: 12px; }
.story-progress .slim-progress { margin-top: 9px; background: color-mix(in srgb, var(--accent) 16%, var(--surface)); }
.story-progress .slim-progress i { background: var(--accent); }

.lesson-road { max-width: 900px; margin: 0 auto; }
.lesson-list { display: grid; gap: 9px; }
.lesson-row { width: 100%; min-height: 88px; display: grid; grid-template-columns: 44px 1fr auto 24px; gap: 15px; align-items: center; padding: 13px 17px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; text-align: left; transition: border-color .18s ease, transform .18s ease; }
.lesson-row:not(.is-locked):hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.lesson-row.is-locked { cursor: not-allowed; opacity: .52; }
.lesson-number { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-soft); color: var(--muted); font-weight: 800; }
.lesson-row.is-done .lesson-number { background: var(--accent); color: white; }
.lesson-copy { min-width: 0; display: grid; gap: 2px; }
.lesson-copy small { color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.lesson-copy strong { color: var(--ink); font: 700 17px/1.3 "Manrope", sans-serif; }
.lesson-copy em { color: var(--muted); font-size: 13px; font-style: normal; }
.mechanic-tag { display: inline-flex; align-items: center; gap: 7px; padding: 8px 10px; border-radius: 6px; background: var(--surface-soft); color: var(--muted); font-size: 11px; font-weight: 700; }
.mechanic-tag svg { width: 16px; height: 16px; }
.row-arrow { color: var(--muted); }
.final-row { margin-top: 12px; border: 2px solid var(--accent); background: var(--accent-soft); }
.final-row .lesson-number { border-radius: 8px; background: var(--accent); color: white; }

.lesson-player { min-height: calc(100vh - 72px); display: grid; grid-template-rows: 70px minmax(0, 1fr) 76px; background: var(--surface); }
.lesson-topbar { display: grid; grid-template-columns: 48px minmax(0, 620px) 100px; justify-content: space-between; align-items: center; gap: 24px; padding: 0 28px; border-bottom: 1px solid var(--line); }
.lesson-top-progress { display: grid; grid-template-columns: 1fr auto; gap: 11px; align-items: center; }
.lesson-top-progress > div { height: 8px; overflow: hidden; border-radius: 99px; background: var(--surface-soft); }
.lesson-top-progress i { display: block; height: 100%; background: var(--accent); }
.lesson-top-progress span { color: var(--muted); font-size: 12px; font-weight: 700; }
.score-live { justify-self: end; display: grid; text-align: right; }
.score-live span { color: var(--muted); font-size: 10px; text-transform: uppercase; }
.score-live strong { color: var(--ink); font: 800 24px/1 "Manrope", sans-serif; }
.lesson-stage { width: min(1120px, calc(100% - 48px)); margin: 0 auto; display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 56px; align-items: center; padding: 38px 0; }
.guide-panel { align-self: stretch; display: flex; flex-direction: column; justify-content: center; }
.guide-panel > small { color: var(--accent); font-weight: 800; }
.guide-panel h2 { margin: 6px 0 9px; color: var(--ink); font: 700 24px/1.2 "Manrope", sans-serif; }
.guide-panel p { margin: 0; line-height: 1.55; }
.scenario-chip { display: grid; gap: 2px; margin-top: 25px; padding: 13px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-soft); }
.scenario-chip span { color: var(--muted); font-size: 10px; text-transform: uppercase; }
.scenario-chip strong { color: var(--ink); font-size: 13px; }
.exercise-panel { min-width: 0; max-width: 750px; }
.exercise-heading h1 { margin: 8px 0 28px; color: var(--ink); font: 700 30px/1.25 "Manrope", sans-serif; }
.multi-mode-top { display: grid; grid-template-columns: 43px 1fr; gap: 12px; align-items: center; margin: -12px 0 18px; padding: 13px 15px; border: 3px solid var(--accent); border-radius: 8px; background: color-mix(in srgb,var(--accent) 12%,var(--surface)); }
.multi-mode-top > svg { width: 40px; height: 40px; padding: 8px; border-radius: 7px; background: var(--accent); color: white; }
.multi-mode-top span { display: grid; gap: 2px; }.multi-mode-top strong { color: var(--ink); font-size: 15px; }.multi-mode-top small { color: var(--muted); font-size: 11px; }
.option-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.multi-select-banner { display: grid; grid-template-columns: 42px 1fr auto; gap: 12px; align-items: center; margin-bottom: 14px; padding: 13px 15px; border: 2px solid var(--accent); border-radius: 8px; background: color-mix(in srgb,var(--accent) 9%,var(--surface)); }
.multi-select-banner > svg { width: 40px; height: 40px; padding: 9px; border-radius: 7px; background: var(--accent); color: white; }
.multi-select-banner > span { display: grid; gap: 2px; }.multi-select-banner strong { color: var(--ink); font-size: 14px; }.multi-select-banner small { color: var(--muted); font-size: 11px; line-height: 1.35; }
.multi-select-banner em { min-width: 90px; padding: 7px 9px; border-radius: 5px; background: var(--surface); color: var(--accent); font-size: 10px; font-style: normal; font-weight: 800; text-align: center; }
.option-grid.multi .answer-option { grid-template-columns: 38px 1fr; border-width: 2px; }
.answer-option > span.multi-checkbox { width: 34px; height: 34px; border: 2px solid var(--line-strong); border-radius: 6px; background: var(--surface); }
.multi-checkbox svg { width: 21px; opacity: 0; color: white; }
.answer-option.is-selected > .multi-checkbox { border-color: var(--accent); background: var(--accent); }
.answer-option.is-selected > .multi-checkbox svg { opacity: 1; }
.answer-option { min-height: 76px; display: grid; grid-template-columns: 34px 1fr 20px; gap: 12px; align-items: center; padding: 13px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); cursor: pointer; text-align: left; }
.answer-option:hover { border-color: var(--accent); }
.answer-option.is-selected { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); box-shadow: inset 0 0 0 1px var(--accent); }
.answer-option > span { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 6px; background: var(--surface-soft); color: var(--muted); font-weight: 800; }
.answer-option strong { color: var(--ink); font-size: 14px; line-height: 1.35; }
.answer-option > svg { opacity: 0; color: var(--accent); }
.answer-option.is-selected > svg { opacity: 1; }
.selection-note { display: flex; align-items: center; gap: 7px; margin: 12px 0 0; color: var(--muted); font-size: 12px; }
.selection-note svg { width: 15px; }
.query-box { height: 58px; display: grid; grid-template-columns: 24px 1fr; gap: 10px; align-items: center; padding: 0 16px; border: 2px solid var(--line-strong); border-radius: 8px; background: var(--surface); }
.query-box:focus-within { border-color: var(--accent); }
.query-box input { min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font: 600 17px/1 "DM Sans", sans-serif; }
.simulated-search { margin-top: 12px; padding: 17px; border-radius: 8px; background: var(--surface-soft); }
.simulated-search span { color: var(--accent); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.simulated-search p { margin: 5px 0 0; font-size: 13px; }
.order-work { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.order-options, .order-result { display: grid; align-content: start; gap: 8px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); }
.order-options button { min-height: 48px; display: grid; grid-template-columns: 26px 1fr; gap: 9px; align-items: center; padding: 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); cursor: pointer; text-align: left; }
.order-options button:disabled { opacity: .35; }
.order-options button span, .order-result li span { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: white; font-size: 11px; font-weight: 800; }
.order-result > span { color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.order-result ol { min-height: 160px; display: grid; align-content: start; gap: 7px; margin: 0; padding: 0; list-style: none; }
.order-result li { display: grid; grid-template-columns: 26px 1fr; gap: 8px; align-items: center; padding: 7px; border-bottom: 1px solid var(--line); font-size: 13px; }
.practice-map { position: relative; min-height: 340px; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: #dfe8df; }
.map-grid { position: absolute; inset: 0; background-image: linear-gradient(#c8d6ca 1px, transparent 1px), linear-gradient(90deg, #c8d6ca 1px, transparent 1px); background-size: 44px 44px; transform: rotate(7deg) scale(1.2); }
.practice-map::after { content: ""; position: absolute; left: 44%; top: -10%; width: 11%; height: 120%; border: 9px solid #90b5cf; border-top: 0; border-bottom: 0; transform: rotate(-12deg); }
.practice-map button { position: absolute; z-index: 2; left: var(--mx); top: var(--my); display: grid; justify-items: center; gap: 3px; background: transparent; cursor: pointer; transform: translate(-50%, -50%); }
.practice-map button svg { width: 31px; height: 31px; fill: var(--surface); color: var(--brand); }
.practice-map button span { padding: 5px 8px; border-radius: 5px; background: var(--surface); box-shadow: var(--shadow-sm); color: var(--ink); font-size: 11px; font-weight: 700; }
.practice-map button.is-selected svg { fill: var(--accent); color: var(--accent); }
.answer-feedback { display: none; margin-top: 16px; padding: 14px 16px; border-radius: 8px; grid-template-columns: 24px 1fr; gap: 10px; }
.answer-feedback.is-correct, .answer-feedback.is-wrong { display: grid; }
.answer-feedback.is-correct { background: color-mix(in srgb, var(--success) 12%, var(--surface)); color: var(--success); }
.answer-feedback.is-wrong { background: color-mix(in srgb, var(--warning) 12%, var(--surface)); color: var(--warning); }
.answer-feedback strong { color: inherit; }
.answer-feedback p { margin: 3px 0 0; color: var(--text); font-size: 13px; line-height: 1.45; }
.lesson-footer { position: sticky; z-index: 65; bottom: 0; display: flex; align-items: center; justify-content: center; gap: 24px; padding: 0 max(28px, calc((100vw - 1120px) / 2)); border-top: 1px solid var(--line); background: var(--surface); box-shadow: 0 -10px 24px rgba(23,32,42,.05); }
.lesson-footer > div { display: grid; gap: 2px; }
.lesson-footer > div > span { color: var(--muted); font-size: 12px; }
.lesson-footer > div > small { display: inline-flex; align-items: center; gap: 5px; color: var(--success); font-size: 9px; }
.lesson-footer > div > small svg { width: 13px; }
.lesson-footer .primary-button { min-width: 180px; }
.lesson-actions { min-width: 0; display: flex; align-items: stretch; gap: 8px; }
.lesson-actions > button { min-width: 0; }
.lesson-actions .hint-button { min-width: 170px; }
.lesson-footer > div:first-child { min-width: 240px; }
.lesson-actions { width: min(360px, 100%); }
.lesson-topbar-nav { display: flex; align-items: center; gap: 8px; }
.lesson-home-button { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font: 700 12px/1 "DM Sans", sans-serif; cursor: pointer; }
.lesson-home-button svg { width: 15px; }
.single-mode-top { display: inline-flex; align-items: center; gap: 9px; width: fit-content; margin: 0 0 16px; padding: 9px 13px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); color: var(--ink); font-size: 13px; font-weight: 800; }
.single-mode-top svg { width: 16px; color: var(--accent); }
.selection-mode-top span { display: grid; gap: 2px; }
.selection-mode-top small { color: var(--muted); font-size: 11px; font-weight: 600; line-height: 1.35; }
.spin { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.result-page { min-height: calc(100vh - 72px); display: grid; justify-items: center; align-content: center; padding: 40px 24px; text-align: center; }
.result-mark { width: 86px; height: 86px; display: grid; place-items: center; margin-bottom: 22px; border-radius: 50%; background: color-mix(in srgb, var(--accent) 13%, var(--surface)); color: var(--accent); }
.result-mark svg { width: 42px; height: 42px; }
.result-page h1 { margin: 7px 0; color: var(--ink); font: 800 44px/1.1 "Manrope", sans-serif; }
.result-page p { margin: 0; }
.result-score { margin: 27px 0; color: var(--accent); }
.result-score strong { font: 800 72px/1 "Manrope", sans-serif; }
.result-score span { color: var(--muted); font-size: 22px; }

.case-app { height: calc(100vh - 72px); min-height: 620px; display: grid; grid-template-rows: 60px minmax(0, 1fr); overflow: hidden; background: #dfe3e7; }
.case-topbar { display: grid; grid-template-columns: 40px 1fr auto; gap: 15px; align-items: center; padding: 0 16px; background: var(--dark); color: white; }
.case-topbar .icon-button { border-color: rgba(255,255,255,.15); background: rgba(255,255,255,.06); color: white; }
.case-topbar > div:nth-child(2) { display: grid; }
.case-topbar span { color: rgba(255,255,255,.6); font-size: 10px; text-transform: uppercase; }
.case-topbar strong { font: 700 15px/1.25 "Manrope", sans-serif; }
.autosave { display: flex !important; align-items: center; gap: 7px; }
.autosave svg { width: 17px; color: #61d2a7; }
.case-workspace { min-height: 0; display: grid; grid-template-columns: 74px minmax(0, 1fr) 300px; gap: 1px; background: #aeb6be; }
.case-tools { display: flex; flex-direction: column; align-items: stretch; gap: 5px; padding: 12px 7px; background: #202a33; color: rgba(255,255,255,.65); }
.case-tools > strong { padding: 6px 2px 10px; color: rgba(255,255,255,.38); font-size: 8px; text-align: center; text-transform: uppercase; }
.case-tools button { min-height: 58px; display: grid; justify-items: center; align-content: center; gap: 4px; border-radius: 6px; background: transparent; color: inherit; cursor: pointer; }
.case-tools button span { font-size: 8px; }
.case-tools button svg { width: 19px; }
.case-tools button:hover, .case-tools button.is-active { background: rgba(255,255,255,.09); color: white; }
.sim-browser { min-width: 0; display: grid; grid-template-rows: 38px 46px minmax(0, 1fr); background: #eef1f3; }
.browser-tabs { min-width: 0; display: flex; gap: 2px; padding: 6px 8px 0; overflow-x: auto; background: #cfd5da; }
.browser-tabs button { min-width: 150px; max-width: 210px; display: grid; grid-template-columns: 15px 1fr; gap: 6px; align-items: center; padding: 0 10px; border-radius: 6px 6px 0 0; background: #bfc6cc; color: #35414d; cursor: pointer; }
.browser-tabs button.is-active { background: #eef1f3; }
.browser-tabs button svg { width: 14px; }
.browser-tabs button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.browser-bar { min-width: 0; display: grid; grid-template-columns: 30px 30px minmax(0, 1fr) 30px; gap: 5px; align-items: center; padding: 6px 9px; border-bottom: 1px solid #cfd5da; }
.browser-bar button { height: 30px; display: grid; place-items: center; border-radius: 5px; background: transparent; }
.browser-bar button svg { width: 15px; }
.browser-bar > div { min-width: 0; height: 31px; display: grid; grid-template-columns: 16px 1fr; gap: 7px; align-items: center; padding: 0 10px; border: 1px solid #ccd2d7; border-radius: 6px; background: white; }
.browser-bar > div svg { width: 13px; color: #54705f; }
.browser-bar > div span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #52606c; font-size: 11px; }
.source-page { position: relative; min-height: 0; overflow-y: auto; margin: 10px; border: 1px solid #d6dce0; border-radius: 6px; background: white; color: #28343f; }
.source-page > img { width: 100%; max-height: 45vh; object-fit: cover; }
.source-masthead { min-height: 110px; display: flex; justify-content: space-between; align-items: end; padding: 22px; border-bottom: 1px solid #dde1e4; background: #f4f5f6; }
.source-masthead span { color: #17202a; font: 800 25px/1.2 "Manrope", sans-serif; }
.source-masthead small { color: #71808d; }
.source-content { max-width: 720px; padding: 34px; }
.source-label { color: var(--accent); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.source-content h1 { margin: 7px 0 13px; color: #17202a; font: 800 34px/1.15 "Manrope", sans-serif; }
.source-content p { font: 500 18px/1.65 "DM Sans", sans-serif; }
.source-meta { display: grid; grid-template-columns: 90px 1fr; gap: 8px 12px; margin-top: 28px; padding-top: 18px; border-top: 1px solid #e1e4e7; font-size: 12px; }
.source-meta span { color: #71808d; }
.source-meta strong { overflow-wrap: anywhere; }
.capture-button { position: sticky; left: 100%; bottom: 18px; min-height: 42px; display: inline-flex; align-items: center; gap: 8px; margin: 0 18px 18px auto; padding: 0 14px; border-radius: 6px; background: var(--accent); color: white; cursor: pointer; font-weight: 700; }
.evidence-panel { min-height: 0; display: grid; grid-template-rows: 46px minmax(120px, 1fr) auto auto auto; padding: 0 13px 13px; background: var(--surface); }
.workspace-tabs { display: flex; gap: 12px; border-bottom: 1px solid var(--line); }
.workspace-tabs button { background: transparent; color: var(--muted); font-size: 12px; font-weight: 700; }
.workspace-tabs button.is-active { color: var(--ink); box-shadow: inset 0 -2px var(--accent); }
.workspace-tabs span { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--surface-soft); font-size: 10px; }
.evidence-list { min-height: 0; display: grid; align-content: start; gap: 7px; padding: 11px 0; overflow-y: auto; }
.evidence-list article { display: grid; grid-template-columns: 30px 1fr; gap: 8px; align-items: center; padding: 9px; border: 1px solid var(--line); border-radius: 6px; }
.evidence-list article > svg { width: 18px; color: var(--accent); }
.evidence-list article div { min-width: 0; display: grid; }
.evidence-list article strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-size: 11px; }
.evidence-list article span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 9px; }
.empty-evidence { align-self: center; display: grid; justify-items: center; padding: 20px; color: var(--muted); text-align: center; }
.empty-evidence p { max-width: 180px; font-size: 12px; }
.case-note { display: grid; gap: 5px; margin-bottom: 8px; }
.case-note span, .delivery-drawer label > span { color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.case-note textarea, .delivery-drawer textarea { width: 100%; resize: vertical; border: 1px solid var(--line-strong); border-radius: 6px; outline: 0; padding: 10px; background: var(--surface); color: var(--ink); font-size: 12px; }
.case-note textarea:focus, .delivery-drawer textarea:focus { border-color: var(--accent); }
.evidence-panel .secondary-button, .evidence-panel .primary-button { min-height: 40px; margin-top: 7px; font-size: 12px; }
.delivery-drawer { position: fixed; z-index: 100; top: 72px; right: 0; bottom: 0; width: min(460px, 100%); overflow-y: auto; padding: 25px; border-left: 1px solid var(--line); background: var(--surface); box-shadow: -24px 0 60px rgba(18,25,32,.18); transform: translateX(105%); transition: transform .25s ease; }
.delivery-drawer.is-open { transform: translateX(0); }
.drawer-head { display: flex; justify-content: space-between; align-items: start; gap: 20px; }
.drawer-head h2 { margin: 5px 0; color: var(--ink); font: 700 25px/1.2 "Manrope", sans-serif; }
.delivery-drawer > p { line-height: 1.5; }
.delivery-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 20px 0; }
.delivery-summary span { display: grid; padding: 12px; border-radius: 7px; background: var(--surface-soft); color: var(--muted); font-size: 11px; }
.delivery-summary strong { color: var(--ink); font-size: 21px; }
.delivery-drawer label { display: grid; gap: 6px; }
.confidence-row { display: grid; grid-template-columns: auto 1fr 42px; gap: 10px; align-items: center; margin: 20px 0; }
.confidence-row span { color: var(--muted); font-size: 12px; }
.confidence-row input { accent-color: var(--accent); }
.confidence-row strong { color: var(--ink); }
.case-review { margin-top: 12px; padding: 14px; border-radius: 7px; background: color-mix(in srgb, var(--warning) 12%, var(--surface)); }
.case-review.is-passed { background: color-mix(in srgb, var(--success) 12%, var(--surface)); }
.case-review strong { color: var(--ink); }
.case-review p { margin: 5px 0; font-size: 13px; }
.case-review span { color: var(--muted); font-size: 11px; }

.simple-page { padding-bottom: 80px; }
.simple-heading { display: block; max-width: 760px; padding-top: 54px; }
.simple-heading h1 { font-size: 48px; }
.route-list { display: grid; gap: 10px; }
.route-item { min-height: 105px; display: grid; grid-template-columns: 42px 52px 1fr auto; gap: 17px; align-items: center; padding: 16px 20px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; text-align: left; }
.route-item:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); }
.route-index { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 800; }
.route-item > svg { width: 48px; height: 48px; padding: 12px; border-radius: 8px; background: var(--accent); color: white; }
.route-item > div:nth-child(3) { display: grid; gap: 3px; }
.route-item small { color: var(--muted); font-size: 10px; text-transform: uppercase; }
.route-item strong { color: var(--ink); font: 700 18px/1.25 "Manrope", sans-serif; }
.route-item p { margin: 0; color: var(--muted); font-size: 13px; }
.route-percent { display: flex; align-items: center; gap: 18px; }
.route-percent strong { color: var(--accent); }

.library-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 18px; }
.library-toolbar label { width: min(440px, 100%); height: 46px; display: grid; grid-template-columns: 20px 1fr; gap: 8px; align-items: center; padding: 0 13px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.library-toolbar input { border: 0; outline: 0; background: transparent; color: var(--ink); }
.library-toolbar > span { color: var(--muted); font-size: 13px; }
.library-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 11px; }
.knowledge-card { min-height: 210px; display: flex; flex-direction: column; padding: 18px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.knowledge-card > div { display: flex; align-items: center; gap: 9px; color: var(--accent); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.knowledge-card > div svg { width: 18px; }
.knowledge-card h2 { margin: 18px 0 7px; color: var(--ink); font: 700 18px/1.25 "Manrope", sans-serif; }
.knowledge-card p { margin: 0; font-size: 13px; line-height: 1.45; }
.knowledge-card > small { margin-top: auto; padding-top: 18px; color: var(--muted); }
.knowledge-card.is-locked { background: var(--surface-soft); opacity: .7; }

.profile-hero { display: grid; grid-template-columns: 82px 1fr auto; gap: 20px; align-items: center; padding: 54px 0 34px; }
.profile-avatar-large { width: 82px; height: 82px; display: grid; place-items: center; border-radius: 50%; background: var(--dark); color: white; font: 800 23px/1 "Manrope", sans-serif; }
.profile-hero h1 { margin: 4px 0; color: var(--ink); font: 800 34px/1.1 "Manrope", sans-serif; }
.profile-hero p { margin: 0; }
.profile-home-button { grid-column: 3; grid-row: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; }
.profile-home-button svg { width: 18px; height: 18px; }
.profile-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 14px; }
.profile-card { padding: 22px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.certificate-card { position: relative; display: grid; grid-template-columns: 48px 1fr auto; gap: 14px; align-items: center; grid-column: 1 / -1; border-color: color-mix(in srgb, var(--brand) 24%, var(--line)); }
.certificate-icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; background: color-mix(in srgb, var(--brand) 12%, var(--surface)); color: var(--brand); }
.certificate-icon svg { width: 25px; }
.certificate-card h2 { margin: 3px 0 4px; font: 800 19px/1.15 "Manrope", sans-serif; }
.certificate-card p { margin: 0; color: var(--muted); font-size: 12px; }
.certificate-download { display: inline-flex; width: fit-content; min-height: 38px; margin-top: 12px; padding: 0 12px; font-size: 11px; text-decoration: none; }
.certificate-download svg { width: 15px; }
.certificate-status { padding: 6px 9px; border-radius: 99px; background: var(--surface-soft); color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.certificate-card.is-earned { border-color: var(--brand); box-shadow: 0 8px 22px color-mix(in srgb, var(--brand) 12%, transparent); }
.certificate-card.is-earned .certificate-icon { background: var(--brand); color: white; }
.certificate-card.is-earned .certificate-status { background: color-mix(in srgb, var(--success) 14%, var(--surface)); color: var(--success); }
.account-card { grid-column: 1 / -1; }
.account-card > p { margin: -4px 0 18px; color: var(--muted); }
.account-card dl { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 18px; }
.account-card dl div { padding: 12px; border-radius: 7px; background: var(--surface-soft); }
.account-card dt { color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.account-card dd { margin: 4px 0 0; color: var(--ink); font-weight: 700; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-bottom: 16px; padding: 4px; border-radius: 7px; background: var(--surface-soft); }
.auth-tabs button { min-height: 38px; border-radius: 5px; background: transparent; cursor: pointer; font-weight: 700; }
.auth-tabs button.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.auth-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.auth-form[hidden] { display: none; }
.auth-form label { display: grid; gap: 5px; }
.auth-form label span { color: var(--muted); font-size: 11px; font-weight: 700; }
.auth-form input { width: 100%; min-height: 44px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface); color: var(--ink); }
.auth-form input:focus { outline: 2px solid color-mix(in srgb, var(--brand) 18%, transparent); border-color: var(--brand); }
.auth-form button { align-self: end; }
.auth-gate[hidden], .app-shell[hidden] { display: none !important; }
.auth-gate { min-height: 100vh; padding: 22px; background: #f4f6f7; color: var(--ink); }
.auth-gate-shell { width: min(1080px,100%); min-height: calc(100vh - 44px); margin: 0 auto; display: grid; grid-template-rows: auto 1fr; border: 1px solid var(--line); background: var(--surface); box-shadow: 0 24px 70px rgba(20,29,35,.08); }
.auth-gate-header { min-height: 68px; display: flex; align-items: center; gap: 10px; padding: 0 24px; border-bottom: 1px solid var(--line); }
.auth-gate-header > strong { font: 800 18px/1 "Manrope",sans-serif; }
.auth-gate-header label { margin-left: auto; display: flex; align-items: center; gap: 7px; color: var(--muted); }
.auth-gate-header label svg { width: 17px; }
.auth-gate-header select { min-height: 36px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); }
.auth-gate-main { display: grid; grid-template-columns: minmax(0,1.1fr) minmax(340px,.8fr); gap: clamp(40px,8vw,100px); align-items: center; padding: clamp(36px,8vw,90px); }
.auth-intro h1 { max-width: 620px; margin: 10px 0 16px; font: 800 52px/1.06 "Manrope",sans-serif; letter-spacing: 0; }
.auth-intro > p { max-width: 580px; margin: 0; color: var(--muted); font-size: 18px; line-height: 1.6; }
.auth-intro ul { display: grid; gap: 13px; margin: 32px 0 0; padding: 0; list-style: none; }
.auth-intro li { display: flex; align-items: center; gap: 10px; font-weight: 650; }
.auth-intro li svg { width: 20px; color: var(--brand); }
.auth-box { padding: 24px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow-md); }
.gate-form { display: grid; gap: 14px; }
.gate-form[hidden] { display: none; }
.gate-form h2 { margin: 2px 0 4px; font: 750 22px/1.2 "Manrope",sans-serif; }
.gate-form label { display: grid; gap: 6px; }
.gate-form label span { color: var(--muted); font-size: 11px; font-weight: 700; }
.gate-form input { width: 100%; min-height: 48px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); color: var(--ink); font-size: 15px; }
.gate-form input:focus { outline: 3px solid color-mix(in srgb,var(--brand) 14%,transparent); border-color: var(--brand); }
.gate-form button { min-height: 48px; margin-top: 4px; }
.demo-start { display: grid; grid-template-columns: minmax(160px,220px) auto; gap: 10px; align-items: end; margin-top: 25px; }
.demo-start label { display: grid; gap: 5px; }
.demo-start label span { color: var(--muted); font-size: 11px; font-weight: 700; }
.demo-start select { width: 100%; min-height: 46px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); color: var(--ink); }
.demo-start button { min-height: 46px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.level-choice { display: grid; gap: 7px; margin: 0; padding: 0; border: 0; }
.level-choice legend { margin-bottom: 7px; color: var(--muted); font-size: 11px; font-weight: 700; }
.level-choice > label { position: relative; }
.level-choice input { position: absolute; opacity: 0; pointer-events: none; }
.level-choice label > span { min-height: 54px; display: grid; align-content: center; gap: 2px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
.level-choice label > span strong { color: var(--ink); font-size: 12px; }
.level-choice label > span small { color: var(--muted); font-size: 10px; }
.level-choice input:checked + span { border-color: var(--brand); background: color-mix(in srgb,var(--brand) 7%,var(--surface)); box-shadow: inset 3px 0 var(--brand); }
.is-demo .app-header,.is-demo .mobile-nav { display: none; }
.is-demo #app-main { min-height: 100vh; }
.lesson-level-badge { display: inline-flex; width: fit-content; margin-bottom: 14px; padding: 6px 9px; border-radius: 5px; background: var(--accent); color: white; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.world-cover-simple { grid-template-columns: minmax(0,720px); }
.skill-row { display: grid; grid-template-columns: 160px 1fr 32px; gap: 12px; align-items: center; margin: 14px 0; }
.skill-row span { color: var(--ink); font-size: 13px; }
.skill-row > div { height: 8px; overflow: hidden; border-radius: 99px; background: var(--surface-soft); }
.skill-row i { display: block; height: 100%; background: var(--brand); }
.skill-row strong { text-align: right; }
.profile-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.profile-stats div { display: grid; padding: 14px; border-radius: 7px; background: var(--surface-soft); }
.profile-stats strong { color: var(--ink); font-size: 24px; }
.profile-stats span { color: var(--muted); font-size: 11px; }
.profile-card hr { margin: 22px 0; border: 0; border-top: 1px solid var(--line); }
.settings-row { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.settings-row > span { display: grid; }
.settings-row strong { color: var(--ink); }
.settings-row small { color: var(--muted); }
.language-setting { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.level-setting { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.language-setting select,.level-setting select { min-width: 132px; min-height: 42px; padding: 0 30px 0 11px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface); color: var(--ink); }
.profile-card .danger-button { width: 100%; margin-top: 24px; }

.toast-region { position: fixed; z-index: 300; right: 20px; bottom: 20px; display: grid; gap: 8px; pointer-events: none; }
.toast { max-width: 360px; padding: 13px 16px; border: 1px solid var(--line); border-radius: 7px; background: var(--dark); color: white; box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(8px); transition: .2s ease; }
.toast.is-visible { opacity: 1; transform: translateY(0); }
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.welcome-guide-backdrop { position: fixed; z-index: 240; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(8,13,18,.62); backdrop-filter: blur(8px); }
.welcome-guide { position: relative; width: min(640px,100%); padding: 30px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: 0 30px 90px rgba(0,0,0,.28); }
.welcome-guide-close { position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--muted); cursor: pointer; }
.welcome-guide-close svg { width: 17px; }
.welcome-guide h2 { margin: 7px 45px 6px 0; color: var(--ink); font: 800 28px/1.15 "Manrope", sans-serif; }
.welcome-guide-intro { margin: 0 0 22px; color: var(--muted); line-height: 1.5; }
.welcome-guide-steps { display: grid; gap: 8px; }
.welcome-guide-steps article { display: grid; grid-template-columns: 30px 1fr; gap: 11px; align-items: start; padding: 11px 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-soft); }
.welcome-guide-steps article > strong { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: var(--brand); color: white; font-size: 11px; }
.welcome-guide-steps article span { display: grid; gap: 2px; }.welcome-guide-steps b { color: var(--ink); font-size: 13px; }.welcome-guide-steps small { color: var(--muted); font-size: 11px; line-height: 1.35; }
.welcome-guide-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 22px; }
.contextual-guide { width: min(320px, 100%); padding: 16px; border: 1px solid var(--line); border-top: 3px solid var(--brand); border-radius: 8px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); }
.contextual-guide::before, .contextual-guide::after { display: none; }
.contextual-guide .kicker { color: var(--brand); font-weight: 900; }
.contextual-guide h2 { color: var(--ink); font-size: 19px; }
.contextual-guide .welcome-guide-intro { color: var(--muted); font-size: 13px; line-height: 1.45; }
.contextual-guide-next { display: flex; align-items: flex-start; gap: 7px; margin-top: 11px; padding: 10px; border: 1px solid var(--line); border-left: 3px solid var(--brand); border-radius: 6px; background: var(--surface-soft); color: var(--ink); font-size: 12px; font-weight: 700; line-height: 1.4; }
.contextual-guide-next svg { flex: 0 0 auto; width: 20px; margin-top: 1px; }
.contextual-guide .welcome-guide-actions { margin-top: 14px; gap: 6px; }
.contextual-guide .welcome-guide-actions button { min-height: 34px; padding: 0 9px; font-size: 11px; }
.contextual-guide .primary-button { background: var(--brand); border-color: var(--brand); color: white; box-shadow: none; }
.contextual-guide .text-button { color: var(--muted); }
.contextual-guide-backdrop { display: block; padding: 0; background: transparent; backdrop-filter: none; pointer-events: none; }
.contextual-guide-backdrop .contextual-guide { position: fixed; pointer-events: auto; }
.guide-highlight { z-index: 241 !important; outline: 3px solid var(--brand) !important; outline-offset: 5px; }
.guide-highlight.option-grid { outline-width: 2px; outline-offset: 8px; border-radius: 10px; }

@media (max-width: 980px) {
  .app-header { grid-template-columns: 1fr auto; }
  .main-nav { display: none; }
  .city-layout { grid-template-columns: 1fr; }
  .next-mission { min-height: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
  .mission-world { margin-top: 0; }
  .mission-body { margin-top: 0; }
  .next-mission .primary-button { margin-top: 0; align-self: end; }
  .next-mission .text-button, .mission-top { display: none; }
  .world-cover-grid { grid-template-columns: 1fr 340px; gap: 30px; }
  .lesson-stage { grid-template-columns: 220px 1fr; gap: 30px; }
  .case-workspace { grid-template-columns: 62px minmax(0, 1fr) 260px; }
  .world-summary-grid, .library-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  body { padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
  .app-header { height: 60px; padding: 0 14px; }
  .brand-word, .streak-chip span, .xp-chip span { display: none; }
  .header-language { padding-left: 7px; }
  .header-language svg { display: none; }
  .header-level { padding: 0 6px; }
  .header-level svg { display: none; }
  .header-level select { width: 76px; }
  .streak-chip,.xp-chip,#theme-toggle { display: none; }
  .streak-chip, .xp-chip { padding: 0 9px; }
  .header-actions .profile-button { display: none; }
  .auth-form, .account-card dl { grid-template-columns: 1fr; }
  #app-main { min-height: calc(100vh - 60px); }
  .mobile-nav { position: fixed; z-index: 90; left: 0; right: 0; bottom: 0; height: calc(64px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(4, 1fr); padding-bottom: env(safe-area-inset-bottom); border-top: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 96%, transparent); backdrop-filter: blur(18px); }
  .mobile-nav button { display: grid; justify-items: center; align-content: center; gap: 3px; color: var(--muted); font-size: 9px; font-weight: 700; }
  .mobile-nav button svg { width: 20px; }
  .mobile-nav button.is-active { color: var(--brand); }
  .page-wrap { width: min(100% - 28px, 620px); }
  .city-heading, .simple-heading { display: block; padding: 30px 0 20px; }
  .city-heading h1, .simple-heading h1, .world-title-block h1 { font-size: 34px; }
  .city-heading p, .simple-heading p, .world-title-block p { font-size: 15px; }
  .rank-panel { width: 100%; margin-top: 20px; }
  .home-status { width: 100%; margin-top: 20px; }
  .city-map { min-height: 610px; }
  .city-map::after { inset: 60px 20px; }
  .district { width: 130px; min-height: 104px; grid-template-columns: 38px 1fr; gap: 7px; padding: 9px; }
  .district-building { width: 38px; height: 46px; }
  .district-building svg { width: 20px; }
  .district-copy strong { font-size: 11px; }
  .district-search { --x: 23% !important; --y: 18% !important; }
  .district-visual { --x: 72% !important; --y: 17% !important; }
  .district-documents { --x: 27% !important; --y: 44% !important; }
  .district-geoint { --x: 73% !important; --y: 43% !important; }
  .district-identity { --x: 27% !important; --y: 70% !important; }
  .district-infrastructure { --x: 73% !important; --y: 69% !important; }
  .city-legend { bottom: 12px; }
  .next-mission { display: block; padding: 18px; }
  .mission-world { padding-bottom: 13px; }
  .mission-body { margin: 15px 0 18px; }
  .mission-body h2 { font-size: 24px; }
  .world-strip { padding: 38px 0 30px; }
  .section-heading { align-items: start; }
  .section-heading h2 { font-size: 21px; }
  .world-summary-grid, .library-grid { grid-template-columns: 1fr; }
  .world-cover { padding-top: 14px; }
  .world-cover-grid { display: block; padding: 22px 0; }
  .level-selector { grid-template-columns: 1fr; }
  .level-selector button, .level-selector > div { min-height: 58px; }
  .level-selector button small, .level-selector > div small { display: block; }
  .story-brief { grid-template-columns: 1fr; gap: 18px; padding: 19px; margin-bottom: 32px; }
  .lesson-row { grid-template-columns: 40px 1fr 20px; padding: 12px; }
  .mechanic-tag { grid-column: 2; justify-self: start; }
  .row-arrow { grid-column: 3; grid-row: 1 / 3; }
  .lesson-copy strong { font-size: 15px; }
  .lesson-player { min-height: calc(100vh - 60px - 64px); grid-template-rows: 60px auto 72px; }
  .lesson-topbar { grid-template-columns: 40px 1fr 54px; gap: 10px; padding: 0 12px; }
  .score-live span { display: none; }
  .lesson-stage { width: min(100% - 28px, 620px); display: block; padding: 24px 0 110px; }
  .guide-panel { display: grid; grid-template-columns: 52px 1fr; gap: 2px 12px; align-items: center; margin-bottom: 22px; }
  .guide-panel h2 { margin: 1px 0; font-size: 17px; }
  .guide-panel p { font-size: 12px; }
  .scenario-chip { grid-column: 1 / -1; margin-top: 12px; }
  .exercise-heading h1 { font-size: 23px; margin-bottom: 20px; }
  .option-grid { grid-template-columns: 1fr; }
  .answer-option { min-height: 62px; }
  .order-work { grid-template-columns: 1fr; }
  .practice-map { min-height: 300px; }
  .lesson-footer { position: fixed; z-index: 70; left: 0; right: 0; bottom: calc(64px + env(safe-area-inset-bottom)); height: 72px; padding: 0 14px; background: var(--surface); }
  .lesson-footer > div { display: none; }
  .lesson-footer .primary-button { width: 100%; }
  .result-page { min-height: calc(100vh - 124px); }
  .result-page h1 { font-size: 34px; }
  .case-app { height: auto; min-height: calc(100vh - 60px - 64px); overflow: visible; grid-template-rows: 60px auto; }
  .case-topbar { position: sticky; z-index: 50; top: 60px; }
  .case-workspace { display: grid; grid-template-columns: 1fr; gap: 0; }
  .case-tools { position: sticky; z-index: 45; top: 120px; display: flex; flex-direction: row; overflow-x: auto; padding: 6px; }
  .case-tools > strong { display: none; }
  .case-tools button { min-width: 68px; min-height: 48px; }
  .sim-browser { min-height: 620px; }
  .source-content { padding: 24px 20px; }
  .source-content h1 { font-size: 28px; }
  .source-content p { font-size: 16px; }
  .evidence-panel { min-height: 470px; grid-template-rows: 46px minmax(160px, auto) auto auto auto; }
  .delivery-drawer { top: 60px; bottom: 64px; }
  .route-item { grid-template-columns: 36px 44px 1fr 24px; padding: 13px; }
  .route-item > svg { width: 42px; height: 42px; }
  .route-percent strong { display: none; }
  .route-item p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .library-toolbar { display: block; }
  .library-toolbar > span { display: block; margin-top: 9px; }
  .profile-hero { grid-template-columns: 64px 1fr; padding-top: 32px; }
  .profile-avatar-large { width: 64px; height: 64px; }
  .profile-hero .secondary-button { grid-column: 1 / -1; }
  .profile-grid { grid-template-columns: 1fr; }
  .skill-row { grid-template-columns: 120px 1fr 30px; }
  .toast-region { left: 14px; right: 14px; bottom: 78px; }
  .toast { max-width: none; }
}

body.is-guest .header-actions .profile-button.is-guest-cta { display: inline-flex; width: auto; min-width: 38px; }

/* Keep the world overview focused on the lessons instead of a tall title block. */
.world-cover { padding-top: 14px; }
.world-cover-grid { gap: 24px; padding: 15px 0 20px; }
.world-title-block h1 { max-width: 760px; margin: 5px 0 8px; font-size: clamp(36px, 4vw, 44px); line-height: 1.08; }
.world-title-block p { max-width: 760px; margin: 0; line-height: 1.4; }
.world-content { padding-bottom: 48px; }
.story-brief { margin: 8px 0 24px; padding: 18px 22px; }
.lesson-road { max-width: 1040px; }

@media (max-width: 720px) {
  .world-cover-grid { padding: 12px 0 16px; }
  .world-title-block h1 { font-size: 32px; }
  .world-content { padding-bottom: 28px; }
  .story-brief { margin: 4px 0 20px; padding: 16px; }
}

/* Keep each home's progress bar attached to its own text card. */
.district-copy .district-progress { position: relative; z-index: auto; left: auto; right: auto; bottom: auto; grid-column: 1; width: 100%; height: 4px; margin: 6px 0 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Rich investigation and learning surfaces */
.investigation-brief { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; overflow: hidden; margin: -8px 0 22px; border: 1px solid var(--line); border-radius: 8px; background: var(--line); }
.investigation-brief > div { min-height: 88px; padding: 13px 15px; background: var(--surface-soft); }
.investigation-brief .brief-primary { grid-column: 1 / -1; min-height: 72px; background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.investigation-brief .brief-process { border-left: 3px solid var(--accent); }
.investigation-brief small { color: var(--accent); font-size: 9px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.investigation-brief p { margin: 5px 0 0; font-size: 12px; line-height: 1.45; }
.investigation-brief ul { margin: 5px 0 0; padding-left: 16px; font-size: 11px; line-height: 1.45; }

.city-map { min-height: 700px; background: #24313a; }
.terrain-zone { position: absolute; z-index: -1; border: 1px solid rgba(255,255,255,.05); background: rgba(123,158,113,.09); transform: rotate(-8deg); }
.terrain-one { left: 3%; top: 5%; width: 30%; height: 36%; border-radius: 48% 32% 44% 35%; }
.terrain-two { right: 2%; top: 11%; width: 34%; height: 38%; border-radius: 30% 48% 35% 46%; background: rgba(190,151,92,.07); }
.terrain-three { left: 18%; right: 18%; bottom: 4%; height: 32%; border-radius: 45%; background: rgba(95,145,157,.09); }
.map-tree { position: absolute; z-index: 1; width: 15px; height: 22px; border-radius: 50% 50% 42% 42%; background: #54765a; box-shadow: 0 8px 0 -4px #172028; }
.map-tree::after { content: ""; position: absolute; left: 6px; bottom: -7px; width: 3px; height: 9px; background: #8a684c; }
.tree-a { left: 8%; top: 52%; }.tree-b { left: 35%; top: 12%; }.tree-c { right: 8%; top: 52%; }.tree-d { right: 38%; bottom: 10%; }
.map-lamp { position: absolute; z-index: 1; width: 4px; height: 23px; background: #7f8990; }
.map-lamp::before { content: ""; position: absolute; left: -4px; top: -5px; width: 12px; height: 8px; border-radius: 4px; background: #f0c96a; box-shadow: 0 0 18px rgba(240,201,106,.5); }
.lamp-a { left: 33%; top: 47%; }.lamp-b { right: 32%; top: 44%; }.lamp-c { left: 50%; bottom: 17%; }
.district { width: 178px; min-height: 150px; grid-template-columns: 72px 1fr; align-items: center; border: 0; background: transparent; box-shadow: none; }
.district:hover, .district:focus-visible { border-color: transparent; transform: translate(-50%, -54%); }
.district-building { position: relative; width: 70px; height: 86px; display: block; border-radius: 0; background: transparent; box-shadow: 0 15px 24px rgba(0,0,0,.24); }
.building-roof { position: absolute; z-index: 3; left: -5px; top: 0; width: 80px; height: 25px; clip-path: polygon(50% 0,100% 100%,0 100%); background: color-mix(in srgb, var(--world) 70%, #15202a); }
.building-face { position: absolute; z-index: 2; left: 4px; right: 4px; top: 22px; bottom: 0; display: grid; place-items: center; border: 2px solid rgba(255,255,255,.18); border-radius: 3px 3px 6px 6px; background: color-mix(in srgb, var(--world) 74%, #283640); }
.building-face > svg { width: 24px; height: 24px; margin-top: -16px; color: white; }
.building-face b { position: absolute; left: 9px; right: 9px; bottom: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.building-face b i { height: 8px; border: 1px solid rgba(255,255,255,.35); background: rgba(235,220,154,.65); }
.building-door { position: absolute; z-index: 4; left: 29px; bottom: 0; width: 14px; height: 21px; border-radius: 2px 2px 0 0; background: #17212a; }
.district-copy { padding: 10px 9px; border: 1px solid rgba(255,255,255,.14); border-radius: 7px; background: rgba(18,25,32,.92); box-shadow: 0 12px 22px rgba(0,0,0,.18); }
.district-progress { grid-column: 2; margin: -8px 9px 0; }
.current-position { position: absolute; z-index: 7; left: var(--x); top: var(--y); display: grid; justify-items: center; gap: 3px; transform: translate(48px, 56px); pointer-events: none; }
.current-position span { width: 32px; height: 32px; display: grid; place-items: center; border: 3px solid white; border-radius: 50%; background: var(--brand); color: white; box-shadow: 0 8px 18px rgba(0,0,0,.28); font-size: 9px; font-weight: 900; }
.current-position small { padding: 3px 6px; border-radius: 4px; background: white; color: #17202a; font-size: 8px; font-weight: 800; }
.next-mission { min-height: 700px; }

.case-app-v2 { min-height: 620px; }
.case-workspace-v2 { grid-template-columns: 78px minmax(0,1fr) 330px; }
.case-center { min-width: 0; min-height: 0; overflow-y: auto; background: #eef1f3; }
[data-theme="dark"] .case-center { background: #11181e; }
.case-briefing-v2 { max-width: 880px; margin: 0 auto; padding: 42px clamp(24px,5vw,64px) 70px; }
.briefing-badge { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 28px; padding: 8px 10px; border-radius: 6px; background: color-mix(in srgb,var(--accent) 10%,var(--surface)); color: var(--accent); font-size: 11px; font-weight: 800; }
.briefing-badge svg { width: 16px; }
.case-briefing-v2 h1 { margin: 8px 0 10px; color: var(--ink); font: 800 42px/1.08 "Manrope",sans-serif; }
.case-lead { max-width: 760px; margin: 0 0 24px; font-size: 18px; line-height: 1.6; }
.case-objective { display: grid; gap: 5px; padding: 18px; border-left: 4px solid var(--accent); border-radius: 0 7px 7px 0; background: var(--surface); }
.case-objective small,.initial-material small { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.case-objective strong { color: var(--ink); }
.simple-case-question { padding: 22px; }
.simple-case-question strong { font-size: 19px; line-height: 1.45; }
.mission-question-strip { display: grid; grid-template-columns: 34px 1fr; gap: 11px; align-items: center; margin-bottom: 22px; padding: 14px 16px; border: 2px solid var(--accent); border-radius: 7px; background: color-mix(in srgb,var(--accent) 7%,var(--surface)); }
.mission-question-strip > svg { width: 31px; height: 31px; color: var(--accent); }.mission-question-strip span { display: grid; gap: 2px; }.mission-question-strip small { color: var(--accent); font-size: 9px; font-weight: 800; text-transform: uppercase; }.mission-question-strip strong { color: var(--ink); font-size: 15px; line-height: 1.35; }
.mini-mission { display: grid; gap: 3px; margin-bottom: 20px; padding: 11px 13px; border-radius: 6px; background: #edf1f3; }.mini-mission small { color: #6b7780; font-size: 8px; font-weight: 800; text-transform: uppercase; }.mini-mission strong { color: #27343d; font-size: 12px; line-height: 1.4; }
.initial-material { display: grid; gap: 8px; margin: 32px 0; }
.initial-material h2 { margin: 3px 0 8px; color: var(--ink); font: 700 22px/1.2 "Manrope",sans-serif; }
.initial-material button { min-height: 66px; display: grid; grid-template-columns: 38px 1fr 22px; gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); cursor: pointer; text-align: left; }
.initial-material button:hover { border-color: var(--accent); }
.initial-material button > svg:first-child { width: 38px; height: 38px; padding: 9px; border-radius: 6px; background: color-mix(in srgb,var(--accent) 12%,var(--surface)); color: var(--accent); }
.initial-material button span { min-width: 0; display: grid; }
.initial-material button strong { color: var(--ink); }
.initial-material button span small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-transform: none; }
.dossier-summary { display: flex; flex-wrap: wrap; gap: 18px; margin: 22px 0 0; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.dossier-summary span { display: inline-flex; align-items: baseline; gap: 6px; color: var(--muted); font-size: 11px; }
.dossier-summary strong { color: var(--ink); font-size: 18px; }
.case-method { display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; margin-bottom: 25px; }
.case-method > div { min-height: 112px; padding: 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.case-method span { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: white; font-size: 10px; font-weight: 800; }
.case-method p { display: grid; gap: 3px; margin: 10px 0 0; color: var(--muted); font-size: 11px; line-height: 1.4; }
.case-method strong { color: var(--ink); font-size: 13px; }

.research-tool { min-height: 100%; padding: 32px; }
.research-tool > header { max-width: 760px; margin-bottom: 22px; }
.research-tool > header h2,.map-toolbar h2 { margin: 5px 0 6px; color: var(--ink); font: 700 28px/1.2 "Manrope",sans-serif; }
.research-tool > header p { margin: 0; line-height: 1.5; }
.research-search { height: 54px; display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: center; padding-left: 15px; border: 2px solid var(--line-strong); border-radius: 8px; background: var(--surface); }
.research-search:focus-within { border-color: var(--accent); }
.research-search input { min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); }
.research-search .primary-button { min-height: 46px; margin-right: 3px; }
.query-history { display: flex; align-items: center; gap: 6px; overflow-x: auto; padding: 10px 0; }
.query-history > span { color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.query-history button { flex: 0 0 auto; padding: 6px 8px; border-radius: 5px; background: var(--surface); color: var(--muted); cursor: pointer; font-size: 10px; }
.result-summary { display: flex; gap: 8px; margin: 20px 0 10px; font-size: 12px; }
.result-summary strong { color: var(--ink); }.result-summary span { color: var(--muted); }
.material-filters { display: flex; gap: 5px; overflow-x: auto; margin-top: 12px; padding-bottom: 2px; }
.material-filters button { flex: 0 0 auto; min-height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--muted); cursor: pointer; font-size: 10px; font-weight: 700; }
.material-filters button.is-active { border-color: var(--accent); background: color-mix(in srgb,var(--accent) 9%,var(--surface)); color: var(--accent); }
.optional-search { margin-top: 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.optional-search summary { display: flex; align-items: center; gap: 8px; padding: 11px 13px; color: var(--muted); cursor: pointer; font-size: 11px; font-weight: 700; }
.optional-search summary svg { width: 16px; }
.optional-search .research-search { margin: 0 10px 10px; }
.simple-tip { border-color: color-mix(in srgb,var(--accent) 30%,var(--line)); background: color-mix(in srgb,var(--accent) 7%,var(--surface)); }
.search-results { display: grid; gap: 8px; }
.visual-source-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.search-result.visual-source-card { position: relative; display: grid; grid-template-columns: minmax(150px,42%) 1fr; gap: 0; overflow: hidden; padding: 0; }
.source-number { position: absolute; z-index: 3; left: 10px; top: 10px; width: 27px; height: 27px; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: white; box-shadow: 0 3px 10px rgba(0,0,0,.16); font-size: 11px; font-weight: 900; }
.visual-source-copy { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; padding: 15px; }
.visual-source-copy h3 { margin: 8px 0 7px; }
.visual-source-copy > p { display: -webkit-box; overflow: hidden; margin-bottom: 14px; color: var(--muted); font-size: 11px; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.visual-source-copy .primary-button { width: 100%; min-height: 36px; margin-top: auto; }
.source-kind { display: inline-flex; align-items: center; gap: 5px; color: var(--accent); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.source-kind svg { width: 14px; }
.source-preview { position: relative; min-height: 190px; overflow: hidden; background: #e8ecef; color: #31404a; }
.source-preview > svg { width: 24px; }
.preview-photo img { width: 100%; height: 100%; min-height: 190px; display: block; object-fit: cover; }
.preview-message { padding: 26px 16px 16px; background: #e6edf2; }
.preview-message-head { display: grid; grid-template-columns: 32px 1fr auto; gap: 7px; align-items: center; margin-bottom: 22px; }
.preview-message-head > span { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: white; }
.preview-message-head svg { width: 17px; }
.preview-message-head b,.preview-message-line { height: 8px; border-radius: 2px; background: white; }
.preview-message-head small { font-size: 7px; }.preview-message-line { width: 72%; margin: 9px 0; }.preview-message-line.is-long { width: 94%; }.preview-message-line.is-short { width: 48%; }
.preview-message > svg { position: absolute; right: 15px; bottom: 13px; color: #71808b; }
.preview-network { min-height: 190px; background: #e4ece9; }
.network-center,.network-node { position: absolute; z-index: 2; display: grid; place-items: center; border: 3px solid white; border-radius: 50%; background: #2f6f67; box-shadow: 0 4px 12px rgba(26,51,48,.18); }
.network-center { left: 50%; top: 50%; width: 58px; height: 58px; transform: translate(-50%,-50%); color: white; }.network-center svg { width: 25px; }
.network-node { width: 23px; height: 23px; background: #8ca9a3; }.node-a { left: 18%; top: 22%; }.node-b { right: 16%; top: 19%; }.node-c { right: 19%; bottom: 16%; }
.network-line { position: absolute; z-index: 1; left: 50%; top: 50%; height: 2px; transform-origin: left center; background: #9cb3ae; }.line-a { width: 68px; transform: rotate(215deg); }.line-b { width: 70px; transform: rotate(320deg); }.line-c { width: 66px; transform: rotate(35deg); }
.preview-data { display: grid; grid-template-columns: 1.2fr .8fr; gap: 13px; align-items: end; padding: 28px 17px 20px; background: #ece9e2; }
.preview-chart { height: 112px; display: flex; align-items: end; gap: 7px; padding: 8px; border-left: 2px solid #8d8a83; border-bottom: 2px solid #8d8a83; }
.preview-chart i { width: 18%; height: var(--h); background: #bb7d3f; }.preview-data-list { align-self: center; }.preview-data-list span { display: block; height: 7px; margin: 10px 0; border-radius: 2px; background: white; }.preview-data > strong { position: absolute; left: 17px; top: 13px; font-size: 9px; text-transform: uppercase; }
.preview-browser { padding: 23px 12px 12px; background: #dde7ed; }
.preview-browser-bar { height: 24px; display: flex; align-items: center; gap: 4px; padding: 0 7px; border-radius: 5px 5px 0 0; background: #34434e; }.preview-browser-bar i { width: 5px; height: 5px; border-radius: 50%; background: #aebbc3; }.preview-browser-bar span { height: 9px; flex: 1; margin-left: 5px; border-radius: 2px; background: #63727c; }
.preview-browser-page { height: 120px; padding: 18px 14px; background: white; }.preview-browser-page b { display: block; width: 55%; height: 12px; margin-bottom: 16px; background: #35434d; }.preview-browser-page span { display: block; width: 90%; height: 6px; margin: 9px 0; background: #d5dce0; }.preview-browser-page span:last-child { width: 58%; }.preview-browser em { position: absolute; right: 17px; bottom: 18px; color: #6b7881; font-size: 8px; font-style: normal; }
.preview-map { background-color: #dce8da; background-image: linear-gradient(rgba(118,143,115,.16) 1px,transparent 1px),linear-gradient(90deg,rgba(118,143,115,.16) 1px,transparent 1px); background-size: 28px 28px; }.map-route { position: absolute; width: 130%; height: 14px; background: white; box-shadow: 0 0 0 2px #c2cdc0; }.route-a { left: -10%; top: 42%; transform: rotate(17deg); }.route-b { left: -20%; top: 66%; transform: rotate(-24deg); }.preview-map > span { position: absolute; z-index: 3; left: 54%; top: 42%; color: #c44639; }.preview-map > span svg { width: 38px; height: 38px; fill: white; }
.preview-timeline { padding: 28px 18px; background: #ece8ef; }.preview-timeline > i { position: absolute; left: 33px; top: 30px; bottom: 30px; width: 3px; background: #a593ad; }.preview-timeline > span { position: relative; z-index: 2; display: grid; grid-template-columns: 17px 1fr; gap: 10px; align-items: center; margin: 14px 0; }.preview-timeline b { width: 17px; height: 17px; border: 4px solid white; border-radius: 50%; background: #765c82; }.preview-timeline small { overflow: hidden; color: #54485a; font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.preview-registry { padding: 24px 15px 15px; background: #ebe8df; }.preview-registry > div { display: flex; align-items: center; gap: 7px; padding-bottom: 10px; border-bottom: 2px solid #414b4f; }.preview-registry > div svg { width: 18px; }.preview-registry > div strong { font-size: 9px; letter-spacing: .08em; }.preview-registry > span { display: grid; gap: 3px; margin-top: 14px; }.preview-registry small { color: #77776f; font-size: 7px; }.preview-registry b { overflow: hidden; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }.preview-registry > em { position: absolute; right: 13px; bottom: 13px; color: #4d7967; }.preview-registry > em svg { width: 31px; height: 31px; }
.preview-document { display: grid; place-items: center; padding: 18px; background: #e5e8eb; }.preview-paper { width: 76%; height: 145px; padding: 20px 16px; background: white; box-shadow: 0 6px 14px rgba(32,44,52,.12); }.preview-paper > svg { width: 20px; color: #65737d; }.preview-paper b,.preview-paper span { display: block; height: 7px; margin-top: 13px; background: #35434d; }.preview-paper span { width: 100%; height: 5px; margin-top: 9px; background: #d6dce0; }.preview-paper span.short { width: 58%; }.preview-document > small { position: absolute; bottom: 7px; font-size: 7px; font-weight: 800; text-transform: uppercase; }
.source-visual-large { display: block; margin-bottom: 14px; }.source-visual-large .source-preview { min-height: 230px; border-radius: 7px; }.source-visual-large .preview-photo img { min-height: 230px; }
.search-result { display: grid; grid-template-columns: 56px 1fr; gap: 14px; padding: 17px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.result-type { display: grid; justify-items: center; align-content: center; gap: 4px; border-radius: 6px; background: var(--surface-soft); color: var(--accent); }
.result-type span { font-size: 8px; text-transform: uppercase; }
.search-result small { color: var(--muted); font-size: 10px; }
.search-result h3 { margin: 4px 0; color: var(--ink); font: 700 17px/1.25 "Manrope",sans-serif; }
.search-result p { margin: 0; font-size: 13px; line-height: 1.45; }
.source-order { display: inline-block; margin-bottom: 4px; color: var(--accent); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.search-result .source-purpose { display: grid; grid-template-columns: 20px 1fr; gap: 8px; margin-top: 10px; padding: 10px; border-radius: 6px; background: var(--surface-soft); color: var(--muted); font-size: 11px; }
.source-purpose svg { width: 17px; color: var(--accent); }
.source-purpose span { display: grid; gap: 2px; }
.source-purpose strong { color: var(--ink); }
.result-actions { display: flex; gap: 8px; margin-top: 12px; }
.result-actions .primary-button { min-height: 36px; font-size: 11px; }
.tool-empty { min-height: 100%; display: grid; justify-items: center; align-content: center; padding: 48px 24px; text-align: center; }
.tool-empty > svg { width: 52px; height: 52px; padding: 12px; border-radius: 8px; background: color-mix(in srgb,var(--accent) 12%,var(--surface)); color: var(--accent); }
.tool-empty h2,.tool-empty h3 { margin: 15px 0 4px; color: var(--ink); }
.tool-empty p { max-width: 440px; margin: 0 0 18px; }

.archive-controls { display: grid; grid-template-columns: 1fr auto; gap: 12px; margin-bottom: 14px; }
.archive-controls label { height: 44px; display: grid; grid-template-columns: 20px 1fr; gap: 8px; align-items: center; padding: 0 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.archive-controls input { border: 0; outline: 0; background: transparent; color: var(--ink); }
.segmented { display: flex; gap: 2px; padding: 3px; border-radius: 7px; background: var(--surface-soft); }
.segmented button,.analyzer-modes button { padding: 0 10px; border-radius: 5px; background: transparent; color: var(--muted); cursor: pointer; font-size: 10px; font-weight: 700; }
.segmented button.is-active,.analyzer-modes button.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.archive-table { overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.archive-table-head,.archive-row { display: grid; grid-template-columns: minmax(260px,1fr) 100px 90px 22px; gap: 10px; align-items: center; }
.archive-table-head { padding: 9px 13px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.archive-row { width: 100%; min-height: 62px; padding: 9px 13px; border-bottom: 1px solid var(--line); background: transparent; cursor: pointer; text-align: left; }
.archive-row:last-child { border-bottom: 0; }.archive-row:hover { background: var(--surface-soft); }
.archive-row > span:first-child { min-width: 0; display: grid; grid-template-columns: 30px 1fr; gap: 0 9px; }
.archive-row > span:first-child svg { grid-row: 1 / 3; align-self: center; color: var(--accent); }
.archive-row strong,.archive-row small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.archive-row strong { color: var(--ink); font-size: 12px; }.archive-row small,.archive-row > span { color: var(--muted); font-size: 9px; }

.browser-v2 { min-height: 100%; grid-template-rows: 48px minmax(0,1fr); }
.browser-v2 .source-page { margin: 14px; }
.source-page-v2 { display: flex; flex-direction: column; }
.source-page-v2 .source-masthead > span { display: inline-flex; align-items: center; gap: 7px; }
.source-page-v2 .source-masthead svg { width: 16px; }
.source-content-rich { width: min(900px,100%); margin: 0 auto; }
.source-content-rich > h1 { margin-bottom: 18px; }
.look-here { display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: center; margin: 0 0 16px; padding: 12px; border-left: 3px solid var(--accent); background: #f2f5f6; }
.look-here > svg { width: 22px; color: var(--accent); }
.look-here span { display: grid; gap: 2px; }
.look-here small { color: #697680; font-size: 9px; font-weight: 800; text-transform: uppercase; }
.look-here strong { color: #24313b; font-size: 12px; }
.technical-details { margin-top: 15px; border-top: 1px solid #dfe3e7; }
.technical-details summary { padding: 12px 0; color: #65727c; cursor: pointer; font-size: 10px; font-weight: 700; }
.technical-details .source-meta { margin-top: 0; }
.artifact-facts { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); border: 1px solid #dfe3e7; border-radius: 6px; overflow: hidden; background: #dfe3e7; gap: 1px; }
.artifact-facts > div { min-width: 0; display: grid; gap: 4px; padding: 12px; background: white; }
.artifact-facts small { color: #697680; font-size: 9px; font-weight: 800; text-transform: uppercase; }
.artifact-facts strong { color: #24313b; font-size: 12px; overflow-wrap: anywhere; }
.artifact-message,.artifact-record { margin-bottom: 18px; border: 1px solid #d8dee3; border-radius: 7px; background: #f8f9fa; overflow: hidden; }
.artifact-message > header,.artifact-record > header { display: flex; align-items: center; gap: 10px; padding: 13px 15px; border-bottom: 1px solid #d8dee3; background: white; }
.artifact-message > header > svg,.artifact-record > header > svg { width: 34px; height: 34px; padding: 8px; border-radius: 6px; background: #edf1f3; color: #34434e; }
.artifact-message > header span,.artifact-record > header span { min-width: 0; display: grid; flex: 1; }
.artifact-message > header small,.artifact-record > header small { color: #697680; font-size: 9px; text-transform: uppercase; }
.artifact-message > header strong,.artifact-record > header strong { color: #24313b; font-size: 12px; }
.artifact-message time { color: #697680; font-size: 10px; }
.artifact-message .artifact-facts,.artifact-record .artifact-facts { margin: 14px; }
.artifact-message blockquote { margin: 0; padding: 2px 18px 18px; color: #24313b; font-size: 14px; line-height: 1.6; }
.artifact-record > p { margin: 0; padding: 2px 15px 16px; color: #44525d; font-size: 13px; line-height: 1.55; }
.artifact-document { padding: 20px; border: 1px solid #d8dee3; border-radius: 7px; background: #e9ecef; }
.document-sheet { max-width: 700px; margin: 0 auto; padding: clamp(22px,4vw,42px); background: white; box-shadow: 0 8px 22px rgba(27,38,46,.1); }
.document-sheet > header { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 10px; border-bottom: 2px solid #24313b; color: #697680; font-size: 9px; font-weight: 800; text-transform: uppercase; }
.document-sheet h2 { margin: 22px 0 12px; color: #24313b; font-size: 22px; }
.document-sheet > p { color: #44525d; line-height: 1.65; }
.document-sheet .artifact-facts { margin-top: 20px; }
.artifact-image { margin: 0 0 16px; overflow: hidden; border-radius: 6px; background: #182128; }
.artifact-image img { width: 100%; max-height: 52vh; display: block; object-fit: contain; }
.artifact-image figcaption { padding: 8px 11px; color: #dce3e8; font-size: 9px; }
.source-action-bar { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: 8px; padding: 12px; border-top: 1px solid #dfe3e7; background: rgba(255,255,255,.95); }
.source-action-bar .primary-button,.source-action-bar .secondary-button { min-height: 40px; }
.easy-source-view { height: max(440px,calc(100dvh - 264px)); min-height: 0; display: grid; grid-template-rows: 64px minmax(0,1fr) auto; overflow: hidden; background: #f4f6f7; }
.easy-source-header { display: grid; grid-template-columns: 38px minmax(0,1fr) auto; gap: 12px; align-items: center; padding: 0 18px; border-bottom: 1px solid var(--line); background: var(--surface); }
.easy-source-header > span:nth-child(2) { min-width: 0; display: grid; gap: 2px; }
.easy-source-header small { color: var(--accent); font-size: 9px; font-weight: 900; text-transform: uppercase; }
.easy-source-header strong { overflow: hidden; color: var(--ink); font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.easy-source-type { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.easy-source-type svg { width: 16px; }
.easy-source-scroll { min-height: 0; overflow-y: auto; padding: 22px; }
.easy-question { width: min(940px,100%); display: grid; grid-template-columns: 36px 1fr; gap: 12px; align-items: center; margin: 0 auto 14px; padding: 12px 15px; border: 1px solid color-mix(in srgb,var(--accent) 28%,var(--line)); border-radius: 7px; background: color-mix(in srgb,var(--accent) 7%,var(--surface)); }
.easy-question > svg { width: 24px; color: var(--accent); }
.easy-question span { display: grid; gap: 2px; }
.easy-question small,.easy-finding small,.easy-remember small { color: var(--muted); font-size: 9px; font-weight: 900; text-transform: uppercase; }
.easy-question strong { color: var(--ink); font-size: 13px; line-height: 1.4; }
.easy-clue-card { width: min(940px,100%); display: grid; grid-template-columns: minmax(280px,42%) minmax(0,1fr); margin: 0 auto; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: 0 8px 22px rgba(25,37,45,.07); }
.easy-clue-visual { position: relative; min-height: 390px; background: #e5e9ec; }
.easy-clue-visual > .source-preview { height: 100%; min-height: 390px; }
.easy-clue-visual .preview-photo img { min-height: 390px; }
.easy-clue-visual > span { position: absolute; z-index: 4; left: 14px; bottom: 14px; display: inline-flex; align-items: center; gap: 6px; padding: 7px 9px; border-radius: 5px; background: rgba(23,32,42,.88); color: white; font-size: 10px; font-weight: 800; }
.easy-clue-visual > span svg { width: 14px; }
.easy-clue-copy { min-width: 0; padding: clamp(22px,3vw,36px); }
.easy-clue-copy h1 { margin: 8px 0 20px; color: var(--ink); font: 800 clamp(24px,3vw,34px)/1.15 "Manrope",sans-serif; letter-spacing: 0; }
.easy-finding { padding: 15px 16px; border-left: 4px solid var(--accent); background: var(--surface-soft); }
.easy-finding p { margin: 5px 0 0; color: var(--ink); font-size: 16px; font-weight: 600; line-height: 1.5; }
.easy-facts { margin-top: 22px; }
.easy-facts h2 { margin: 0 0 9px; color: var(--ink); font-size: 13px; }
.easy-facts > div { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.easy-fact { min-width: 0; display: grid; grid-template-columns: 30px minmax(0,1fr); gap: 9px; align-items: center; padding: 11px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.easy-fact > svg { width: 30px; height: 30px; padding: 7px; border-radius: 5px; background: color-mix(in srgb,var(--accent) 10%,var(--surface)); color: var(--accent); }
.easy-fact span { min-width: 0; display: grid; gap: 2px; }
.easy-fact small { overflow: hidden; color: var(--muted); font-size: 8px; font-weight: 800; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.easy-fact strong { overflow-wrap: anywhere; color: var(--ink); font-size: 12px; }
.easy-remember { width: min(940px,100%); display: grid; grid-template-columns: 38px 1fr; gap: 12px; align-items: center; margin: 14px auto 0; padding: 13px 15px; border-radius: 7px; background: #fff; }
.easy-remember > svg { width: 34px; height: 34px; padding: 8px; border-radius: 6px; background: var(--accent); color: white; }
.easy-remember span { display: grid; gap: 2px; }
.easy-remember strong { color: var(--ink); font-size: 12px; }
.easy-technical { width: min(940px,100%); margin: 8px auto 0; }
.easy-technical summary { display: flex; align-items: center; gap: 7px; }
.easy-technical summary svg { width: 15px; }
.easy-source-actions { position: relative; justify-content: center; padding: 12px 18px; }
.easy-source-actions button { min-width: 190px; }
.analyzer-modes { display: inline-flex; gap: 2px; height: 40px; padding: 3px; border-radius: 7px; background: var(--surface-soft); }
.analysis-report { margin: 15px 0; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.analysis-status { display: flex; align-items: center; gap: 8px; padding: 12px 15px; border-bottom: 1px solid var(--line); color: var(--success); font-size: 11px; font-weight: 700; }
.analysis-status svg { width: 17px; }
.analysis-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); }
.analysis-grid > div { min-height: 90px; padding: 15px; background: var(--surface); }
.analysis-grid small { display: block; margin-bottom: 6px; color: var(--muted); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.analysis-grid strong { color: var(--ink); overflow-wrap: anywhere; }.analysis-grid p { margin: 0; font-size: 12px; line-height: 1.5; }
.term-cloud { display: flex; flex-wrap: wrap; gap: 6px; }.term-cloud span { padding: 5px 7px; border-radius: 4px; background: var(--surface-soft); font-size: 10px; }
.analysis-actions { display: flex; justify-content: flex-end; gap: 8px; }

.map-tool-v2 { min-height: 100%; display: grid; grid-template-rows: auto minmax(460px,1fr) auto; padding: 22px; }
.map-toolbar,.map-footer { display: flex; justify-content: space-between; align-items: center; gap: 18px; }
.map-toolbar > div:last-child { display: flex; align-items: center; gap: 6px; }
.map-toolbar button,.map-pan-controls button { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); cursor: pointer; }
.map-toolbar span { min-width: 45px; text-align: center; font-size: 11px; font-weight: 800; }
.investigation-map { position: relative; min-height: 460px; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 8px; background: #dfe9df; }
.map-canvas { position: absolute; inset: -12%; transform-origin: center; background-image: linear-gradient(#cad7ca 1px,transparent 1px),linear-gradient(90deg,#cad7ca 1px,transparent 1px); background-size: 50px 50px; transition: transform .2s ease; }
.map-water { position: absolute; left: 43%; top: -10%; width: 16%; height: 120%; border-left: 15px solid #8bb9d0; border-right: 15px solid #8bb9d0; transform: rotate(-9deg); background: #a8cede; }
.map-road { position: absolute; height: 24px; background: #aeb6b4; border-top: 2px solid white; border-bottom: 2px solid white; }
.map-road-one { left: -5%; right: -5%; top: 45%; transform: rotate(12deg); }.map-road-two { left: 18%; right: 4%; top: 68%; transform: rotate(-25deg); }
.map-park { position: absolute; right: 8%; top: 13%; width: 24%; height: 26%; border: 5px solid #a9c99e; border-radius: 40%; background: #bdd7b3; }
.case-map-marker,.custom-map-marker { position: absolute; z-index: 3; left: var(--px); top: var(--py); display: grid; justify-items: center; gap: 3px; transform: translate(-50%,-50%); }
.case-map-marker { background: transparent; cursor: pointer; }.case-map-marker svg,.custom-map-marker svg { width: 30px; height: 30px; fill: var(--surface); color: var(--brand); }
.case-map-marker span,.custom-map-marker small { max-width: 130px; padding: 4px 6px; border-radius: 4px; background: var(--surface); box-shadow: var(--shadow-sm); color: var(--ink); font-size: 8px; font-weight: 700; text-align: center; }
.custom-map-marker svg { color: var(--success); }.map-pan-controls { position: absolute; left: 12px; bottom: 12px; display: grid; grid-template-columns: repeat(3,34px); gap: 3px; }.map-pan-controls button:first-child { grid-column: 2; }.map-pan-controls button:nth-child(2) { grid-column: 1; }.map-pan-controls button:nth-child(4) { grid-column: 2; }
.map-footer { padding-top: 12px; color: var(--muted); font-size: 11px; }.map-footer span { display: flex; align-items: center; gap: 7px; }

.evidence-panel-v2 { grid-template-rows: 48px minmax(0,1fr) auto; padding: 0 12px 12px; }
.workspace-tabs-v2 { gap: 3px; overflow-x: auto; }.workspace-tabs-v2 button { flex: 1 0 auto; padding: 0 6px; font-size: 10px; }
.workspace-body { min-height: 0; display: grid; align-content: start; gap: 8px; padding: 10px 0; overflow-y: auto; }
.evidence-card,.hypothesis-card,.note-card { padding: 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.evidence-card > div { display: flex; justify-content: space-between; color: var(--accent); }.evidence-card > div svg { width: 17px; }.reliability { color: #d79b21; letter-spacing: 2px; }
.evidence-card strong,.hypothesis-card strong { display: block; margin: 5px 0; color: var(--ink); font-size: 12px; }.evidence-card p,.note-card p { margin: 0 0 5px; font-size: 11px; line-height: 1.4; }.evidence-card small,.hypothesis-card small,.note-card small { color: var(--muted); font-size: 8px; overflow-wrap: anywhere; }
.hypothesis-form { display: grid; gap: 6px; padding: 9px; border-radius: 7px; background: var(--surface-soft); }.hypothesis-form input,.hypothesis-form select { min-width: 0; height: 36px; border: 1px solid var(--line); border-radius: 5px; padding: 0 8px; background: var(--surface); color: var(--ink); }.hypothesis-form > div { display: grid; grid-template-columns: 1fr 70px 36px; gap: 5px; }.hypothesis-form button { display: grid; place-items: center; border-radius: 5px; background: var(--accent); color: white; cursor: pointer; }
.hypothesis-card > span { color: var(--muted); font-size: 8px; font-weight: 800; text-transform: uppercase; }.hypothesis-card.status-supported { border-left: 3px solid var(--success); }.hypothesis-card.status-discarded { opacity: .62; border-left: 3px solid var(--danger); }

.modal-backdrop,.guide-backdrop { position: fixed; z-index: 140; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(10,15,20,.65); backdrop-filter: blur(8px); }
.capture-dialog { width: min(560px,100%); max-height: calc(100vh - 40px); overflow-y: auto; padding: 22px; border-radius: 8px; background: var(--surface); box-shadow: var(--shadow-lg); }
.capture-dialog h2 { margin: 5px 0; color: var(--ink); font-size: 20px; }.capture-dialog > p { font-size: 12px; line-height: 1.5; }.capture-dialog label { display: grid; gap: 5px; margin: 12px 0; }.capture-dialog label > span { color: var(--muted); font-size: 9px; font-weight: 800; text-transform: uppercase; }.capture-dialog textarea,.capture-dialog select { width: 100%; border: 1px solid var(--line-strong); border-radius: 6px; padding: 9px; resize: vertical; background: var(--surface); color: var(--ink); }.capture-dialog textarea:focus,.capture-dialog select:focus { outline: 2px solid color-mix(in srgb,var(--accent) 35%,transparent); border-color: var(--accent); }
.score-only-review { display: grid; justify-items: center; margin-top: 14px; padding: 20px; border-radius: 8px; background: var(--surface-soft); text-align: center; }.score-only-review > span { color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }.score-only-review > strong { margin: 6px 0; color: var(--danger); font: 800 58px/1 "Manrope",sans-serif; }.score-only-review.is-passed > strong { color: var(--success); }.score-only-review small { font-size: 16px; }.score-only-review p { margin: 4px 0 14px; }
.delivery-warning { margin-top: 14px; padding: 14px; border: 1px solid color-mix(in srgb,var(--warning) 35%,var(--line)); border-radius: 7px; background: color-mix(in srgb,var(--warning) 10%,var(--surface)); }.delivery-warning strong { color: var(--ink); }.delivery-warning p,.delivery-warning li { font-size: 12px; }

.library-heading { display: grid; grid-template-columns: 1fr 220px; gap: 50px; max-width: none; }.library-progress { align-self: center; padding: 17px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }.library-progress strong { display: block; color: var(--ink); font: 800 28px/1 "Manrope",sans-serif; }.library-progress strong small { color: var(--muted); font-size: 14px; }.library-progress > span { color: var(--muted); font-size: 10px; }.library-progress .slim-progress { margin-top: 9px; }
.last-guide { width: 100%; min-height: 66px; display: grid; grid-template-columns: 36px 1fr 22px; gap: 12px; align-items: center; margin-bottom: 14px; padding: 12px 15px; border: 1px solid color-mix(in srgb,var(--brand) 35%,var(--line)); border-radius: 8px; background: color-mix(in srgb,var(--brand) 5%,var(--surface)); cursor: pointer; text-align: left; }.last-guide > svg:first-child { color: var(--brand); }.last-guide span { display: grid; }.last-guide small { color: var(--muted); }.last-guide strong { color: var(--ink); }
.library-toolbar-v2 { display: grid; grid-template-columns: minmax(220px,1fr) repeat(3,auto); }.library-toolbar-v2 select { min-height: 46px; padding: 0 28px 0 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--ink); }
.knowledge-card-v2 { min-height: 278px; }.knowledge-top { display: grid !important; grid-template-columns: 20px 1fr auto; }.knowledge-top em { padding: 4px 6px; border-radius: 4px; background: color-mix(in srgb,var(--accent) 10%,var(--surface)); font-size: 8px; font-style: normal; }.guide-meta { display: flex !important; flex-wrap: wrap; gap: 8px !important; margin-top: auto; padding: 16px 0 10px; color: var(--muted) !important; }.guide-meta span { display: flex; align-items: center; gap: 3px; font-size: 8px; }.guide-meta svg { width: 12px !important; }
.library-empty { grid-column: 1 / -1; display: grid; justify-items: center; padding: 60px 20px; color: var(--muted); text-align: center; }.library-empty svg { width: 42px; height: 42px; }.library-empty h2 { color: var(--ink); margin-bottom: 3px; }.library-empty p { margin: 0; }
.guide-detail { width: min(680px,100%); max-height: calc(100vh - 40px); overflow-y: auto; padding: 24px; border-radius: 8px; background: var(--surface); }.guide-detail h2 { margin: 4px 0; color: var(--ink); font: 700 26px/1.2 "Manrope",sans-serif; }.guide-lead { font-size: 16px; line-height: 1.55; }.guide-detail section { margin: 9px 0; padding: 13px; border-radius: 7px; background: var(--surface-soft); }.guide-detail section small { color: var(--brand); font-size: 9px; font-weight: 800; text-transform: uppercase; }.guide-detail section p { margin: 5px 0 0; font-size: 13px; line-height: 1.5; }

@media (max-width:980px) {
  .case-workspace-v2 { grid-template-columns: 68px minmax(0,1fr) 280px; }
  .case-method { grid-template-columns: 1fr 1fr; }
  .library-toolbar-v2 { grid-template-columns: 1fr 1fr; }
}

@media (max-width:720px) {
  .auth-gate { padding: 0; }
  .auth-gate-shell { min-height: 100vh; border: 0; }
  .auth-gate-main { grid-template-columns: 1fr; gap: 28px; align-items: start; padding: 30px 18px 50px; }
  .auth-intro h1 { font-size: 38px; }
  .auth-intro > p { font-size: 16px; }
  .auth-intro ul { margin-top: 22px; }
  .auth-box { padding: 18px; }
  .demo-start { grid-template-columns: 1fr; }
  .investigation-brief { grid-template-columns: 1fr; }.investigation-brief .brief-primary { grid-column: 1; }
  .city-map { min-height: 700px; }.next-mission { min-height: 0; }.district { width: 142px; grid-template-columns: 52px 1fr; }.district-building { width: 52px; height: 68px; }.building-roof { width: 60px; height: 19px; }.building-face { top: 17px; }.building-face > svg { width: 18px; }.building-face b { left: 7px; right: 7px; gap: 4px; }.building-face b i { height: 6px; }.building-door { left: 21px; width: 11px; height: 16px; }.current-position { transform: translate(30px,46px); }
  .case-app-v2 { min-height: calc(100vh - 124px); }.case-workspace-v2 { grid-template-columns: 1fr; }.case-center { min-height: 640px; }.case-briefing-v2 { padding: 26px 16px 50px; }.case-briefing-v2 h1 { font-size: 32px; }.case-method { grid-template-columns: 1fr 1fr; }.research-tool { padding: 20px 14px; }.research-search { grid-template-columns: 20px 1fr; height: auto; padding: 9px; }.research-search .primary-button { grid-column: 1 / -1; width: 100%; }.search-result { grid-template-columns: 42px 1fr; padding: 12px; }.archive-controls { grid-template-columns: 1fr; }.segmented { overflow-x: auto; }.archive-table-head { display: none; }.archive-row { grid-template-columns: 1fr 20px; }.archive-row > span:nth-child(2),.archive-row > span:nth-child(3) { display: none; }.analysis-grid { grid-template-columns: 1fr; }.map-tool-v2 { min-height: 650px; padding: 14px; }.map-footer { align-items: start; flex-direction: column; }.evidence-panel-v2 { min-height: 520px; }.modal-backdrop,.guide-backdrop { padding: 10px; }.capture-dialog,.guide-detail { max-height: calc(100vh - 86px); }.delivery-drawer { z-index: 160; }
  .library-heading { grid-template-columns: 1fr; gap: 16px; }.library-progress { width: 100%; }.library-toolbar-v2 { grid-template-columns: 1fr; }.knowledge-card-v2 { min-height: 250px; }
}

/* Guided investigation workspace */
.case-guided { grid-template-rows: 60px auto minmax(0,1fr); background: var(--surface-soft); }
.case-phase-nav { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 1px; padding: 0 clamp(12px,4vw,48px); border-bottom: 1px solid var(--line); background: var(--surface); }
.case-phase-nav button { min-height: 72px; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 3px solid transparent; background: transparent; color: var(--muted); cursor: pointer; text-align: left; }
.case-phase-nav button > span { width: 28px; height: 28px; flex: 0 0 28px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; font-size: 11px; font-weight: 800; }
.case-phase-nav button > span svg { width: 14px; }
.case-phase-nav button strong { font-size: 12px; line-height: 1.25; }
.case-phase-nav button.is-active { border-bottom-color: var(--accent); color: var(--ink); }
.case-phase-nav button.is-active > span { border-color: var(--accent); background: var(--accent); color: white; }
.case-phase-nav button.is-done { color: var(--ink); }
.case-phase-nav button.is-done > span { border-color: var(--success); color: var(--success); }
.case-phase-nav button:disabled { cursor: not-allowed; opacity: .42; }
.case-guided-layout { min-height: 0; display: grid; grid-template-columns: minmax(0,1fr) 260px; gap: 1px; background: var(--line); }
.case-guided .case-center { background: var(--surface-soft); }
.case-progress-card { padding: 24px 18px; background: var(--surface); }
.case-progress-card h2 { margin: 7px 0 20px; font: 750 18px/1.25 "Manrope",sans-serif; }
.case-progress-card > p { margin-top: 22px; padding: 12px; border-radius: 6px; background: var(--surface-soft); color: var(--muted); font-size: 11px; line-height: 1.5; }
.case-check { display: grid; grid-template-columns: 22px 1fr; gap: 9px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); color: var(--muted); }
.case-check > svg { width: 19px; }
.case-check > span { display: grid; gap: 2px; }
.case-check strong { color: var(--ink); font-size: 12px; }
.case-check small { font-size: 10px; }
.case-check.is-done > svg { color: var(--success); }
.case-simple-instructions { margin: 22px 0; padding: 18px 20px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.case-simple-instructions h2 { margin: 0 0 10px; font-size: 17px; }
.case-simple-instructions ol { display: grid; gap: 8px; margin: 0; padding-left: 22px; line-height: 1.45; }
.visual-case-steps { display: grid; grid-template-columns: 1fr 22px 1fr 22px 1fr; gap: 8px; align-items: center; margin: 24px 0; }
.visual-case-steps > div { position: relative; min-height: 118px; display: grid; justify-items: center; align-content: center; gap: 3px; padding: 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); text-align: center; }
.visual-case-steps > div > span { position: absolute; left: 8px; top: 8px; width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: white; font-size: 8px; font-weight: 900; }
.visual-case-steps > div > svg { width: 30px; height: 30px; margin-bottom: 6px; color: var(--accent); }.visual-case-steps > svg { width: 16px; color: var(--muted); }.visual-case-steps strong { color: var(--ink); }.visual-case-steps small { color: var(--muted); font-size: 9px; }
.guided-conclusion { max-width: 820px; margin: 0 auto; }
.conclusion-template { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin: 0 0 20px; }
.conclusion-template > div { display: grid; grid-template-columns: 26px 1fr; gap: 8px; padding: 13px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.conclusion-template span { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: white; font-size: 10px; font-weight: 800; }
.conclusion-template p { display: grid; gap: 3px; margin: 0; color: var(--muted); font-size: 11px; line-height: 1.4; }
.conclusion-template strong { color: var(--ink); font-size: 12px; }
.simple-hypothesis { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; margin-bottom: 16px; padding: 14px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.simple-hypothesis label,.conclusion-field { display: grid; gap: 6px; }
.simple-hypothesis label span,.conclusion-field > span { color: var(--ink); font-size: 12px; font-weight: 750; }
.simple-hypothesis input,.conclusion-field textarea { width: 100%; padding: 11px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); color: var(--ink); }
.saved-hypothesis { display: grid; grid-template-columns: 22px 1fr; gap: 9px; margin-bottom: 14px; padding: 12px; border-left: 3px solid var(--accent); background: var(--surface); }
.saved-hypothesis > span { display: grid; gap: 2px; }
.saved-hypothesis small { color: var(--muted); }
.answer-example { display: grid; grid-template-columns: 22px 1fr; gap: 9px; margin-bottom: 14px; padding: 12px; border-radius: 6px; background: color-mix(in srgb,var(--accent) 8%,var(--surface)); }
.answer-example svg { width: 19px; color: var(--accent); }
.answer-example p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.answer-example strong { color: var(--ink); }
.conclusion-field > small { color: var(--muted); text-align: right; }
.capture-dialog-simple { max-width: 560px; }
.case-top-actions { display: flex !important; align-items: center; gap: 12px; }
.case-help-button { min-height: 36px; display: inline-flex; align-items: center; gap: 7px; padding: 0 11px; border: 1px solid rgba(255,255,255,.16); border-radius: 6px; background: rgba(255,255,255,.06); color: white; cursor: pointer; font-size: 11px; font-weight: 700; }
.case-help-button:hover { background: rgba(255,255,255,.12); }
.case-help-button svg { width: 16px; }
.case-workspace-v2 { grid-template-columns: 164px minmax(0,1fr) 330px; }
.case-tools { gap: 4px; padding: 12px 8px; }
.case-tools > strong { padding: 6px 8px 9px; text-align: left; }
.case-tools button { position: relative; min-height: 64px; grid-template-columns: 21px minmax(0,1fr); justify-items: start; align-content: center; gap: 2px 9px; padding: 9px; text-align: left; }
.case-tools button > svg { grid-row: 1 / 3; align-self: start; margin-top: 2px; }
.case-tools button > span { min-width: 0; display: grid; gap: 3px; }
.case-tools button > span strong { color: inherit; font-size: 11px; line-height: 1.25; }
.case-tools button > span small { color: rgba(255,255,255,.42); font-size: 8px; line-height: 1.35; }
.case-tools button.is-active > span small { color: rgba(255,255,255,.68); }
.case-tools button > em { position: absolute; top: 7px; right: 7px; width: 7px; height: 7px; border: 2px solid #202a33; border-radius: 50%; background: #f3c64e; }
.case-tools button.is-active { box-shadow: inset 3px 0 var(--accent); }
.next-step-bar { position: sticky; z-index: 18; top: 0; min-height: 58px; display: grid; grid-template-columns: 22px minmax(0,1fr) auto; gap: 10px; align-items: center; padding: 8px 14px; border-bottom: 1px solid var(--line); background: color-mix(in srgb,var(--surface) 96%,transparent); backdrop-filter: blur(12px); }
.next-step-bar > svg { color: var(--accent); }
.next-step-bar > span { min-width: 0; display: grid; grid-template-columns: auto 1fr; gap: 1px 7px; align-items: baseline; }
.next-step-bar small { grid-column: 1 / -1; color: var(--muted); font-size: 8px; font-weight: 800; text-transform: uppercase; }
.next-step-bar strong { color: var(--ink); font-size: 11px; }
.next-step-bar em { overflow: hidden; color: var(--muted); font-size: 10px; font-style: normal; text-overflow: ellipsis; white-space: nowrap; }
.next-step-bar button { min-height: 32px; display: inline-flex; align-items: center; gap: 5px; padding: 0 9px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--ink); cursor: pointer; font-size: 10px; font-weight: 800; }
.next-step-bar button:hover { border-color: var(--accent); color: var(--accent); }
.next-step-bar button svg { width: 13px; }
.tool-usage { display: grid; grid-template-columns: 20px 1fr; gap: 9px; align-items: start; margin-bottom: 14px; padding: 10px 12px; border-left: 3px solid var(--accent); background: color-mix(in srgb,var(--accent) 6%,var(--surface)); }
.tool-usage svg { width: 17px; color: var(--accent); }
.tool-usage span { display: grid; gap: 2px; font-size: 11px; line-height: 1.4; }
.tool-usage strong { color: var(--ink); }
.hypothesis-form > label { display: grid; gap: 5px; }
.hypothesis-form > label > span { color: var(--muted); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.hypothesis-form button { min-width: 76px; display: inline-flex; gap: 4px; padding: 0 9px; font-size: 10px; font-weight: 800; }
.hypothesis-form button svg { width: 14px; }
.hypothesis-form > div { grid-template-columns: minmax(0,1fr) 68px 76px; }
.case-tour { position: fixed; z-index: 220; inset: 0; background: rgba(8,13,18,.69); backdrop-filter: blur(3px); }
.tour-card { position: absolute; width: min(390px,calc(100% - 32px)); padding: 24px; border: 1px solid rgba(255,255,255,.16); border-radius: 8px; background: var(--surface); box-shadow: 0 28px 80px rgba(0,0,0,.32); }
.tour-step-0 .tour-card { left: 178px; top: 126px; }
.tour-step-1 .tour-card { left: 50%; top: 50%; transform: translate(-50%,-50%); }
.tour-step-2 .tour-card { right: 344px; top: 126px; }
.tour-step-3 .tour-card { right: 30px; bottom: 30px; }
.tour-card > svg { width: 38px; height: 38px; margin: 10px 0 4px; padding: 8px; border-radius: 7px; background: color-mix(in srgb,var(--accent) 12%,var(--surface)); color: var(--accent); }
.tour-counter { color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.tour-card h2 { margin: 7px 0; color: var(--ink); font: 700 23px/1.2 "Manrope",sans-serif; }
.tour-card p { margin: 0 0 20px; line-height: 1.55; }
.tour-card > div:last-child { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.case-help-backdrop { place-items: stretch end; padding: 0; }
.case-help { width: min(460px,100%); height: 100%; overflow-y: auto; padding: 24px; background: var(--surface); box-shadow: -24px 0 70px rgba(0,0,0,.24); }
.case-help > p { line-height: 1.55; }
.help-tool-list { display: grid; gap: 6px; margin: 20px 0; }
.help-tool-list button { min-height: 58px; display: grid; grid-template-columns: 30px 1fr 18px; gap: 10px; align-items: center; padding: 9px 11px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); cursor: pointer; text-align: left; }
.help-tool-list button:hover { border-color: var(--accent); }
.help-tool-list button > svg:first-child { color: var(--accent); }
.help-tool-list button > svg:last-child { width: 15px; color: var(--muted); }
.help-tool-list button span { display: grid; gap: 2px; }
.help-tool-list strong { color: var(--ink); font-size: 13px; }
.help-tool-list small { color: var(--muted); font-size: 10px; }
.help-method { margin: 18px 0; padding: 14px; border-left: 3px solid var(--accent); background: var(--surface-soft); }
.help-method small { color: var(--accent); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.help-method p { margin: 5px 0 0; font-size: 12px; line-height: 1.5; }

/* Modular City Rulside map */
.city-map { min-height: 700px; background: #26343b; }
.city-map::before { z-index: -2; background-image: linear-gradient(rgba(255,255,255,.018) 1px,transparent 1px),linear-gradient(90deg,rgba(255,255,255,.018) 1px,transparent 1px); background-size: 28px 28px; transform: skewY(-3deg) scale(1.08); }
.city-map::after { display: none; }
.map-skyline { opacity: .38; }
.river { left: 45%; width: 11%; border-width: 12px; opacity: .48; }
.terrain-zone { z-index: -1; border-color: rgba(255,255,255,.035); }
.city-routes { position: absolute; z-index: 1; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.mobile-routes { display: none; }
.route-edge { fill: none; stroke: #152129; stroke-linecap: round; stroke-linejoin: round; stroke-width: 28; opacity: .86; }
.route-center { fill: none; stroke: #7b8990; stroke-dasharray: 10 9; stroke-linecap: round; stroke-width: 4; opacity: .8; }
.district { width: 226px; min-height: 136px; grid-template-columns: 84px minmax(0,1fr); gap: 9px; align-items: center; padding: 0; overflow: visible; }
.district:hover,.district:focus-visible { transform: translate(-50%,-54%); }
.district-building { position: relative; width: 82px; height: 92px; filter: drop-shadow(0 15px 11px rgba(0,0,0,.26)); box-shadow: none; }
.building-shadow { position: absolute; z-index: 0; left: 13px; bottom: -7px; width: 80px; height: 27px; border-radius: 50%; background: rgba(5,10,14,.32); transform: skewX(-28deg); }
.building-base { position: absolute; z-index: 1; left: 0; bottom: 0; width: 77px; height: 16px; clip-path: polygon(20% 0,100% 0,80% 100%,0 100%); background: #202b31; }
.building-face { position: absolute; z-index: 3; left: 8px; top: 26px; width: 52px; height: 58px; border: 1px solid rgba(255,255,255,.18); border-radius: 1px; background: color-mix(in srgb,var(--world) 68%,#314048); box-shadow: inset 0 -10px rgba(0,0,0,.08); }
.building-side { position: absolute; z-index: 2; left: 60px; top: 26px; width: 20px; height: 58px; clip-path: polygon(0 0,100% 24%,100% 100%,0 100%); background: color-mix(in srgb,var(--world) 38%,#243139); }
.building-roof { position: absolute; z-index: 5; left: 5px; top: 13px; width: 75px; height: 26px; clip-path: polygon(28% 0,100% 45%,72% 100%,0 55%); background: color-mix(in srgb,var(--world) 76%,#546068); box-shadow: inset 0 1px rgba(255,255,255,.28); }
.building-sign { position: absolute; z-index: 6; left: 21px; top: 34px; width: 26px; height: 26px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.3); border-radius: 4px; background: rgba(20,29,35,.82); color: white; }
.building-sign svg { width: 15px; height: 15px; }
.building-face b { position: absolute; left: 7px; right: 7px; bottom: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.building-face b i { height: 7px; border: 1px solid rgba(255,255,255,.28); background: rgba(241,216,130,.76); box-shadow: 0 0 7px rgba(241,216,130,.18); }
.building-door { z-index: 7; left: 43px; bottom: 8px; width: 12px; height: 19px; background: #172127; }
.district-copy { position: relative; z-index: 8; min-width: 0; min-height: 88px; align-content: start; padding: 11px 12px; border: 1px solid rgba(255,255,255,.16); border-radius: 6px; background: rgba(16,24,29,.94); box-shadow: 0 12px 26px rgba(0,0,0,.2); overflow: visible; }
.district-copy::before { content: ""; position: absolute; left: -6px; top: 28px; width: 10px; height: 10px; border-left: 1px solid rgba(255,255,255,.16); border-bottom: 1px solid rgba(255,255,255,.16); background: rgba(16,24,29,.94); transform: rotate(45deg); }
.district-copy small { color: rgba(255,255,255,.5); }
.district-copy strong { min-width: 0; font-size: 13px; line-height: 1.22; overflow-wrap: normal; word-break: normal; hyphens: none; }
.district-copy em { margin-top: 4px; }
.district-progress { position: absolute; z-index: 9; left: 94px; right: 10px; bottom: 14px; height: 4px; margin: 0; }
.district.state-current .district-copy { border-color: color-mix(in srgb,var(--world) 68%,white); box-shadow: 0 0 0 3px color-mix(in srgb,var(--world) 20%,transparent),0 14px 30px rgba(0,0,0,.24); }
.district.state-completed .building-sign { background: var(--success); }
.district-status { margin-top: 4px; color: #70d8ae; font-size: 8px; font-weight: 800; text-transform: uppercase; }
.district.state-available:not(.state-current) { filter: saturate(.72); }
.current-position { z-index: 12; transform: translate(42px,46px); }
.current-position span { width: 29px; height: 29px; border-width: 2px; }
.current-position small { box-shadow: 0 4px 12px rgba(0,0,0,.22); }
.map-poi { position: absolute; z-index: 2; display: grid; grid-template-columns: 26px auto; gap: 7px; align-items: center; padding: 7px 8px; border: 1px solid rgba(255,255,255,.13); border-radius: 6px; background: rgba(22,31,37,.88); color: white; cursor: pointer; text-align: left; box-shadow: 0 8px 20px rgba(0,0,0,.16); }
.map-poi:hover { border-color: rgba(255,255,255,.35); }
.map-poi > svg { width: 26px; height: 26px; padding: 5px; border-radius: 5px; background: rgba(255,255,255,.09); color: #d9b85d; }
.map-poi span { display: grid; gap: 1px; }
.map-poi strong { font-size: 9px; }
.map-poi small { color: rgba(255,255,255,.48); font-size: 7px; }
.poi-library { left: 4%; bottom: 14%; }
.poi-route { left: 42%; top: 42%; }
.poi-profile { right: 4%; top: 11%; }
.city-legend { z-index: 14; padding-top: 11px; border-top: 1px solid rgba(255,255,255,.1); }

@media (max-width:1180px) {
  .case-workspace-v2 { grid-template-columns: 142px minmax(0,1fr) 292px; }
  .case-tools button > span small { display: none; }
  .case-tools button { min-height: 52px; }
  .tour-step-2 .tour-card { right: 305px; }
}

@media (max-width:980px) {
  .case-workspace-v2 { grid-template-columns: 118px minmax(0,1fr) 260px; }
  .case-tools button { grid-template-columns: 18px 1fr; padding: 8px 7px; }
  .case-tools button > span strong { font-size: 9px; }
  .next-step-bar em { display: none; }
  .tour-step-0 .tour-card { left: 130px; }
  .tour-step-2 .tour-card { right: 272px; }
}

@media (max-width:720px) {
  .case-guided { grid-template-rows: 60px auto auto; }
  .case-phase-nav { position: sticky; z-index: 44; top: 120px; overflow-x: auto; grid-template-columns: repeat(4,150px); padding: 0 6px; }
  .case-phase-nav button { min-height: 60px; padding: 8px; }
  .case-guided-layout { grid-template-columns: 1fr; }
  .case-progress-card { order: -1; display: grid; grid-template-columns: repeat(3,1fr); gap: 7px; padding: 10px; }
  .case-progress-card > .kicker,.case-progress-card > h2,.case-progress-card > p { display: none; }
  .case-check { min-width: 0; grid-template-columns: 16px 1fr; gap: 5px; padding: 8px; border: 1px solid var(--line); border-radius: 6px; }
  .case-check > svg { width: 15px; }
  .case-check strong { font-size: 9px; }
  .case-check small { font-size: 8px; }
  .conclusion-template { grid-template-columns: 1fr; }
  .multi-select-banner { grid-template-columns: 34px 1fr; padding: 10px; }.multi-select-banner > svg { width: 32px; height: 32px; padding: 7px; }.multi-select-banner em { grid-column: 1 / -1; width: 100%; }.multi-select-banner small { font-size: 10px; }
  .visual-case-steps { grid-template-columns: 1fr 14px 1fr 14px 1fr; gap: 3px; }
  .visual-case-steps > div { min-height: 96px; padding: 8px 3px; }.visual-case-steps > div > svg { width: 23px; }.visual-case-steps strong { font-size: 10px; }.visual-case-steps small { font-size: 7px; }
  .visual-source-grid { grid-template-columns: 1fr; }
  .search-result.visual-source-card { grid-template-columns: 42% 1fr; }
  .source-preview { min-height: 180px; }
  .artifact-facts { grid-template-columns: 1fr; }
  .artifact-message > header { align-items: flex-start; flex-wrap: wrap; }
  .artifact-message time { width: 100%; padding-left: 44px; }
  .artifact-document { padding: 8px; }
  .easy-source-view { grid-template-rows: 58px minmax(0,1fr) auto; }
  .easy-source-header { grid-template-columns: 36px minmax(0,1fr); gap: 8px; padding: 0 10px; }
  .easy-source-type { display: none; }
  .easy-source-scroll { padding: 10px; }
  .easy-question { grid-template-columns: 27px 1fr; gap: 8px; padding: 9px 10px; }
  .easy-question > svg { width: 20px; }
  .easy-question strong { font-size: 11px; }
  .easy-clue-card { grid-template-columns: 1fr; }
  .easy-clue-visual,.easy-clue-visual > .source-preview { min-height: 220px; }
  .easy-clue-visual .preview-photo img { min-height: 220px; max-height: 300px; }
  .easy-clue-copy { padding: 18px; }
  .easy-clue-copy h1 { margin-bottom: 14px; font-size: 25px; }
  .easy-finding p { font-size: 14px; }
  .easy-facts > div { grid-template-columns: 1fr; }
  .easy-source-actions { display: grid; grid-template-columns: 1fr 1fr; padding: 9px; }
  .easy-source-actions button { min-width: 0; padding: 0 8px; font-size: 10px; }
  .simple-hypothesis { grid-template-columns: 1fr; }
  .case-topbar { grid-template-columns: 36px minmax(0,1fr) auto; padding: 0 10px; }
  .case-topbar > div:nth-child(2) { min-width: 0; }
  .case-topbar > div:nth-child(2) strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .case-help-button { width: 36px; padding: 0; justify-content: center; }
  .case-help-button span,.autosave { display: none !important; }
  .case-tools { top: 120px; gap: 4px; padding: 6px; }
  .case-tools button { flex: 0 0 128px; min-width: 128px; min-height: 48px; grid-template-columns: 18px 1fr; padding: 7px 8px; }
  .case-tools button > span strong { font-size: 9px; }
  .case-tools button > span small { display: none; }
  .case-tools button > em { top: 5px; right: 5px; }
  .case-center { min-height: 560px; }
  .next-step-bar { top: 0; grid-template-columns: 18px 1fr auto; padding: 8px 10px; }
  .next-step-bar em { display: none; }
  .next-step-bar button { width: 32px; padding: 0; justify-content: center; font-size: 0; }
  .hypothesis-form > div { grid-template-columns: 1fr 64px; }
  .hypothesis-form button { grid-column: 1 / -1; width: 100%; min-height: 36px; }
  .case-tour { display: grid; place-items: end center; padding: 14px 14px calc(78px + env(safe-area-inset-bottom)); }
  .tour-card,.tour-step-0 .tour-card,.tour-step-1 .tour-card,.tour-step-2 .tour-card,.tour-step-3 .tour-card { position: static; width: 100%; transform: none; }
  .tour-card { padding: 19px; }
  .tour-card h2 { font-size: 20px; }
  .case-help { padding: 18px 16px calc(82px + env(safe-area-inset-bottom)); }
  .city-map { min-height: 780px; }
  .desktop-routes { display: none; }
  .mobile-routes { display: block; }
  .river { left: 45%; width: 13%; opacity: .35; }
  .district { width: 224px; min-height: 132px; grid-template-columns: 76px minmax(0,1fr); }
  .district-building { width: 68px; height: 82px; }
  .building-shadow { left: 8px; bottom: -4px; width: 57px; height: 18px; }
  .building-base { width: 54px; height: 12px; }
  .building-face { left: 6px; top: 20px; width: 37px; height: 44px; }
  .building-side { left: 43px; top: 20px; width: 14px; height: 44px; }
  .building-roof { left: 4px; top: 10px; width: 53px; height: 20px; }
  .building-sign { left: 14px; top: 25px; width: 21px; height: 21px; }
  .building-sign svg { width: 13px; height: 13px; }
  .building-face b { left: 5px; right: 5px; bottom: 7px; gap: 3px; }
  .building-face b i { height: 5px; }
  .building-door { left: 30px; bottom: 6px; width: 9px; height: 14px; }
  .district-copy { min-height: 86px; padding: 10px 11px; }
  .district-copy strong { font-size: 13px; line-height: 1.2; }
  .district-progress { left: 84px; right: 8px; bottom: 12px; }
  .district-search { --x:24% !important;--y:14% !important; }
  .district-visual { --x:76% !important;--y:27% !important; }
  .district-documents { --x:24% !important;--y:42% !important; }
  .district-geoint { --x:76% !important;--y:57% !important; }
  .district-identity { --x:24% !important;--y:72% !important; }
  .district-infrastructure { --x:76% !important;--y:86% !important; }
  .current-position { transform: translate(27px,35px); }
  .map-poi { display: none; }
  .city-legend { left: 10px; right: 10px; bottom: 8px; font-size: 9px; }
}

@media (max-width: 720px) {
  .district { width: 204px; min-height: 126px; grid-template-columns: 62px minmax(0,1fr); }
  .district-building { width: 58px; height: 70px; }
  .district-copy { min-height: 82px; padding: 9px 10px; }
  .district-copy strong { font-size: 12px; line-height: 1.2; }
  .district-progress { left: 70px; right: 8px; }
}

/* Night map and compact language control */
.language-flag { width: 22px; height: 15px; flex: 0 0 auto; overflow: hidden; border: 1px solid rgba(23,32,42,.18); border-radius: 3px; box-shadow: 0 1px 3px rgba(23,32,42,.12); pointer-events: none; }
.flag-es { background: linear-gradient(#aa151b 0 25%,#f1bf00 25% 75%,#aa151b 75%); }
.flag-ca { background: repeating-linear-gradient(#f7cd25 0 2px,#d92228 2px 4px); }
.flag-en { width: auto; height: auto; border: 0; border-radius: 0; box-shadow: none; overflow: visible; background: none; }
.flag-en::before { content: "🇬🇧"; display: block; font-size: 18px; line-height: 1; }
.header-language { position: relative; width: 42px; min-width: 42px; justify-content: center; padding: 0; cursor: pointer; }
.header-language select { position: absolute; inset: 0; width: 100%; min-height: 100%; opacity: 0; cursor: pointer; }
.auth-gate-header label { position: relative; width: 42px; height: 40px; justify-content: center; margin-left: auto; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); cursor: pointer; }
.auth-gate-header label select { position: absolute; inset: 0; width: 100%; min-height: 100%; opacity: 0; cursor: pointer; }

.city-page { width: min(1400px,calc(100% - 32px)); }
.city-layout { position: relative; display: block; }
.city-map { min-height: 0; aspect-ratio: 16 / 9; border-color: #19354a; background-color: #061523; background-image: linear-gradient(rgba(4,16,27,.08),rgba(4,16,27,.08)),url('/assets/world/city-night-v1.jpg'); background-position: center; background-size: cover; box-shadow: 0 26px 64px rgba(4,17,29,.2); }
.city-map::before { z-index: 0; background: radial-gradient(circle at 50% 45%,transparent 30%,rgba(2,10,18,.18) 100%); opacity: 1; transform: none; }
.city-map .map-skyline,.city-map .terrain-zone,.city-map .river,.city-map .map-tree,.city-map .map-lamp { display: none; }
.city-routes { z-index: 2; }
.route-edge { stroke: #06111c; stroke-width: 20; opacity: .66; }
.route-center { stroke: #b8c9d8; stroke-width: 3.5; stroke-dasharray: 7 10; opacity: .78; filter: drop-shadow(0 0 5px rgba(133,182,221,.35)); }
.district { z-index: 5; }
.map-poi { z-index: 7; backdrop-filter: blur(10px); }
.poi-library { left: 2.5%; bottom: 7%; }
.poi-route { left: 42%; top: 46%; }
.poi-profile { right: 2.5%; top: 5%; }
.city-legend { z-index: 14; }
.next-mission { position: absolute; z-index: 12; right: 18px; bottom: 58px; width: 280px; min-height: 250px; }
.world-strip { padding-top: 34px; }

@media (max-width: 1360px) {
  .app-header { grid-template-columns: auto auto minmax(0,1fr); gap: 14px; padding: 0 18px; }
  .header-actions { min-width: 0; }
  .nav-button { min-width: 46px; padding: 0 11px; }
  .nav-button span { display: none; }
  .streak-chip span,.xp-chip span,.profile-button em { display: none; }
  .city-page { width: min(100% - 20px,1100px); }
  .district { transform: translate(-50%,-50%) scale(.86); }
  .district:hover,.district:focus-visible { transform: translate(-50%,-54%) scale(.89); }
  .next-mission { width: 240px; min-height: 220px; padding: 18px; }
  .next-mission .mission-world { margin-top: 20px; }
}

@media (max-width: 900px) {
  .app-header { grid-template-columns: auto 1fr auto; }
  .main-nav { justify-self: center; }
  .header-level { max-width: 108px; }
  .streak-chip,.xp-chip { display: none; }
  .city-map { aspect-ratio: auto; min-height: 760px; }
  .next-mission { display: none; }
  .poi-library { left: 4%; bottom: 4%; }
  .poi-route { left: 40%; top: 48%; }
  .poi-profile { right: 3%; top: 3%; }
}

@media (max-width: 720px) {
  .certificate-card { grid-template-columns: 42px 1fr; gap: 10px; }
  .certificate-status { grid-column: 2; justify-self: start; }
  .certificate-download { width: 100%; justify-content: center; }
  .app-header { height: 60px; padding: 0 10px; gap: 7px; }
  .brand-word,.main-nav,.header-level { display: none; }
  .brand-logo { width: 112px; }
  .header-actions { gap: 5px; }
  .header-language,.icon-button,.profile-button { width: 38px; height: 38px; min-width: 38px; }
  .city-page { width: 100%; }
  .city-heading { padding-inline: 16px; }
  .city-map { min-height: 800px; border-left: 0; border-right: 0; border-radius: 0; }
  .map-poi { display: none; }
  .city-legend { left: 12px; right: 12px; }
}

/* Custom selectors and compact mission panel */
.pretty-select { position: relative; }
.select-source { position: absolute !important; width: 1px !important; height: 1px !important; min-height: 0 !important; overflow: hidden; opacity: 0; pointer-events: none; }
.pretty-select-trigger { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; gap: 7px; padding: 0 9px; border-radius: 6px; background: transparent; cursor: pointer; color: var(--ink); font-size: 11px; font-weight: 800; }
.pretty-select-trigger > svg:first-child { width: 16px; color: var(--brand); }
.pretty-select-trigger > svg:last-child { width: 13px; color: var(--muted); transition: transform .18s ease; }
.pretty-select.is-open .pretty-select-trigger > svg:last-child { transform: rotate(180deg); }
.header-level.pretty-select { width: 126px; padding: 0; }
.header-language.pretty-select { width: 50px; min-width: 50px; padding: 0; }
.language-trigger { padding: 0 7px; }
.pretty-menu { position: absolute; z-index: 190; top: calc(100% + 9px); right: 0; width: 230px; display: grid; gap: 4px; padding: 7px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: 0 20px 48px rgba(20,31,42,.18); opacity: 0; pointer-events: none; transform: translateY(-6px); transition: opacity .16s ease,transform .16s ease; }
.pretty-select.is-open .pretty-menu { opacity: 1; pointer-events: auto; transform: translateY(0); }
.pretty-menu button { min-height: 56px; display: grid; grid-template-columns: 36px 1fr; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 6px; background: transparent; cursor: pointer; text-align: left; }
.pretty-menu button:hover,.pretty-menu button.is-selected { background: var(--surface-soft); }
.pretty-menu button.is-selected { box-shadow: inset 3px 0 var(--brand); }
.pretty-menu button > svg { width: 34px; height: 34px; padding: 8px; border-radius: 6px; background: color-mix(in srgb,var(--brand) 8%,var(--surface)); color: var(--brand); }
.pretty-menu button > span:last-child { display: grid; gap: 2px; }
.pretty-menu strong { color: var(--ink); font-size: 12px; }.pretty-menu small { color: var(--muted); font-size: 9px; }
.language-menu { width: 190px; }
.language-menu button { grid-template-columns: 30px 1fr; }
.language-menu .language-flag { width: 27px; height: 18px; }

.demo-start { grid-template-columns: minmax(0,1fr); align-items: stretch; }
.demo-start > div > span { display: block; margin-bottom: 7px; color: var(--muted); font-size: 11px; font-weight: 700; }
.demo-level-picker { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 7px; }
.demo-level-picker button { min-height: 72px; display: grid; grid-template-columns: 30px minmax(0,1fr); gap: 8px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); cursor: pointer; text-align: left; }
.demo-level-picker button:hover { border-color: var(--brand); }.demo-level-picker button.is-active { border-color: var(--brand); background: color-mix(in srgb,var(--brand) 7%,var(--surface)); box-shadow: inset 3px 0 var(--brand); }
.demo-level-picker button > svg { width: 28px; height: 28px; padding: 6px; border-radius: 6px; background: var(--surface-soft); color: var(--brand); }
.demo-level-picker button span { min-width: 0; display: grid; gap: 2px; }.demo-level-picker strong { color: var(--ink); font-size: 11px; }.demo-level-picker small { color: var(--muted); font-size: 8px; line-height: 1.2; }
.auth-gate-header .gate-language { width: 52px; height: 40px; margin-left: auto; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.auth-gate-header .gate-language .pretty-menu { top: calc(100% + 9px); right: 0; left: auto; width: 220px; }
.level-choice label > span { grid-template-columns: 34px minmax(0,1fr) 18px; align-items: center; gap: 10px; padding: 9px 10px; }
.level-choice label > span > svg:first-child { width: 32px; height: 32px; padding: 7px; border-radius: 6px; background: var(--surface-soft); color: var(--brand); }
.level-choice label > span b { min-width: 0; display: grid; gap: 2px; font-weight: inherit; }
.level-choice .level-check { width: 18px; color: var(--brand); opacity: 0; transform: scale(.7); transition: .16s ease; }
.level-choice input:checked + span .level-check { opacity: 1; transform: scale(1); }
.level-choice input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.demo-start #start-demo { justify-self: start; min-height: 42px; margin-top: 3px; }

.next-mission { position: static; width: 100%; min-height: 0; display: grid; grid-template-columns: 140px 190px minmax(220px,1fr) auto; gap: 16px; align-items: center; margin-top: 12px; padding: 13px 15px; transform: none; }
.next-mission .mission-top { align-items: center; }.next-mission .mission-world { margin: 0; padding: 0 16px 0 0; border: 0; border-right: 1px solid var(--line); }.next-mission .mission-world strong { font-size: 15px; }
.next-mission .mission-body { margin: 0; }.next-mission .mission-body h2 { margin: 3px 0; font-size: 17px; }.next-mission .mission-body p { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.next-mission .primary-button { width: auto; min-height: 40px; margin: 0; padding: 0 13px; font-size: 11px; }.next-mission .text-button { display: none; }

@media (max-width: 900px) {
  .next-mission { display: grid; grid-template-columns: 120px 1fr auto; }
  .next-mission .mission-world { display: none; }.next-mission .mission-body p { max-width: 320px; }
  .streak-chip,.xp-chip { display: inline-flex; }
  .header-actions #theme-toggle,.header-actions .profile-button { display: none; }
}

@media (max-width: 720px) {
  .app-header { height: 104px; grid-template-columns: auto 1fr; grid-template-rows: 52px 45px; align-content: center; }
  .brand-button { grid-column: 1; grid-row: 1; }.brand-word { display: inline; font-size: 16px; }
  .header-actions { width: 100%; grid-column: 1 / -1; grid-row: 2; display: grid; grid-template-columns: 1.25fr .8fr .9fr .55fr; gap: 6px; }
  .header-level { display: flex; }.streak-chip,.xp-chip { height: 38px; display: inline-flex; justify-content: center; padding: 0 7px; }.streak-chip span { display: none; }.xp-chip span { display: inline; font-size: 9px; }
  .header-language.pretty-select { display: flex; width: auto; min-width: 0; }.header-actions #theme-toggle,.header-actions .profile-button { display: none; }
  .header-level.pretty-select { width: auto; max-width: none; }.pretty-select-trigger { padding: 0 7px; }.pretty-select-trigger #header-level-label { overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
  .pretty-menu { position: fixed; z-index: 220; left: 10px; right: 10px; top: 102px; width: auto; }
  #app-main { min-height: calc(100vh - 104px); }
  .next-mission { grid-template-columns: 1fr auto; gap: 6px 10px; margin: 10px; width: calc(100% - 20px); padding: 11px 12px; }
  .next-mission .mission-top { grid-column: 1; }.next-mission .mission-body { grid-column: 1; }.next-mission .mission-body small,.next-mission .mission-body p { display: none; }.next-mission .mission-body h2 { margin: 0; font-size: 15px; }.next-mission .primary-button { grid-column: 2; grid-row: 1 / 3; width: 40px; min-height: 40px; padding: 0; font-size: 0; }
  .demo-level-picker { grid-template-columns: 1fr; }.demo-level-picker button { min-height: 58px; }.demo-start #start-demo { width: 100%; }
  .auth-gate-header .gate-language .pretty-menu { right: 10px; }
}

@media (max-width: 720px) {
  .welcome-guide-backdrop { align-items: end; padding: 10px 10px calc(74px + env(safe-area-inset-bottom)); }
  .welcome-guide { padding: 23px 18px 18px; max-height: calc(100vh - 92px); overflow-y: auto; }
  .welcome-guide h2 { font-size: 23px; }
  .welcome-guide-actions { align-items: stretch; flex-direction: column-reverse; }
  .welcome-guide-actions button { width: 100%; justify-content: center; }
}

/* Compact first view: keep the next action above a full-width, shorter map. */
.city-layout { display: flex; flex-direction: column; gap: 12px; }
.next-mission { order: -1; }
.city-map { aspect-ratio: 16 / 5.8; min-height: 0; }
.city-heading { padding-top: 24px; padding-bottom: 14px; }
.city-heading h1 { font-size: 36px; }
.city-heading p { font-size: 15px; }
.home-status { width: 420px; grid-template-columns: 1fr 1fr; gap: 8px; }
.rank-panel { width: 100%; padding: 11px 12px; }
.home-certificate { min-height: 66px; padding: 9px 10px; }
.next-mission { min-height: 0; padding: 10px 14px; }
.next-mission .mission-top { font-size: 10px; }
.next-mission .mission-body h2 { font-size: 15px; }
.next-mission .mission-body p { font-size: 10px; }
.next-mission .primary-button { min-height: 36px; }

.brief-more { grid-column: 1 / -1; background: var(--surface-soft); }
.brief-more summary { padding: 9px 11px; color: var(--ink); cursor: pointer; font-size: 11px; font-weight: 800; list-style-position: inside; }
.brief-more-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; border-top: 1px solid var(--line); background: var(--line); }
.brief-more-grid > div { min-height: 58px; padding: 9px 11px; background: var(--surface-soft); }

/* Keep the lesson brief readable while bringing the answer choices into view. */
@media (min-width: 901px) {
  .lesson-footer .lesson-actions { width: min(520px, 100%); flex: 1 1 520px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
  .lesson-footer .lesson-actions > button { width: 100%; min-width: 0; min-height: 48px; white-space: nowrap; }
  .lesson-footer .hint-button { min-width: 0; }
  .city-page { display: flex; flex-direction: column; }
  .city-layout { display: contents; }
  .city-map { order: 2; aspect-ratio: 16 / 4.2; }
  .next-mission { order: 3; }
  .world-strip { order: 4; padding: 4px 0; }
  .world-strip .section-heading { margin-bottom: 7px; }
  .world-strip .section-heading h2 { font-size: 20px; }
  .world-summary-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
  .world-summary { min-height: 52px; grid-template-columns: 26px minmax(0, 1fr); gap: 5px; padding: 6px; }
  .world-summary > svg { width: 26px; height: 26px; padding: 6px; }
  .world-summary span { gap: 1px; min-width: 0; }
  .world-summary strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
  .world-summary small { font-size: 9px; }
  .world-summary em { grid-column: 2; font-size: 10px; }
  .lesson-player { grid-template-rows: 58px minmax(0, 1fr) 68px; }
  .lesson-stage { grid-template-columns: 180px minmax(0, 1fr); gap: 36px; align-items: start; padding: 24px 0 24px; }
  .guide-panel { padding-top: 10px; }
  .guide-panel h2 { font-size: 21px; }
  .guide-panel p { font-size: 13px; line-height: 1.4; }
  .scenario-chip { margin-top: 16px; padding: 10px; }
  .exercise-panel { max-width: none; }
  .exercise-heading h1 { margin-bottom: 18px; font-size: 30px; line-height: 1.22; }
  .multi-mode-top { margin: 0 0 10px; padding: 9px 11px; }
  .multi-mode-top > svg { width: 32px; height: 32px; padding: 6px; }
  .multi-mode-top strong { font-size: 13px; }
  .multi-mode-top small { font-size: 10px; }
  .single-mode-top { margin-bottom: 10px; padding: 7px 10px; font-size: 12px; }
  .investigation-brief { margin: 0 0 12px; }
  .investigation-brief { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .investigation-brief .brief-primary { grid-column: 1 / -1; }
  .investigation-brief > div { min-height: 72px; padding: 13px 15px; }
  .investigation-brief .brief-primary { min-height: 88px; }
  .investigation-brief p, .investigation-brief ul { margin-top: 5px; font-size: 15px; line-height: 1.5; }
  .brief-more summary { padding: 11px 15px; font-size: 11px; }
  .brief-more-grid > div { min-height: 72px; padding: 13px 15px; }
  .answer-option { min-height: 76px; padding: 13px; gap: 12px; }
  .answer-option > span { width: 32px; height: 32px; }
  .answer-option strong { font-size: 14px; line-height: 1.35; }
}

@media (max-width: 900px) {
  .city-layout { gap: 10px; }
  .city-map { display: block; order: -1; aspect-ratio: 16 / 7; min-height: 0; }
  .next-mission { display: grid; order: 0; }
  .home-status { width: 100%; grid-template-columns: 1fr 1fr; }
}

@media (max-width: 720px) {
  .city-heading { padding-top: 20px; padding-bottom: 12px; }
  .city-heading h1 { font-size: 30px; }
  .city-heading p { font-size: 14px; line-height: 1.4; }
  .city-map { aspect-ratio: 4 / 3; min-height: 0; }
  .home-status { grid-template-columns: 1fr; }
}

/* Mobile lesson fixes for narrow iPhone screens. */
@media (max-width: 720px) {
  .lesson-stage { width: calc(100% - 24px); padding: 16px 0 126px; }
  .guide-panel { display: block; margin-bottom: 22px; }
  .lesson-level-badge { display: inline-flex; margin-bottom: 10px; padding: 7px 10px; font-size: 11px; }
  .guide-panel h2 { margin: 0 0 8px; font-size: 24px; line-height: 1.16; }
  .guide-panel p { font-size: 14px; line-height: 1.45; }
  .scenario-chip { margin-top: 14px; padding: 12px; }
  .scenario-chip strong { font-size: 14px; line-height: 1.3; }
  .exercise-panel { width: 100%; max-width: none; }
  .exercise-heading .kicker { display: block; margin-bottom: 7px; line-height: 1.25; }
  .exercise-heading h1 { margin: 0 0 20px; font-size: 25px; line-height: 1.2; overflow-wrap: anywhere; }
  .investigation-brief { margin-top: 0; }
  .investigation-brief > div { padding: 13px 14px; }
  .investigation-brief p, .investigation-brief ul { font-size: 15px; line-height: 1.5; }
  .brief-more-grid { grid-template-columns: 1fr; }
  .lesson-footer { z-index: 160; bottom: calc(64px + env(safe-area-inset-bottom)); height: auto; min-height: 78px; padding: 10px 14px; }
  .lesson-footer { justify-content: stretch; }
  .lesson-footer > div { display: none; }
  .lesson-footer .lesson-actions { display: flex; width: 100%; }
  .lesson-footer .lesson-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
  .lesson-footer .lesson-actions > button { width: 100%; min-width: 0; min-height: 50px; padding: 0 10px; }
  .lesson-footer .lesson-actions { width: 100%; }
  .lesson-footer .lesson-actions { display: grid !important; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-auto-flow: column; }
  .lesson-footer .hint-button { min-width: 0; }
  .lesson-footer .lesson-actions > button { font-size: 12px; white-space: nowrap; }
  .lesson-topbar-nav { gap: 5px; }
  .lesson-home-button { min-height: 36px; padding: 0 9px; }
  .lesson-home-button span { display: none; }
  .lesson-footer .primary-button { width: 100%; min-height: 50px; font-size: 15px; }
  .current-position { transform: translate(-50%, 44px); gap: 5px; }
  .current-position span { width: 36px; height: 36px; font-size: 10px; box-shadow: 0 0 0 4px rgba(255,255,255,.2), 0 8px 18px rgba(0,0,0,.32); }
  .current-position small { padding: 5px 8px; font-size: 10px; white-space: nowrap; }
}

/* Final responsive pass: tablet navigation, world density and safe overlays. */
@media (min-width: 1600px) {
  .city-page { width: min(1640px, calc(100% - 64px)); }
  .page-wrap { width: min(1320px, calc(100% - 64px)); }
  .city-map { aspect-ratio: 16 / 5.7; }
  .world-summary-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

@media (max-width: 1100px) {
  .world-cover-simple { grid-template-columns: minmax(0, 1fr); }
  .world-cover-grid { gap: 18px; }
  .world-title-block h1 { max-width: 100%; }
  .lesson-road { max-width: none; }
}

@media (min-width: 721px) and (max-width: 1024px) {
  body { padding-bottom: calc(70px + env(safe-area-inset-bottom)); }
  .app-header { height: 68px; grid-template-columns: auto 1fr auto; padding: 0 16px; gap: 12px; }
  .main-nav { display: none; }
  .header-actions { min-width: 0; gap: 6px; }
  .header-level.pretty-select { width: 118px; }
  .streak-chip, .xp-chip { display: inline-flex; min-width: 66px; }
  .streak-chip span, .xp-chip span { display: inline; }
  .header-actions .profile-button { display: none; }
  .mobile-nav { position: fixed; z-index: 90; left: 0; right: 0; bottom: 0; height: calc(70px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(4, 1fr); padding-bottom: env(safe-area-inset-bottom); border-top: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 96%, transparent); backdrop-filter: blur(18px); }
  .mobile-nav button { display: grid; justify-items: center; align-content: center; gap: 4px; color: var(--muted); font-size: 10px; font-weight: 700; }
  .mobile-nav button svg { width: 22px; height: 22px; }
  .mobile-nav button.is-active { color: var(--brand); }
  #app-main { min-height: calc(100vh - 68px); }
  .city-page { width: min(100% - 32px, 1100px); }
  .city-heading { padding-top: 24px; padding-bottom: 14px; }
  .city-map { aspect-ratio: 16 / 7; min-height: 0; }
  .next-mission { display: grid; grid-template-columns: 120px 1fr auto; }
  .next-mission .mission-world { display: none; }
  .world-cover { padding-top: 14px; }
  .world-cover-grid { padding: 18px 0 20px; }
  .story-brief { margin-bottom: 22px; }
  .lesson-stage { width: min(100% - 40px, 900px); grid-template-columns: 210px minmax(0, 1fr); gap: 26px; padding: 28px 0 32px; }
  .lesson-footer { padding-inline: 20px; }
  .case-workspace-v2 { grid-template-columns: 92px minmax(0, 1fr) 250px; }
  .case-tools button { padding-inline: 7px; }
  .case-tools button > span small { display: none; }
}

@media (max-width: 720px) {
  .contextual-guide-backdrop .contextual-guide { left: 10px !important; right: 10px !important; top: auto !important; bottom: calc(74px + env(safe-area-inset-bottom)) !important; width: auto !important; max-height: calc(100vh - 94px); overflow-y: auto; }
  .world-cover-simple { grid-template-columns: minmax(0, 1fr); }
  .world-title-block h1 { max-width: 100%; }
  .world-content { width: min(100% - 24px, 620px); }
  .lesson-road .section-heading { gap: 12px; }
  .lesson-road .section-heading > span { white-space: nowrap; }
  .case-phase-nav { overflow-x: auto; grid-template-columns: repeat(4, minmax(150px, 1fr)); }
  .visual-case-steps { grid-template-columns: 1fr; }
  .visual-case-steps > svg { transform: rotate(90deg); justify-self: center; }

  /* Keep every header control inside the intended second row on phones. */
  .header-actions { grid-template-columns: minmax(0, 1.35fr) minmax(50px, .78fr) minmax(58px, .9fr) 44px 44px; grid-auto-flow: row; }
  .header-actions #help-guide, .header-actions #theme-toggle { display: none !important; }
  .header-actions .profile-button, body.is-guest .header-actions .profile-button.is-guest-cta { display: inline-flex !important; width: 44px; min-width: 44px; height: 38px; padding: 0; justify-content: center; }
  .header-actions .profile-button em { display: none !important; }
  .header-actions .profile-button svg { width: 20px; height: 20px; }
  .city-heading { padding: 16px 14px 10px; }
  .city-heading h1 { margin: 4px 0 6px; font-size: 28px; line-height: 1.08; }
  .city-heading p { max-width: 360px; margin: 0; font-size: 14px; line-height: 1.35; }
  .home-status { gap: 8px; margin-top: 12px; }
  .rank-panel { min-height: 86px; padding: 11px 13px; }
  .rank-panel strong { font-size: 22px; }
  .home-certificate { min-height: 70px; padding: 10px 12px; }
  .home-certificate strong { font-size: 13px; }
  .home-certificate small { font-size: 10px; }
  .city-map { aspect-ratio: 4 / 3; min-height: 0; }
  .next-mission { margin: 8px 10px; width: calc(100% - 20px); border-radius: 8px; }
  .world-strip { padding: 24px 12px 88px; }
  .world-summary-grid { gap: 8px; }
  .world-summary { min-height: 70px; padding: 10px; }
  .world-summary strong { font-size: 12px; line-height: 1.15; }
  .world-summary small { font-size: 10px; }
  .world-summary em { font-size: 11px; }
  .lesson-stage { padding-bottom: 118px; }
  .lesson-footer { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  .lesson-footer .lesson-actions > button { min-height: 48px; }

  /* Keep the player marker attached to the active building on phones. */
  .district > .current-position { left: 38px; top: 100%; transform: translate(-50%, 8px); }
}

@media (min-width:721px) {
  .district > .current-position { left: 36px; top: 100%; transform: translate(-50%, 10px); }
}

/* Private traffic dashboard */
.admin-access-card { grid-column: 1 / -1; display: grid; grid-template-columns: 52px 1fr auto; gap: 18px; align-items: center; border-color: rgba(230,75,60,.28); }
.admin-access-card > svg { width: 52px; height: 52px; padding: 13px; border-radius: 8px; background: var(--brand-soft); color: var(--brand); }
.admin-access-card h2 { margin: 3px 0 5px; }
.admin-access-card p { margin: 0; color: var(--muted); }
.admin-access-card .primary-button { white-space: nowrap; }
.admin-page { padding: 30px 0 80px; }
.admin-heading { display: flex; justify-content: space-between; gap: 24px; align-items: end; margin-bottom: 24px; }
.admin-heading h1 { margin: 4px 0 6px; color: var(--ink); font: 800 38px/1.08 "Manrope", sans-serif; }
.admin-heading p { margin: 0; color: var(--muted); }
.admin-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.admin-metrics article { position: relative; min-height: 132px; padding: 20px; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.admin-metrics svg { position: absolute; top: 18px; right: 18px; width: 22px; color: var(--brand); }
.admin-metrics span { display: block; max-width: calc(100% - 32px); color: var(--muted); font-size: 13px; font-weight: 700; }
.admin-metrics strong { display: block; margin-top: 19px; color: var(--ink); font: 800 34px/1 "Manrope", sans-serif; }
.admin-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, .8fr); gap: 14px; margin-bottom: 14px; }
.analytics-panel { padding: 22px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.analytics-panel > header { display: flex; justify-content: space-between; gap: 20px; align-items: start; margin-bottom: 22px; }
.analytics-panel h2 { margin: 3px 0 0; color: var(--ink); font: 800 21px/1.2 "Manrope", sans-serif; }
.analytics-panel > header > strong { color: var(--ink); font: 800 22px/1 "Manrope", sans-serif; }
.analytics-panel > header > strong small, .analytics-panel > header > small { color: var(--muted); font: 600 12px/1.3 "DM Sans", sans-serif; }
.bar-chart { display: grid; grid-template-columns: repeat(7, minmax(38px, 1fr)); gap: 12px; height: 240px; align-items: end; }
.chart-day { min-width: 0; display: grid; grid-template-rows: 20px 1fr 18px 16px; gap: 5px; height: 100%; text-align: center; }
.bar-value { color: var(--ink); font-size: 12px; font-weight: 800; }
.bar-track { position: relative; display: flex; align-items: end; justify-content: center; min-height: 0; border-radius: 5px 5px 2px 2px; background: var(--surface-2); overflow: hidden; }
.bar-track i { display: block; width: min(42px, 64%); border-radius: 4px 4px 0 0; background: var(--brand); }
.chart-day strong { color: var(--ink); font-size: 11px; }
.chart-day small { overflow: hidden; color: var(--muted); font-size: 9px; white-space: nowrap; text-overflow: ellipsis; }
.source-list { display: grid; gap: 17px; }
.source-list > div { display: grid; gap: 7px; }
.source-list span { display: flex; justify-content: space-between; gap: 10px; }
.source-list strong { color: var(--ink); font-size: 13px; }
.source-list small { color: var(--muted); font-size: 11px; }
.source-list i { display: block; height: 6px; overflow: hidden; border-radius: 99px; background: var(--surface-2); }
.source-list b { display: block; height: 100%; border-radius: inherit; background: var(--brand); }
.recent-panel { overflow: hidden; }
.visit-table { overflow-x: auto; border: 1px solid var(--line); border-radius: 6px; }
.visit-row { min-width: 820px; display: grid; grid-template-columns: 150px 150px minmax(180px, 1fr) minmax(130px, .7fr) 90px; gap: 14px; align-items: center; padding: 13px 15px; border-top: 1px solid var(--line); color: var(--ink); font-size: 12px; }
.visit-row:first-child { border-top: 0; }
.visit-head { background: var(--surface-2); color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.visit-row code { width: fit-content; padding: 4px 7px; border-radius: 4px; background: var(--surface-2); color: var(--ink); font-size: 11px; }
.visit-row > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.visit-row > span strong, .visit-row > span small { display: block; overflow: hidden; text-overflow: ellipsis; }
.visit-row > span small { margin-top: 2px; color: var(--muted); }
.admin-loading { min-height: 380px; display: grid; place-items: center; align-content: center; gap: 12px; color: var(--muted); text-align: center; }
.admin-loading span { width: 34px; height: 34px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: admin-spin .8s linear infinite; }
.admin-loading svg { width: 36px; height: 36px; color: var(--brand); }
.admin-loading h2, .admin-loading p { margin: 0; }
.analytics-empty { padding: 28px; color: var(--muted); text-align: center; }
@keyframes admin-spin { to { transform: rotate(360deg); } }

@media (max-width: 980px) {
  .admin-metrics { grid-template-columns: repeat(2, 1fr); }
  .admin-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .admin-access-card { grid-template-columns: 42px 1fr; padding: 18px; }
  .admin-access-card > svg { width: 42px; height: 42px; padding: 10px; }
  .admin-access-card .primary-button { grid-column: 1 / -1; width: 100%; }
  .admin-page { padding: 22px 16px 96px; }
  .admin-heading { align-items: start; flex-direction: column; margin-bottom: 18px; }
  .admin-heading h1 { font-size: 30px; }
  .admin-heading .secondary-button { width: 100%; }
  .admin-metrics { gap: 8px; }
  .admin-metrics article { min-height: 108px; padding: 15px; }
  .admin-metrics svg { top: 14px; right: 14px; width: 19px; }
  .admin-metrics span { font-size: 11px; }
  .admin-metrics strong { margin-top: 14px; font-size: 28px; }
  .analytics-panel { padding: 17px 14px; }
  .bar-chart { gap: 5px; height: 210px; }
  .chart-day { grid-template-rows: 18px 1fr 16px 14px; }
  .bar-track i { width: 70%; }
  .chart-day small { font-size: 8px; }
  .recent-panel { padding: 17px 0; }
  .recent-panel > header { padding: 0 14px; }
  .visit-table { border-right: 0; border-left: 0; border-radius: 0; }
}

/* Privacy, legal links and consent */
.app-legal-footer, .auth-legal-footer, .legal-footer { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px 20px; color: var(--muted); font-size: 12px; }
.app-legal-footer { min-height: 66px; padding: 18px 24px 84px; border-top: 1px solid var(--line); background: var(--surface); }
.auth-legal-footer { min-height: 54px; padding: 12px 24px; border-top: 1px solid var(--line); }
.app-legal-footer a, .auth-legal-footer a, .legal-footer a, .app-legal-footer button, .auth-legal-footer button { padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; text-decoration: none; }
.app-legal-footer a:hover, .auth-legal-footer a:hover, .legal-footer a:hover, .app-legal-footer button:hover, .auth-legal-footer button:hover { color: var(--brand); text-decoration: underline; }
.cookie-banner[hidden] { display: none !important; }
.cookie-banner { position: fixed; z-index: 500; right: 20px; bottom: 20px; width: min(720px, calc(100vw - 40px)); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px 22px; padding: 20px; border: 1px solid var(--line-strong); border-top: 4px solid var(--brand); border-radius: 8px; background: var(--surface); box-shadow: 0 24px 70px rgba(23,32,42,.2); }
.cookie-summary { min-width: 0; display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 14px; }
.cookie-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 7px; background: var(--brand-soft, #fff0ed); color: var(--brand); }
.cookie-icon svg { width: 22px; }
.cookie-summary h2 { margin: 2px 0 5px; color: var(--ink); font: 800 20px/1.2 "Manrope", sans-serif; }
.cookie-summary p { margin: 0; color: var(--text); font-size: 13px; line-height: 1.5; }
.cookie-links { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 9px; }
.cookie-links a, .cookie-links button { padding: 0; border: 0; background: none; color: var(--brand); font: 700 11px/1.2 "DM Sans", sans-serif; cursor: pointer; text-decoration: underline; }
.cookie-actions { width: 190px; display: grid; gap: 8px; align-content: center; }
.cookie-actions button { width: 100%; min-height: 42px; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); color: var(--ink); font: 700 12px/1.2 "DM Sans", sans-serif; cursor: pointer; }
.cookie-actions button:hover { border-color: var(--brand); color: var(--brand); }
.cookie-actions .cookie-save { border-color: var(--brand); background: var(--brand); color: white; }
.cookie-details { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding-top: 16px; border-top: 1px solid var(--line); }
.cookie-details[hidden] { display: none; }
.cookie-category { position: relative; min-width: 0; display: grid; grid-template-columns: 1fr 30px; gap: 10px; align-items: center; padding: 13px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-soft); cursor: pointer; }
.cookie-category.is-required { cursor: default; }
.cookie-category strong, .cookie-category small { display: block; }
.cookie-category strong { color: var(--ink); font-size: 12px; }
.cookie-category small { margin-top: 3px; color: var(--muted); font-size: 10px; line-height: 1.4; }
.cookie-category input { width: 18px; height: 18px; accent-color: var(--brand); }
.cookie-category > svg { display: none; }

.legal-body { background: #f5f6f7; }
.legal-header { position: sticky; z-index: 20; top: 0; min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 12px max(24px, calc((100vw - 960px) / 2)); border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); }
.legal-header img { display: block; width: 150px; height: 48px; object-fit: contain; object-position: left center; }
.legal-page { width: min(900px, calc(100% - 36px)); margin: 0 auto; padding: 30px 0 70px; }
.legal-tabs { display: flex; gap: 8px; margin-bottom: 34px; }
.legal-tabs a { padding: 9px 13px; border: 1px solid var(--line); border-radius: 6px; background: white; color: var(--muted); font-weight: 700; text-decoration: none; }
.legal-tabs a[aria-current="page"] { border-color: var(--brand); color: var(--brand); }
.legal-title { padding-bottom: 26px; border-bottom: 1px solid var(--line); }
.legal-title h1 { margin: 6px 0 8px; color: var(--ink); font: 800 44px/1.08 "Manrope", sans-serif; }
.legal-title p { margin: 0; color: var(--muted); }
.legal-page > section { padding: 25px 0; border-bottom: 1px solid var(--line); }
.legal-page > section h2 { margin: 0 0 12px; color: var(--ink); font: 800 22px/1.25 "Manrope", sans-serif; }
.legal-page > section h3 { margin: 0 0 7px; color: var(--ink); font-size: 15px; }
.legal-page > section p, .legal-page > section li { font-size: 15px; line-height: 1.7; }
.legal-page > section p { margin: 0 0 12px; }
.legal-page > section a { color: var(--brand); }
.legal-intro { margin-top: 24px; padding: 22px !important; border: 1px solid rgba(220,51,40,.22) !important; border-left: 4px solid var(--brand) !important; border-radius: 7px; background: #fff; }
.legal-table { overflow: hidden; margin: 16px 0; border: 1px solid var(--line); border-radius: 7px; background: white; }
.legal-table > div { display: grid; grid-template-columns: 160px minmax(0,1fr) 120px; gap: 16px; padding: 13px 15px; border-top: 1px solid var(--line); align-items: start; }
.legal-table > div:first-child { border-top: 0; }
.legal-table-head { background: var(--surface-soft); color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.legal-table code { color: var(--ink); font-weight: 700; }
.legal-purposes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.legal-purposes article { padding: 17px; border: 1px solid var(--line); border-radius: 7px; background: white; }
.legal-purposes article p { color: var(--text); font-size: 13px; }
.legal-purposes article strong { color: var(--brand); font-size: 11px; }
.legal-cookie-link { display: inline-flex; margin-top: 8px; text-decoration: none; }
.legal-footer { min-height: 72px; padding: 18px; border-top: 1px solid var(--line); background: white; }

@media (max-width: 720px) {
  .app-legal-footer { padding-bottom: 90px; }
  .auth-legal-footer { padding: 14px 12px; }
  .cookie-banner { right: 8px; bottom: 8px; width: calc(100vw - 16px); max-height: calc(100vh - 16px); grid-template-columns: 1fr; gap: 14px; padding: 16px; overflow-y: auto; }
  .cookie-summary { grid-template-columns: 34px minmax(0,1fr); gap: 10px; }
  .cookie-icon { width: 34px; height: 34px; }
  .cookie-summary h2 { font-size: 18px; }
  .cookie-actions { width: 100%; grid-template-columns: 1fr 1fr; }
  .cookie-actions .cookie-save { grid-column: 1 / -1; }
  .cookie-details { grid-template-columns: 1fr; }
  .legal-header { min-height: 66px; padding: 9px 16px; }
  .legal-header img { width: 125px; height: 40px; }
  .legal-header .secondary-button { min-height: 40px; padding: 0 11px; font-size: 11px; }
  .legal-page { width: min(100% - 28px, 900px); padding-top: 20px; }
  .legal-tabs { margin-bottom: 24px; }
  .legal-title h1 { font-size: 34px; }
  .legal-page > section p, .legal-page > section li { font-size: 14px; }
  .legal-table { overflow-x: auto; }
  .legal-table > div { min-width: 650px; }
  .legal-purposes { grid-template-columns: 1fr; }
}
