:root {
  --paper: #f3ecdd;
  --paper-2: #fbf7ee;
  --paper-edge: #e3d8c1;
  --ink: #2b2520;
  --ink-dim: rgba(43, 37, 32, 0.62);
  --ink-faint: rgba(43, 37, 32, 0.16);
  --pen: #2d5da8;
  --red: #c4432f;
  --gold: #e7a93a;
  --hi: rgba(242, 201, 76, 0.55);
  --hand: "Caveat", "Segoe Print", cursive;
  --ui: "Nunito", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--ui);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}

/* no 100dvh here: in an iOS home-screen app it leaves out the status bar and a strip of page shows below */
#app { position: fixed; inset: 0; }

#game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  /* a bold ring with a white edge, so the pen stays visible over dark ink */
  cursor: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2232%22%20height%3D%2232%22%20viewBox%3D%220%200%2032%2032%22%3E%3Ccircle%20cx%3D%2216%22%20cy%3D%2216%22%20r%3D%229%22%20fill%3D%22none%22%20stroke%3D%22%23fff%22%20stroke-width%3D%224.5%22/%3E%3Ccircle%20cx%3D%2216%22%20cy%3D%2216%22%20r%3D%229%22%20fill%3D%22none%22%20stroke%3D%22%232b2520%22%20stroke-width%3D%222%22/%3E%3Ccircle%20cx%3D%2216%22%20cy%3D%2216%22%20r%3D%222.6%22%20fill%3D%22%232b2520%22%20stroke%3D%22%23fff%22%20stroke-width%3D%221.6%22/%3E%3C/svg%3E") 16 16, crosshair;
}

.ico {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

/* ---------- top HUD ---------- */
.hud-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: calc(10px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 0 max(18px, env(safe-area-inset-left));
  pointer-events: none;
}

.score { line-height: 1; }
.score-row { display: flex; align-items: baseline; gap: 4px; }
#dist {
  font-family: var(--hand);
  font-weight: 700;
  font-size: 46px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  color: var(--ink);
}
.unit { font-family: var(--hand); font-size: 24px; color: var(--ink-dim); }
.score-sub {
  display: flex;
  gap: 12px;
  margin-top: 2px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-dim);
  font-variant-numeric: tabular-nums;
}
#hud-best:empty { display: none; }
.score-row { gap: 12px !important; align-items: center !important; }
.coin-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px 3px 7px;
  border-radius: 999px;
  background: rgba(251, 247, 238, 0.8);
  border: 1.5px solid rgba(43, 37, 32, 0.18);
  font: 800 14px/1 var(--ui);
  color: #8a5a10;
  font-variant-numeric: tabular-nums;
}
.coin-pill .ico { width: 15px; height: 15px; color: #c98a14; }
.coin-pill.pop { animation: pop 0.3s ease-out; }

.combo {
  position: absolute;
  left: 50%;
  top: calc(10px + env(safe-area-inset-top));
  transform: translateX(-50%) scale(0.8);
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  column-gap: 8px;
  padding: 6px 14px 8px;
  border-radius: 14px;
  background: rgba(251, 247, 238, 0.85);
  border: 2px solid var(--ink);
  box-shadow: 2px 3px 0 rgba(43, 37, 32, 0.14);
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}
.combo.on { opacity: 1; transform: translateX(-50%) scale(1); }
.combo.bump { animation: bump 0.28s ease-out; }
@keyframes bump { 40% { transform: translateX(-50%) scale(1.18) rotate(-3deg); } }
.combo-x { grid-row: span 2; font-family: var(--hand); font-weight: 700; font-size: 34px; line-height: 0.9; color: var(--red); }
.combo-label { font-size: 11px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-dim); }
.combo-bar { display: block; width: 72px; height: 4px; border-radius: 4px; background: rgba(43, 37, 32, 0.12); overflow: hidden; }
.combo-bar i { display: block; height: 100%; width: 100%; background: var(--red); transform-origin: left; }

.actions { display: flex; gap: 8px; position: relative; z-index: 6; }
/* the top bar stays usable over every card; it is hidden while the splash is up */
body.splashing .hud-top, body.splashing .ink-hud, body.splashing .actions { visibility: hidden; }

.icon-btn {
  pointer-events: auto;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 255px 18px 225px 18px / 18px 225px 18px 255px;
  background: var(--paper-2);
  color: var(--ink);
  cursor: pointer;
  box-shadow: 2px 3px 0 rgba(43, 37, 32, 0.14);
  transition: transform 0.12s, box-shadow 0.12s, background 0.15s;
}
.icon-btn .ico { grid-area: 1 / 1; }
.icon-btn:hover { background: #fff; transform: translateY(-1px) rotate(-2deg); }
.icon-btn:active { transform: translateY(1px); box-shadow: 1px 1px 0 rgba(43, 37, 32, 0.14); }
.icon-btn:focus-visible, .cta:focus-visible { outline: 3px solid var(--pen); outline-offset: 3px; }
.icon-btn .ico-off { display: none; }
.icon-btn.off .ico-on { display: none; }
.icon-btn.off .ico-off { display: block; }
#btn-music.off { color: var(--ink-dim); }
#btn-music.off::after {
  content: "";
  grid-area: 1 / 1;
  width: 24px;
  height: 2px;
  background: var(--red);
  border-radius: 2px;
  transform: rotate(-40deg);
}

