@font-face {
  font-family: 'Fredoka';
  src: url('../assets/fonts/fredoka.woff2') format('woff2');
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

/* ---------------------------------------------------------------- tokens
   Every surface is cream paper with a cocoa-ink outline and a hard drop.
   Accents carry meaning only: coral = digging, teal = Shelly & buying,
   sun = hot / new / legendary. --cat-* and --rarity-* are written from JS. */

:root {
  --ink: #5b3a29;
  --ink-soft: #8a6049;
  --paper: #fff4e3;
  --paper-2: #ffe8c9;
  --paper-3: #f6d7ae;
  --paper-card: #fffaf2;
  --coral: #f08a6c;
  --coral-deep: #c9644a;
  --teal: #4f9e9a;
  --teal-deep: #3a7a77;
  --sun: #ffd27a;
  --sun-deep: #f7b267;
  --plum: #3d2f5c;
  --lcd-bg: #1f3833;
  --lcd-ink: #bff3d6;
  --new: #d44468;

  --fs-2xs: 10px;
  --fs-xs: 11.5px;
  --fs-s: 13px;
  --fs-m: 15px;
  --fs-l: 17px;
  --fs-xl: 19px;
  --fs-2xl: 22px;
  --fs-3xl: 26px;
  --fs-4xl: 30px;

  --night: 0;
  --shadow: rgba(20, 8, 30, calc(.28 + var(--night) * .2));
  --lift-1: 0 2px 0 var(--ink);
  --lift-2: 0 3px 0 var(--ink);
  --lift-3: 0 5px 0 var(--ink);
  --drop-1: 0 4px 10px var(--shadow);
  --drop-2: 0 6px 14px var(--shadow);
  --drop-3: 0 12px 28px rgba(40, 10, 40, .35);

  --bw-1: 1.5px;
  --bw-2: 2px;
  --bw-3: 2.5px;
  --bw-4: 3px;
  --r-chip: 6px;
  --r-s: 10px;
  --r-m: 14px;
  --r-l: 18px;
  --r-xl: 24px;
  --r-pill: 999px;

  /* legacy names, kept as aliases so untouched rules keep working */
  --cream: var(--paper);
  --cream-2: var(--paper-2);
  --cream-3: var(--paper-3);
  --brown: var(--ink);
  --brown-soft: var(--ink-soft);
  --coral-dark: var(--coral-deep);
  --sunset: var(--sun-deep);
  --teal-dark: var(--teal-deep);
  --lcd-fg: var(--lcd-ink);

  --vig-rgb: 120, 60, 40;
  --vig-a: .12;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --font: 'Fredoka', ui-rounded, 'SF Pro Rounded', 'Nunito', 'Varela Round', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #2a2150;
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  overscroll-behavior: none;
}

body { position: fixed; inset: 0; touch-action: manipulation; }

button {
  font-family: inherit;
  color: inherit;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}

.hidden { display: none !important; }

button:focus-visible, [role="switch"]:focus-visible, input:focus-visible { outline: 3px solid var(--sun); outline-offset: 3px; }
#modal-panel :focus-visible { outline-color: var(--teal-deep); }
button:focus:not(:focus-visible) { outline: none; }

#game {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  outline: none;
}

/* time-of-day vignette: a static CSS gradient, never a WebGL pass */
#grade {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  background: radial-gradient(ellipse 110% 85% at 50% 42%, rgba(0, 0, 0, 0) 58%, rgba(var(--vig-rgb), var(--vig-a)) 100%);
  transition: opacity .3s ease;
}

body.modal-open #grade { opacity: 0; }

.ico-inline { width: 1.1em; height: 1.1em; vertical-align: -0.2em; display: inline-block; }

/* ---------------------------------------------------------------- HUD */

#ui {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  transition: opacity .6s ease;
}

#ui > * { pointer-events: auto; }
#ui > #hint, #ui > .float-text, #ui > .watch-caption { pointer-events: none; }
body.nightfall #ui { opacity: 0; pointer-events: none; }
body.nightfall #ui > * { pointer-events: none; }

#hud-top {
  position: absolute;
  top: calc(var(--safe-top) + 10px);
  left: calc(var(--safe-left) + 10px);
  right: calc(var(--safe-right) + 10px);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  pointer-events: none;
}

#hud-top > * { pointer-events: auto; }

.hud-left { display: flex; align-items: flex-start; min-width: 0; }
.hud-right { display: flex; gap: 8px; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 44px;
  padding: 0 5px 0 8px;
  border-radius: var(--r-pill);
  background: var(--paper);
  border: var(--bw-3) solid var(--ink);
  box-shadow: var(--lift-2), var(--drop-2);
  font-weight: 600;
  line-height: 1;
}

.pill.status { font-family: inherit; color: var(--ink); cursor: pointer; }
.pill.status:active { transform: translateY(2px); box-shadow: var(--lift-1), var(--drop-1); }
.pill .ico { width: 26px; height: 26px; flex: 0 0 auto; }
#shell-count { font-size: var(--fs-xl); font-weight: 600; font-variant-numeric: tabular-nums; padding-right: 2px; }
.pill .sep { width: 2px; height: 24px; border-radius: 2px; background: var(--paper-3); flex: 0 0 auto; }
.pill.bump { animation: bump .22s cubic-bezier(.3, 1.6, .5, 1); }

@keyframes bump {
  0% { transform: scale(1); }
  45% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

/* live sky dial: the real sky gradient, the sun sinking, the moon rising */
.dial {
  position: relative;
  width: 44px;
  height: 30px;
  flex: 0 0 auto;
  border: 2px solid var(--ink);
  border-radius: 22px 22px 8px 8px;
  overflow: hidden;
  background: linear-gradient(to bottom, var(--sky-top, #5d8fd0), var(--sky-hz, #ffd79e) 78%);
  --sun-c: #ffe07a;
  --sea: #6f8ec4;
}

.dial::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 8px;
  background: var(--sea);
  border-top: 1.5px solid rgba(91, 58, 41, .55);
  z-index: 2;
}

.dial .sun {
  position: absolute;
  left: 12px;
  top: 8px;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  background: var(--sun-c);
  box-shadow: 0 0 6px 2px var(--sun-c);
  z-index: 1;
}

.dial .moon {
  position: absolute;
  right: 7px;
  top: 5px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  box-shadow: -2.5px 1px 0 0 #fff4e3;
  opacity: 0;
}

.dial .st { position: absolute; width: 2px; height: 2px; border-radius: 50%; background: #fff; opacity: var(--stars, 0); }

.icon-btn {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: var(--r-m);
  border: var(--bw-3) solid var(--ink);
  background: var(--paper);
  box-shadow: var(--lift-2), var(--drop-1);
  padding: 5px;
  display: grid;
  place-items: center;
  transition: transform .08s;
}

.icon-btn svg { width: 28px; height: 28px; display: block; }
.icon-btn:active { transform: translateY(2px); box-shadow: var(--lift-1), var(--drop-1); }

.badge {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: var(--r-pill);
  background: var(--coral);
  color: #fff;
  border: 2px solid var(--ink);
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.badge.dot { min-width: 0; width: 12px; height: 12px; padding: 0; top: -4px; right: -4px; background: var(--teal); }

@media (hover: hover) and (pointer: fine) {
  .icon-btn[data-key]::after {
    content: attr(data-key);
    position: absolute;
    right: -6px;
    bottom: -6px;
    min-width: 17px;
    height: 17px;
    padding: 0 3px;
    border-radius: 5px;
    background: var(--ink);
    color: var(--paper);
    font: 700 10.5px/17px var(--font);
    text-align: center;
    pointer-events: none;
  }
}

/* night: the paper dims a little, the detector glows like a lantern */
@supports (color: color-mix(in oklab, red, blue)) {
  .pill, .icon-btn, .toast, #hint, .world-bubble:not(.shop) {
    background-color: color-mix(in oklab, #fff4e3, #b89878 calc(var(--night) * 18%));
  }
}

/* ---------------------------------------------------------------- toasts & hint */

#toasts {
  position: fixed;
  z-index: 50;
  pointer-events: none;
  left: 0;
  right: 0;
  bottom: calc(var(--safe-bottom) + 124px);
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 6px;
  padding: 0 16px;
}

body[data-hint="center"] #toasts, body[data-hint="lcd"] #toasts, body[data-hint="dig"] #toasts {
  top: calc(var(--safe-top) + 62px);
  bottom: auto;
  flex-direction: column;
}

.toast {
  max-width: 100%;
  height: 36px;
  padding: 0 14px 0 5px;
  border-radius: var(--r-pill);
  background: var(--paper);
  border: var(--bw-2) solid var(--ink);
  box-shadow: var(--lift-1), var(--drop-1);
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  animation: toast-in .3s cubic-bezier(.3, 1.5, .5, 1) both;
  transition: opacity .3s ease, transform .3s ease;
}

.toast.no-ico { padding-left: 14px; }
.toast .t-ico { width: 26px; height: 26px; flex: 0 0 auto; border-radius: 50%; background: var(--paper-2); display: grid; place-items: center; }
.toast .t-ico img, .toast .t-ico svg { width: 20px; height: 20px; display: block; }
.toast .t-txt { overflow: hidden; text-overflow: ellipsis; }
.toast .plus { display: inline-flex; align-items: center; gap: 2px; font-weight: 700; color: var(--coral-deep); }
.toast .plus svg { width: 16px; height: 16px; }
.toast > svg.deco { width: 18px; height: 18px; flex: 0 0 auto; margin-left: -3px; }
.toast.out { opacity: 0; transform: translateY(-6px); }

@keyframes toast-in { from { opacity: 0; transform: translateY(8px) scale(.94); } to { opacity: 1; transform: none; } }
@keyframes toast-fade { from { opacity: 0; } to { opacity: 1; } }

/* watch the sunset: an offer that appears when you stand still, then the HUD
   steps aside while Cornelius sits and watches */
.watch-chip {
  position: absolute;
  left: 50%;
  top: calc(var(--safe-top) + 66px);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px 0 7px;
  border-radius: var(--r-pill);
  background: var(--paper);
  color: var(--ink);
  border: var(--bw-2) solid var(--ink);
  box-shadow: var(--lift-1), var(--drop-1);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  opacity: 0;
  transform: translate(-50%, -6px);
  transition: opacity .9s ease, transform .9s ease;
}
#ui > .watch-chip { pointer-events: none; }
#ui > .watch-chip.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.watch-chip svg { width: 28px; height: 28px; flex: 0 0 auto; }
.watch-chip:active { transform: translate(-50%, 1px) scale(.97); }

#hud-top, #hud-bottom, #hint, #shop-bubble, #toasts { transition: opacity .6s ease; }
body.watching #hud-top, body.watching #hud-bottom, body.watching #hint, body.watching #shop-bubble,
body.watching #toasts, body.watching .float-text {
  opacity: 0 !important;
  pointer-events: none !important;
  transition: opacity 1.6s ease;
}
body.watching #hud-top *, body.watching #hud-bottom *, body.watching #shop-bubble * { pointer-events: none !important; }

.watch-caption {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: calc(var(--safe-bottom) + 30px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
  color: #fff6ea;
  text-shadow: 0 1px 10px rgba(70, 36, 48, .55), 0 0 2px rgba(70, 36, 48, .4);
  opacity: 0;
  transition: opacity 1.6s ease;
}
.watch-caption b { font-size: 20px; font-weight: 600; letter-spacing: .01em; }
.watch-caption span { font-size: 13px; opacity: .85; }
.watch-caption.show { opacity: 1; }

/* tutorial coach mark: cream speech bubble with Cornelius's face */
#hint {
  position: absolute;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 124px);
  transform: translateX(-50%);
  width: max-content;
  max-width: min(340px, calc(100vw - 32px));
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px 8px 8px;
  border-radius: 20px;
  background: var(--paper);
  color: var(--ink);
  border: var(--bw-3) solid var(--ink);
  box-shadow: var(--lift-2), var(--drop-2);
  font-size: 15px;
  line-height: 1.3;
  text-align: left;
  animation: hint-in .5s cubic-bezier(.3, 1.4, .5, 1);
}

