:root {
  /* Palette tokens. js/themes.js sets these from the chosen palette; the values
     here are the default (Azulejo) so the page looks right before JS runs. */
  --bg: #F6F1E7; --surface: #FFFFFF; --surface2: #EEE6D6; --text: #1D2A44; --muted: #7A7468; --line: rgba(29,42,68,.1);
  --accent: #1F4E99; --accent-text: #FFFFFF; --accent-shadow: 0 10px 24px rgba(31,78,153,.3);
  --accent2: #F2B33D; --accent2-text: #3A2600; --chip: #E4ECF8; --chip-text: #1F4E99;
  --brick: #D9653B; --window: #2B3550; --base: #B9AF9C; --track: #EAE2D2;
  --tile: #1F4E99; --tile-text: #FFFFFF; --tile-edge: #163A73; --good: #2E9E6A; --good-text: #FFFFFF; --bad: #D64545;
  --bp: #1F4E99; --bp-text: #FFFFFF; --bp-grid: rgba(255,255,255,.08); --en-bg: #F1EADC;
  --tabbar: #FFFFFF; --tab-on: #E4ECF8; --ghost: rgba(29,42,68,.25); --ghost-fill: rgba(29,42,68,.08); --card-shadow: 0 2px 8px rgba(29,42,68,.06);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  --d-plaza: #D9653B; --d-ser: #1F4E99; --d-estar: #2E7D8C; --d-well: #E0A030; --d-market: #B5473A; --d-oldtown: #4F6FA8; --d-harbor: #3D8F6E; --d-hilltop: #8A5A9E;
  /* Derived from the palette */
  --surface3: color-mix(in srgb, var(--text) 9%, var(--surface));
  --pill: color-mix(in srgb, var(--text) 16%, var(--surface));
  --text-soft: color-mix(in srgb, var(--text) 82%, var(--bg));
  --topbar: color-mix(in srgb, var(--bg) 84%, transparent);
  --toast: color-mix(in srgb, var(--text) 92%, var(--bg));
  --brick-hi: color-mix(in srgb, var(--brick) 72%, #fff);
  --brick-lo: color-mix(in srgb, var(--brick) 70%, #000);
  --bp-muted: color-mix(in srgb, var(--bp-text) 62%, var(--bp));
  --bp-soft: color-mix(in srgb, var(--bp-text) 85%, var(--bp));
  --bp-chip: color-mix(in srgb, var(--bp-text) 10%, var(--bp));
  --bp-line: color-mix(in srgb, var(--bp-text) 20%, transparent);
  /* Layout */
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --top-h: calc(var(--sat) + 54px);
  /* Tab bar sits low: only part of the home-indicator area is kept clear
     (the indicator is a thin bar ~8px from the bottom edge). */
  --tab-pad-b: max(8px, calc(var(--sab) - 20px));
  --tab-h: calc(54px + var(--tab-pad-b));
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { overscroll-behavior: none; }
html, body {
  margin: 0; height: 100%;
  background: var(--bg); color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}
body { position: fixed; inset: 0; overflow: hidden; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: manipulation; -webkit-text-size-adjust: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; }
#app { position: absolute; inset: 0; overflow: hidden; }

.pressable { transition: scale 0.45s var(--spring), filter 0.2s; }
.pressable.pressed { scale: 0.95; filter: brightness(0.9); transition: scale 0.08s ease-out, filter 0.08s; }
.shake { animation: shake 0.38s; }
@keyframes shake { 0%, 100% { translate: 0; } 20% { translate: -7px; } 40% { translate: 6px; } 60% { translate: -4px; } 80% { translate: 2px; } }

/* ---------- Top bar ---------- */
.topbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 20;
  height: var(--top-h); padding: var(--sat) 16px 0;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--topbar);
  -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 0.5px solid var(--line);
}
.brand { font-size: 22px; font-weight: 850; letter-spacing: -0.02em; }
.top-stats { display: flex; align-items: center; gap: 12px; font-weight: 750; font-variant-numeric: tabular-nums; }
.bricks { display: flex; align-items: center; gap: 7px; font-size: 17px; }
.brick-icon {
  display: inline-block; width: 22px; height: 13px; border-radius: 3px;
  background: linear-gradient(180deg, var(--brick-hi), var(--brick) 55%, var(--brick-lo));
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(0, 0, 0, 0.25);
}
.streak { font-size: 15px; }

/* ---------- Views ---------- */
.views { position: absolute; inset: 0; }
.view {
  position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden;
  padding: calc(var(--top-h) + 14px) 0 calc(var(--tab-h) + 28px);
  opacity: 0; visibility: hidden; transform: translateX(28px);
  transition: opacity 0.2s ease, transform 0.4s var(--ease-out), visibility 0s linear 0.4s;
}
.view.before { transform: translateX(-28px); }
.view.active { opacity: 1; visibility: visible; transform: none; transition: opacity 0.25s ease, transform 0.4s var(--ease-out), visibility 0s; }
.page-title { margin: 4px 16px 4px; font-size: 32px; font-weight: 850; letter-spacing: -0.02em; }
.page-sub { margin: 0 16px 16px; color: var(--muted); font-size: 14px; line-height: 1.45; }
.section-title { display: flex; justify-content: space-between; align-items: baseline; margin: 26px 16px 10px; font-size: 20px; font-weight: 800; }
.section-title small { font-size: 13px; font-weight: 500; color: var(--muted); }
.section-title.small { font-size: 16px; margin: 18px 0 8px; }
.empty { padding: 40px 24px; text-align: center; color: var(--muted); line-height: 1.5; }

/* ---------- Generic controls ---------- */
.card { margin: 0 16px 14px; background: var(--surface); border-radius: 20px; padding: 16px; }
.btn { height: 48px; padding: 0 18px; border-radius: 15px; background: var(--surface3); font-weight: 700; font-size: 15px; }
.btn.primary { background: var(--accent); color: var(--accent-text); }
.btn.danger { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); }
.btn.block { display: block; width: 100%; }
.link-btn { color: var(--muted); font-size: 14px; font-weight: 600; padding: 10px 8px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; font-size: 16px; }
.row + .row { border-top: 0.5px solid var(--line); }
.fine { font-size: 12.5px; color: var(--muted); margin: 8px 0 0; line-height: 1.4; }
input[type="checkbox"] { accent-color: var(--good); margin: 0; }
.info { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; font-size: 14px; }
.info dt { color: var(--muted); }
.info dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.version { text-align: center; color: var(--muted); font-size: 12px; }
.stepper { display: flex; align-items: center; gap: 4px; background: var(--surface3); border-radius: 12px; padding: 3px; }
.stepper button { width: 38px; height: 34px; border-radius: 9px; font-size: 20px; font-weight: 700; }
.stepper b { min-width: 40px; text-align: center; font-variant-numeric: tabular-nums; }
.stepper.big { justify-content: center; margin: 18px auto 6px; width: fit-content; }
.stepper.big b { min-width: 110px; font-size: 22px; }
.stepper.big button { width: 52px; height: 48px; font-size: 26px; }
.ob-title { text-align: center; color: var(--accent2); font-weight: 700; }
.seg { position: relative; display: flex; background: var(--surface3); border-radius: 11px; padding: 3px; }
.seg button { flex: 1; height: 32px; position: relative; z-index: 1; font-size: 14px; font-weight: 650; color: var(--muted); }
.seg button.on { color: var(--text); }
.seg-pill { position: absolute; top: 3px; bottom: 3px; left: 0; width: 0; border-radius: 8px; background: var(--pill); transition: transform 0.45s var(--spring), width 0.45s var(--spring); }

/* ---------- Tab bar ---------- */
.tabbar {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 20; height: var(--tab-h);
  display: grid; grid-template-columns: repeat(4, 1fr); padding: 4px 10px var(--tab-pad-b);
  background: var(--tabbar);
  -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
  border-top: 0.5px solid var(--line);
}
.tab { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; height: 50px; font-size: 11px; font-weight: 650; color: var(--muted); transition: color 0.2s; }
.tab svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: scale 0.4s var(--spring); }
.tab.active { color: var(--accent); }
.tab.active svg { scale: 1.08; }
.tab-indicator { position: absolute; top: 4px; left: 0; height: 50px; width: 0; border-radius: 16px; background: var(--tab-on); transition: transform 0.5s var(--spring), width 0.5s var(--spring); }

