/* Lern-App components. Every value comes from tokens.css. */
.la, .la * { box-sizing: border-box; }
body { margin: 0; font-family: var(--font-sans); color: var(--ink); background: var(--surface); -webkit-font-smoothing: antialiased; }
.la-stack { display: flex; flex-direction: column; gap: var(--space-3); }
.la-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
.la-pad { padding: var(--space-4); }

/* Outlined display title (game look) */
.la-title { font-family: var(--font-display); font-weight: 400; color: var(--ink-inverse); letter-spacing: .5px;
  -webkit-text-stroke: 1.5px var(--outline); paint-order: stroke fill; text-shadow: 0 3px 0 var(--outline); margin: 0; }

/* Icon */
.la-icon { display: inline-block; flex: none; vertical-align: middle; }

/* Button: 3D lip, outline, press-down */
.la-btn { --b: var(--surface-raised); --b-deep: var(--line); --b-ink: var(--ink);
  appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: var(--tap-min); padding: 0 var(--space-5); border-radius: var(--radius-md);
  border: var(--stroke-bold) solid var(--outline); background: var(--b); color: var(--b-ink);
  font-family: var(--font-sans); font-size: 15px; line-height: 20px; font-weight: 800; letter-spacing: .3px; text-transform: uppercase;
  box-shadow: 0 var(--lip) 0 var(--b-deep), 0 calc(var(--lip) + 2px) 0 var(--outline);
  transform: translateY(0); transition: transform 80ms ease-out, box-shadow 80ms ease-out; cursor: pointer; margin-bottom: 7px; }
.la-btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 var(--b-deep), 0 3px 0 var(--outline); }
.la-btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
.la-btn:disabled { --b: var(--surface-sunken); --b-deep: var(--line); --b-ink: var(--ink-muted); border-color: var(--line-strong); box-shadow: 0 var(--lip) 0 var(--line); cursor: not-allowed; }
.la-btn-primary { --b: var(--sun); --b-deep: var(--sun-deep); --b-ink: var(--on-sun); }
.la-btn-go { --b: var(--leaf); --b-deep: var(--leaf-deep); --b-ink: var(--on-leaf); }
.la-btn-brand { --b: var(--sky); --b-deep: var(--sky-deep); --b-ink: var(--on-sky); }
.la-btn-secondary { --b: var(--surface-raised); --b-deep: var(--line); --b-ink: var(--ink); }
.la-btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--sky); margin-bottom: 0; }
.la-btn-ghost:active:not(:disabled) { transform: none; box-shadow: none; }
.la-btn-lg { min-height: var(--tap-lg); font-size: 17px; padding: 0 var(--space-6); }
.la-btn-xl { min-height: var(--tap-xl); font-family: var(--font-display); font-weight: 400; font-size: 26px; line-height: 28px; text-transform: none; letter-spacing: .5px; padding: 0 var(--space-8); border-radius: var(--radius-lg); }
.la-btn-block { display: flex; width: 100%; }

/* Currency pill */
.la-pill { display: inline-flex; align-items: center; gap: var(--space-1); height: 36px; padding: 0 var(--space-3) 0 4px;
  border-radius: var(--radius-pill); background: var(--outline); color: #ffffff; border: var(--stroke-bold) solid var(--outline);
  font-family: var(--font-display); font-size: 20px; line-height: 24px; }
.la-pill-badge { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; }
.la-pill-xp .la-pill-badge { background: var(--grape); color: var(--on-grape); }
.la-pill-coins .la-pill-badge { background: var(--sun); color: var(--on-sun); box-shadow: inset 0 -3px 0 var(--sun-deep); }
.la-pill-streak .la-pill-badge { background: var(--flame); color: var(--outline); }
.la-pill-label { font-family: var(--font-sans); font-size: 13px; font-weight: 800; opacity: .85; margin-left: 2px; }