#hint b { color: var(--coral-deep); font-weight: 600; }
#hint .h-text { margin: 0; }
#hint .h-av {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: #ffe8c9 no-repeat 50% 50% / 108px;
}

#hint .h-dots {
  position: absolute;
  top: -1px;
  left: 64px;
  transform: translateY(-50%);
  display: flex;
  gap: 4px;
  padding: 2px 6px;
  border-radius: var(--r-pill);
  border: 2px solid var(--ink);
  background: var(--paper);
}

#hint .h-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--paper-3); }
#hint .h-dots i.on { background: var(--coral); }

#hint .h-tail {
  position: absolute;
  bottom: -10px;
  width: 18px;
  height: 18px;
  background: inherit;
  border-right: var(--bw-3) solid var(--ink);
  border-bottom: var(--bw-3) solid var(--ink);
  border-radius: 0 0 4px 0;
  transform: rotate(45deg);
  display: none;
}

#hint[data-anchor="lcd"] {
  left: calc(var(--safe-left) + 10px);
  right: auto;
  transform: none;
  bottom: calc(var(--safe-bottom) + 12px + var(--lcd-h, 96px) + 16px);
  max-width: min(260px, calc(100vw - 32px));
  animation-name: hint-in-anchor;
}

#hint[data-anchor="dig"] {
  left: auto;
  right: calc(var(--safe-right) + 10px);
  transform: none;
  bottom: calc(var(--safe-bottom) + 12px + var(--dig-h, 96px) + 16px);
  animation-name: hint-in-anchor;
}

#hint[data-anchor="shop"] {
  left: auto;
  right: calc(var(--safe-right) + 10px);
  top: calc(var(--safe-top) + 64px);
  bottom: auto;
  transform: none;
  max-width: min(300px, calc(100vw - 32px));
  animation-name: hint-in-anchor;
}

#hint[data-anchor="lcd"] .h-tail { display: block; left: 36px; }
#hint[data-anchor="dig"] .h-tail { display: block; right: 38px; }
#hint[data-anchor="shop"] .h-tail {
  display: block;
  top: -10px;
  bottom: auto;
  right: 117px;
  border: none;
  border-left: var(--bw-3) solid var(--ink);
  border-top: var(--bw-3) solid var(--ink);
  border-radius: 4px 0 0 0;
}

body.lefty #hint[data-anchor="lcd"] { left: auto; right: calc(var(--safe-right) + 10px); }
body.lefty #hint[data-anchor="lcd"] .h-tail { left: auto; right: 36px; }
body.lefty #hint[data-anchor="dig"] { right: auto; left: calc(var(--safe-left) + 10px); }
body.lefty #hint[data-anchor="dig"] .h-tail { right: auto; left: 38px; }

@keyframes hint-in { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes hint-in-anchor { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.coach-ring {
  position: absolute;
  inset: -8px;
  border-radius: 26px;
  border: 4px solid var(--sun);
  box-shadow: 0 0 0 1.5px rgba(91, 58, 41, .5);
  pointer-events: none;
  display: none;
  animation: coach-pulse 1.6s ease-in-out infinite;
}

#dig-btn .coach-ring { border-radius: 50%; }
.coach > .coach-ring { display: block; }
#btn-shop.coach { animation: coach-wiggle 2.4s ease-in-out infinite; }

@keyframes coach-pulse { 0%, 100% { opacity: .35; transform: scale(.98); } 50% { opacity: 1; transform: scale(1.03); } }
@keyframes coach-wiggle { 0%, 80%, 100% { transform: none; } 85% { transform: rotate(-9deg); } 90% { transform: rotate(8deg); } 95% { transform: rotate(-4deg); } }

/* ---------------------------------------------------------------- Shelly's world bubble */

.world-bubble {
  position: absolute;
  left: 0;
  top: 0;
  padding: 0;
  border: none;
  background: none;
  will-change: transform;
}

.world-bubble .wb-in {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px 4px 4px;
  border-radius: var(--r-pill);
  border: var(--bw-3) solid var(--ink);
  background: var(--teal);
  color: var(--paper);
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  text-shadow: 0 1px 0 rgba(30, 50, 50, .5);
  box-shadow: var(--lift-2), var(--drop-2);
  animation: bob 2s ease-in-out infinite alternate;
}

.world-bubble .wb-av {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: var(--paper) no-repeat 84% 50% / 70px;
}

.world-bubble .wb-tail {
  position: absolute;
  bottom: -9px;
  left: var(--tail-x, 50%);
  width: 16px;
  height: 16px;
  margin-left: -8px;
  background: var(--teal);
  border-right: var(--bw-3) solid var(--ink);
  border-bottom: var(--bw-3) solid var(--ink);
  border-radius: 0 0 3px 0;
  transform: rotate(45deg);
}

.world-bubble.no-tail .wb-tail { display: none; }
.world-bubble:active .wb-in { box-shadow: var(--lift-1), var(--drop-1); }

@keyframes bob { from { transform: translateY(0); } to { transform: translateY(-4px); } }

body.modal-open #shop-bubble { display: none; }
/* the HUD row would otherwise peek out above full-height paper panels */
#hud-top { transition: opacity .15s ease; }
body.modal-open #hud-top { opacity: 0; }

/* ---------------------------------------------------------------- bottom HUD */

#hud-bottom {
  position: absolute;
  left: calc(var(--safe-left) + 10px);
  right: calc(var(--safe-right) + 10px);
  bottom: calc(var(--safe-bottom) + 12px);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  pointer-events: none;
}

#hud-bottom > * { pointer-events: auto; }
body.lefty #hud-bottom { flex-direction: row-reverse; }

/* detector: bezel, LED, IRON key, backlit screen */
#lcd {
  position: relative;
  flex: 0 1 222px;
  min-width: 0;
  padding: 15px 7px 7px;
  border-radius: var(--r-l);
  background: linear-gradient(#f6e7cf, #e0c59e);
  border: var(--bw-3) solid var(--ink);
  box-shadow: var(--lift-2), var(--drop-1);
  --sig: #bff3d6;
}

.lcd-brand {
  position: absolute;
  top: 2px;
  left: 14px;
  font-size: 8.5px;
  line-height: 11px;
  font-weight: 600;
  letter-spacing: .16em;
  color: rgba(91, 58, 41, .55);
  pointer-events: none;
}

.lcd-led {
  position: absolute;
  top: 4px;
  right: 13px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #7a5a48;
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, .4);
}

#lcd.flash .lcd-led, #lcd.lock .lcd-led { background: var(--sig); box-shadow: 0 0 6px 1px var(--sig); }

#lcd-iron {
  position: absolute;
  top: 1px;
  right: 26px;
  height: 13px;
  padding: 0 5px;
  border-radius: 4px;
  border: 1px solid rgba(91, 58, 41, .45);
  background: transparent;
  color: rgba(91, 58, 41, .8);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .04em;
  line-height: 11px;
}

#lcd-iron::before { content: ''; position: absolute; inset: -15px -8px; }
#lcd-iron[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
#lcd-iron[aria-pressed="true"]::after {
  content: '';
  position: absolute;
  left: 2px;
  right: 2px;
  top: 50%;
  height: 1px;
  margin-top: -.5px;
  background: currentColor;
  opacity: .85;
  transform: rotate(-12deg);
}

