:root {
  --cream: #FFF1D6;
  --cream-2: #FFF8E8;
  --sky: #59D2E8;
  --grass: #3FBF6E;
  --meadow: #1C7A4C;
  --coral: #FF6B4A;
  --coral-deep: #D94A2F;
  --yolk: #FFC93C;
  --violet: #8E5BD9;
  --plum: #3A2A45;
  --plum-soft: rgba(58, 42, 69, .55);
  --grey: #B7AFC0;
  --display: 'Baloo 2', 'Trebuchet MS', sans-serif;
  --text: 'Figtree', system-ui, sans-serif;
  --num: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --topH: 22vh;
  --botH: 8vh;
  --skyX: 0px;
  --skyY: 0px;
  --mesaX: 0px;
  --meadowX: 0px;
  --meadowY: 0px;
  --fgX: 0px;
  --fgY: 0px;
  --nearX: 0px;
  --nearY: 0px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #59D2E8;
  color: var(--plum);
  font-family: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  overscroll-behavior: none;
}
body {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
}
button {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
img { -webkit-user-drag: none; user-select: none; }
.is-hidden { display: none !important; }

#page-bg {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: linear-gradient(180deg, #59D2E8 0%, #A8ECF4 30%, #7EDA9A 58%, #1C7A4C 100%);
}
.bg-sky {
  position: absolute;
  inset: -4% -2% 48% -2%;
  background: url('assets/art/sky_and_mesa_band.webp') center bottom / cover no-repeat;
  filter: blur(3px) saturate(1.05);
  opacity: .7;
}
.bg-meadow {
  position: absolute;
  inset: 46% -2% -6% -2%;
  background: url('assets/art/meadow_and_fence_band.webp') center bottom / cover no-repeat;
  filter: blur(4px) saturate(1.08);
  opacity: .9;
}
.bg-veil {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 38%, rgba(255, 241, 214, .28), transparent 60%),
    radial-gradient(ellipse at 50% 100%, rgba(255, 201, 60, .2), transparent 70%);
}

#game-root {
  position: relative;
  width: 100%;
  height: 100dvh;
  height: 100svh;
  overflow: hidden;
  background: #6BD68C;
  isolation: isolate;
}

@media (min-aspect-ratio: 1/1) and (min-width: 760px) and (min-height: 620px) {
  #game-root {
    width: min(560px, calc(100dvh * .62));
    height: min(100dvh, 1120px);
    border-radius: 30px;
    border: 3px solid rgba(255, 241, 214, .8);
    box-shadow:
      0 30px 90px rgba(58, 42, 69, .5),
      0 0 0 12px rgba(255, 241, 214, .12),
      inset 0 0 0 1px rgba(255, 255, 255, .6);
  }
}

/* ---------- scenery ---------- */
.boss-vignette {
  position: absolute;
  inset: 0;
  z-index: 26;
  pointer-events: none;
  opacity: 0;
  transition: opacity .55s ease;
  background:
    radial-gradient(ellipse at 50% 45%, transparent 34%, rgba(255, 201, 60, .18) 58%, rgba(255, 107, 74, .2) 100%);
}
.boss-vignette.show { opacity: 1; }
.scenery {
  position: absolute;
  left: 0;
  right: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 2;
}
.scenery-top {
  top: 0;
  height: var(--topH);
  background: linear-gradient(180deg, #59D2E8 0%, #A9EBF3 48%, #E9F8DF 88%, #FFF1D6 100%);
}
.sky-layer {
  position: absolute;
  left: -6%;
  right: -6%;
  top: 0;
  height: 100%;
  background-image: url('assets/art/sky_and_mesa_band.webp');
  background-size: 100% auto;
  background-position: center top;
  transform: translate3d(var(--skyX, 0px), var(--skyY, 0px), 0);
  will-change: transform;
  background-repeat: no-repeat;
  opacity: .98;
  filter: blur(.25px) saturate(1.08) brightness(1.02);
}
/* far mesa haze and drifting clouds add the depth behind the arena */
.mesa-layer {
  position: absolute;
  left: -22%;
  right: -22%;
  top: 4%;
  height: 78%;
  background-image: url('assets/art/sky_and_mesa_band.webp');
  background-size: 118% auto;
  background-position: center bottom;
  background-repeat: no-repeat;
  transform: translate3d(var(--mesaX, 0px), var(--skyY, 0px), 0);
  opacity: .4;
  filter: blur(2.4px) saturate(.9) brightness(1.04);
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 28%, #000 82%, transparent 100%);
  mask-image: linear-gradient(180deg, transparent 0%, #000 28%, #000 82%, transparent 100%);
  will-change: transform;
}
.sun-disc {
  position: absolute;
  left: 8%;
  top: -34px;
  width: 190px;
  height: 190px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 250, 226, .95) 0%, rgba(255, 241, 214, .55) 32%, rgba(255, 201, 60, .18) 55%, transparent 72%);
  filter: blur(.5px);
  pointer-events: none;
}
.cloud-drift {
  position: absolute;
  left: 0;
  right: 0;
  top: 6%;
  height: 42%;
  pointer-events: none;
  background:
    radial-gradient(ellipse 90px 15px at 18% 52%, rgba(255, 248, 228, .82), transparent 70%),
    radial-gradient(ellipse 52px 20px at 24% 46%, rgba(255, 248, 228, .75), transparent 72%),
    radial-gradient(ellipse 70px 13px at 72% 28%, rgba(255, 248, 228, .62), transparent 72%),
    radial-gradient(ellipse 40px 16px at 76% 23%, rgba(255, 248, 228, .55), transparent 72%);
  transform: translate3d(calc(var(--skyX, 0px) * 1.4), var(--skyY, 0px), 0);
  opacity: .8;
  animation: cloudBreathe 14s ease-in-out infinite alternate;
  will-change: transform;
}
@keyframes cloudBreathe {
  from { opacity: .62; }
  to { opacity: .9; }
}
.meadow-layer {
  position: absolute;
  left: -6%;
  right: -6%;
  bottom: -2px;
  height: 60%;
  background-image: url('assets/art/meadow_and_fence_band.webp');
  background-size: 100% 100%;
  background-position: center bottom;
  transform: translate3d(var(--meadowX, 0px), var(--meadowY, 0px), 0);
  will-change: transform;
  background-repeat: no-repeat;
  filter: blur(.2px) saturate(1.05) drop-shadow(0 -6px 16px rgba(58, 42, 69, .2));
}
.haze {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 26%;
  background: linear-gradient(180deg, transparent, rgba(255, 241, 214, .32) 62%, rgba(255, 241, 214, .62));
  opacity: .85;
}
.scenery-top::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -12px;
  height: 26px;
  background: linear-gradient(180deg, rgba(58, 42, 69, .2), rgba(58, 42, 69, .02) 55%, transparent);
  z-index: 6;
  pointer-events: none;
}
.scenery-bottom {
  bottom: 0;
  height: var(--botH);
  background: #1C7A4C;
}
.scenery-bottom::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: -18px;
  height: 18px;
  background: linear-gradient(180deg, rgba(28, 122, 76, 0), rgba(28, 122, 76, .16));
  z-index: 2;
}
.fg-layer {
  position: absolute;
  inset: -1px -8% 0 -8%;
  background-image: url('assets/art/foreground_grass_band.webp');
  background-size: 100% 100%;
  background-position: center bottom;
  transform: translate3d(var(--fgX, 0px), var(--fgY, 0px), 0);
  will-change: transform;
  background-repeat: no-repeat;
  filter: blur(.35px) saturate(1.06);
}

.near-grass {
  position: absolute;
  left: -4%;
  right: -4%;
  bottom: -16px;
  height: 124px;
  z-index: 5;
  pointer-events: none;
  background-image: url('assets/art/foreground_grass_band.webp');
  background-size: 114% 100%;
  background-position: center top;
  background-repeat: no-repeat;
  transform: translate3d(var(--nearX, 0px), var(--nearY, 0px), 0);
  will-change: transform;
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, .2) 16%, #000 46%);
  mask-image: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, .2) 16%, #000 46%);
  filter: blur(.45px) brightness(.97) saturate(1.04);
  opacity: .97;
}