/* Level badge */
.la-level { position: relative; display: inline-grid; place-items: center; }
.la-level svg { display: block; }
.la-level-track { stroke: var(--surface-sunken); }
.la-level-fill { stroke: var(--grape); }
.la-level-core { fill: var(--grape); stroke: var(--outline); }
.la-level-num { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-display); color: var(--on-grape); }

/* Progress bar */
.la-progress { display: flex; flex-direction: column; gap: var(--space-1); }
.la-progress-head { display: flex; justify-content: space-between; font-size: 13px; line-height: 18px; font-weight: 800; color: var(--ink-muted); }
.la-progress-track { height: 18px; border-radius: var(--radius-pill); background: var(--surface-sunken); overflow: hidden; border: var(--stroke-hair) solid var(--line); }
.la-progress-fill { height: 100%; border-radius: var(--radius-pill); background: var(--leaf); box-shadow: inset 0 5px 0 rgba(255,255,255,.35); transition: width 300ms ease-out; min-width: 14px; }
.la-progress-sky .la-progress-fill { background: var(--sky); }
.la-progress-grape .la-progress-fill { background: var(--grape); }

/* Answer option */
.la-option { appearance: none; display: flex; align-items: center; gap: var(--space-3); width: 100%; min-height: var(--tap-lg);
  padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); border: var(--stroke-hair) solid var(--line-strong);
  background: var(--surface-raised); color: var(--ink); box-shadow: 0 4px 0 var(--line);
  font-family: var(--font-sans); font-size: 18px; line-height: 26px; font-weight: 700; text-align: left; cursor: pointer; }
.la-option:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.la-option-key { flex: none; width: 30px; height: 30px; border-radius: var(--radius-sm); display: grid; place-items: center;
  border: var(--stroke-hair) solid var(--line-strong); font-size: 13px; font-weight: 900; color: var(--ink-muted); }
.la-option-text { flex: 1; }
.la-option-mark { flex: none; }
.la-option-selected { border-color: var(--sky); background: var(--sky-soft); box-shadow: 0 4px 0 var(--sky); }
.la-option-selected .la-option-key { border-color: var(--sky); color: var(--sky); }
.la-option-correct { border-color: var(--leaf-deep); background: var(--leaf-soft); box-shadow: 0 4px 0 var(--leaf-deep); }
.la-option-correct .la-option-key { background: var(--leaf); border-color: var(--leaf-deep); color: var(--on-leaf); }
.la-option-wrong { border-color: var(--coral-deep); background: var(--coral-soft); box-shadow: 0 4px 0 var(--coral-deep); }
.la-option-wrong .la-option-key { background: var(--coral); border-color: var(--coral-deep); color: var(--on-coral); }
.la-option:disabled { cursor: default; }
.la-option-dim { opacity: .55; }

/* Feedback banner */
.la-feedback { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-5); border-radius: var(--radius-lg) var(--radius-lg) 0 0; border-top: var(--stroke-bold) solid; }
.la-feedback-correct { background: var(--leaf-soft); border-color: var(--leaf-deep); }
.la-feedback-almost { background: var(--coral-soft); border-color: var(--coral-deep); }
.la-feedback-head { display: flex; align-items: center; gap: var(--space-3); }
.la-feedback-badge { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; border: var(--stroke-bold) solid var(--outline); }
.la-feedback-correct .la-feedback-badge { background: var(--leaf); color: var(--on-leaf); }
.la-feedback-almost .la-feedback-badge { background: var(--coral); color: var(--on-coral); }
.la-feedback-title { font-family: var(--font-display); font-size: 24px; line-height: 28px; }
.la-feedback-correct .la-feedback-title { color: var(--leaf-text); }
.la-feedback-almost .la-feedback-title { color: var(--coral-text); }
.la-feedback-body { font-size: 16px; line-height: 24px; font-weight: 600; color: var(--ink); }
.la-feedback-body b { font-weight: 900; }
.la-feedback-xp { margin-left: auto; font-family: var(--font-display); font-size: 20px; color: var(--grape-deep); }
[data-theme="dark"] .la-feedback-xp { color: var(--grape); }