.lcd-screen {
  position: relative;
  padding: 7px 9px 6px;
  border-radius: 11px;
  overflow: hidden;
  background: radial-gradient(130% 100% at 25% 0%, #2c4c45, #1f3833 70%);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, .5);
  color: var(--sig);
}

@supports (color: color-mix(in oklab, red, blue)) {
  #lcd { background: linear-gradient(color-mix(in oklab, #f6e7cf, #8a6a55 calc(var(--night) * 20%)), color-mix(in oklab, #e0c59e, #6e5444 calc(var(--night) * 20%))); }
  .lcd-screen { box-shadow: inset 0 2px 6px rgba(0, 0, 0, .5), 0 0 calc(var(--night) * 16px) color-mix(in srgb, var(--sig), transparent 65%); }
}

.lcd-screen::before, .lcd-screen::after { content: ''; position: absolute; inset: 0; pointer-events: none; }
.lcd-screen::before { background: repeating-linear-gradient(0deg, rgba(0, 0, 0, .14) 0 1px, transparent 1px 3px); }
.lcd-screen::after { background: linear-gradient(155deg, rgba(255, 255, 255, .09) 0 38%, transparent 38.5%); }

.lcd-bars {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 3px;
  height: 14px;
  align-items: end;
}

.lcd-bars i { display: block; border-radius: 2px; background: rgba(191, 243, 214, .12); }
.lcd-bars i.on { background: var(--sig); box-shadow: 0 0 5px var(--sig); }
.lcd-screen.cat-iron .lcd-bars i.on { box-shadow: none; background: repeating-linear-gradient(135deg, var(--sig) 0 2px, rgba(239, 106, 90, .45) 2px 4px); }
.lcd-screen.lock .lcd-bars i.on { background: var(--sun); box-shadow: 0 0 8px var(--sun); }

.lcd-scale { position: relative; display: flex; gap: 2px; height: 5px; margin-top: 6px; }
.lcd-scale span { border-radius: 2px; background: var(--c); opacity: .28; }
.lcd-scale span.act { opacity: 1; box-shadow: 0 0 5px var(--c); }
.lcd-screen.locked .lcd-scale span { background: var(--lcd-ink); opacity: .28; box-shadow: none; }

.lcd-scale .caret {
  position: absolute;
  top: 7px;
  left: 0;
  width: 0;
  height: 0;
  margin-left: -4px;
  border: 4px solid transparent;
  border-top: 0;
  border-bottom: 5px solid var(--sig);
  transition: left 120ms ease-out;
  display: none;
}

.lcd-screen.vdi .caret { display: block; }

.lcd-row { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 8px; gap: 6px; }
.lcd-left { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.lcd-cat { font-size: 13.5px; font-weight: 600; letter-spacing: .1em; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--sig); }

.lcd-depth { display: flex; align-items: center; gap: 2px; font-size: 8px; font-weight: 600; letter-spacing: .14em; line-height: 1; color: var(--lcd-ink); opacity: .85; }
.lcd-depth b { font-weight: 600; margin-right: 3px; }
.lcd-depth i { width: 9px; height: 6px; clip-path: polygon(0 0, 100% 0, 50% 100%); background: rgba(191, 243, 214, .22); }
.lcd-depth i.on { background: #bff3d6; }
.lcd-screen.locked .lcd-depth { opacity: .35; }

.seg7 { display: flex; gap: 4px; flex: 0 0 auto; transform: skewX(-7deg); color: var(--sig); margin-right: 1px; }
.seg7 .dg { position: relative; width: 15px; height: 27px; }
.seg7 .dg i { position: absolute; border-radius: 1.5px; background: currentColor; opacity: .1; }
.seg7 .dg i.on { opacity: 1; box-shadow: 0 0 4px currentColor; }
.seg7 .h { left: 2.5px; width: 10px; height: 3px; }
.seg7 .v { width: 3px; height: 10.5px; }
.seg7 .a { top: 0; }
.seg7 .g { top: 12px; }
.seg7 .d { top: 24px; }
.seg7 .f { left: 0; top: 2px; }
.seg7 .b { right: 0; top: 2px; }
.seg7 .e { left: 0; top: 14.5px; }
.seg7 .c { right: 0; top: 14.5px; }
.lcd-screen.locked .seg7 { opacity: .5; }
#lcd.flash .lcd-screen.locked .seg7 { opacity: 1; }

/* DIG: idle paper, warm peach, hot coral with a gold halo, busy scoop */
#dig-btn {
  position: relative;
  flex: 0 0 auto;
  width: 96px;
  height: 96px;
  padding: 0;
  border-radius: 50%;
  border: var(--bw-4) solid var(--ink);
  background: radial-gradient(circle at 35% 30%, #fffdf6, #f8e6c8 58%, #e8cda4);
  box-shadow: var(--lift-3), 0 10px 22px var(--shadow);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .08em;
  line-height: 1.1;
  transition: transform .07s;
  --s: 0;
  --sig: #bff3d6;
}

#dig-btn[data-state="warm"] { background: radial-gradient(circle at 35% 30%, #fff1e2, #fbc9a8 58%, #ef9d7c); }
#dig-btn[data-state="hot"] { background: radial-gradient(circle at 35% 30%, #ffb59b, var(--coral) 55%, var(--coral-deep)); color: #fff; text-shadow: 0 2px 0 rgba(91, 58, 41, .8); }
#dig-btn[data-state="busy"] { background: radial-gradient(circle at 35% 30%, #f7a488, #e27a5e 55%, #b95a42); color: #fff; text-shadow: 0 2px 0 rgba(91, 58, 41, .8); }

#dig-btn svg { position: relative; width: 46px; height: 46px; margin-bottom: -3px; }
#dig-btn .dig-label { position: relative; }
#dig-btn:active, #dig-btn.pressed { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink), 0 4px 10px var(--shadow); }

#dig-btn .ring, #dig-btn .halo, #dig-btn .pips { position: absolute; pointer-events: none; }

#dig-btn .ring {
  inset: -7px;
  border-radius: 50%;
  background: conic-gradient(var(--sig) calc(var(--s) * 1turn), rgba(91, 58, 41, .22) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4.5px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4.5px));
}

#dig-btn[data-state="idle"] .ring, #dig-btn[data-state="hot"] .ring { display: none; }

#dig-btn .halo {
  inset: -5px;
  border-radius: 50%;
  border: 4px solid var(--sun);
  box-shadow: 0 0 0 1.5px rgba(91, 58, 41, .55), 0 0 14px 4px rgba(255, 210, 122, .85);
  display: none;
}

#dig-btn[data-state="hot"] .halo { display: block; animation: halo 900ms ease-out infinite; }
#dig-btn[data-state="hot"] svg { animation: spade-wiggle 500ms ease-in-out infinite alternate; }
#dig-btn[data-state="busy"] svg { animation: spade-scoop 350ms ease-in-out infinite alternate; }

#dig-btn .pips { top: 7px; left: 50%; transform: translateX(-50%); display: none; gap: 4px; margin: 0; }
#dig-btn[data-state="busy"] .pips.show { display: flex; }
#dig-btn .pips i { flex: none; width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--paper); background: rgba(91, 58, 41, .35); }
#dig-btn .pips i.on { background: var(--paper); }
#dig-btn[data-state="busy"] svg { margin-top: 8px; }

@keyframes halo { from { transform: scale(1); opacity: .95; } to { transform: scale(1.08); opacity: .7; } }
@keyframes spade-wiggle { from { transform: rotate(-8deg); } to { transform: rotate(8deg); } }
@keyframes spade-scoop { from { transform: rotate(-25deg); } to { transform: rotate(10deg); } }

/* ---------------------------------------------------------------- title */

#title-screen {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: stretch;
  padding: calc(var(--safe-top) + 20px) 20px calc(var(--safe-bottom) + 20px);
  background: linear-gradient(to bottom, rgba(90, 40, 70, .40), rgba(90, 40, 70, .12) 26%, rgba(90, 40, 70, 0) 40%, rgba(0, 0, 0, 0) 62%, rgba(50, 20, 40, .38));
  transition: opacity .8s ease;
  cursor: pointer;
}

#title-screen.gone { opacity: 0; pointer-events: none; }

.title-inner {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 7vh 0 5vh;
  transform: none;
}

.title {
  margin: 0;
  font-size: clamp(44px, min(15vw, 11vh), 96px);
  line-height: .92;
  font-weight: 700;
  color: var(--paper);
  letter-spacing: -0.01em;
  text-shadow: 0 3px 0 #8a4a5a, 0 6px 0 #6b3348, 0 10px 24px rgba(40, 10, 40, .35);
}

.title span { display: block; color: var(--sun); white-space: nowrap; }
.title span i { display: inline-block; font-style: normal; animation: beep 2.4s ease-in-out infinite; }

@keyframes beep {
  0%, 70%, 100% { transform: none; }
  76% { transform: translateY(-8px) scale(1.04); }
  84% { transform: none; }
}

.subtitle {
  display: inline-block;
  margin: 12px 0 0;
  padding: 5px 14px 6px;
  border-radius: 18px;
  background: rgba(40, 20, 50, .36);
  color: var(--paper);
  font-size: 17px;
  font-weight: 500;
  line-height: 1.35;
  text-shadow: 1.5px 1.5px 0 #6b3348, -1.5px 1.5px 0 #6b3348, 1.5px -1.5px 0 #6b3348, -1.5px -1.5px 0 #6b3348, 0 0 12px rgba(40, 10, 40, .6);
}

.subtitle b { color: #ffe08f; font-weight: 700; }

.t-bottom { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.t-prog { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.t-prog:empty { display: none; }

.t-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px 3px 6px;
  border-radius: var(--r-pill);
  border: 2px solid var(--ink);
  background: rgba(255, 244, 227, .92);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: var(--lift-1);
}

.t-chip svg { width: 18px; height: 18px; }
.t-chip.plain { padding-left: 10px; }

.big-btn {
  font-size: 22px;
  font-weight: 600;
  padding: 15px 38px;
  border-radius: var(--r-pill);
  border: var(--bw-4) solid var(--ink);
  background: linear-gradient(#fff9ee, #ffe8c9);
  box-shadow: var(--lift-3), 0 12px 26px rgba(40, 10, 40, .35);
  animation: pulse 1.8s ease-in-out infinite;
}

.big-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--ink); animation: none; }

@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }

