@font-face {
  font-family: 'Baloo 2';
  src: url('../fonts/wXK0E3kTposypRydzVT08TS3JnAmtdiayqpv.ttf') format('truetype');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Nunito';
  src: url('../fonts/XRXI3I6Li01BKofiOc5wtlZ2di8HDLshRTM.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Nunito';
  src: url('../fonts/XRXI3I6Li01BKofiOc5wtlZ2di8HDFwmRTM.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Oswald';
  src: url('../fonts/TK3_WkUHHAIjg75cFRf3bXL8LICs18NvgUE.ttf') format('truetype');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #2a1f3a;
  --ink-deep: #1b1229;
  --ink-soft: #57466c;
  --cream: #fff3d6;
  --cream-2: #ffe9bd;
  --parchment: #f7e4bb;
  --parchment-2: #efd7a8;
  --canvas: #ecd8ad;
  --ginger: #f39a3e;
  --ginger-deep: #c96a24;
  --rose: #ef6b7a;
  --coral: #f58a63;
  --teal: #3aa6a0;
  --teal-deep: #237a7d;
  --magenta: #c93d8d;
  --gold: #f5b93f;
  --gold-bright: #ffe9a0;
  --violet: #4a2d6e;
  --tin: #b4bbc6;
  --shadow: rgba(24, 14, 38, 0.45);
  --display: 'Baloo 2', 'Trebuchet MS', system-ui, sans-serif;
  --body: 'Nunito', 'Segoe UI', system-ui, sans-serif;
  --num: 'Oswald', 'Arial Narrow', 'Roboto Condensed', monospace;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

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

#app {
  position: fixed;
  inset: 0;
  height: 100dvh;
  overflow: hidden;
  isolation: isolate;
}

#app::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 8;
  background: radial-gradient(ellipse at 50% 47%, transparent 52%, rgba(36, 20, 58, 0.22) 100%);
}

#stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 1;
  touch-action: none;
}

#fx {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 9;
  pointer-events: none;
}

#sunwash {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 40% at 78% 4%, rgba(255, 148, 190, 0.18), transparent 70%),
    linear-gradient(180deg, rgba(255, 214, 232, 0.06), transparent 26%);
  mix-blend-mode: screen;
}

#hurtflash {
  position: absolute;
  inset: 0;
  z-index: 18;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(ellipse at center, transparent 42%, rgba(239, 60, 84, 0.55) 100%);
  transition: opacity 0.28s ease-out;
}
#hurtflash.on { opacity: 1; transition: opacity 0.04s; }

#violetwash {
  position: absolute;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(ellipse at 50% 60%, rgba(89, 48, 138, 0.45), rgba(42, 22, 72, 0.82));
  transition: opacity 0.35s ease;
}
#violetwash.on { opacity: 1; }

.hidden { display: none !important; }

/* ---------- shared painted badges ---------- */

.badge-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background:
    linear-gradient(180deg, #fff7e4 0%, var(--parchment) 46%, var(--parchment-2) 100%);
  color: var(--ink);
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.85),
    inset 0 -4px 0 rgba(201, 106, 36, 0.22),
    0 5px 0 var(--ink),
    0 9px 16px rgba(24, 14, 38, 0.32);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.2s ease;
}
.badge-btn:hover { filter: brightness(1.06); transform: translateY(-2px); }
.badge-btn:active { transform: translateY(4px); box-shadow: inset 0 2px 0 rgba(255,255,255,.7), 0 1px 0 var(--ink); }
.badge-btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 4px; }
.badge-btn::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1.5px dashed rgba(87, 70, 108, 0.38);
  border-radius: inherit;
  pointer-events: none;
}
.badge-btn .btn-shine {
  position: absolute;
  left: 12%;
  top: 3px;
  width: 42%;
  height: 38%;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255,255,255,.9), rgba(255,255,255,0));
  pointer-events: none;
}

.badge-big {
  font-size: clamp(22px, 4.6vw, 40px);
  padding: 12px clamp(28px, 6vw, 70px) 15px;
  background:
    linear-gradient(180deg, #fff6dc 0%, #ffe1a8 42%, #f4bb58 100%);
  border-color: var(--ink);
  text-shadow: 0 1px 0 rgba(255,255,255,.7);
}
.badge-big:hover { filter: brightness(1.08); }
.badge-coop {
  background:
    linear-gradient(180deg, #e7fbf7 0%, #b8eadf 42%, #74c9b8 100%);
}

.badge-small {
  font-size: clamp(10px, 2.4vw, 14px);
  padding: 8px 16px 9px;
  border-width: 2.5px;
  box-shadow:
    inset 0 2px 0 rgba(255,255,255,.8),
    inset 0 -3px 0 rgba(201,106,36,.18),
    0 3px 0 var(--ink),
    0 6px 10px rgba(24,14,38,.25);
}

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

#hud {
  position: absolute;
  inset: 0;
  z-index: 12;
  pointer-events: none;
  padding: calc(var(--safe-t) + 10px) calc(12px + var(--safe-r)) 0 calc(12px + var(--safe-l));
}

.hud-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "left right"
    "center center";
  align-items: start;
  gap: 0;
}

.hud-left { grid-area: left; display: flex; flex-direction: column; gap: 8px; min-width: 0; }

/* The boss bar and the co-op partner chip live in one centre column. In
   portrait they sit on their own row under the top HUD; in landscape they
   move between the health cluster and the clock so nothing crosses the pet
   or the bottom controls. */
.hud-center {
  grid-area: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  margin-top: 12px;
}

.health-row { display: flex; align-items: center; gap: 7px; min-width: 0; }

.paw-emblem {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  color: var(--cream);
  background: linear-gradient(180deg, #44305e, #2a1f3a);
  border: 3px solid var(--ink);
  border-radius: 50%;
  display: grid;
  place-items: center;
  box-shadow: 0 3px 0 rgba(24,14,38,.4), inset 0 2px 0 rgba(255,255,255,.2);
}
.paw-emblem svg { width: 24px; height: 24px; }

.health-pill {
  position: relative;
  width: clamp(148px, 28vw, 300px);
  height: 38px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: linear-gradient(180deg, #fffdf2, #f6e6c4);
  overflow: hidden;
  box-shadow: 0 3px 0 rgba(24,14,38,.35), inset 0 2px 0 #fff;
}

.health-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 100%;
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.42) 0 34%, transparent 35%),
    linear-gradient(90deg, #f58a63 0%, #ef6b7a 62%, #e35476 100%);
  transition: width 0.18s ease-out;
  box-shadow: inset 0 -4px 0 rgba(140, 30, 60, 0.26);
}

.health-ticks {
  position: absolute;
  inset: 5px 8px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}
.health-ticks i {
  width: 3px;
  border-radius: 2px;
  background: repeating-linear-gradient(180deg, rgba(255,255,255,.85) 0 5px, rgba(42,31,58,.22) 5px 8px);
}

.health-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--num);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.12em;
  color: var(--cream);
  text-shadow: 0 1px 0 rgba(42,31,58,.65), 0 0 6px rgba(42,31,58,.35);
}