/* ---------- world / canvas ---------- */
#world-holder::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 66px;
  z-index: 5;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 248, 228, .78), rgba(255, 241, 214, .26) 40%, rgba(255, 241, 214, 0));
}
#world-holder {
  position: absolute;
  left: 0;
  right: 0;
  top: var(--topH);
  bottom: var(--botH);
  overflow: hidden;
  z-index: 1;
  background: #4CC77A;
}
#game-canvas, #game-canvas canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
}
#game-canvas canvas {
  display: block;
  filter: saturate(1.18) contrast(1.1) brightness(1.0);
}
.world-depth {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background:
    radial-gradient(ellipse 120% 42% at 50% -8%, rgba(255, 241, 214, .18), rgba(255, 241, 214, .05) 46%, transparent 66%),
    linear-gradient(180deg, rgba(255, 201, 60, .07), transparent 16%);
  mix-blend-mode: screen;
  opacity: .55;
}
.sun-shafts {
  position: absolute;
  inset: -14% -10% -8% -10%;
  pointer-events: none;
  z-index: 3;
  background:
    linear-gradient(112deg, transparent 4%, rgba(255, 248, 228, .16) 9%, rgba(255, 248, 228, .05) 13%, transparent 17%),
    linear-gradient(115deg, transparent 28%, rgba(255, 241, 214, .12) 33%, rgba(255, 241, 214, .04) 37%, transparent 41%),
    linear-gradient(108deg, transparent 58%, rgba(255, 248, 228, .1) 64%, rgba(255, 248, 228, .03) 68%, transparent 73%);
  filter: blur(4px);
  mix-blend-mode: screen;
  opacity: .32;
  animation: sunDrift 16s ease-in-out infinite alternate;
  will-change: transform, opacity;
}
@keyframes sunDrift {
  from { transform: translate3d(-1.4%, 0, 0) scale(1); opacity: .26; }
  to { transform: translate3d(1.6%, 1.2%, 0) scale(1.03); opacity: .44; }
}
.world-light {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  background:
    radial-gradient(ellipse at 10% -6%, rgba(255, 231, 160, .22), transparent 44%),
    radial-gradient(ellipse at 46% -12%, rgba(255, 201, 60, .12), transparent 42%),
    radial-gradient(ellipse at 88% 112%, rgba(89, 210, 232, .26), transparent 56%),
    radial-gradient(ellipse at 24% 106%, rgba(28, 122, 76, .18), transparent 54%),
    linear-gradient(180deg, rgba(255, 241, 214, .1), transparent 22%, transparent 72%, rgba(255, 201, 60, .12));
}
.world-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  background:
    radial-gradient(ellipse at 50% 52%, transparent 52%, rgba(255, 201, 60, .12) 100%),
    linear-gradient(180deg, transparent 78%, rgba(255, 241, 214, .14) 100%);
}
#input-layer {
  position: absolute;
  inset: 0;
  z-index: 7;
  touch-action: none;
}


@media (pointer: coarse) {
  .action-key { display: none; }
}

/* ---------- mood / storm ---------- */
.storm-sky {
  position: absolute;
  left: -5%;
  right: -5%;
  top: 0;
  height: 74%;
  z-index: 3;
  pointer-events: none;
  background-image: url('assets/art/sky_and_mesa_band.webp');
  background-size: cover;
  background-position: center bottom;
  filter: brightness(.98) saturate(1.2) hue-rotate(-4deg) contrast(1.03);
  opacity: 0;
  opacity: calc(var(--mood, 0) * .42);
  mix-blend-mode: soft-light;
}
.storm-dusk {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 201, 60, .16), rgba(255, 107, 74, .12) 55%, rgba(255, 241, 214, .08)),
    radial-gradient(ellipse at 78% 10%, rgba(255, 107, 74, .22), transparent 48%);
  opacity: calc(var(--mood, 0) * .5);
  mix-blend-mode: screen;
}
.barn-fire {
  position: absolute;
  left: 4%;
  top: 34%;
  width: 150px;
  height: 150px;
  z-index: 5;
  pointer-events: none;
  opacity: calc(var(--mood, 0) * .95);
  filter: blur(.2px);
}
.barn-fire::before {
  content: '';
  position: absolute;
  left: 46%;
  top: 42%;
  width: 70px;
  height: 72px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 65%, rgba(255, 201, 60, .95), rgba(255, 107, 74, .6) 38%, transparent 70%);
  filter: blur(3px);
  animation: barnFlicker 1.1s ease-in-out infinite alternate;
}
.barn-fire::after {
  content: '';
  position: absolute;
  left: 40%;
  top: -36%;
  width: 66px;
  height: 110px;
  background: radial-gradient(ellipse at 50% 100%, rgba(58, 42, 69, .55), transparent 68%);
  filter: blur(8px);
  opacity: .8;
  animation: barnSmoke 5s ease-in-out infinite;
}
@keyframes barnFlicker { from { transform: scale(.88); opacity: .62; } to { transform: scale(1.06); opacity: 1; } }
@keyframes barnSmoke { 0%, 100% { transform: translate(-4px, 0) scale(.9); } 50% { transform: translate(8px, -12px) scale(1.12); } }
.mood-wash {
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  opacity: calc(var(--mood, 0) * .3);
  background:
    linear-gradient(180deg, rgba(255, 201, 60, .2), rgba(255, 107, 74, .1) 46%, rgba(255, 241, 214, .14)),
    radial-gradient(ellipse at 70% 14%, rgba(255, 107, 74, .24), transparent 54%);
  mix-blend-mode: screen;
}
.storm-smoke {
  position: absolute;
  inset: -8%;
  z-index: 22;
  pointer-events: none;
  opacity: calc(var(--mood, 0) * .32);
  background:
    radial-gradient(ellipse 38% 24% at 14% 16%, rgba(214, 160, 112, .28), transparent 72%),
    radial-gradient(ellipse 34% 22% at 82% 8%, rgba(255, 201, 60, .22), transparent 74%),
    radial-gradient(ellipse 46% 26% at 52% 36%, rgba(255, 107, 74, .16), transparent 74%),
    radial-gradient(ellipse 40% 22% at 28% 68%, rgba(255, 241, 214, .18), transparent 76%);
  animation: smokeRoll 19s ease-in-out infinite alternate;
  will-change: transform;
}
@keyframes smokeRoll {
  from { transform: translate3d(-1.5%, 1%, 0) scale(1.02); }
  to { transform: translate3d(2%, -1.4%, 0) scale(1.06); }
}
.storm-heat {
  position: absolute;
  inset: 0;
  z-index: 22;
  pointer-events: none;
  opacity: calc(var(--mood, 0) * .8);
  background:
    radial-gradient(ellipse 40% 34% at 8% 78%, rgba(255, 107, 74, .34), transparent 68%),
    radial-gradient(ellipse 30% 26% at 88% 64%, rgba(255, 201, 60, .18), transparent 70%),
    radial-gradient(ellipse 52% 24% at 50% 96%, rgba(255, 107, 74, .24), transparent 72%);
  mix-blend-mode: screen;
  animation: heatFlicker 3.2s ease-in-out infinite;
  will-change: opacity;
}
@keyframes heatFlicker {
  0%, 100% { opacity: calc(var(--mood, 0) * .66); }
  44% { opacity: calc(var(--mood, 0) * .9); }
  68% { opacity: calc(var(--mood, 0) * .76); }
}
.boss-wash {
  position: absolute;
  inset: 0;
  z-index: 21;
  pointer-events: none;
  opacity: calc(var(--boss, 0) * .42);
  background:
    radial-gradient(ellipse at 50% 58%, rgba(142, 91, 217, .3), transparent 46%),
    radial-gradient(ellipse at 50% 46%, rgba(255, 201, 60, .12), transparent 62%),
    linear-gradient(180deg, rgba(255, 201, 60, .08), rgba(255, 107, 74, .12) 54%, rgba(255, 241, 214, .1));
  mix-blend-mode: screen;
}
.storm-flash {
  position: absolute;
  inset: 0;
  z-index: 22;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(ellipse at 68% 4%, rgba(255, 248, 228, .9), rgba(255, 241, 214, .36) 22%, transparent 54%);
  mix-blend-mode: screen;
}
.storm-flash.flash { animation: stormFlash .62s ease-out; }
@keyframes stormFlash {
  0% { opacity: 0; }
  9% { opacity: .9; }
  18% { opacity: .12; }
  27% { opacity: .72; }
  100% { opacity: 0; }
}