.tip {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px 5px 8px;
  border-radius: var(--r-pill);
  background: rgba(40, 20, 50, .35);
  color: var(--paper);
  font-size: 14px;
  text-shadow: 0 1px 4px rgba(40, 10, 40, .6);
}

.tip svg { width: 20px; height: 20px; }

/* ---------------------------------------------------------------- modal */

#modal-root {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: grid;
  place-items: center;
  padding: calc(var(--safe-top) + 14px) 12px calc(var(--safe-bottom) + 14px);
}

#modal-backdrop {
  position: absolute;
  inset: 0;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  background: radial-gradient(120% 90% at 50% 45%, rgba(70, 30, 50, .30), rgba(34, 14, 40, .62));
  animation: fade-in .25s ease;
}

#modal-root[data-tone="legendary"] #modal-backdrop { background: radial-gradient(90% 60% at 50% 42%, rgba(255, 200, 110, .38), rgba(60, 24, 30, .66)); }
#modal-root[data-tone="rare"] #modal-backdrop { background: radial-gradient(90% 60% at 50% 42%, rgba(190, 150, 255, .28), rgba(40, 18, 50, .64)); }
#modal-root[data-tone="note"] #modal-backdrop { background: radial-gradient(120% 90% at 50% 45%, rgba(30, 50, 70, .30), rgba(20, 20, 45, .66)); }

#modal-root.refresh #modal-backdrop, #modal-root.refresh #modal-panel { animation: none; }

#modal-panel {
  position: relative;
  width: 100%;
  max-width: 460px;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border: var(--bw-4) solid var(--ink);
  border-radius: var(--r-xl);
  box-shadow: 0 6px 0 var(--ink), 0 20px 50px rgba(20, 5, 20, .45);
  animation: pop-in .38s cubic-bezier(.3, 1.45, .5, 1);
  overflow: hidden;
}

@keyframes fade-in { from { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(24px) scale(.92); } }

.modal-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px 10px 18px;
  border-bottom: 2px dashed var(--paper-3);
  flex: 0 0 auto;
}

.modal-head h2 { margin: 0; font-size: var(--fs-2xl); font-weight: 600; flex: 1; line-height: 1.1; min-width: 0; }
.modal-head h2 small { display: block; font-size: var(--fs-s); font-weight: 400; color: var(--ink-soft); margin-top: 2px; }

.close-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: var(--bw-3) solid var(--ink);
  background: var(--paper-2);
  box-shadow: var(--lift-1);
  padding: 6px;
  flex: 0 0 auto;
}

.close-btn svg { width: 100%; height: 100%; display: block; }
.close-btn:active { transform: translateY(2px); box-shadow: none; }

.modal-body {
  padding: 14px 16px 18px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  overscroll-behavior: contain;
  flex: 1 1 auto;
  min-height: 0;
}

.btn {
  font-size: 17px;
  font-weight: 600;
  padding: 10px 20px;
  min-height: 46px;
  border-radius: var(--r-m);
  border: var(--bw-3) solid var(--ink);
  background: var(--paper-2);
  box-shadow: var(--lift-2);
}