/* Word card */
.la-word { position: relative; display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-6) var(--space-5) var(--space-5);
  border-radius: var(--radius-lg); background: var(--surface-raised); border: var(--stroke-hair) solid var(--line); box-shadow: var(--shadow-card); }
.la-word-dots { display: flex; gap: 4px; }
.la-word-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--surface-sunken); border: var(--stroke-hair) solid var(--line-strong); }
.la-word-dot-on { background: var(--leaf); border-color: var(--leaf-deep); }
.la-word-top { display: flex; justify-content: space-between; align-items: center; font-size: 13px; line-height: 18px; font-weight: 800; color: var(--ink-muted); }
.la-word-main { font-size: 30px; line-height: 36px; font-weight: 900; color: var(--ink); }
.la-word-sub { font-size: 18px; line-height: 26px; font-weight: 700; color: var(--ink-muted); }
.la-word-extra { margin-top: var(--space-2); padding-top: var(--space-3); border-top: var(--stroke-hair) dashed var(--line); display: flex; flex-direction: column; gap: 4px; font-size: 16px; line-height: 24px; font-weight: 600; }
.la-tag { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 var(--space-2); border-radius: var(--radius-sm); font-size: 13px; line-height: 18px; font-weight: 800; }
.la-tag-added { background: var(--grape-soft); color: var(--grape-deep); }
[data-theme="dark"] .la-tag-added { color: var(--grape); }
.la-tag-new { background: var(--berry); color: var(--on-berry); text-transform: uppercase; letter-spacing: .5px; border: var(--stroke-hair) solid var(--outline); }

/* Scan review row */
.la-scan { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-radius: var(--radius-md);
  background: var(--surface-raised); border: var(--stroke-hair) solid var(--line); }
.la-scan-check { border: var(--stroke-bold) solid var(--sun-deep); }
.la-scan-ask { border: var(--stroke-bold) solid var(--sky); flex-wrap: wrap; }
.la-scan-hint { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; line-height: 18px; font-weight: 800; color: var(--ink); background: var(--sky-soft); border-radius: var(--radius-sm); padding: 0 var(--space-2); height: 24px; }
.la-scan-check .la-scan-hint { background: var(--sun); color: var(--on-sun); }
.la-scan-pair { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.la-scan-de { font-size: 13px; line-height: 18px; font-weight: 800; color: var(--ink-muted); }
.la-scan-en { font-size: 18px; line-height: 26px; font-weight: 800; color: var(--ink); }
.la-scan-state { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; line-height: 18px; font-weight: 800; color: var(--leaf-text); }
.la-scan-actions { display: flex; gap: var(--space-2); }
.la-scan-input { width: 100%; height: var(--tap-min); border-radius: var(--radius-md); border: var(--stroke-hair) solid var(--line-strong); background: var(--surface-sunken); color: var(--ink);
  padding: 0 var(--space-4); font-family: var(--font-sans); font-size: 18px; font-weight: 700; }
.la-scan-input:focus { outline: 3px solid var(--focus); outline-offset: 1px; }
.la-btn-sm { min-height: 40px; padding: 0 var(--space-3); font-size: 13px; border-width: var(--stroke-hair); box-shadow: 0 3px 0 var(--b-deep), 0 5px 0 var(--outline); margin-bottom: 5px; }

/* Week band */
.la-week { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4); border-radius: var(--radius-lg); background: var(--surface-raised); border: var(--stroke-hair) solid var(--line); }
.la-week-good { background: var(--leaf-soft); border-color: var(--leaf-deep); }
.la-week-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: var(--space-2); }
.la-week-day { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 13px; line-height: 18px; font-weight: 800; color: var(--ink-muted); }
.la-week-dot { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-sunken); border: var(--stroke-hair) solid var(--line); color: var(--ink-muted); }
.la-week-done .la-week-dot { background: var(--leaf); border: var(--stroke-bold) solid var(--outline); color: var(--on-leaf); }
.la-week-freeze .la-week-dot { background: var(--frost); border: var(--stroke-bold) solid var(--outline); color: var(--outline); }
.la-week-rest .la-week-dot { border-style: dashed; }
.la-week-today .la-week-dot { border: var(--stroke-bold) solid var(--sky); background: var(--surface-raised); }
.la-week-today { color: var(--ink); }
.la-week-msg { font-size: 16px; line-height: 24px; font-weight: 700; color: var(--ink); }