.level-chip {
  flex: 0 0 auto;
  font-family: var(--display);
  font-weight: 800;
  font-size: 12px;
  letter-spacing: .05em;
  color: var(--ink);
  background: linear-gradient(180deg, #ffe9a0, var(--gold));
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  padding: 5px 8px 6px;
  box-shadow: 0 3px 0 rgba(24,14,38,.4), inset 0 1px 0 #fff;
}

.form-line { padding-left: 45px; margin-top: 0; }
.form-chip {
  display: inline-block;
  font-family: var(--num);
  font-weight: 600;
  font-size: 8px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink);
  background: linear-gradient(180deg, #ffe9a0, var(--gold));
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 1px 8px 2px;
  box-shadow: 0 2px 0 rgba(24,14,38,.35), inset 0 1px 0 #fff;
}

.perk-rail {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  min-height: 23px;
  padding-left: 45px;
}

.perk-pin {
  position: relative;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: radial-gradient(circle at 32% 26%, #fff7df, var(--pin, var(--tin)) 68%);
  box-shadow: 0 2px 0 rgba(24,14,38,.4), inset 0 1px 0 #fff;
  display: grid;
  place-items: center;
}
.perk-pin svg { width: 14px; height: 14px; color: var(--ink); }
.perk-pin-art {
  width: 16px;
  height: 16px;
  object-fit: cover;
  border-radius: 50%;
  display: block;
  pointer-events: none;
}
.perk-pin b {
  position: absolute;
  right: -4px;
  bottom: -4px;
  font-family: var(--num);
  font-size: 9px;
  line-height: 1;
  color: var(--cream);
  background: var(--ink);
  border-radius: 6px;
  padding: 1px 3px;
}

.hud-right { grid-area: right; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex: 0 0 auto; }
.hud-right-stack { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; min-width: 0; }

.clock-badge {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  border: 3px solid var(--ink);
  background: linear-gradient(145deg, #fff8e6, #efd8a9);
  box-shadow: 0 4px 0 rgba(24,14,38,.42), inset 0 0 0 3px rgba(255,255,255,.65);
  display: grid;
  place-items: center;
}
.clock-rim {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  border: 2px dashed rgba(87,70,108,.45);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: radial-gradient(circle at 50% 38%, #fffdf4, #f2dfb4);
}
.clock-label {
  font-family: var(--num);
  font-size: 7px;
  letter-spacing: .18em;
  color: var(--ink-soft);
  margin-left: .18em;
}
.clock-time {
  font-family: var(--num);
  font-weight: 600;
  font-size: 21px;
  line-height: 1;
  letter-spacing: .02em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.kill-plate {
  display: flex;
  align-items: center;
  gap: 5px;
  background: linear-gradient(180deg, #fff6df, #ecd4a4);
  border: 2.5px solid var(--ink);
  border-radius: 9px;
  padding: 4px 9px 5px;
  box-shadow: 0 3px 0 rgba(24,14,38,.4), inset 0 1px 0 #fff;
  color: var(--ink);
}
.kill-paw { width: 16px; height: 16px; color: var(--ginger-deep); }
.kill-count { font-family: var(--num); font-weight: 600; font-size: 18px; line-height: 1; font-variant-numeric: tabular-nums; }
.kill-label { font-family: var(--num); font-size: 7px; letter-spacing: .14em; color: var(--ink-soft); }

.hud-menu-btn {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 44px;
  min-height: 44px;
  padding: 6px 12px 7px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: linear-gradient(180deg, #fff6dc 0%, #ffe1a8 42%, #f4bb58 100%);
  color: var(--ink);
  font-family: var(--display);
  font-weight: 800;
  font-size: 12px;
  letter-spacing: .06em;
  cursor: pointer;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.85), 0 4px 0 var(--ink), 0 7px 12px rgba(24,14,38,.3);
  transition: transform .12s ease, filter .2s ease;
  touch-action: manipulation;
}
.hud-menu-btn svg { width: 18px; height: 18px; flex: 0 0 auto; }
.hud-menu-btn:hover { filter: brightness(1.07); }
.hud-menu-btn:active { transform: translateY(3px); box-shadow: inset 0 2px 0 rgba(255,255,255,.7), 0 1px 0 var(--ink); }
.hud-menu-btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

.hint-strip {
  position: absolute;
  left: 50%;
  bottom: calc(var(--safe-b) + 52px);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px 6px;
  background: rgba(255, 243, 214, 0.86);
  border: 2px solid rgba(42, 31, 58, 0.8);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-soft);
  white-space: nowrap;
  opacity: 1;
  transition: opacity .6s ease;
  box-shadow: 0 2px 8px rgba(24,14,38,.25);
}
.hint-strip.dim { opacity: 0; }
.hint-key {
  font-family: var(--num);
  font-size: 9px;
  letter-spacing: .08em;
  background: var(--ink);
  color: var(--cream);
  padding: 1px 5px 2px;
  border-radius: 4px;
}
.hint-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--ink-soft); opacity: .5; }

.xp-wrap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0 calc(12px + var(--safe-r)) calc(9px + var(--safe-b)) calc(12px + var(--safe-l));
}

.xp-ribbon {
  position: relative;
  height: 30px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: linear-gradient(180deg, #f9edd0, #e6cfa2);
  overflow: visible;
  box-shadow: 0 4px 0 rgba(24,14,38,.42), inset 0 2px 0 #fff;
}
.xp-ribbon::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 999px;
  border: 1.5px dashed rgba(111, 86, 49, 0.45);
  pointer-events: none;
  z-index: 4;
}
.xp-fill {
  position: absolute;
  inset: 4px auto 4px 4px;
  width: 0%;
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.6) 0 32%, transparent 33%),
    linear-gradient(90deg, #ffd873, var(--gold) 55%, #eaa22d);
  box-shadow: inset 0 -4px 0 rgba(160, 96, 18, 0.28);
  transition: width 0.22s cubic-bezier(.3,1.4,.5,1);
  z-index: 2;
}
.xp-stitch {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: repeating-linear-gradient(90deg, transparent 0 20px, rgba(42,31,58,.18) 20px 22px);
  opacity: .25;
  z-index: 3;
  pointer-events: none;
}
.xp-emblem {
  position: absolute;
  left: 0%;
  top: 50%;
  width: 32px;
  height: 32px;
  transform: translate(-50%, -50%);
  z-index: 6;
  filter: drop-shadow(0 2px 2px rgba(24,14,38,.4));
  transition: left .22s cubic-bezier(.3,1.4,.5,1);
}
.xp-emblem svg { width: 100%; height: 100%; }
.xp-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--num);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: .12em;
  color: var(--ink);
  z-index: 5;
  text-shadow: 0 1px 0 rgba(255,255,255,.5);
  font-variant-numeric: tabular-nums;
}

.touch-ui { display: none; }
body.touch .touch-ui { display: block; }

.stick-hint {
  position: absolute;
  left: calc(22px + var(--safe-l));
  bottom: calc(var(--safe-b) + 54px);
  width: 94px;
  height: 94px;
  border: 2.5px dashed rgba(255, 243, 214, 0.6);
  border-radius: 50%;
  display: grid;
  place-items: center;
  pointer-events: none;
}
.stick-hint span {
  font-family: var(--num);
  font-size: 8px;
  letter-spacing: .18em;
  color: rgba(255, 243, 214, 0.72);
}
body.touch .hint-strip { display: none; }

.dash-btn {
  position: absolute;
  right: calc(20px + var(--safe-r));
  bottom: calc(var(--safe-b) + 52px);
  width: 82px;
  height: 82px;
  border-radius: 50%;
  border: 3px solid var(--ink);
  background:
    radial-gradient(circle at 36% 28%, #fff7e4, #ffd979 48%, #f2a63c 100%);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  box-shadow: 0 5px 0 var(--ink), 0 8px 16px rgba(24,14,38,.35), inset 0 2px 0 rgba(255,255,255,.75);
  pointer-events: auto;
  touch-action: none;
  font-family: var(--display);
  font-weight: 800;
  font-size: 10px;
  letter-spacing: .08em;
}
.dash-btn svg { width: 32px; height: 32px; }
.dash-btn:active { transform: translateY(3px) scale(.97); box-shadow: 0 2px 0 var(--ink); }
.dash-btn.cool { filter: grayscale(.55) brightness(.86); }
.dash-btn.cool::after {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: conic-gradient(rgba(42,31,58,.35) var(--cool, 0%), transparent 0);
}

/* floating touch stick */

.stick-live {
  position: fixed;
  z-index: 14;
  width: 112px;
  height: 112px;
  margin: -56px 0 0 -56px;
  border-radius: 50%;
  border: 3px solid rgba(255, 243, 214, 0.78);
  background: radial-gradient(circle, rgba(42, 31, 58, 0.22), rgba(42, 31, 58, 0.05) 70%);
  pointer-events: none;
  display: none;
  box-shadow: inset 0 0 24px rgba(42,31,58,.2);
}
.stick-live.on { display: block; }
.stick-live .knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 52px;
  height: 52px;
  margin: -26px 0 0 -26px;
  border-radius: 50%;
  border: 3px solid var(--ink);
  background: radial-gradient(circle at 35% 28%, #fff8e6, #ffd979 55%, #f0a63c);
  box-shadow: 0 3px 0 rgba(24,14,38,.35), inset 0 2px 0 #fff;
}

/* ---------- screens ---------- */

.screen {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
}

.title-screen {
  z-index: 22;
  display: flex;
  align-items: stretch;
  justify-content: flex-start;
  padding: calc(var(--safe-t) + 14px) 18px calc(var(--safe-b) + 14px);
  background:
    linear-gradient(180deg, rgba(32, 24, 56, 0.10) 0%, transparent 34%, rgba(42, 26, 66, 0.52) 100%);
  overflow: hidden;
}
.title-sky {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 55% 34% at 72% 8%, rgba(255, 143, 188, 0.5), transparent 68%),
    linear-gradient(180deg, rgba(58, 166, 160, 0.16), transparent 40%);
  mix-blend-mode: screen;
}
.title-inner {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  gap: 8px;
  min-height: 0;
}