.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.btn.primary { background: linear-gradient(#ee8466, #d4664e); color: #fff; font-weight: 700; text-shadow: 0 1.5px 0 rgba(91, 58, 41, .55); }
.btn.teal { background: var(--teal-deep); color: #fff; text-shadow: 0 1px 0 rgba(30, 50, 50, .5); }
.btn.danger { background: #d9534f; color: #fff; text-shadow: 0 1px 0 rgba(91, 30, 30, .4); }
.btn:disabled { opacity: .5; box-shadow: var(--lift-2); transform: none; cursor: default; }

/* the CTA of a find card or note arms after a beat, so a DIG tap can't dismiss it */
#modal-panel [data-close].btn { transition: opacity .22s ease, transform .28s cubic-bezier(.3, 1.5, .5, 1); }
.btn.arming { opacity: 0; transform: translateY(8px) scale(.96); pointer-events: none; }

/* ---------------------------------------------------------------- find card */

#modal-panel > .find-card { overflow-y: auto; overflow-x: hidden; min-height: 0; max-height: 100%; }

.find-card {
  text-align: center;
  padding: 20px 18px 20px;
  position: relative;
  --k: 1;
  --ray: rgba(106, 165, 107, .28);
  --rc: var(--rarity-common, #6aa56b);
  --rd: var(--rarity-common-deep, #3f7a41);
}

.fc-junk .find-card { --k: .4; --rc: var(--rarity-junk, #a08f7e); --rd: var(--rarity-junk-deep, #7a6a5a); padding: 16px; }
.fc-uncommon .find-card { --ray: rgba(79, 143, 192, .28); --rc: var(--rarity-uncommon, #4f8fc0); --rd: var(--rarity-uncommon-deep, #2f6a99); }
.fc-rare .find-card { --ray: rgba(154, 106, 208, .30); --rc: var(--rarity-rare, #9a6ad0); --rd: var(--rarity-rare-deep, #7446a8); }
.fc-legendary .find-card { --ray: rgba(255, 190, 60, .55); --rc: var(--rarity-legendary, #e0a526); --rd: var(--rarity-legendary-deep, #8a5a0e); }

#modal-panel.fc-junk { max-width: 330px; }
#modal-panel.fc-rare {
  background: linear-gradient(#f3eafc 0, var(--paper) 190px);
  box-shadow: 0 6px 0 var(--ink), 0 0 0 5px rgba(154, 106, 208, .25), 0 20px 50px rgba(20, 5, 20, .45);
}
#modal-panel.fc-legendary {
  background: radial-gradient(130% 60% at 50% 20%, #fff8df, #ffecb8 55%, #fcdc92);
  border-color: #7a4a14;
  box-shadow: 0 6px 0 #7a4a14, 0 0 0 6px rgba(255, 214, 120, .45), 0 0 60px 10px rgba(255, 190, 80, .45);
}

.find-card > * { position: relative; }

.find-card .rays, .find-card .rays2, .find-card .flash, .find-card .spark { position: absolute; pointer-events: none; }

.find-card .rays {
  left: 50%;
  top: 92px;
  width: 280px;
  height: 280px;
  margin: -140px 0 0 -140px;
  border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, var(--ray) 0 10deg, transparent 10deg 20deg);
  -webkit-mask-image: radial-gradient(circle, #000 20%, transparent 68%);
  mask-image: radial-gradient(circle, #000 20%, transparent 68%);
  animation: rays-in .5s ease-out both, spin 14s linear .5s infinite;
}

.fc-common .find-card .rays { opacity: .6; }
.fc-junk .find-card .rays { display: none; }
.fc-legendary .find-card .rays { width: 380px; height: 380px; margin: -190px 0 0 -190px; top: 110px; animation: rays-in .5s ease-out both, spin 22s linear .5s infinite; }

.find-card .rays2 {
  left: 50%;
  top: 110px;
  width: 300px;
  height: 300px;
  margin: -150px 0 0 -150px;
  border-radius: 50%;
  background: repeating-conic-gradient(from 5deg, rgba(255, 245, 200, .7) 0 4deg, transparent 4deg 22deg);
  -webkit-mask-image: radial-gradient(circle, #000 20%, transparent 68%);
  mask-image: radial-gradient(circle, #000 20%, transparent 68%);
  animation: rays-in .5s ease-out both, spin 30s linear .5s infinite reverse;
}

.find-card .flash {
  left: 50%;
  top: 110px;
  width: 240px;
  height: 240px;
  margin: -120px 0 0 -120px;
  border-radius: 50%;
  background: radial-gradient(#fff, rgba(255, 230, 150, 0) 60%);
  opacity: 0;
  animation: flash 450ms ease-out 150ms both;
}

.find-card .spark {
  width: 14px;
  height: 14px;
  background: radial-gradient(circle, #fff 0 18%, transparent 20%), conic-gradient(from 45deg, transparent 0 20deg, #fff6c8 20deg 25deg, transparent 25deg 110deg, #fff6c8 110deg 115deg, transparent 115deg 200deg, #fff6c8 200deg 205deg, transparent 205deg 290deg, #fff6c8 290deg 295deg, transparent 295deg);
  animation: twinkle 1.8s ease-in-out infinite;
  z-index: 1;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rays-in { from { opacity: 0; transform: scale(.6); } }
@keyframes flash { from { transform: scale(.2); opacity: 1; } to { transform: scale(1.8); opacity: 0; } }
@keyframes twinkle { 0%, 100% { transform: scale(.3) rotate(0); opacity: 0; } 50% { transform: scale(1.1) rotate(45deg); opacity: 1; } }

.find-card .icon-slot { display: block; height: 150px; }
.find-card .icon-slot canvas, .find-card .icon-slot img { width: 150px; height: 150px; animation: item-pop .6s cubic-bezier(.3, 1.7, .5, 1) calc(.12s * var(--k)) both; }
.fc-junk .find-card .icon-slot { height: 104px; }
.fc-junk .find-card .icon-slot canvas { width: 104px; height: 104px; animation: item-pop .6s cubic-bezier(.3, 1.7, .5, 1) calc(.12s * var(--k)) both, wobble 2.4s ease-in-out .6s infinite; }
.fc-rare .find-card .icon-slot canvas { filter: drop-shadow(0 0 10px rgba(190, 150, 255, .8)); }
.fc-legendary .find-card .icon-slot { height: 176px; }
.fc-legendary .find-card .icon-slot canvas { width: 176px; height: 176px; filter: drop-shadow(0 0 14px rgba(255, 200, 90, .95)); }

@keyframes item-pop { from { transform: scale(.2) rotate(-20deg); opacity: 0; } }
@keyframes wobble { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes chip { from { opacity: 0; transform: scale(.7); } }
@keyframes star { from { opacity: .2; transform: scale(1.6); } }

.find-card .kicker {
  display: block;
  margin: -4px 0 2px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--rd);
  animation: rise .24s ease-out calc(.30s * var(--k)) both;
}

.find-card h3 { margin: 2px 0 6px; font-size: var(--fs-3xl); font-weight: 600; line-height: 1.1; animation: rise .24s ease-out calc(.30s * var(--k)) both; }
.fc-junk .find-card h3 { font-size: 23px; }

.rarity {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  font-size: var(--fs-s);
  font-weight: 600;
  color: #fff;
  letter-spacing: .04em;
  background: var(--rd, var(--ink-soft));
}

.rarity .stars { display: inline-flex; gap: 1px; }
.rarity i.st, .rarity .stars i {
  display: inline-block;
  width: 11px;
  height: 11px;
  background: currentColor;
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

.find-card .rarity { animation: chip .28s cubic-bezier(.3, 1.6, .5, 1) calc(.38s * var(--k)) both; box-shadow: 0 2px 0 rgba(91, 58, 41, .35); }
.find-card .rarity i.st { animation: star .22s cubic-bezier(.3, 1.8, .5, 1) calc(.44s + var(--i) * 70ms) both; }
.fc-legendary .find-card .rarity { background: linear-gradient(90deg, #e0a526, #ffd45e, #e0a526); color: var(--ink); border: 2px solid #7a4a14; }

.find-card .desc { margin: 12px auto 6px; max-width: 300px; font-size: 16px; line-height: 1.35; color: var(--ink-soft); text-wrap: pretty; animation: rise .24s ease-out calc(.52s * var(--k)) both; }

.find-card .unlock {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 290px;
  margin: 4px auto 10px;
  padding: 8px 12px 8px 8px;
  border-radius: 14px;
  background: #fff;
  border: 2.5px dashed #c98f2a;
  text-align: left;
  font-size: 14px;
  line-height: 1.25;
  animation: rise .24s ease-out calc(.56s * var(--k)) both;
}
.find-card .unlock > span:last-child { text-wrap: balance; }

.find-card .unlock b { display: block; font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #b3761a; }
.find-card .unlock .u-ico { width: 40px; height: 40px; flex: 0 0 auto; border-radius: 10px; background: #fff3cf no-repeat 50% 50% / 88%; display: grid; place-items: center; }
.find-card .unlock .u-ico.crown { background-size: 70px; background-position: 50% 12%; }
.find-card .unlock .u-ico svg { width: 26px; height: 26px; }

.find-card .value {
  display: inline-flex;
  align-items: center;
  gap: 0;
  margin: 6px 0 8px;
  font-size: var(--fs-2xl);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  animation: rise .24s ease-out calc(.60s * var(--k)) both;
}

.find-card .value b { font-weight: 600; }
.find-card .value svg { width: 26px; height: 26px; margin-left: 6px; }

.find-card .chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 0 0 14px; animation: rise .24s ease-out calc(.66s * var(--k)) both; }
.chip { display: inline-block; padding: 3px 8px; border-radius: 7px; font-size: 12px; font-weight: 600; letter-spacing: .06em; }
.chip.lcd { background: var(--lcd-bg); box-shadow: inset 0 1px 3px rgba(0, 0, 0, .4); }
.chip.soft { background: rgba(91, 58, 41, .08); color: var(--ink-soft); letter-spacing: .02em; }

.find-card .btn { min-width: 150px; }
.fc-junk .find-card .btn.primary { background: var(--teal-deep); text-shadow: 0 1px 0 rgba(30, 50, 50, .5); }
.fc-rare .find-card .btn.primary { background: #7446a8; }
.fc-legendary .find-card .btn.primary {
  min-width: 180px;
  background: linear-gradient(#ffd96a, #f0ae2e);
  color: var(--ink);
  text-shadow: 0 1px 0 rgba(255, 255, 255, .5);
  border-color: #7a4a14;
  box-shadow: 0 3px 0 #7a4a14;
}

.new-ribbon {
  position: absolute;
  top: 16px;
  left: -6px;
  background: var(--new);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  padding: 5px 14px 5px 12px;
  border-radius: 0 var(--r-pill) var(--r-pill) 0;
  border: var(--bw-3) solid var(--ink);
  border-left: none;
  box-shadow: var(--lift-1);
  transform: rotate(-4deg);
  z-index: 2;
}

.find-card > .new-ribbon { position: absolute; }

/* ---------------------------------------------------------------- journal scrapbook */

#modal-panel.journal { background: #fbf3e2; }
#modal-panel.journal::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 14px; background: #e98a6c; border-right: var(--bw-3) solid var(--ink); z-index: 2; pointer-events: none; }
#modal-panel.journal::after { content: ''; position: absolute; left: 5px; top: 10px; bottom: 10px; width: 0; border-left: 2px dashed rgba(255, 244, 227, .8); z-index: 3; pointer-events: none; }
.journal .modal-head { padding-left: 28px; border-bottom: none; }
.journal .modal-body { padding-left: 26px; background: repeating-linear-gradient(transparent 0 31px, rgba(160, 120, 80, .10) 31px 32px); background-attachment: local; }

.j-section { display: flex; align-items: center; gap: 8px; margin: 18px 0 10px; }
.j-section:first-child { margin-top: 4px; }

.j-tape {
  display: inline-block;
  padding: 4px 12px 3px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .06em;
  color: #fff;
  transform: rotate(-2deg);
  background: repeating-linear-gradient(135deg, rgba(255, 255, 255, .18) 0 6px, transparent 6px 12px), var(--rd, var(--ink-soft));
  text-shadow: 0 1px 0 rgba(0, 0, 0, .2);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .15);
}

.j-count { font-size: 13px; font-weight: 500; color: var(--ink-soft); }
.j-count b { color: var(--ink); font-weight: 600; }

.journal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 10px 8px;
}

.j-cell {
  position: relative;
  min-height: 90px;
  padding: 8px 4px 6px;
  border: none;
  border-radius: 6px;
  background: transparent;
  font-family: inherit;
  color: inherit;
  font-size: 11.5px;
  line-height: 1.15;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
}

.j-cell img { width: 52px; height: 52px; }
.j-cell.found { background: #fff; box-shadow: 0 1px 0 rgba(91, 58, 41, .12), 0 3px 8px rgba(91, 58, 41, .12); transform: rotate(var(--tilt, 0deg)); }
.j-cell.found::before { content: ''; position: absolute; top: -6px; left: 50%; width: 34px; height: 12px; margin-left: -17px; background: var(--rc); opacity: .55; transform: rotate(-4deg); }
.j-cell.locked { border: 2px dashed #e2cfb4; border-radius: var(--r-s); background: rgba(255, 255, 255, .25); color: #8f7563; }
.j-cell.locked img { opacity: .55; }
.j-cell:active { transform: rotate(var(--tilt, 0deg)) scale(.96); }
.j-cell .count { position: absolute; top: 4px; right: 4px; padding: 1px 5px; border-radius: var(--r-pill); background: var(--ink); color: var(--paper); font-size: 10px; font-weight: 600; line-height: 1.3; }
.j-cell .new-st { position: absolute; top: -8px; right: -6px; z-index: 1; padding: 2px 6px; border-radius: var(--r-pill); border: 2px solid #fff; background: var(--new); color: #fff; font-size: 10.5px; font-weight: 700; transform: rotate(8deg); box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }

.j-log { margin-top: 20px; padding: 12px 14px; border-radius: 6px; background: #fff; box-shadow: 0 1px 0 rgba(91, 58, 41, .12), 0 3px 8px rgba(91, 58, 41, .12); transform: rotate(-.6deg); }
.j-log h4 { margin: 0 0 4px; font-size: 13px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-soft); }
.j-log div { display: flex; align-items: baseline; font-size: 15px; line-height: 1.9; }
.j-log div span { flex: 1; margin: 0 6px; border-bottom: 2px dotted #e6d4bb; transform: translateY(-5px); }
.j-log div b { font-weight: 600; font-variant-numeric: tabular-nums; }

.j-letters { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 12px 8px; justify-items: center; }
.j-env {
  width: 64px;
  height: 46px;
  padding: 0;
  border-radius: 6px;
  border: 2px solid #d9bf8c;
  background: linear-gradient(to bottom right, transparent 49%, #e8d3a6 50%) top left / 50% 50% no-repeat, linear-gradient(to bottom left, transparent 49%, #e8d3a6 50%) top right / 50% 50% no-repeat, #fbf1d9;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  display: grid;
  place-items: end center;
  padding-bottom: 3px;
  box-shadow: 0 2px 4px rgba(91, 58, 41, .12);
}

.j-env:nth-child(odd) { transform: rotate(-2deg); }
.j-env:nth-child(even) { transform: rotate(1.5deg); }
.j-env.locked { border-style: dashed; background: rgba(255, 255, 255, .25); color: #8f7563; place-items: center; padding: 0; box-shadow: none; cursor: default; }

/* item detail: a journal page with a specimen plate */
.jd .modal-head { gap: 8px; padding-left: 24px; }
.back-btn { padding: 5px; }
.detail { text-align: center; }
.detail.slide { animation: slide-in .22s ease-out both; }

@keyframes slide-in { from { opacity: 0; transform: translateX(18px); } }

.spec-wrap { position: relative; width: 264px; max-width: 100%; margin: 2px auto 10px; display: flex; align-items: center; justify-content: center; }

.spec-plate {
  width: 168px;
  height: 168px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle, var(--rt) 0 62%, transparent 63%);
  outline: 2px dashed var(--rc50, rgba(91, 58, 41, .3));
  outline-offset: -6px;
}

.spec-plate canvas, .spec-plate img { width: 132px; height: 132px; }
.spec-plate.locked { filter: grayscale(1); }

.spec-nav {
  position: absolute;
  top: 50%;
  width: 44px;
  height: 44px;
  margin-top: -22px;
  border-radius: 50%;
  border: var(--bw-3) solid var(--ink);
  background: var(--paper);
  box-shadow: var(--lift-1);
  padding: 0;
}

.spec-nav::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 10px;
  margin: -6px 0 0 -3px;
  border-left: 3px solid var(--ink);
  border-bottom: 3px solid var(--ink);
  border-radius: 0 0 0 2px;
  transform: rotate(45deg);
}

.spec-nav.prev { left: 0; }
.spec-nav.next { right: 0; }
.spec-nav.next::before { margin-left: -8px; transform: rotate(-135deg); }
.spec-nav:disabled { opacity: .3; cursor: default; box-shadow: none; }
.spec-nav:active:not(:disabled) { transform: translateY(2px); box-shadow: none; }

.detail .rarity { margin-top: 2px; }
.detail .d-desc { margin: 12px auto 12px; max-width: 300px; font-size: 18px; line-height: 1.4; color: var(--ink); text-wrap: pretty; }
.detail .d-tip { margin: 0 auto 10px; max-width: 300px; font-size: 14px; line-height: 1.35; color: var(--ink-soft); }

.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 4px 0 6px; }
.facts > div { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 64px; padding: 8px 4px; border-radius: 12px; border: 2px solid var(--paper-3); background: var(--paper-card); font-size: 18px; font-weight: 600; }
.facts small { font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); }
.facts .f-v { display: inline-flex; align-items: center; gap: 4px; }
.facts .f-v svg { width: 20px; height: 20px; }
.facts .chip.lcd { font-size: 12px; }
.depth-pips { display: inline-flex; gap: 4px; }
.depth-pips i { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--ink); background: var(--sun-deep); }

/* ---------------------------------------------------------------- shop: Shelly's stall */

.shelly-img { width: 72px; height: 72px; flex: 0 0 auto; margin: 0 -4px -10px -4px; position: relative; z-index: 1; }

.shop-head { position: relative; padding: 30px 12px 12px; border-bottom: none; align-items: flex-end; }
.shop-head::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 26px; background: repeating-linear-gradient(90deg, #f08a6c 0 26px, #fff4e3 26px 52px); border-bottom: var(--bw-3) solid var(--ink); }
.shop-head::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 26px;
  height: 12px;
  background: radial-gradient(circle at 13px -2px, #f08a6c 0 11px, #5b3a29 11px 13.5px, transparent 14px) 0 0 / 52px 12px repeat-x, radial-gradient(circle at 13px -2px, #fff4e3 0 11px, #5b3a29 11px 13.5px, transparent 14px) 26px 0 / 52px 12px repeat-x;
  pointer-events: none;
}

.shop-head .close-btn { align-self: center; position: relative; z-index: 1; }
.shop-head .sh-title { flex: 1; min-width: 0; padding-top: 10px; }
.shop-head h2 { font-size: 20px; white-space: nowrap; }
.shop-head h2 small { display: none; }

.wallet {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  margin-top: 4px;
  padding: 0 10px 0 5px;
  border-radius: var(--r-pill);
  border: var(--bw-3) solid var(--ink);
  background: #fff;
  box-shadow: var(--lift-1);
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.wallet svg { width: 22px; height: 22px; }

.counter {
  flex: 0 0 auto;
  height: 14px;
  border-block: var(--bw-3) solid var(--ink);
  background: repeating-linear-gradient(90deg, transparent 0 60px, rgba(91, 58, 41, .25) 60px 62px), linear-gradient(#d49a62, #b77b47);
}

.shop-speech {
  position: relative;
  margin: 8px 0 12px;
  padding: 9px 12px;
  border-radius: 16px;
  border: 2px solid var(--paper-3);
  background: #fff;
  font-size: 14.5px;
  line-height: 1.3;
  color: var(--ink-soft);
}

.shop-speech::before { content: ''; position: absolute; left: 22px; top: -10px; width: 16px; height: 16px; background: #fff; border-left: 2px solid var(--paper-3); border-top: 2px solid var(--paper-3); transform: rotate(45deg); }

.shop-section { font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); margin: 16px 0 8px; }

.shop-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px;
  border-radius: 16px;
  background: var(--paper-card);
  border: 2px solid var(--paper-3);
  margin-bottom: 8px;
}

.shop-item.just-bought { animation: row-glow .6s ease-out; }
@keyframes row-glow { 0% { background: #e3f3ee; border-color: rgba(79, 158, 154, .3); } 100% { background: var(--paper-card); border-color: var(--paper-3); } }

.shop-item .icon-slot { width: 54px; height: 54px; flex: 0 0 auto; border-radius: 12px; background: var(--paper-2); display: grid; place-items: center; }
.shop-item .icon-slot canvas { width: 46px; height: 46px; }
.shop-item .info { flex: 1; min-width: 0; }
.shop-item .name { font-weight: 600; font-size: 16px; }
.shop-item .desc { font-size: 12.5px; color: var(--ink-soft); line-height: 1.25; margin-top: 1px; }

.shop-item .pips { display: flex; align-items: center; gap: 4px; margin-top: 5px; }
.shop-item .pips i { width: 18px; height: 8px; border-radius: 4px; background: var(--paper-3); }
.shop-item .pips i.on { background: var(--teal); }
.shop-item .pips i.new { animation: pip-pop .26s cubic-bezier(.3, 1.8, .5, 1); }
.shop-item .pips .lvl { margin-left: 4px; font-size: 11.5px; font-weight: 600; color: var(--teal-deep); letter-spacing: .02em; }

@keyframes pip-pop { from { transform: scale(.2); } }

.buy-wrap { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.buy-wrap .need { font-size: 11px; color: var(--ink-soft); font-weight: 500; white-space: nowrap; }
.buy-wrap .need:empty { display: none; }

.buy-btn {
  flex: 0 0 auto;
  min-width: 78px;
  min-height: 44px;
  padding: 6px 10px;
  border-radius: 13px;
  border: var(--bw-3) solid var(--ink);
  background: var(--teal-deep);
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  box-shadow: var(--lift-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
  text-shadow: 0 1px 0 rgba(30, 50, 50, .5);
}

.buy-btn svg { width: 18px; height: 18px; }
.buy-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.buy-btn.cant { background: #cdbfb2; text-shadow: none; color: #6e5a4c; }
.buy-btn.owned { background: var(--paper-2); color: var(--ink); text-shadow: none; }
.buy-btn.got { background: var(--teal); }
.buy-btn.deny { animation: deny .3s ease; }
.buy-btn.needing { font-size: 12px; line-height: 1.05; white-space: normal; padding: 4px 6px; background: #cdbfb2; color: #6e5a4c; text-shadow: none; }
.buy-btn.maxed, .buy-btn.equipped { border: none; background: transparent; box-shadow: none; color: var(--teal-deep); text-shadow: none; cursor: default; padding-left: 6px; }
.buy-btn.maxed::before, .buy-btn.equipped::before { content: ''; width: 5px; height: 10px; margin: -3px 4px 0 0; border-right: 2.5px solid currentColor; border-bottom: 2.5px solid currentColor; transform: rotate(40deg); }
.buy-btn.maxed:active, .buy-btn.equipped:active { transform: none; }
.buy-btn.locked-hat { background: #cdbfb2; color: #6e5a4c; text-shadow: none; cursor: default; }

@keyframes deny { 0%, 100% { transform: none; } 20% { transform: translateX(-5px); } 45% { transform: translateX(5px); } 70% { transform: translateX(-4px); } 88% { transform: translateX(3px); } }

.hat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }

.hat-card {
  position: relative;
  border-radius: 16px;
  background: radial-gradient(40% 7% at 50% 64%, rgba(91, 58, 41, .16), transparent 100%), var(--paper-card);
  border: 2px solid var(--paper-3);
  padding: 6px 6px 8px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.hat-card img { width: 80px; height: 80px; }
.hat-card.hop img { animation: hat-hop .42s ease-out; }
.hat-card .name { font-size: 13px; font-weight: 600; line-height: 1.1; min-height: 2.2em; display: flex; align-items: center; }
.hat-card .buy-wrap { width: 100%; }
.hat-card .buy-btn { width: 100%; min-width: 0; font-size: 14px; min-height: 38px; }
.hat-card .h-note { font-size: 11px; color: var(--ink-soft); }
.hat-card.is-equipped { border-color: #ffc86b; background: radial-gradient(40% 7% at 50% 64%, rgba(91, 58, 41, .16), transparent 100%), #fff3d6; }
.hat-card.is-equipped::before {
  content: 'Wearing';
  position: absolute;
  top: 6px;
  left: -4px;
  z-index: 1;
  padding: 2px 8px 2px 6px;
  border-radius: 0 var(--r-pill) var(--r-pill) 0;
  border: 2px solid var(--ink);
  border-left: none;
  background: var(--sun);
  font-size: 11px;
  font-weight: 700;
}

@keyframes hat-hop { 40% { transform: translateY(-10px) rotate(-6deg); } }

/* ---------------------------------------------------------------- settings */

.set-group { background: var(--paper-card); border: 2px solid var(--paper-3); border-radius: 16px; padding: 2px 14px; margin-bottom: 12px; }
.set-group + .shop-section, .modal-body > .shop-section:first-child { margin-top: 4px; }
.setting { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 2px dashed var(--paper-3); flex-wrap: wrap; }
.setting:last-child { border-bottom: none; }
.setting.stack .seg { flex: 1 1 100%; display: flex; }
.setting.stack .seg button { flex: 1; }
.setting label { flex: 1; font-size: 16px; font-weight: 500; }
.setting label small { display: block; font-size: 12.5px; color: var(--ink-soft); font-weight: 400; }

input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  width: 150px;
  height: 28px;
  background: transparent;
  touch-action: pan-x;
  --p: 50%;
}

input[type=range]::-webkit-slider-runnable-track { height: 10px; border-radius: 999px; border: 2px solid var(--ink); background: linear-gradient(90deg, var(--coral) 0 var(--p), var(--paper-3) var(--p) 100%); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; margin-top: -10px; border-radius: 50%; background: #fff; border: var(--bw-3) solid var(--ink); box-shadow: 0 2px 0 var(--ink); }
input[type=range]::-moz-range-track { height: 8px; border-radius: 999px; border: 2px solid var(--ink); background: linear-gradient(90deg, var(--coral) 0 var(--p), var(--paper-3) var(--p) 100%); }
input[type=range]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: #fff; border: var(--bw-3) solid var(--ink); }

.seg { display: inline-flex; border: var(--bw-3) solid var(--ink); border-radius: 12px; overflow: hidden; flex: 0 0 auto; }
.seg button { border: none; background: var(--paper-2); padding: 8px 10px; font-size: 13.5px; font-weight: 500; min-height: 40px; line-height: 1.15; }
.seg button + button { border-left: 2px solid var(--ink); }
.seg button.on { background: var(--teal-deep); color: #fff; }
.seg button small { display: block; font-size: 11px; font-weight: 400; color: var(--ink-soft); }
.seg button.on small { color: rgba(255, 255, 255, .85); }

.toggle {
  width: 58px;
  height: 34px;
  border-radius: 999px;
  border: var(--bw-3) solid var(--ink);
  background: var(--paper-3);
  position: relative;
  flex: 0 0 auto;
  padding: 0;
}

.toggle::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--ink);
  transition: transform .18s cubic-bezier(.3, 1.4, .5, 1);
}

.toggle[aria-checked="true"] { background: var(--teal); }
.toggle[aria-checked="true"]::after { transform: translateX(23px); }

.reset-link { display: block; margin: 6px auto 0; padding: 8px 6px; border: none; background: none; color: var(--coral-deep); font-size: 14px; font-weight: 500; text-decoration: underline dashed; text-underline-offset: 3px; }
.reset-confirm { margin: 6px 0 0; padding: 10px; border-radius: 12px; border: 2px solid #e76f6f; background: #fdeaea; text-align: center; font-size: 14.5px; }
.reset-confirm p { margin: 0 0 10px; }
.reset-confirm .row { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.reset-confirm .btn { font-size: 15px; min-height: 42px; padding: 8px 14px; }

.credits { font-size: 12px; color: var(--ink-soft); text-align: center; margin-top: 14px; line-height: 1.45; }

/* ---------------------------------------------------------------- bottle note */

#modal-panel.note { max-width: 360px; background: transparent; border: none; box-shadow: none; overflow: visible; }
.note .n-body { padding: 4px 14px 6px; overflow-y: auto; min-height: 0; }
.note .n-bottle { display: flex; justify-content: center; }
.note .n-bottle svg { width: 120px; height: 46px; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .3)); }
.note .n-kicker { margin: 8px 0 18px; text-align: center; color: var(--paper); font-size: 13px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; text-shadow: 0 2px 0 rgba(20, 10, 30, .5); }
.note .n-scroll { position: relative; margin: 0 10px; animation: unroll 700ms cubic-bezier(.2, .9, .3, 1) both; }
.note .n-scroll::before, .note .n-scroll::after {
  content: '';
  position: absolute;
  left: -10px;
  right: -10px;
  height: 18px;
  border-radius: 9px;
  border: var(--bw-3) solid #8a6049;
  background: linear-gradient(#d9bf8c, #fff3d6 40%, #e8d3a6 70%, #c9a86e);
  z-index: 1;
}

.note .n-scroll::before { top: -8px; }
.note .n-scroll::after { bottom: -8px; }

@keyframes unroll { from { clip-path: inset(-12px -12px 90% -12px); } to { clip-path: inset(-12px); } }

.note-paper {
  padding: 30px 26px 26px;
  font-size: 19px;
  line-height: 32px;
  color: var(--ink);
  text-align: left;
  background: repeating-linear-gradient(transparent 0 31px, rgba(79, 158, 154, .22) 31px 32px) 0 22px / 100% 32px, linear-gradient(#fbf1d9, #f3e2bd);
  border-inline: var(--bw-3) solid #8a6049;
  box-shadow: inset 0 0 40px rgba(170, 120, 60, .22), 0 10px 30px rgba(0, 0, 0, .35);
}

.note-paper .sig { text-align: right; margin-top: 4px; font-weight: 500; color: #8a6049; }

.note .n-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 22px 10px 4px; }
.note .n-foot.reread { justify-content: flex-end; }
.note .n-reward { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px 4px 6px; border-radius: var(--r-pill); border: 2px solid var(--ink); background: rgba(255, 244, 227, .95); box-shadow: var(--lift-1); font-size: 14px; font-weight: 600; }
.note .n-reward svg { width: 22px; height: 22px; }

/* ---------------------------------------------------------------- evening transition */

#fade {
  position: fixed;
  inset: 0;
  z-index: 35;
  opacity: 0;
  pointer-events: none;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--paper);
  transition: opacity 1.2s ease;
}

#fade.dusk { background: linear-gradient(to bottom, rgba(28, 22, 56, .15) 0%, rgba(28, 22, 56, .55) 40%, rgba(24, 18, 48, .92) 75%); }

#fade.on { opacity: 1; pointer-events: auto; cursor: pointer; transition-duration: .9s; }
#fade > * { grid-area: 1 / 1; }

.ev-cover { position: absolute; inset: 0; background: #1c1638; opacity: 0; transition: opacity .2s ease; }
#fade.cover .ev-cover { opacity: 1; }

.ev-stars { position: absolute; inset: 0 0 45% 0; pointer-events: none; }
.ev-stars i { position: absolute; width: 2px; height: 2px; border-radius: 50%; background: #fff6d8; box-shadow: 0 0 5px #fff6d8; animation: tw 2.4s ease-in-out infinite; }

@keyframes tw { 0%, 100% { opacity: .2; transform: scale(.7); } 50% { opacity: 1; transform: scale(1.3); } }

.ev-a, .ev-b { position: relative; z-index: 2; text-align: center; padding: 20px; transition: opacity .5s ease; }
.ev-a { align-self: end; padding-bottom: calc(var(--safe-bottom) + 5vh); }
.ev-b { opacity: 0; z-index: 4; }
#fade.reset .ev-a { opacity: 0; }
#fade.reset .ev-b { opacity: 1; }

.ev-title { font-size: var(--fs-4xl); font-weight: 600; line-height: 1.2; text-shadow: 0 3px 0 rgba(10, 5, 30, .5); }
.ev-title svg { width: .9em; height: .9em; vertical-align: -0.1em; margin-left: 4px; }
.ev-quiet { margin-top: 10px; font-size: 16px; opacity: .85; }

.ev-card {
  width: 290px;
  margin: 16px auto 0;
  padding: 10px 12px 12px;
  border-radius: 18px;
  border: var(--bw-4) solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 5px 0 var(--ink), 0 14px 30px rgba(0, 0, 0, .4);
  display: grid;
  grid-template-columns: repeat(var(--cols, 3), 1fr);
  gap: 4px;
  transform: rotate(-1.5deg);
  animation: card-up .5s cubic-bezier(.3, 1.4, .5, 1) .3s both;
}

@keyframes card-up { from { opacity: 0; transform: translateY(24px) rotate(-1.5deg); } }
.ev-card .lbl { grid-column: 1 / -1; margin-bottom: 4px; font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft); text-align: center; }
.ev-card .cell { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.ev-card .cell svg { width: 34px; height: 34px; }
.ev-card .cell img { width: 40px; height: 40px; margin: -3px 0 -3px; }
.ev-card .cell .nm { max-width: 100%; font-size: 12.5px; line-height: 1.15; text-align: center; white-space: normal; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ev-card .cell small { font-size: 11.5px; font-weight: 500; color: var(--ink-soft); }

.ev-sunrise { position: absolute; inset: 0; z-index: 3; opacity: 0; background: linear-gradient(#2a2150 0%, #7a4a7a 55%, #f7b267 100%); transition: opacity .4s ease; }
.ev-sun { position: absolute; left: 50%; bottom: 18vh; width: 90px; height: 90px; margin-left: -45px; border-radius: 50%; background: radial-gradient(circle, #fff3c4 20%, #ffc86b 60%, #ff9a5a); box-shadow: 0 0 40px 10px rgba(255, 190, 110, .5); transform: translateY(60px); transition: transform 1.4s ease-out; }
#fade.reset .ev-sunrise { opacity: 1; }
#fade.reset .ev-sun { transform: translateY(0); }

.ev-big { font-size: var(--fs-4xl); font-weight: 600; text-shadow: 0 3px 0 rgba(60, 20, 50, .45); }
.ev-small { display: block; margin-top: 8px; font-size: 16px; font-weight: 400; opacity: .9; }

/* ---------------------------------------------------------------- floating world text */

.float-text {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 18px;
  font-weight: 700;
  color: var(--paper);
  text-shadow: 2px 0 0 #5b3a29, -2px 0 0 #5b3a29, 0 2px 0 #5b3a29, 0 -2px 0 #5b3a29, 1.5px 1.5px 0 #5b3a29, -1.5px 1.5px 0 #5b3a29, 1.5px -1.5px 0 #5b3a29, -1.5px -1.5px 0 #5b3a29, 0 4px 0 #5b3a29;
  will-change: transform, opacity;
}

.float-text svg { width: 20px; height: 20px; filter: drop-shadow(0 2px 0 #5b3a29); }
.float-text.deeper { color: var(--sun); font-size: 19px; }
.float-text.shell { color: #ffc2a2; }
.float-text.sand { font-size: 15px; opacity: .92; }
.float-text.near { color: #bff3d6; font-size: 17px; }
.float-text.wish { color: #fff1c4; }
.float-text .dp { display: inline-flex; gap: 3px; margin-left: 2px; }
.float-text .dp i { width: 9px; height: 9px; border-radius: 50%; border: 2px solid #5b3a29; background: var(--sun); box-shadow: 0 2px 0 #5b3a29; }
.float-text .chev { width: 0; height: 0; border-left: 8px solid transparent; border-right: 8px solid transparent; border-top: 8px solid currentColor; filter: drop-shadow(0 2px 0 #5b3a29) drop-shadow(0 -1px 0 #5b3a29); }
.float-text .chev.left { transform: rotate(90deg); }
.float-text .chev.right { transform: rotate(-90deg); }
.float-text .chev.up { transform: rotate(180deg); }

/* shells flying into the counter */
.fly-shell { position: fixed; left: 0; top: 0; z-index: 60; width: 22px; height: 22px; pointer-events: none; will-change: transform; }

/* ---------------------------------------------------------------- responsive */

@media (max-width: 380px) {
  .hud-right { gap: 6px; }
  .icon-btn { width: 42px; height: 42px; }
  .dial { width: 38px; }
  #hint[data-anchor="shop"] .h-tail { right: 108px; }
}

@media (orientation: landscape) {
  #hint[data-anchor="center"] {
    top: calc(var(--safe-top) + 12px);
    bottom: auto;
    max-width: min(380px, calc(100vw - 440px));
    font-size: 14.5px;
    animation-name: hint-in-top;
  }
}

@keyframes hint-in-top { from { opacity: 0; transform: translate(-50%, -10px); } to { opacity: 1; transform: translate(-50%, 0); } }

@media (max-height: 520px) and (orientation: landscape) {
  .pill { height: 38px; }
  .pill .ico { width: 22px; height: 22px; }
  #shell-count { font-size: var(--fs-l); }
  .icon-btn { width: 38px; height: 38px; border-radius: 12px; }
  .icon-btn svg { width: 24px; height: 24px; }
  #hint[data-anchor="shop"] { top: calc(var(--safe-top) + 58px); }
  #hint[data-anchor="shop"] .h-tail { right: 99px; }
  #dig-btn { width: 78px; height: 78px; font-size: 15px; }
  #dig-btn svg { width: 36px; height: 36px; }
  #dig-btn .pips { top: 5px; }
  #dig-btn[data-state="busy"] svg { margin-top: 6px; }
  #lcd { flex-basis: 200px; }
  .seg7 { transform: skewX(-7deg) scale(.85); transform-origin: 100% 100%; margin: -4px -1px 0 -4px; }
  #hint { font-size: 13.5px; }
  #toasts, body[data-hint] #toasts {
    top: auto;
    bottom: calc(var(--safe-bottom) + 12px);
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: calc(100vw - 480px);
    max-width: calc(100vw - 480px);
    padding: 0;
    flex-direction: column-reverse;
  }
  .title-inner { align-items: flex-start; text-align: left; width: 46vw; min-width: max-content; padding: 5vh 0 4vh calc(var(--safe-left) + 5vw); }
  .title { white-space: nowrap; }
  .t-bottom { align-items: flex-start; }
  .t-prog { justify-content: flex-start; }
  .title { font-size: clamp(40px, 16vh, 92px); }
  .title span { display: inline; }
  .subtitle { font-size: 15px; }
  .big-btn { padding: 11px 30px; font-size: 20px; }

  #modal-panel.fc { max-width: min(680px, calc(100vw - 24px)); }
  .fc .find-card { display: grid; grid-template-columns: 190px 1fr; column-gap: 16px; text-align: left; align-items: center; padding: 14px 18px 16px; }
  .fc .find-card > :not(.icon-slot):not(.rays):not(.rays2):not(.spark):not(.flash):not(.new-ribbon) { grid-column: 2; justify-self: start; }
  .fc .find-card .icon-slot { grid-column: 1; grid-row: 1 / span 9; height: auto; display: grid; place-items: center; }
  .fc .find-card .icon-slot canvas, .fc-legendary .find-card .icon-slot canvas, .fc-junk .find-card .icon-slot canvas { width: 150px; height: 150px; }
  .fc .find-card .rays, .fc .find-card .rays2, .fc .find-card .flash { left: 95px; top: 50%; }
  .fc .find-card .rays { width: 240px; height: 240px; margin: -120px 0 0 -120px; }
  .fc .find-card h3 { font-size: var(--fs-3xl); margin-top: 0; }
  .fc .find-card .desc { margin: 8px 0 4px; }
  .fc .find-card .unlock { margin: 4px 0 6px; }
  .fc .find-card .value { margin: 2px 0 4px; }
  .fc .find-card .chips { justify-content: flex-start; margin: 0 0 10px; }
  #modal-panel.fc-junk { max-width: 520px; }
  .fc.fc-junk .find-card { grid-template-columns: 130px 1fr; }
  .fc.fc-junk .find-card .icon-slot canvas { width: 104px; height: 104px; }
  .fc.fc-junk .find-card .flash { left: 65px; }

  .modal-head { padding-top: 8px; padding-bottom: 6px; }
  .modal-head h2 { font-size: 19px; }
  #modal-panel.journal { max-width: 760px; }
  .journal .modal-head { padding: 8px 12px 6px 28px; }
  .journal .modal-head h2 small { display: inline; margin-left: 8px; }
  .jd .spec-wrap { margin-bottom: 4px; }
  .jd .spec-plate { width: 132px; height: 132px; }
  .jd .spec-plate canvas, .jd .spec-plate img { width: 104px; height: 104px; }
  .jd .d-desc { font-size: 16px; margin: 8px auto; }
  #modal-panel.shop { max-width: 640px; }
  .shop-head { padding: 30px 12px 4px; }
  .shop-head .shelly-img { width: 44px; height: 44px; margin-bottom: -4px; }
  .shop-head .sh-title { display: flex; align-items: center; gap: 10px; padding-top: 6px; }
  .shop-head h2 { flex: 1 1 auto; min-width: 0; }
  .shop-head h2 small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12.5px; }
  .shop-head .wallet { flex: none; margin-top: 0; }
  .counter { height: 8px; }
  .shop .modal-body { padding-top: 8px; }
  .shop-speech { display: none; }
  .shop-speech + .shop-section { margin-top: 2px; margin-bottom: 6px; }
  .hat-grid { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); }
  #modal-panel.note { max-width: 520px; }
  .note .n-bottle { display: none; }
  .note .n-kicker { margin: 0 0 14px; }
  .note-paper { font-size: 17px; line-height: 28px; padding: 22px 22px 20px; background-size: 100% 28px, auto; background-position: 0 18px, 0 0; }
  .ev-a { padding-bottom: calc(var(--safe-bottom) + 6vh); }
  .ev-card { margin-top: 10px; }
}

@media (min-width: 700px) and (min-height: 600px) {
  #dig-btn { width: 112px; height: 112px; font-size: 20px; }
  #dig-btn svg { width: 54px; height: 54px; }
  #lcd { flex-basis: 270px; }
}

/* ---------------------------------------------------------------- reduced motion & calm */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@media (prefers-reduced-motion: reduce) {
  #fade { transition-duration: 1.2s !important; }
  #fade > * { transition-duration: .4s !important; }
  #title-screen { transition-duration: .6s !important; }
  .toast { animation: toast-fade .25s ease both !important; transition: opacity .25s ease !important; transform: none !important; }
  #modal-panel [data-close].btn { transition: opacity .15s ease !important; transform: none !important; }
}

body.calm #fade { transition-duration: 1.2s; }
body.calm .watch-chip { transform: translate(-50%, 0); transition: opacity .4s ease; }
body.calm #fade > * { transition-duration: .4s; }
body.calm .ev-sun { transform: none !important; transition: none; }
body.calm .ev-card { animation: fade-in .4s ease .3s both; }
body.calm .toast { animation: toast-fade .25s ease both; transition: opacity .25s ease; transform: none; }
body.calm #dig-btn[data-state="hot"] .halo { animation: none; transform: scale(1.04); opacity: .9; }
body.calm #dig-btn svg { animation: none !important; }
body.calm .world-bubble .wb-in, body.calm .big-btn, body.calm .title span i, body.calm #btn-shop.coach, body.calm .coach-ring, body.calm .ev-stars i { animation: none; }
body.calm .find-card, body.calm .find-card *, body.calm .find-card *::before { animation: none !important; }
body.calm #modal-panel.fc { animation: fade-in .15s ease; }
body.calm #modal-panel [data-close].btn { transition: opacity .15s ease; transform: none; }
body.calm .note .n-scroll { animation: none; }
body.calm .detail.slide { animation: fade-in .15s ease both; }

@media (prefers-reduced-motion: reduce) {
  #dig-btn[data-state="hot"] .halo { transform: scale(1.04); opacity: .9; }
  .coach-ring { opacity: 1; }
}

/* ---------------------------------------------------------------- graphics trouble card */

#gpu-note {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: calc(var(--safe-top) + 20px) 18px calc(var(--safe-bottom) + 20px);
  background: radial-gradient(ellipse at 50% 35%, #6b4a7e, #2a2150 70%);
}

.gpu-card {
  width: 100%;
  max-width: 380px;
  padding: 22px 20px 20px;
  border-radius: var(--r-xl);
  border: var(--bw-4) solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--lift-3), var(--drop-3);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.gpu-card h2 { margin: 0; font-size: var(--fs-2xl); font-weight: 600; line-height: 1.15; text-wrap: balance; }
.gpu-card p { margin: 0; font-size: var(--fs-m); line-height: 1.4; color: var(--ink-soft); }
.gpu-card ol { margin: 0; padding-left: 1.3em; font-size: var(--fs-m); line-height: 1.4; display: grid; gap: 6px; }
.gpu-card .btn { align-self: stretch; margin-top: 4px; }

.credits.gpu-line { margin-top: 4px; font-size: var(--fs-2xs); opacity: .75; overflow-wrap: anywhere; }
