/* PyQuest — base, layout and shared components */
:root {
  --bg: #f2f3ee;
  --panel: #ffffff;
  --ink: #172033;
  --text: #1d2433;
  --muted: #5b6577;
  --blue: #2f5f8f;
  --blue-d: #244b72;
  --blue-l: #e6eef6;
  --yellow: #f2c230;
  --green: #1e7a4c;
  --green-l: #e7f3ec;
  --red: #b0352d;
  --red-l: #faeceb;
  --line: #d9dcd2;
  --code-bg: #172033;
  --font: "Public Sans", "Segoe UI", system-ui, Arial, sans-serif;
  --display: "Bricolage Grotesque", "Public Sans", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", Consolas, "Courier New", monospace;
}
* { box-sizing: border-box; }
html { scroll-behavior: auto; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); font: 15px/1.6 var(--font); overflow-x: hidden; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.hidden { display: none !important; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 10; background: var(--ink); color: #fff; }
.nav-wrap { max-width: 1120px; min-height: 62px; margin: auto; padding: 0 24px; display: flex; align-items: center; gap: 22px; }
.brand { display: flex; align-items: center; gap: 10px; font: 700 20px var(--display); letter-spacing: -.01em; white-space: nowrap; }
.brand-mark { width: 30px; height: 30px; border-radius: 7px; display: block; }
.brand em { color: var(--yellow); font-style: normal; }
.nav-links { display: flex; gap: 2px; margin: 0 auto 0 8px; }
.nav-link { padding: 8px 12px; border-radius: 6px; color: #b9c3d3; font-size: 14px; font-weight: 500; white-space: nowrap; }
.nav-link:hover { color: #fff; background: #ffffff14; }
.nav-link.active { color: #fff; box-shadow: inset 0 -3px 0 var(--yellow); border-radius: 6px 6px 0 0; }
.nav-right { display: flex; align-items: center; gap: 8px; }
.language-switch { display: flex; border: 1px solid #ffffff30; border-radius: 6px; overflow: hidden; }
.language-switch button { border: 0; background: transparent; color: #b9c3d3; font-size: 12px; font-weight: 600; padding: 6px 9px; }
.language-switch button.selected { background: #fff; color: var(--ink); }
.profile-pill, .xp-pill { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; white-space: nowrap; max-width: 150px; }
.profile-name { overflow: hidden; text-overflow: ellipsis; }
.avatar { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--yellow); color: var(--ink); font-size: 12px; font-weight: 700; flex: none; }
.name-change { border: 0; background: none; color: #b9c3d3; font-size: 12px; text-decoration: underline; padding: 4px; }
.name-change:hover { color: #fff; }
.xp-pill { background: var(--yellow); color: var(--ink); padding: 4px 10px; border-radius: 99px; font-family: var(--mono); font-size: 12px; }
.menu-toggle { display: none; border: 1px solid #ffffff30; background: none; color: #fff; border-radius: 6px; padding: 5px 10px; font-size: 18px; }

/* Layout and type */
.main-content { width: min(1040px, calc(100% - 40px)); margin: 0 auto; padding: 40px 0 64px; flex: 1; outline: 0; min-width: 0; }
.site-footer { width: min(1040px, calc(100% - 40px)); margin: 0 auto; padding: 16px 0 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; display: flex; justify-content: space-between; gap: 12px; }
.eyebrow { color: var(--blue); font-size: 13px; font-weight: 600; }
.page-title { font: 700 clamp(28px, 4.5vw, 40px)/1.15 var(--display); letter-spacing: -.02em; margin: 6px 0 8px; overflow-wrap: anywhere; }
.page-subtitle { margin: 0; color: var(--muted); max-width: 620px; }
.section-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; }
.section-heading h2 { font: 700 21px var(--display); margin: 0; }
.section-heading p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.section-heading .eyebrow, .result-card .eyebrow { display: none; }
.empty-state { text-align: center; color: var(--muted); padding: 32px; }

/* Buttons and cards */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 9px 18px; border: 1px solid transparent; border-radius: 6px; font-size: 14px; font-weight: 600; color: #fff; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--blue); }
.btn-primary:hover:not(:disabled) { background: var(--blue-d); }
.btn-secondary { background: var(--panel); border-color: #bcc3b8; color: var(--text); }
.btn-secondary:hover { background: #eceee7; }
.btn-ghost { background: none; color: var(--blue); }
.btn-ghost:hover { text-decoration: underline; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; min-width: 0; }

/* Landing and name entry */
.landing { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 48px; align-items: center; min-height: 460px; }
.landing-title { font: 700 clamp(36px, 5.5vw, 58px)/1.08 var(--display); letter-spacing: -.03em; margin: 10px 0 16px; }
.landing-copy > p { color: var(--muted); font-size: 17px; max-width: 480px; margin: 0 0 24px; }
.landing-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.spot-card { margin: 0; background: var(--code-bg); border-radius: 10px; border-left: 5px solid var(--yellow); color: #e5ebf5; overflow: hidden; }
.spot-card figcaption { padding: 10px 18px; font: 12px var(--mono); color: #8d9ab0; border-bottom: 1px solid #ffffff1a; }
.spot-card pre { margin: 0; padding: 18px; font: 14px/1.9 var(--mono); overflow-x: auto; }
.spot-card .gap { display: inline-block; min-width: 12px; border-bottom: 2px dashed var(--yellow); }
.spot-verdict { display: flex; gap: 10px; padding: 0 18px 18px; font-size: 13px; font-weight: 600; }
.spot-verdict span { padding: 6px 12px; border-radius: 5px; }
.spot-verdict .v-ok { background: #1e7a4c40; color: #9be3bd; }
.spot-verdict .v-bad { background: var(--yellow); color: var(--ink); }
.login-card { max-width: 480px; margin: 24px auto; padding: clamp(22px, 5vw, 36px); }
.login-card h1 { font: 700 30px var(--display); letter-spacing: -.02em; margin: 6px 0 8px; }
.login-card p { color: var(--muted); margin: 0 0 20px; }
.field-label { display: block; font-size: 13px; font-weight: 600; margin: 0 0 6px; }
.text-input { width: 100%; min-width: 0; height: 44px; padding: 0 12px; background: #fff; color: var(--text); border: 1px solid #aeb6aa; border-radius: 6px; }
.text-input:focus { outline: 3px solid #2f5f8f40; border-color: var(--blue); }
.form-error { min-height: 22px; margin-top: 6px; color: var(--red); font-size: 13px; }
.login-submit { width: 100%; margin-top: 8px; }

/* Dashboard */
.welcome-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.level-chip { padding: 6px 12px; border-radius: 6px; background: var(--blue-l); color: var(--blue-d); font-size: 13px; font-weight: 600; }
.overview { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); gap: 14px; margin-bottom: 28px; }
.journey-card, .xp-card { padding: 20px; }
.card-topline { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.card-topline h2 { font: 700 17px var(--display); margin: 0; }
.progress-percent { font: 600 13px var(--mono); color: var(--blue); }
.progress-track { height: 8px; background: #e4e7de; border-radius: 4px; overflow: hidden; margin: 14px 0 4px; }
.progress-fill { height: 100%; background: var(--blue); border-radius: 4px; transition: width .3s; }
.xp-card small { display: block; color: var(--muted); font-size: 13px; }
.xp-card strong { display: block; font: 700 32px/1.2 var(--display); }
.xp-card .level-small { color: var(--muted); font-size: 13px; }
.menu-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.menu-card { position: relative; display: block; padding: 22px; min-height: 150px; border-left: 5px solid var(--blue); }
.menu-card:nth-child(2) { border-left-color: var(--yellow); }
.menu-card:hover { background: #fafbf8; }
.menu-icon { display: grid; place-items: center; width: 38px; height: 38px; margin-bottom: 12px; border-radius: 6px; background: var(--ink); color: var(--yellow); font: 600 14px var(--mono); }
.menu-card h3 { font: 700 18px var(--display); margin: 0 0 4px; }
.menu-card p { margin: 0; color: var(--muted); font-size: 14px; }
.menu-arrow { position: absolute; right: 18px; top: 20px; color: var(--muted); }

/* Results, toast */
.result-card { max-width: 720px; margin: 24px auto; padding: clamp(22px, 5vw, 40px); text-align: center; }
.result-card h2 { font: 700 30px var(--display); letter-spacing: -.02em; margin: 0 0 6px; }
.result-card > p { color: var(--muted); margin: 0; }
.result-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 24px 0; }
.result-stat { padding: 14px 8px; border: 1px solid var(--line); border-radius: 8px; background: #f8f9f5; min-width: 0; }
.result-stat strong { display: block; font: 700 24px var(--display); color: var(--blue-d); }
.result-stat span { display: block; font-size: 12px; color: var(--muted); }
.result-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.toast-region { position: fixed; z-index: 20; right: 18px; bottom: 18px; display: grid; gap: 8px; }
.toast { max-width: min(340px, calc(100vw - 32px)); padding: 12px 16px; background: var(--ink); color: #fff; border-radius: 6px; font-size: 14px; }
.toast.success { border-left: 4px solid var(--yellow); }