.wordmark-wrap { position: relative; text-align: center; margin-top: 2vh; }
.wordmark-3d-wrap {
  position: relative;
  width: min(93vw, 1060px);
  aspect-ratio: 5.4 / 1;
  margin: 0 auto;
  filter: drop-shadow(0 7px 0 rgba(42, 31, 58, 0.30)) drop-shadow(0 16px 18px rgba(42, 31, 58, 0.34));
}
.wordmark-3d-wrap::before {
  content: "";
  position: absolute;
  inset: -22% -6% -30%;
  background: radial-gradient(ellipse at 50% 48%, rgba(255, 244, 214, 0.58), rgba(255, 226, 178, 0.24) 42%, transparent 72%);
  pointer-events: none;
  z-index: 0;
}
.wordmark-3d {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  z-index: 2;
}
.wordmark-3d-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}
.wordmark-3d-fallback img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.wordmark-3d-fallback.is-live { display: none; }

.wordmark {
  position: relative;
  display: inline-block;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(52px, 12.4vw, 168px);
  line-height: .86;
  letter-spacing: .035em;
  color: var(--cream);
  -webkit-text-stroke: clamp(5px, 1.15vw, 13px) var(--ink);
  paint-order: stroke fill;
  text-shadow:
    0 clamp(5px, .9vw, 10px) 0 var(--ginger-deep),
    0 clamp(9px, 1.6vw, 19px) 0 var(--ink),
    clamp(5px, .9vw, 12px) clamp(12px, 2.2vw, 26px) 0 rgba(201, 61, 141, 0.52);
  transform: rotate(-1.2deg);
}

.wordmark-tail {
  position: absolute;
  right: clamp(-58px, -4vw, -22px);
  bottom: clamp(-30px, -2.4vw, -10px);
  width: clamp(46px, 7vw, 110px);
  height: auto;
  transform: rotate(8deg);
}

.wordmark-paw {
  position: absolute;
  left: 57.4%;
  top: 11%;
  width: clamp(17px, 3.2vw, 42px);
  height: clamp(17px, 3.2vw, 42px);
  transform: rotate(-9deg);
  transform-origin: center;
  filter: drop-shadow(0 2px 0 rgba(42,31,58,.25));
}

.tagline {
  margin: 14px 0 0;
  font-family: var(--body);
  font-weight: 700;
  font-size: clamp(12px, 2.1vw, 20px);
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--cream);
  text-shadow: 0 2px 0 var(--ink), 0 0 18px rgba(42,31,58,.6);
}

.title-bottom {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(18px, 4vw, 58px);
  width: 100%;
  margin-top: auto;
  padding: 0 4px;
}