/* ---------- ink HUD ---------- */
.ink-hud {
  position: absolute;
  left: max(18px, env(safe-area-inset-left));
  bottom: calc(16px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 14px 8px 10px;
  border-radius: 14px;
  background: rgba(251, 247, 238, 0.78);
  border: 1.5px solid var(--ink-faint);
  pointer-events: none;
}
.slots { display: flex; gap: 6px; }
.slot {
  position: relative;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--pen);
  transition: transform 0.2s;
}
.slot::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(var(--pen) calc(var(--p, 1) * 360deg), rgba(45, 93, 168, 0.14) 0);
  -webkit-mask: radial-gradient(circle, transparent 13px, #000 14px);
  mask: radial-gradient(circle, transparent 13px, #000 14px);
}
.slot .ico { width: 18px; height: 18px; fill: var(--pen); stroke: var(--pen); }
.slot.used .ico { fill: none; opacity: 0.45; }
.slot.pop { animation: pop 0.35s ease-out; }
@keyframes pop { 40% { transform: scale(1.25); } }
.ink-hud.shake { animation: shake 0.32s; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.ink-len {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--hand);
  font-weight: 700;
  font-size: 22px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.ink-len .ico { width: 16px; height: 16px; color: var(--ink-dim); }
.ink-len.low { color: var(--red); }

/* ---------- overlays ---------- */
.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(243, 236, 221, 0.35);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}
.overlay.show { opacity: 1; visibility: visible; }
.overlay .card { transform: translateY(12px) rotate(-1.2deg); transition: transform 0.4s cubic-bezier(0.2, 1.4, 0.4, 1); }
.overlay.show .card { transform: translateY(0) rotate(-1.2deg); }

.card {
  position: relative;
  width: min(430px, 100%);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: 30px 28px 22px;
  background: var(--paper-2);
  border: 2px solid var(--ink);
  border-radius: 6px 12px 8px 14px;
  text-align: center;
  box-shadow: 6px 8px 0 rgba(43, 37, 32, 0.1), 0 20px 50px rgba(80, 60, 30, 0.18);
}
.card.small { width: min(330px, 100%); }
.tape {
  position: absolute;
  top: -12px;
  left: 50%;
  width: 96px;
  height: 26px;
  transform: translateX(-50%) rotate(3deg);
  background: rgba(231, 169, 58, 0.45);
  border-left: 2px dashed rgba(255, 255, 255, 0.5);
  border-right: 2px dashed rgba(255, 255, 255, 0.5);
}

h1 {
  margin: 0;
  font-family: var(--hand);
  font-weight: 700;
  font-size: 62px;
  line-height: 0.95;
  letter-spacing: 0.01em;
}
h2 { margin: 4px 0 18px; font-family: var(--hand); font-weight: 700; font-size: 38px; line-height: 1; }
.tag {
  display: inline-block;
  margin: 6px 0 20px;
  padding: 0 6px;
  font-family: var(--hand);
  font-size: 24px;
  font-weight: 500;
  background: linear-gradient(transparent 55%, var(--hi) 55%, var(--hi) 90%, transparent 90%);
}

.hints { list-style: none; margin: 0 0 22px; padding: 0; display: grid; gap: 12px; text-align: left; }
.hints li { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; line-height: 1.4; color: var(--ink-dim); font-weight: 500; }
.hint-ico {
  flex: none;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1.5px solid currentColor;
  border-radius: 50% 45% 55% 48%;
  color: var(--pen);
}
.hint-ico.red { color: var(--red); }
.hint-ico .ico { width: 16px; height: 16px; }

.cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 190px;
  height: 52px;
  padding: 0 26px;
  border: 2px solid var(--ink);
  border-radius: 255px 18px 225px 18px / 18px 225px 18px 255px;
  background: var(--pen);
  color: #fff;
  font: 800 17px/1 var(--ui);
  cursor: pointer;
  box-shadow: 3px 4px 0 var(--ink);
  transition: transform 0.12s, box-shadow 0.12s;
}
.cta .ico { width: 18px; height: 18px; }
.cta:hover { transform: translate(-1px, -1px) rotate(-1deg); box-shadow: 4px 5px 0 var(--ink); }
.cta:active { transform: translate(2px, 3px); box-shadow: 1px 1px 0 var(--ink); }

.sub { margin: 14px 0 0; font-family: var(--hand); font-size: 22px; color: var(--ink-dim); }
.sub:empty { display: none; }
.rotate { display: none; margin: 10px 0 0; font-size: 13px; color: var(--red); font-weight: 700; }
.keys { margin: 8px 0 0; font-size: 12px; color: var(--ink-dim); letter-spacing: 0.03em; }
@media (orientation: portrait) and (max-width: 700px) {
  .rotate { display: block; }
  .keys { display: none; }
}