/* ---------- HUD ---------- */
.hud {
  position: absolute;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  padding: calc(8px + var(--safe-t)) 10px 0;
}
.hud button, .hud .hud-chip { pointer-events: auto; }
.hud-top {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.hud-id {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 1 1 auto;
  min-width: 0;
}
.avatar-wrap {
  position: relative;
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 30%, #FFF8E8, #FFE2B8);
  border: 3px solid var(--cream);
  box-shadow: 0 4px 0 rgba(58, 42, 69, .3), 0 0 0 2px rgba(255, 107, 74, .25), inset 0 2px 0 #fff;
  overflow: visible;
}
.avatar-wrap > img {
  position: absolute;
  inset: 1px;
  width: calc(100% - 2px);
  height: calc(100% - 2px);
  object-fit: cover;
  object-position: 50% 16%;
  border-radius: 50%;
}
.level-badge {
  position: absolute;
  right: -6px;
  bottom: -5px;
  min-width: 23px;
  height: 23px;
  padding: 0 5px;
  border-radius: 999px;
  background: radial-gradient(circle at 35% 28%, #FFE27A, var(--yolk));
  border: 2px solid var(--cream);
  color: var(--plum);
  font-family: var(--num);
  font-weight: 800;
  font-size: 16px;
  line-height: 19px;
  text-align: center;
  box-shadow: 0 2px 0 rgba(58, 42, 69, .28);
}
.bars {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 260px;
}
.bar-shell {
  position: relative;
  width: 100%;
  height: 40px;
  filter: drop-shadow(0 3px 0 rgba(58, 42, 69, .24));
}
.bar-shell.xp-shell { height: 31px; }
.shell-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
}
.bar-fill {
  position: absolute;
  left: 8.2%;
  right: 8.2%;
  top: 20%;
  bottom: 20%;
  width: auto;
  border-radius: 999px;
  transform-origin: left center;
  transition: width .15s linear;
}
.hp-fill {
  background: linear-gradient(180deg, #FF8A63, #FF5A3C 65%, #E0452A);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .45);
  width: 92%;
}
.xp-fill {
  position: absolute;
  left: 8.2%;
  top: 22%;
  bottom: 22%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #2FB8D6 0%, #59D2E8 46%, #B1ECFF 76%, #FFE27A 100%);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .55), 0 0 10px rgba(89, 210, 232, .35);
  transition: width .15s linear;
  z-index: 1;
}
.xp-mask {
  position: absolute;
  right: 8.2%;
  z-index: 2;
  top: 22%;
  bottom: 22%;
  width: 83.6%;
  border-radius: 999px;
  background: linear-gradient(90deg, #1B4653, #123440 16%, #0E2A35);
  box-shadow: -3px 0 7px rgba(89, 210, 232, .45), inset 0 2px 0 rgba(89, 210, 232, .22), inset 0 -2px 0 rgba(58, 42, 69, .5);
  transition: width .15s linear;
}
.bar-glyph {
  position: absolute;
  left: 5px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  color: #FFF8E8;
  background: radial-gradient(circle at 36% 30%, #FFB59F, var(--coral) 62%, #D94A2F);
  border: 2px solid rgba(255, 248, 232, .9);
  box-shadow: 0 2px 0 rgba(58, 42, 69, .24), inset 0 1px 0 rgba(255, 255, 255, .45);
  pointer-events: none;
}
.xp-shell .bar-glyph {
  width: 21px;
  height: 21px;
  left: 6px;
  color: #3A2A45;
  background: radial-gradient(circle at 36% 30%, #FFF2B8, var(--yolk) 66%, #E2A21B);
}
.bar-glyph svg { width: 14px; height: 14px; }
.xp-shell .bar-glyph svg { width: 12px; height: 12px; }
.bar-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--num);
  font-weight: 800;
  font-size: 21px;
  letter-spacing: .5px;
  color: #FFF8E8;
  text-shadow: 0 1px 0 rgba(58, 42, 69, .65);
  padding-bottom: 1px;
}
.evo-socket {
  --evo: 0;
  position: relative;
  width: 33px;
  height: 33px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: conic-gradient(var(--yolk) calc(var(--evo) * 1turn), rgba(255, 241, 214, .45) 0);
  border: 2px solid var(--cream);
  box-shadow: 0 3px 0 rgba(58, 42, 69, .26);
  display: grid;
  place-items: center;
}
.evo-socket::before {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: #FFF1D6;
}
.evo-ico {
  position: relative;
  z-index: 1;
  width: 16px;
  height: 16px;
  color: var(--coral);
  display: grid;
  place-items: center;
}
.evo-ico svg { width: 16px; height: 16px; }
.evo-socket.ready { animation: evoPulse 1s ease-in-out infinite; }
.evo-socket.done { background: conic-gradient(var(--violet) 1turn, var(--violet) 0); }
.evo-socket.done .evo-ico { color: var(--violet); }
@keyframes evoPulse {
  0%, 100% { box-shadow: 0 3px 0 rgba(58, 42, 69, .26), 0 0 0 0 rgba(255, 201, 60, .65); }
  50% { box-shadow: 0 3px 0 rgba(58, 42, 69, .26), 0 0 0 6px rgba(255, 201, 60, 0); }
}
.hud-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}
.coin-chip {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 36px;
  padding: 0 9px 0 4px;
  border-radius: 999px;
  background: linear-gradient(180deg, #FFF8E8, #FFE9C2);
  border: 2px solid var(--cream);
  box-shadow: 0 3px 0 rgba(58, 42, 69, .26), inset 0 1px 0 #fff;
}
.coin-chip img { width: 24px; height: 24px; object-fit: contain; }
.coin-chip span {
  font-family: var(--num);
  font-weight: 800;
  font-size: 19px;
  color: var(--plum);
}
.coin-chip.big { height: 40px; padding: 0 14px 0 5px; }
.coin-chip.big img { width: 32px; height: 32px; }
.coin-chip.big span { font-size: 24px; }
.icon-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(180deg, #FFF8E8, #FFE5BB);
  border: 2px solid var(--cream);
  box-shadow: 0 3px 0 rgba(58, 42, 69, .28), inset 0 1px 0 #fff;
  color: var(--plum);
  transition: transform .08s ease, filter .08s ease;
}
.icon-btn:active { transform: translateY(2px) scale(.96); filter: brightness(.97); }
.icon-btn svg { width: 20px; height: 20px; }
.pause-btn { width: 40px; height: 40px; padding: 0; }
.pause-btn svg { width: 18px; height: 18px; }
.chip-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}
.hud-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 37px;
  padding: 0 10px 0 5px;
  border-radius: 999px;
  background: linear-gradient(180deg, #FFFDF7 0%, #FFF5E2 42%, #FFE4B9 100%);
  border: 2px solid var(--cream);
  box-shadow: 0 4px 0 #C9A16B, 0 7px 12px rgba(58, 42, 69, .18), inset 0 2px 0 #fff;
  color: var(--plum);
}
.chip-ico {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 28%, color-mix(in srgb, var(--med, #59D2E8) 72%, #fff), var(--med, #59D2E8));
  border: 2px solid #FFF8E8;
  color: #FFF8E8;
  box-shadow: 0 2px 0 rgba(58, 42, 69, .24), inset 0 1px 0 rgba(255, 255, 255, .4);
}
#ico-timer { --med: #2B93A8; }
#ico-skull { --med: #D94A2F; }
#ico-help { --med: #FFC93C; color: #3A2A45; }
.chip-ico svg { width: 15px; height: 15px; }
.chip-num {
  font-family: var(--num);
  font-weight: 800;
  font-size: 23px;
  line-height: 1;
  letter-spacing: .4px;
  min-width: 21px;
  text-align: center;
}
.chip-label {
  font-family: var(--display);
  font-weight: 800;
  font-size: 10px;
  letter-spacing: 1.1px;
  color: var(--plum-soft);
}
.wave-chip img { width: 24px; height: 25px; object-fit: contain; margin-left: -4px; }
.wave-chip { padding-left: 3px; }
.help-chip { width: 34px; padding: 0; justify-content: center; }
.help-chip .chip-ico { width: 25px; height: 25px; }
.help-chip svg { width: 15px; height: 15px; }
.boss-bar {
  margin-top: 7px;
  padding: 5px 9px 7px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 248, 232, .97), rgba(255, 226, 184, .97));
  border: 2px solid var(--cream);
  box-shadow: 0 4px 0 rgba(58, 42, 69, .24), 0 8px 18px rgba(58, 42, 69, .18);
  transform: translateY(-6px);
  opacity: 0;
  transition: transform .35s cubic-bezier(.2, 1.4, .4, 1), opacity .3s;
}
.boss-bar.show { transform: none; opacity: 1; }
.boss-head { display: flex; align-items: center; gap: 6px; padding: 0 2px 4px; }
.boss-crest {
  width: 25px;
  height: 25px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 35% 28%, #FFE27A, var(--yolk));
  border: 2px solid #FFF8E8;
  color: var(--plum);
  box-shadow: 0 2px 0 rgba(58, 42, 69, .22);
  flex: 0 0 auto;
}
.boss-crest svg { width: 14px; height: 14px; }
.boss-tag {
  font-family: var(--display);
  font-weight: 800;
  font-size: 9px;
  letter-spacing: 1.4px;
  color: #FFF8E8;
  background: var(--coral);
  border-radius: 999px;
  padding: 2px 6px;
}
.boss-name {
  font-family: var(--display);
  font-weight: 700;
  font-size: 14px;
  color: var(--plum);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.boss-shell {
  position: relative;
  height: 18px;
  border-radius: 999px;
  background: #4A3553;
  border: 2px solid #FFF8E8;
  overflow: hidden;
  box-shadow: inset 0 2px 3px rgba(0, 0, 0, .3);
}
.boss-fill {
  position: absolute;
  inset: 1px auto 1px 1px;
  width: 100%;
  border-radius: 999px;
  background:
    repeating-linear-gradient(90deg, transparent 0 26px, rgba(255, 255, 255, .14) 26px 28px),
    linear-gradient(180deg, #FF9A6F, #FF5A3C 60%, #D63B25);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .5);
  transition: width .18s linear;
}
.hint-strip {
  position: absolute;
  left: 50%;
  bottom: calc(var(--botH) + 142px);
  transform: translateX(-50%);
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 248, 232, .96);
  border: 2px solid var(--cream);
  box-shadow: 0 3px 0 rgba(58, 42, 69, .22);
  font-family: var(--display);
  font-weight: 700;
  font-size: 12.5px;
  color: var(--plum);
  white-space: nowrap;
  transition: opacity .5s, transform .5s;
  pointer-events: none;
}
.hint-strip.fade { opacity: 0; transform: translate(-50%, 8px); }

/* joystick */
.joystick {
  position: absolute;
  left: 16px;
  bottom: calc(var(--botH) + 16px + var(--safe-b));
  width: 112px;
  height: 112px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  pointer-events: none;
  z-index: 4;
}
.joy-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 45% 42%, rgba(255, 241, 214, .2), rgba(58, 42, 69, .14));
  border: 2px solid rgba(255, 248, 232, .72);
  box-shadow: inset 0 3px 14px rgba(58, 42, 69, .2), 0 5px 14px rgba(58, 42, 69, .14), inset 0 0 0 4px rgba(255, 248, 232, .12);
}
.joy-knob {
  position: relative;
  width: 47px;
  height: 47px;
  border-radius: 50%;
  background: radial-gradient(circle at 36% 28%, #FFF8E8, #FFE3B9 68%, #E9BE86);
  border: 3px solid var(--cream);
  box-shadow: 0 5px 0 rgba(58, 42, 69, .3), inset 0 3px 0 #fff, inset 0 -7px 9px rgba(201, 161, 107, .18);
  transform: translate(var(--jx, 0px), var(--jy, 0px));
  transition: transform .05s linear;
}
.joystick-float {
  left: 0;
  top: 0;
  bottom: auto;
  transform: translate(-50%, -50%);
  opacity: .92;
}
.joystick-float .joy-ring { background: radial-gradient(circle at 45% 42%, rgba(255, 241, 214, .26), rgba(58, 42, 69, .12)); }
.action-cluster {
  position: absolute;
  right: 14px;
  bottom: calc(var(--botH) + 16px + var(--safe-b));
  display: flex;
  align-items: flex-end;
  gap: 11px;
  z-index: 5;
}
.action-btn {
  position: relative;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #FFF8E8;
  background:
    radial-gradient(circle at 35% 26%, #FFA07E 0%, #FF7852 32%, #FF5F3D 62%, #D94A2F 100%);
  border: 3px solid var(--cream);
  box-shadow:
    0 0 0 3px rgba(255, 241, 214, .5),
    0 7px 0 #A93522,
    0 13px 26px rgba(58, 42, 69, .34),
    inset 0 3px 0 rgba(255, 255, 255, .5),
    inset 0 -8px 0 rgba(0, 0, 0, .13);
  transition: transform .07s ease, filter .07s ease, box-shadow .07s ease;
  overflow: hidden;
  pointer-events: auto;
}
.action-btn::before {
  content: '';
  position: absolute;
  inset: 7%;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 24%, rgba(255, 255, 255, .28), transparent 56%);
  pointer-events: none;
  z-index: 0;
}
.action-btn:active, .action-btn.pressed {
  transform: translateY(4px) scale(.95);
  box-shadow: 0 2px 0 #A93522, 0 6px 12px rgba(58, 42, 69, .3), inset 0 2px 0 rgba(255, 255, 255, .3);
  filter: brightness(1.07);
}
.dash-btn { width: 69px; height: 69px; }
.ult-btn { width: 93px; height: 93px; }
.action-ico { position: relative; z-index: 2; display: grid; place-items: center; }
.dash-btn .action-ico svg { width: 29px; height: 29px; }
.ult-btn .action-ico svg { width: 42px; height: 42px; }
.action-key {
  position: absolute;
  bottom: 5px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--num);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: .6px;
  color: rgba(255, 248, 232, .85);
  z-index: 2;
}
.ult-btn .action-key { font-size: 11px; bottom: 7px; }
.ult-btn.locked { filter: saturate(.45) brightness(.86); }
.ult-btn.locked .action-ico { opacity: .62; }
.ult-btn.locked .action-key { letter-spacing: .2px; }
.ult-btn.locked:active { filter: saturate(.55) brightness(.92); }
.cd {
  position: absolute;
  inset: -2px;
  z-index: 1;
  border-radius: 50%;
  background: conic-gradient(var(--yolk) calc(var(--cd, 0) * 1turn), transparent 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 7px), #000 calc(100% - 6px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 7px), #000 calc(100% - 6px));
  opacity: .95;
  transition: background .08s linear, opacity .15s;
  pointer-events: none;
}
.action-btn.cooling { filter: brightness(.88) saturate(.94); }
.action-btn.cooling:active { filter: brightness(.95); }
.action-btn.ready { animation: readyPop .4s ease-out; }
@keyframes readyPop {
  0% { box-shadow: 0 6px 0 #A93522, 0 0 0 0 rgba(255, 248, 232, .9); }
  60% { box-shadow: 0 6px 0 #A93522, 0 0 0 9px rgba(255, 248, 232, 0); }
  100% { box-shadow: 0 6px 0 #A93522, 0 0 0 0 rgba(255, 248, 232, 0); }
}
.ripple {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid rgba(255, 248, 232, .9);
  animation: rippleOut .45s ease-out forwards;
  pointer-events: none;
}
@keyframes rippleOut {
  from { transform: scale(.7); opacity: .9; }
  to { transform: scale(1.55); opacity: 0; }
}

/* ---------- start screen ---------- */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
}
.start-screen {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  padding: calc(8px + var(--safe-t)) 12px calc(10px + var(--safe-b));
  background:
    linear-gradient(180deg, rgba(255, 241, 214, .04) 0%, transparent 22%, rgba(63, 191, 110, .1) 62%, rgba(28, 122, 76, .16) 100%);
}
.start-topbar {
  position: absolute;
  left: 12px;
  right: 12px;
  top: calc(8px + var(--safe-t));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  z-index: 3;
}
.icon-row { display: flex; gap: 6px; }
.title-wrap {
  position: relative;
  text-align: center;
  margin-top: 34px;
  flex: 0 0 auto;
}
.title-wrap::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 46%;
  width: min(96vw, 470px);
  height: 150px;
  transform: translate(-50%, -50%);
  background: radial-gradient(ellipse at 50% 50%, rgba(255, 241, 214, .6), rgba(255, 201, 60, .16) 46%, transparent 70%);
  filter: blur(6px);
  pointer-events: none;
  z-index: -1;
}
.title-art {
  display: block;
  width: min(84vw, 390px);
  height: auto;
  margin: 0 auto;
  filter: drop-shadow(0 5px 0 rgba(58, 42, 69, .2)) drop-shadow(0 12px 18px rgba(58, 42, 69, .2));
  animation: titleBob 5s ease-in-out infinite;
}
@keyframes titleBob {
  0%, 100% { transform: translateY(0) rotate(-.3deg); }
  50% { transform: translateY(-4px) rotate(.3deg); }
}
.title-sub {
  display: inline-block;
  margin: 2px 0 0;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(58, 42, 69, .5);
  border: 1px solid rgba(255, 241, 214, .35);
  color: var(--cream);
  font-family: var(--display);
  font-weight: 700;
  font-size: 10.5px;
  letter-spacing: 2px;
  text-transform: uppercase;
}
.stable-board {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 0 1 auto;
  min-height: 0;
  max-height: min(62vh, 640px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 11px 11px 9px;
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .55), transparent 18%),
    linear-gradient(180deg, #FFF8E8, #FFEBCB);
  border: 2px solid #FFF1D6;
  box-shadow:
    0 7px 0 rgba(58, 42, 69, .22),
    0 16px 30px rgba(58, 42, 69, .28),
    inset 0 1px 0 #fff;
  z-index: 2;
  scrollbar-width: thin;
}
.board-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 0 3px 7px;
}
.board-head h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 800;
  font-size: 18px;
  line-height: 1;
  letter-spacing: -.2px;
  color: var(--plum);
}
.board-meta {
  font-family: var(--num);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .4px;
  color: var(--meadow);
  text-transform: uppercase;
  white-space: nowrap;
}
.stable-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}
.stable-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 92px;
  padding: 7px;
  border-radius: 15px;
  background: #FFFDF6;
  border: 2px solid #F6E2BE;
  box-shadow: 0 3px 0 rgba(58, 42, 69, .14), inset 0 1px 0 #fff;
  text-align: left;
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
  overflow: hidden;
}
.stable-card:active { transform: translateY(1px) scale(.99); }
.stable-card.selected {
  border-color: var(--coral);
  box-shadow: 0 3px 0 rgba(217, 74, 47, .45), 0 0 0 3px rgba(255, 107, 74, .16), inset 0 1px 0 #fff;
  background: #FFF7E9;
}
.stable-card.locked { cursor: pointer; }
.stable-card.locked .fam-name { color: #6F6378; }
.fam-portrait {
  position: relative;
  width: 58px;
  height: 62px;
  flex: 0 0 auto;
  border-radius: 11px;
  background:
    radial-gradient(circle at 50% 70%, rgba(63, 191, 110, .25), transparent 68%),
    linear-gradient(180deg, #E7F9EA, #D3F0D9);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.fam-portrait img {
  width: 96%;
  height: 96%;
  object-fit: contain;
  object-position: 50% 55%;
  filter: drop-shadow(0 3px 2px rgba(58, 42, 69, .2));
}
.stable-card.locked .fam-portrait img {
  filter: brightness(0) saturate(0) opacity(.32) drop-shadow(0 2px 1px rgba(58, 42, 69, .1));
}
.stable-card.selected .fam-portrait {
  background:
    radial-gradient(circle at 50% 62%, rgba(255, 107, 74, .34), transparent 68%),
    linear-gradient(180deg, #FFF3D6, #FFE7B8);
  box-shadow: inset 0 0 0 2px rgba(255, 107, 74, .35);
}
.fam-info { min-width: 0; flex: 1 1 auto; }
.fam-name {
  display: block;
  font-family: var(--display);
  font-weight: 800;
  font-size: 14.5px;
  line-height: 1.05;
  color: var(--plum);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fam-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}
.fam-el {
  font-family: var(--display);
  font-weight: 800;
  font-size: 8.5px;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: #FFF8E8;
  padding: 2px 5px;
  border-radius: 999px;
  background: var(--el, var(--coral));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45);
  white-space: nowrap;
}
.fam-lv {
  font-family: var(--num);
  font-weight: 700;
  font-size: 10px;
  color: #94879C;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.fam-line {
  margin: 3px 0 0;
  font-family: var(--text);
  font-weight: 600;
  font-size: 12.5px;
  line-height: 1.2;
  color: #7A6C82;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.lock-badge {
  position: absolute;
  right: 5px;
  top: 5px;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(58, 42, 69, .12);
  color: #75677E;
}
.lock-badge svg { width: 10px; height: 10px; }
.card-ready {
  position: absolute;
  right: 5px;
  top: 5px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--coral);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 0 rgba(58, 42, 69, .2);
}
.card-ready svg { width: 10px; height: 10px; }
.starter-note {
  margin: 7px 2px 0;
  padding: 6px 9px;
  border-radius: 10px;
  background: rgba(89, 210, 232, .14);
  border: 1px solid rgba(89, 210, 232, .45);
  font-family: var(--text);
  font-size: 11.5px;
  line-height: 1.3;
  color: #3E6A71;
  font-weight: 600;
}
.starter-note b { color: var(--plum); font-weight: 800; }
.diff-block { margin-top: 7px; }
.diff-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  padding: 0 3px 4px;
  font-family: var(--display);
  font-weight: 800;
  font-size: 12.5px;
  color: var(--plum);
}
.diff-head span:last-child {
  font-family: var(--text);
  font-weight: 600;
  font-size: 10.5px;
  color: #7A6C82;
  text-align: right;
}
.diff-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.diff-card {
  padding: 6px 4px 5px;
  border-radius: 12px;
  background: #FFFDF6;
  border: 2px solid #F6E2BE;
  box-shadow: 0 3px 0 rgba(58, 42, 69, .12), inset 0 1px 0 #fff;
  text-align: center;
  transition: transform .1s ease, border-color .1s ease;
}
.diff-card:active { transform: translateY(1px); }
.diff-card.selected {
  background: linear-gradient(180deg, #FF9B78, #FF6B4A);
  border-color: #FFF1D6;
  box-shadow: 0 3px 0 #A93522, 0 0 0 2px rgba(255, 107, 74, .24);
  color: #FFF8E8;
}
.diff-card b {
  display: block;
  font-family: var(--display);
  font-weight: 800;
  font-size: 14px;
  line-height: 1;
  letter-spacing: .3px;
}
.diff-card small {
  display: block;
  margin-top: 2px;
  font-family: var(--num);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: .5px;
  opacity: .75;
  text-transform: uppercase;
}
.diff-card.selected small { opacity: .92; }
.ranch-ledger {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 8px;
}
.ledger-tile {
  padding: 5px 6px 4px;
  border-radius: 10px;
  background: rgba(58, 42, 69, .055);
  border: 1px solid rgba(58, 42, 69, .08);
  text-align: center;
}
.ledger-tile b {
  display: block;
  font-family: var(--num);
  font-weight: 800;
  font-size: 19px;
  line-height: 1;
  color: var(--plum);
}
.ledger-tile small {
  display: block;
  margin-top: 1px;
  font-family: var(--text);
  font-weight: 700;
  font-size: 8.5px;
  letter-spacing: .9px;
  text-transform: uppercase;
  color: #8C7E95;
}
.board-tip {
  margin: 7px 2px 0;
  font-size: 10.5px;
  line-height: 1.3;
  color: #7A6C82;
  font-weight: 600;
}
.board-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding: 8px 3px 0;
  border-top: 1px dashed rgba(58, 42, 69, .12);
  font-family: var(--num);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .4px;
  color: #7A6C82;
  text-transform: uppercase;
}
.goal-line { text-align: right; text-transform: none; letter-spacing: 0; font-family: var(--text); font-weight: 600; font-size: 10.5px; color: #6C7D72; }
.start-actions {
  flex: 0 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 7px;
  z-index: 2;
}
.start-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  height: 58px;
  border-radius: 18px;
  background: linear-gradient(180deg, #FFA07E 0%, #FF7852 40%, #FF5F3D 75%, #E84C2E 100%);
  border: 3px solid var(--cream);
  box-shadow:
    0 6px 0 #AE3622,
    0 12px 24px rgba(58, 42, 69, .32),
    inset 0 2px 0 rgba(255, 255, 255, .42);
  color: #FFF8E8;
  transition: transform .08s ease, filter .08s ease, box-shadow .08s ease;
}
.start-btn:disabled { filter: saturate(.35) brightness(1.03); cursor: default; }
.start-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 #AE3622, 0 6px 12px rgba(58, 42, 69, .3), inset 0 2px 0 rgba(255, 255, 255, .32); filter: brightness(1.06); }
.start-ico { display: grid; place-items: center; width: 24px; height: 24px; }
.start-ico svg { width: 22px; height: 22px; }
.start-label {
  font-family: var(--display);
  font-weight: 800;
  font-size: 24px;
  letter-spacing: .5px;
  text-shadow: 0 2px 0 rgba(58, 42, 69, .28);
}
.start-diff {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(58, 42, 69, .24);
  border: 1px solid rgba(255, 241, 214, .35);
  font-family: var(--num);
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 1px;
}
.mode-strip { display: flex; gap: 4px; }
.mode {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 4px 2px 3px;
  border-radius: 10px;
  background: rgba(58, 42, 69, .38);
  border: 1px solid rgba(255, 241, 214, .28);
  color: rgba(255, 248, 232, .9);
  text-shadow: 0 1px 0 rgba(58, 42, 69, .25);
}
.mode.active {
  background: rgba(255, 241, 214, .94);
  border-color: var(--cream);
  color: var(--plum);
  box-shadow: 0 2px 0 rgba(58, 42, 69, .18);
}
.mode svg { width: 14px; height: 14px; }
.mode span {
  font-family: var(--display);
  font-weight: 700;
  font-size: 8px;
  letter-spacing: .2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.mode.locked { opacity: .82; }

.hp-shell.low .hp-fill {
  animation: lowPulse .9s ease-in-out infinite;
}
@keyframes lowPulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.35); }
}
.hurt-flash {
  position: absolute;
  inset: 0;
  z-index: 55;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 50%, transparent 42%, rgba(255, 107, 74, .36) 100%);
  opacity: 0;
  animation: hurtPop .32s ease-out;
}
@keyframes hurtPop {
  0% { opacity: 0; }
  24% { opacity: 1; }
  100% { opacity: 0; }
}


