/* Ancient Paleo Pilgrimage — cozy farm cream/gold/sky */
:root {
  --cream: #f7f0e0;
  --cream-deep: #efe4cc;
  --gold: #c9a227;
  --gold-bright: #e8c547;
  --gold-dim: #a68520;
  --ink: #2c2416;
  --ink-soft: #5c4f3a;
  --sky: #7eb8d4;
  --sky-deep: #4a8fb0;
  --sky-pale: #d4eaf4;
  --soil: #8b6914;
  --leaf: #5a8f5a;
  --leaf-bright: #6fb06f;
  --warn: #b54a3a;
  --panel: rgba(255,252,245,0.94);
  --shadow: 0 8px 28px rgba(44,36,22,0.14);
  --radius: 16px;
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "Cascadia Code", Consolas, monospace;
}
*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; min-height: 100%;
  font-family: "PaleoHeb",var(--font); color: var(--ink);
  background:
    radial-gradient(ellipse 120% 80% at 50% -10%, var(--sky-pale), transparent 55%),
    linear-gradient(180deg, #e8f4fa 0%, var(--cream) 38%, var(--cream-deep) 100%);
  background-attachment: fixed;
}
body { overflow-x: hidden; }
button, .btn {
  font: inherit; cursor: pointer; border: none;
  border-radius: 12px; padding: 0.65rem 1.15rem;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  color: var(--ink); font-weight: 650; letter-spacing: 0.02em;
  box-shadow: 0 3px 0 var(--gold-dim), var(--shadow);
  transition: transform .12s, filter .12s;
}
button:hover, .btn:hover { filter: brightness(1.05); transform: translateY(-1px); }
button:active, .btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--gold-dim); }
button:disabled, .btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; filter: none; }
button.secondary, .btn.secondary {
  background: linear-gradient(180deg, #fff, var(--cream));
  box-shadow: 0 2px 0 #cbb992, var(--shadow);
}
button.ghost, .btn.ghost {
  background: transparent; box-shadow: none; color: var(--ink-soft);
  border: 1.5px solid rgba(44,36,22,0.18);
}
button.danger { background: linear-gradient(180deg, #e87868, var(--warn)); color: #fff; }

.app-shell { max-width: 980px; margin: 0 auto; padding: 12px 14px 88px; min-height: 100vh; position: relative; }

/* Progress ribbon */
.progress-ribbon {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px; margin: -12px -14px 14px;
  background: rgba(247,240,224,0.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(201,162,39,0.35);
}
.progress-ribbon .brand { font-weight: 750; color: var(--soil); font-size: 0.92rem; }
.ribbon-bar {
  flex: 1; min-width: 120px; height: 10px; border-radius: 99px;
  background: rgba(44,36,22,0.1); overflow: hidden;
}
.ribbon-fill {
  height: 100%; width: 0%; border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--leaf-bright));
  transition: width .45s ease;
}
.ribbon-meta { font-size: 0.8rem; color: var(--ink-soft); white-space: nowrap; }
.nav-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.nav-pills button {
  padding: 0.35rem 0.7rem; font-size: 0.78rem; border-radius: 999px;
  box-shadow: none; background: var(--cream-deep);
}
.nav-pills button.active { background: var(--sky); color: #fff; }

.screen { display: none; animation: fadeIn .28s ease; }
.screen.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.panel {
  background: var(--panel); border-radius: var(--radius);
  padding: 1.25rem 1.35rem; box-shadow: var(--shadow);
  border: 1px solid rgba(201,162,39,0.28);
}
.panel h1, .panel h2, .panel h3 { margin: 0 0 0.55rem; color: var(--soil); }
.panel p { margin: 0.4rem 0; line-height: 1.5; color: var(--ink-soft); }

/* Title */
.title-hero {
  text-align: center; padding: 2rem 1rem 1.5rem;
}
.title-hero .ox-mark {
  width: 88px; height: 88px; margin: 0 auto 0.75rem;
  color: var(--gold-dim);
  filter: drop-shadow(0 4px 8px rgba(201,162,39,0.35));
  overflow: hidden;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.title-hero .ox-mark svg {
  width: 72px !important;
  height: 72px !important;
  max-width: 100%;
  max-height: 100%;
  display: block;
}
.title-hero h1 {
  font-size: clamp(1.6rem, 5vw, 2.35rem); margin: 0;
  color: var(--soil); letter-spacing: 0.03em;
}
.title-hero .tagline { font-size: 1.05rem; color: var(--sky-deep); margin: 0.4rem 0 1.2rem; }
.title-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 1rem; }
.credit {
  margin-top: 1.5rem; font-size: 0.78rem; color: var(--ink-soft); text-align: center;
}
.credit a { color: var(--sky-deep); }

/* Overworld map */
.map-grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  margin-top: 1rem;
}
.region-card {
  position: relative; padding: 1rem; border-radius: 14px;
  background: linear-gradient(160deg, #fffef9, var(--cream));
  border: 2px solid rgba(201,162,39,0.4);
  cursor: pointer; transition: transform .15s, border-color .15s;
  text-align: left;
}
.region-card:hover:not(.locked) { transform: translateY(-3px); border-color: var(--gold); }
.region-card.locked { opacity: 0.55; cursor: not-allowed; filter: grayscale(0.35); }
.region-card .region-num {
  display: inline-block; font-size: 0.7rem; font-weight: 700;
  background: var(--sky); color: #fff; padding: 2px 8px; border-radius: 99px; margin-bottom: 6px;
}
.region-card h3 { margin: 0 0 4px; font-size: 1.05rem; color: var(--soil); }
.region-card .letters-range { font-size: 0.82rem; color: var(--ink-soft); }
.region-card .seal-count { margin-top: 8px; font-size: 0.8rem; font-weight: 650; color: var(--leaf); }
.region-card .lock-icon { position: absolute; top: 10px; right: 12px; font-size: 1.1rem; }

.letter-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 10px; margin-top: 1rem;
}
.letter-tile {
  aspect-ratio: 1; border-radius: 12px; padding: 8px;
  background: #fffef8; border: 2px solid rgba(201,162,39,0.35);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer; transition: transform .12s, box-shadow .12s;
  position: relative;
}
.letter-tile:hover { transform: scale(1.04); box-shadow: var(--shadow); }
.letter-tile.sealed { border-color: var(--leaf); background: linear-gradient(180deg, #f3faf3, #e8f5e8); }
.letter-tile.locked-letter { opacity: 0.4; cursor: not-allowed; }
.letter-tile .svg-wrap {
  width: 48px; height: 48px; color: var(--ink); display: flex; align-items: center; justify-content: center;
}
.letter-tile .svg-wrap svg { max-width: 100%; max-height: 100%; width: auto; height: auto; }
.letter-tile .name { font-size: 0.72rem; font-weight: 700; margin-top: 4px; text-align: center; }
.letter-tile .seal-badge {
  position: absolute; top: 4px; right: 6px; font-size: 0.75rem; color: var(--leaf);
}

/* Shrine */
.shrine-layout {
  display: grid; gap: 1rem;
  grid-template-columns: 1fr;
}
@media (min-width: 720px) {
  .shrine-layout { grid-template-columns: 220px 1fr; }
}
.shrine-svg {
  background: linear-gradient(180deg, #fff, var(--sky-pale));
  border-radius: 14px; padding: 1rem;
  display: flex; align-items: center; justify-content: center;
  min-height: 200px; color: var(--ink);
  border: 1px solid rgba(74,143,176,0.3);
}
.shrine-svg svg { max-width: 160px; max-height: 180px; width: 100%; height: auto; }
.fact-grid { display: grid; gap: 8px; }
.fact-row {
  background: rgba(255,255,255,0.7); border-radius: 10px; padding: 0.55rem 0.75rem;
  border-left: 3px solid var(--gold);
}
.fact-row label {
  display: block; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--gold-dim); font-weight: 750; margin-bottom: 2px;
}
.fact-row .val { white-space: pre-wrap; font-size: 0.92rem; color: var(--ink); line-height: 1.4; }
.meanings-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  background: var(--cream-deep); padding: 3px 10px; border-radius: 999px;
  font-size: 0.82rem; border: 1px solid rgba(201,162,39,0.35);
}

/* Quiz / Trial */
.trial-box { margin-top: 1rem; }
.trial-step { font-size: 0.8rem; color: var(--sky-deep); font-weight: 650; margin-bottom: 6px; }
.quiz-prompt { font-size: 1.1rem; font-weight: 650; color: var(--ink); margin: 0.5rem 0 1rem; }
.quiz-options { display: grid; gap: 8px; }
.quiz-options button {
  text-align: left; background: #fff; box-shadow: 0 2px 0 #d4c5a0;
  font-weight: 550; padding: 0.75rem 1rem;
}
.quiz-options button.correct { background: #d4edd4; border: 2px solid var(--leaf); }
.quiz-options button.wrong { background: #f8d4ce; border: 2px solid var(--warn); }
.quiz-feedback { margin-top: 0.75rem; font-weight: 650; min-height: 1.4em; }
.quiz-feedback.ok { color: var(--leaf); }
.quiz-feedback.bad { color: var(--warn); }
.fill-blank {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0.75rem 0;
}
.fill-blank input, .fill-blank select {
  font: inherit; padding: 0.5rem 0.7rem; border-radius: 10px;
  border: 1.5px solid rgba(201,162,39,0.5); background: #fff; min-width: 140px;
}

/* Workshop */
.workshop-list { display: grid; gap: 8px; max-height: 280px; overflow: auto; margin: 0.75rem 0; }
.word-row {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 0.65rem 0.85rem; border-radius: 10px; background: #fffef8;
  border: 1px solid rgba(201,162,39,0.3); cursor: pointer; text-align: left;
}
.word-row:hover { border-color: var(--gold); }
.word-row.crafted { border-color: var(--leaf); background: #f0f8f0; }
.word-row .meta { font-size: 0.78rem; color: var(--ink-soft); }
.assembly {
  display: flex; flex-wrap: wrap; gap: 8px; min-height: 64px; padding: 10px;
  background: var(--sky-pale); border-radius: 12px; margin: 0.75rem 0;
  align-items: center;
}
.slot {
  width: 56px; height: 64px; border-radius: 10px;
  border: 2px dashed rgba(74,143,176,0.55); background: rgba(255,255,255,0.6);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.slot.filled { border-style: solid; border-color: var(--gold); background: #fff; }
.slot .svg-mini { width: 36px; height: 36px; color: var(--ink); }
.slot .svg-mini svg { max-width: 100%; max-height: 100%; }
.tray {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 0.5rem;
}
.tray-tile {
  width: 58px; padding: 6px; border-radius: 10px; background: #fff;
  border: 2px solid rgba(201,162,39,0.45); cursor: grab; text-align: center;
}
.tray-tile.used { opacity: 0.3; pointer-events: none; }
.tray-tile .svg-mini { width: 34px; height: 34px; margin: 0 auto; color: var(--ink); }
.tray-tile .svg-mini svg { max-width: 100%; max-height: 100%; }
.tray-tile .tn { font-size: 0.62rem; font-weight: 700; }
.word-facts {
  margin-top: 1rem; padding: 0.85rem; background: rgba(255,255,255,0.75);
  border-radius: 12px; border: 1px solid rgba(201,162,39,0.25); font-size: 0.9rem;
}
.word-facts .label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--gold-dim); font-weight: 750; }
.word-facts .block { margin-bottom: 0.65rem; white-space: pre-wrap; line-height: 1.45; }

/* Codex */
.codex-tools { display: flex; flex-wrap: wrap; gap: 8px; margin: 0.75rem 0; }
.codex-tools input {
  flex: 1; min-width: 160px; font: inherit; padding: 0.55rem 0.75rem;
  border-radius: 10px; border: 1.5px solid rgba(201,162,39,0.45); background: #fff;
}
.codex-section { margin-top: 1.25rem; }
.codex-section h3 { font-size: 1rem; }
.codex-cards { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.codex-card {
  padding: 0.75rem; border-radius: 12px; background: #fffef8;
  border: 1px solid rgba(201,162,39,0.3); font-size: 0.85rem;
}
.codex-card .svg-mini { width: 40px; height: 40px; color: var(--ink); margin-bottom: 4px; }
.codex-card .svg-mini svg { max-width: 100%; max-height: 100%; }

/* Trials board */
.streak-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--cream-deep); padding: 4px 12px; border-radius: 999px;
  font-weight: 700; font-size: 0.85rem;
}
.score-big { font-size: 2rem; font-weight: 800; color: var(--soil); }

/* Finale / certificate */
.certificate {
  text-align: center; padding: 2rem 1.25rem;
  background:
    linear-gradient(180deg, #fffef5, var(--cream)),
    repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(201,162,39,0.04) 10px, rgba(201,162,39,0.04) 20px);
  border: 4px double var(--gold);
  border-radius: 8px;
  position: relative;
}
.certificate h1 { color: var(--gold-dim); font-size: clamp(1.4rem, 4vw, 2rem); }
.certificate .seal-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 1rem 0; }
.certificate .mini-seal {
  width: 36px; height: 36px; border-radius: 50%; background: var(--leaf);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 0.65rem; font-weight: 800;
}

/* Sparks */
.spark-layer {
  pointer-events: none; position: fixed; inset: 0; z-index: 100; overflow: hidden;
}
.spark {
  position: absolute; width: 8px; height: 8px; border-radius: 50%;
  background: var(--gold-bright); animation: sparkFly 0.9s ease-out forwards;
}
@keyframes sparkFly {
  0% { opacity: 1; transform: translate(0,0) scale(1); }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(0.2); }
}

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: var(--cream); padding: 0.65rem 1.2rem;
  border-radius: 999px; font-size: 0.88rem; opacity: 0; transition: .25s; z-index: 90;
  pointer-events: none; max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.back-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 0.85rem; align-items: center; }
.hint { font-size: 0.8rem; color: var(--ink-soft); font-style: italic; }

@media (max-width: 520px) {
  .app-shell { padding: 10px 10px 96px; }
  .progress-ribbon { margin: -10px -10px 10px; }
  .letter-grid { grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); }
}


/* Keep paleo SVGs from exploding past their boxes (Alef path is huge) */
.ox-mark { overflow: hidden; }
.ox-mark svg { max-width: 100%; max-height: 100%; width: 100%; height: auto; display: block; }
.shrine-svg { overflow: hidden; }

.hub-pill{display:inline-block;text-decoration:none;font-weight:700;border-radius:999px;padding:.3rem .8rem;border:2px solid var(--gold,#d4a84b);background:rgba(255,253,246,.9);color:var(--ink,#3d2e1a);font-size:.85rem}
.progress-ribbon{padding-bottom:6px}
body{padding-bottom:44px}
.meta .paleo-word{font-size:1.7em;line-height:1;vertical-align:middle;margin:0 .15em}