.medallion {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  transform: rotate(-2deg);
}
.medallion-rim {
  width: clamp(112px, 15vw, 178px);
  height: clamp(112px, 15vw, 178px);
  border-radius: 50%;
  border: 4px solid var(--ink);
  background: linear-gradient(160deg, #fff4d8, #d9a94e);
  padding: 7px;
  box-shadow: 0 8px 0 rgba(24,14,38,.42), 0 14px 26px rgba(24,14,38,.28), inset 0 2px 0 #fff;
}
.medallion-face {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--ink);
  background: #8fce9f;
}
.medallion-face svg { width: 100%; height: 100%; display: block; }
.medallion-face .pet-art[hidden] { display: none; }
.pet-switch { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 2px; }
.pet-tab {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--num);
  font-weight: 600;
  font-size: 9px;
  letter-spacing: .14em;
  color: var(--ink);
  cursor: pointer;
  padding: 3px 10px 4px 4px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: linear-gradient(180deg, #fff6df, #e6cfa2);
  box-shadow: 0 2px 0 rgba(24,14,38,.35), inset 0 1px 0 #fff;
}
.tab-face {
  display: block;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  overflow: hidden;
  border: 1.5px solid var(--ink);
  background: #f4e8cf;
  flex: 0 0 auto;
}
.tab-face svg { display: block; width: 100%; height: 100%; }
.pet-tab.on {
  background: linear-gradient(180deg, #ffe9a0, var(--gold));
  box-shadow: inset 0 0 0 2px #fff6d8, 0 2px 0 rgba(24,14,38,.4);
}
.pet-tab:active { transform: translateY(1px); }
.medallion-plate {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  font-family: var(--display);
  font-size: 13px;
  letter-spacing: .08em;
  color: var(--ink);
  background: linear-gradient(180deg, #fff6df, #ecd4a4);
  border: 2.5px solid var(--ink);
  border-radius: 8px;
  padding: 3px 12px 4px;
  box-shadow: 0 3px 0 rgba(24,14,38,.4);
}
.medallion-plate small {
  font-family: var(--num);
  font-size: 7px;
  letter-spacing: .16em;
  color: var(--ink-soft);
}
.evolve-line {
  font-family: var(--num);
  font-size: 7px;
  letter-spacing: .05em;
  color: var(--cream);
  text-shadow: 0 1px 0 var(--ink);
  opacity: .9;
  white-space: nowrap;
}
.signature-skills {
  display: flex;
  gap: 5px;
  align-items: center;
  justify-content: center;
}
.signature-skills img {
  width: 30px;
  height: 30px;
  object-fit: contain;
  border-radius: 50%;
  border: 1.5px solid var(--ink);
  background: linear-gradient(160deg, #fff4dd, #e6c98f);
  padding: 2px;
  filter: drop-shadow(0 1px 1px rgba(30, 18, 10, 0.35));
}
@media (max-width: 520px) {
  .signature-skills img { width: 26px; height: 26px; }
}
@media (max-height: 560px) and (orientation: landscape) {
  .evolve-line { display: none; }
  .signature-skills { display: none; }
}

.title-buttons {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: min(640px, calc(100% - 190px));
  flex: 0 0 auto;
  min-width: 0;
  padding-bottom: 6px;
}
.title-main-row {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  min-width: 0;
  max-width: 100%;
}
.title-main-row .badge-big {
  padding-left: clamp(14px, 2vw, 30px);
  padding-right: clamp(14px, 2vw, 30px);
  white-space: nowrap;
}
.badge-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

.best-line {
  font-family: var(--num);
  font-size: 11px;
  letter-spacing: .1em;
  color: var(--cream);
  text-shadow: 0 1px 0 var(--ink);
  opacity: .92;
  text-align: center;
}

.title-credit {
  font-family: var(--num);
  font-size: 9px;
  letter-spacing: .22em;
  color: rgba(255, 243, 214, 0.72);
  text-shadow: 0 1px 0 var(--ink);
  margin-top: 4px;
  padding-bottom: 2px;
}

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

.modal-screen {
  z-index: 42;
  background: rgba(28, 16, 48, 0.62);
  backdrop-filter: blur(4px) saturate(.9);
  padding: max(16px, var(--safe-t)) 14px max(16px, var(--safe-b));
}

.panel {
  position: relative;
  width: min(560px, 100%);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: clamp(18px, 3.2vw, 30px);
  border: 4px solid var(--ink);
  border-radius: 20px;
  background:
    radial-gradient(circle at 18% 12%, rgba(255,255,255,.55), transparent 42%),
    repeating-linear-gradient(0deg, rgba(120, 88, 48, 0.06) 0 2px, transparent 2px 6px),
    linear-gradient(160deg, #fff2d4, var(--parchment) 52%, #edcf9a);
  box-shadow:
    0 10px 0 var(--ink),
    0 26px 60px rgba(10, 4, 20, 0.5),
    inset 0 0 0 5px rgba(255, 255, 255, 0.38),
    inset 0 0 0 8px rgba(201, 106, 36, 0.16);
  animation: panelIn .3s cubic-bezier(.2, 1.35, .4, 1);
}
.panel::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1.5px dashed rgba(111, 86, 49, 0.4);
  border-radius: 13px;
  pointer-events: none;
}
@keyframes panelIn {
  from { transform: translateY(26px) scale(.94); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.panel-rivets { position: absolute; inset: 10px; pointer-events: none; z-index: 2; }
.panel-rivets i {
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: radial-gradient(circle at 34% 30%, #fff7e0, #b98b45);
}
.panel-rivets i:nth-child(1) { left: 1px; top: 1px; }
.panel-rivets i:nth-child(2) { right: 1px; top: 1px; }
.panel-rivets i:nth-child(3) { left: 1px; bottom: 1px; }
.panel-rivets i:nth-child(4) { right: 1px; bottom: 1px; }

.panel-title {
  position: relative;
  margin: 0 0 4px;
  text-align: center;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(30px, 6vw, 48px);
  letter-spacing: .04em;
  color: var(--ink);
  text-shadow: 0 2px 0 rgba(255,255,255,.5), 0 4px 0 rgba(201,106,36,.25);
}
.panel-sub {
  margin: 0 0 18px;
  text-align: center;
  font-size: 13px;
  color: var(--ink-soft);
}

.pause-panel, .settings-panel, .help-panel { display: flex; flex-direction: column; align-items: stretch; }
.pause-panel > .badge-btn, .settings-panel > .badge-btn, .help-panel > .badge-btn { align-self: center; }
.panel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 16px;
}
.panel-grid .badge-btn { width: 100%; }

.pause-stats {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1.5px dashed rgba(111,86,49,.4);
  text-align: center;
  font-family: var(--num);
  font-size: 11px;
  letter-spacing: .1em;
  color: var(--ink-soft);
}

/* ---------- game over ---------- */

.over-panel { text-align: center; }
.over-kicker {
  margin: 0 0 2px;
  font-family: var(--num);
  font-size: 10px;
  letter-spacing: .24em;
  color: var(--magenta);
}
.over-title { color: var(--ink); font-size: clamp(38px, 7vw, 60px); }
.over-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 18px 0 12px;
}
.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 9px 8px 10px;
  border: 2.5px solid var(--ink);
  border-radius: 12px;
  background: linear-gradient(180deg, #fff8e6, #efd9ac);
  box-shadow: 0 3px 0 rgba(24,14,38,.25), inset 0 1px 0 #fff;
}
.stat-label { font-family: var(--num); font-size: 9px; letter-spacing: .16em; color: var(--ink-soft); }
.stat-value { font-family: var(--num); font-weight: 600; font-size: clamp(24px, 5vw, 34px); line-height: 1.1; color: var(--ink); font-variant-numeric: tabular-nums; }
.over-best {
  font-family: var(--num);
  font-size: 11px;
  letter-spacing: .1em;
  color: var(--ink-soft);
  margin-bottom: 16px;
}
.over-panel .badge-big { width: 100%; margin-bottom: 10px; }
.over-panel .badge-small { align-self: center; }

/* ---------- help ---------- */

.help-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 18px 0;
}
.help-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  border: 2px solid rgba(42,31,58,.55);
  border-radius: 11px;
  background: rgba(255, 250, 234, 0.62);
}
.help-item b { font-family: var(--display); font-weight: 800; font-size: 15px; letter-spacing: .03em; }
.help-item span { font-size: 12px; line-height: 1.4; color: var(--ink-soft); }

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

.setting-group { margin: 16px 0; }
.setting-label { font-family: var(--num); font-size: 10px; letter-spacing: .18em; color: var(--ink-soft); margin-bottom: 7px; }
.seg {
  display: flex;
  gap: 0;
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  overflow: hidden;
  background: #e9d3a6;
}
.seg button {
  flex: 1;
  border: 0;
  border-right: 2px solid rgba(42,31,58,.4);
  padding: 10px 8px 11px;
  background: transparent;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(10px, 2.3vw, 13px);
  letter-spacing: .04em;
  color: var(--ink-soft);
  cursor: pointer;
}
.seg button:last-child { border-right: 0; }
.seg button.on {
  background: linear-gradient(180deg, #ffe9a0, var(--gold));
  color: var(--ink);
  box-shadow: inset 0 1px 0 #fff;
}
.setting-note { margin: 6px 0 0; font-size: 11px; color: var(--ink-soft); }

/* ---------- cards ---------- */

.cards-screen {
  z-index: 44;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding: 0 10px calc(14px + var(--safe-b));
  background: rgba(36, 20, 60, 0.44);
  /* No backdrop blur here: blurring the cream cat into the violet wash
     turned her head and upper body into a white glow in portrait. The
     darkened, saturated world keeps her mask and eyes readable behind
     the cards instead. */
  backdrop-filter: saturate(.82);
  overflow: hidden;
}
.cards-wash {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 68%, rgba(111, 58, 150, 0.24), rgba(32, 16, 56, 0.62));
  pointer-events: none;
}
.cards-head {
  position: relative;
  z-index: 2;
  margin: auto 0 0;
  text-align: center;
  padding-top: 3vh;
}
.level-banner {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  font-family: var(--display);
  font-weight: 800;
  color: var(--cream);
  text-transform: uppercase;
  -webkit-text-stroke: 4px var(--ink);
  paint-order: stroke fill;
  text-shadow: 0 6px 0 var(--ink), 0 10px 0 rgba(201,61,141,.35);
  transform: rotate(-1.5deg);
}
.lb-small { font-size: clamp(18px, 4vw, 34px); letter-spacing: .1em; }
.lb-big { font-size: clamp(54px, 12vw, 110px); line-height: .8; }
.cards-sub {
  margin: 10px 0 0;
  font-size: clamp(11px, 2vw, 15px);
  font-weight: 700;
  letter-spacing: .03em;
  color: var(--cream);
  text-shadow: 0 2px 0 rgba(42,31,58,.9);
}

.card-row {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(6px, 1.8vw, 20px);
  width: 100%;
  max-width: 860px;
  padding: 7vh 0 2vh;
  perspective: 1000px;
}
.card-timer {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  justify-content: center;
}
.card-timer-track {
  width: min(280px, 46vw);
  height: 10px;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: rgba(42,31,58,.55);
  overflow: hidden;
}
.card-timer-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #f0b23c, #ffe9a0);
  transition: width .2s linear;
}
.card-timer.urgent .card-timer-fill { background: linear-gradient(90deg, #d23f4a, #ff8a7a); }
.card-timer-num {
  font-family: var(--num);
  font-size: 13px;
  font-weight: 800;
  color: var(--cream);
  text-shadow: 0 2px 0 var(--ink);
  min-width: 2ch;
  text-align: left;
}
.card-timer.urgent .card-timer-num { color: #ffb0a8; }

.card {
  --frame: var(--tin);
  --frame-hi: #eef1f6;
  --tilt: 0deg;
  position: relative;
  width: clamp(106px, 26vw, 218px);
  aspect-ratio: 0.62;
  flex: 0 0 auto;
  border: 3px solid var(--ink);
  border-radius: 15px;
  background:
    radial-gradient(circle at 50% 26%, rgba(255,255,255,.65), transparent 44%),
    repeating-linear-gradient(0deg, rgba(120, 88, 48, 0.055) 0 2px, transparent 2px 6px),
    linear-gradient(170deg, #fff4d9, #f2ddb2 58%, #e5c690);
  box-shadow:
    0 7px 0 var(--ink),
    0 16px 26px rgba(8, 3, 18, 0.5),
    inset 0 0 0 4px rgba(255,255,255,.35),
    0 0 0 4px var(--frame),
    0 0 0 6px rgba(42,31,58,.55);
  color: var(--ink);
  transform: rotate(var(--tilt));
  transform-origin: 50% 100%;
  padding: 8px 9px 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  animation: dealIn .38s cubic-bezier(.2, 1.5, .35, 1) both;
  transition: transform .2s cubic-bezier(.2,1.2,.4,1), box-shadow .2s, filter .2s;
  overflow: hidden;
}
.card::after {
  content: "";
  position: absolute;
  top: -40%;
  bottom: -40%;
  width: 34%;
  left: -60%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.75), transparent);
  transform: skewX(-16deg);
  opacity: 0;
  pointer-events: none;
}
.card:hover::after, .card:focus-visible::after { animation: foil .75s ease-out; opacity: 1; }
@keyframes foil {
  from { left: -60%; }
  to { left: 140%; }
}
.card:nth-child(1) { --tilt: -4.5deg; animation-delay: .03s; }
.card:nth-child(2) { --tilt: 0deg; animation-delay: .12s; }
.card:nth-child(3) { --tilt: 4.5deg; animation-delay: .21s; }
@keyframes dealIn {
  0% { transform: translateY(24%) rotate(var(--tilt)) scale(.94); opacity: 0; }
  70% { transform: translateY(-4%) rotate(calc(var(--tilt) * .3)) scale(1.01); opacity: 1; }
  100% { transform: translateY(0) rotate(var(--tilt)) scale(1); opacity: 1; }
}
.card:hover, .card:focus-visible {
  --tilt: 0deg;
  transform: translateY(-16px) rotate(0deg) scale(1.035);
  filter: brightness(1.05);
  box-shadow:
    0 9px 0 var(--ink),
    0 26px 40px rgba(8,3,18,.55),
    inset 0 0 0 4px rgba(255,255,255,.4),
    0 0 0 4px var(--frame),
    0 0 26px 3px color-mix(in srgb, var(--frame) 55%, transparent);
  z-index: 5;
}
.card:focus-visible { outline: 3px solid var(--gold); outline-offset: 6px; }

.card-nameplate {
  position: relative;
  margin: 1px 0 3px;
  padding: 6px 6px 5px;
  background: linear-gradient(180deg, #4a3667, #2a1f3a);
  color: var(--cream);
  border: 2px solid var(--ink);
  border-radius: 6px;
  clip-path: polygon(7% 0, 93% 0, 100% 50%, 93% 100%, 7% 100%, 0 50%);
  text-align: center;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(10px, 2.1vw, 17px);
  line-height: 1.02;
  letter-spacing: .02em;
  min-height: 2.2em;
  display: flex;
  align-items: center;
  justify-content: center;
  text-shadow: 0 1px 0 rgba(0,0,0,.5);
}

.card-icon {
  width: clamp(44px, 10vw, 78px);
  height: clamp(44px, 10vw, 78px);
  border-radius: 50%;
  align-self: center;
  margin: 2px 0 3px;
  display: grid;
  place-items: center;
  border: 2.5px solid var(--ink);
  background:
    radial-gradient(circle at 34% 27%, #fffdf2, var(--frame-hi) 36%, var(--frame) 100%);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.8), 0 3px 0 rgba(42,31,58,.3);
  position: relative;
}
.card-icon::after {
  content: "";
  position: absolute;
  left: 18%;
  top: 10%;
  width: 30%;
  height: 18%;
  border-radius: 50%;
  background: rgba(255,255,255,.7);
  filter: blur(.5px);
}
.card-icon svg { width: 62%; height: 62%; color: var(--ink); position: relative; z-index: 1; }
.card-art {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  position: relative;
  z-index: 1;
  pointer-events: none;
}
.card-icon.glow { box-shadow: inset 0 2px 0 rgba(255,255,255,.8), 0 3px 0 rgba(42,31,58,.3), 0 0 18px 2px color-mix(in srgb, var(--frame) 70%, transparent); }

.card-effect {
  font-size: clamp(10px, 1.8vw, 13px);
  line-height: 1.28;
  font-weight: 700;
  text-align: center;
  padding: 0 1px;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}
.card-synergy {
  font-size: clamp(8px, 1.5vw, 10.5px);
  line-height: 1.22;
  font-style: italic;
  text-align: center;
  color: var(--ink-soft);
  padding: 2px 1px 0;
  border-top: 1px dashed rgba(87,70,108,.35);
}
.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin-top: 2px;
}
.rarity-tag {
  font-family: var(--num);
  font-size: clamp(7px, 1.3vw, 9px);
  letter-spacing: .14em;
  color: var(--ink);
  background: var(--frame);
  border: 1.5px solid var(--ink);
  border-radius: 4px;
  padding: 2px 5px 3px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.6);
}
.card-pips { display: flex; gap: 3px; }
.card-pips i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  border: 1.5px solid var(--ink);
  background: transparent;
}
.card-pips i.on { background: var(--frame); }
.card-seal {
  position: absolute;
  right: 6px;
  bottom: 6px;
  width: 20px;
  height: 20px;
  opacity: .55;
  color: var(--ink);
}
.card-seal svg { width: 100%; height: 100%; }

.card.rarity-common { --frame: #b4bbc6; --frame-hi: #e7ebf1; }
.card.rarity-rare { --frame: #3aa6a0; --frame-hi: #a8e3da; }
.card.rarity-epic { --frame: #c93d8d; --frame-hi: #f2a8d0; }
.card.rarity-legendary {
  --frame: #f0b23c;
  --frame-hi: #ffe9a0;
  background:
    radial-gradient(circle at 50% 26%, rgba(255,255,255,.75), transparent 44%),
    repeating-linear-gradient(0deg, rgba(120, 88, 48, 0.05) 0 2px, transparent 2px 6px),
    linear-gradient(170deg, #fff6d8, #f7e1a8 58%, #e8c377);
}

.cards-foot {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 0 0 4px;
  flex-wrap: wrap;
}
.reroll-btn:disabled { opacity: .45; cursor: default; transform: none; }
.pick-hint {
  font-family: var(--num);
  font-size: 10px;
  letter-spacing: .12em;
  color: rgba(255,243,214,.82);
  text-shadow: 0 1px 0 var(--ink);
}

/* ---------- toast, loading ---------- */

.toast {
  position: absolute;
  left: 50%;
  top: auto;
  bottom: calc(var(--safe-b) + 58px);
  transform: translateX(-50%);
  z-index: 16;
  padding: 7px 14px 8px;
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  background: linear-gradient(180deg, #fff4d7, #f0d39c);
  font-family: var(--display);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: .08em;
  color: var(--ink);
  box-shadow: 0 4px 0 rgba(24,14,38,.4), 0 0 22px rgba(255, 201, 77, .35);
  animation: toastIn .3s cubic-bezier(.2,1.5,.4,1);
  pointer-events: none;
  white-space: nowrap;
  max-width: calc(100vw - 24px);
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (max-width: 760px) {
  .toast {
    bottom: calc(var(--safe-b) + 54px);
    font-size: 11px;
    padding: 6px 10px 7px;
  }
}
@keyframes toastIn {
  from { transform: translate(-50%, -10px) scale(.9); opacity: 0; }
  to { transform: translate(-50%, 0) scale(1); opacity: 1; }
}

.loading {
  position: absolute;
  inset: 0;
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: radial-gradient(ellipse at 50% 40%, #3f2a63, #1b1229 70%);
  color: var(--cream);
  font-family: var(--num);
  font-size: 11px;
  letter-spacing: .22em;
  transition: opacity .5s ease;
}
.loading.done { opacity: 0; pointer-events: none; }
.loading-badge {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 3px solid var(--cream);
  display: grid;
  place-items: center;
  animation: spinPaw 2.6s ease-in-out infinite;
}
.loading-badge svg { width: 32px; height: 32px; }
.loading-title {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(13px, 3.2vw, 19px);
  letter-spacing: .16em;
  color: var(--cream);
  text-shadow: 0 2px 0 var(--ink);
}
.loading-track {
  width: min(280px, 72vw);
  height: 20px;
  padding: 3px;
  border: 3px solid var(--cream);
  border-radius: 999px;
  background: rgba(27, 18, 41, 0.72);
  box-shadow: inset 0 3px 0 rgba(0, 0, 0, 0.32), 0 3px 0 rgba(0, 0, 0, 0.3);
  overflow: hidden;
}
.loading-fill {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--ginger), var(--gold) 46%, var(--gold-bright) 72%, var(--ginger));
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.85);
  transition: width 0.18s ease-out;
}
.loading-pct {
  font-family: var(--num);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: .12em;
  color: var(--cream);
  font-variant-numeric: tabular-nums;
}
.loading-pct b { font-weight: 600; }
#title button:disabled { cursor: progress; }
@keyframes spinPaw {
  0%, 100% { transform: rotate(-8deg) scale(1); }
  50% { transform: rotate(8deg) scale(1.08); }
}

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

@media (max-width: 760px) {
  #hud { padding: calc(var(--safe-t) + 8px) calc(9px + var(--safe-r)) 0 calc(9px + var(--safe-l)); }
  .paw-emblem { width: 32px; height: 32px; }
  .paw-emblem svg { width: 20px; height: 20px; }
  .health-pill { height: 33px; width: clamp(130px, 40vw, 250px); }
  .health-label { font-size: 11px; }
  .level-chip { font-size: 10px; padding: 4px 6px 5px; }
  .form-line { padding-left: 39px; }
  .perk-rail { padding-left: 39px; gap: 4px; }
  .perk-pin { width: 21px; height: 21px; }
  .perk-pin svg { width: 12px; height: 12px; }
  .clock-badge { width: 68px; height: 68px; }
  .clock-rim { width: 54px; height: 54px; }
  .clock-time { font-size: 17px; }
  .clock-label { font-size: 6px; }
  .kill-plate { padding: 3px 7px 4px; }
  .kill-count { font-size: 15px; }
  .kill-paw { width: 13px; height: 13px; }
  .hud-menu-btn { min-height: 40px; padding: 4px 10px 5px; font-size: 11px; }

  .title-bottom { flex-direction: column; align-items: center; justify-content: center; gap: 10px; }
  .medallion { transform: rotate(-1.4deg); }
  .medallion-rim { width: 84px; height: 84px; padding: 5px; }
  .medallion-plate { font-size: 9px; padding: 2px 7px 3px; }
  .pet-tab { font-size: 8px; padding: 2px 7px 3px 3px; gap: 4px; }
  .tab-face { width: 17px; height: 17px; }
  .title-buttons { gap: 8px; width: 100%; flex: 0 0 auto; min-width: 0; }
  .title-main-row { gap: 8px; }
  .title-main-row .badge-big {
    font-size: clamp(16px, 4.5vw, 22px);
    padding-left: 10px;
    padding-right: 10px;
  }
  .badge-big { align-self: stretch; padding-left: 20px; padding-right: 20px; }
  .badge-row { gap: 5px; }
  .badge-small { padding: 7px 8px 8px; font-size: 9px; }
  .wordmark-paw { left: 57%; top: 13%; }
  .wordmark-tail { right: -30px; bottom: -14px; width: 60px; }
  .title-inner { gap: 6px; }
  .wordmark-wrap { margin-top: 1vh; }
  .tagline { margin-top: 10px; }

  .card-row { padding-top: 8vh; gap: 7px; }
  .card { padding: 6px 6px 8px; border-radius: 12px; }
  .card-nameplate { clip-path: none; border-radius: 5px; padding: 4px 4px 5px; }
  .card-seal { width: 15px; height: 15px; right: 4px; bottom: 4px; }
  .card-effect { font-size: 9.5px; }
  .card-synergy { font-size: 8px; }
  .cards-sub { max-width: 300px; }
  .cards-head { padding-top: 2vh; }

  .help-grid { grid-template-columns: 1fr; gap: 7px; }
  .help-item { padding: 8px 10px; }
  .panel-grid { grid-template-columns: 1fr; }
  .over-stats { gap: 6px; }
}

@media (max-width: 400px) {
  .pet-tab { padding: 2px; border-radius: 50%; }
  .pet-tab .tab-label { display: none; }
  .tab-face { width: 22px; height: 22px; }
  .health-pill { width: 43vw; }
  .level-chip { display: none; }
  .clock-badge { width: 60px; height: 60px; }
  .clock-rim { width: 48px; height: 48px; }
  .clock-time { font-size: 15px; }
  .kill-label { font-size: 6px; letter-spacing: .1em; }
  .wordmark { font-size: clamp(46px, 15vw, 70px); }
  .wordmark-3d-wrap { width: 95vw; }
  .title-credit { font-size: 8px; }
  .card { width: 29vw; }
}

@media (max-height: 560px) and (orientation: landscape) {
  .title-screen { padding-top: 8px; padding-bottom: 8px; }
  .wordmark-wrap { margin-top: 0; }
  .wordmark { font-size: clamp(40px, 8vw, 82px); }
  .wordmark-3d-wrap { width: min(80vw, 780px); }
  .tagline { margin-top: 6px; font-size: 11px; }
  .title-bottom { flex-direction: row; align-items: center; }
  .medallion-rim { width: 84px; height: 84px; }
  .medallion-plate { font-size: 10px; }
  .pet-switch { max-width: 260px; }
  .pet-tab { font-size: 8px; padding: 2px 7px 3px; }
  .title-buttons { gap: 7px; width: min(640px, calc(100% - 300px)); flex: 0 0 auto; }
  .badge-big { font-size: 20px; padding: 8px 36px 10px; }
  .badge-small { font-size: 9px; padding: 6px 10px 7px; }
  .title-credit { display: none; }
  .card-row { padding-top: 5vh; padding-bottom: 1vh; }
  .card { width: clamp(100px, 19vw, 168px); }
  .cards-head { padding-top: 1vh; }
  .cards-sub { display: none; }
  .help-grid { grid-template-columns: 1fr 1fr; }
  .panel { padding: 16px; }
}

@media (max-height: 560px) and (orientation: landscape) and (max-width: 700px) {
  .pet-switch { max-width: 190px; gap: 4px; }
  .pet-tab { padding: 2px; }
  .pet-tab .tab-label { display: none; }
  .tab-face { width: 20px; height: 20px; }
  .title-buttons { width: 300px; }
  .title-main-row { flex-direction: row; gap: 6px; }
}

@media (max-height: 560px) and (orientation: landscape) and (max-width: 520px) {
  .pet-switch { max-width: 160px; }
  .title-buttons { width: 170px; }
  .title-main-row { flex-direction: column; gap: 6px; }
  .title-main-row .badge-big { font-size: 16px; padding: 5px 10px 7px; }
}

/* Short landscape has nine pet tabs now. Icons only keep them inside one
   or two rows instead of running off the bottom of the screen. */
@media (max-height: 560px) and (orientation: landscape) {
  .pet-switch { max-width: 220px; gap: 4px; }
  .pet-tab { padding: 2px; border-radius: 50%; }
  .pet-tab .tab-label { display: none; }
  .pet-tab .tab-lock { display: none; }
  .tab-face { width: 20px; height: 20px; }
}

@media (min-width: 1024px) and (min-height: 700px) {
  .title-inner { max-width: 1260px; }
}

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

/* ---------- boss health ---------- */

.boss-bar {
  position: static;
  width: min(540px, 100%);
  max-width: 100%;
  min-width: 0;
  pointer-events: none;
  filter: drop-shadow(0 4px 10px rgba(24, 14, 38, 0.35));
}
.boss-plate {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  margin-bottom: 4px;
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--cream);
  text-shadow: 0 2px 0 var(--ink), 0 0 10px rgba(42, 31, 58, 0.85);
}
.boss-kicker {
  font-family: var(--num);
  font-size: 9px;
  letter-spacing: 0.24em;
  color: #ffd35c;
  text-shadow: 0 2px 0 var(--ink);
}
#boss-name {
  font-size: clamp(13px, 2.6vw, 19px);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.boss-track {
  height: 15px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: linear-gradient(180deg, #2b1f3d, #1c1229);
  overflow: hidden;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.14), 0 3px 0 rgba(24, 14, 38, 0.4);
}
.boss-fill {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.36) 0 36%, transparent 37%),
    linear-gradient(90deg, #ff8a2b, #e35476 58%, #a92f69);
  box-shadow: inset 0 -4px 0 rgba(90, 20, 40, 0.3);
  transition: width 0.16s linear;
}

/* ---------- unlock hints ---------- */

.unlocks-panel { display: flex; flex-direction: column; max-width: 700px; }
.unlock-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 6px 0 12px;
  padding-right: 4px;
  max-height: 54vh;
  overflow: auto;
}
.unlock-row {
  display: grid;
  grid-template-columns: 128px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px 11px;
  border: 2px solid rgba(42, 31, 58, 0.38);
  border-radius: 10px;
  background: rgba(255, 250, 234, 0.66);
}
.unlock-row.legendary {
  background: linear-gradient(90deg, rgba(255, 233, 160, 0.55), rgba(255, 250, 234, 0.7));
  border-color: rgba(168, 110, 20, 0.55);
}
.unlock-name {
  font-family: var(--num);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--ink);
}
.unlock-cond { font-size: 12px; line-height: 1.35; color: var(--ink-soft); }
.unlock-role {
  font-family: var(--num);
  font-size: 8px;
  letter-spacing: 0.14em;
  text-align: right;
  color: var(--ginger-deep, #c96a24);
  white-space: nowrap;
}
.unlock-note {
  margin: 0 0 14px;
  padding-top: 10px;
  border-top: 1.5px dashed rgba(111, 86, 49, 0.4);
  text-align: center;
  font-size: 11px;
  line-height: 1.4;
  color: var(--ink-soft);
}
.unlocks-panel > .badge-btn { align-self: center; margin: 4px 0 8px; }

@media (max-width: 560px) {
  .unlock-row { grid-template-columns: 1fr auto; }
  .unlock-cond { grid-column: 1 / -1; }
}

/* ---------- shield chip ---------- */

.form-line { display: flex; align-items: center; gap: 6px; }
.shield-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--num);
  font-weight: 600;
  font-size: 8px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink);
  background: linear-gradient(180deg, #d8f8ff, #7fd8ff);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 1px 8px 2px;
  box-shadow: 0 2px 0 rgba(24,14,38,.35), inset 0 1px 0 #fff;
}
.shield-chip small { font-size: 7px; letter-spacing: .12em; color: var(--ink); }
.shield-chip.cool {
  background: linear-gradient(180deg, #f2e6c8, #d9c69a);
  color: var(--ink-soft);
}
.shield-chip.cool small { color: var(--ink-soft); }

/* ---------- equipment ---------- */

.gear-panel { display: flex; flex-direction: column; max-width: 780px; height: min(92dvh, 760px); overflow: hidden; }
.gear-panel > .badge-btn { align-self: center; margin: 8px 0 4px; }
.gear-slots {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 4px 0 14px;
  flex: 0 0 auto;
}
.gear-slot {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-height: 116px;
  padding: 9px 10px 10px;
  border: 2.5px solid var(--ink);
  border-radius: 12px;
  background: linear-gradient(180deg, #fff8e6, #efd9ac);
  box-shadow: 0 3px 0 rgba(24,14,38,.25), inset 0 1px 0 #fff;
}
.gear-slot.empty { opacity: .72; border-style: dashed; }
.gear-slot.rarity-rare { box-shadow: inset 0 0 0 2px rgba(77,170,160,.35); }
.gear-slot.rarity-epic { box-shadow: inset 0 0 0 2px rgba(201,61,141,.3); }
.gear-slot.rarity-legendary { box-shadow: inset 0 0 0 2px rgba(245,185,63,.55); }
.gear-slot-head {
  font-family: var(--num);
  font-size: 8px;
  letter-spacing: .18em;
  color: var(--ink-soft);
}
.gear-slot-body { display: flex; align-items: center; gap: 6px; }
.gear-slot-name {
  font-family: var(--display);
  font-size: 12px;
  line-height: 1.05;
  color: var(--ink);
}
.gear-slot-desc { font-size: 10px; line-height: 1.3; color: var(--ink-soft); }
.gear-slot-empty { color: var(--ink-soft); font-size: 11px; margin: auto 0; }
.gear-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: radial-gradient(circle at 34% 27%, #fffdf2, #f0d7a6);
  color: var(--ginger-deep);
}
.gear-icon svg { width: 18px; height: 18px; }
.gear-mini {
  margin-top: auto;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: #fff6df;
  font-family: var(--num);
  font-size: 8px;
  letter-spacing: .12em;
  padding: 3px 8px 4px;
  cursor: pointer;
  color: var(--ink);
}
.gear-mini:hover { background: var(--gold); }
.gear-bag-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--num);
  font-size: 9px;
  letter-spacing: .16em;
  color: var(--ink-soft);
  border-top: 1.5px dashed rgba(111,86,49,.4);
  padding-top: 10px;
}
.gear-bag-head small { font-size: 9px; letter-spacing: .1em; }
.gear-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 8px 0 10px;
  flex: 1 1 auto;
  min-height: 180px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-right: 3px;
}
.gear-row {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  border: 2px solid rgba(42,31,58,.38);
  border-radius: 10px;
  background: rgba(255,250,234,.72);
}
.gear-row.rarity-rare { border-color: rgba(77,170,160,.6); }
.gear-row.rarity-epic { border-color: rgba(201,61,141,.55); }
.gear-row.rarity-legendary { border-color: rgba(201,140,30,.7); background: linear-gradient(90deg, rgba(255,233,160,.55), rgba(255,250,234,.72)); }
.gear-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.gear-info b { font-family: var(--display); font-size: 13px; letter-spacing: .02em; color: var(--ink); }
.gear-rarity { font-family: var(--num); font-size: 8px; letter-spacing: .14em; color: var(--ginger-deep); }
.gear-desc { font-size: 10.5px; line-height: 1.35; color: var(--ink-soft); }
.gear-equip { padding: 5px 10px 6px; font-size: 9px; }
.gear-empty { text-align: center; color: var(--ink-soft); font-size: 12px; margin: 10px 0; }