/* ---------- equipment / satchel / chest ---------- */
.satchel-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: radial-gradient(circle at 35% 28%, #FFA07E, var(--coral));
  border: 2px solid #FFF8E8;
  color: #FFF8E8;
  font-family: var(--num);
  font-weight: 800;
  font-size: 11px;
  line-height: 14px;
  text-align: center;
  box-shadow: 0 2px 0 rgba(58, 42, 69, .2);
}
.result-loot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  background: linear-gradient(90deg, rgba(255, 201, 60, .2), rgba(255, 241, 214, .3));
  border: 2px solid var(--rar, #FFC93C);
  animation: unlockIn .4s ease-out both;
}
.result-loot .gear-icon { width: 36px; height: 36px; }
.result-loot b { display: block; font-family: var(--display); font-weight: 800; font-size: 14px; }
.result-loot span { display: block; font-size: 10.5px; font-weight: 600; color: #6E6176; }
.result-subactions { display: flex; gap: 7px; }
.result-subactions .soft-btn { flex: 1; }
.chest-screen { z-index: 85; }
.chest-panel {
  position: relative;
  width: 100%;
  max-width: 400px;
  max-height: 92vh;
  overflow-y: auto;
  padding: 16px;
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .55), transparent 16%),
    linear-gradient(180deg, #FFF8E8, #FFE9C2);
  border: 2px solid var(--cream);
  box-shadow: 0 8px 0 rgba(58, 42, 69, .3), 0 28px 60px rgba(58, 42, 69, .4), inset 0 1px 0 #fff;
  text-align: center;
  animation: panelIn .3s cubic-bezier(.2, 1.35, .4, 1);
}
.chest-stage {
  position: relative;
  height: min(44vw, 210px);
  margin: 8px auto 2px;
  display: grid;
  place-items: center;
  isolation: isolate;
}
.chest-beam {
  position: absolute;
  left: 50%;
  bottom: 8%;
  width: 90px;
  height: 220%;
  transform: translateX(-50%) rotate(180deg);
  transform-origin: 50% 100%;
  background: linear-gradient(180deg, transparent 0%, color-mix(in srgb, var(--chest-rar, #FFC93C) 70%, transparent) 52%, color-mix(in srgb, var(--chest-rar, #FFC93C) 22%, transparent) 100%);
  filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  z-index: -1;
}
.chest-img {
  position: relative;
  max-height: 100%;
  max-width: 82%;
  object-fit: contain;
  filter: drop-shadow(0 12px 18px rgba(58, 42, 69, .28)) drop-shadow(0 0 18px color-mix(in srgb, var(--chest-rar, #FFC93C) 60%, transparent));
  z-index: 1;
}
.chest-stage.opening .chest-img { animation: chestShake .5s ease-in-out; }
.chest-stage.open .chest-beam { animation: chestBeam .9s ease-out forwards; }
@keyframes chestShake {
  0%, 100% { transform: rotate(0) scale(1); }
  20% { transform: rotate(-4deg) scale(1.03); }
  40% { transform: rotate(4deg) scale(1.03); }
  60% { transform: rotate(-3deg) scale(1.02); }
  80% { transform: rotate(2deg) scale(1.01); }
}
@keyframes chestBeam {
  0% { opacity: 0; transform: translateX(-50%) scaleY(.2); }
  35% { opacity: .9; }
  100% { opacity: 0; transform: translateX(-50%) scaleY(1.2); }
}
.chest-rarity {
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  padding: 3px 12px;
  border-radius: 999px;
  background: var(--chest-rar, #FFC93C);
  border: 2px solid #FFF8E8;
  color: #3A2A45;
  font-family: var(--display);
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  box-shadow: 0 3px 0 rgba(58, 42, 69, .2);
}
.chest-item { margin: 14px 0 12px; }
.chest-item .gear-card { cursor: default; max-width: 320px; margin: 0 auto; }
.chest-item .gear-card:active { transform: none; }
.chest-screen .primary-btn[disabled] { opacity: .5; }
.satchel-panel { max-width: 470px; }
.satchel-hint { margin: 0 0 8px; font-size: 11px; line-height: 1.35; color: #7A6C82; font-weight: 600; }
.satchel-slots {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}
.gear-slot {
  min-height: 64px;
  padding: 5px;
  border-radius: 11px;
  border: 2px dashed rgba(58, 42, 69, .18);
  background: rgba(255, 248, 232, .5);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: #9A8AA0;
  font-size: 9px;
  font-weight: 700;
  text-align: center;
}
.gear-slot.filled { border-style: solid; border-color: var(--rar, var(--coral)); background: #FFFDF6; color: var(--plum); }
.gear-slot .gear-icon { width: 30px; height: 30px; }
.gear-slot b { font-family: var(--display); font-size: 10px; line-height: 1.05; }
.satchel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  max-height: 47vh;
  overflow-y: auto;
  padding: 1px 2px 4px;
}
.satchel-empty { margin: 8px 0; font-size: 12px; color: #7A6C82; font-weight: 600; text-align: center; }
.gear-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 8px;
  border-radius: 13px;
  background: #FFFDF6;
  border: 2px solid var(--rar, #F0D9B0);
  box-shadow: 0 3px 0 color-mix(in srgb, var(--rar, #C9A16B) 38%, transparent), inset 0 1px 0 #fff;
  text-align: left;
  overflow: hidden;
  transition: transform .1s ease, filter .1s ease;
}
.gear-card::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 5px;
  background: var(--rar, #B7AFC0);
}
.gear-card:active { transform: translateY(2px) scale(.99); }
.gear-card.equipped { box-shadow: 0 3px 0 color-mix(in srgb, var(--rar, #C9A16B) 38%, transparent), 0 0 0 3px color-mix(in srgb, var(--rar, #FFC93C) 28%, transparent), inset 0 1px 0 #fff; }
.gear-card.misfit { filter: saturate(.55) brightness(.97); }
.gear-card.misfit::after {
  content: 'OTHER FAMILY';
  position: absolute;
  right: 5px;
  top: 8px;
  font-family: var(--display);
  font-weight: 800;
  font-size: 6.5px;
  letter-spacing: .7px;
  color: #8C7E95;
}
.gear-top { display: flex; align-items: center; gap: 6px; width: 100%; padding-top: 3px; }
.gear-icon {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 38% 30%, #FFF8E8, color-mix(in srgb, var(--rar, #B7AFC0) 22%, #FFF1D6));
  border: 2px solid color-mix(in srgb, var(--rar, #B7AFC0) 55%, #FFF1D6);
  color: var(--rar, #B7AFC0);
}
.gear-icon svg { width: 20px; height: 20px; }
.gear-name { font-family: var(--display); font-weight: 800; font-size: 12.5px; line-height: 1.05; color: var(--plum); }
.gear-rarity { font-family: var(--display); font-weight: 800; font-size: 8px; letter-spacing: 1px; text-transform: uppercase; color: var(--rar, #B7AFC0); }
.gear-fam { font-family: var(--display); font-weight: 700; font-size: 8px; letter-spacing: .5px; text-transform: uppercase; color: #8C7E95; }
.gear-stats { margin: 1px 0 0; padding: 0; list-style: none; width: 100%; }
.gear-stats li { font-family: var(--text); font-weight: 700; font-size: 10px; line-height: 1.25; color: #5E5167; }
.gear-skill { margin-top: 2px; padding: 3px 5px; border-radius: 5px; background: rgba(142, 91, 217, .1); font-size: 9.5px; line-height: 1.25; color: #6B4A96; font-weight: 700; width: 100%; }
.gear-equipped-tag {
  position: absolute;
  right: 5px;
  bottom: 5px;
  padding: 1px 5px;
  border-radius: 999px;
  background: var(--rar, var(--coral));
  color: #FFF8E8;
  font-family: var(--display);
  font-weight: 800;
  font-size: 7px;
  letter-spacing: .6px;
}

/* ---------- level up ---------- */
.levelup-screen {
  z-index: 60;
  display: grid;
  pointer-events: none;
  place-items: center;
  padding: 14px;
}
.lu-dim {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 62%, rgba(255, 201, 60, .22), transparent 60%),
    rgba(58, 42, 69, .46);
  backdrop-filter: blur(2px);
}
.lu-content {
  position: relative;
  z-index: 2;
  pointer-events: none;
  width: 100%;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.lu-head { text-align: center; color: var(--cream); }
.lu-chip {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--yolk);
  color: var(--plum);
  font-family: var(--display);
  font-weight: 800;
  font-size: 10px;
  letter-spacing: 1.4px;
}
.lu-chip b { font-family: var(--num); font-size: 14px; }
.lu-head h2 {
  margin: 5px 0 1px;
  font-family: var(--display);
  font-weight: 800;
  font-size: 31px;
  line-height: 1;
  color: var(--cream);
  text-shadow: 0 3px 0 rgba(58, 42, 69, .38);
}
.lu-head p { margin: 0; font-family: var(--text); font-weight: 600; font-size: 13px; color: rgba(255, 241, 214, .84); }
.card-row {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 8px;
  width: 100%;
}
.up-card {
  position: relative;
  pointer-events: auto;
  flex: 1 1 0;
  min-width: 0;
  max-width: 172px;
  border-radius: 16px;
  padding: 10px 7px 8px;
  background-image: url('assets/art/hud_kit_07_upgrade_card_frame.webp');
  background-size: 100% 100%;
  background-repeat: no-repeat;
  border: 0;
  text-align: center;
  opacity: 0;
  transform: translateY(48px) scale(.86);
  animation: cardIn .44s cubic-bezier(.2, 1.5, .4, 1) forwards;
  overflow: hidden;
  filter: drop-shadow(0 8px 14px rgba(58, 42, 69, .25));
}
.up-card:nth-child(2) { animation-delay: .06s; }
.up-card:nth-child(3) { animation-delay: .12s; }
@keyframes cardIn {
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.up-card:active { transform: translateY(3px) scale(.98); }
.up-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  min-height: 190px;
  padding: 8px 7px 6px;
  border-radius: 11px;
  background: rgba(255, 251, 240, .96);
}
.rarity-strip {
  position: absolute;
  left: 9px;
  right: 9px;
  top: 0;
  height: 6px;
  border-radius: 0 0 5px 5px;
  background: var(--rar, var(--grey));
  box-shadow: inset 0 -2px 0 rgba(58, 42, 69, .14);
}
.rarity-tag {
  position: absolute;
  top: 6px;
  left: 0;
  right: 0;
  text-align: center;
  font-family: var(--display);
  font-weight: 800;
  font-size: 8.5px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--rar, var(--grey));
}
.up-ico {
  width: 54px;
  height: 54px;
  margin-top: 17px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--rar, var(--coral));
  background: radial-gradient(circle at 40% 32%, #fff, rgba(255, 241, 214, .6));
  border: 2px solid color-mix(in srgb, var(--rar, var(--coral)) 40%, #FFF1D6);
  box-shadow: 0 3px 0 rgba(58, 42, 69, .12), inset 0 1px 0 #fff;
}
.up-ico svg { width: 31px; height: 31px; }
.up-name {
  margin-top: 6px;
  font-family: var(--display);
  font-weight: 800;
  font-size: 15px;
  line-height: 1.05;
  color: var(--plum);
}
.up-desc {
  margin: 4px 0 0;
  font-family: var(--text);
  font-weight: 600;
  font-size: 14px;
  line-height: 1.1;
  color: #5E5167;
}
.up-evolve {
  display: block;
  margin-top: 6px;
  padding: 3px 6px;
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(255, 201, 60, .28), rgba(183, 240, 138, .28));
  border: 1px dashed rgba(58, 42, 69, .2);
  font-family: var(--text);
  font-weight: 600;
  font-size: 10.5px;
  line-height: 1.18;
  color: #4A5C42;
}
.up-stacks {
  margin-top: auto;
  padding-top: 6px;
  font-family: var(--num);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: .6px;
  color: #8C7E95;
  text-transform: uppercase;
}
.lu-foot {
  margin: 0;
  font-family: var(--text);
  font-weight: 600;
  font-size: 11px;
  color: rgba(255, 241, 214, .7);
}

/* ---------- evolution ---------- */
.evolve-screen {
  z-index: 70;
  display: grid;
  place-items: center;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 50%, rgba(255, 201, 60, .25), rgba(58, 42, 69, .16) 52%, transparent 72%);
}
.evo-bloom {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 46%, rgba(255, 241, 214, .9), rgba(255, 201, 60, .35) 24%, transparent 58%);
  animation: evoBloom 2.6s ease-out forwards;
}
@keyframes evoBloom {
  0% { opacity: 0; transform: scale(.55); }
  22% { opacity: 1; transform: scale(1); }
  72% { opacity: .8; }
  100% { opacity: 0; transform: scale(1.16); }
}
.evo-inner {
  position: relative;
  text-align: center;
  color: var(--plum);
  animation: evoRise 2.6s ease-out forwards;
}
@keyframes evoRise {
  0% { opacity: 0; transform: translateY(22px) scale(.92); }
  18% { opacity: 1; transform: none; }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-14px) scale(1.03); }
}
.evo-eyebrow {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--violet);
  color: #FFF8E8;
  font-family: var(--display);
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 3px;
  box-shadow: 0 3px 0 rgba(58, 42, 69, .25);
}
.evo-portrait {
  width: min(48vw, 220px);
  height: min(48vw, 220px);
  margin: 6px auto 2px;
  display: grid;
  place-items: center;
}
.evo-portrait img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 10px 18px rgba(58, 42, 69, .3)) drop-shadow(0 0 22px rgba(255, 201, 60, .7));
  animation: evoFloat 2.6s ease-out forwards;
}
@keyframes evoFloat {
  0% { transform: scale(.72) rotate(-5deg); }
  38% { transform: scale(1.06) rotate(1deg); }
  100% { transform: scale(1) rotate(0); }
}
.evo-copy {
  margin-top: 8px;
  padding: 9px 18px 11px;
  border-radius: 18px;
  background: rgba(255, 248, 232, .92);
  border: 2px solid rgba(255, 241, 214, .9);
  box-shadow: 0 6px 0 rgba(58, 42, 69, .18), 0 16px 34px rgba(58, 42, 69, .2);
  max-width: 92vw;
}
.evo-inner h2 {
  margin: 0;
  font-family: var(--display);
  font-weight: 800;
  font-size: 34px;
  line-height: 1;
  color: var(--plum);
  text-shadow: none;
}
.evo-inner p {
  margin: 4px 0 6px;
  font-family: var(--text);
  font-weight: 700;
  font-size: 14px;
  color: #5E5167;
}
.evo-tag {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(58, 42, 69, .78);
  color: #FFF1D6;
  font-family: var(--num);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: .8px;
}

/* ---------- modals ---------- */
.modal-screen {
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(58, 42, 69, .5);
  backdrop-filter: blur(4px);
}
.panel {
  position: relative;
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 16px;
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .55), transparent 16%),
    linear-gradient(180deg, #FFF8E8, #FFEAC8);
  border: 2px solid var(--cream);
  box-shadow:
    0 8px 0 rgba(58, 42, 69, .3),
    0 26px 60px rgba(58, 42, 69, .4),
    inset 0 1px 0 #fff;
  animation: panelIn .28s cubic-bezier(.2, 1.35, .4, 1);
  scrollbar-width: thin;
}
@keyframes panelIn {
  from { opacity: 0; transform: translateY(18px) scale(.96); }
}
.eyebrow {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--plum);
  color: var(--cream);
  font-family: var(--display);
  font-weight: 800;
  font-size: 9px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
}
.panel h2 {
  margin: 6px 0 8px;
  font-family: var(--display);
  font-weight: 800;
  font-size: 27px;
  line-height: 1;
  color: var(--plum);
}
.primary-btn {
  width: 100%;
  height: 50px;
  border-radius: 15px;
  background: linear-gradient(180deg, #FF9B78, #FF6B4A 62%, #E84C2E);
  border: 2px solid var(--cream);
  box-shadow: 0 5px 0 #AE3622, 0 10px 18px rgba(58, 42, 69, .22), inset 0 2px 0 rgba(255, 255, 255, .4);
  color: #FFF8E8;
  font-family: var(--display);
  font-weight: 800;
  font-size: 20px;
  letter-spacing: .3px;
  transition: transform .08s ease, filter .08s ease;
}
.primary-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #AE3622, 0 5px 10px rgba(58, 42, 69, .22); filter: brightness(1.05); }
.soft-btn {
  height: 42px;
  border-radius: 12px;
  background: #FFFDF6;
  border: 2px solid #F0D9B0;
  box-shadow: 0 3px 0 rgba(58, 42, 69, .14), inset 0 1px 0 #fff;
  color: var(--plum);
  font-family: var(--display);
  font-weight: 700;
  font-size: 14px;
  transition: transform .08s ease;
}
.soft-btn:active { transform: translateY(2px); }
.pause-stats {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}
.pause-stats .mini {
  flex: 1;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(58, 42, 69, .06);
  border: 1px solid rgba(58, 42, 69, .08);
  font-family: var(--num);
  font-weight: 700;
  font-size: 21px;
  text-align: center;
}
.pause-stats .mini small {
  display: block;
  font-family: var(--text);
  font-weight: 600;
  font-size: 9px;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: #8C7E95;
}
.pause-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-top: 9px;
}
.pause-note { margin: 9px 0 0; font-size: 11px; line-height: 1.35; color: #7A6C82; font-weight: 600; text-align: center; }
.help-panel { max-width: 430px; }
.help-row {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  padding: 7px 0;
  border-bottom: 1px dashed rgba(58, 42, 69, .12);
}
.help-row:last-of-type { border-bottom: 0; }
.help-ico {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 201, 60, .2);
  color: var(--coral);
}
.help-ico svg { width: 19px; height: 19px; }
.help-row b { font-family: var(--display); font-weight: 800; font-size: 14px; display: block; }
.help-row p { margin: 1px 0 0; font-size: 12.5px; line-height: 1.3; color: #6E6176; font-weight: 600; }
.help-keys {
  margin: 9px 0 11px;
  padding: 7px 9px;
  border-radius: 9px;
  background: rgba(58, 42, 69, .06);
  font-size: 11px;
  line-height: 1.4;
  color: #6E6176;
  font-weight: 600;
}
.records-list { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.records-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border-radius: 10px;
  background: rgba(58, 42, 69, .05);
  font-family: var(--num);
  font-weight: 700;
  font-size: 17px;
}
.records-list .rank { width: 20px; color: var(--coral); font-size: 15px; }
.records-list .who { flex: 1; font-family: var(--text); font-weight: 700; font-size: 13px; color: var(--plum); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.records-list .who a { color: inherit; text-decoration: none; }
.records-list .when { color: #6E6176; font-size: 13px; font-family: var(--num); letter-spacing: .6px; }
.records-list .record-empty { justify-content: center; font-family: var(--text); font-size: 12px; color: #7A6C82; }
.records-note { margin: 0 0 10px; font-size: 11px; line-height: 1.35; color: #7A6C82; font-weight: 600; }

/* result */
.result-panel { max-width: 440px; }
.result-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.result-portrait {
  width: 72px;
  height: 76px;
  flex: 0 0 auto;
  border-radius: 15px;
  background: radial-gradient(circle at 50% 72%, rgba(63, 191, 110, .3), transparent 70%), linear-gradient(180deg, #EDFBEE, #D5F3DC);
  border: 2px solid #FFF1D6;
  box-shadow: 0 3px 0 rgba(58, 42, 69, .16);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.result-portrait img { max-width: 108%; max-height: 108%; object-fit: contain; filter: drop-shadow(0 3px 2px rgba(58, 42, 69, .2)); }
.result-heading { min-width: 0; }
.result-heading h2 { margin: 4px 0 2px; font-size: 24px; }
.result-heading p { margin: 0; font-size: 12px; line-height: 1.3; color: #6E6176; font-weight: 600; }
.result-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 9px;
}
.stat-tile {
  padding: 7px 9px;
  border-radius: 11px;
  background: #FFFDF6;
  border: 2px solid #F2DDB7;
  box-shadow: 0 3px 0 rgba(58, 42, 69, .1), inset 0 1px 0 #fff;
}
.stat-tile small {
  display: block;
  font-family: var(--text);
  font-weight: 700;
  font-size: 9.5px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #8C7E95;
}
.stat-tile b {
  display: block;
  font-family: var(--num);
  font-weight: 800;
  font-size: 27px;
  line-height: 1;
  color: var(--plum);
}
.stat-tile.gold b { color: #C68A00; }
.stat-tile.coral b { color: var(--coral-deep); }
.stat-tile.violet b { color: var(--violet); }
.result-rank {
  margin: 0 0 8px;
  padding: 6px 9px;
  border-radius: 10px;
  background: rgba(89, 210, 232, .14);
  border: 1px dashed rgba(89, 210, 232, .55);
  font-family: var(--text);
  font-weight: 700;
  font-size: 11.5px;
  color: #3E6A71;
  text-align: center;
}
.result-rank b { color: var(--plum); }
.result-unlocks { display: flex; flex-direction: column; gap: 5px; margin-bottom: 8px; }
.unlock-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  background: linear-gradient(90deg, rgba(142, 91, 217, .16), rgba(89, 210, 232, .1));
  border: 2px solid rgba(142, 91, 217, .35);
  animation: unlockIn .4s ease-out both;
}
@keyframes unlockIn { from { opacity: 0; transform: scale(.96); } }
.unlock-banner img { width: 33px; height: 36px; object-fit: contain; }
.unlock-banner b { display: block; font-family: var(--display); font-weight: 800; font-size: 14px; color: var(--violet); }
.unlock-banner span { display: block; font-size: 11px; line-height: 1.25; color: #5E5167; font-weight: 600; }
.next-goal {
  margin-bottom: 9px;
  padding: 8px 10px;
  border-radius: 11px;
  background: rgba(89, 210, 232, .12);
  border: 1px dashed rgba(89, 210, 232, .55);
  font-size: 11.5px;
  line-height: 1.35;
  color: #3E6A71;
  font-weight: 600;
}
.next-goal b { color: var(--plum); }
.result-actions { display: flex; flex-direction: column; gap: 7px; }
.record-new {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--yolk);
  color: var(--plum);
  font-family: var(--display);
  font-weight: 800;
  font-size: 8px;
  letter-spacing: 1px;
  vertical-align: middle;
}

/* toasts */
.toasts {
  position: absolute;
  top: calc(var(--topH) + 6px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  pointer-events: none;
  width: max-content;
  max-width: 92vw;
}
.toast {
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255, 248, 232, .97);
  border: 2px solid var(--cream);
  box-shadow: 0 4px 0 rgba(58, 42, 69, .2), 0 8px 16px rgba(58, 42, 69, .16);
  color: var(--plum);
  font-family: var(--display);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: .3px;
  animation: toastIn .3s cubic-bezier(.2, 1.4, .4, 1);
  text-align: center;
}
.toast.gold { background: var(--yolk); }
.toast.violet { background: var(--violet); color: #FFF8E8; }
.toast.coral { background: var(--coral); color: #FFF8E8; }
.toast.fade { opacity: 0; transform: translateY(-6px); transition: opacity .35s, transform .35s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px) scale(.92); } }

/* loading */
.loading-screen {
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background:
    radial-gradient(ellipse at 50% 40%, #FFF1D6, #F7D9A8 46%, #E7B37A 100%);
}
.load-title { width: min(74vw, 330px); filter: drop-shadow(0 6px 0 rgba(58, 42, 69, .2)); }
.load-track {
  width: min(64vw, 260px);
  height: 16px;
  border-radius: 999px;
  background: rgba(58, 42, 69, .18);
  border: 2px solid var(--cream);
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(58, 42, 69, .2);
}
.load-fill {
  height: 100%;
  width: 4%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--coral), var(--yolk));
  transition: width .2s linear;
}
#load-text { margin: 0; font-family: var(--display); font-weight: 700; font-size: 13px; color: var(--plum); }

/* small height tweaks */

@media (min-width: 700px) and (orientation: portrait) {
  #game-root {
    width: min(100vw, 720px);
    border-radius: 30px;
    border: 3px solid rgba(255, 241, 214, .55);
    box-shadow: 0 24px 70px rgba(58, 42, 69, .38);
  }
  .title-art { width: min(56vw, 400px); }
  .stable-grid { grid-template-columns: repeat(3, 1fr); }
  .stable-card { min-height: 96px; }
  .fam-portrait { width: 56px; height: 60px; }
  .fam-name { font-size: 15px; }
  .fam-line { font-size: 12.5px; }
  .fam-el { font-size: 9px; }
  .start-label { font-size: 26px; }
  .start-btn { height: 62px; }
}
@media (max-height: 980px) and (orientation: portrait) {
  .title-art { width: min(72vw, 330px); }
  .stable-card { min-height: 82px; padding: 5px; }
  .fam-portrait { width: 46px; height: 50px; }
  .board-tip { display: none; }
  .ranch-ledger { margin-top: 5px; }
  .ledger-tile { padding: 4px 6px 3px; }
}
@media (max-height: 740px) {
  .near-grass { height: 92px; }
  .title-art { width: min(62vw, 270px); }
  .start-screen { gap: 5px; }
  .stable-card { min-height: 78px; padding: 5px; }
  .fam-portrait { width: 44px; height: 48px; }
  .fam-name { font-size: 13.5px; }
  .fam-line { font-size: 9.5px; }
  .start-btn { height: 52px; }
  .start-label { font-size: 21px; }
  .board-head h1 { font-size: 16px; }
  .hint-strip { display: none; }
}
@media (max-width: 360px) {
  .fam-line { font-size: 10.5px; }
  .fam-name { font-size: 13px; }
  .stable-card { min-height: 84px; padding: 5px 5px; gap: 5px; }
  .fam-portrait { width: 44px; height: 48px; }
  .fam-el { font-size: 7.5px; }
  .fam-lv { font-size: 9px; }
  .title-art { width: min(84vw, 300px); }
  .board-head h1 { font-size: 16px; }
  .starter-note { font-size: 10.5px; }
  .hud { padding-left: 7px; padding-right: 7px; }
  .avatar-wrap { width: 42px; height: 42px; }
  .bars { max-width: 190px; }
  .coin-chip span { font-size: 17px; }
  .hud-chip { padding: 0 6px; }
  .chip-num { font-size: 18px; }
  .action-cluster { right: 10px; gap: 8px; }
  .dash-btn { width: 58px; height: 58px; }
  .ult-btn { width: 78px; height: 78px; }
  .joystick { width: 100px; height: 100px; left: 12px; }
  .up-name { font-size: 13.5px; }
  .up-desc { font-size: 13px; }
}
@media (min-height: 561px) and (max-height: 800px) and (min-width: 760px) and (min-aspect-ratio: 1/1) {
  .title-art { width: min(48vw, 280px); }
  .title-sub { font-size: 9.5px; padding: 3px 9px; }
  .start-screen { gap: 4px; }
  .stable-board { padding: 8px 10px 7px; }
  .stable-card { min-height: 76px; padding: 5px 6px; border-radius: 13px; }
  .fam-portrait { width: 44px; height: 48px; border-radius: 9px; }
  .fam-name { font-size: 13px; }
  .fam-line { font-size: 10.5px; }
  .ranch-ledger, .board-tip { display: none; }
  .starter-note { margin-top: 5px; padding: 4px 8px; font-size: 10.5px; }
  .diff-block { margin-top: 5px; }
  .diff-head { padding-bottom: 3px; }
  .diff-card { padding: 4px; }
  .diff-card b { font-size: 13px; }
  .diff-card small { font-size: 8.5px; }
  .board-foot { margin-top: 6px; padding-top: 6px; }
  .board-head { padding-bottom: 5px; }
  .board-head h1 { font-size: 16px; }
  .start-actions { gap: 5px; }
  .start-btn { height: 51px; border-radius: 15px; }
  .start-label { font-size: 21px; }
  .mode span { font-size: 7.5px; }
  .mode svg { width: 13px; height: 13px; }
  .hint-strip { display: none; }
}
@media (max-height: 560px) and (min-aspect-ratio: 1/1) {
  .start-actions { gap: 3px; }
  .start-btn { height: 42px; }
  .start-label { font-size: 18px; }
  .mode { padding: 2px 1px; }
  .mode span { font-size: 6.5px; }
  .mode svg { width: 11px; height: 11px; }

  .near-grass { height: 70px; }
  .start-screen {
    display: grid;
    grid-template-columns: minmax(220px, 34%) 1fr;
    grid-template-rows: auto 1fr auto;
    gap: 6px 10px;
    padding: calc(6px + var(--safe-t)) 10px calc(6px + var(--safe-b));
  }
  .start-topbar { position: static; grid-column: 1 / -1; grid-row: 1; }
  .title-wrap { grid-column: 1; grid-row: 2; align-self: start; padding-top: 4px; }
  .title-art { width: min(31vw, 235px); }
  .title-sub { font-size: 9px; padding: 3px 8px; letter-spacing: 1.4px; }
  .stable-board {
    grid-column: 2;
    grid-row: 2 / 4;
    height: 100%;
    flex: none;
    padding: 7px 8px 6px;
    border-radius: 18px;
  }
  .board-head { padding-bottom: 4px; }
  .board-head h1 { font-size: 16px; }
  .board-meta { font-size: 11px; }
  .stable-grid { grid-template-columns: repeat(3, 1fr); gap: 5px; }
  .stable-card { min-height: 70px; padding: 4px 5px; gap: 5px; border-radius: 12px; }
  .fam-portrait { width: 40px; height: 44px; border-radius: 9px; }
  .fam-name { font-size: 12.5px; }
  .fam-el { font-size: 7.5px; padding: 1px 4px; }
  .fam-lv { font-size: 9px; }
  .fam-line { font-size: 9.5px; line-height: 1.15; }
  .board-tip { display: none; }
  .starter-note { display: block; margin: 4px 2px 0; padding: 4px 7px; font-size: 10px; }
  .ranch-ledger { display: grid; margin-top: 4px; }
  .ledger-tile { padding: 3px 5px 2px; }
  .ledger-tile b { font-size: 15px; }
  .ledger-tile small { font-size: 7.5px; }
  .board-foot { display: flex; margin-top: 4px; padding-top: 4px; font-size: 10px; }
  .goal-line { font-size: 9px; }
  .diff-block { margin-top: 5px; }
  .diff-head { padding: 0 2px 2px; font-size: 11px; }
  .diff-head span:last-child { font-size: 9px; }
  .diff-row { gap: 5px; }
  .diff-card { padding: 4px 3px; border-radius: 9px; }
  .diff-card b { font-size: 12.5px; }
  .diff-card small { font-size: 8px; margin-top: 1px; }
  .start-actions { grid-column: 1; grid-row: 3; align-self: end; gap: 5px; }
  .start-btn { height: 46px; border-radius: 14px; }
  .start-label { font-size: 19px; }
  .start-diff { font-size: 9px; padding: 2px 5px; right: 8px; }
  .mode-strip { gap: 3px; }
  .mode { border-radius: 8px; padding: 3px 1px 2px; }
  .mode svg { width: 12px; height: 12px; }
  .mode span { font-size: 7px; }
  .hint-strip { display: none; }
  .joystick { width: 96px; height: 96px; left: 12px; }
  .action-cluster { right: 12px; gap: 8px; }
  .dash-btn { width: 58px; height: 58px; }
  .ult-btn { width: 76px; height: 76px; }
  .hud-top { align-items: flex-start; }
  .hud-id .avatar-wrap { width: 42px; height: 42px; }
  .bars { max-width: 210px; }
  .hud-chip { height: 27px; }
  .chip-num { font-size: 18px; }
  .help-chip { width: 27px; }
}
@media (prefers-reduced-motion: reduce) {
  .title-art { animation: none; }
  .up-card { animation-duration: .01s; }
  .evo-bloom, .evo-inner, .evo-portrait img { animation-duration: .01s; }
}
