:root {
  --bg1: #f4f2df;
  --bg2: #d9ecdc;
  --card: #fffffff0;
  --card-strong: #fffdf4;
  --ink: #25351f;
  --ink-soft: #5d6d55;
  --line: #27351d26;
  --grass-a: #95c95f;
  --grass-b: #7fb853;
  --grass-lit-a: #ecd98a; /* hay-field meadow, enclose.horse style */
  --grass-lit-b: #e3cf7c;
  --water: #63afe0;
  --water-deep: #2e79b5;
  --rock: #8b887c;
  --fence: #744a27;
  --fence-light: #b47b43;
  --accent: #e86f31;
  --accent-2: #8e5bd9;
  --roam: #f3cf43;
  --danger: #cf463b;
  --good: #2f9652;
  --gold: #dba510;
  --sky: #5aa6d6;
  --shadow: 0 18px 45px #2a381b24;
  --shadow-soft: 0 8px 24px #2a381b18;
  --radius: 8px;
  --radius-lg: 12px;
  --btn-bg: #ffffffd4;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg1: #182216;
    --bg2: #10170e;
    --card: #222d1eee;
    --card-strong: #293522;
    --ink: #edf3e5;
    --ink-soft: #b9c5ae;
    --line: #edf3e526;
    --grass-a: #5c8f37;
    --grass-b: #47782f;
    --grass-lit-a: #b39b4e;
    --grass-lit-b: #a89044;
    --water: #397daf;
    --water-deep: #235f90;
    --rock: #686458;
    --shadow: 0 18px 45px #00000070;
    --shadow-soft: 0 8px 24px #00000048;
    --btn-bg: #3b4834; /* readable dark pills — no more white-on-white */
  }
}
* { box-sizing: border-box; margin: 0; -webkit-tap-highlight-color: transparent; }
body {
  font-family: 'Nunito', ui-rounded, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  min-height: 100vh;
  background:
    linear-gradient(90deg, #ffffff18 1px, transparent 1px) 0 0 / 26px 26px,
    linear-gradient(180deg, #ffffff18 1px, transparent 1px) 0 0 / 26px 26px,
    linear-gradient(180deg, var(--bg1), var(--bg2)) fixed;
}
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(110deg, transparent 0 42%, #ffffff24 42% 43%, transparent 43% 100%),
    repeating-linear-gradient(135deg, #25351f08 0 1px, transparent 1px 18px);
  mix-blend-mode: soft-light;
}
#app { max-width: 620px; margin: 0 auto; padding: 16px 14px 98px; position: relative; }
h1 { font-size: 38px; line-height: 0.95; font-weight: 950; letter-spacing: 0; }
h2 { letter-spacing: 0; }
h3 { font-size: 17px; margin-bottom: 4px; letter-spacing: 0; }
p { line-height: 1.35; }
.center { text-align: center; }
.soft { color: var(--ink-soft); }
.small { font-size: 13px; }
.eyebrow {
  color: var(--accent);
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 6px;
}

nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 40;
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px calc(10px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: blur(18px) saturate(140%);
  border-top: 1px solid var(--line);
  box-shadow: 0 -10px 30px #0001;
}
nav button {
  flex: 1;
  max-width: 126px;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  padding: 7px 4px;
  border-radius: var(--radius);
  cursor: pointer;
}
nav button .ico { display: block; font-size: 20px; margin-bottom: 2px; }
nav button.active { color: #fff; background: var(--accent); box-shadow: 0 8px 18px #e86f3136; }

.card {
  background: var(--card);
  backdrop-filter: blur(12px) saturate(120%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin: 12px 0;
  box-shadow: var(--shadow-soft);
}
.row { display: flex; align-items: center; gap: 10px; }
.row .grow { flex: 1; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }

.btn {
  border: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 950;
  color: var(--ink);
  background: var(--btn-bg);
  padding: 11px 18px;
  border-radius: 999px;
  box-shadow: 0 4px 12px #0002;
  transition: transform .14s ease, box-shadow .14s ease, background .14s ease, opacity .14s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 8px 20px #0002; }
.btn:active { transform: translateY(1px) scale(0.98); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.good { background: var(--good); color: #fff; }
.btn.ghost { background: transparent; box-shadow: none; color: var(--ink-soft); }
.btn:disabled { opacity: 0.42; cursor: default; transform: none; box-shadow: none; }
.btn.toggled { background: var(--roam); color: #4a3b00; }

.hero-card {
  position: relative;
  overflow: hidden;
  min-height: 170px;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  align-items: center;
  gap: 10px;
  padding: 24px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--card-strong), var(--card));
  box-shadow: var(--shadow);
}
.hero-card p { margin-top: 10px; color: var(--ink-soft); font-weight: 750; max-width: 300px; }
.hero-art {
  position: relative;
  min-height: 126px;
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, #8bc7e8 0 46%, #95c95f 46% 100%);
  border: 1px solid #ffffff80;
  box-shadow: inset 0 0 0 1px #00000010;
}
.hero-art::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 24px;
  height: 18px;
  background: repeating-linear-gradient(90deg, var(--fence) 0 12px, transparent 12px 22px);
  border-top: 5px solid var(--fence-light);
  border-bottom: 5px solid var(--fence-light);
}
.hero-sun { position: absolute; right: 14px; top: 8px; color: #ffcf4a; font-size: 24px; }
.hero-cat { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); font-size: 54px; filter: drop-shadow(0 5px 5px #0004); }
.hero-fence { position: absolute; left: 12px; bottom: 7px; color: #ffffffa0; font-weight: 950; letter-spacing: 2px; }

.home-stats { margin-top: 12px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat {
  text-align: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 4px;
  box-shadow: var(--shadow-soft);
}
.stat b { display: block; font-size: 22px; line-height: 1; }
.stat span { font-size: 11px; font-weight: 900; color: var(--ink-soft); }

.lv-item { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-radius: var(--radius); cursor: pointer; }
.lv-item:hover { background: #8881; }
.daily-feature { padding: 12px; background: linear-gradient(90deg, #f28c4018, transparent); }
.lv-num {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: var(--good);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 950;
  font-size: 18px;
  flex: none;
  box-shadow: inset 0 -8px 14px #0002;
}
.lv-num.daily { background: var(--accent); }
.lv-num.ai { background: var(--accent-2); }
.stars { color: var(--gold); font-size: 13px; letter-spacing: 1px; white-space: nowrap; }
.stars .off { opacity: 0.25; }

.trail-card { padding: 16px 10px 8px; overflow: hidden; }
.progress-pill {
  min-width: 52px;
  text-align: center;
  border-radius: 999px;
  padding: 7px 10px;
  color: #fff;
  background: var(--good);
  font-size: 12px;
  font-weight: 950;
  box-shadow: 0 8px 18px #2f965238;
}
.trail-progress {
  height: 8px;
  margin: 8px 6px 2px;
  border-radius: 999px;
  background: #25351f18;
  overflow: hidden;
}
.trail-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--good), var(--gold));
  transition: width .6s cubic-bezier(.34,1,.64,1);
}
.path-wrap { position: relative; margin: 6px 0; }
.path-wrap svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.trail-shadow {
  stroke: #00000016;
  stroke-width: 14;
  stroke-linecap: round;
}
.trail-path {
  stroke: color-mix(in srgb, var(--fence-light) 70%, var(--ink) 10%);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-dasharray: 1 9;
  opacity: 0.85;
}
.trail-done {
  stroke: var(--good);
  stroke-dasharray: 0 100;
  opacity: 1;
  filter: drop-shadow(0 3px 4px #2f965244);
}
.path-node {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 166px;
  cursor: pointer;
  user-select: none;
}
.path-card {
  position: relative;
  min-height: 86px;
  display: grid;
  align-content: start;
  gap: 4px;
  padding: 10px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.path-node:hover .path-card { transform: translateY(-3px); box-shadow: var(--shadow); }
.path-node.done .path-card { border-color: color-mix(in srgb, var(--good) 45%, var(--line)); }
.path-node.next .path-card {
  border-color: var(--accent);
  box-shadow: 0 14px 34px #e86f3130;
}
.path-node.locked .path-card {
  opacity: 0.55;
  filter: grayscale(0.35);
  border-style: dashed;
}
.path-node.locked:hover .path-card {
  transform: none;
  box-shadow: var(--shadow-soft);
}
.node-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.node-badge { font-size: 22px; filter: drop-shadow(0 2px 2px #0002); }
.node-meta {
  font-size: 10px;
  font-weight: 950;
  text-transform: uppercase;
  color: var(--ink-soft);
  letter-spacing: 0.08em;
}
.node-stats { color: var(--ink-soft); font-size: 11px; font-weight: 850; }
.path-cat {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: -28px;
  transform: translateX(-50%);
  font-size: 30px;
  filter: drop-shadow(0 4px 4px #0004);
}

#board-wrap { display: flex; justify-content: center; margin: 12px 0 10px; }
#board {
  position: relative;
  display: grid;
  gap: 3px;
  padding: 9px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, #2b3b2430, #ffffff2a);
  touch-action: none;
  user-select: none;
  box-shadow: inset 0 2px 9px #0002, var(--shadow);
  border: 1px solid #ffffff5c;
}
.tile {
  position: relative;
  border-radius: 18%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(var(--ts) * 0.62);
  width: var(--ts);
  height: var(--ts);
  cursor: pointer;
  overflow: hidden;
  transition: transform .12s ease, filter .18s ease, background-color .22s ease, box-shadow .18s ease;
}
.tile::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #ffffff35, transparent 44%, #00000010);
  pointer-events: none;
}
.tile.grass-a { background: var(--grass-a); }
.tile.grass-b { background: var(--grass-b); }
.tile.water { background: var(--water); cursor: default; box-shadow: inset 0 5px 0 #1d456655; }
.tile.water::before {
  content: '';
  position: absolute;
  left: 14%; top: 24%; width: 42%; height: 9%;
  border-radius: 999px;
  background: #ffffff88;
  animation: shimmer 2.8s ease-in-out infinite;
}
@keyframes shimmer { 0%, 100% { transform: translateX(0); opacity: .85; } 50% { transform: translateX(55%); opacity: .35; } }
.tile.water::after {
  content: '';
  position: absolute;
  width: 62%;
  height: 32%;
  border-radius: 50%;
  background: var(--water-deep);
  opacity: .6;
  top: 54%;
}
.tile.rock::after { content: '🪨'; position: relative; z-index: 1; filter: drop-shadow(0 2px 2px #0003); }
/* the enclosure becomes a harvested hay field: straw striping + wheat, like enclose.horse */
.tile.roam.grass-a, .tile.roam.grass-b {
  background: repeating-linear-gradient(180deg, #f0dd93 0 5px, #e2cb74 5px 10px);
  box-shadow: inset 0 0 0 1px #c9a53e4d;
}
@media (prefers-color-scheme: dark) {
  .tile.roam.grass-a, .tile.roam.grass-b {
    background: repeating-linear-gradient(180deg, #b89f52 0 5px, #a68c41 5px 10px);
    box-shadow: inset 0 0 0 1px #00000040;
  }
}
.tile .wheat {
  font-size: calc(var(--ts) * 0.62); opacity: 1; pointer-events: none;
  filter: saturate(1.15) drop-shadow(0 2px 1px #0002);
  animation: wheatIn .45s cubic-bezier(.34,1.56,.64,1) backwards;
}
@keyframes wheatIn { from { opacity: 0; transform: scale(.4) translateY(30%); } }
.tile.roam { box-shadow: inset 0 0 0 2px #fff7a980; }
.tile.roam.pop { animation: meadowWave .55s cubic-bezier(.34,1.56,.64,1) backwards; }
@keyframes meadowWave { 0% { transform: scale(.72); filter: brightness(1.65); } 60% { filter: brightness(1.18); } }
.tile.esc {
  box-shadow: inset 0 0 0 3px #ffd8d3, inset 0 0 0 100vmax #d94d4058;
  animation: pulse 1s infinite;
  z-index: 1;
}
/* fences stand up off the grass like enclose.horse walls: raised posts + ground shadow */
.tile.fence { overflow: visible; z-index: 3; }
.tile.fence::after {
  content: '';
  position: absolute;
  bottom: 3%; left: 12%; right: 12%; height: 14%;
  border-radius: 50%;
  background: #00000033;
}
.tile .fpost {
  position: absolute;
  left: 8%; right: 8%; top: -16%; bottom: 12%;
  border-radius: 12%;
  background:
    linear-gradient(180deg, transparent 0 20%, var(--fence-light) 20% 36%, transparent 36% 58%, var(--fence-light) 58% 74%, transparent 74% 100%),
    repeating-linear-gradient(90deg, var(--fence) 0 20%, transparent 20% 40%);
  filter: drop-shadow(0 5px 3px #00000040);
  z-index: 2;
  filter: drop-shadow(0 2px 2px #0004);
}
.tile .fpost.new { animation: pop .25s cubic-bezier(.34,1.56,.64,1); }
.tile.fence.optimal .fpost {
  background:
    linear-gradient(180deg, transparent 0 20%, var(--gold) 20% 36%, transparent 36% 58%, var(--gold) 58% 74%, transparent 74% 100%),
    repeating-linear-gradient(90deg, #8a6a00 0 20%, transparent 20% 40%);
  filter: drop-shadow(0 0 9px #f2b705c0);
}
.tile.placeable:hover { transform: scale(1.07); filter: saturate(1.08); z-index: 2; }
.tile .tile-cat { font-size: calc(var(--ts) * 0.8); filter: drop-shadow(0 3px 3px #0005); z-index: 2; }

/* items celebrate (or warn) when the pen closes around them */
.tile.roam .item.goodie { animation: claimBounce .55s cubic-bezier(.34,1.7,.64,1); }
.tile.roam .item.baditem { animation: claimShake .5s ease; }
.tile.roam:has(.baditem) { box-shadow: inset 0 0 0 2px #cf463b99; }
@keyframes claimBounce { 40% { transform: translateY(-30%) scale(1.25); } }
@keyframes claimShake { 25%, 75% { transform: translateX(-12%); } 50% { transform: translateX(12%); } }

/* gentle cue that the pen is sealed and can be submitted */
.btn.ready { animation: readyPulse 1.8s ease-in-out infinite; }
@keyframes readyPulse { 50% { box-shadow: 0 0 0 6px #2f965226, 0 4px 12px #0002; } }
.tile.enter { animation: tileIn .42s cubic-bezier(.34,1.4,.64,1) backwards; }
@keyframes tileIn { from { transform: translateY(10px) scale(0.7); opacity: 0; } }
@keyframes pop { from { transform: scale(0.3); opacity: 0; } }
@keyframes pulse { 50% { opacity: 0.68; } }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
.cat { animation: bob 2.2s ease-in-out infinite; display: inline-block; }
@keyframes bob { 50% { transform: translateY(-8%) rotate(-4deg); } }
.tile .deco { position: absolute; font-size: calc(var(--ts) * 0.35); opacity: .45; top: 6%; right: 8%; pointer-events: none; }
.tile .item { position: relative; z-index: 2; animation: wobble 3.4s ease-in-out infinite; text-shadow: 0 2px 3px #0003; }
.tile .goodie { filter: drop-shadow(0 0 8px #fff5a6); }
.tile .baditem { filter: drop-shadow(0 0 8px #d94d4060); }
.boxitem { display: grid; place-items: center; }
.boxitem em {
  position: absolute;
  right: -0.25em;
  bottom: -0.2em;
  min-width: 1.15em;
  height: 1.15em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg1);
  font-size: 0.32em;
  font-style: normal;
  font-weight: 950;
  border: 1px solid #ffffff90;
}
@keyframes wobble { 50% { transform: rotate(7deg) translateY(-4%); } }
#status.gold { color: #9a7600; }
.review-bar .btn { font-size: 13px; }

.tut-banner {
  border: 2px solid var(--accent);
  animation: pop .3s cubic-bezier(.34,1.56,.64,1);
  background: color-mix(in srgb, var(--accent) 14%, var(--card-strong));
  box-shadow: 0 10px 30px color-mix(in srgb, var(--accent) 22%, transparent);
}
#conn-pill {
  position: fixed;
  top: calc(8px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  background: var(--danger);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  padding: 7px 14px;
  border-radius: 999px;
  box-shadow: 0 6px 18px #0004;
  animation: pop .3s cubic-bezier(.34,1.56,.64,1);
  pointer-events: none;
  max-width: 92vw;
  text-align: center;
}
.boot {
  min-height: 60vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  text-align: center;
}
.boot-cat { font-size: 54px; animation: bob 1.4s ease-in-out infinite; }
.cg-card { display: flex; gap: 12px; align-items: flex-start; }
.cg-thumb {
  margin: 0;
  flex: 0 0 auto;
  font-size: 10px;
  line-height: 1;
  letter-spacing: 0;
  white-space: pre;
  padding: 4px;
  border-radius: 8px;
  background: #0003;
}
.cg-thumb-lg {
  display: block;
  width: max-content;
  max-width: 100%;
  margin: 0 auto 6px;
  font-size: 22px;
  line-height: 1.05;
  text-align: center;
  overflow: auto;
  padding: 8px;
  border-radius: var(--radius);
  background: #0002;
}
.cg-card .actions { flex-wrap: wrap; gap: 6px; }
.cg-like.toggled { background: var(--danger); color: #fff; }
.tut-icon {
  flex: 0 0 auto;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  font-size: 20px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 24%, transparent);
}
.tut-msg { color: var(--ink); font-size: 14px; font-weight: 800; line-height: 1.34; }
.tut-msg b { color: var(--accent); }
.tut-dots { display: flex; gap: 6px; justify-content: center; margin-top: 10px; }
.tut-dots span {
  width: 7px; height: 7px; border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 24%, transparent);
  transition: transform .25s, background .25s, width .25s;
}
.tut-dots span.done { background: color-mix(in srgb, var(--accent) 55%, transparent); }
.tut-dots span.on { background: var(--accent); width: 18px; }
#board-wrap.tut-wait #board { opacity: .48; filter: saturate(.55); transition: opacity .3s, filter .3s; }
@keyframes tutNudge { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }
@keyframes tutBounce { 0%, 100% { transform: scale(1); } 32% { transform: scale(1.3); } 62% { transform: scale(.94); } }
.tile.hint.tap-wrong { animation: tutBounce .45s, hintpulse 1s infinite; }
.tile.hint {
  box-shadow: 0 0 0 3px var(--accent), 0 0 16px var(--accent);
  animation: hintpulse 1s infinite;
  z-index: 3;
}
@keyframes hintpulse { 50% { box-shadow: 0 0 0 5px var(--accent), 0 0 24px var(--accent); } }
.btn.attn { animation: attn 1s infinite; }
@keyframes attn { 50% { transform: scale(1.06); box-shadow: 0 0 18px #e86f3168; } }

.bd-list { margin: 8px auto 2px; max-width: 260px; }
.bd-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  font-weight: 850;
  padding: 4px 6px;
  animation: bdIn .35s cubic-bezier(.34,1.4,.64,1) backwards;
}
.bd-pts { font-weight: 950; color: var(--good); }
.bd-pts.neg { color: var(--danger); }
@keyframes bdIn { from { opacity: 0; transform: translateX(-14px); } }

#tile-hint {
  min-height: 20px;
  font-size: 11.5px;
  font-weight: 800;
  color: var(--ink-soft);
  margin: -4px 0 4px;
}
.score-panel {
  max-width: min(100%, 520px);
  margin: -2px auto 8px;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}
.score-panel.open { border-color: color-mix(in srgb, var(--danger) 48%, var(--line)); }
.score-panel.closed { border-color: color-mix(in srgb, var(--good) 36%, var(--line)); }
.score-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 6px;
}
.score-head b { font-size: 14px; font-weight: 950; }
.score-head span { font-size: 12px; font-weight: 850; color: var(--ink-soft); text-align: right; }
.score-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12.5px;
  font-weight: 850;
  padding: 3px 0;
  border-top: 1px solid #8882;
}
.score-row b { color: var(--good); }
.score-row b.neg, .danger-row b { color: var(--danger); }
.bar-row { display: flex; align-items: center; gap: 8px; margin: 5px 0; }
.bar-label { width: 58px; font-size: 11px; font-weight: 900; color: var(--ink-soft); text-align: right; }
.bar-track { flex: 1; height: 14px; background: #8882; border-radius: 999px; overflow: hidden; }
.bar { height: 100%; background: var(--good); border-radius: 999px; transition: width .6s cubic-bezier(.34,1.2,.64,1); }
.bar-gold { background: var(--gold); }
.bar-n { width: 20px; font-size: 12px; font-weight: 900; color: var(--ink-soft); }

#hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 13px;
  box-shadow: var(--shadow-soft);
}
.pips { display: flex; gap: 3px; flex-wrap: wrap; }
.pip { width: 8px; height: 17px; border-radius: 3px; background: var(--fence); opacity: 0.22; }
.pip.used { opacity: 1; box-shadow: 0 3px 8px #744a2740; }
#status { font-weight: 950; font-size: 15px; }
#status.bad { color: var(--danger); }
#status.ok { color: var(--good); }
.actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }

#overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #11180bcc;
  backdrop-filter: blur(5px);
  padding: 20px;
}
#overlay .card {
  max-width: 410px;
  width: 100%;
  animation: modalIn .28s cubic-bezier(.34,1.56,.64,1);
  box-shadow: 0 30px 80px #0008;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(16px) scale(.96); } }
.bigstars { font-size: 40px; letter-spacing: 4px; color: var(--gold); }
.pop-star { display: inline-block; animation: starpop .5s cubic-bezier(.34,1.8,.64,1) backwards; }
.pop-star.off { opacity: .18; animation: none; }
@keyframes starpop { from { transform: scale(0) rotate(-120deg); } }
.share-pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  background: #8881;
  padding: 10px;
  border-radius: var(--radius);
  white-space: pre-wrap;
  word-break: break-all;
  margin: 10px 0;
}

input, select {
  font: inherit;
  color: var(--ink);
  background: #ffffffc4;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  width: 100%;
}
@media (prefers-color-scheme: dark) { input, select { background: #ffffff14; } }
label { font-size: 12px; font-weight: 900; color: var(--ink-soft); display: block; margin: 10px 0 4px; }

.lb-row { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-radius: var(--radius); }
.lb-row.me { background: #f28c4026; }
.lb-rank { width: 26px; font-weight: 950; color: var(--ink-soft); }
.lb-score { font-weight: 950; }
.tabs { display: flex; gap: 6px; margin-bottom: 8px; }
.tabs .btn { padding: 7px 16px; font-size: 13px; }

.confetti {
  position: fixed;
  top: -20px;
  z-index: 60;
  font-size: 20px;
  pointer-events: none;
  animation: fall linear forwards;
}
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 3px solid #fff8;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin .8s linear infinite;
  vertical-align: -4px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }

@media (max-width: 520px) {
  #app { padding-inline: 10px; }
  h1 { font-size: 34px; }
  .hero-card { grid-template-columns: 1fr; min-height: 0; }
  .hero-art { min-height: 96px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .path-node { width: 152px; }
  .path-card { min-height: 84px; padding: 9px; }
  .node-stats { font-size: 10.5px; }
  .btn { padding-inline: 15px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