.cause { margin: 0; font-family: var(--hand); font-size: 26px; color: var(--red); }
.big { margin: 0; font-family: var(--hand); font-weight: 700; font-size: 92px; line-height: 0.95; font-variant-numeric: tabular-nums; }
.big small { font-size: 36px; margin-left: 4px; color: var(--ink-dim); }
.big-label { margin: -4px 0 0; font-size: 11px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-dim); }
.stats { flex-wrap: wrap; gap: 10px 22px !important; }
.best-pill {
  display: none;
  align-items: center;
  gap: 6px;
  width: max-content;
  margin: 8px auto 0;
  padding: 5px 12px 5px 9px;
  border: 1.5px solid var(--red);
  border-radius: 999px;
  background: rgba(196, 67, 47, 0.1);
  color: var(--red);
  font: 800 12px/1 var(--ui);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.best-pill .ico { width: 14px; height: 14px; fill: currentColor; }
.best-pill.show { display: flex; animation: best-pop 0.4s 0.3s cubic-bezier(0.3, 1.6, 0.5, 1) both; }
@keyframes best-pop { from { transform: scale(0.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.stats { display: flex; justify-content: center; gap: 28px; margin: 12px 0 18px; }
.stats div { display: flex; flex-direction: column; align-items: center; }
.stats dt { font-size: 11px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-dim); }
.stats dd { margin: 2px 0 0; font-family: var(--hand); font-weight: 700; font-size: 28px; }

@media (max-width: 560px) {
  .combo { top: calc(92px + env(safe-area-inset-top)); padding: 4px 12px 6px; }
  .combo-x { font-size: 28px; }
  #dist { font-size: 40px; }
  .icon-btn { width: 38px; height: 38px; }
  .actions { gap: 6px; }
  h1 { font-size: 54px; }
}

@media (max-height: 460px) {
  .card { padding: 20px 22px 16px; }
  h1 { font-size: 46px; }
  .tag { margin-bottom: 10px; font-size: 21px; }
  .hints { gap: 7px; margin-bottom: 14px; }
  .hints li { font-size: 13.5px; }
  .hint-ico { width: 26px; height: 26px; }
  .cta { height: 46px; }
  .big { font-size: 72px; }
  .stats { margin: 6px 0 12px; }
  .ink-hud { padding: 6px 12px 6px 8px; }
  .slot { width: 30px; height: 30px; }
  .slot::before { -webkit-mask: radial-gradient(circle, transparent 11px, #000 12px); mask: radial-gradient(circle, transparent 11px, #000 12px); }
}

@media (prefers-reduced-motion: reduce) {
  .overlay .card { transition: none; }
  .best-pill.show { animation: none; }
}

/* ---------- menus: rank, missions, dojo, toasts ---------- */
.btn-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.cta.ghost { background: var(--paper-2); color: var(--ink); min-width: 0; }
.cta.ghost .ico { color: var(--ink); }

.rank { display: none; align-items: center; gap: 10px; margin: 0 auto 14px; width: max-content; max-width: 100%; }
.rank.show { display: flex; }
.belt { width: 30px; height: 12px; border-radius: 3px; border: 2px solid var(--ink); position: relative; }
.belt::after { content: ""; position: absolute; left: 50%; top: -5px; width: 6px; height: 18px; transform: translateX(-50%) rotate(12deg); background: inherit; border: 2px solid var(--ink); border-radius: 2px; }
.rank-text { text-align: left; }
.rank-name { font-family: var(--hand); font-weight: 700; font-size: 22px; line-height: 1; }
.rank-bar { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 800; color: var(--ink-dim); }
.rank-bar .ico { width: 13px; height: 13px; fill: var(--gold); stroke: #9a6a10; }
.rank-track { width: 90px; height: 5px; border-radius: 5px; background: var(--ink-faint); overflow: hidden; }
.rank-track i { display: block; height: 100%; background: var(--gold); }

.missions { display: grid; gap: 8px; margin: 0 0 18px; text-align: left; }
.missions:empty { display: none; }
.missions h3 { margin: 0 0 2px; font-size: 11px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-dim); display: flex; align-items: center; gap: 6px; }
.missions h3 .ico { width: 14px; height: 14px; }
.mission { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border: 1.5px solid var(--ink-faint); border-radius: 10px; background: rgba(255, 255, 255, 0.45); }
.mission .m-ico { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--ink-faint); color: var(--ink-dim); }
.mission .m-ico .ico { width: 14px; height: 14px; }
.mission.done { border-color: rgba(95, 160, 90, 0.5); background: rgba(150, 200, 130, 0.14); }
.mission.done .m-ico { background: #5b9a4f; border-color: #5b9a4f; color: #fff; }
.mission .m-text { font-size: 13px; font-weight: 700; line-height: 1.25; }
.mission .m-prog { margin-top: 4px; height: 4px; border-radius: 4px; background: var(--ink-faint); overflow: hidden; }
.mission .m-prog i { display: block; height: 100%; background: var(--pen); }
.mission.done .m-prog i { background: #5b9a4f; }
.mission .m-reward { display: flex; align-items: center; gap: 4px; font: 800 12px/1 var(--ui); color: #8a5a10; }
.mission .m-reward .ico { width: 13px; height: 13px; color: #c98a14; }
.missions.compact .mission { padding: 6px 9px; }
.missions.compact .m-text { font-size: 12px; }

.dojo { width: min(560px, 100%); }
.dojo-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dojo-head h2 { margin: 0; }
.dojo-sub { margin: 6px 0 16px; text-align: left; font-size: 13px; color: var(--ink-dim); }
.coin-pill.big { font-size: 18px; padding: 6px 14px 6px 10px; }
.coin-pill.big .ico { width: 18px; height: 18px; }
.upgrades { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; margin-bottom: 18px; text-align: left; }
.upgrade { display: grid; grid-template-columns: 40px 1fr; gap: 4px 12px; padding: 12px; border: 2px solid var(--ink); border-radius: 12px 6px 14px 8px; background: #fff; box-shadow: 2px 3px 0 rgba(43, 37, 32, 0.1); }
.upgrade .u-ico { grid-row: span 2; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: rgba(45, 93, 168, 0.1); color: var(--pen); }
.upgrade .u-ico .ico { width: 20px; height: 20px; }
.upgrade .u-name { font-weight: 800; font-size: 15px; }
.upgrade .u-desc { font-size: 12px; color: var(--ink-dim); line-height: 1.35; }
.upgrade .u-foot { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.pips { display: flex; gap: 4px; }
.pips i { width: 14px; height: 6px; border-radius: 3px; background: var(--ink-faint); }
.pips i.on { background: var(--pen); }
.buy { display: inline-flex; align-items: center; gap: 5px; height: 32px; padding: 0 12px; border: 2px solid var(--ink); border-radius: 9px; background: #f2c94c; font: 800 13px/1 var(--ui); color: var(--ink); cursor: pointer; box-shadow: 2px 2px 0 var(--ink); }
.buy .ico { width: 14px; height: 14px; }
.buy:disabled { background: var(--paper); color: var(--ink-dim); box-shadow: none; cursor: default; opacity: 0.8; }
.buy.maxed { background: rgba(150, 200, 130, 0.3); }
.buy:not(:disabled):active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--ink); }
.upgrade.bought { animation: pop 0.35s ease-out; }

.toasts { position: absolute; left: 50%; top: calc(80px + env(safe-area-inset-top)); transform: translateX(-50%); display: grid; gap: 8px; justify-items: center; pointer-events: none; z-index: 5; }
.toast { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border: 2px solid var(--ink); border-radius: 12px; background: var(--paper-2); box-shadow: 3px 4px 0 rgba(43, 37, 32, 0.15); font: 700 14px/1.2 var(--ui); animation: toastIn 0.35s cubic-bezier(0.2, 1.4, 0.4, 1), toastOut 0.4s 2.6s forwards; }
.toast .t-ico { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: #5b9a4f; color: #fff; flex: none; }
.toast.rankup .t-ico { background: var(--gold); }
.toast .t-ico .ico { width: 15px; height: 15px; }
.toast small { display: block; font-size: 11px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-dim); }
.toast .t-reward { display: flex; align-items: center; gap: 4px; color: #8a5a10; font-weight: 800; }
.toast .t-reward .ico { width: 14px; height: 14px; color: #c98a14; }
@keyframes toastIn { from { transform: translateY(-14px) scale(0.9); opacity: 0; } }
@keyframes toastOut { to { transform: translateY(-10px); opacity: 0; } }
@media (max-width: 560px) { .toasts { top: calc(140px + env(safe-area-inset-top)); } }
@media (max-height: 460px) { .missions { gap: 5px; margin-bottom: 12px; } .mission { padding: 5px 8px; } .toasts { top: 70px; } }
#ov-over .card { width: min(390px, 100%); }
#ov-over .stats { display: grid; grid-template-columns: repeat(4, auto); justify-content: center; gap: 4px 20px !important; }
#ov-over .stats dd { font-size: 24px; }
@media (max-height: 460px) {
  #ov-start .tag { display: none; }
  #ov-start h1 { font-size: 40px; margin-bottom: 6px; }
  .rank { margin-bottom: 8px; }
  .rank-name { font-size: 19px; }
  .mission { padding: 4px 8px; gap: 8px; grid-template-columns: 22px 1fr auto; }
  .mission .m-ico { width: 22px; height: 22px; }
  .mission .m-text { font-size: 12px; }
  #ov-start .keys, #ov-start .sub { display: none; }
  .dojo { width: min(760px, 100%); padding: 16px 18px 14px; }
  .dojo-sub { display: none; }
  .dojo-head h2 { font-size: 30px; }
  .upgrades { grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0 12px; }
  .upgrade { padding: 8px; grid-template-columns: 30px 1fr; gap: 2px 8px; }
  .upgrade .u-ico { width: 30px; height: 30px; }
  .upgrade .u-ico .ico { width: 16px; height: 16px; }
  .upgrade .u-name { font-size: 13px; }
  .upgrade .u-desc { font-size: 11px; }
  .upgrade .u-foot { margin-top: 4px; }
  .buy { height: 28px; padding: 0 9px; font-size: 12px; }
  #ov-over .missions { display: none; }
}

/* ---------- ink picker ---------- */
.inks { display: flex; gap: 6px; padding-right: 12px; margin-right: 2px; border-right: 1.5px solid var(--ink-faint); pointer-events: auto; }
.inks:empty, .inks.solo { display: none; }
.ink-btn { position: relative; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; border: 2px solid transparent; background: var(--ink-color); color: #fff; cursor: pointer; opacity: 0.55; transition: transform 0.15s, opacity 0.15s, border-color 0.15s; }
.ink-btn .ico { width: 18px; height: 18px; }
.ink-btn[aria-checked="true"] { opacity: 1; border-color: var(--ink); transform: scale(1.08); box-shadow: 2px 2px 0 rgba(43, 37, 32, 0.25); }
.ink-btn kbd { position: absolute; right: -3px; bottom: -3px; width: 15px; height: 15px; border-radius: 50%; background: var(--paper-2); border: 1.5px solid var(--ink); color: var(--ink); font: 800 9px/12px var(--ui); text-align: center; }
@media (hover: none) { .ink-btn kbd { display: none; } }
@media (max-height: 460px) { .ink-btn { width: 34px; height: 34px; } }
.upgrade .u-desc b { color: var(--ink); }
@media (min-height: 461px) {
  .dojo { width: min(780px, 100%); }
  .upgrades { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
}

/* ---------- boss health ---------- */
.bossbar { position: absolute; left: 50%; top: calc(64px + env(safe-area-inset-top)); transform: translateX(-50%) translateY(-8px); display: flex; align-items: center; gap: 10px; padding: 6px 12px; border: 2px solid var(--ink); border-radius: 10px; background: rgba(251, 247, 238, 0.9); font: 800 12px/1 var(--ui); letter-spacing: 0.08em; text-transform: uppercase; opacity: 0; transition: opacity 0.25s, transform 0.25s; pointer-events: none; }
.bossbar.show { opacity: 1; transform: translateX(-50%); }
.bossbar b { display: block; width: 150px; height: 10px; border-radius: 5px; background: var(--ink-faint); overflow: hidden; border: 1.5px solid var(--ink); }
.bossbar i { display: block; height: 100%; width: 100%; background: var(--red); transition: width 0.3s; }
@media (max-width: 560px) { .bossbar { top: calc(132px + env(safe-area-inset-top)); } }

/* ---------- dojo tabs + wardrobe ---------- */
.dojo-head { flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; padding: 3px; border: 1.5px solid var(--ink-faint); border-radius: 10px; margin-right: auto; margin-left: 14px; }
.tab { height: 32px; padding: 0 14px; border: 0; border-radius: 7px; background: transparent; font: 800 13px/1 var(--ui); color: var(--ink-dim); cursor: pointer; }
.tab.on { background: var(--ink); color: var(--paper-2); }
.wardrobe { display: grid; gap: 14px; margin-bottom: 18px; text-align: left; }
.wardrobe[hidden], .upgrades[hidden] { display: none; }
.w-cat h3 { margin: 0 0 8px; font-size: 11px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-dim); }
.w-items { display: flex; flex-wrap: wrap; gap: 8px; }
.w-item { display: grid; justify-items: center; gap: 5px; width: 84px; padding: 9px 6px 8px; border: 2px solid var(--ink-faint); border-radius: 12px; background: #fff; cursor: pointer; font: 700 11px/1.2 var(--ui); color: var(--ink); transition: transform 0.12s, border-color 0.12s; }
.w-item:hover { transform: translateY(-2px); }
.w-item.eq { border-color: var(--ink); box-shadow: 2px 3px 0 rgba(43, 37, 32, 0.15); }
.w-item.locked { color: var(--ink-dim); }
.w-item.poor { opacity: 0.55; }
.w-item.shake { animation: shake 0.3s; }
.w-swatch { width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--ink); position: relative; overflow: hidden; }
.w-price { display: flex; align-items: center; gap: 3px; font: 800 11px/1 var(--ui); color: #8a5a10; }
.w-price .ico { width: 12px; height: 12px; color: #c98a14; }
.w-tag { font: 800 10px/1 var(--ui); letter-spacing: 0.08em; text-transform: uppercase; color: #3f8a46; }
@media (max-height: 460px) { .w-item { width: 72px; padding: 6px 4px; } .w-swatch { width: 30px; height: 30px; } .wardrobe { gap: 8px; } }

/* ---------- phone comfort: fewer, smaller overlays ---------- */
.icon-btn[hidden] { display: none; }
.install { margin: 8px 0 0; font-size: 12px; color: var(--ink-dim); font-weight: 700; }
.install[hidden] { display: none; }
.toasts.in-run { left: auto; right: max(16px, env(safe-area-inset-right)); top: calc(62px + env(safe-area-inset-top)); transform: none; justify-items: end; }
.toasts.in-run .toast { padding: 6px 10px; gap: 8px; font-size: 12px; border-width: 1.5px; box-shadow: 2px 2px 0 rgba(43, 37, 32, 0.12); animation: toastIn 0.3s cubic-bezier(0.2, 1.4, 0.4, 1), toastOut 0.35s 1.9s forwards; }
.toasts.in-run .toast .t-ico { width: 20px; height: 20px; }
.toasts.in-run .toast small { font-size: 9px; }
@media (max-width: 460px) { .actions { gap: 5px; } .icon-btn { width: 36px; height: 36px; } }
@media (max-height: 460px) { .icon-btn { width: 36px; height: 36px; } .actions { gap: 6px; } .combo { padding: 3px 10px 5px; } .combo-x { font-size: 26px; } }

/* ---------- pre-run card: missions and checkpoints ---------- */
.card.ready h2 { margin-bottom: 12px; }
.card.ready .missions { margin-bottom: 14px; }
.cps { margin: 0 0 16px; text-align: left; }
.cps h3 { margin: 0 0 8px; font-size: 11px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-dim); display: flex; align-items: center; gap: 6px; }
.cps h3 .ico { width: 14px; height: 14px; }
.cp-list { display: flex; flex-wrap: wrap; gap: 6px; }
.cp {
  display: inline-flex; flex-direction: column; align-items: flex-start; gap: 1px;
  padding: 6px 11px; border: 1.5px solid var(--ink-dim); border-radius: 10px;
  background: var(--paper-2); color: var(--ink); font: 800 14px/1.1 var(--ui); cursor: pointer;
}
.cp small { font: 600 11px/1.1 var(--ui); color: var(--ink-dim); }
.cp.on { border-color: var(--pen); background: var(--pen); color: #fff; box-shadow: 2px 2px 0 var(--ink); }
.cp.on small { color: rgba(255, 255, 255, 0.85); }
.cp-note { margin: 8px 0 0; font-size: 12px; color: var(--ink-dim); min-height: 1em; }
.cp-note:empty { display: none; }
.cta.resume { width: 100%; margin: 0 0 12px; height: auto; min-height: 52px; padding: 8px 20px; background: #2f9a6a; }
.cta.resume span { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.cta.resume small { font: 600 12px/1 var(--ui); opacity: 0.9; }
.cta.resume[hidden] { display: none; }
.icon-btn.zoom-pct { width: auto; min-width: 42px; padding: 0 7px; font: 800 13px/1 var(--ui); letter-spacing: -0.02em; }
@media (max-width: 460px), (max-height: 460px) { .icon-btn.zoom-pct { min-width: 36px; padding: 0 5px; font-size: 12px; } }

/* short landscape phones: missions on the left, start point and Go on the right */
@media (max-height: 500px) and (min-width: 600px) {
  .card.ready { width: min(680px, 100%); display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: auto 1fr auto; column-gap: 20px; padding: 16px 20px; }
  .card.ready h2, .card.ready .modes, .card.ready .daily-note { grid-column: 1 / -1; }
  .card.ready h2 { margin-bottom: 8px; font-size: 30px; }
  .card.ready h2 { grid-row: 1; }
  .card.ready .modes { grid-row: 2; }
  .card.ready .daily-note { grid-row: 3; }
  .card.ready { grid-template-rows: auto auto auto auto 1fr auto; }
  .card.ready .missions { grid-row: 4 / 7 !important; }
  .card.ready .cps { grid-row: 4 !important; }
  .card.ready #boss-test { grid-row: 5 !important; }
  .card.ready #btn-go { grid-row: 6 !important; }
  .card.ready .missions { grid-column: 1; grid-row: 2 / 4; margin: 0; }
  .card.ready .cps { grid-column: 2; grid-row: 2; margin: 0 0 12px; }
  .card.ready #btn-go { grid-column: 2; grid-row: 3; width: 100%; }
}

/* ---------- game over: replay of the last moments ---------- */
.over-a { position: relative; }
.replay { position: relative; margin: 0 auto 10px; width: 100%; aspect-ratio: 16 / 10; border: 2px solid var(--ink); border-radius: 10px 14px 8px 12px; overflow: hidden; background: var(--paper); box-shadow: 2px 3px 0 rgba(43, 37, 32, 0.14); }
.replay[hidden] { display: none; }
.replay canvas { display: block; width: 100%; height: 100%; }
.replay-tag { position: absolute; left: 8px; top: 7px; display: inline-flex; align-items: center; gap: 5px; padding: 3px 7px; border-radius: 6px; background: rgba(251, 247, 238, 0.85); font: 800 10px/1 var(--ui); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink); }
.replay-tag i { width: 7px; height: 7px; border-radius: 50%; background: var(--red); animation: rec-blink 1s steps(2) infinite; }
@keyframes rec-blink { 50% { opacity: 0.2; } }
.replay-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(43, 37, 32, 0.12); }
.replay-bar i { display: block; height: 100%; width: 0; background: var(--red); }
@media (max-height: 500px) and (min-width: 600px) {
  #ov-over .card { width: min(680px, 100%); display: grid; grid-template-columns: 1fr 1fr; column-gap: 20px; align-items: center; padding: 16px 20px; }
  #ov-over .replay { margin-bottom: 6px; }
  #ov-over .big { font-size: 60px; }
  #ov-over .stats { grid-template-columns: repeat(2, auto); margin: 0 0 10px; }
}

/* ---------- mode switch: endless or today's daily course ---------- */
.modes { display: flex; gap: 4px; padding: 4px; margin: 0 auto 12px; width: max-content; max-width: 100%; border: 1.5px solid var(--ink-dim); border-radius: 12px; background: var(--paper-2); }
.mode { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border: 0; border-radius: 9px; background: transparent; color: var(--ink-dim); font: 800 14px/1 var(--ui); cursor: pointer; }
.mode .ico { width: 16px; height: 16px; }
.mode.on { background: var(--ink); color: var(--paper-2); }
.daily-note { margin: -4px 0 12px; font-size: 13px; color: var(--ink-dim); }
.daily-note[hidden] { display: none; }

/* ---------- keep going: a paid revive on the score card ---------- */
.cta.revive { background: #2f9a6a; }
.cta.revive[hidden] { display: none; }
.rv-cost { display: inline-flex; align-items: center; gap: 4px; margin-left: 4px; padding: 3px 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.22); font: 800 14px/1 var(--ui); }
.rv-cost .ico { width: 14px; height: 14px; }

/* on short landscape screens the badge sits beside the score, so nothing runs off the card */
@media (max-height: 500px) and (min-width: 600px) {
  #ov-over .over-scoreline { display: flex; align-items: center; justify-content: center; gap: 14px; }
  #ov-over .over-side { display: grid; justify-items: start; gap: 6px; }
  #ov-over .over-side .big-label { margin: 0; }
  #ov-over .best-pill { margin: 0; }
}

/* ---------- splash: the name written in by the pen, then tap to start ---------- */
.overlay.splash { background: rgba(243, 236, 221, 0.78); cursor: pointer; }
.splash-in { text-align: center; padding: 16px; }
.splash-title { position: relative; display: inline-block; margin: 0; font-family: var(--hand); font-weight: 700; font-size: clamp(64px, 14vw, 132px); line-height: 1; color: var(--ink); }
.splash-title span { display: inline-block; padding: 0 0.06em; clip-path: inset(-20% 100% -20% 0); animation: splash-write 1.1s 0.25s cubic-bezier(0.55, 0.1, 0.35, 1) forwards; }
.splash-title .nib { position: absolute; top: 58%; left: 0; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: var(--pen); box-shadow: 0 0 0 3px rgba(45, 93, 168, 0.18); opacity: 0; animation: splash-nib 1.1s 0.25s cubic-bezier(0.55, 0.1, 0.35, 1) forwards; }
.splash-line { display: block; width: min(78%, 420px); height: auto; margin: -2px auto 10px; overflow: visible; }
.splash-line path { fill: none; stroke: var(--pen); stroke-width: 5; stroke-linecap: round; stroke-dasharray: 320; stroke-dashoffset: 320; animation: splash-line 0.55s 1.25s ease-out forwards; }
.splash-tag { opacity: 0; animation: splash-fade 0.5s 1.6s ease-out forwards; }
.splash-tap { margin: 22px 0 0; font: 800 13px/1 var(--ui); letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-dim); opacity: 0; animation: splash-fade 0.4s 1.9s ease-out forwards, splash-pulse 1.6s 2.3s ease-in-out infinite; }
@keyframes splash-write { to { clip-path: inset(-20% 0 -20% 0); } }
@keyframes splash-nib { 0% { left: 0; opacity: 1; } 92% { opacity: 1; } 100% { left: 100%; opacity: 0; } }
@keyframes splash-line { to { stroke-dashoffset: 0; } }
@keyframes splash-fade { to { opacity: 1; } }
@keyframes splash-pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) {
  .splash-title span { animation: none; clip-path: none; }
  .splash-title .nib { display: none; }
  .splash-line path { animation: none; stroke-dashoffset: 0; }
  .splash-tag, .splash-tap { animation: none; opacity: 1; }
}

/* ---------- settings ---------- */
.card.settings { width: min(440px, 100%); text-align: left; }
.card.settings h2 { text-align: center; margin-bottom: 12px; }
.set-list { display: grid; gap: 4px; margin: 0 0 14px; }
.set-row { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 4px 2px; border-bottom: 1px dashed rgba(43, 37, 32, 0.14); }
.set-row[hidden] { display: none; }
.set-label { display: inline-flex; align-items: center; gap: 8px; flex: 1; font: 800 14px/1.2 var(--ui); color: var(--ink); }
.set-label .ico { width: 18px; height: 18px; color: var(--ink-dim); }
.set-row input[type="range"] { flex: 1.3; min-width: 0; accent-color: var(--pen); height: 28px; }
.set-row output { width: 32px; text-align: right; font: 800 13px/1 var(--ui); color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.seg { display: flex; gap: 3px; padding: 3px; border: 1.5px solid var(--ink-dim); border-radius: 10px; background: var(--paper-2); }
.seg button { min-width: 50px; height: 32px; padding: 0 10px; border: 0; border-radius: 7px; background: transparent; color: var(--ink-dim); font: 800 13px/1 var(--ui); cursor: pointer; }
.seg button.on { background: var(--ink); color: var(--paper-2); }
.switch { position: relative; width: 50px; height: 30px; border: 2px solid var(--ink); border-radius: 999px; background: var(--paper); cursor: pointer; transition: background 0.15s; }
.switch i { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--ink); transition: transform 0.18s; }
.switch[aria-checked="true"] { background: var(--pen); }
.switch[aria-checked="true"] i { transform: translateX(20px); background: #fff; }
.set-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 0 0 14px; }
.cta.small { height: 40px; min-width: 0; padding: 0 14px; font-size: 14px; gap: 7px; box-shadow: 2px 3px 0 var(--ink); }
.cta.small .ico { width: 16px; height: 16px; }
.cta.danger, .cta.danger .ico { color: var(--red); }
.cta.danger.armed { background: var(--red); color: #fff; }
.cta.danger.armed .ico { color: #fff; }
.set-actions .done { order: 3; flex-basis: 100%; max-width: 240px; height: 48px; font-size: 17px; }
@media (max-height: 500px) and (min-width: 600px) {
  .card.settings { width: min(640px, 100%); }
  .set-list { grid-template-columns: 1fr 1fr; column-gap: 22px; }
}

/* the top bar sits above every card, so cards start below it */
.overlay:not(.splash) { padding-top: calc(60px + env(safe-area-inset-top)); }
.overlay:not(.splash) .card { max-height: calc(100dvh - 76px - env(safe-area-inset-top)); }
@media (max-height: 500px) {
  .overlay:not(.splash) { padding-top: 58px; padding-bottom: 8px; }
  .overlay:not(.splash) .card { max-height: calc(100dvh - 66px); }
}

@media (max-height: 500px) {
  .card.settings { padding: 12px 20px 14px; }
  .card.settings h2 { font-size: 28px; margin-bottom: 4px; }
  .set-row { min-height: 40px; padding: 2px; }
  .set-list { margin-bottom: 10px; }
  .set-actions { margin: 0; }
  .set-actions .done { flex-basis: auto; order: 0; max-width: none; height: 40px; min-width: 110px; font-size: 15px; }
}

/* ---------- a retry skips the card: missions flash up at the top instead ---------- */
.mission-strip { position: absolute; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); transform: translate(-50%, -8px); display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; width: max-content; max-width: calc(100% - 32px); pointer-events: none; opacity: 0; z-index: 4; }
.mission-strip.show { animation: strip-in 3.6s ease forwards; }
.mission-strip .ms { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border: 1.5px solid var(--ink); border-radius: 999px; background: var(--paper-2); font: 700 12px/1.1 var(--ui); color: var(--ink); box-shadow: 2px 2px 0 rgba(43, 37, 32, 0.14); }
.mission-strip .ms .ico { width: 14px; height: 14px; color: var(--ink-dim); }
@keyframes strip-in { 0% { opacity: 0; transform: translate(-50%, -8px); } 10%, 82% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; transform: translate(-50%, -4px); } }
.link-btn { display: block; margin: 10px auto 0; padding: 4px 8px; border: 0; background: none; font: 700 13px/1.2 var(--ui); color: var(--ink-dim); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
@media (max-height: 500px) { .mission-strip { bottom: 70px; } .mission-strip .ms { font-size: 11px; padding: 4px 8px; } }

/* ---------- stats and badges ---------- */
.card.stats-card { width: min(620px, 100%); text-align: left; }
.card.stats-card h2 { text-align: center; margin-bottom: 12px; }
.st-h { margin: 16px 0 8px; font-size: 11px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-dim); display: flex; gap: 8px; }
.st-h span { color: var(--ink); }
.st-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.st-tile { display: grid; justify-items: center; gap: 2px; padding: 10px 6px; border: 1.5px solid rgba(43, 37, 32, 0.16); border-radius: 12px; background: #fff; text-align: center; }
.st-tile .ico { width: 18px; height: 18px; color: var(--ink-dim); }
.st-tile b { font-family: var(--hand); font-size: 26px; line-height: 1; }
.st-tile span { font: 700 11px/1.2 var(--ui); color: var(--ink-dim); }
.st-bosses { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.st-boss { display: grid; justify-items: center; gap: 3px; padding: 8px 4px; border: 1.5px dashed rgba(43, 37, 32, 0.25); border-radius: 12px; text-align: center; color: var(--ink-dim); }
.st-boss .ico { width: 20px; height: 20px; }
.st-boss b { font: 800 12px/1.15 var(--ui); color: var(--ink); }
.st-boss span { font: 600 11px/1 var(--ui); }
.st-boss.won { border-style: solid; border-color: #e7a93a; background: rgba(231, 169, 58, 0.12); }
.st-boss.won .ico { color: #c98a1e; }
.st-deaths { display: grid; gap: 6px; }
.st-death { display: grid; grid-template-columns: 150px 1fr 34px; align-items: center; gap: 8px; font: 700 13px/1.2 var(--ui); }
.st-death i { display: block; height: 10px; border-radius: 5px; background: var(--red); opacity: 0.75; }
.st-death b { text-align: right; font-variant-numeric: tabular-nums; }
.st-empty { margin: 0; font: 600 13px/1.4 var(--ui); color: var(--ink-dim); }
.st-badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 8px; margin-bottom: 16px; }
.st-badge { display: grid; justify-items: center; gap: 3px; padding: 10px 6px; border: 1.5px solid rgba(43, 37, 32, 0.14); border-radius: 12px; text-align: center; color: var(--ink-dim); background: rgba(43, 37, 32, 0.03); }
.st-badge .ico { width: 22px; height: 22px; }
.st-badge b { font: 800 12px/1.15 var(--ui); }
.st-badge span { font: 600 10.5px/1.25 var(--ui); }
.st-badge.got { color: var(--ink); background: #fff; border-color: #e7a93a; box-shadow: 2px 2px 0 rgba(231, 169, 58, 0.5); }
.st-badge.got .ico { color: #c98a1e; }
.card.stats-card > .cta { display: flex; margin: 0 auto; }
.badge-lock { color: var(--ink-dim); }
@media (max-width: 560px) {
  .st-tiles { grid-template-columns: repeat(2, 1fr); }
  .st-bosses { grid-template-columns: repeat(3, 1fr); }
  .st-death { grid-template-columns: 110px 1fr 30px; font-size: 12px; }
}

/* ---------- highlight clip button, pinned on the replay ---------- */
.clip-btn { position: absolute; right: 8px; top: 7px; display: inline-flex; align-items: center; gap: 6px; max-width: 70%; padding: 6px 10px; overflow: hidden; border: 1.5px solid var(--ink); border-radius: 8px; background: #fbf7ee; font: 800 12px/1 var(--ui); color: var(--ink); cursor: pointer; box-shadow: 2px 2px 0 rgba(43, 37, 32, 0.25); }
.clip-btn[hidden] { display: none; }
.clip-btn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clip-btn .ico { width: 14px; height: 14px; flex: none; color: var(--red); }
.clip-btn i { position: absolute; left: 0; bottom: 0; height: 3px; width: 0; background: var(--red); }
.clip-btn:disabled { opacity: 0.8; cursor: progress; }

/* ---------- a friend's challenge, on the start card ---------- */
.challenge { margin: 0 0 14px; padding: 12px 14px; border: 2px dashed var(--red); border-radius: 12px; background: rgba(196, 67, 47, 0.06); text-align: center; }
.challenge[hidden] { display: none; }
.challenge p { margin: 0 0 10px; font: 700 14px/1.35 var(--ui); }
.challenge .cta { background: var(--red); }

/* ---------- level mode ---------- */
.card.levels-card { width: min(620px, 100%); }
.lv-sub { display: flex; align-items: center; justify-content: center; gap: 6px; margin: -6px 0 12px; font: 800 13px/1 var(--ui); color: var(--ink-dim); }
.lv-sub .ico { width: 16px; height: 16px; color: #e7a93a; fill: #e7a93a; }
.lv-world { margin: 0 0 12px; text-align: left; }
.lv-world h3 { margin: 0 0 6px; font-size: 11px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-dim); }
.lv-row { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.lv-tile { display: grid; justify-items: center; gap: 4px; padding: 8px 2px 6px; border: 2px solid var(--ink); border-radius: 10px; background: #fff; cursor: pointer; box-shadow: 2px 2px 0 rgba(43, 37, 32, 0.2); }
.lv-tile b { font: 700 22px/1 var(--hand); color: var(--ink); }
.lv-tile.boss { background: rgba(196, 67, 47, 0.08); border-color: var(--red); }
.lv-tile.locked { border-color: rgba(43, 37, 32, 0.2); box-shadow: none; background: rgba(43, 37, 32, 0.04); cursor: default; }
.lv-tile.locked .ico { width: 16px; height: 16px; color: var(--ink-dim); }
.lv-mini { display: flex; gap: 2px; }
.lv-mini i { width: 7px; height: 7px; border-radius: 50%; background: rgba(43, 37, 32, 0.15); }
.lv-mini i.on { background: #e7a93a; }
.card.levels-card > .cta { display: flex; margin: 6px auto 0; }
.lvl-name { margin: -4px 0 10px; font: 700 15px/1.3 var(--ui); color: var(--ink-dim); }
.lv-stars { display: flex; justify-content: center; gap: 10px; margin: 0 0 12px; }
.lv-star .ico { width: 40px; height: 40px; color: rgba(43, 37, 32, 0.2); fill: rgba(43, 37, 32, 0.08); }
.lv-star.on .ico { color: #c98a1e; fill: #f2c94c; }
.lv-star.on { animation: star-pop 0.4s cubic-bezier(0.3, 1.6, 0.5, 1) both; }
@keyframes star-pop { from { transform: scale(0.3) rotate(-30deg); opacity: 0; } to { transform: scale(1) rotate(0); opacity: 1; } }
.lv-goals { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 6px; text-align: left; }
.lv-goals li { display: flex; align-items: center; gap: 8px; font: 700 13px/1.3 var(--ui); color: var(--ink-dim); }
.lv-goals li .ico { width: 16px; height: 16px; flex: none; }
.lv-goals li.ok { color: var(--ink); }
.lv-goals li.ok .ico { color: #2f9a6a; }
@media (max-width: 560px) { .lv-row { grid-template-columns: repeat(4, 1fr); } }
@media (prefers-reduced-motion: reduce) { .lv-star.on { animation: none; } }

.set-select { min-width: 150px; height: 36px; padding: 0 10px; border: 1.5px solid var(--ink-dim); border-radius: 10px; background: var(--paper-2); font: 800 14px/1 var(--ui); color: var(--ink); cursor: pointer; }
/* Japanese: the hand-lettering font has no kana or kanji, so use a soft system face */
html[lang="ja"] { --hand: "Caveat", "Hiragino Maru Gothic ProN", "Yu Gothic", "Noto Sans JP", sans-serif; }
html[lang="zh"] { --hand: "Caveat", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif; }
html[lang="ko"] { --hand: "Caveat", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif; }

/* best moment or last seconds, on the replay */
.replay-tabs { position: absolute; left: 8px; top: 7px; display: flex; gap: 3px; padding: 3px; border-radius: 9px; background: rgba(251, 247, 238, 0.9); max-width: 58%; }
.replay-tabs[hidden] { display: none; }
.replay-tabs button { display: inline-flex; align-items: center; gap: 4px; max-width: 150px; padding: 4px 8px; border: 0; border-radius: 6px; background: transparent; font: 800 11px/1 var(--ui); color: var(--ink-dim); cursor: pointer; white-space: nowrap; overflow: hidden; }
.replay-tabs button span { overflow: hidden; text-overflow: ellipsis; }
.replay-tabs button .ico { width: 12px; height: 12px; flex: none; color: #c98a1e; }
.replay-tabs button.on { background: var(--ink); color: var(--paper-2); }
.replay-tag[hidden] { display: none; }