/* Reward card */
.la-reward { --r: var(--rarity-common); width: 168px; display: flex; flex-direction: column; border-radius: var(--radius-lg); overflow: hidden;
  border: var(--stroke-bold) solid var(--outline); background: var(--r); box-shadow: 0 6px 0 var(--outline); font-family: var(--font-sans); }
.la-reward-rare { --r: var(--rarity-rare); }
.la-reward-epic { --r: var(--rarity-epic); }
.la-reward-legend { --r: var(--rarity-legend); }
.la-reward-top { display: flex; justify-content: space-between; align-items: center; padding: var(--space-2) var(--space-2) 0; min-height: 34px; }
.la-reward-rarity { font-size: 13px; line-height: 18px; font-weight: 900; padding: 2px var(--space-2); border-radius: var(--radius-sm); background: var(--outline); color: #ffffff; }
.la-reward-art { height: 118px; display: grid; place-items: center; }
.la-reward-name { background: var(--surface-raised); padding: var(--space-2) var(--space-3) 0; font-family: var(--font-display); font-size: 18px; line-height: 22px; color: var(--ink); }
.la-reward-kind { background: var(--surface-raised); padding: 0 var(--space-3) var(--space-2); font-size: 13px; line-height: 18px; font-weight: 800; color: var(--ink-muted); }
.la-reward-price { display: flex; align-items: center; justify-content: center; gap: var(--space-1); height: 44px; background: var(--leaf); border-top: var(--stroke-bold) solid var(--outline);
  font-family: var(--font-display); font-size: 20px; color: var(--on-leaf); }
.la-reward-owned .la-reward-price { background: var(--surface-sunken); color: var(--ink-muted); font-family: var(--font-sans); font-size: 15px; font-weight: 800; }

/* Start card */
.la-start { position: relative; overflow: hidden; display: flex; flex-direction: column; gap: var(--space-4); padding: var(--space-6) var(--space-5) var(--space-5);
  border-radius: var(--radius-lg); background: var(--world); border: var(--stroke-bold) solid var(--outline); color: var(--ink-inverse); isolation: isolate; }
.la-start::before { content: ""; position: absolute; inset: -50%; z-index: -1;
  background: repeating-conic-gradient(from 0deg at 50% 50%, var(--world-ray) 0deg 12deg, transparent 12deg 30deg); }
.la-start-title { font-size: 32px; line-height: 36px; }
.la-start-sub { font-family: var(--font-sans); font-size: 16px; line-height: 24px; font-weight: 800; color: var(--ink-inverse); }
.la-start-meta { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.la-chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 var(--space-3); border-radius: var(--radius-pill);
  background: var(--surface-raised); color: var(--ink); border: var(--stroke-hair) solid var(--outline); font-size: 13px; line-height: 18px; font-weight: 800; }

/* Reward card: locked */
.la-reward-lock { background: var(--surface-sunken); color: var(--ink); font-family: var(--font-sans); font-size: 13px; line-height: 16px; font-weight: 800; padding: 0 var(--space-2); text-align: center; }
.la-reward-prog { height: 6px; background: var(--surface-sunken); }
.la-reward-prog span { display: block; height: 100%; background: var(--grape); }

/* Character */
.la-char { display: block; overflow: visible; }
.la-char-crop { overflow: hidden; }

/* Character editor */
.la-editor { display: flex; flex-direction: column; max-width: 420px; border-radius: var(--radius-lg); overflow: hidden; border: var(--stroke-bold) solid var(--outline); background: var(--surface); }
.la-editor-stage { position: relative; isolation: isolate; overflow: hidden; display: flex; flex-direction: column; align-items: center; gap: var(--space-3); padding: var(--space-4); background: var(--world); }
.la-editor-stage::before { content: ""; position: absolute; inset: -50%; z-index: -1; background: repeating-conic-gradient(from 0deg at 50% 50%, var(--world-ray) 0deg 12deg, transparent 12deg 30deg); }
.la-editor-top { align-self: stretch; display: flex; justify-content: space-between; align-items: center; }
.la-editor-tabs { display: flex; gap: var(--space-2); padding: var(--space-3) var(--space-4); overflow-x: auto; background: var(--surface-raised); border-bottom: var(--stroke-hair) solid var(--line); }
.la-tab { appearance: none; flex: none; min-height: 40px; padding: 0 var(--space-4); border-radius: var(--radius-pill); border: var(--stroke-hair) solid var(--line-strong); background: var(--surface-raised); color: var(--ink);
  font-family: var(--font-sans); font-size: 15px; font-weight: 800; cursor: pointer; }
.la-tab-on { background: var(--outline); border-color: var(--outline); color: #ffffff; }
.la-tab:focus-visible, .la-opt:focus-visible, .la-swatch-btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.la-editor-body { padding: var(--space-4); min-height: 220px; }
.la-opt-head { font-size: 15px; line-height: 20px; font-weight: 800; color: var(--ink); }
.la-opt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: var(--space-3); }
.la-opt { appearance: none; position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: var(--space-2) var(--space-2) var(--space-3);
  border-radius: var(--radius-md); border: var(--stroke-hair) solid var(--line-strong); background: var(--surface-raised); color: var(--ink); box-shadow: 0 4px 0 var(--line);
  font-family: var(--font-sans); cursor: pointer; overflow: hidden; }
.la-opt-art { height: 96px; display: grid; place-items: center; }
.la-opt-name { font-size: 13px; line-height: 16px; font-weight: 800; text-align: center; }
.la-opt-on { border: var(--stroke-bold) solid var(--sky); background: var(--sky-soft); box-shadow: 0 4px 0 var(--sky); }
.la-opt-common { border-bottom: 6px solid var(--rarity-common); }
.la-opt-rare { border-bottom: 6px solid var(--rarity-rare); }
.la-opt-epic { border-bottom: 6px solid var(--rarity-epic); }
.la-opt-legend { border-bottom: 6px solid var(--rarity-legend); }
.la-opt-locked { background: var(--surface-sunken); cursor: default; }
.la-opt-locked .la-opt-art { opacity: .55; }
.la-opt-lock { display: block; font-size: 12px; line-height: 15px; font-weight: 800; color: var(--ink-muted); text-align: center; }
.la-opt-lock .la-icon { margin: -2px 3px 0 0; }
.la-opt-prog { width: 100%; height: 6px; border-radius: var(--radius-pill); background: var(--surface-raised); overflow: hidden; border: 1px solid var(--line); }
.la-opt-prog span { display: block; height: 100%; background: var(--grape); }
.la-swatch-row { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.la-swatch-btn { appearance: none; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px; min-width: 56px; border-radius: var(--radius-md); border: var(--stroke-hair) solid transparent; background: transparent; color: var(--ink); font-family: var(--font-sans); cursor: pointer; }
.la-swatch-btn.la-opt-on { border: var(--stroke-bold) solid var(--sky); background: var(--sky-soft); box-shadow: none; }
.la-swatch { width: 40px; height: 40px; border-radius: 50%; border: var(--stroke-bold) solid var(--outline); display: block; }