/* ---------- Stage (game view) ---------- */
.stage {
  position: absolute; inset: 0; z-index: 30; display: flex; flex-direction: column;
  background: var(--bg); transform: translateY(100%); visibility: hidden;
  transition: transform 0.45s var(--ease-out), visibility 0s linear 0.45s;
}
.stage.open { transform: none; visibility: visible; transition: transform 0.5s var(--spring), visibility 0s; }
.stage-top { flex: none; display: flex; align-items: center; gap: 12px; padding: calc(var(--sat) + 8px) 14px 8px; }
.stage-close { width: 38px; height: 38px; border-radius: 19px; background: var(--surface3); font-size: 16px; color: var(--muted); }
.stage-title { flex: 1; font-weight: 750; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage-body { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 6px 16px calc(var(--sab) + 24px); }
.stage .page-sub { margin: 4px 0 14px; }

/* ---------- Builder ---------- */
.builder { display: flex; flex-direction: column; min-height: 100%; }
.b-prompt { padding: 14px 4px 18px; }
.b-meta { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; }
.combo { color: var(--accent2); }
.b-en { font-size: 23px; font-weight: 700; line-height: 1.3; margin-top: 6px; letter-spacing: -0.01em; -webkit-user-select: text; user-select: text; }
.anno { font-size: 0.7em; font-weight: 700; color: var(--accent2); background: color-mix(in srgb, var(--accent2) 12%, transparent); padding: 1px 6px; border-radius: 6px; vertical-align: 2px; }
.caps { color: var(--accent2); text-decoration: underline 2px; text-underline-offset: 3px; }
.b-sentence {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 6px; padding: 16px 14px; min-height: 96px;
  border-radius: 20px; background: linear-gradient(180deg, var(--surface2), var(--surface2)); box-shadow: inset 0 0 0 1px var(--line);
}
.b-sentence.hidden-until-ready { filter: blur(8px); opacity: 0.4; }
.tw { display: inline-flex; align-items: center; }
.punct { font-size: 20px; font-weight: 700; color: var(--muted); padding: 0 1px; }
.brick { display: inline-block; padding: 7px 10px; border-radius: 8px; font-size: 17px; font-weight: 600; }
.brick.en { background: color-mix(in srgb, var(--text) 7%, transparent); color: var(--muted); font-style: italic; }
.brick.es { background: color-mix(in srgb, var(--brick) 22%, transparent); color: var(--text); }
.slot {
  min-width: 56px; height: 40px; padding: 0 10px; border-radius: 10px; font-size: 17px; font-weight: 750;
  border: 2px dashed var(--ghost); color: var(--text); transition: border-color 0.2s, background 0.2s;
}
.slot.verb { border-color: color-mix(in srgb, var(--accent2) 35%, transparent); }
.slot.active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); border-style: solid; }
.slot.filled { border-style: solid; border-color: transparent; background: var(--tile); color: var(--tile-text); }
.slot.right { background: var(--good); color: var(--good-text); }
.slot.wrong { background: var(--bad); color: #fff; }
.b-feedback:empty { display: none; }
.b-feedback { margin-top: 14px; }
.fb { padding: 14px 16px; border-radius: 18px; }
.fb.good { background: color-mix(in srgb, var(--good) 10%, transparent); }
.fb.bad { background: color-mix(in srgb, var(--bad) 8%, transparent); }
.fb-title { font-weight: 800; font-size: 17px; margin-bottom: 4px; }
.fb.good .fb-title { color: var(--good); }
.fb-answer { font-size: 18px; font-weight: 650; line-height: 1.5; margin-bottom: 8px; -webkit-user-select: text; user-select: text; }
.fb-answer mark { background: color-mix(in srgb, var(--good) 18%, transparent); color: var(--good); padding: 0 4px; border-radius: 5px; }
.fb-full { color: var(--muted); font-size: 14px; margin-bottom: 10px; -webkit-user-select: text; user-select: text; }
.fb-full b { color: var(--text); }
.b-tray { margin-top: 18px; flex: 1; }
.tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.tile {
  min-width: 52px; height: 48px; padding: 0 16px; border-radius: 13px; font-size: 18px; font-weight: 750;
  background: var(--tile); color: var(--tile-text); box-shadow: 0 4px 0 var(--tile-edge), 0 6px 14px rgba(0, 0, 0, 0.3);
}
.tile.used { opacity: 0.18; box-shadow: none; }
.tile.selected { background: var(--accent2); translate: 0 -4px; box-shadow: 0 8px 0 color-mix(in srgb, var(--accent2) 70%, #000), 0 12px 20px rgba(0, 0, 0, 0.35); }
.b-actions { display: flex; justify-content: space-between; margin-top: 16px; }
.b-actions .btn { margin-top: 4px; }
.say-first { text-align: center; padding: 18px 0; color: var(--muted); }
.say-first p { font-size: 15px; margin: 0 0 12px; }

/* Seat picker */
.picker { background: var(--surface); border-radius: 20px; padding: 12px 12px 14px; }
.pk-step { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 750; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin: 4px 2px 6px; }
.pk-step span { width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; background: var(--surface3); color: var(--text); font-size: 11px; }
.pk-row { display: flex; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.chip-btn { flex: 1; min-width: 70px; height: 40px; border-radius: 12px; background: var(--surface3); font-weight: 750; font-size: 15px; }
.chip-btn.on { background: var(--accent2); color: var(--accent2-text); }
.chip-btn:disabled { opacity: 0.35; }
.pk-table { position: relative; height: 210px; margin-top: 4px; }
.pk-tabletop { position: absolute; left: 30%; right: 30%; top: 32%; bottom: 32%; border-radius: 50%; background: radial-gradient(circle, var(--surface3), var(--surface2)); box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.5); }
.seat {
  position: absolute; translate: -50% -50%; min-width: 84px; padding: 7px 8px; border-radius: 14px;
  background: var(--tile); color: var(--tile-text); display: flex; flex-direction: column; align-items: center;
  box-shadow: 0 3px 0 var(--tile-edge), 0 6px 12px rgba(0, 0, 0, 0.3);
}
.seat b { font-size: 17px; }
.seat small { font-size: 10.5px; font-weight: 650; opacity: 0.65; white-space: nowrap; }
.seat:disabled { background: var(--surface3); color: var(--muted); box-shadow: none; }

/* ---------- Quick Sort ---------- */
.sort { display: flex; flex-direction: column; min-height: 100%; }
.sort-hud { display: flex; align-items: center; gap: 12px; padding: 6px 0 14px; }
.sort-progress { flex: 1; height: 8px; border-radius: 4px; background: var(--surface3); overflow: hidden; }
.sort-progress i { display: block; height: 100%; width: 0; border-radius: 4px; background: linear-gradient(90deg, var(--accent2), var(--accent)); transition: width 0.4s var(--spring); }
.sort-combo { min-width: 44px; text-align: right; font-weight: 800; color: var(--accent2); }
.sort-stack { flex: 1; display: grid; place-items: center; min-height: 300px; }
.sort-card {
  position: relative; width: 100%; padding: 22px 20px 26px; border-radius: 26px; overflow: hidden;
  background: var(--surface); box-shadow: var(--lift), inset 0 0 0 1px var(--line);
  touch-action: none; cursor: grab; will-change: transform;
}
.sort-card.good { box-shadow: 0 0 0 2px var(--good), var(--lift); }
.sort-card.bad { box-shadow: 0 0 0 2px var(--bad), var(--lift); }
.sc-rule { font-size: 12px; font-weight: 750; color: var(--accent2); text-transform: uppercase; letter-spacing: 0.05em; }
.sc-en { margin-top: 10px; font-size: 15px; color: var(--muted); line-height: 1.4; }
.sc-es { margin-top: 12px; font-size: 24px; font-weight: 750; line-height: 1.4; }
.gap { display: inline-block; min-width: 54px; padding: 0 8px; border-radius: 8px; text-align: center; background: color-mix(in srgb, var(--accent2) 15%, transparent); color: var(--accent2); border: 2px dashed color-mix(in srgb, var(--accent2) 50%, transparent); }
.gap.revealed { background: var(--good); color: var(--good-text); border-color: transparent; }
.sc-tint { position: absolute; top: 14px; padding: 6px 12px; border-radius: 10px; font-weight: 800; font-size: 18px; opacity: 0; background: var(--accent2); color: var(--accent2-text); }
.sc-tint.l { left: 14px; rotate: -8deg; }
.sc-tint.r { right: 14px; rotate: 8deg; }
.sort-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.choice { height: 64px; border-radius: 18px; background: var(--tile); color: var(--tile-text); font-size: 22px; font-weight: 800; box-shadow: 0 4px 0 var(--tile-edge), 0 8px 16px rgba(0, 0, 0, 0.3); }
.sort-hint { text-align: center; color: var(--muted); font-size: 13px; }
.sort-end { text-align: center; padding-top: 20px; }
.se-score { font-size: 64px; font-weight: 900; letter-spacing: -0.03em; color: var(--accent2); font-variant-numeric: tabular-nums; }
.se-label { color: var(--muted); font-weight: 650; }
.se-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 22px 0; }
.se-stats div, .ds-stats div { background: var(--surface); border-radius: 16px; padding: 12px 6px; display: flex; flex-direction: column; }
.se-stats b, .ds-stats b { font-size: 20px; font-variant-numeric: tabular-nums; }
.se-stats small, .ds-stats small { color: var(--muted); font-size: 12px; }
.se-missed { text-align: left; margin-bottom: 18px; }

/* ---------- Palace ---------- */
.palace-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.palace-card { min-height: 112px; padding: 14px; border-radius: 18px; text-align: left; display: flex; flex-direction: column; background: linear-gradient(150deg, var(--b1), var(--b2)); box-shadow: inset 0 0 0 1px var(--line); }
.palace-card.locked { opacity: 0.4; }
.pc-name { font-weight: 800; font-size: 16px; }
.pc-scene { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.pc-best { margin-top: auto; font-size: 13px; font-weight: 700; color: var(--accent2); }
.pl-head { display: flex; justify-content: space-between; align-items: flex-end; padding: 6px 2px 12px; }
.pl-name { font-size: 22px; font-weight: 850; }
.pl-scene { color: var(--muted); font-size: 13px; }
.pl-timer { font-size: 22px; font-weight: 800; color: var(--accent2); font-variant-numeric: tabular-nums; }
.scene { position: relative; aspect-ratio: 1 / 0.92; border-radius: 24px; background: radial-gradient(120% 100% at 50% 0%, var(--b1), var(--b2)); box-shadow: inset 0 0 0 1px var(--line); }
.pseat {
  position: absolute; translate: -50% -50%; min-width: 86px; max-width: 120px; padding: 6px 8px 7px; border-radius: 16px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: rgba(0, 0, 0, 0.28); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}
.ps-icon { font-size: 26px; line-height: 1.1; }
.ps-words { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; min-height: 4px; }
.ps-words b { padding: 2px 8px; border-radius: 7px; background: var(--tile); color: var(--tile-text); font-size: 14px; }
.pseat small { font-size: 10.5px; color: rgba(255, 255, 255, 0.7); text-align: center; line-height: 1.15; }
.pl-hint { text-align: center; color: var(--muted); font-size: 14px; margin: 14px 0 12px; }
.pl-hint b { color: var(--accent2); font-size: 18px; }
.pl-end { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; }

/* ---------- Sheet, scrim, toast, modal, fx ---------- */
.scrim { position: absolute; inset: 0; z-index: 45; background: #000; opacity: 0; pointer-events: none; }
.scrim.on { pointer-events: auto; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; height: calc(100% - var(--sat) - 24px); z-index: 50;
  display: flex; flex-direction: column; background: var(--surface); border-radius: 22px 22px 0 0;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5); transform: translate3d(0, 110%, 0); will-change: transform;
}
.sheet::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 200px; background: var(--surface); }
.sheet-handle { padding: 8px 16px 12px; touch-action: none; }
.grabber { width: 38px; height: 5px; border-radius: 3px; background: var(--ghost); margin: 0 auto 12px; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.sheet-head h3 { margin: 0; font-size: 20px; }
.sheet-done { height: 34px; padding: 0 14px; border-radius: 17px; background: var(--surface3); font-weight: 700; font-size: 14px; flex: none; }
.sheet-content { flex: 1; overflow-y: auto; padding: 0 16px calc(var(--sab) + 24px); }
.toast {
  position: absolute; left: 50%; bottom: calc(var(--tab-h) + 14px); z-index: 90; max-width: calc(100% - 32px);
  padding: 11px 18px; border-radius: 22px; background: var(--toast); color: var(--bg); font-size: 14px; font-weight: 650;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  transform: translate(-50%, 30px) scale(0.9); opacity: 0; pointer-events: none; transition: transform 0.45s var(--spring), opacity 0.2s;
}
.toast.show { transform: translate(-50%, 0) scale(1); opacity: 1; }
.modal-wrap { position: absolute; inset: 0; z-index: 70; display: grid; place-items: center; padding: 24px; background: rgba(0, 0, 0, 0.6); opacity: 0; pointer-events: none; transition: opacity 0.2s; }
.modal-wrap.show { opacity: 1; pointer-events: auto; }
.modal { width: min(360px, 100%); padding: 24px 22px 20px; border-radius: 28px; background: var(--surface2); text-align: center; transform: scale(0.85); transition: transform 0.55s var(--spring); }
.modal-wrap.show .modal { transform: scale(1); }
.modal h2 { margin: 0 0 8px; font-size: 21px; }
.modal p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.4; }
.modal-actions { display: grid; gap: 10px; margin-top: 18px; }
#fx { position: absolute; inset: 0; z-index: 100; pointer-events: none; overflow: hidden; }
.particle { position: absolute; left: 0; top: 0; width: 7px; height: 7px; margin: -3.5px; border-radius: 50%; background: var(--accent2); box-shadow: 0 0 8px var(--accent); }
.brick-fly { position: absolute; left: 0; top: 0; width: 20px; height: 11px; margin: -5px -10px; border-radius: 3px; background: linear-gradient(180deg, var(--brick-hi), var(--brick)); }
.float { position: absolute; font-weight: 800; font-size: 22px; color: var(--accent2); white-space: nowrap; }
.reduce-motion .stage, .reduce-motion .view { transition-duration: 0.01s !important; }

/* =========================================================
   Prototype 2: town, buildings, blueprints, intros
   ========================================================= */
.lv-badge { padding: 4px 9px; border-radius: 10px; background: color-mix(in srgb, var(--accent2) 14%, transparent); color: var(--accent2); font-size: 13px; }
.lv-badge b { font-size: 15px; }
.xp-chip { display: inline-block; padding: 2px 8px; border-radius: 9px; background: color-mix(in srgb, var(--accent2) 16%, transparent); color: var(--accent2); font-size: 13px; font-weight: 800; vertical-align: 2px; }
.xp-chip.big { font-size: 18px; padding: 6px 14px; border-radius: 14px; margin: 6px 0 18px; }
.new-tag { padding: 1px 6px; border-radius: 6px; background: var(--accent); color: var(--accent-text); font-size: 10.5px; letter-spacing: 0.06em; }

/* Stage HUD */
.stage-hud { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stage-hud .lv { color: var(--accent2); }
.stage-hud .goal { color: var(--muted); }
.xpbar { display: inline-block; position: relative; width: 70px; height: 7px; border-radius: 4px; background: var(--track); overflow: hidden; }
.xpbar i { position: absolute; inset: 0 auto 0 0; border-radius: 4px; background: linear-gradient(90deg, var(--accent2), var(--accent)); transition: width 0.5s var(--spring); }

/* Player card + play button */
.player { display: flex; align-items: center; gap: 14px; margin: 0 16px; padding: 14px 16px; border-radius: 20px; background: var(--surface); }
.pl-level { width: 54px; height: 54px; flex: none; border-radius: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; background: var(--accent2); color: var(--accent2-text); }
.pl-level b { font-size: 24px; line-height: 1; }
.pl-level small { font-size: 9px; font-weight: 800; letter-spacing: 0.1em; }
.pl-mid { flex: 1; min-width: 0; display: grid; gap: 8px; }
.pl-xp, .pl-goal { display: flex; align-items: center; gap: 10px; }
.pl-xp .xpbar { flex: 1; width: auto; height: 9px; }
.pl-mid small { color: var(--muted); font-size: 12px; font-weight: 650; white-space: nowrap; font-variant-numeric: tabular-nums; }
.goal-dots { flex: 1; display: flex; gap: 3px; }
.goal-dots i { flex: 1; height: 9px; border-radius: 2px; background: var(--track); }
.goal-dots i.on { background: linear-gradient(180deg, var(--brick-hi), var(--brick)); }
.play-btn { display: flex; align-items: center; gap: 14px; width: calc(100% - 32px); margin: 12px 16px 0; padding: 16px 18px; border-radius: 22px; text-align: left; background: var(--accent); color: var(--accent-text); box-shadow: var(--accent-shadow); }
.pb-icon { width: 46px; height: 46px; flex: none; border-radius: 23px; display: grid; place-items: center; background: rgba(0, 0, 0, 0.14); font-size: 18px; }
.pb-text { display: flex; flex-direction: column; min-width: 0; }
.pb-text b { font-size: 24px; font-weight: 900; letter-spacing: -0.02em; }
.pb-text small { font-size: 13px; font-weight: 650; opacity: 0.75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.modes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 16px 0; }
.mode { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 4px; border-radius: 16px; background: var(--surface); text-align: center; }
.mode span { font-size: 20px; }
.mode b { font-size: 12px; }
.mode small { font-size: 10.5px; color: var(--muted); min-height: 13px; }
.mode.locked { opacity: 0.45; }

/* Districts and buildings */
.districts { display: grid; gap: 14px; margin: 22px 16px 0; }
.district { padding: 14px 14px 12px; border-radius: 22px; background: linear-gradient(180deg, color-mix(in srgb, var(--c) 16%, var(--surface)), var(--surface) 70%); box-shadow: inset 0 0 0 1px var(--line); }
.district.closed { opacity: 0.55; }
.d-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.d-name { font-size: 18px; font-weight: 850; }
.d-blurb { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.d-count { font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.street { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 6px; margin-top: 14px; padding-bottom: 6px; border-bottom: 3px solid var(--ghost-fill); }
.lot { display: flex; flex-direction: column; align-items: center; gap: 5px; min-width: 0; }
.lot-name { font-size: 11px; font-weight: 700; color: var(--muted); max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.claim { margin-top: 10px; font-size: 13px; font-weight: 700; color: var(--muted); padding: 6px 2px; }

.bld { position: relative; width: 58px; height: 58px; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.bld.big { width: 96px; height: 96px; }
.bld .base { width: 100%; height: 9%; min-height: 6px; border-radius: 2px; background: var(--base); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.3); }
.bld .walls {
  position: relative; width: 84%; height: 48%; display: flex; justify-content: space-around; align-items: center;
  background-color: var(--c);
  background-image: linear-gradient(rgba(0, 0, 0, 0.22) 1px, transparent 1px), linear-gradient(90deg, rgba(0, 0, 0, 0.18) 1px, transparent 1px);
  background-size: 100% 6px, 9px 6px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
}
.bld.big .walls { background-size: 100% 10px, 15px 10px; }
.bld .walls i { width: 22%; height: 38%; border-radius: 2px; background: var(--window); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.4); }
.bld .roof { width: 100%; height: 32%; clip-path: polygon(50% 0, 100% 100%, 0 100%); background: linear-gradient(180deg, color-mix(in srgb, var(--c) 55%, #000), color-mix(in srgb, var(--c) 75%, #000)); margin-bottom: -1px; }
.bld.st4 .walls i { background: #ffd36b; box-shadow: 0 0 8px rgba(255, 211, 107, 0.8); }
.bld .flag { position: absolute; top: -4%; left: 52%; width: 2px; height: 24%; background: #ddd; }
.bld .flag::after { content: ""; position: absolute; left: 2px; top: 0; width: 12px; height: 8px; background: var(--accent2); clip-path: polygon(0 0, 100% 50%, 0 100%); }
.bld .plot { width: 100%; height: 22%; border: 2px dashed var(--ghost); border-radius: 4px; }
.bld .stake { position: absolute; top: 18%; font-size: 20px; }
.bld.big .stake { font-size: 34px; }
.bld.fresh .stake { animation: bob 1.4s ease-in-out infinite; }
@keyframes bob { 50% { translate: 0 -4px; } }
.bld .fence { width: 100%; height: 30%; background: repeating-linear-gradient(90deg, var(--ghost) 0 3px, transparent 3px 9px); border-top: 2px solid var(--ghost); }
.bld .lock { position: absolute; top: 22%; font-size: 15px; opacity: 0.6; }
.bld.weathered { filter: saturate(0.25) brightness(0.75); }
.bld.weathered::after { content: "🔧"; position: absolute; top: -6px; right: -4px; font-size: 15px; filter: none; }

/* Skill sheet */
.ss-top { display: flex; align-items: center; gap: 18px; margin: 6px 0 16px; }
.ss-district { font-size: 12px; font-weight: 750; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.ss-stage { font-size: 22px; font-weight: 850; margin: 2px 0; }
.ss-next { font-size: 13.5px; color: var(--muted); line-height: 1.35; }
.ss-locked { color: var(--muted); font-size: 14px; line-height: 1.45; }
.skill-sheet .bp { margin-top: 14px; }

/* Blueprint cards */
.bp {
  position: relative; padding: 14px 16px 14px; border-radius: 18px; text-align: left;
  background-color: var(--bp);
  background-image: linear-gradient(var(--bp-grid) 1px, transparent 1px), linear-gradient(90deg, var(--bp-grid) 1px, transparent 1px);
  background-size: 16px 16px;
  box-shadow: inset 0 0 0 1px var(--bp-line);
}
.bp.big { padding: 20px; }
.bp-head { display: flex; justify-content: space-between; align-items: center; }
.bp-district { font-size: 11px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--bp-muted); }
.bp-name { font-size: 20px; font-weight: 850; margin: 4px 0 6px; color: var(--bp-text); }
.bp.big .bp-name { font-size: 26px; }
.bp-line { font-size: 15px; line-height: 1.4; color: var(--bp-soft); }
.bp-test { margin-top: 10px; padding: 8px 10px; border-radius: 10px; background: var(--bp-chip); font-size: 14px; line-height: 1.35; color: var(--bp-text); }
.bp-test span { display: inline-block; margin-right: 8px; padding: 1px 6px; border-radius: 5px; background: var(--accent2); color: var(--accent2-text); font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; vertical-align: 1px; }
.bp-ex { margin-top: 10px; display: flex; flex-direction: column; }
.bp-ex b { font-size: 16px; color: var(--bp-text); }
.bp-ex small { font-size: 13px; color: var(--bp-muted); }
.bp-stage { position: absolute; right: 14px; bottom: 12px; font-size: 11px; font-weight: 750; color: var(--bp-muted); }
.bp-list { display: grid; gap: 10px; margin: 0 16px; }
.acc { padding: 2px 7px; border-radius: 8px; font-size: 11px; font-weight: 800; }
.acc.hi { background: color-mix(in srgb, var(--good) 15%, transparent); color: var(--good); }
.acc.mid { background: color-mix(in srgb, var(--accent2) 15%, transparent); color: var(--accent2); }
.acc.lo { background: color-mix(in srgb, var(--bad) 15%, transparent); color: var(--bad); }
.bp-mini { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; padding: 10px 12px; border-radius: 12px; background: var(--bp); color: var(--bp-soft); font-size: 14px; line-height: 1.35; box-shadow: inset 3px 0 0 var(--bp-muted); }
.bp-mini b { color: var(--bp-text); }
.bp-mini .link-btn { flex: none; color: var(--bp-muted); }
.fb-why { margin: 4px 0 2px; }
.brick.given { background: var(--chip); color: var(--chip-text); font-style: normal; }

/* Intro steps */
.intro { padding-top: 8px; }
.intro-title { font-size: 26px; font-weight: 900; letter-spacing: -0.02em; margin: 6px 0 4px; }
.notice-line { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0; }
.ntok { padding: 10px 12px; border-radius: 12px; font-size: 19px; font-weight: 700; background: var(--surface2); box-shadow: inset 0 0 0 1px var(--line); transition: background 0.2s, scale 0.3s var(--spring); }
.ntok.en { color: var(--muted); font-style: italic; }
.ntok.hint { box-shadow: inset 0 0 0 2px var(--accent2); animation: bob 1s ease-in-out infinite; }
.ntok.hit { background: var(--accent2); color: var(--accent2-text); scale: 1.08; font-style: normal; }
.intro-reveal { font-size: 16px; margin: 4px 0 14px; color: var(--text); }
.intro-after { margin-top: 16px; }
.bp-drop { margin-top: 14px; }
.sort .b-meta { margin: 6px 0 4px; }
.sort-after { margin-top: 14px; display: grid; gap: 10px; justify-items: center; }
.sort-after .bp-mini, .sort-after .btn { width: 100%; }
.foundation { text-align: center; padding-top: 40px; display: flex; flex-direction: column; align-items: center; }
.fd-bld { margin-bottom: 18px; }
.fd-bld .bld.big { width: 130px; height: 130px; }
.fd-title { font-size: 30px; font-weight: 900; letter-spacing: -0.02em; }
.fd-sub { color: var(--muted); font-size: 15px; line-height: 1.45; margin: 8px 12px 14px; }
.foundation .btn { width: 100%; }

/* Level-up modal */
.lvl-big { font-size: 72px; font-weight: 900; color: var(--accent2); line-height: 1; margin: 6px 0 12px; }
.unlock-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-top: 8px; border-radius: 12px; background: var(--surface3); text-align: left; }
.unlock-row span { font-size: 22px; }
.unlock-row b { flex: 1; }
.unlock-row small { color: var(--accent2); font-weight: 700; }
/* Unbuilt parts show as a faint outline of what's coming */
.bld .ghost { background: none !important; box-shadow: none !important; outline: 1.5px dashed var(--ghost); outline-offset: -1.5px; }
.bld .roof.ghost { clip-path: none; outline: none; height: 0; border-left: 29px solid transparent; border-right: 29px solid transparent; border-bottom: 18px solid var(--ghost-fill); width: 0; }
.bld.big .roof.ghost { border-left-width: 48px; border-right-width: 48px; border-bottom-width: 30px; }
.fd-bld .bld.big .roof.ghost { border-left-width: 65px; border-right-width: 65px; border-bottom-width: 40px; }
.bld .walls.ghost i { background: var(--ghost-fill); box-shadow: none; }
.install-hint { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 16px 12px; padding: 10px 12px 10px 14px; border-radius: 14px; background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent2); font-size: 13px; }
.install-hint button { width: 28px; height: 28px; border-radius: 14px; color: var(--muted); flex: none; }

/* ---------- Screen experiments for the iOS Home Screen bottom strip ---------- */
/* Stretch fix: stop using a fixed-position body (iOS clips fixed layers to the
   short viewport) and size the page to the real screen height instead. */
html.tall-fix { height: var(--screen-h); overflow: hidden; }
html.tall-fix body { position: relative; inset: auto; height: var(--screen-h); overflow: hidden; }

/* ---------- Intro lesson cards ---------- */
.lesson { display: flex; flex-direction: column; min-height: 100%; padding-top: 6px; }
.ls-top { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.ls-top b { font-size: 14px; }
.ls-dots { margin-left: auto; display: flex; gap: 4px; }
.ls-dots i { width: 7px; height: 7px; border-radius: 4px; background: var(--surface3); transition: width 0.3s var(--spring); }
.ls-dots i.done { background: var(--dc); }
.ls-dots i.on { width: 18px; background: var(--accent2); }
.ls-hook { margin-top: 14px; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--dc) 18%, transparent); color: var(--text); font-size: 14px; font-weight: 650; line-height: 1.4; }
.ls-card { margin-top: 16px; }
.ls-card h2 { margin: 0 0 8px; font-size: 25px; font-weight: 900; letter-spacing: -0.02em; line-height: 1.15; }
.ls-card p { margin: 0 0 14px; font-size: 16.5px; line-height: 1.5; color: var(--text-soft); }
.ls-kicker { font-size: 12px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent2); margin-bottom: 6px; }
.ls-ex { padding: 11px 13px; border-radius: 13px; background: var(--surface2); margin-bottom: 8px; box-shadow: inset 3px 0 0 var(--dc); }
.ls-ex .es { font-size: 18px; font-weight: 700; line-height: 1.35; }
.ls-ex .en { font-size: 13.5px; color: var(--muted); margin-top: 2px; }
.ls-card mark, .ls-answer mark, .ls-gap mark { background: color-mix(in srgb, var(--accent2) 20%, transparent); color: var(--accent2); padding: 0 3px; border-radius: 5px; }
.ls-en { font-size: 24px; font-weight: 750; line-height: 1.3; margin: 4px 0 16px; }
.ls-en.small { font-size: 14px; color: var(--muted); font-weight: 600; margin: 8px 0 0; }
.ls-answer { font-size: 24px; font-weight: 800; line-height: 1.35; padding: 14px 16px; border-radius: 16px; background: linear-gradient(180deg, var(--surface2), var(--surface2)); box-shadow: inset 0 0 0 1px var(--line); }
.ls-note { margin-top: 10px; font-size: 15px; line-height: 1.45; color: var(--text-soft); }
.ls-rows { display: grid; gap: 10px; }
.ls-row { display: grid; gap: 6px; }
.ls-label { justify-self: start; padding: 3px 9px; border-radius: 8px; background: var(--surface3); font-size: 12.5px; font-weight: 800; }
.ls-row .ls-ex { margin: 0; }
.ls-gap { font-size: 22px; font-weight: 750; line-height: 1.4; padding: 14px 16px; border-radius: 16px; background: var(--surface2); }
.ls-gap .blank { display: inline-block; min-width: 50px; padding: 0 8px; text-align: center; border-radius: 8px; border: 2px dashed color-mix(in srgb, var(--accent2) 50%, transparent); color: var(--accent2); }
.ls-gap .blank.filled { border-style: solid; border-color: transparent; background: var(--good); color: var(--good-text); }
.ls-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 10px; margin-top: 16px; }
.ls-opt { height: 56px; border-radius: 16px; background: var(--tile); color: var(--tile-text); font-size: 19px; font-weight: 800; box-shadow: 0 4px 0 var(--tile-edge); }
.ls-opt.right { background: var(--good); color: var(--good-text); box-shadow: 0 4px 0 color-mix(in srgb, var(--good) 70%, #000); }
.ls-opt.wrong { background: var(--bad); color: #fff; box-shadow: 0 4px 0 color-mix(in srgb, var(--bad) 70%, #000); }
.ls-explain { margin-top: 14px; }
.ls-explain .good { color: var(--good); font-weight: 850; font-size: 17px; }
.ls-explain .bad { color: var(--bad); font-weight: 850; font-size: 17px; }
.ls-explain p { margin: 4px 0 0; font-size: 15.5px; }
.ls-actions { margin-top: auto; padding-top: 18px; }
.ls-reveal-btn { background: var(--surface3); }

/* ---------- Palette-dependent depth ---------- */
:root { --lift: 0 16px 40px rgba(0, 0, 0, 0.45); }
html[data-scheme="light"] { --lift: 0 12px 30px rgba(0, 0, 0, 0.12); }
html[data-scheme="light"] .sheet { box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.12); }
.player, .card, .mode, .district, .day-card, .ls-ex, .b-sentence { box-shadow: var(--card-shadow); }
.district { box-shadow: var(--card-shadow), inset 0 0 0 1px var(--line); }
/* Text set in palette's serif/sans font everywhere, including buttons */
button, input { font-family: var(--font); }
/* Theme picker */
.theme-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.theme-opt { position: relative; padding: 10px; border-radius: 16px; text-align: left; background: var(--tb); color: var(--tt); box-shadow: inset 0 0 0 1px rgba(127,127,127,.25); }
.theme-opt.on { box-shadow: inset 0 0 0 2.5px var(--accent2), 0 4px 14px rgba(0,0,0,.15); }
.theme-opt b { display: block; font-size: 14px; }
.theme-opt small { display: block; font-size: 11px; opacity: .7; margin-top: 1px; }
.theme-opt .sw { display: flex; gap: 4px; margin-top: 8px; }
.theme-opt .sw i { flex: 1; height: 16px; border-radius: 5px; }
.theme-opt .check { position: absolute; top: 8px; right: 10px; font-size: 13px; }

/* ---------- Markdown in teaching text ---------- */
.md p { margin: 0 0 10px; }
.md p:last-child, .md ul:last-child, .md ol:last-child { margin-bottom: 0; }
.md ul, .md ol { margin: 4px 0 12px; padding-left: 20px; }
.md li { margin: 4px 0; line-height: 1.45; }
.md li::marker { color: var(--accent2); font-weight: 800; }
.md strong { font-weight: 800; color: var(--text); }
.md em { font-style: italic; }
.md mark, .ls-hook mark { background: color-mix(in srgb, var(--accent2) 28%, transparent); color: inherit; padding: 0 3px; border-radius: 4px; }
code.es { font-family: var(--font); font-size: 0.95em; font-weight: 800; padding: 1px 6px; border-radius: 6px; background: color-mix(in srgb, var(--accent2) 20%, transparent); color: var(--text); white-space: nowrap; }
.bp code.es, .bp-mini code.es { background: var(--bp-chip); color: var(--bp-text); }
.md .callout { margin: 10px 0; padding: 9px 12px; border-radius: 12px; background: var(--surface2); border-left: 4px solid var(--accent2); font-size: 0.95em; line-height: 1.45; }
.ls-card .md { font-size: 16.5px; line-height: 1.5; color: var(--text-soft); margin-bottom: 14px; }
.ls-note .md, .ls-explain .md { font-size: 15.5px; color: var(--text-soft); }

/* ---------- Backup ---------- */
.backup-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.save-box { width: 100%; height: 130px; margin-top: 14px; padding: 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: 11px/1.4 ui-monospace, Menlo, monospace; resize: none; -webkit-user-select: text; user-select: text; }
.file-pick { display: block; margin-top: 10px; padding: 10px; border-radius: 12px; border: 1.5px dashed var(--ghost); color: var(--muted); font-size: 14px; font-weight: 650; text-align: center; }
.save-status { min-height: 18px; margin-top: 8px; font-size: 13px; font-weight: 650; color: var(--accent); }

/* ---------- Behind the status bar ----------
   The app draws under the iOS status bar (black-translucent), whose text is
   always white. --statusbar is the palette's band color for that strip. */
:root { --statusbar: var(--accent); }
.topbar::before, .stage-top::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: var(--sat);
  background: var(--statusbar); pointer-events: none;
}
.stage-top { position: relative; }

/* ---------- Sound picker ---------- */
.vol-row { gap: 10px; }
.vol-row input[type="range"] { flex: 1; accent-color: var(--accent); }
.packs { display: grid; gap: 8px; margin-top: 6px; }
.pack { display: flex; align-items: center; gap: 6px; padding: 8px 8px 8px 12px; border-radius: 14px; background: var(--surface2); box-shadow: inset 0 0 0 1px var(--line); }
.pack.on { box-shadow: inset 0 0 0 2px var(--accent); }
.pack-main { flex: 1; min-width: 0; text-align: left; }
.pack-main b { display: block; font-size: 15px; }
.pack-main small { display: block; font-size: 12px; color: var(--muted); line-height: 1.3; }
.pack-play { flex: none; width: 58px; height: 40px; border-radius: 12px; background: var(--surface); font-size: 12px; font-weight: 800; color: var(--accent); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; }
.pack-play span { font-size: 10px; color: var(--muted); font-weight: 700; }
.tap-hint { text-align: center; font-size: 13px; font-weight: 650; color: var(--muted); margin-bottom: 8px; animation: hintPulse 1.6s ease-in-out infinite; }
@keyframes hintPulse { 50% { opacity: 0.45; } }
.b-actions:has(.tap-hint) { flex-direction: column; }
.md .ln { display: block; }
.md .ln + .ln { margin-top: 6px; }
.md li { padding-left: 2px; }

/* ---------- Dev lens: syntax colors (editor-style) ---------- */
:root { --syn-verb: #c792ea; --syn-obj: #82aaff; --syn-subj: #89ddff; --syn-det: #c3e88d; --syn-op: #ffcb6b; --syn-neg: #ff6b81; --syn-adv: #f78c6c; --syn-q: #f07178; }
html[data-scheme="light"] { --syn-verb: #7c3aed; --syn-obj: #2563eb; --syn-subj: #0e7490; --syn-det: #15803d; --syn-op: #b45309; --syn-neg: #dc2626; --syn-adv: #c2410c; --syn-q: #be185d; }
.syn { font-weight: 800; }
.syn-verb { color: var(--syn-verb); } .syn-obj { color: var(--syn-obj); } .syn-subj { color: var(--syn-subj); } .syn-det { color: var(--syn-det); }
.syn-op { color: var(--syn-op); } .syn-neg { color: var(--syn-neg); } .syn-adv { color: var(--syn-adv); } .syn-q { color: var(--syn-q); }
mark .syn { color: inherit; }
.ls-card mark .syn, .ls-answer mark .syn { color: var(--accent2); }
.syn-block { margin: 8px 0 6px; padding: 10px 12px; border-radius: 12px; background: var(--surface2); }
.syn-line { font-size: 18px; font-weight: 700; line-height: 1.4; }
.syn-legend { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 6px; font-size: 11.5px; }
.syn-legend .syn { font-weight: 750; }
.syn-legend .syn::before { content: "●"; margin-right: 3px; }
.row-sub { display: block; font-size: 12px; color: var(--muted); font-weight: 500; }

/* Dev lens note on blueprint cards */
.dev-lens { margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: rgba(0, 0, 0, 0.18); }
.dl-tag { font: 800 11px/1 ui-monospace, Menlo, monospace; letter-spacing: .04em; opacity: .8; margin-bottom: 6px; }
.dev-lens .md { font-size: 14px; line-height: 1.45; }
.dev-lens .md strong { color: inherit; }
.dl-code { margin: 8px 0 0; padding: 9px 11px; border-radius: 10px; background: #1b1d2a; color: #d6deeb; font: 12px/1.5 ui-monospace, "SF Mono", Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- Word hints under nouns ---------- */
.noun { display: inline-flex; flex-direction: column; align-items: center; line-height: 1.1; cursor: pointer; }
.noun .gloss { font-size: 10px; font-weight: 700; font-style: normal; color: var(--muted); margin-top: 2px; white-space: nowrap; letter-spacing: 0; }
.brick.has-noun { padding-top: 5px; padding-bottom: 4px; }
.sc-es .noun { vertical-align: top; }
.sc-es .noun .gloss { font-size: 10.5px; }

/* ---------- Construction site (Play) ---------- */
.b-site { margin-top: 16px; }
.site { border-radius: 18px; padding: 10px 12px 10px; background: linear-gradient(180deg, color-mix(in srgb, var(--c) 10%, var(--surface)), var(--surface)); box-shadow: var(--card-shadow), inset 0 0 0 1px var(--line); }
.site-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 13px; }
.site-head b { font-size: 14px; }
.site-part { color: var(--muted); font-weight: 700; font-variant-numeric: tabular-nums; }
.site-scene { position: relative; height: 150px; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.site-ground { width: 100%; height: 5px; border-radius: 3px; background: color-mix(in srgb, var(--text) 12%, transparent); }
.sb { display: flex; flex-direction: column; align-items: center; margin-bottom: 1px; }
.sb i { display: block; }
/* roof: four bands clipped to a triangle */
.sb-roof { width: 176px; height: 48px; display: grid; grid-template-rows: repeat(4, 1fr); gap: 2px; clip-path: polygon(50% 0, 100% 100%, 0 100%); margin-bottom: -1px; }
.sb-roof i { background: color-mix(in srgb, var(--ghost) 50%, transparent); }
.sb-roof i.on { background: color-mix(in srgb, var(--c) 55%, #000); }
/* walls: staggered brick grid */
.sb-walls { position: relative; width: 150px; display: grid; grid-template-columns: repeat(6, 1fr); gap: 2px; padding: 2px; }
.sb-walls > i { height: 11px; border-radius: 2px; outline: 1px dashed var(--ghost); outline-offset: -1px; }
.sb-walls > i:nth-child(12n+7), .sb-walls > i:nth-child(12n+8), .sb-walls > i:nth-child(12n+9), .sb-walls > i:nth-child(12n+10), .sb-walls > i:nth-child(12n+11), .sb-walls > i:nth-child(12n+12) { translate: 6px 0; }
.sb-walls > i.on { outline: none; background: var(--c); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.18); }
/* windows appear once the walls are done; panes light up in the last stage */
/* Cracked bricks: memory fading. 1 hairline, 2 cracked, 3 crumbling. */
.sb-walls > i { position: relative; }
.sb-walls > i.on.ck1::after, .sb-walls > i.on.ck2::after, .sb-walls > i.on.ck3::after {
  content: ""; position: absolute; inset: 0; background: var(--crack-img) center / 100% 100% no-repeat; pointer-events: none;
}
.sb-walls > i.on.ck1 { --crack-img: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 12'%3E%3Cpath d='M9 0 L12 4 L10 7 L14 12' fill='none' stroke='%23000' stroke-opacity='.5' stroke-width='1.1'/%3E%3C/svg%3E"); }
.sb-walls > i.on.ck2 { background: color-mix(in srgb, var(--c) 70%, #6b5a4a); --crack-img: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 12'%3E%3Cpath d='M6 0 L10 4 L8 7 L12 12 M10 4 L16 6 L19 3' fill='none' stroke='%23000' stroke-opacity='.65' stroke-width='1.3'/%3E%3C/svg%3E"); }
.sb-walls > i.on.ck3 { background: color-mix(in srgb, var(--c) 45%, #6b5a4a); clip-path: polygon(0 0, 78% 0, 100% 35%, 100% 100%, 18% 100%, 0 70%); --crack-img: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 12'%3E%3Cpath d='M4 0 L9 4 L7 8 L11 12 M9 4 L15 5 L17 9 L22 8 M15 5 L18 1' fill='none' stroke='%23000' stroke-opacity='.75' stroke-width='1.4'/%3E%3C/svg%3E"); }
.sb-walls > i.sealing { z-index: 2; box-shadow: 0 0 10px var(--accent2) !important; }
.sb-win { position: absolute; top: 14px; width: 30px; height: 24px; display: grid; grid-template-columns: 1fr 1fr; gap: 2px; padding: 2px; border-radius: 3px; background: var(--window); opacity: 0; transition: opacity 0.4s; }
.sb-win.l { left: 20px; } .sb-win.r { right: 20px; }
.walls-done .sb-win { opacity: 1; }
.sb-win i { border-radius: 1px; background: color-mix(in srgb, var(--window) 80%, #fff); }
.sb-win i.on { background: #ffd36b; box-shadow: 0 0 8px rgba(255, 211, 107, 0.9); }
/* foundation */
.sb-base { width: 170px; display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; }
.sb-base i { height: 8px; border-radius: 2px; outline: 1px dashed var(--ghost); outline-offset: -1px; }
.sb-base i.on { outline: none; background: var(--base); }
.site.done .sb-roof { filter: drop-shadow(0 0 6px rgba(255, 211, 107, 0.6)); }
.site-note { min-height: 14px; margin-top: 4px; font-size: 11.5px; color: var(--muted); text-align: center; }
.site-up { position: absolute; left: 50%; top: 8px; padding: 4px 12px; border-radius: 12px; background: var(--accent2); color: var(--accent2-text); font-weight: 850; font-size: 14px; white-space: nowrap; pointer-events: none; }

/* ================= Cracks on town buildings ================= */
.bld .walls { position: relative; }
.bld.ck1 .walls::after, .bld.ck2 .walls::after, .bld.ck3 .walls::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 30' preserveAspectRatio='none'%3E%3Cpath d='M12 0 L16 8 L13 13 L18 21 L15 30' fill='none' stroke='%23000' stroke-opacity='.5' stroke-width='1.2'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
}
.bld.ck2 .walls::after { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 30' preserveAspectRatio='none'%3E%3Cpath d='M12 0 L16 8 L13 13 L18 21 L15 30 M16 8 L24 10 L28 6 M30 30 L29 22 L33 18' fill='none' stroke='%23000' stroke-opacity='.6' stroke-width='1.4'/%3E%3C/svg%3E"); }
.bld.ck3 .walls::after { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 30' preserveAspectRatio='none'%3E%3Cpath d='M10 0 L15 8 L11 14 L17 22 L13 30 M15 8 L25 10 L29 4 M31 30 L29 21 L35 16 L40 18 M25 10 L27 17' fill='none' stroke='%23000' stroke-opacity='.7' stroke-width='1.6'/%3E%3C/svg%3E"); }
.bld.ck2 .walls, .bld.ck2 .roof { filter: saturate(0.6); }
.bld.ck3 .walls, .bld.ck3 .roof { filter: saturate(0.35) brightness(0.85); }
.bld.ck3 .roof { rotate: -3deg; }
.bld.ck2::after, .bld.ck3::after { content: "🔧"; position: absolute; top: -6px; right: -6px; font-size: 14px; }
.bld.big.ck2::after, .bld.big.ck3::after { font-size: 20px; }

/* ================= Condition (building / district) ================= */
.cond { margin: 12px 0; padding: 12px; border-radius: 14px; background: var(--surface2); }
.cond-head { display: flex; justify-content: space-between; font-size: 13.5px; margin-bottom: 8px; }
.cond-head span { color: var(--muted); font-weight: 700; font-variant-numeric: tabular-nums; }
.cond-bar { display: flex; height: 10px; gap: 2px; border-radius: 6px; overflow: hidden; background: var(--track); }
.cond-bar i { display: block; min-width: 4px; }
.cond-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.cond-legend span { display: inline-flex; align-items: center; gap: 5px; }
.cond-legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.cond-note { margin-top: 8px; font-size: 12px; color: var(--muted); }

/* ================= City view ================= */
.town-seg { margin: 18px 16px 0; }
.town-seg + .districts { margin-top: 14px; }
.districts > .card { margin: 0; }
.districts > .repair-all { margin-top: -4px; }
.districts > .ch-cap { margin-top: -10px; }
.city-health { display: flex; align-items: center; gap: 14px; padding: 14px; }
.ch-ring { --p: 0; flex: none; width: 74px; height: 74px; border-radius: 50%; display: grid; place-content: center; text-align: center;
  background: radial-gradient(closest-side, var(--surface) 76%, transparent 78%), conic-gradient(var(--good) calc(var(--p) * 1%), var(--track) 0); }
.ch-ring b { font-size: 18px; line-height: 1; font-variant-numeric: tabular-nums; }
.ch-ring small { font-size: 9.5px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.ch-mid { min-width: 0; }
.ch-title { font-weight: 850; font-size: 16px; margin-bottom: 3px; }
.ch-sub { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.repair-all:disabled { opacity: 0.55; }
.ch-cap { margin-top: 6px; font-size: 11.5px; color: var(--muted); text-align: center; }
.city-map {
  padding: 12px; border-radius: 22px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px;
  background: color-mix(in srgb, var(--text) 13%, var(--bg));
}
.cb { position: relative; text-align: left; padding: 9px 9px 10px; border-radius: 14px; min-height: 92px; display: flex; flex-direction: column; gap: 6px;
  background: color-mix(in srgb, var(--c) 14%, var(--surface)); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--c) 30%, transparent), 0 2px 0 rgba(0, 0, 0, 0.15); }
.cb.closed { filter: saturate(0.3); opacity: 0.7; }
.cb-head { display: flex; justify-content: space-between; align-items: baseline; gap: 4px; font-size: 12.5px; }
.cb-head b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cb-hp, .cb-n { flex: none; font-size: 11px; font-weight: 800; padding: 1px 6px; border-radius: 8px; background: var(--surface); color: var(--muted); font-variant-numeric: tabular-nums; }
.cb-hp.k0 { color: var(--good); } .cb-hp.k1 { color: #C99A2A; } .cb-hp.k2 { color: #E07B39; } .cb-hp.k3 { color: var(--bad); }
.cb-lots { display: flex; flex-wrap: wrap; gap: 3px 4px; align-items: flex-end; }
.cb-lock { position: absolute; right: 8px; bottom: 6px; font-size: 13px; opacity: 0.7; }
.cb-sub { font-size: 11px; color: var(--muted); line-height: 1.35; }
.cb.venue { grid-column: span 2; min-height: 0; }
.cb.future { min-height: 70px; background: transparent; box-shadow: none; outline: 2px dashed color-mix(in srgb, var(--text) 25%, transparent); outline-offset: -2px; opacity: 0.75; }
.city-label { grid-column: span 2; font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: color-mix(in srgb, var(--text) 60%, transparent); padding: 4px 2px 0; }

/* Mini building: s-1 locked · s0 plot · s1 foundation · s2 walls · s3 roof · s4 lit. k = crack level. */
.mb { width: 15px; height: 18px; display: inline-flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.mb .mr { width: 15px; height: 6px; clip-path: polygon(50% 0, 100% 100%, 0 100%); background: color-mix(in srgb, var(--c) 55%, #000); margin-bottom: -0.5px; visibility: hidden; }
.mb .mw { position: relative; width: 12px; height: 10px; border-radius: 1.5px; background: var(--c); }
.mb.s3 .mr, .mb.s4 .mr { visibility: visible; }
.mb.s4 .mw::before { content: ""; position: absolute; left: 4px; top: 3px; width: 4px; height: 4px; border-radius: 1px; background: #ffd36b; box-shadow: 0 0 4px #ffd36b; }
.mb.s1 .mw { height: 3px; background: var(--base); }
.mb.s0 .mw { height: 7px; background: none; outline: 1.5px dashed var(--ghost); outline-offset: -1.5px; }
.mb.s-1 .mw { height: 3px; width: 10px; background: var(--ghost-fill); }
.mb.k1 .mw::after, .mb.k2 .mw::after, .mb.k3 .mw::after { content: ""; position: absolute; inset: 0; background: linear-gradient(115deg, transparent 44%, rgba(0, 0, 0, 0.55) 45% 52%, transparent 53%); }
.mb.k2 { filter: saturate(0.55); }
.mb.k3 { filter: saturate(0.3) brightness(0.85); rotate: -6deg; }

.district-sheet .ds-blurb { margin: 0 0 4px; color: var(--muted); font-size: 14px; }
.ds-list { display: flex; flex-direction: column; gap: 2px; margin-top: 12px; }
.ds-row { display: flex; align-items: center; gap: 10px; padding: 9px 6px; border-radius: 10px; text-align: left; }
.ds-row .mb { transform: scale(1.35); margin: 0 4px; }
.ds-name { flex: 1; font-weight: 700; font-size: 14.5px; }
.ds-state { font-size: 12.5px; color: var(--muted); }

/* ================= Venue sheet ================= */
.vs-hero { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 18px; margin-bottom: 12px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--c) 30%, var(--surface)), color-mix(in srgb, var(--c) 8%, var(--surface))); }
.vs-emoji { font-size: 44px; line-height: 1; }
.vs-name { font-size: 20px; font-weight: 850; }
.vs-blurb { font-size: 13.5px; color: var(--muted); }
.vs-p { font-size: 14px; line-height: 1.45; margin: 4px 0 12px; }
.vs-small { font-size: 12.5px; color: var(--muted); margin: 8px 0; text-align: center; }
.vs-need { display: grid; grid-template-columns: 1fr auto; gap: 6px; padding: 10px 12px; border-radius: 12px; background: var(--surface2); margin-bottom: 8px; font-size: 14px; }
.vs-need span { color: var(--muted); font-size: 13px; }
.vs-need .xpbar { grid-column: span 2; }
.vs-lots { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-bottom: 10px; }
.vs-lot { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px; border-radius: 12px; background: var(--surface2); font-size: 12px; font-weight: 700; }
.vs-lot .mb { transform: scale(1.6); margin: 6px 0 4px; }
.vs-cond { font-size: 13px; color: var(--muted); text-align: center; margin-bottom: 10px; }
.vs-h { font-size: 15px; margin: 18px 0 8px; }
.vs-scenes { display: flex; flex-direction: column; gap: 8px; }
.vs-scene { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; background: var(--surface2); text-align: left; }
.vs-scene.locked { opacity: 0.55; }
.vs-who { font-size: 28px; }
.vs-st { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.vs-st b { font-size: 14.5px; }
.vs-st small { font-size: 12px; color: var(--muted); }
.vs-stars { color: var(--accent2); font-size: 14px; letter-spacing: 1px; white-space: nowrap; }

/* ================= Role-play ================= */
.rp { display: flex; flex-direction: column; gap: 12px; padding-bottom: 20px; }
.rp-head { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 16px; background: var(--surface2); }
.rp-face { font-size: 34px; }
.rp-head b { display: block; font-size: 15px; }
.rp-head small { color: var(--muted); font-size: 12.5px; }
.rp-log { display: flex; flex-direction: column; gap: 8px; }
.bub { position: relative; max-width: 82%; padding: 10px 13px; border-radius: 18px; font-size: 15.5px; line-height: 1.35; }
.bub.npc { align-self: flex-start; background: var(--surface); box-shadow: var(--card-shadow), inset 0 0 0 1px var(--line); border-bottom-left-radius: 6px; padding-right: 38px; }
.bub.me { align-self: flex-end; background: var(--accent); color: var(--accent-text); border-bottom-right-radius: 6px; font-weight: 650; }
.bub-es { font-weight: 650; }
.bub-en { font-size: 13px; color: var(--muted); margin-top: 3px; filter: blur(4px); opacity: 0.6; transition: filter 0.25s, opacity 0.25s; }
.bub.show-en .bub-en { filter: none; opacity: 1; }
.bub-say { position: absolute; right: 6px; top: 6px; width: 28px; height: 28px; border-radius: 50%; font-size: 13px; background: var(--surface2); }
.rp-ask { font-weight: 750; font-size: 15px; margin-top: 6px; }
.rp-opts { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.rp-opt { padding: 13px 14px; border-radius: 14px; background: var(--tile); color: var(--tile-text); box-shadow: 0 3px 0 var(--tile-edge); text-align: left; font-size: 16px; }
.rp-opt.right { background: var(--good); color: var(--good-text); box-shadow: none; }
.rp-opt.wrong { background: var(--bad); color: #fff; box-shadow: none; opacity: 0.8; }
.rp-why { margin-top: 8px; }
.rp-why .fb { padding: 10px 12px; font-size: 14px; }
.rp-build .b-site { display: none; }
.rp-end { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 18px; border-radius: 18px; background: var(--surface2); text-align: center; }
.rp-stars { font-size: 34px; color: var(--accent2); letter-spacing: 4px; }
.rp-end b { font-size: 18px; }
.rp-end small { color: var(--muted); margin-bottom: 8px; }
.chat-form { position: sticky; bottom: 0; display: flex; gap: 8px; padding: 8px 0; background: var(--bg); }
.chat-in { flex: 1; min-width: 0; height: 46px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-size: 16px; }
.chat-form.busy { opacity: 0.6; }
.chat-fb { align-self: stretch; font-size: 13px; color: var(--muted); padding: 6px 10px; border-radius: 10px; background: var(--surface2); }
.typing { display: flex; gap: 4px; padding: 14px 16px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: bob 1s ease-in-out infinite; }
.typing i:nth-child(2) { animation-delay: 0.15s; } .typing i:nth-child(3) { animation-delay: 0.3s; }

/* ================= Casa de la Memoria ================= */
.casa { padding: 4px 0 24px; }
.casa-sub { text-align: center; color: var(--muted); font-size: 13.5px; margin: 0 0 12px; }
.casa-compass, .rv-compass { font-size: 12px; color: var(--muted); text-align: center; line-height: 1.45; margin: 12px 8px 0; }
.casa-actions { display: grid; gap: 10px; margin-top: 14px; }
.casa-actions .btn:disabled { opacity: 0.5; }
.dh { max-width: 360px; margin: 0 auto; }
.dh-roof { position: relative; height: 70px; margin: 0 -10px -1px; clip-path: polygon(50% 0, 100% 100%, 0 100%);
  background: linear-gradient(180deg, color-mix(in srgb, var(--brick) 75%, #000), color-mix(in srgb, var(--brick) 55%, #000)); display: grid; place-items: end center; }
.dh-sign { margin-bottom: 9px; padding: 2px 10px; border-radius: 6px; background: var(--surface); color: var(--text); font-size: 10.5px; font-weight: 800; letter-spacing: 0.04em; }
.dh-floors { display: flex; flex-direction: column; gap: 5px; padding: 5px; background: color-mix(in srgb, var(--brick) 80%, #000); }
.dh-floor { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.dh-room { position: relative; aspect-ratio: 4 / 3; border-radius: 3px; overflow: hidden; text-align: left;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 26%, var(--surface)) 0 74%, color-mix(in srgb, var(--base) 70%, #7a5a3a) 74%); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12), inset 0 10px 14px -10px rgba(0, 0, 0, 0.35); }
.dh-room.empty { background: color-mix(in srgb, var(--brick) 60%, #000); box-shadow: none; }
.dh-room.scaffold { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 6px; text-align: center;
  background: repeating-linear-gradient(45deg, color-mix(in srgb, var(--accent2) 18%, var(--surface2)) 0 8px, var(--surface2) 8px 16px); }
.dh-room.scaffold .mr-name { position: static; }
.dh-room.scaffold small { font-size: 10px; color: var(--muted); }
.sc-crane { font-size: 22px; }
.mr-name { position: absolute; left: 6px; top: 4px; font-size: 10.5px; font-weight: 800; line-height: 1.15; color: var(--text); }
.mr-name small { display: block; font-weight: 600; color: var(--muted); font-size: 9px; }
.mr-prop { position: absolute; right: 6px; bottom: 26%; font-size: 15px; opacity: 0.85; }
.mr-seat { position: absolute; translate: -50% -50%; font-size: 15px; line-height: 1; margin-top: 6px; }
.mr-seat.d1 { filter: grayscale(0.4); } .mr-seat.d2 { filter: grayscale(0.75); opacity: 0.8; } .mr-seat.d3 { filter: grayscale(1); opacity: 0.6; }
.mr-web { position: absolute; right: 3px; top: 2px; font-size: 13px; opacity: 0.8; }
.dh-room.dusty::after { content: ""; position: absolute; inset: 0; background: rgba(140, 130, 115, 0.22); pointer-events: none; }
.dh-ground { position: relative; height: 34px; margin: 0 -14px; border-radius: 0 0 14px 14px; background: linear-gradient(180deg, #5f9a4a, #4a7d39); display: flex; justify-content: center; }
.dh-door { width: 26px; height: 24px; margin-top: -24px; border-radius: 13px 13px 0 0; background: color-mix(in srgb, var(--brick) 40%, #2a1a10); box-shadow: inset -4px 0 0 rgba(0, 0, 0, 0.2); }
.dh-bush { position: absolute; left: 6px; top: -20px; font-size: 26px; }
.dh-bush.r { left: auto; right: 6px; }

/* Room view: a little stage set seen from the front. */
.rv { display: flex; flex-direction: column; gap: 10px; padding-bottom: 20px; }
.rv-top { display: flex; align-items: center; gap: 8px; }
.rv-title { flex: 1; text-align: center; }
.rv-title b { display: block; font-size: 17px; }
.rv-title small { color: var(--muted); font-size: 12.5px; }
.rv-nav { width: 40px; height: 40px; border-radius: 20px; background: var(--surface2); font-size: 24px; line-height: 1; color: var(--text); }
.rv-nav:disabled { opacity: 0.3; }
.rv-stage { touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.rm { position: relative; aspect-ratio: 1 / 1.02; border-radius: 18px; overflow: hidden; background: color-mix(in srgb, var(--c) 40%, #000); }
.rm-back { position: absolute; left: 16%; right: 16%; top: 7%; bottom: 30%; background: color-mix(in srgb, var(--c) 24%, var(--surface)); display: flex; justify-content: center; }
.rm-window { width: 34%; height: 36%; margin-top: 7%; border-radius: 6px 6px 2px 2px; background: linear-gradient(180deg, #9fd3f0, #d8eefa); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 30%, #fff); }
.rm-prop { position: absolute; right: 8%; bottom: 4%; font-size: 30px; opacity: 0.9; }
.rm-wall { position: absolute; top: 0; bottom: 0; width: 16%; }
.rm-wall.l { left: 0; clip-path: polygon(0 0, 100% 7%, 100% 70%, 0 100%); background: color-mix(in srgb, var(--c) 34%, var(--surface2)); filter: brightness(0.86); }
.rm-wall.r { right: 0; clip-path: polygon(0 7%, 100% 0, 100% 100%, 0 70%); background: color-mix(in srgb, var(--c) 34%, var(--surface2)); filter: brightness(0.8); }
.rm-floor { position: absolute; left: 0; right: 0; bottom: 0; height: 30%; clip-path: polygon(16% 0, 84% 0, 100% 100%, 0 100%);
  background: repeating-linear-gradient(90deg, color-mix(in srgb, var(--base) 65%, #7a5a3a) 0 22px, color-mix(in srgb, var(--base) 55%, #6a4a2a) 22px 24px); }
.rm-seat { position: absolute; translate: -50% -50%; display: flex; flex-direction: column; align-items: center; gap: 3px; max-width: 34%; z-index: 1; }
.rs-icon { font-size: 34px; line-height: 1; filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.25)); transition: filter 0.4s; }
.rs-words { padding: 3px 9px; border-radius: 10px; background: var(--surface); color: var(--text); font-weight: 850; font-size: 14px; white-space: nowrap; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18); }
.rs-label, .rs-note { font-size: 10.5px; font-weight: 700; color: #fff; text-align: center; line-height: 1.2; padding: 1px 6px; border-radius: 6px; background: rgba(0, 0, 0, 0.45); }
.rs-note { font-style: italic; font-weight: 600; background: color-mix(in srgb, var(--accent) 80%, #000); }
.rm-seat.hidden .rs-words { background: transparent; color: #fff; outline: 2px dashed rgba(255, 255, 255, 0.7); outline-offset: -2px; box-shadow: none; }
.rm-seat.sel .rs-words { outline: 3px solid var(--accent2); outline-offset: 1px; animation: bob 1s ease-in-out infinite; }
.rm-seat.d1 .rs-icon { filter: grayscale(0.4) drop-shadow(0 3px 3px rgba(0, 0, 0, 0.25)); }
.rm-seat.d2 .rs-icon { filter: grayscale(0.75) brightness(0.9); }
.rm-seat.d3 .rs-icon { filter: grayscale(1) brightness(0.8); opacity: 0.75; }
.rm-seat.d2::after, .rm-seat.d3::after { content: "🕸️"; position: absolute; right: -14px; top: -8px; font-size: 18px; }
.rm-seat.wiping .rs-icon { animation: wipe 0.8s ease-out; }
@keyframes wipe { 0% { filter: grayscale(1) brightness(1.8); scale: 1.4; } 100% { filter: none; scale: 1; } }
.rv-hint { text-align: center; color: var(--muted); font-size: 13px; margin: 2px 0 0; }
.rv-tray { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 10px; }
.rv-opt { padding: 10px 14px; border-radius: 12px; background: var(--tile); color: var(--tile-text); box-shadow: 0 3px 0 var(--tile-edge); font-weight: 800; font-size: 15.5px; }
.rv-opt.used { opacity: 0.3; pointer-events: none; }
.rv-dots { display: flex; justify-content: center; gap: 5px; flex-wrap: wrap; }
.rv-dots i { width: 6px; height: 6px; border-radius: 3px; background: var(--ghost); }
.rv-dots i.on { width: 16px; background: var(--accent); }
.rv-end { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 30px 16px; border-radius: 18px; background: var(--surface2); text-align: center; }
.rv-end-big { font-size: 46px; }
.rv-end b { font-size: 20px; }
.rv-end small { color: var(--muted); margin-bottom: 10px; }
.ei-sub { font-size: 13px; color: var(--muted); margin: 0 0 10px; }
.ei-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.ei-e { aspect-ratio: 1; border-radius: 10px; background: var(--surface2); font-size: 22px; }
.ei-e.on { outline: 3px solid var(--accent); }
.ei-own, .ei-note { width: 100%; margin-top: 8px; height: 42px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-size: 16px; }
.seat-hint { margin-top: 8px; font-size: 13px; color: var(--muted); }
.cb.casa-block { grid-column: span 2; min-height: 0; background: linear-gradient(135deg, color-mix(in srgb, var(--brick) 22%, var(--surface)), var(--surface)); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--brick) 35%, transparent), 0 2px 0 rgba(0, 0, 0, 0.15); }

/* ================= Challenge formats ================= */
.ch-badge { display: inline-block; padding: 1px 7px; border-radius: 8px; background: color-mix(in srgb, var(--accent2) 22%, transparent); color: var(--text); letter-spacing: 0; text-transform: none; }
.ch-ask { margin-top: 10px; font-size: 15px; font-weight: 650; color: var(--muted); }
.ch-op { display: inline-block; padding: 6px 12px; border-radius: 12px; background: var(--accent); color: var(--accent-text); font-size: 17px; font-weight: 800; }
.ch-orig { margin-top: 10px; font-size: 14px; color: var(--muted); }
.ch-step { text-align: center; font-weight: 750; font-size: 14px; color: var(--muted); margin-bottom: 10px; }
.ch-clean:disabled { opacity: 0.6; }
.brick.tap { cursor: pointer; box-shadow: inset 0 -2px 0 color-mix(in srgb, var(--brick) 45%, transparent); transition: background 0.2s; }
.brick.tap.nope { background: color-mix(in srgb, var(--text) 8%, transparent); color: var(--muted); text-decoration: line-through; }
.brick.tap.found { background: color-mix(in srgb, var(--bad) 22%, transparent); outline: 2px solid var(--bad); }
.brick.tap.fixed { background: var(--good); color: var(--good-text); outline: none; }
.brick.tap.bad { background: var(--bad); color: #fff; outline: none; }
.brick.given { background: color-mix(in srgb, var(--good) 16%, transparent); }
.ch-transform .b-sentence { align-items: center; }
.b-sentence .gap { flex: none; min-width: 0; padding: 0; } 
.gap { width: 22px; height: 30px; margin: 0 -2px; border-radius: 8px; color: var(--muted); font-weight: 800; font-size: 14px; background: color-mix(in srgb, var(--accent) 8%, transparent); outline: 1.5px dashed color-mix(in srgb, var(--accent) 40%, transparent); outline-offset: -1.5px; vertical-align: middle; }
.gap.nope { opacity: 0.25; outline-color: var(--bad); }
.gap.placed { width: auto; padding: 0 9px; background: var(--good); color: var(--good-text); outline: none; font-size: 16px; }
.ch-play { display: flex; gap: 10px; justify-content: center; width: 100%; padding: 8px 0; }
.ch-say, .ch-slow { padding: 14px 20px; border-radius: 16px; font-size: 17px; font-weight: 800; background: var(--accent); color: var(--accent-text); box-shadow: var(--accent-shadow); }
.ch-slow { background: var(--surface); color: var(--text); box-shadow: var(--card-shadow), inset 0 0 0 1px var(--line); }
.ch-lines { display: flex; flex-direction: column; gap: 8px; }
.ch-line { padding: 13px 14px; border-radius: 14px; text-align: left; font-size: 16.5px; font-weight: 650; background: var(--surface); box-shadow: var(--card-shadow), inset 0 0 0 1px var(--line); }
.ch-line.right { background: var(--good); color: var(--good-text); }
.ch-line.wrong { background: var(--bad); color: #fff; }
.ch-in { height: 38px; padding: 0 8px; border-radius: 8px; border: 2px solid var(--accent); background: var(--surface); color: var(--text); font-size: 17px; font-weight: 650; text-align: center; min-width: 3.5em; }
.ch-in.right { border-color: var(--good); background: color-mix(in srgb, var(--good) 14%, var(--surface)); }
.ch-in.wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, var(--surface)); text-decoration: line-through; }
.fmt-stats { display: grid; grid-template-columns: auto 1fr auto; gap: 6px 10px; align-items: center; font-size: 13.5px; }
.fmt-stats .xpbar { height: 6px; }
.fb mark { background: color-mix(in srgb, var(--good) 18%, transparent); color: var(--good); padding: 0 4px; border-radius: 5px; font-weight: 750; }

.voice-pick { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; align-items: center; gap: 8px; margin: 8px 0; font-size: 14px; font-weight: 650; }
.voice-pick small { display: block; font-size: 11px; color: var(--muted); font-weight: 600; }
.voice-pick select { min-width: 0; height: 38px; padding: 0 8px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface2); color: var(--text); font: inherit; font-size: 14px; }

/* ================= Next concept ================= */
.next-up { margin: 12px 16px 0; padding: 12px 14px; border-radius: 18px; background: var(--surface); box-shadow: var(--card-shadow), inset 0 0 0 1px var(--line); }
.nu-head { display: flex; align-items: baseline; gap: 8px; }
.nu-head span { font-size: 11px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.nu-head b { font-size: 17px; }
.nu-why { margin: 4px 0 6px; font-size: 13px; color: var(--muted); line-height: 1.4; }
.nu-why small { font-size: 11.5px; }
.nu-row { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) 70px auto; align-items: center; gap: 8px; padding: 7px 0; text-align: left; border-top: 1px solid var(--line); }
.nu-name { font-weight: 750; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nu-meter { height: 7px; border-radius: 4px; background: var(--track); overflow: hidden; }
.nu-meter i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.nu-stat { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.nu-stat b.ok { color: var(--good); } .nu-stat b.low { color: var(--bad); }
.nu-tip { margin-top: 6px; font-size: 11.5px; color: var(--muted); }
.solid-line { margin: 4px 0 12px; padding: 4px 12px 10px; border-radius: 14px; background: var(--surface2); }
.solid-line .nu-row { border-top: none; }
.solid-line small { display: block; font-size: 11.5px; color: var(--muted); }
.solid-line.ok { padding: 10px 12px; font-size: 13.5px; font-weight: 700; color: var(--good); }

/* ================= Play tools: type filter + new concept ================= */
.stage-tools:empty { display: none; }
.stage-tools { flex: none; display: flex; gap: 8px; padding: 0 16px 6px; overflow-x: auto; scrollbar-width: none; }
.tool-chip { flex: none; padding: 6px 12px; border-radius: 14px; font-size: 13px; font-weight: 750; background: var(--surface2); color: var(--text); white-space: nowrap; max-width: 70vw; overflow: hidden; text-overflow: ellipsis; }
.tool-chip.ready { background: color-mix(in srgb, var(--accent2) 30%, var(--surface2)); }
.nu-early { margin-top: 10px; }

/* ================= New topic or keep reviewing? ================= */
.ask-new { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 8vh; padding: 24px 18px; border-radius: 22px; text-align: center; background: var(--surface); box-shadow: var(--card-shadow), inset 0 0 0 1px var(--line); }
.an-icon { font-size: 44px; }
.an-kicker { font-size: 11.5px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.ask-new h2 { margin: 0; font-size: 26px; letter-spacing: -0.01em; }
.an-hook { margin: 0 0 8px; color: var(--muted); font-size: 15px; line-height: 1.45; }
.an-note { margin: 4px 0 0; font-size: 12px; color: var(--muted); line-height: 1.4; }

/* City blocks: memory is its own labeled line, separate from "built" */
.cb-mem { position: relative; height: 15px; border-radius: 8px; overflow: hidden; background: color-mix(in srgb, var(--text) 8%, transparent); }
.cb-mem i { position: absolute; inset: 0 auto 0 0; background: color-mix(in srgb, var(--good) 35%, transparent); }
.cb-mem.k1 i { background: color-mix(in srgb, #E0B341 45%, transparent); } .cb-mem.k2 i { background: color-mix(in srgb, #E07B39 45%, transparent); } .cb-mem.k3 i { background: color-mix(in srgb, var(--bad) 40%, transparent); }
.cb-mem span { position: relative; display: block; padding: 0 6px; font-size: 9.5px; font-weight: 800; line-height: 15px; color: var(--text); opacity: 0.8; }

/* ================= Today's wall ================= */
.twall { border-radius: 18px; padding: 10px 12px 12px; background: linear-gradient(180deg, color-mix(in srgb, var(--accent2) 8%, var(--surface)), var(--surface)); box-shadow: var(--card-shadow), inset 0 0 0 1px var(--line); }
.tw-head { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 8px; }
.tw-head b { font-size: 14px; }
.tw-count { font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.tw-house { margin-left: auto; display: flex; align-items: flex-end; gap: 5px; }
.tw-house small { font-size: 11px; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.tw-body { min-height: 40px; max-height: 128px; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; }
.wall-rows { --cols: 12; display: flex; flex-direction: column-reverse; gap: 2px; }
.wr { display: grid; grid-template-columns: repeat(var(--cols), 1fr); gap: 2px; }
.wr.odd { translate: calc(50% / var(--cols)) 0; } /* running bond; the overhang is clipped like a real wall's half brick */
.twall .tw-body, .wall-snap { overflow: hidden; }
.wb { display: block; aspect-ratio: 2.2 / 1; border-radius: 2px; background: var(--c); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.18); }
.wb.gold { background: linear-gradient(135deg, #f7d774, #d9a531 60%, #f7d774); box-shadow: inset 0 -2px 0 rgba(120, 80, 0, 0.35), 0 0 6px rgba(240, 190, 60, 0.6); }
.wb.corner { background: var(--c); outline: 2px solid var(--accent2); outline-offset: -2px; }
.wall-snap { margin: 10px auto; max-width: 280px; padding: 8px; border-radius: 12px; background: var(--surface2); }

/* Daily house (mini) */
.dh-mini { position: relative; width: 22px; height: 24px; display: inline-flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.dh-mini .r { width: 22px; height: 8px; clip-path: polygon(50% 0, 100% 100%, 0 100%); background: color-mix(in srgb, var(--c) 55%, #000); visibility: hidden; margin-bottom: -0.5px; }
.dh-mini .w { position: relative; width: 17px; height: 12px; border-radius: 2px; background: var(--c); visibility: hidden; }
.dh-mini .w i { position: absolute; left: 6px; top: 3px; width: 5px; height: 5px; border-radius: 1px; background: rgba(0, 0, 0, 0.25); }
.dh-mini .b { width: 20px; height: 3px; border-radius: 1px; background: var(--base); }
.dh-mini.s0 .b { background: none; outline: 1.5px dashed var(--ghost); }
.dh-mini.s2 .w, .dh-mini.s3 .w, .dh-mini.s4 .w { visibility: visible; }
.dh-mini.s3 .r, .dh-mini.s4 .r { visibility: visible; }
.dh-mini.s4 .w i { background: #ffd36b; box-shadow: 0 0 5px #ffd36b; }
.dh-mini.s1 .w { visibility: visible; height: 5px; opacity: 0.6; }
.dh-mini.lot .b { background: none; outline: 1.5px dashed var(--ghost); outline-offset: -1px; }

/* Your street */
.street-card { margin: 12px 16px 0; padding: 12px 14px; border-radius: 18px; background: var(--surface); box-shadow: var(--card-shadow), inset 0 0 0 1px var(--line); }
.sc-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 13px; }
.sc-head b { font-size: 14px; }
.sc-head span { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; text-align: right; }
.sc-row { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 2px; margin-top: 10px; padding-bottom: 2px; border-bottom: 3px solid color-mix(in srgb, var(--text) 12%, transparent); }
.st-day { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 0; }
.st-day small { font-size: 9.5px; font-weight: 700; color: var(--muted); }
.st-day.is-today small { color: var(--accent); font-weight: 850; }
.st-day .dh-mini { transform: scale(0.9); transform-origin: bottom; }

/* Recap */
.recap { text-align: center; }
.rc-big { font-size: 54px; font-weight: 900; line-height: 1; color: var(--accent); font-variant-numeric: tabular-nums; }
.rc-label { font-size: 14px; font-weight: 700; color: var(--muted); margin-top: 2px; }
.rc-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 12px; font-size: 13px; font-weight: 700; margin: 6px 0; }
.rc-topics { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 8px 0; }
.rc-chip { padding: 3px 9px; border-radius: 10px; font-size: 12.5px; font-weight: 700; background: color-mix(in srgb, var(--c) 22%, var(--surface2)); }
.rc-today { font-size: 12.5px; color: var(--muted); margin-top: 6px; }

/* ================= Hacker palette: terminal touches ================= */
html[data-palette="hacker"] body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 9999;
  background: repeating-linear-gradient(180deg, rgba(0, 0, 0, 0) 0 2px, rgba(0, 0, 0, 0.18) 2px 3px);
  mix-blend-mode: multiply;
}
html[data-palette="hacker"] h1, html[data-palette="hacker"] h2, html[data-palette="hacker"] .b-en, html[data-palette="hacker"] .page-title,
html[data-palette="hacker"] .ch-title, html[data-palette="hacker"] .rc-big { text-shadow: 0 0 8px rgba(57, 255, 20, 0.45); }
html[data-palette="hacker"] .b-en::before { content: "> "; color: var(--accent); }
html[data-palette="hacker"] .stage-title::after { content: "_"; margin-left: 2px; color: var(--accent); animation: caret 1s steps(1) infinite; }
html[data-palette="hacker"] body.reduce-motion .stage-title::after { animation: none; }
@keyframes caret { 50% { opacity: 0; } }
html[data-palette="hacker"] .tile, html[data-palette="hacker"] .rv-opt, html[data-palette="hacker"] .rp-opt { box-shadow: 0 3px 0 var(--tile-edge), 0 0 10px rgba(57, 255, 20, 0.15); }
html[data-palette="hacker"] .slot.filled, html[data-palette="hacker"] .brick.es { text-shadow: 0 0 6px rgba(57, 255, 20, 0.35); }

/* ================= Pueblo ================= */
.pb-res { padding: 12px 14px; }
.pb-pesos { font-size: 15px; }
.pb-pesos b { font-size: 26px; font-variant-numeric: tabular-nums; }
.pb-pesos small { color: var(--muted); font-weight: 700; }
.pb-mats { display: flex; flex-wrap: wrap; gap: 6px 10px; margin-top: 8px; }
.pb-mat { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; }
.pm { display: inline-block; width: 16px; height: 9px; border-radius: 2px; background: var(--c); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.2); vertical-align: middle; }
.pm.gold { background: linear-gradient(135deg, #f7d774, #d9a531 60%, #f7d774); }
.pm.stone { background: #9aa0a6; outline: 2px solid var(--accent2); outline-offset: -2px; }
.pm.any { background: linear-gradient(90deg, var(--d-plaza) 0 33%, var(--d-ser) 33% 66%, var(--d-estar) 66%); }
.pb-hint { margin-top: 8px; font-size: 12px; color: var(--muted); line-height: 1.4; }
.pb-collect { margin: 0 16px 12px; width: calc(100% - 32px); }
.pb-collect:disabled { opacity: 0.5; }
.pb-map { margin: 0 16px; padding: 12px; border-radius: 22px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  background: linear-gradient(180deg, color-mix(in srgb, #6fae5a 30%, var(--bg)), color-mix(in srgb, #4f8f3f 30%, var(--bg))); }
.pl { position: relative; min-height: 118px; padding: 10px 8px; border-radius: 16px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px;
  background: color-mix(in srgb, var(--surface) 88%, transparent); box-shadow: 0 3px 0 rgba(0, 0, 0, 0.12); }
.pl.empty { background: color-mix(in srgb, var(--surface) 45%, transparent); outline: 2px dashed color-mix(in srgb, var(--text) 25%, transparent); outline-offset: -2px; box-shadow: none; }
.pl.locked { background: color-mix(in srgb, var(--text) 10%, transparent); box-shadow: none; opacity: 0.8; }
.pl-empty { font-size: 30px; color: var(--muted); }
.pl-bld { font-size: 46px; line-height: 1; filter: drop-shadow(0 4px 3px rgba(0, 0, 0, 0.25)); }
.pl.ready .pl-bld { animation: bob 1.4s ease-in-out infinite; }
.pl-name { font-size: 13px; font-weight: 800; }
.pl-lv { color: var(--accent2); font-size: 11px; letter-spacing: 1px; }
.pl-sub { font-size: 11.5px; color: var(--muted); font-weight: 700; }
.pl-bar { position: relative; width: 100%; height: 16px; border-radius: 8px; overflow: hidden; background: var(--track); }
.pl-bar i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #f7d774, #e9b23c); }
.pl-bar span { position: relative; display: block; text-align: center; font-size: 10.5px; font-weight: 850; line-height: 16px; color: var(--text); font-variant-numeric: tabular-nums; }
.pl.full { box-shadow: 0 3px 0 rgba(0, 0, 0, 0.12), 0 0 0 2px #e9b23c; }
.pb-play { margin: 14px 16px 24px; width: calc(100% - 32px); }
.pb-sheet p { font-size: 14px; line-height: 1.45; }
.pb-sub { color: var(--muted); margin-top: 0; }
.pb-types { display: flex; flex-direction: column; gap: 10px; }
.pt { padding: 12px; border-radius: 16px; background: var(--surface2); }
.pt.locked { opacity: 0.7; }
.pt-top { display: flex; gap: 10px; align-items: center; }
.pt-emoji { font-size: 34px; }
.pt-top small { color: var(--muted); }
.pt-desc { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.pt-cost { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 6px; }
.pc { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 10px; background: var(--surface); font-size: 13px; font-weight: 800; }
.pc small { font-weight: 600; color: var(--muted); font-size: 11px; }
.pc.short { outline: 2px solid var(--bad); outline-offset: -2px; }
.pt-meta { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.pt-lock { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.bs-top { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.bs-emoji { font-size: 48px; }
.bs-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.bs-row span { color: var(--muted); }
.bs-row b.low { color: var(--bad); }
.bs-note { font-size: 12.5px; color: var(--muted); }
.bs-up { margin: 12px 0 8px; }

/* ================= Juice ================= */
.fly-brick { position: fixed; left: 0; top: 0; z-index: 60; border-radius: 3px; background: var(--c); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.2), 0 6px 12px rgba(0, 0, 0, 0.25); pointer-events: none; }
.fly-brick.gold { background: linear-gradient(135deg, #f7d774, #d9a531 60%, #f7d774); box-shadow: 0 0 14px rgba(240, 190, 60, 0.8); }
.wb.incoming { opacity: 0; }
.confetti { position: fixed; left: 0; top: 0; z-index: 61; border-radius: 2px; pointer-events: none; }
.shout { position: fixed; left: 50%; top: 38%; z-index: 62; white-space: nowrap; pointer-events: none; font-size: 40px; font-weight: 900; letter-spacing: -0.02em; color: var(--accent2);
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.25), 0 0 24px color-mix(in srgb, var(--accent2) 60%, transparent); -webkit-text-stroke: 1.5px color-mix(in srgb, var(--accent2) 40%, #000); }
.flash { position: fixed; inset: 0; z-index: 59; background: #fff; pointer-events: none; }
.float.combo { font-size: 22px; font-weight: 900; color: var(--accent2); text-shadow: 0 2px 0 rgba(0, 0, 0, 0.2); }
.float.lucky { font-size: 17px; font-weight: 900; color: #E0A520; text-shadow: 0 0 10px rgba(255, 211, 107, 0.8); }
.tw-combo { font-weight: 900; font-size: 13px; font-variant-numeric: tabular-nums; color: var(--muted); }
.tw-combo.warm { color: #E0832A; }
.tw-combo.hot { color: #E0402A; text-shadow: 0 0 8px rgba(255, 120, 40, 0.7); animation: bob 0.7s ease-in-out infinite; }
.tw-crate { position: relative; height: 15px; margin: -2px 0 8px; border-radius: 8px; overflow: hidden; background: var(--track); }
.tw-crate i { position: absolute; inset: 0 auto 0 0; background: color-mix(in srgb, var(--accent2) 55%, transparent); transition: width 0.5s var(--spring); }
.tw-crate span { position: relative; display: block; padding: 0 8px; font-size: 10px; font-weight: 800; line-height: 15px; }
.crate-chip { background: color-mix(in srgb, var(--accent2) 35%, var(--surface2)); }
.crate-ov { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; background: rgba(0, 0, 0, 0.55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.crate-box { width: min(320px, 86vw); padding: 24px 20px; border-radius: 24px; background: var(--surface); text-align: center; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35); }
.crate { font-size: 92px; line-height: 1.1; cursor: pointer; user-select: none; }
.crate-title { font-size: 22px; font-weight: 900; margin-top: 4px; }
.crate-hint { font-size: 13px; color: var(--muted); margin-top: 4px; cursor: pointer; }
.crate-loot { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; }
.loot-row { padding: 10px 12px; border-radius: 12px; background: var(--surface2); font-size: 15.5px; font-weight: 800; display: flex; align-items: center; justify-content: center; gap: 6px; }
.pb-crate { margin: 0 16px 10px; width: calc(100% - 32px); background: color-mix(in srgb, var(--accent2) 30%, var(--surface2)); }

/* ================= Living Pueblo ================= */
.pb-town { margin: 0 16px; }
.tv { position: relative; height: 430px; border-radius: 22px; overflow: hidden; box-shadow: var(--card-shadow), inset 0 0 0 1px var(--line); touch-action: none; }
.tv-canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.tv-zoom { position: absolute; right: 10px; bottom: 10px; display: flex; flex-direction: column; gap: 6px; }
.tv-zoom button { width: 36px; height: 36px; border-radius: 12px; background: rgba(255, 255, 255, 0.85); color: #222; font-size: 20px; font-weight: 800; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2); }
.tv-clock { position: absolute; left: 10px; top: 10px; padding: 4px 10px; border-radius: 12px; background: rgba(255, 255, 255, 0.8); color: #222; font-size: 12px; font-weight: 800; }
.tv-bubbles { position: absolute; inset: 0; pointer-events: none; }
.tv-bubble { position: absolute; transform: translate(-50%, -100%); width: max-content; max-width: 220px; padding: 8px 30px 8px 11px; border-radius: 14px; background: #fff; color: #222; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25); pointer-events: auto; font-size: 14px; }
.tv-bubble::after { content: ""; position: absolute; left: 50%; bottom: -6px; width: 12px; height: 12px; background: #fff; transform: translateX(-50%) rotate(45deg); }
.tv-bubble b { display: block; font-size: 11px; color: #888; }
.tvb-es { font-weight: 750; }
.tvb-en { font-size: 12.5px; color: #666; filter: blur(4px); transition: filter 0.2s; }
.tv-bubble.show-en .tvb-en { filter: none; }
.tvb-say { position: absolute; right: 6px; top: 6px; width: 22px; height: 22px; font-size: 12px; }
.pb-tip { margin: 8px 18px 0; font-size: 12px; color: var(--muted); text-align: center; }
.art-url { width: 100%; height: 40px; margin-top: 8px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface2); color: var(--text); font-size: 14px; }

/* ================= Pueblo v2: rank card + HUD ================= */
.pb-rank { display: flex; align-items: center; gap: 12px; width: calc(100% - 32px); text-align: left; padding: 12px 14px; }
.pr-badge { font-size: 34px; }
.pr-mid { flex: 1; min-width: 0; }
.pr-mid > b { font-size: 18px; }
.pr-mid small { color: var(--muted); font-weight: 700; }
.pr-next { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.pr-bar { height: 7px; border-radius: 4px; background: var(--track); overflow: hidden; margin-top: 5px; }
.pr-bar i { display: block; height: 100%; background: var(--accent); }
.pr-arrow { font-size: 26px; color: var(--muted); }
.pr-go { padding: 6px 10px; border-radius: 12px; background: var(--accent2); color: var(--accent2-text); font-weight: 900; animation: bob 1s ease-in-out infinite; }
.pb-hud { padding: 10px 12px; }
.hud-row { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; margin-bottom: 6px; }
.hud-res { font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hud-res b { font-size: 15px; }
.hud-res small { color: var(--muted); font-size: 10.5px; }
.hud-chip { padding: 4px 10px; border-radius: 12px; background: var(--surface2); font-size: 13px; font-variant-numeric: tabular-nums; }
.hud-chip.warn { background: color-mix(in srgb, var(--bad) 22%, var(--surface2)); font-weight: 800; }
.pm-res { font-size: 13px; }
.bs-where { font-size: 12px; color: var(--muted); }
.wk { display: inline-flex; align-items: center; gap: 8px; }
.wk-b { width: 30px; height: 30px; border-radius: 10px; background: var(--surface2); font-size: 18px; font-weight: 800; }
.wk-auto { padding: 4px 10px; border-radius: 10px; background: var(--surface2); font-size: 12px; font-weight: 800; color: var(--muted); }
.wk-auto.on { background: var(--accent); color: var(--accent-text); }
.rk-list { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 12px; }
.rk-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface2); text-align: left; }
.rk-item.done { opacity: 0.65; }
.rk-item.done .rk-tick { color: var(--good); }
.rk-tick { font-weight: 900; width: 18px; text-align: center; }
.rk-label { flex: 1; font-size: 14px; font-weight: 700; }
.rk-label small { font-weight: 600; color: var(--muted); }
.rk-n { font-size: 12.5px; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }

.audio-log { margin-top: 8px; font-size: 12px; color: var(--muted); }
.audio-log pre { white-space: pre-wrap; font-size: 11px; margin: 6px 0 0; }

/* ================= El Olvido ================= */
.olv { padding: 10px 12px; }
.olv-head small { color: var(--muted); }
.olv-row { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); text-align: left; font-size: 13.5px; font-weight: 700; }
.olv-stage { font-size: 11.5px; font-weight: 800; padding: 2px 8px; border-radius: 8px; background: var(--surface2); color: var(--muted); }
.olv-stage.s2 { color: #E07B39; } .olv-stage.s3 { color: var(--bad); }
.olv-go { font-size: 12.5px; color: var(--accent); }
.olv-note { margin: 6px 0 0; font-size: 11.5px; color: var(--muted); }
.mr { display: flex; flex-direction: column; gap: 8px; text-align: left; margin: 4px 0 10px; }
.mr-row { padding: 9px 11px; border-radius: 12px; background: var(--surface2); font-size: 14px; line-height: 1.45; }
.mr-row small { display: inline-block; margin-left: 6px; color: var(--muted); font-size: 12px; }

/* ---------- Pueblo Phase C: research + La Catedral ---------- */
.pb-links { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 16px 0; }
.pb-links .pb-link { margin: 0; width: auto; }
.pb-link { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 12px; text-align: left; font-size: 15px; }
.pb-link small { color: var(--muted); font-weight: 700; font-size: 12px; }
.cat-stages { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.cat-st { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: var(--surface2); }
.cat-st.done { opacity: 0.7; }
.cat-st.done .cat-n { background: var(--good); color: #fff; }
.cat-st.next { outline: 2px solid var(--accent2, #F2B33D); }
.cat-st.future { filter: blur(0.6px); opacity: 0.55; }
.cat-st.soon { opacity: 0.35; }
.cat-n { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--track); }
.cat-body { flex: 1; min-width: 0; }
.cat-body small, .cat-hint { color: var(--muted); font-size: 12.5px; }
.cat-body .pt-cost { margin-top: 6px; }
.rs-perks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rs-perk { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 12px; background: var(--surface2); text-align: left; }
.rs-perk small { color: var(--muted); font-size: 11.5px; }
.rs-perk.on { outline: 2px solid var(--good); }
.rs-perk.locked { opacity: 0.5; }
.rs-pn { font-weight: 800; font-size: 13.5px; }
.rs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.rs-node { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 6px; border-radius: 12px; background: var(--surface2); font-size: 12.5px; text-align: center; min-height: 70px; }
.rs-node .rs-ic { font-size: 20px; }
.rs-node.locked { opacity: 0.45; }
.rs-node.available { outline: 2px dashed var(--accent2, #F2B33D); }
.rs-node.mastered { background: color-mix(in srgb, var(--good) 18%, var(--surface2)); }
.rs-name { font-weight: 700; line-height: 1.15; }
.rs-bar { width: 100%; height: 5px; border-radius: 3px; background: var(--track); overflow: hidden; }
.rs-bar i { display: block; height: 100%; background: var(--good); }
.rs-bar.big { height: 8px; margin: 4px 0 8px; }
.rs-bp { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface2); }
.rs-bp p { margin: 4px 0; }

/* ---------- Pueblo Phase D: expeditions ---------- */
.pb-links .pb-exp { grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: space-between; }
.pb-exp.ping { outline: 2px solid var(--accent2, #F2B33D); animation: exPing 1.6s ease-in-out infinite; }
@keyframes exPing { 50% { outline-color: transparent; } }
.tab-badge { position: absolute; top: 4px; right: calc(50% - 22px); min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: #E04F3B; color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; }
.ex-trip, .ex-site { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; margin-bottom: 8px; border-radius: 12px; background: var(--surface2); text-align: left; }
.ex-trip.waiting { outline: 2px solid var(--accent2, #F2B33D); }
.ex-ic { font-size: 24px; flex: none; }
.ex-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ex-mid small { color: var(--muted); font-size: 12px; }
.ex-go { font-weight: 800; color: var(--accent); }
.ex-crew { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.ex-person { display: inline-flex; align-items: center; gap: 4px; padding: 5px 8px; border-radius: 10px; background: var(--surface2); font-size: 13px; font-weight: 700; }
.ex-person small { color: var(--muted); font-weight: 600; }
.ex-person.training { opacity: 0.7; }
.ex-retire { margin-left: 2px; width: 20px; height: 20px; border-radius: 50%; background: var(--track); font-size: 13px; line-height: 1; }
.ex-train .pt-cost { margin-bottom: 8px; }
.ex-scrolls { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.ex-scroll { padding: 8px 10px; border-radius: 10px; background: var(--surface2); font-size: 13px; }
.ex-scroll summary { font-weight: 700; cursor: pointer; }
.ex-scroll p { margin: 6px 0 0; }
.ex-scroll.locked { opacity: 0.45; text-align: center; }
.enc { text-align: center; padding: 18px 6px; }
.enc h2 small { display: block; font-size: 14px; color: var(--muted); font-weight: 600; }
.enc-icon { font-size: 64px; line-height: 1.1; margin: 8px 0; }
.enc-loot { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 12px 0; font-size: 18px; font-weight: 800; }
.enc-note { font-size: 14px; margin: 6px 0; }
.enc-scroll { margin: 10px 0; padding: 10px 12px; border-radius: 12px; background: #f6ecd2; color: #4a3a1e; text-align: left; }
.enc-scroll p { margin: 4px 0 0; }
.skirm { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 8px auto 12px; max-width: 340px; height: 70px; font-size: 30px; overflow: hidden; }
.sk-side { display: flex; align-items: flex-end; }
.sk-side span { margin: 0 -4px; }
.sk-them span:not(.sk-flag) { transform: scaleX(-1); }
.sk-flag { font-size: 26px; align-self: flex-start; }
.sk-dust { display: flex; gap: 2px; font-size: 24px; }
.skirm.win .sk-dust, .skirm.lose .sk-dust { opacity: 0.25; }

/* ---------- Profe, the in-app agent ---------- */
.ag-fab { position: absolute; right: 14px; bottom: calc(var(--tab-h) + 14px); z-index: 56; width: 52px; height: 52px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 24px; display: grid; place-items: center; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25); }
.ag-dot { position: absolute; top: 4px; right: 4px; width: 12px; height: 12px; border-radius: 50%; background: #E04F3B; border: 2px solid #fff; display: none; }
.ag.unread .ag-dot { display: block; }
.ag.in-play .ag-fab, .ag.in-play .ag-mini { display: none; }
.ag[data-mode="open"] .ag-fab, .ag[data-mode="mini"] .ag-fab { display: none; }
.ag-mini { position: absolute; left: 12px; right: 12px; bottom: calc(var(--tab-h) + 10px); z-index: 56; display: none; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 14px; background: var(--surface); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22); text-align: left; font-size: 14px; }
.ag[data-mode="mini"] .ag-mini { display: flex; }
.ag-mini-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-mini-go { font-weight: 800; color: var(--accent); }
.ag-panel { position: absolute; left: 0; right: 0; bottom: 0; z-index: 57; height: min(78%, 640px); display: none; flex-direction: column; background: var(--bg); border-radius: 20px 20px 0 0; box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.25); padding-bottom: var(--sab); }
.ag[data-mode="open"] .ag-panel { display: flex; animation: agUp 0.25s ease-out; }
@keyframes agUp { from { transform: translateY(40px); opacity: 0; } }
.ag-head { display: flex; align-items: baseline; gap: 8px; padding: 14px 16px 8px; }
.ag-head b { font-size: 18px; }
.ag-head small { color: var(--muted); font-weight: 600; }
.ag-sp { flex: 1; }
.ag-new { font-size: 13px; font-weight: 700; color: var(--accent); padding: 4px 8px; }
.ag-close { width: 30px; height: 30px; border-radius: 50%; background: var(--surface2); font-size: 14px; }
.ag-log { flex: 1; overflow-y: auto; padding: 4px 14px 10px; display: flex; flex-direction: column; gap: 8px; -webkit-overflow-scrolling: touch; }
.ag-msg { max-width: 86%; padding: 9px 12px; border-radius: 16px; font-size: 15px; line-height: 1.4; }
.ag-msg p { margin: 0 0 6px; } .ag-msg p:last-child { margin-bottom: 0; }
.ag-msg ul { margin: 4px 0; padding-left: 18px; }
.ag-msg code { font-size: 13px; background: rgba(0, 0, 0, 0.06); padding: 0 4px; border-radius: 4px; }
.ag-msg.me { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 5px; }
.ag-msg.ai { align-self: flex-start; background: var(--surface); border-bottom-left-radius: 5px; box-shadow: var(--card-shadow); }
.ag-msg.ag-note { color: var(--muted); font-style: italic; }
.ag-act { align-self: flex-start; font-size: 12px; font-weight: 700; color: var(--muted); padding: 2px 8px; }
.ag-hello { padding: 10px 4px; color: var(--text); } .ag-hello p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.ag-typing { align-self: flex-start; display: flex; gap: 4px; padding: 12px 14px; border-radius: 16px; background: var(--surface); }
.ag-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: agDot 1s infinite ease-in-out; }
.ag-typing i:nth-child(2) { animation-delay: 0.15s; } .ag-typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes agDot { 50% { transform: translateY(-4px); opacity: 0.4; } }
.ag-sugg { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 8px; }
.ag-sugg:empty { display: none; }
.ag-chip { padding: 7px 11px; border-radius: 16px; background: var(--surface2); font-size: 13px; font-weight: 650; }
.ag-form { display: flex; gap: 8px; padding: 8px 12px 12px; border-top: 1px solid var(--line); }
.ag-in { flex: 1; height: 42px; padding: 0 14px; border-radius: 21px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-size: 16px; }
.ag-send { width: 42px; height: 42px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 20px; font-weight: 800; }
.ag-send:disabled { opacity: 0.4; }
/* Keyboard up: the panel sits on the keyboard and fills what is visible (agent.js fitKeyboard). */
.ag.kb .ag-panel { padding-bottom: 0; }
.ag.kb .ag-hello p { display: none; }

/* ---------- Clase (AI-led session) ---------- */
/* The strip: the last row of the class screen (agent.js dock()), never an overlay.
   Drag its handle to resize, tap it (or drag down) to minimize to a one-line bar. */
.ag-strip { display: none; flex-direction: column; gap: 6px; padding: 0 12px calc(8px + var(--sab)); background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.06); }
.ag-strip.docked { display: flex; flex: none; }
.ag-strip.kb { padding-bottom: 8px; }
.ag[data-mode="class"] .ag-fab, .ag[data-mode="class"] .ag-mini { display: none; }
.ag-grab { display: flex; justify-content: center; align-items: center; height: 22px; margin: 0 -12px -4px; cursor: ns-resize; touch-action: none; }
.ag-grab i { width: 40px; height: 5px; border-radius: 3px; background: var(--ghost, rgba(0, 0, 0, 0.2)); }
.ag-strip-log { height: var(--log-h, 76px); overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 6px; font-size: 14.5px; line-height: 1.4; -webkit-overflow-scrolling: touch; }
.sl p { margin: 0 0 4px; } .sl p:last-child { margin: 0; }
.sl ul { margin: 2px 0; padding-left: 18px; }
.sl.ai::before { content: "🧑‍🏫 "; float: left; margin-right: 4px; }
.sl.me { align-self: flex-end; max-width: 85%; padding: 4px 10px; border-radius: 12px; background: var(--surface2); }
.ag-peek { display: none; align-items: center; gap: 8px; width: 100%; padding: 2px 0 4px; text-align: left; font-size: 14px; }
.ag-peek::before { content: "🧑‍🏫"; }
.ag-peek-text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.ag-peek-go { font-weight: 800; color: var(--accent); }
.ag-strip.news .ag-peek::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #E04F3B; order: 3; }
.ag-strip[data-size="min"] .ag-peek { display: flex; }
.ag-strip[data-size="min"] .ag-strip-log, .ag-strip[data-size="min"] .ag-sform { display: none; }
.ag-thinking { color: var(--muted); font-style: italic; }
.ag-sform { display: flex; gap: 8px; }
.ag-sin { flex: 1; height: 38px; padding: 0 12px; border-radius: 19px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font-size: 16px; }
.ag-sform .ag-send { width: 38px; height: 38px; font-size: 18px; }
.stage.has-strip .stage-body { padding-bottom: 16px; }
.clase-wait { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 50vh; color: var(--muted); text-align: center; }
.cw-ic { font-size: 56px; }
.cw-dots { display: flex; gap: 6px; } .cw-dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); animation: agDot 1s infinite ease-in-out; }
.cw-dots i:nth-child(2) { animation-delay: 0.15s; } .cw-dots i:nth-child(3) { animation-delay: 0.3s; }
.clase-choice .cc-opts { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.clase-sum { margin: 10px auto; max-width: 340px; font-size: 15px; }
/* Profe full screen (the ⤢ button). */
.ag-full { width: 30px; height: 30px; border-radius: 50%; background: var(--surface2); font-size: 15px; margin-right: 6px; }
.ag.full .ag-panel { height: 100%; border-radius: 0; padding-top: var(--sat); box-shadow: none; }
/* A piece partly done: it fills from the bottom as the memory behind it grows (site.js). */
.sb i.part { outline: 1px dashed var(--ghost); outline-offset: -1px; background: linear-gradient(to top, color-mix(in srgb, var(--c) 40%, var(--surface)) var(--fill, 0%), transparent var(--fill, 0%)); }
.sb-base i.part { background: linear-gradient(to top, var(--base) var(--fill, 0%), transparent var(--fill, 0%)); }
.sb-roof i.part { outline: none; background: linear-gradient(to right, color-mix(in srgb, var(--c) 40%, var(--surface)) var(--fill, 0%), color-mix(in srgb, var(--ghost) 40%, transparent) var(--fill, 0%)); }
.sb-win i.part { background: linear-gradient(to top, rgba(255, 211, 107, 0.45) var(--fill, 0%), color-mix(in srgb, var(--window) 80%, #fff) var(--fill, 0%)); }
.site-gain { margin-left: auto; margin-right: 6px; font-size: 12px; font-weight: 800; color: var(--good, #3c9a5f); }
/* Profe-first home (docs/ai-first.md): Today with Profe is the main button; Quick Play for short gaps. */
.session-btn .pb-icon { font-size: 24px; }
.quick-play { display: flex; align-items: baseline; gap: 10px; width: calc(100% - 32px); margin: 10px 16px 0; padding: 12px 16px; border-radius: 16px; background: var(--surface); box-shadow: var(--card-shadow); text-align: left; }
.quick-play b { font-size: 16px; color: var(--accent); }
.quick-play small { color: var(--muted); font-size: 12.5px; }
/* "Looks wrong?" on AI-written questions (play.js). */
.b-prompt { position: relative; }
.flag-btn { position: absolute; top: 0; right: 0; font-size: 12px; font-weight: 650; color: var(--muted); padding: 2px 4px; }
/* The plan card on the home screen (plan.js). */
.plan-card { display: block; width: calc(100% - 32px); margin: 10px 16px 0; padding: 12px 14px; border-radius: 16px; background: var(--surface); box-shadow: var(--card-shadow); text-align: left; }
.plc-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 15px; }
.plc-top small { color: var(--muted); font-weight: 700; }
.plc-bar { height: 6px; border-radius: 3px; background: var(--track); overflow: hidden; margin: 8px 0 6px; }
.plc-bar i { display: block; height: 100%; background: var(--good, #3c9a5f); }
.plc-next { font-size: 13px; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; }
.plc-next span { color: var(--accent); font-weight: 800; flex: none; }
/* Settings: About you (profile.js). */
button.row { width: 100%; text-align: left; }
.row-go { color: var(--muted); font-weight: 800; }
.about-sheet { display: flex; flex-direction: column; gap: 12px; }
.about-sheet label { display: flex; flex-direction: column; gap: 4px; font-weight: 700; font-size: 14px; }
.about-sheet label small { color: var(--muted); font-weight: 600; }
.about-sheet textarea, .about-sheet input { font: inherit; font-size: 16px; font-weight: 500; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
/* Your words (blueprints.js). */
.wd-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 16px; }
.wd { padding: 5px 9px; border-radius: 10px; background: var(--surface); box-shadow: var(--card-shadow); font-size: 13.5px; }
.wd small { color: var(--muted); }
.wd.strong { background: color-mix(in srgb, var(--good, #3c9a5f) 16%, var(--surface)); }
.wd.crack { outline: 1px dashed color-mix(in srgb, #b8860b 70%, transparent); }
.wd.crumble { outline: 1px dashed #c0392b; }
/* Readings (play.js readingStep). */
.rd h2 { margin: 4px 0 12px; }
.rd-lines { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.rd-line { position: relative; padding: 10px 40px 10px 12px; border-radius: 14px; background: var(--surface); box-shadow: var(--card-shadow); cursor: pointer; }
.rd-sp { display: block; font-size: 12px; color: var(--accent); margin-bottom: 2px; }
.rd-es { font-size: 17px; line-height: 1.4; }
.rd-w { text-decoration: underline dotted; text-underline-offset: 3px; cursor: help; }
.rd-en { display: none; margin-top: 4px; font-size: 14px; color: var(--muted); }
.rd-line.show-en .rd-en { display: block; }
.rd-say { position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border-radius: 50%; background: var(--surface2); font-size: 13px; }
.rd-q .cc-opts { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.rd-q .btn.right { outline: 2px solid var(--good, #3c9a5f); }
.rd-q .btn.wrong { outline: 2px solid #c0392b; }
.rd-fb { margin-top: 12px; text-align: center; }
.ex-lore { display: flex; flex-direction: column; gap: 2px; text-align: left; }
.ex-lore small { color: var(--muted); }

/* ---------- Verb chart (verbchart.js) ---------- */
.vc-ov { position: absolute; inset: 0; z-index: 58; display: flex; align-items: flex-end; background: rgba(0, 0, 0, 0); transition: background 0.2s; }
.vc-ov.show { background: rgba(0, 0, 0, 0.45); }
.vc-card { width: 100%; max-height: 82%; display: flex; flex-direction: column; background: var(--bg); border-radius: 20px 20px 0 0; box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.25); padding-bottom: var(--sab); transform: translateY(100%); transition: transform 0.24s cubic-bezier(0.2, 0.9, 0.3, 1); }
.vc-ov.show .vc-card { transform: none; }
.vc-grab { width: 38px; height: 5px; border-radius: 3px; background: var(--ghost); margin: 8px auto 2px; flex: none; }
.vc-body { overflow-y: auto; padding: 0 16px 16px; -webkit-overflow-scrolling: touch; }
.vc-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 0 4px; }
.vc-head h3 { margin: 0; font-size: 18px; }
.vc-x { width: 30px; height: 30px; border-radius: 50%; background: var(--surface2); font-size: 14px; }
.vc-peek { margin: 2px 0 8px; font-size: 13px; color: var(--muted); }
.vc-chips { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 8px; scrollbar-width: none; }
.vc-chip { flex: none; padding: 7px 12px; border-radius: 16px; background: var(--surface2); font-size: 14px; font-weight: 700; color: var(--text); }
.vc-chip.on { background: var(--accent); color: var(--accent-text); }
.vc-tabs { display: flex; gap: 4px; padding: 3px; border-radius: 10px; background: var(--surface2); margin-bottom: 8px; }
.vc-tab { flex: 1; padding: 6px 4px; border-radius: 8px; font-size: 13px; font-weight: 700; color: var(--muted); }
.vc-tab.on { background: var(--surface); color: var(--text); box-shadow: var(--card-shadow); }
.vc-tab.locked { opacity: 0.55; }
.vc-tname { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin: 2px 0 4px; }
.vc-table { width: 100%; border-collapse: separate; border-spacing: 0 4px; }
.vc-table th { text-align: left; font-size: 13px; font-weight: 650; color: var(--muted); padding: 4px 6px 4px 0; white-space: nowrap; }
.vc-table thead th, .vc-table tr:first-child th { vertical-align: bottom; }
.vc-table th b { display: block; font-size: 16px; color: var(--text); }
.vc-table th small { display: block; font-size: 11px; font-weight: 600; }
.vc-table tr.vc-hi th { color: var(--accent); }
.vc-table tr.vc-hi td { box-shadow: inset 0 0 0 2px var(--accent); }
.vc-cell { padding: 8px 10px; border-radius: 10px; background: var(--surface); font-size: 17px; font-weight: 700; color: var(--text); box-shadow: var(--card-shadow); }
.vc-cell.c1 { background: color-mix(in srgb, var(--accent2) 16%, var(--surface)); }
.vc-cell.c2 { background: color-mix(in srgb, var(--brick) 20%, var(--surface)); }
.vc-cell.c3 { background: color-mix(in srgb, var(--bad) 24%, var(--surface)); }
.vc-cell.c2, .vc-cell.c3 { background-image: linear-gradient(118deg, transparent 46%, color-mix(in srgb, var(--text) 30%, transparent) 47%, transparent 49%); }
.vc-cell.unseen { color: var(--muted); background: var(--surface3); box-shadow: none; }
.vc-cell.new { color: var(--muted); background: transparent; box-shadow: inset 0 0 0 1.5px var(--ghost); font-style: italic; }
.vc-cell.lit { background: var(--accent2); color: var(--accent2-text); }
.vc-cell.vc-pat b { color: var(--accent); }
.vc-lock { text-align: center; color: var(--muted); font-size: 14px; }
.vc-rule { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: var(--chip); color: var(--chip-text); font-size: 14px; line-height: 1.35; }
.vc-rule small { display: block; margin-top: 3px; opacity: 0.8; font-size: 12.5px; }
.vc-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 12px 0 10px; }
.vc-legend .vc-cell { padding: 3px 8px; font-size: 11px; font-weight: 650; box-shadow: none; }
.vc-legend small { color: var(--muted); font-size: 11px; margin-left: auto; }
.vc-drill { margin-top: 4px; }
.vc-open { position: absolute; top: 0; right: 0; padding: 3px 9px; border-radius: 12px; background: var(--chip); color: var(--chip-text); font-size: 12px; font-weight: 750; }
.b-prompt.has-vc .flag-btn { right: 92px; }
.b-prompt.has-vc .b-meta { padding-right: 96px; }
.b-prompt.has-vc:has(.flag-btn) .b-meta { padding-right: 190px; }
.vf { text-decoration: underline dotted color-mix(in srgb, var(--accent) 60%, transparent); text-underline-offset: 3px; cursor: pointer; }
.fb-peek { margin-top: 6px; font-size: 13px; color: var(--muted); }
.vc-entry-row { display: flex; gap: 8px; }
.vc-entry-row .btn { flex: 1; }
/* The drill */
.vc-drillv { display: flex; flex-direction: column; gap: 10px; }
.vc-dtable .vc-table th { width: 40%; font-size: 15px; }
.vc-cell.given { color: var(--muted); }
.vc-blank { text-align: center; color: var(--muted); background: var(--surface3); box-shadow: inset 0 0 0 1.5px var(--ghost); }
.vc-blank.active { box-shadow: inset 0 0 0 2.5px var(--accent); color: var(--accent); }
.vc-cell.right { background: var(--good); color: var(--good-text); }
.vc-cell.helped { background: color-mix(in srgb, var(--accent2) 40%, var(--surface)); }
.vc-tray { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.vc-tray .tile.used { opacity: 0.3; pointer-events: none; }

/* ---------- Speaking (speakpad.js) ---------- */
.sp-pad { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 10px 0 4px; }
.sp-mic { width: 76px; height: 76px; border-radius: 50%; background: var(--accent); color: var(--accent-text); font-size: 34px; display: grid; place-items: center; box-shadow: var(--accent-shadow); transition: transform 0.15s, background 0.2s; }
.sp-pad[data-state="rec"] .sp-mic { background: var(--bad); animation: sp-pulse 1.2s ease-in-out infinite; }
.sp-pad[data-state="busy"] .sp-mic { opacity: 0.6; }
@keyframes sp-pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--bad) 45%, transparent); } 50% { box-shadow: 0 0 0 14px transparent; } }
.sp-state { font-size: 14px; font-weight: 650; color: var(--muted); text-align: center; }
.sp-level { width: 120px; height: 5px; border-radius: 3px; background: var(--track); overflow: hidden; opacity: 0; transition: opacity 0.2s; }
.sp-pad[data-state="rec"] .sp-level { opacity: 1; }
.sp-level i { display: block; height: 100%; width: 0; background: var(--good); transition: width 0.08s; }
.sp-gap { min-width: 44px; color: var(--muted); letter-spacing: 2px; background: var(--surface3); box-shadow: inset 0 0 0 1.5px var(--ghost); }
.sp-result { margin-top: 8px; display: flex; flex-direction: column; gap: 8px; text-align: left; }
.sp-heard { font-size: 13px; color: var(--muted); }
.sp-words { display: flex; flex-wrap: wrap; gap: 6px; }
.sp-w { display: inline-flex; align-items: baseline; gap: 4px; padding: 5px 9px; border-radius: 10px; font-size: 15px; font-weight: 700; background: var(--surface2); color: var(--text); }
.sp-w small { font-size: 11px; font-weight: 650; opacity: 0.75; }
.sp-w.good { background: color-mix(in srgb, var(--good) 22%, var(--surface)); }
.sp-w.ok { background: color-mix(in srgb, var(--accent2) 30%, var(--surface)); }
.sp-w.weak { background: color-mix(in srgb, var(--bad) 24%, var(--surface)); }
.sp-w.miss { text-decoration: line-through; color: var(--bad); background: transparent; box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--bad) 50%, transparent); }
.sp-w.extra { color: var(--muted); font-style: italic; background: transparent; box-shadow: inset 0 0 0 1.5px var(--ghost); }
.sp-w.focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.sp-scores { display: flex; flex-wrap: wrap; gap: 12px; font-size: 13px; color: var(--muted); }
.sp-scores b { font-size: 16px; color: var(--text); }
.sp-tip { font-size: 13px; color: var(--muted); }
.sp-override, .sp-sayit { display: block; margin-top: 8px; font-size: 13px; font-weight: 700; }
.sp-line { font-size: 22px; font-weight: 750; line-height: 1.3; margin: 6px 0 2px; }
.sp-en { font-size: 14px; color: var(--muted); }
.sp-row { display: flex; gap: 8px; margin: 12px 0 4px; }
.sp-row .btn { flex: 1; }
.sp-out { padding-bottom: 10px; }
.rd-mic { position: absolute; top: 8px; right: 40px; width: 28px; height: 28px; border-radius: 50%; background: var(--surface2); font-size: 13px; }
.rd-line:has(.rd-mic) { padding-right: 76px; }
.rd-all { margin: 4px 0 10px; }
.voice-card h3 { margin: 0 0 4px; font-size: 15px; }
.mic-state { margin-top: 10px; font-size: 14px; font-weight: 650; color: var(--muted); }
.mic-state.ok { color: var(--good); }
.mic-steps { padding-left: 18px; margin: 8px 0 10px; line-height: 1.45; }
.mic-steps a { color: var(--accent); font-weight: 700; }
.sp-gap.right { color: var(--good-text); background: var(--good); box-shadow: none; letter-spacing: 0; }
.sp-gap.wrong { color: #fff; background: var(--bad); box-shadow: none; letter-spacing: 0; }

/* ---------- Voice lab (voicelab.js) ---------- */
.lab { display: flex; flex-direction: column; gap: 12px; padding-bottom: 24px; }
.lab .card h3 { margin: 0 0 6px; font-size: 15px; }
.lab-row { display: flex; align-items: baseline; gap: 8px; padding: 4px 0; font-size: 14px; }
.lab-row > span { width: 16px; font-weight: 800; }
.lab-row.ok > span { color: var(--good); } .lab-row.bad > span { color: var(--bad); }
.lab-row small { color: var(--muted); font-size: 12px; margin-left: auto; text-align: right; }
.lab-mic { display: flex; align-items: center; gap: 12px; }
.lab-level { opacity: 0; } .lab-level.on { opacity: 1; }
.lab-out:empty { display: none; }
.lab-out { margin-top: 10px; }
.lab-err { color: var(--bad); font-weight: 650; font-size: 14px; margin: 0 0 4px; }
.lab-good { color: var(--good); font-weight: 650; font-size: 14px; margin: 0 0 8px; }
.lab-text { width: 100%; height: 42px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-size: 16px; }
.lab-fmts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#openLab small { display: block; font-size: 12px; font-weight: 600; color: var(--muted); }

/* ---------- Word drills (worddrill.js) ---------- */
.wd-big { display: flex; align-items: center; gap: 10px; font-size: 34px; font-weight: 800; margin: 6px 0 2px; }
.wd-say { font-size: 18px; width: 36px; height: 36px; border-radius: 50%; background: var(--surface2); }
.wd-drill .cc-opts { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.wd-drill .cc-opts .btn.right { background: var(--good); color: var(--good-text); }
.wd-drill .cc-opts .btn.wrong { background: var(--bad); color: #fff; }
.wd-fb { font-size: 15px; font-weight: 650; margin: 8px 0; }
.wd-next { margin-top: 12px; }
.wd-btns { margin: 4px 0 10px; }

/* ---------- AI model picker (aimodel.js) ---------- */
.am-card h3 { margin: 0 0 4px; font-size: 15px; }
.am-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.am-opt { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 12px; border-radius: 12px; background: var(--surface2); text-align: left; }
.am-opt b { font-size: 15px; } .am-opt small { font-size: 12px; color: var(--muted); }
.am-opt.on { background: var(--chip); box-shadow: inset 0 0 0 2px var(--accent); }
.am-def { display: inline; color: var(--accent) !important; font-weight: 700; }

/* Ask Profe from the Play header (agent.js) */
.stage-ask { position: relative; flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--chip); color: var(--chip-text); font-size: 16px; display: grid; place-items: center; }
.stage-ask[hidden] { display: none; }
.stage-ask .ag-dot { top: -1px; right: -1px; width: 10px; height: 10px; }
.stage-ask.unread .ag-dot { display: block; }
.ch-en { font-weight: 650; text-align: left; }

/* The strip in Play ("side" mode, agent.js) */
.ag[data-mode="side"] .ag-fab, .ag[data-mode="side"] .ag-mini { display: none; }
.stage-ask.on { background: var(--accent); color: var(--accent-text); }

/* A clearer drag bar for the strip: a wide handle across the top */
.ag-grab { height: 30px; margin: 0 -12px -2px; border-radius: 14px 14px 0 0; }
.ag-grab i { width: 56px; height: 6px; border-radius: 3px; background: color-mix(in srgb, var(--text) 35%, transparent); }
.ag-strip.docked { border-radius: 16px 16px 0 0; box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.12); border-top: none; }

/* Say it: try again after the result */
.sp-again { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.sp-again-head { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 750; color: var(--muted); }
.sp-again-head .link-btn { font-size: 13px; }
.sp-again .sp-mic { width: 56px; height: 56px; font-size: 26px; }

/* Lessons: before → after examples, and "Explain it another way" */
.ls-before { font-size: 15px; color: var(--muted); margin-bottom: 2px; }
.ls-before s { text-decoration-thickness: 2px; text-decoration-color: var(--bad); color: var(--muted); }
.ls-before::after { content: " ↓"; color: var(--muted); }
.ls-explain-btn { display: block; margin: 14px auto 0; font-size: 14px; font-weight: 700; }

/* ================= Bigger screens (phone layout unchanged below 700px) ================= */
/* Tablet, or a narrow laptop window: the phone layout in a centered column. (left/right, not
   transform: flying bricks and confetti are positioned in screen coordinates.) */
@media (min-width: 700px) {
  body { background: color-mix(in srgb, var(--text) 6%, var(--bg)); }
  #app { left: max(0px, calc((100% - 560px) / 2)); right: max(0px, calc((100% - 560px) / 2)); background: var(--bg); box-shadow: 0 0 0 0.5px var(--line), 0 10px 40px rgba(0, 0, 0, 0.08); }
  .kb-hint { display: none; }
}

/* Laptop and desktop: a sidebar for the tabs, roomy centered content, Profe in a side panel. */
@media (min-width: 1024px) {
  #app { left: max(0px, calc((100% - 1320px) / 2)); right: max(0px, calc((100% - 1320px) / 2)); }
  :root { --side-w: 210px; }
  /* Tabs → a sidebar */
  .tabbar { top: var(--top-h); bottom: 0; right: auto; width: var(--side-w); height: auto; display: flex; flex-direction: column; gap: 4px; padding: 14px 12px; border-top: 0; border-right: 0.5px solid var(--line); }
  .tab { flex-direction: row; justify-content: flex-start; gap: 12px; height: 46px; padding: 0 14px; border-radius: 14px; font-size: 15px; }
  .tab.active { background: var(--tab-on); }
  .tab-indicator { display: none; }
  /* Content beside it, in a readable column */
  .views { left: var(--side-w); }
  .view { padding-left: max(8px, calc((100% - 760px) / 2)); padding-right: max(8px, calc((100% - 760px) / 2)); padding-bottom: 40px; }
  .view[data-view="pueblo"] { padding-left: 16px; padding-right: 16px; }
  .toast { bottom: 28px; }
  .ag-fab { bottom: 28px; right: 28px; }
  .ag-mini { left: auto; right: 24px; width: 420px; bottom: 24px; }
  /* Sheets: a centered card instead of a full-width drawer */
  .sheet { left: max(0px, calc((100% - 680px) / 2)); right: max(0px, calc((100% - 680px) / 2)); height: calc(100% - 48px); }
  .vc-ov { justify-content: center; }
  .vc-card { width: min(680px, 100%); }
  /* Play: the question in a centered column */
  .stage-top, .stage-tools { padding-left: 24px; padding-right: 24px; }
  .stage-body { padding-left: max(16px, calc((100% - 720px) / 2)); padding-right: max(16px, calc((100% - 720px) / 2)); }
  .kb-hint { display: block; flex: none; font-size: 12px; color: var(--muted); }
  /* Profe beside the question (class strip and the Play strip): a right-hand column */
  .stage.has-strip { display: grid; grid-template-columns: minmax(0, 1fr) 400px; grid-template-rows: auto auto minmax(0, 1fr); }
  .stage.has-strip > .stage-top { grid-column: 1 / -1; }
  .stage.has-strip > .stage-tools { grid-column: 1; grid-row: 2; }
  .stage.has-strip > .stage-body { grid-column: 1; grid-row: 3; padding-left: max(16px, calc((100% - 680px) / 2)); padding-right: max(16px, calc((100% - 680px) / 2)); }
  .stage.has-strip > .ag-strip { grid-column: 2; grid-row: 2 / 4; display: flex; min-height: 0; padding: 14px 14px 16px; border: 0; border-left: 0.5px solid var(--line); border-radius: 0; box-shadow: none; }
  .stage.has-strip .ag-grab, .stage.has-strip .ag-peek { display: none !important; }
  .stage.has-strip .ag-strip-log { display: flex !important; flex: 1 1 auto; height: auto !important; min-height: 0; }
  .stage.has-strip .ag-sform { display: flex !important; }
  /* The full Profe chat: a panel on the right instead of a bottom sheet */
  .ag-panel, .ag.full .ag-panel { left: auto; top: 0; bottom: 0; width: 440px; height: auto; border-radius: 0; padding-top: 0; box-shadow: -8px 0 30px rgba(0, 0, 0, 0.15); }
  .ag-full { display: none; }
}
.kb-hint { display: none; }

/* Pueblo buttons keep their side margins (.btn.block would make them 100% + margins wide). */
.btn.block.pb-collect, .btn.block.pb-crate { width: calc(100% - 32px); }

/* ---------- Wide screens: use the room ---------- */
.town-cols { display: contents; }
@media (min-width: 1024px) {
  /* Fill the window (no outer frame), and give the content more room. */
  #app { left: 0; right: 0; box-shadow: none; }
  .view { padding-left: max(16px, calc((100% - 880px) / 2)); padding-right: max(16px, calc((100% - 880px) / 2)); }
  .bp-list { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
}
@media (min-width: 1200px) {
  /* Town: you and what to do on the left, the city on the right. */
  #view-town, #view-blueprints { padding-left: max(20px, calc((100% - 1480px) / 2)); padding-right: max(20px, calc((100% - 1480px) / 2)); }
  #view-town { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); column-gap: 8px; align-content: start; align-items: start; }
  .town-cols { display: block; min-width: 0; }
  .town-side .town-seg { margin-top: 0; }
  .town-side .districts { margin-top: 14px; }
}

/* ================= Pueblo: the map is the page, the controls float on it ================= */
#view-pueblo.pq-view { padding: 0 !important; overflow: hidden; }
.pq { position: absolute; left: 0; right: 0; top: var(--top-h); bottom: var(--tab-h); overflow: hidden; }
.pq .pb-town { position: absolute; inset: 0; margin: 0; }
.pq .tv { height: 100%; border-radius: 0; box-shadow: none; }
.pq .tv-clock { top: auto; bottom: 14px; left: 12px; }
.pq .tv-zoom { right: auto; left: 10px; bottom: auto; top: 50%; transform: translateY(-50%); }
.pq-glass { background: color-mix(in srgb, var(--surface) 86%, transparent); -webkit-backdrop-filter: blur(12px) saturate(160%); backdrop-filter: blur(12px) saturate(160%); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16); }
.pq-top { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; pointer-events: none; }
.pq-top > * { pointer-events: auto; }
.pq-rank { display: flex; align-items: center; gap: 8px; height: 46px; padding: 0 12px 0 8px; border-radius: 16px; text-align: left; }
.pq-rank .pr-badge { font-size: 26px; }
.pq-rank-t { display: flex; flex-direction: column; line-height: 1.15; }
.pq-rank-t b { font-size: 15px; }
.pq-rank-t small { font-size: 11px; color: var(--muted); font-weight: 700; }
.pq-more { font-size: 20px; color: var(--muted); }
.pq-rank .pr-go { padding: 3px 8px; font-size: 12px; }
.pq-res { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 12px; min-height: 46px; padding: 6px 12px; border-radius: 16px; }
.pq-res .hud-res { font-size: 13px; }
.pq-res .hud-res b { font-size: 14px; margin-left: 2px; }
.pq-chips { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; }
.pq-chips .hud-chip { border-radius: 14px; padding: 6px 10px; }
.pq-side { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 12px; }
.pq-btn { position: relative; width: 60px; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10.5px; font-weight: 800; color: var(--text); text-shadow: 0 1px 2px color-mix(in srgb, var(--bg) 80%, transparent); }
.pq-btn .ic { width: 50px; height: 50px; border-radius: 50%; display: grid; place-items: center; font-size: 23px; }
.pq-btn.ping .ic::after { content: ""; position: absolute; top: 2px; right: 6px; width: 12px; height: 12px; border-radius: 50%; background: #E04F3B; border: 2px solid #fff; }
.pq-bottom { position: absolute; left: 12px; right: 78px; bottom: 16px; display: flex; justify-content: center; gap: 10px; pointer-events: none; }
.pq-bottom > * { pointer-events: auto; }
.pq-pill { height: 48px; padding: 0 20px; border-radius: 24px; font-weight: 850; font-size: 15px; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22); white-space: nowrap; }
.pq-collect { background: var(--accent2); color: var(--accent2-text); }
.pq-play { background: var(--accent); color: var(--accent-text); }
.pq-tip { position: absolute; left: 50%; bottom: 80px; transform: translateX(-50%); width: min(340px, calc(100% - 40px)); padding: 10px 14px; border-radius: 16px; font-size: 13px; line-height: 1.4; text-align: left; }
.pq-tip b { color: var(--accent); margin-left: 4px; }
.pq-stock { display: grid; gap: 6px; }
.pq-stock-row { display: grid; grid-template-columns: 1fr auto auto; gap: 6px; align-items: baseline; padding: 8px 2px; border-bottom: 0.5px solid var(--line); font-size: 15px; }
.pq-stock-row b { font-variant-numeric: tabular-nums; font-size: 17px; }
.pq-stock-row small { color: var(--muted); }
.pb-mat small { font-weight: 600; color: var(--muted); }
@media (min-width: 1024px) {
  .pq { bottom: 0; }
  .pq-top { left: 16px; right: 16px; top: 14px; }
  .pq-chips { width: auto; }
  .pq-side { right: 16px; }
  .pq-bottom { right: 100px; bottom: 24px; }
}
.pq .pq-rank { width: auto; margin: 0; }
.pq-tip { bottom: 92px; }
@media (max-width: 699px) { .pq .tv-clock { display: none; } }
.pq .pq-pill { width: auto; margin: 0; }

/* ================= Desktop panes (VS Code style) ================= */
.nav-toggle, .top-profe, .ag-resize { display: none; }
@media (min-width: 1024px) {
  /* Sidebar: icons + names, or icons only (« / », or the [ key). */
  #app.nav-collapsed { --side-w: 68px; }
  .tabbar { transition: width 0.2s var(--ease-out); overflow: hidden; }
  .views, .stage { transition: left 0.2s var(--ease-out), right 0.2s var(--ease-out); }
  #app.nav-collapsed .tab { justify-content: center; padding: 0; }
  #app.nav-collapsed .tab span, #app.nav-collapsed .nt-label { display: none; }
  .tab span, .nt-label { white-space: nowrap; }
  .nav-toggle { display: flex; align-items: center; gap: 12px; margin-top: auto; height: 40px; padding: 0 14px; border-radius: 12px; color: var(--muted); font-size: 13px; font-weight: 650; }
  .nav-toggle:hover, .tab:hover { background: var(--surface3); }
  .nt-ic { width: 24px; text-align: center; font-size: 18px; }
  #app.nav-collapsed .nav-toggle { justify-content: center; padding: 0; }
  #app.nav-collapsed .nt-ic { transform: scaleX(-1); }
  /* Profe: a pane docked on the right; the rest of the app makes room for it. */
  #app { --profe-w: 400px; }
  #app.profe-docked .views, #app.profe-docked .stage { right: var(--profe-w); }
  #app.profe-docked .toast { left: calc(50% - var(--profe-w) / 2); }
  .ag-panel, .ag.full .ag-panel { top: var(--top-h); width: var(--profe-w); box-shadow: none; border-left: 0.5px solid var(--line); z-index: 35; }
  .ag[data-mode="open"] .ag-panel { animation: none; }
  .ag-resize { display: block; position: absolute; left: -3px; top: 0; bottom: 0; width: 7px; cursor: col-resize; z-index: 2; }
  .ag-resize:hover, body.resizing .ag-resize { background: color-mix(in srgb, var(--accent) 35%, transparent); }
  body.resizing { cursor: col-resize; }
  body.resizing * { user-select: none; }
  .ag-close { display: grid; place-items: center; }
  .top-profe { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 16px; background: var(--surface3); font-size: 13px; font-weight: 750; }
  #app.profe-docked .top-profe { background: var(--accent); color: var(--accent-text); }
  #app.profe-docked .ag-fab, .ag-fab { display: none; }
  /* In Play, Profe's pane takes the place of the strip. */
  #app.profe-docked .stage.has-strip { grid-template-columns: minmax(0, 1fr); }
}

/* English under Spanish names (gloss.js) */
.gloss { display: block; font-size: 0.72em; font-weight: 600; color: var(--muted); line-height: 1.25; letter-spacing: 0; text-transform: none; margin-top: 1px; }
.gloss-in { font-size: 0.82em; font-weight: 600; color: var(--muted); letter-spacing: 0; text-transform: none; }
.pq-gl { display: block; margin-top: -2px; font-size: 9px; font-weight: 650; opacity: 0.8; }
.cb-gloss { margin-top: 1px; font-size: 11px; font-weight: 600; color: var(--muted); line-height: 1.25; }
.cb-head { flex-wrap: wrap; row-gap: 2px; }
.cb-head b { white-space: normal; overflow: visible; }

/* Lessons: hear every example (🔊 = English, then Spanish; tap the Spanish = just Spanish) */
.ls-ex { position: relative; padding-right: 46px; }
.ls-say { cursor: pointer; }
.ls-play { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 15px; background: var(--surface3); }
.ls-play.on, .rl-pair.on { background: var(--accent); color: var(--accent-text); }
.ls-say-ic { font-size: 0.7em; opacity: 0.6; }
/* Word rules: an English ending turns into a Spanish one */
.rl-shift { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 6px 0 4px; font-size: 26px; font-weight: 850; }
.rl-shift .rl-en { color: var(--muted); }
.rl-shift .rl-es { color: var(--accent); }
.rl-arrow { color: var(--muted); font-weight: 600; }
.rl-reach { text-align: center; font-weight: 750; margin-bottom: 10px; }
.rl-pairs { display: grid; gap: 6px; margin: 10px 0 4px; }
.rl-pair { display: grid; grid-template-columns: 1fr auto 1fr auto; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px; background: var(--surface2, var(--surface)); border: 0.5px solid var(--line); text-align: left; font-size: 16px; }
.rl-w.en { color: var(--muted); }
.rl-w.es { font-weight: 800; }
.rl-ic { font-size: 13px; opacity: 0.7; }
.rl-all { display: block; margin: 6px auto 0; font-weight: 750; }
.rl-try { margin-top: 14px; padding-top: 12px; border-top: 0.5px solid var(--line); }
.rl-q { font-size: 18px; margin: 4px 0 8px; }

/* Lessons list (Town → 📚 Lessons): start, retake or practice any lesson */
.lsn-list .section-title { margin: 14px 2px 6px; }
.lsn-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 2px; border-bottom: 0.5px solid var(--line); }
.lsn-row.locked { opacity: 0.5; }
.lsn-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.lsn-name b { display: block; font-size: 15.5px; }
.lsn-name small { display: block; color: var(--muted); font-size: 12px; font-weight: 650; }
.lsn-n { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--surface3); font-weight: 800; font-size: 13px; }
.lsn-row.started .lsn-n { background: var(--accent); color: var(--accent-text); }
.lsn-go { display: flex; gap: 6px; flex: none; }
.lsn-go .btn { height: 34px; padding: 0 12px; font-size: 13.5px; }
.lsn-name { flex: 1; }
.lsn-t { min-width: 0; }
.lsn-t b { overflow-wrap: anywhere; }
.lsn-go .btn { padding: 0 10px; }
@media (max-width: 380px) { .lsn-go .btn { font-size: 12.5px; padding: 0 8px; } }
.rl-pair.on .rl-w.en, .rl-pair.on .rl-arrow { color: inherit; opacity: 0.8; }

/* "You already know these": tap a Spanish word to flip it to its English */
.gs-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.gs-card { position: relative; height: 64px; border-radius: 14px; background: var(--surface2); border: 0.5px solid var(--line); display: grid; place-items: center; text-align: center; padding: 4px; }
.gs-es { font-size: 17px; font-weight: 800; transition: transform 0.25s var(--ease-out); }
.gs-en { position: absolute; bottom: 6px; left: 0; right: 0; font-size: 12.5px; color: var(--muted); font-weight: 650; opacity: 0; transition: opacity 0.25s; }
.gs-card.flip { background: color-mix(in srgb, var(--accent) 14%, var(--surface2)); }
.gs-card.flip .gs-es { transform: translateY(-8px); }
.gs-card.flip .gs-en { opacity: 1; }
.gs-outro { margin-top: 4px; }
/* The rule, said plainly */
.rl-rule { font-size: 19px; font-weight: 800; line-height: 1.3; margin: 2px 0 8px; }
.gs-grid { grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); }
.gs-card { min-width: 0; }
.gs-es { font-size: 16px; max-width: 100%; }

/* The word wall under a question: each brick is a sentence you've laid for this topic */
.ww { padding: 10px 12px; border-radius: 14px; background: var(--surface2); border: 0.5px solid var(--line); }
.ww-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 14px; }
.ww-part { color: var(--muted); font-size: 12.5px; font-weight: 650; }
.ww-strip { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0 6px; }
.ww-b { font-size: 12.5px; font-weight: 650; padding: 4px 8px; border-radius: 4px; background: color-mix(in srgb, var(--c, var(--accent)) 22%, var(--surface)); color: var(--text); border-bottom: 2px solid color-mix(in srgb, var(--c, var(--accent)) 55%, var(--surface)); white-space: nowrap; }
.ww-b.ck { background: color-mix(in srgb, var(--c, var(--accent)) 10%, var(--surface)); color: var(--muted); text-decoration: underline wavy color-mix(in srgb, var(--bad) 70%, transparent); text-underline-offset: 3px; }
.ww-b.empty { min-width: 46px; background: transparent; border: 1px dashed var(--line); border-bottom-width: 1px; }
.ww-more { font-size: 12px; color: var(--muted); align-self: center; padding: 0 4px; }
.ww-note { font-size: 12.5px; color: var(--muted); }

/* End of a class or session: keep going? */
.ce-more { margin-top: 16px; display: grid; gap: 8px; }
.ce-q { font-weight: 800; font-size: 15px; text-align: center; margin-bottom: 2px; }
.ce-done { background: transparent; box-shadow: none; color: var(--muted); }
/* One slim row: it scrolls sideways, fading out at the edge */
.ww-strip { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); padding-right: 24px; }
.ww-strip::-webkit-scrollbar { display: none; }
.ww-b, .ww-more { flex: none; }

/* Back a card in a lesson */
.ls-back { width: 30px; height: 30px; margin-right: 2px; border-radius: 50%; display: grid; place-items: center; font-size: 22px; line-height: 1; color: var(--muted); background: var(--surface3); flex: none; }
/* The word wall wraps again (no sideways scrolling); about two rows at most */
.ww-strip { flex-wrap: wrap; overflow: visible; -webkit-mask-image: none; mask-image: none; padding-right: 0; }

/* Play's top bar: today's bricks toward the daily goal (tap: the whole wall) */
.hud-wall { flex: 1; min-width: 0; display: grid; grid-template-columns: repeat(20, 1fr); gap: 1.5px; height: 12px; padding: 0; background: none; }
.hud-wall .wb { height: 100%; width: auto; border-radius: 2px; margin: 0; }
.hud-wall .wb.hole { background: color-mix(in srgb, var(--text) 10%, transparent); box-shadow: none; }
.stage-hud { flex: 1; min-width: 0; }
/* The wall inside the feedback card */
.fb-wall { margin-top: 10px; }
.fb-wall .twall { box-shadow: none; background: color-mix(in srgb, var(--surface) 70%, transparent); padding: 8px 10px 10px; }
.hud-wall { display: grid !important; width: 100%; max-width: 260px; overflow: hidden; }
.hud-wall .wb { aspect-ratio: auto; width: 100%; height: 100%; box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.18); }
/* The top bar shares the header with the title: the bricks get the larger share. */
.stage-top .stage-title { flex: 0 1 auto; max-width: 38%; }
.stage-top .stage-hud { flex: 1 1 0; }
.hud-wall { min-width: 80px; }
.hud-wall { display: flex !important; gap: 1.5px; align-items: stretch; }
.hud-wall .wb { flex: 1 1 0; min-width: 0; width: auto; }
.stage-hud .lv, .stage-hud .goal { white-space: nowrap; flex: none; }
.stage-top { gap: 10px; }
.hud-wall { min-width: 36px; }

/* Feedback (✎) */
.stage-fb, .top-fb { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 16px; background: var(--surface3); color: var(--muted); flex: none; }
.fbk-text { width: 100%; box-sizing: border-box; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); padding: 10px 12px; font: inherit; font-size: 16px; resize: vertical; }
.fbk-text.fbk-need { border-color: var(--bad); }
.fbk-ctx { margin: 8px 0 2px; font-size: 13px; color: var(--muted); line-height: 1.4; }

/* Cheatsheet (📒) */
.cs-peek { font-size: 13px; color: var(--muted); margin: 0 0 8px; }
.cs-nav { display: flex; gap: 8px; margin-bottom: 6px; position: sticky; top: 0; z-index: 1; background: var(--surface); padding: 4px 0 8px; }
.cs-nav a { font-size: 13px; font-weight: 750; padding: 6px 10px; border-radius: 14px; background: var(--surface3); color: var(--text); text-decoration: none; }
.cs-rule { padding: 10px 0; border-bottom: 0.5px solid var(--line); }
.cs-rule.locked { opacity: 0.5; }
.cs-shift { display: flex; align-items: baseline; gap: 8px; font-size: 18px; font-weight: 850; }
.cs-shift small { margin-left: auto; font-size: 12px; font-weight: 650; color: var(--muted); }
.cs-line { font-size: 14px; margin: 2px 0 6px; }
.cs-pairs { display: flex; flex-wrap: wrap; gap: 4px; }
.cs-pair { font-size: 13px; padding: 4px 8px; border-radius: 8px; background: var(--surface2); border: 0.5px solid var(--line); }
.cs-pair .en { color: var(--muted); }
.cs-verb { padding: 8px 0; border-bottom: 0.5px solid var(--line); }
.cs-vh { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.cs-vh small { color: var(--muted); font-size: 12.5px; }
.cs-forms { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 4px; }
.cs-form { display: flex; flex-direction: column; align-items: flex-start; padding: 6px 8px; border-radius: 8px; background: var(--surface2); border: 0.5px solid var(--line); text-align: left; }
.cs-form small { font-size: 11px; color: var(--muted); }
.cs-chart { margin-top: 10px; }
.cs-bp { padding: 8px 0; border-bottom: 0.5px solid var(--line); font-size: 14px; }
.cs-test { color: var(--muted); font-size: 13px; margin-top: 2px; }
.top-stats .streak, .top-stats .bricks { white-space: nowrap; }

/* "I know this": the quick test-out (Lessons list, a new lesson's first card, the result) */
.lsn-go .lsn-know { background: transparent; border: 1px solid var(--line); color: var(--text); }
.ls-testout { display: block; margin: 6px auto 0; font-size: 13.5px; text-decoration: underline; text-underline-offset: 3px; }
.testout-end .ce-more { width: 100%; max-width: 360px; }
.testout-end .fd-title { margin-top: 6px; }
.fbk { padding-top: 8px; } /* room for the text box's top edge and focus glow (the panel clips at its top) */

/* This copy of the game fell behind another tab: reload */
.stale-bar { position: fixed; left: 50%; bottom: calc(var(--sab, 0px) + 84px); transform: translateX(-50%); z-index: 400; width: min(420px, calc(100% - 32px)); padding: 12px 16px; border-radius: 14px; background: var(--accent); color: var(--accent-text); font-weight: 750; font-size: 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25); }

/* ================= Quests (js/quests/ui.js): the log on Town, sheets, moments, map markers ================= */
.quest-log[hidden] { display: none; }
.ql { margin: 12px 16px 0; }
.ql-card { display: block; padding: 14px 14px 12px; border-radius: 20px; background: var(--surface); box-shadow: var(--card-shadow); text-align: left; cursor: pointer; border: 2px solid transparent; }
.ql-card.new { border-color: color-mix(in srgb, var(--accent2) 70%, transparent); }
.ql-card.ready { border-color: color-mix(in srgb, var(--good) 70%, transparent); }
.ql-top { display: flex; align-items: center; gap: 12px; }
.ql-face { position: relative; flex: none; line-height: 0; }
.ql-mark { position: absolute; top: -5px; right: -7px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; display: grid; place-items: center; font: 900 13px/1 var(--font); box-shadow: 0 0 0 2px var(--surface); }
.ql-mark.x { background: var(--accent2); color: var(--accent2-text); }
.ql-mark.q { background: var(--good); color: var(--good-text); }
.ql-tt { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ql-tt small { font-size: 11.5px; font-weight: 750; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.ql-tt b { font-size: 18px; line-height: 1.2; }
.ql-tt .ql-from { text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--text-soft); font-weight: 650; }
.ql-line { margin: 10px 0 4px; }
.ql-say { display: inline-flex; align-items: baseline; gap: 6px; max-width: 100%; padding: 7px 11px; border-radius: 14px 14px 14px 4px; background: var(--surface3); text-align: left; font-size: 15.5px; font-weight: 650; color: var(--text); }
.ql-say .ql-es { min-width: 0; }
.ql-spk { flex: none; font-size: 12px; opacity: 0.6; }
.ql-en { margin: 4px 2px 0; font-size: 13px; color: var(--muted); }
.ql-objs, .qm-objs, .qs-objs { display: flex; flex-direction: column; gap: 6px; margin: 10px 0 2px; }
.ql-obj { display: flex; align-items: center; gap: 8px; font-size: 14px; min-width: 0; }
.ql-check { flex: none; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--ghost); display: grid; place-items: center; font-size: 11px; font-weight: 900; color: var(--good-text); }
.ql-obj.done .ql-check { background: var(--good); border-color: var(--good); }
.ql-obj.done .ql-ol { color: var(--muted); }
.ql-ol { flex: 1; min-width: 0; }
.ql-bar { flex: none; width: 64px; height: 6px; border-radius: 3px; background: var(--track); overflow: hidden; }
.ql-bar i { display: block; height: 100%; background: var(--good); transition: width 0.4s var(--ease-out); }
.ql-obj small { flex: none; min-width: 30px; text-align: right; font-size: 12px; font-weight: 750; color: var(--muted); }
.ql-rews { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 2px; }
.ql-rew { padding: 3px 9px; border-radius: 10px; font-size: 12.5px; font-weight: 700; background: color-mix(in srgb, var(--accent2) 16%, transparent); color: var(--text-soft); }
.ql-rew.hearts { background: color-mix(in srgb, #E0577A 14%, transparent); }
.ql-card .ql-go { margin-top: 12px; }
.ql-town { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 10px 4px 0; font-size: 12.5px; color: var(--muted); font-weight: 650; }
.ql-hearts i { font-style: normal; color: #E0577A; letter-spacing: -1px; }
.ql-dtitle { font-size: 12px; font-weight: 750; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin: 14px 2px 8px; }
.ql-dlist { display: flex; flex-direction: column; gap: 6px; }
.ql-drow { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 14px; background: var(--surface); box-shadow: var(--card-shadow); cursor: pointer; }
.ql-drow.ready { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--good) 60%, transparent), var(--card-shadow); }
.ql-drow.handed { opacity: 0.62; }
.ql-dt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ql-dt b { font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ql-dt small { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ql-dt .ql-bar { width: 100%; height: 4px; margin-top: 3px; }
.ql-drow .btn { flex: none; height: 36px; padding: 0 12px; border-radius: 12px; font-size: 13.5px; }
.ql-dok { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--good); color: var(--good-text); font-weight: 900; }
.ql-noface { display: inline-grid; place-items: center; font-size: calc(var(--av) * 0.6); }
/* A quest's sheet */
.qs { padding-bottom: 12px; }
.qs-who { display: flex; align-items: center; gap: 12px; }
.qs-who > div { display: flex; flex-direction: column; }
.qs-who b { font-size: 18px; }
.qs-who small { color: var(--muted); font-size: 13px; }
.qs-kicker { margin: 12px 0 6px; font-size: 12px; font-weight: 750; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.qs-orow { display: flex; align-items: center; gap: 8px; }
.qs-orow .ql-obj { flex: 1; }
.qs-orow .btn { flex: none; height: 34px; padding: 0 12px; border-radius: 11px; font-size: 13px; }
.qs .qs-act { margin-top: 16px; }
.qs-note { margin-top: 8px; text-align: center; }
/* The offer, hand-in and welcome moments (in the modal) */
.qm { text-align: center; }
.qm-who { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 4px 0 10px; }
.qm-who b { font-size: 17px; }
.qm-who small { color: var(--muted); font-size: 13px; }
.qm-done .qm-who .av { animation: qm-pop 0.6s var(--spring); }
@keyframes qm-pop { from { transform: scale(0.4) rotate(-8deg); opacity: 0; } to { transform: none; opacity: 1; } }
.qm-line { margin-bottom: 6px; }
.qm .ql-say { font-size: 17px; }
.qm-objs, .qm .ql-rews { text-align: left; justify-content: center; }
.qm-objs { max-width: 300px; margin-left: auto; margin-right: auto; }
.qm-got { margin-top: 6px; }
.qm-got .ql-got.hearts span { color: #E0577A; }
.qm-next { margin: 12px 0 2px; font-size: 14px; color: var(--muted); }
.qm .ql-town { justify-content: center; }
.qm p { margin: 0 0 8px; }
/* Pueblo map markers */
.tv-quests { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.tv-qm { position: absolute; left: 0; top: 0; pointer-events: auto; display: flex; flex-direction: column; align-items: center; gap: 0; padding: 0; background: none; line-height: 0; }
.tv-qm b { order: -1; margin-bottom: 3px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 11px; display: grid; place-items: center; font: 900 15px/1 var(--font); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3); animation: tv-qm-bob 1.6s ease-in-out infinite; }
.tv-qm.x b { background: var(--accent2); color: var(--accent2-text); }
.tv-qm.q b { background: var(--good); color: var(--good-text); }
.tv-qm .av { box-shadow: 0 0 0 2px #fff, 0 3px 8px rgba(0, 0, 0, 0.3); }
@keyframes tv-qm-bob { 50% { transform: translateY(-4px); } }
.reduce-motion .tv-qm b, .reduce-motion .qm-done .qm-who .av { animation: none; }
/* A long quest line never pushes the modal's buttons off a short screen: the middle scrolls. */
.qm { max-height: calc(100dvh - 290px); overflow-y: auto; overscroll-behavior: contain; }
@media (max-height: 700px) {
  .qm-who .av { width: 52px; height: 52px; }
  .qm-who { margin-bottom: 6px; }
}
/* Phones: the quest card stays compact so Quick Play isn't far below it (the full story is in the sheet). */
@media (max-width: 520px) {
  .ql-card .ql-en { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .ql-objs { gap: 4px; margin-top: 8px; }
  .ql-rews { margin-top: 8px; }
  .ql-card .ql-go { margin-top: 10px; }
}

/* Play: a quest just got everything it needs (quests/ui.js playBanner). */
.qp-banner {
  position: absolute; z-index: 60; left: 12px; right: 12px; top: calc(var(--sat, 0px) + 64px);
  max-width: 560px; margin: 0 auto;
  display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 12px;
  border-radius: 18px; background: var(--surface); box-shadow: var(--card-shadow), 0 0 0 2px color-mix(in srgb, var(--good) 65%, transparent);
  animation: qpIn .45s var(--spring) both;
}
.qp-banner.out { animation: qpOut .25s ease both; }
.qp-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.qp-t b { font-size: 16px; color: var(--good); }
.qp-t small { font-size: 13px; color: var(--text-soft, var(--muted)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qp-go { flex: none; min-height: 40px; padding: 0 14px; }
.qp-x { flex: none; width: 32px; height: 32px; border-radius: 50%; color: var(--muted); font-size: 15px; }
@keyframes qpIn { from { opacity: 0; transform: translateY(-14px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes qpOut { to { opacity: 0; transform: translateY(-10px); } }

/* Settings: the legal pages and the contact address. */
.legal-links a { color: inherit; text-underline-offset: 3px; }

/* ---------- The restored plaza (quests/restore-art.js) ---------- */
.rs {
  --rs-sky1: #9CCBE3; --rs-sky2: #E8F2F3; --rs-hill: #B9D2B0; --rs-ground: #DCCFB6; --rs-cobble: #C2B193; --rs-rubble: #A99C86;
  --rs-cafe: #E9A574; --rs-roof: #8A3F2B; --rs-trim: #6B3A26; --rs-door: #8B5A3C; --rs-board: #A88457; --rs-board-ink: #2F3B35;
  --rs-glass: #CFE6EE; --rs-grime: #8E8676; --rs-smudge: #6F685A; --rs-glow: #FFD98A; --rs-open: #2E9E6A;
  --rs-bakery: #F3DFBC; --rs-awning: #D9534F; --rs-awning2: #FFF4E6; --rs-bread: #C98A45;
  --rs-dust: #A39B8E; --rs-dust2: #8E877C; --rs-shadow: #4A3B30; --rs-cup: #FFF7EC;
  --rs-flower: #E25D7B; --rs-flower2: #F2B33D; --rs-leaf: #4E9A5B; --rs-bulb: #FFE08A;
  --rs-doghouse: #C0563B; --rs-coco: #B07A45; --rs-coco2: #7A5230;
  --rs-fence: #FAF7F0; --rs-broken: #94897A; --rs-stone: #D5CCBE; --rs-stone2: #B9AE9E; --rs-water: #6FC0E3; --rs-dry: #A99E8C; --rs-crack: #6F6556;
  --rs-skin: #E8B98F; --rs-shirt1: #2F7FB0; --rs-shirt2: #E07BA0; --rs-shirt3: #5FA84A; --rs-bird: #4A5566;
  --rs-dustcoat: #8A8478; --rs-fogc: #EEF1F3;
  display: block; width: 100%; height: auto; border-radius: 18px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .rs { --rs-sky1: #1E2D48; --rs-sky2: #46506A; --rs-hill: #2E4A45; --rs-ground: #6E6656; --rs-cobble: #5C5546; --rs-glass: #5D7487; --rs-fogc: #9AA6B6; --rs-bird: #C9D3E0; }
}
.rs-t { font-family: var(--font); font-weight: 900; letter-spacing: .06em; fill: #FFF4E6; }
.rs-t.rs-lit { fill: #FFE08A; filter: drop-shadow(0 0 2px #FFD98A); }
.rs-t.rs-faded { fill-opacity: .35; }
.rs-fog { fill: var(--rs-fogc); opacity: var(--fog); animation: rsFog 1.6s ease .35s both; }
@keyframes rsFog { from { opacity: var(--fog-from); } to { opacity: var(--fog); } }
.rs-steam path { stroke: #fff; stroke-opacity: .75; stroke-width: 1.6; fill: none; stroke-linecap: round; animation: rsSteam 2.4s ease-in-out infinite; }
.rs-steam path + path { animation-delay: 1.1s; }
@keyframes rsSteam { 0% { opacity: 0; transform: translateY(4px); } 40% { opacity: 1; } 100% { opacity: 0; transform: translateY(-8px); } }
.rs-smoke circle { fill: #D8D4CC; opacity: .7; animation: rsSmoke 3s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.rs-smoke circle:nth-child(2) { animation-delay: .9s; } .rs-smoke circle:nth-child(3) { animation-delay: 1.8s; }
@keyframes rsSmoke { 0% { opacity: 0; transform: translateY(6px) scale(.6); } 40% { opacity: .75; } 100% { opacity: 0; transform: translateY(-10px) scale(1.2); } }
.rs-bulb { animation: rsBulb 2.2s ease-in-out infinite alternate; }
@keyframes rsBulb { from { opacity: .45; } to { opacity: 1; } }
.rs-jet path { stroke-dasharray: 4 4; animation: rsJet .6s linear infinite; }
@keyframes rsJet { to { stroke-dashoffset: -8; } }
.rs-coco { animation: rsPeek 4s ease-in-out infinite; }
@keyframes rsPeek { 0%, 70%, 100% { transform: translateY(0); } 80%, 90% { transform: translateY(-3px); } }
/* A piece that just came back: it pops in after a beat, with sparkles (restore-art.js sparkle). */
.rs-new { animation: rsNew .7s cubic-bezier(.34, 1.56, .64, 1) .35s both; transform-box: fill-box; transform-origin: center bottom; }
@keyframes rsNew { from { opacity: 0; transform: scale(.4) translateY(10px); } to { opacity: 1; transform: none; } }
.rs-gone { animation: rsGone .8s ease-in both; transform-box: fill-box; transform-origin: center; pointer-events: none; }
@keyframes rsGone { 0% { opacity: 1; } 30% { opacity: 1; transform: translateY(-2px) rotate(-3deg); } 100% { opacity: 0; transform: translateY(16px) rotate(8deg); } }
.rs-was-dust { animation: rsWasDust 1.1s ease .35s both; }
@keyframes rsWasDust { from { fill: var(--rs-dust); } }
.rs-was-grime { animation: rsWasGrime 1.1s ease .35s both; }
@keyframes rsWasGrime { from { fill: var(--rs-grime); } }
.rs-spark { fill: #FFE08A; transform: translate(var(--sx), var(--sy)) scale(0); animation: rsSpark .9s ease-out both; }
@keyframes rsSpark { 0% { opacity: 0; transform: translate(var(--sx), var(--sy)) scale(.2); } 30% { opacity: 1; } 100% { opacity: 0; transform: translate(calc(var(--sx) + var(--dx)), calc(var(--sy) + var(--dy))) scale(1.1) rotate(60deg); } }
@media (prefers-reduced-motion: reduce) { .rs * { animation: none !important; } .rs-fog { opacity: var(--fog); } .rs-spark { display: none; } }
/* Town: the restored plaza card, its full view, and the hand-in picture. */
.rs-card { display: block; width: 100%; margin: 12px 0 2px; padding: 0; border-radius: 20px; overflow: hidden; background: var(--surface); box-shadow: var(--card-shadow); text-align: left; }
.rs-card .rs { border-radius: 0; }
.rs-cap { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 10px; padding: 10px 14px 12px; }
.rs-cap b { font-size: 15.5px; }
.rs-cap small { color: var(--muted); font-size: 13px; font-weight: 650; }
.rs-bar { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--track); overflow: hidden; }
.rs-bar i { display: block; height: 100%; background: var(--accent2); }
.rs-sheet .rs { margin-bottom: 14px; }
.rs-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.rs-list li { display: flex; gap: 10px; align-items: flex-start; }
.rs-list li span:last-child { display: flex; flex-direction: column; gap: 1px; }
.rs-list b { font-size: 15px; font-weight: 700; }
.rs-list small { color: var(--muted); font-size: 13px; }
.rs-list li:not(.done) b { color: var(--muted); }
.rs-chk { flex: none; width: 20px; height: 20px; margin-top: 1px; border-radius: 50%; border: 2px solid var(--ghost); display: grid; place-items: center; font-size: 11px; font-weight: 900; color: var(--good-text); }
.rs-list li.done .rs-chk { background: var(--good); border-color: var(--good); }
.rs-list li { align-items: center; }
.rs-list li > span:nth-child(2) { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.rs-list li[data-pq] { cursor: pointer; }
.rs-list li.q-now:not(.done) b, .rs-list li.q-ready:not(.done) b { color: inherit; }
.rs-list li.q-now .rs-chk, .rs-list li.q-ready .rs-chk { border-color: var(--accent2); }
.rs-list li.q-later .rs-chk { border-color: transparent; opacity: .7; }
.rs-list li.q-later { opacity: .75; }
.qm-pic { margin: -4px -4px 12px; }
.qm-pic .rs { border-radius: 16px; }
.qm.has-pic .qm-who { flex-direction: row; gap: 10px; justify-content: center; }

/* ---------- La Fábrica de Palabras (wordrules.js) ---------- */
.wf { max-width: 520px; margin: 0 auto; padding: 18px 16px 24px; text-align: center; }
.wf h2 { margin: 6px 0 8px; font-size: 26px; line-height: 1.15; }
.wf-hero { font-size: 52px; line-height: 1; margin-top: 10px; }
.wf-sub { margin: 0 0 18px; color: var(--text-soft, var(--muted)); font-size: 15.5px; line-height: 1.45; }
.wf-k { font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.wf-rules { display: grid; gap: 8px; margin: 0 0 18px; text-align: left; }
.wf-rule { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 14px; background: var(--surface); box-shadow: var(--card-shadow); }
.wf-shift { flex: 1; display: flex; align-items: baseline; gap: 8px; font-size: 17px; }
.wf-shift span { color: var(--muted); font-weight: 700; }
.wf-shift i { font-style: normal; color: var(--muted); }
.wf-shift b { font-weight: 850; color: var(--accent); }
.wf-rule small { font-size: 12.5px; font-weight: 750; color: var(--muted); }
.wf-st { padding: 2px 8px; border-radius: 9px; background: var(--surface3); }
.wf-st.new { background: color-mix(in srgb, var(--accent2) 22%, transparent); color: var(--text); }
.wf-st.strong { background: color-mix(in srgb, var(--good) 20%, transparent); color: var(--text); }
.wf-st.fading { background: color-mix(in srgb, var(--accent2) 30%, transparent); color: var(--text); }
.wf-st.cracked { background: color-mix(in srgb, var(--bad) 20%, transparent); color: var(--text); }
.wf-more { margin: -8px 0 14px; }
.wf-word { margin: 26px 0 24px; font-size: clamp(34px, 10vw, 52px); font-weight: 850; letter-spacing: -0.02em; word-break: break-word; }
.wf-word.small { font-size: clamp(30px, 8vw, 42px); margin-bottom: 8px; }
.wf-end, .wf-card .wf-end { color: var(--accent); text-decoration: underline; text-decoration-thickness: 4px; text-underline-offset: 6px; text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.wf-bins { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.wf-bin { position: relative; min-height: 62px; border-radius: 16px; background: var(--tile); color: var(--tile-text); font-size: 22px; font-weight: 850; box-shadow: 0 4px 0 var(--tile-edge); }
.wf-bin kbd { position: absolute; top: 6px; left: 8px; font: 700 10px/1 var(--font); opacity: .55; }
.wf-bin.right { background: var(--good); color: var(--good-text); box-shadow: 0 4px 0 color-mix(in srgb, var(--good) 60%, #000); }
.wf-bin.wrong { background: var(--bad); color: #fff; animation: shake .38s; }
.wf-bin:disabled { cursor: default; }
.wf-fb { min-height: 64px; margin-top: 16px; }
.wf-ans { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-bottom: 12px; }
.wf-ans b { font-size: 24px; }
.wf-ans.ok b { color: var(--good); }
.wf-ans.meh b { color: color-mix(in srgb, var(--accent2) 80%, var(--text)); }
.wf-ans.bad b { color: var(--text); }
.wf-ans span { color: var(--muted); font-weight: 700; font-size: 14px; }
.wf-ans small, .wf-ans ul { color: var(--text-soft, var(--muted)); font-size: 14.5px; line-height: 1.4; }
.wf-ans ul { margin: 6px 0 0; padding-left: 18px; text-align: left; }
.wf-ask { margin: 0 0 10px; color: var(--muted); }
.wf-type { display: flex; gap: 8px; }
.wf-in { flex: 1; min-width: 0; height: 54px; padding: 0 14px; border-radius: 14px; border: 2px solid var(--line, rgba(0,0,0,.12)); background: var(--surface); color: var(--text); font: 700 22px var(--font); }
.wf-in:focus { outline: none; border-color: var(--accent); }
.wf-acc { display: flex; gap: 6px; justify-content: center; margin-top: 10px; }
.wf-ch { width: 40px; height: 40px; border-radius: 10px; background: var(--surface3); font-size: 18px; font-weight: 700; }
.wf-hud { display: flex; align-items: center; gap: 12px; margin: 10px 0 8px; }
.wf-time { flex: 1; height: 8px; border-radius: 4px; background: var(--track); overflow: hidden; }
.wf-time i { display: block; height: 100%; width: 100%; background: var(--accent2); }
.wf-score { font-size: 22px; min-width: 48px; text-align: right; }
.wf-combo { min-width: 44px; font-weight: 800; color: var(--accent2); }
.wf-track { position: relative; height: 96px; margin: 8px -16px 18px; overflow: hidden; background: repeating-linear-gradient(90deg, var(--surface3) 0 18px, color-mix(in srgb, var(--surface3) 60%, var(--bg)) 18px 36px); border-block: 3px solid var(--line, rgba(0,0,0,.12)); }
.wf-card { position: absolute; left: 0; top: 18px; padding: 12px 18px; border-radius: 14px; background: var(--surface); box-shadow: var(--card-shadow); font-size: 26px; font-weight: 850; white-space: nowrap; }
.wf-card.in { opacity: 0; scale: .6; transition: opacity .2s, scale .2s !important; }
.wf-card.miss, .wf-card.fell { opacity: .25; }
.wf-bins.belt { grid-template-columns: repeat(auto-fit, minmax(70px, 1fr)); }
.wf-belt-fb { min-height: 30px; margin-top: 12px; color: var(--muted); font-size: 15px; }
.wf-belt-score { margin: 0 0 16px; color: var(--muted); font-weight: 650; }
.wf-belt-score b { color: var(--text); font-size: 18px; }
.wf-best { color: var(--accent2); font-weight: 850; }
.wf-chips { display: flex; gap: 8px; justify-content: center; margin: 0 0 16px; }
.wf-summary .btn + .btn { margin-top: 8px; }
.cs-drill { margin: 0 0 12px; }
.wf-shift span, .wf-shift b { white-space: nowrap; }
.wf-shift { flex-wrap: wrap; }
/* Word factory: the plan, word choices, "finish now", and the customize screen. */
.wf-plan { margin: 0 0 16px; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; counter-reset: wfp; }
.wf-plan li { counter-increment: wfp; padding: 5px 10px; border-radius: 10px; background: var(--surface3); font-size: 13.5px; font-weight: 700; }
.wf-plan li::before { content: counter(wfp) '. '; color: var(--muted); }
.wf-bins.wide { grid-template-columns: 1fr; }
.wf-bins.wide .wf-bin { font-size: 21px; min-height: 54px; }

.wf-cust { text-align: left; }
.wf-cust h2, .wf-cust > .wf-sub { text-align: center; }
.wf-modes { display: grid; gap: 8px; }
.wf-mode { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: var(--surface); box-shadow: var(--card-shadow); opacity: .62; cursor: pointer; }
.wf-mode.on { opacity: 1; box-shadow: var(--card-shadow), 0 0 0 2px color-mix(in srgb, var(--accent) 50%, transparent); }
.wf-mode input { width: 20px; height: 20px; flex: none; accent-color: var(--accent); }
.wf-mt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.wf-mt b { font-size: 15px; }
.wf-mt small { color: var(--muted); font-size: 12.5px; line-height: 1.3; }
.wf-len { flex: none; display: flex; align-items: center; gap: 4px; }
.wf-len b { min-width: 30px; text-align: center; font-size: 17px; }
.wf-len small { margin-left: -3px; color: var(--muted); font-weight: 700; }
.wf-minus, .wf-plus { width: 30px; height: 30px; border-radius: 9px; background: var(--surface3); font-size: 18px; font-weight: 800; }
.wf-h3 { margin: 18px 0 8px; font-size: 15px; }
.wf-pick { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.wf-chip { padding: 7px 11px; border-radius: 12px; background: var(--surface3); font-size: 13.5px; font-weight: 700; }
.wf-chip.on { background: var(--accent); color: var(--accent-text); }
.wf-cust .btn + .btn { margin-top: 8px; }
.wf-cust .link-btn { display: block; margin: 12px auto 0; }
.wf .wf-custom { display: block; margin: 12px auto 0; color: var(--muted); }
/* The plaza's decorations (act1-places.js DECOR) and cracked pieces (restore-art.js markCracks). */
.rs { --rs-trunk: #7A5230; --rs-olive: #8FA463; --rs-leaf2: #4E9A5B; --rs-iron: #3E4552; --rs-pot: #C0563B; --rs-castle: #B9B2A6; }
.rs-lampglow { opacity: .55; }
.rs-cracked { filter: saturate(.25) brightness(.9); }
.rs-crk { fill: none; stroke: #3B2A20; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; opacity: .8; }

/* ---------- Mi Pueblo (mipueblo.js) ---------- */
.mp { padding: 12px 16px 28px; max-width: 760px; margin: 0 auto; }
.mp-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 4px 2px 12px; }
.mp-head h2 { margin: 0; font-size: 24px; }
.mp-head small { color: var(--muted); font-weight: 650; font-size: 13px; }
.mp-wallet { padding: 6px 12px; border-radius: 14px; background: var(--surface); box-shadow: var(--card-shadow); font-weight: 800; white-space: nowrap; }
.mp-wallet.big { display: flex; align-items: baseline; gap: 8px; margin: 12px 0; font-size: 18px; box-shadow: none; background: var(--surface3); }
.mp-wallet.big small { font-size: 12.5px; color: var(--muted); font-weight: 650; }
.mp-map { position: relative; border-radius: 20px; overflow: hidden; box-shadow: var(--card-shadow); }
.mp-map .rs { border-radius: 0; }
.mp-hot { position: absolute; border-radius: 14px; background: transparent; }
.mp-hot:active, .mp-hot:focus-visible { background: color-mix(in srgb, #fff 18%, transparent); outline: 2px solid color-mix(in srgb, var(--accent) 60%, transparent); }
.mp-b { position: absolute; top: -2px; right: -2px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; display: grid; place-items: center; font: 900 12.5px/1 var(--font); box-shadow: 0 0 0 2px var(--surface); }
.mp-b.crack { background: var(--bad); color: #fff; }
.mp-b.q { background: var(--accent2); color: var(--accent2-text); right: 24px; }
.mp-b.q.ready { background: var(--good); color: var(--good-text); }
.mp-b.crack + .mp-b.q { right: 24px; }
.mp-b.q:first-child { right: -2px; }
.mp-tip { margin: 10px 4px 14px; color: var(--muted); font-size: 13.5px; }
.mp-places { display: grid; gap: 8px; }
.mp-place { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 16px; background: var(--surface); box-shadow: var(--card-shadow); text-align: left; }
.mp-face { flex: none; line-height: 0; }
.mp-pt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.mp-pt b { font-size: 15.5px; }
.mp-pt small { color: var(--muted); font-size: 12.5px; font-weight: 650; }
.mp-crk { font-style: normal; color: var(--bad); }
.mp-bar { display: block; height: 6px; border-radius: 3px; background: var(--track); overflow: hidden; }
.mp-bar i { display: block; height: 100%; background: var(--accent2); }
.mp-go { color: var(--muted); font-size: 22px; }
.mp-h3 { margin: 20px 4px 8px; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.mp-fog { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mp-quarter { padding: 14px; border-radius: 16px; background: repeating-linear-gradient(135deg, var(--surface3) 0 10px, color-mix(in srgb, var(--surface3) 60%, var(--bg)) 10px 20px); color: var(--muted); display: flex; flex-direction: column; gap: 2px; }
.mp-quarter b { color: var(--text-soft, var(--muted)); }
.mp-quarter small { font-size: 12.5px; }
/* Mi Pueblo's quarters: the switch at the top, a quarter still under fog, Calle Estar's fog tag. */
.mp-seg { margin: 0 0 10px; }
.mp-seg button { font-size: 13.5px; }
.mp-lock { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center; background: color-mix(in srgb, var(--surface) 30%, transparent); }
.mp-lock b { padding: 6px 14px; border-radius: 14px; background: var(--surface); box-shadow: var(--card-shadow); font-size: 15px; }
.mp-lock small { color: var(--text-soft, var(--muted)); font-weight: 700; font-size: 13px; }
.mp-fogtag { position: absolute; transform: translate(-50%, -50%); padding: 4px 10px; border-radius: 12px; background: color-mix(in srgb, var(--surface) 85%, transparent); color: var(--muted); font-weight: 800; font-size: 12.5px; white-space: nowrap; pointer-events: none; }
.mp-sheet .mp-pic { border-radius: 16px; overflow: hidden; margin-bottom: 10px; }
.mp-sheet .mp-pic .rs { border-radius: 0; }
.mp-prog { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.mp-prog small { color: var(--muted); font-weight: 650; font-size: 13px; }
.mp-alert { display: flex; flex-direction: column; gap: 2px; margin: 0 0 10px; padding: 10px 12px; border-radius: 14px; background: color-mix(in srgb, var(--bad) 12%, var(--surface)); }
.mp-alert span { color: var(--text-soft, var(--muted)); font-size: 13.5px; }
.mp-pieces { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.mp-pieces li { display: flex; align-items: center; gap: 10px; }
.mp-chk { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--ghost); display: grid; place-items: center; font-size: 12px; font-weight: 900; }
.mp-pieces li.back .mp-chk { background: var(--good); border-color: var(--good); color: var(--good-text); }
.mp-pieces li.crk .mp-chk { background: var(--bad); border-color: var(--bad); color: #fff; }
.mp-pl { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.mp-pl b { font-size: 14.5px; }
.mp-pl small { color: var(--muted); font-size: 12.5px; }
.mp-pieces li:not(.back):not(.crk) b { color: var(--muted); }
.mp-fix { flex: none; min-height: 34px; padding: 0 12px; font-size: 14px; }
.mp-pieces li[data-pq] { cursor: pointer; }
.mp-pieces li.q-now:not(.back):not(.crk) b, .mp-pieces li.q-ready:not(.back):not(.crk) b { color: inherit; }
.mp-pieces li.q-now .mp-chk, .mp-pieces li.q-ready .mp-chk { border-color: var(--accent2); }
.mp-pieces li.q-later .mp-chk { border-color: transparent; font-size: 13px; opacity: .7; }
.mp-pieces li.q-later { opacity: .75; }
.mp-who { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line, rgba(0,0,0,.08)); }
.mp-wt { flex: 1; display: flex; flex-direction: column; gap: 1px; }
.mp-hearts { color: #E0577A; letter-spacing: 1px; }
.mp-quest { display: grid; grid-template-columns: auto 1fr; gap: 0 10px; align-items: center; width: 100%; margin: 4px 0 12px; padding: 10px 12px; border-radius: 14px; background: var(--surface3); text-align: left; }
.mp-quest span { grid-row: span 2; width: 24px; height: 24px; border-radius: 12px; display: grid; place-items: center; background: var(--accent2); color: var(--accent2-text); font-weight: 900; }
.mp-quest small { color: var(--muted); font-size: 12.5px; }
.mp-slot h4 { margin: 14px 2px 6px; font-size: 14px; }
.mp-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.mp-item { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 14px; background: var(--surface); box-shadow: var(--card-shadow); text-align: left; }
.mp-item b { font-size: 14px; }
.mp-item small { color: var(--muted); font-size: 12.5px; font-weight: 650; }
.mp-item.placed { box-shadow: var(--card-shadow), 0 0 0 2px var(--good); }
.mp-item.placed small { color: var(--good); }
.mp-item.locked { opacity: .55; }
.mp-item.none { background: var(--surface3); box-shadow: none; }
.mp-sw { width: 100%; height: 10px; border-radius: 5px; margin-bottom: 4px; }
.mp-decor .mp-back { margin-top: 16px; }

/* Decorate: the picture stays pinned while you try things on (mipueblo.js decorate). */
.mp-decor .mp-stick { position: sticky; top: 0; z-index: 3; margin-bottom: 8px; box-shadow: 0 6px 14px -10px rgba(0,0,0,.35); background: var(--surface); }
.mp-decor .mp-stick svg { width: 100%; height: auto; max-height: min(34vh, 260px); }
.mp-try { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; padding: 10px 12px; border-radius: 14px; background: color-mix(in srgb, var(--accent) 10%, var(--surface)); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 40%, transparent); }
.mp-try[hidden] { display: none; }
.mp-tt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.mp-tt small { color: var(--muted); font-size: 12px; font-weight: 650; }
.mp-tt b { font-size: 15.5px; }
.mp-why { font-size: 13px; font-weight: 750; color: var(--muted); }
.mp-buy { flex: none; min-height: 40px; padding: 0 14px; }
.mp-x { flex: none; width: 32px; height: 32px; border-radius: 50%; color: var(--muted); }
.mp-item.trying { box-shadow: var(--card-shadow), 0 0 0 2px var(--accent); }
.mp-item.locked { opacity: .7; }

/* Mi Pueblo's Repair: the end of a focused repair run (play.js fixDone). */
.fix-done { max-width: 480px; margin: 0 auto; padding: 18px 16px 24px; text-align: center; }
.fix-pic { border-radius: 18px; overflow: hidden; margin-bottom: 14px; box-shadow: var(--card-shadow); }
.fix-pic .rs { border-radius: 0; }
.fix-done .fd-title { font-size: 26px; font-weight: 850; margin-bottom: 6px; }
.fix-done .fd-sub { margin: 0 0 18px; color: var(--text-soft, var(--muted)); font-size: 15.5px; }
.fix-done .btn + .btn { margin-top: 8px; }

/* ---------- Scenarios (scenarios/stage.js) ---------- */
.sc-start { max-width: 520px; margin: 0 auto; padding: 14px 16px 24px; text-align: center; }
.sc-start h2 { margin: 6px 0 10px; font-size: 25px; }
.sc-start .who-strip { justify-content: center; margin-bottom: 10px; }
.sc-pic { border-radius: 18px; overflow: hidden; margin-bottom: 12px; box-shadow: var(--card-shadow); }
.sc-pic .rs, .sc-strip .rs { border-radius: 0; }
.sc-goal { margin: 0 0 16px; color: var(--text-soft, var(--muted)); font-size: 15.5px; line-height: 1.45; }
.sc .sc-strip { position: sticky; top: 0; z-index: 2; margin: -4px -4px 10px; border-radius: 0 0 16px 16px; overflow: hidden; box-shadow: 0 6px 14px -10px rgba(0,0,0,.35); }
.sc .sc-strip svg { display: block; width: 100%; height: auto; max-height: 22vh; }
.sc-narr { margin: 10px 8px; color: var(--muted); font-style: italic; font-size: 14.5px; text-align: center; }
.sc-narr.you { color: var(--text-soft, var(--muted)); }
.sc-acts { display: grid; gap: 8px; }
.sc-act { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; background: var(--surface); box-shadow: var(--card-shadow); text-align: left; font-size: 15.5px; }
.sc-act span { font-size: 20px; }
.sc-hear { margin-bottom: 8px; }
.sc-end { text-align: center; padding: 12px 4px 20px; }
.sc-end .fd-title { font-size: 24px; font-weight: 850; margin: 4px 0 8px; }
.sc-outs { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 4px 0 12px; }
.sc-outs span { padding: 5px 10px; border-radius: 12px; background: var(--surface3); font-size: 13.5px; font-weight: 700; }

/* Mi Pueblo: stories to play at a place (scenarios). */
.mp-todo-h { margin: 14px 2px 6px; font-size: 14px; }
.mp-todo { display: grid; gap: 8px; margin-bottom: 12px; }
.mp-story { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: var(--surface); box-shadow: var(--card-shadow), 0 0 0 2px color-mix(in srgb, var(--accent2) 45%, transparent); text-align: left; }
.mp-story > span:first-child { font-size: 22px; }
.mp-st { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mp-st b { font-size: 15px; }
.mp-st small { color: var(--muted); font-size: 12.5px; line-height: 1.3; }
.mp-story em { font-style: normal; color: var(--good); font-weight: 900; }
.mp-story.locked { opacity: .6; box-shadow: var(--card-shadow); }

/* Scenarios: type the missing word. */
.sc-type { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; margin: 10px 0 4px; font-size: 19px; font-weight: 650; line-height: 1.6; }
.sc-gap { font: inherit; padding: 2px 8px; border: none; border-bottom: 3px solid var(--accent); border-radius: 8px 8px 0 0; background: var(--surface); color: var(--text); box-shadow: var(--card-shadow); min-width: 4ch; max-width: 100%; text-align: center; }
.sc-gap:focus { outline: none; border-bottom-color: var(--accent2); }
.sc-gap.right { background: var(--good); color: var(--good-text); border-bottom-color: transparent; }
.sc-gap.shown { background: color-mix(in srgb, var(--bad) 18%, var(--tile)); }
.sc-type-en { color: var(--muted); font-size: 14px; margin-bottom: 6px; }
.sc-picks { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0 4px; }
.sc-picks[hidden] { display: none; }
.sc-picks small { flex-basis: 100%; color: var(--muted); font-size: 13px; }
.sc-pick { padding: 8px 14px; border-radius: 12px; background: var(--surface); color: var(--text); box-shadow: var(--card-shadow); border-bottom: 3px solid var(--ghost); font-size: 17px; font-weight: 650; }
.sc-pick:disabled { opacity: .4; box-shadow: none; }
/* Typing: the picture stops sticking to the top, so the keyboard doesn't leave it covering the gap. */
.sc:focus-within .sc-strip { position: relative; }
.rp-turn .sc-check { margin-top: 10px; }