@media (max-width: 560px) {
  .gear-slots { grid-template-columns: 1fr; gap: 6px; }
  .gear-slot { min-height: 0; }
  .gear-panel { height: min(94dvh, 780px); }
  .gear-list { min-height: 220px; flex: 1 1 auto; }
  .gear-row { grid-template-columns: 26px 1fr auto; }
  .gear-icon { width: 26px; height: 26px; }
  .gear-icon svg { width: 16px; height: 16px; }
  .pet-switch { flex-wrap: wrap; justify-content: center; max-width: 190px; }
}

/* ---------- locked pets ---------- */

.pet-tab.locked {
  filter: grayscale(.72) brightness(.82);
  opacity: .82;
}
.pet-tab.locked .tab-lock {
  font-family: var(--num);
  font-size: 7px;
  letter-spacing: .1em;
  padding: 1px 4px 2px;
  border-radius: 999px;
  background: rgba(24,14,38,.72);
  color: var(--cream);
}
.pet-tab .tab-lock:empty { display: none; }

/* ---------- leaderboards ---------- */

.leaderboard-panel {
  display: flex;
  flex-direction: column;
  max-width: 680px;
  gap: 8px;
}
.leader-board { display: flex; flex-direction: column; gap: 5px; }
.leader-title {
  margin: 4px 0 0;
  font-family: var(--display);
  font-size: 14px;
  letter-spacing: .06em;
  color: var(--ink);
}
.leader-title span {
  font-family: var(--num);
  font-size: 8px;
  letter-spacing: .16em;
  color: var(--ginger-deep, #c96a24);
  margin-left: 6px;
}
.leader-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 26vh;
  overflow: auto;
  padding-right: 3px;
}
.leader-row {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border: 2px solid rgba(42,31,58,.32);
  border-radius: 9px;
  background: rgba(255,250,234,.7);
}
.leader-row.mine {
  border-color: rgba(201,140,30,.7);
  background: linear-gradient(90deg, rgba(255,233,160,.55), rgba(255,250,234,.75));
}
.leader-rank {
  font-family: var(--num);
  font-size: 11px;
  letter-spacing: .06em;
  color: var(--ginger-deep, #c96a24);
}
.leader-who {
  font-family: var(--num);
  font-size: 12px;
  color: var(--ink);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
a.leader-who { text-decoration: underline; text-decoration-color: rgba(42,31,58,.35); }
.leader-who-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
}
.leader-who-wrap .leader-who { min-width: 0; flex: 0 1 auto; }
.leader-pet {
  flex: 0 0 auto;
  font-family: var(--num);
  font-size: 8px;
  letter-spacing: .08em;
  padding: 1px 5px;
  border: 1.5px solid rgba(42,31,58,.38);
  border-radius: 999px;
  background: rgba(255,233,160,.75);
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.leader-value {
  font-family: var(--display);
  font-size: 15px;
  color: var(--ink);
}
.leader-empty {
  margin: 2px 0 6px;
  font-size: 11px;
  color: var(--ink-soft);
}
.leaderboard-panel > .badge-btn { align-self: center; margin: 6px 0 6px; }

@media (max-width: 560px) {
  .leader-list { max-height: 22vh; }
  .leader-row { grid-template-columns: 32px 1fr auto; padding: 4px 8px; }
  .leader-value { font-size: 13px; }
}

/* ---------- grand unlock ---------- */

.grand {
  position: absolute;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 18px;
  background: radial-gradient(ellipse at 50% 45%, rgba(255,201,77,.28), rgba(27,18,41,.78) 68%);
  animation: grandFade .45s ease;
  cursor: pointer;
}
.grand.hidden { display: none; }
.grand.out { animation: grandOut .55s ease forwards; }
.grand-rays {
  position: absolute;
  width: min(78vw, 520px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgba(255,233,160,.34) 0 10deg, transparent 10deg 24deg);
  animation: grandSpin 14s linear infinite;
  filter: blur(1px);
  pointer-events: none;
}
.grand-card {
  position: relative;
  text-align: center;
  padding: 22px 26px 24px;
  border: 3px solid var(--ink);
  border-radius: 16px;
  background: linear-gradient(180deg, #fff6df, #f0d39c);
  box-shadow: 0 10px 0 rgba(24,14,38,.42), 0 0 60px rgba(255,201,77,.55), inset 0 2px 0 #fff;
  animation: grandPop .5s cubic-bezier(.2,1.6,.4,1);
  max-width: 460px;
}
.grand-kicker {
  margin: 0 0 6px;
  font-family: var(--num);
  font-size: 9px;
  letter-spacing: .22em;
  color: var(--ginger-deep, #c96a24);
}
.grand-name {
  margin: 0 0 8px;
  font-family: var(--display);
  font-size: clamp(22px, 6vw, 34px);
  letter-spacing: .04em;
  color: var(--ink);
  text-shadow: 0 2px 0 #fff, 0 4px 0 rgba(201,140,30,.4);
}
.grand-text {
  margin: 0 0 8px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--ink-soft);
}
.grand-hint {
  margin: 0;
  font-family: var(--num);
  font-size: 9px;
  letter-spacing: .12em;
  color: var(--ginger-deep, #c96a24);
}
@keyframes grandFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes grandOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes grandPop { from { transform: scale(.72) rotate(-3deg); } to { transform: scale(1) rotate(0); } }
@keyframes grandSpin { from { transform: rotate(0); } to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------ */
/* 2-player co-op test                                                 */
/* ------------------------------------------------------------------ */
.coop-panel {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(27, 18, 41, 0.58);
  backdrop-filter: blur(3px);
}
.coop-card {
  width: min(520px, 94vw);
  max-height: 88vh;
  overflow-y: auto;
  background: linear-gradient(180deg, #fff6df, #efd7a8);
  border: 3px solid var(--ink);
  border-radius: 16px;
  box-shadow: 0 8px 0 rgba(24, 14, 38, 0.45), 0 26px 60px rgba(24, 14, 38, 0.4);
  padding: 18px 20px 16px;
  color: var(--ink);
  text-align: center;
}
.coop-kicker {
  margin: 0 0 2px;
  font-family: var(--num);
  font-size: 10px;
  letter-spacing: .2em;
  color: var(--teal-deep);
}
.coop-card h2 {
  margin: 0 0 8px;
  font-family: var(--display);
  font-size: clamp(20px, 4.2vw, 28px);
  letter-spacing: .04em;
}
.coop-status {
  margin: 0 0 12px;
  font-family: var(--body);
  font-weight: 700;
  font-size: 13px;
  line-height: 1.35;
}
.coop-link-row {
  display: flex;
  gap: 7px;
  margin: 0 0 12px;
}
.coop-link-row input {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--num);
  font-size: 12px;
  color: var(--ink);
  background: #fffaf0;
  border: 2px solid var(--ink);
  border-radius: 8px;
  padding: 7px 9px;
}
.coop-help {
  margin: 0 0 14px;
  font-family: var(--body);
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink-soft);
  text-align: left;
}
.coop-help b { color: var(--ink); }
.coop-mode {
  display: flex;
  gap: 0;
  margin: 0 auto 12px;
  width: min(100%, 360px);
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  overflow: hidden;
  background: #fffaf0;
}
.coop-mode-btn {
  flex: 1 1 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--num);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  padding: 9px 8px 10px;
  cursor: pointer;
}
.coop-mode-btn + .coop-mode-btn { border-left: 2.5px solid var(--ink); }
.coop-mode-btn.on {
  background: linear-gradient(180deg, #ffe8b0, #f4bb58);
  color: var(--ink);
}
.coop-mode-btn:focus-visible { outline: 3px solid var(--gold); outline-offset: -4px; }
.coop-start-btn {
  background: linear-gradient(180deg, #e7fbf7 0%, #b8eadf 46%, #86d2c2 100%);
}
.coop-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}
.coop-chip {
  position: static;
  z-index: 24;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px 9px;
  padding: 4px 12px 5px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: linear-gradient(180deg, #fff6df, #ecd4a4);
  box-shadow: 0 3px 0 rgba(24,14,38,.35);
  font-family: var(--num);
  font-size: 10px;
  letter-spacing: .08em;
  color: var(--ink);
  pointer-events: none;
  max-width: 100%;
  white-space: normal;
  text-align: center;
  line-height: 1.25;
}
.coop-chip b { font-size: 10px; letter-spacing: .14em; color: var(--teal-deep); }
.coop-chip.down { background: linear-gradient(180deg, #ffd9d4, #ef9b8f); }
.coop-chip.down b { color: #8a2419; }
.coop-banner {
  position: fixed;
  left: 50%;
  bottom: calc(64px + var(--safe-b));
  transform: translateX(-50%);
  z-index: 24;
  padding: 7px 16px 8px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: rgba(27, 18, 41, 0.82);
  color: var(--cream);
  font-family: var(--num);
  font-size: 11px;
  letter-spacing: .16em;
  pointer-events: none;
  animation: coop-pulse 1.6s ease-in-out infinite;
}
@keyframes coop-pulse {
  0%, 100% { opacity: .72; }
  50% { opacity: 1; }
}
@media (max-width: 420px) {
  .coop-card { padding: 14px 14px 12px; }
  .coop-help { font-size: 11px; }
  .coop-chip { font-size: 9px; gap: 4px 6px; padding: 4px 9px 5px; }
}

/* ---------- landscape: one top strip, nothing across the pet ---------- */

@media (orientation: landscape) {
  .hud-top {
    grid-template-columns: minmax(0, 1fr) minmax(0, auto) auto;
    grid-template-areas: "left center right";
  }
  .hud-center {
    justify-self: center;
    width: clamp(180px, 34vw, 540px);
    margin-top: 0;
  }
  /* Clock, kills and the menu live in a short row so the right cluster ends
     well above the pet and leaves the revive button its own space. */
  .hud-right { flex-direction: row; align-items: flex-start; gap: 6px; }
  .hud-right-stack { gap: 4px; }
  .hud-menu-btn span { display: none; }
  .hud-menu-btn {
    width: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    justify-content: center;
  }
}

.revive-btn {
  position: absolute;
  right: calc(24px + var(--safe-r));
  bottom: calc(var(--safe-b) + 148px);
  width: 70px;
  height: 70px;
  border-radius: 50%;
  border: 3px solid var(--ink);
  background: radial-gradient(circle at 36% 28%, #fff7e4, #ffd979 48%, #f2a63c 100%);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  box-shadow: 0 5px 0 var(--ink), 0 8px 16px rgba(24,14,38,.35), inset 0 2px 0 rgba(255,255,255,.75);
  pointer-events: auto;
  touch-action: none;
  font-family: var(--display);
  font-weight: 800;
  font-size: 9px;
  letter-spacing: .08em;
  z-index: 3;
  animation: coop-pulse 1.3s ease-in-out infinite;
}
.revive-btn svg { width: 28px; height: 28px; }
.revive-btn:active { transform: translateY(3px) scale(.97); box-shadow: 0 2px 0 var(--ink); }

/* ---------- portrait phones: every panel scrolls, nothing gets clipped ---------- */

@media (orientation: portrait) and (max-width: 1024px) {
  /* The panels own the scrolling, so a short phone can reach the last gear
     row, the BACK button and the bottom of the title screen. The game canvas
     stays fixed behind them. */
  html, body { touch-action: auto; }
  /* Follow the visible viewport, not the taller layout viewport that sits
     behind a phone's address bar, so the bottom controls never end up under
     the browser chrome. */
  #app { height: 100dvh; }
  .title-screen,
  .modal-screen {
    align-items: flex-start;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
  }
  .title-screen {
    padding-bottom: calc(var(--safe-b) + 24px);
  }
  .title-inner { margin-block: auto; gap: 10px; }
  /* Portrait is one column at every width a phone can report, including the
     wide layout viewport some in-app browsers hand us (around 980px). The
     old two-column title-bottom pushed CO-OP and the badge row off the right
     edge there, which is how those buttons went missing. */
  .title-bottom {
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 14px;
    margin-top: 2vh;
  }
  .medallion { transform: rotate(-1.4deg); }
  .title-buttons {
    width: 100%;
    max-width: 640px;
    flex: 0 0 auto;
    min-width: 0;
  }
  .title-main-row {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }
  .title-main-row .badge-big {
    font-size: clamp(16px, 3.6vw, 26px);
  }
  .badge-row {
    width: 100%;
    justify-content: center;
  }
  /* A skill or wave notice must not sit on top of EX ATTACK or REVIVE while
     the player is reaching for them. */
  .toast {
    bottom: calc(var(--safe-b) + 150px);
    max-width: calc(100vw - 190px);
    white-space: normal;
    text-align: center;
    border-radius: 14px;
    font-size: 10px;
    line-height: 1.25;
  }
  .modal-screen {
    padding-bottom: calc(20px + var(--safe-b));
  }
  .modal-screen .panel {
    max-height: none;
    height: auto;
    overflow: visible;
    margin-block: auto;
  }
  .gear-panel {
    height: auto;
    max-height: none;
    overflow: visible;
  }
  .gear-list {
    flex: 0 0 auto;
    min-height: 0;
    max-height: none;
    overflow: visible;
  }
  .coop-panel {
    align-items: flex-start;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
    padding-bottom: calc(20px + var(--safe-b));
  }
  .coop-card {
    max-height: none;
    margin-block: auto;
  }
}

@media (orientation: portrait) and (max-width: 400px) {
  .coop-banner {
    bottom: calc(var(--safe-b) + 188px);
    max-width: calc(100vw - 28px);
    text-align: center;
  }
}

/* ---------- co-op pet pick for the joining player ---------- */

.coop-pick {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 2px;
}
.coop-pick-title {
  margin: 0;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(18px, 4vw, 24px);
  letter-spacing: .05em;
  color: var(--ink);
}
.coop-pick-note {
  margin: 0;
  font-family: var(--body);
  font-weight: 700;
  font-size: 12px;
  line-height: 1.4;
  color: var(--ink-soft);
}
.coop-pick-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin: 2px 0 4px;
}
.coop-pick-row .pet-tab { min-height: 30px; }

@media (max-width: 400px) {
  /* The picker has room for names even when the title switch does not. */
  .coop-pick-row .pet-tab .tab-label { display: inline; }
  .coop-pick-row .pet-tab { padding: 3px 8px 4px 4px; border-radius: 999px; }
  .coop-pick-row .tab-face { width: 22px; height: 22px; }
  .coop-pick-row .pet-tab.on { box-shadow: inset 0 0 0 2px #fff6d8, 0 0 0 2px var(--gold), 0 2px 0 rgba(24,14,38,.4); }
}
