@font-face {
  font-family: 'Baloo 2';
  src: url('../fonts/wXK0E3kTposypRydzVT08TS3JnAmtdiayqpv.woff2') format('woff2');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Nunito';
  src: url('../fonts/XRXI3I6Li01BKofiOc5wtlZ2di8HDLshRTM.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Nunito';
  src: url('../fonts/XRXI3I6Li01BKofiOc5wtlZ2di8HDFwmRTM.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Oswald';
  src: url('../fonts/TK3_WkUHHAIjg75cFRf3bXL8LICs18NvgUE.woff2') format('woff2');
  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, 172, 176, 0.10), transparent 68%),
    linear-gradient(180deg, rgba(255, 226, 220, 0.03), transparent 24%);
  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, 150, 178, 0.24), 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: center;
  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-fullname {
  margin: 7px auto 0;
  max-width: min(94vw, 980px);
  font-family: var(--body);
  font-weight: 800;
  font-size: clamp(9px, 1.5vw, 14px);
  line-height: 1.3;
  letter-spacing: .055em;
  text-transform: none;
  color: #ffe9a0;
  text-shadow: 0 2px 0 var(--ink), 0 0 16px rgba(42,31,58,.65);
}

.title-bottom {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(14px, 2.4vw, 34px);
  width: 100%;
  margin-top: clamp(8px, 2vh, 22px);
  padding: 0 4px;
  flex-wrap: wrap;
}

.medallion {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  max-width: 100%;
  transform: rotate(-2deg);
}
.medallion-rim {
  position: relative;
  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 16px 28px rgba(24,14,38,.22), inset 0 2px 0 #fff;
}
.medallion.is-empty .medallion-rim {
  animation: medallionWaiting 2.4s ease-in-out infinite;
}
@keyframes medallionWaiting {
  0%, 100% { box-shadow: 0 8px 0 rgba(24,14,38,.42), 0 14px 26px rgba(24,14,38,.16), 0 0 0 0 rgba(255,201,58,0), inset 0 2px 0 #fff; }
  50% { box-shadow: 0 8px 0 rgba(24,14,38,.42), 0 18px 32px rgba(24,14,38,.22), 0 0 0 7px rgba(255,201,58,.42), 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 img { width: 100%; height: 100%; display: block; object-fit: cover; }
.medallion-face .pet-art[hidden] { display: none; }
.medallion-empty {
  position: absolute;
  inset: 8%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 3px dashed rgba(42,31,58,.5);
  background: radial-gradient(circle at 35% 28%, #fff6df, #e8d3a0 68%, #cfae6d);
  color: #2a1f3a;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(34px, 5vw, 68px);
  line-height: 1;
  text-shadow: 0 3px 0 rgba(255,255,255,.55);
}
.medallion-empty.hidden { display: none; }
.pet-switch { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 2px; max-width: min(92vw, 520px); }
.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%; }
.tab-face img { display: block; width: 100%; height: 100%; object-fit: cover; }
.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);
  backdrop-filter: blur(2px) saturate(.86);
  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: 0 0 auto;
  text-align: center;
  padding-top: calc(var(--safe-t) + 10px);
}

.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 .22s cubic-bezier(.2, 1.2, .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: -2deg; animation-delay: 0s; }
.card:nth-child(2) { --tilt: 0deg; animation-delay: 0s; }
.card:nth-child(3) { --tilt: 2deg; animation-delay: 0s; }
@keyframes dealIn {
  /* The three choices are readable from the first frame. The old opacity
     fade and stagger left a card translucent over its neighbour. */
  0% { transform: translateY(12%) rotate(var(--tilt)) scale(.975); 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; }
/* A failed boot keeps the same overlay but says what happened and offers a
   way back. Without this the two lines fell into the letter-spaced flex row
   and the reload control sat off the edge of a phone. */
.loading > span { max-width: min(320px, 80vw); text-align: center; line-height: 1.5; }
.loading > .loading-detail {
  max-width: min(320px, 80vw);
  font-family: var(--body);
  font-size: 10px;
  letter-spacing: .02em;
  color: rgba(255, 243, 214, .7);
  word-break: break-word;
}
.loading > .badge-btn { margin-top: 6px; letter-spacing: .14em; }
.loading-badge {
  position: relative;
  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::after {
  content: "";
  position: absolute;
  inset: -9px;
  border-radius: 50%;
  border: 2px solid rgba(255, 243, 214, .42);
  animation: loadingPulse 1.8s ease-out infinite;
  pointer-events: none;
}
.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 {
  position: relative;
  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-track::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: linear-gradient(100deg, transparent 22%, rgba(255, 255, 255, .34) 48%, transparent 76%);
  background-size: 210% 100%;
  animation: loadingSheen 1.7s linear infinite;
  pointer-events: none;
}
.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; }
.loading-note {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 1.2em;
  padding: 0 22px;
  font-family: var(--num);
  font-size: 10px;
  letter-spacing: .18em;
  line-height: 1.3;
  text-align: center;
  text-transform: uppercase;
  color: var(--cream);
  opacity: .9;
}
.loading-note i {
  grid-area: 1 / 1;
  font-style: normal;
  opacity: 0;
  animation: loadingNote 9s ease-in-out infinite;
}
.loading-note i:nth-child(2) { animation-delay: 3s; }
.loading-note i:nth-child(3) { animation-delay: 6s; }
.loading-note.ready { display: none; }
#title button:disabled { cursor: progress; }
#title.is-loading { visibility: hidden; }
@keyframes spinPaw {
  0%, 100% { transform: rotate(-8deg) scale(1); }
  50% { transform: rotate(8deg) scale(1.08); }
}
@keyframes loadingPulse {
  0% { transform: scale(.82); opacity: .65; }
  100% { transform: scale(1.22); opacity: 0; }
}
@keyframes loadingSheen {
  from { background-position: 150% 0; }
  to { background-position: -60% 0; }
}
@keyframes loadingNote {
  0%, 3% { opacity: 0; transform: translateY(3px); }
  8%, 30% { opacity: 1; transform: translateY(0); }
  35%, 100% { opacity: 0; transform: translateY(-3px); }
}
@media (prefers-reduced-motion: reduce) {
  .loading-badge, .loading-badge::after, .loading-track::after, .loading-note i { animation: none; }
  .loading-note i { opacity: 0; }
  .loading-note i:first-child { opacity: 1; }
}

/* ---------- 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-fullname { margin-top: 5px; font-size: 9px; letter-spacing: .06em; }
  .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 twelve pet tabs now. Put the large face and the tab
   grid side by side and keep the whole picker above the bottom edge. */
@media (max-height: 850px) and (orientation: landscape) {
  .title-screen {
    padding-top: 4px;
    padding-bottom: 4px;
    overflow-y: auto;
  }
  .wordmark-wrap { margin-top: 0; width: min(64vw, 620px); }
  .wordmark-3d-wrap { width: 100%; }
  .title-fullname { display: block; margin-top: 4px; font-size: clamp(9px, 1.5vw, 13px); letter-spacing: .045em; }
  .title-bottom {
    margin-top: 0;
    align-items: center;
    justify-content: center;
    gap: 10px;
  }
  .medallion {
    display: grid;
    grid-template-columns: 88px 220px;
    grid-template-areas:
      "rim switch"
      "plate switch";
    align-items: center;
    column-gap: 6px;
    row-gap: 2px;
    transform: none;
    filter: none;
  }
  .pet-empty { display: none; }
  .medallion-rim {
    grid-area: rim;
    width: 84px;
    height: 84px;
    padding: 4px;
    border-width: 3px;
  }
  .pet-empty {
    grid-area: head;
    margin: 0;
    padding: 2px 6px;
    border-width: 1.5px;
  }
  .pet-empty-title { font-size: 9px; }
  .pet-empty-sub { font-size: 6px; }
  .arcade-pet-head { display: none; }
  .pet-switch {
    grid-area: switch;
    max-width: 220px;
    gap: 4px;
    padding: 4px;
    align-self: start;
  }
  .pet-required { top: 50%; font-size: 9px; padding: 3px 7px 4px; white-space: nowrap; }
  .evolve-line, .signature-skills { display: none; }
  .medallion-plate {
    grid-area: plate;
    padding: 2px 6px;
    font-size: 10px;
  }
  .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; }
  .title-buttons { width: clamp(300px, 46vw, 520px); max-width: 100%; padding-bottom: 0; }
  .title-main-row { gap: 6px; }
  .badge-row { gap: 4px; }
}

@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: flex;
  align-items: flex-start;
  justify-content: center;
  padding: clamp(62px, 11vh, 110px) 12px 12px;
  background: transparent;
  animation: grandFade .45s ease;
  pointer-events: none;
}
.grand.hidden { display: none; }
.grand.out { animation: grandOut .26s ease forwards; }
.grand-rays { display: none; }
.grand-card {
  position: relative;
  text-align: center;
  padding: 12px 16px 12px;
  border: 3px solid var(--ink);
  border-radius: 16px;
  background: linear-gradient(180deg, #fff6df, #f0d39c);
  box-shadow: 0 6px 0 rgba(24,14,38,.38), 0 0 34px rgba(255,201,77,.45), inset 0 2px 0 #fff;
  animation: grandPop .5s cubic-bezier(.2,1.6,.4,1);
  max-width: min(400px, 92vw);
  pointer-events: auto;
  cursor: pointer;
}
.grand-kicker {
  margin: 0 0 4px;
  font-family: var(--num);
  font-size: 8px;
  letter-spacing: .22em;
  color: var(--ginger-deep, #c96a24);
}
.grand-name {
  margin: 0 0 5px;
  font-family: var(--display);
  font-size: clamp(16px, 4.4vw, 24px);
  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 5px;
  font-size: 11px;
  line-height: 1.35;
  color: var(--ink-soft);
}
.grand-hint {
  margin: 0 0 7px;
  font-family: var(--num);
  font-size: 8px;
  letter-spacing: .12em;
  color: var(--ginger-deep, #c96a24);
}
.grand-close {
  position: relative;
  z-index: 1;
  min-height: 34px;
  padding: 4px 16px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: #ffd35c;
  color: var(--ink);
  font-family: var(--num);
  font-size: 10px;
  letter-spacing: .12em;
  box-shadow: 0 3px 0 rgba(24,14,38,.35), inset 0 2px 0 rgba(255,255,255,.6);
  cursor: pointer;
}
.grand-close:active { transform: translateY(2px); box-shadow: inset 0 2px 0 rgba(255,255,255,.6); }
@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-room-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 8px;
  padding: 7px 9px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: #fffaf0;
}
.coop-room-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}
.coop-room-label {
  font-family: var(--num);
  font-size: 9px;
  letter-spacing: .16em;
  color: var(--ink-soft);
}
.coop-room-code {
  font-family: var(--num);
  font-weight: 700;
  font-size: clamp(20px, 5vw, 28px);
  letter-spacing: .18em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.coop-join-row {
  display: flex;
  gap: 7px;
  margin: 0 0 10px;
}
.coop-join-row input {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--num);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: .16em;
  text-align: center;
  color: var(--ink);
  background: #fffaf0;
  border: 2px solid var(--ink);
  border-radius: 8px;
  padding: 7px 9px;
}
.coop-join-row .badge-btn {
  flex: 0 0 auto;
}
.coop-host-opts {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 0 10px;
  padding: 8px 9px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: rgba(255, 250, 240, 0.7);
}
.coop-opt-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.coop-opt-label {
  font-family: var(--num);
  font-size: 9px;
  letter-spacing: .14em;
  color: var(--ink-soft);
  white-space: nowrap;
}
.coop-seg {
  display: flex;
  border: 2px solid var(--ink);
  border-radius: 999px;
  overflow: hidden;
  background: #fffaf0;
}
.coop-seg button {
  border: 0;
  background: transparent;
  font-family: var(--num);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: .08em;
  color: var(--ink);
  padding: 4px 11px 5px;
  cursor: pointer;
}
.coop-seg button + button { border-left: 2px solid var(--ink); }
.coop-seg button.on { background: var(--gold); }
.coop-slot-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.coop-slot-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.coop-slot-row .coop-seg button { min-width: 56px; }
.coop-opt-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: 5px 8px;
}
.coop-queue {
  position: fixed;
  inset: 0;
  z-index: 96;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(27, 18, 41, 0.62);
  backdrop-filter: blur(3px);
}
.coop-queue-card { width: min(560px, 94vw); }
.coop-queue-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 0 0 12px;
  max-height: 52vh;
  overflow-y: auto;
  text-align: left;
}
.coop-queue-empty {
  margin: 8px 0;
  font-family: var(--body);
  font-weight: 700;
  font-size: 12px;
  color: var(--ink-soft);
  text-align: center;
}
.coop-queue-row {
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: #fffaf0;
  padding: 7px 9px 8px;
}
.coop-queue-head {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}
.coop-queue-head b {
  font-family: var(--num);
  font-size: 14px;
  letter-spacing: .1em;
  color: var(--ink);
}
.coop-queue-count {
  font-family: var(--num);
  font-size: 10px;
  letter-spacing: .08em;
  color: var(--teal-deep);
}
.coop-queue-flag {
  font-family: var(--num);
  font-size: 8px;
  letter-spacing: .12em;
  padding: 2px 6px 3px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  color: var(--ink);
  background: #dff3df;
}
.coop-queue-flag.private { background: #ffd9d4; }
.coop-queue-ai {
  font-family: var(--num);
  font-size: 11px;
  line-height: 1;
  color: var(--ink-soft);
  opacity: .8;
  margin-left: -2px;
}
.coop-queue-host {
  margin: 2px 0 0;
  font-family: var(--num);
  font-size: 10px;
  letter-spacing: .08em;
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.coop-queue-host b {
  color: var(--teal-deep);
  font-weight: 700;
}
.coop-countdown {
  position: fixed;
  inset: 0;
  z-index: 98;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  pointer-events: auto;
  background: radial-gradient(circle at 50% 48%, rgba(27, 18, 41, .72) 0%, rgba(27, 18, 41, .56) 30%, rgba(27, 18, 41, .22) 62%, rgba(27, 18, 41, 0) 84%);
  text-align: center;
  user-select: none;
}
.coop-white {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity .58s ease;
}
.coop-white.on { opacity: 1; }
.coop-countdown-num, #coop-countdown-num {
  display: block;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(88px, 26vmin, 240px);
  line-height: .86;
  color: var(--gold-bright);
  -webkit-text-stroke: 3px var(--ink);
  text-shadow: 0 9px 0 rgba(24, 14, 38, .5);
}
.coop-countdown-cap {
  font-family: var(--num);
  font-size: clamp(12px, 2.4vmin, 18px);
  letter-spacing: .34em;
  color: #fff6df;
  text-shadow: 0 2px 0 var(--ink);
}
.coop-countdown.tick #coop-countdown-num {
  animation: coopCountPulse .92s ease-out;
}
@keyframes coopCountPulse {
  0% { transform: scale(1.3); opacity: .15; }
  55% { transform: scale(.98); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
.coop-queue-waiting {
  margin: 4px 0 6px;
  font-family: var(--body);
  font-weight: 700;
  font-size: 11px;
  line-height: 1.4;
  color: var(--ink-soft);
}
.coop-queue-joinrow {
  display: flex;
  gap: 6px;
}
.coop-queue-joinrow button {
  flex: 0 0 auto;
  margin-left: auto;
}
.coop-queue-joinrow input {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--num);
  font-size: 12px;
  color: var(--ink);
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 8px;
  padding: 5px 8px;
}
.over-coop-note {
  margin: 0 0 12px;
  padding: 7px 9px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: rgba(255, 250, 240, 0.74);
  font-family: var(--num);
  font-size: 10px;
  line-height: 1.45;
  letter-spacing: .06em;
  color: var(--ink-soft);
}
.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-start-btn.host-only-off,
.coop-start-btn:disabled {
  opacity: .42;
  filter: grayscale(.6);
  cursor: not-allowed;
  transform: none;
}
.coop-start-btn.host-only-off:hover,
.coop-start-btn:disabled:hover {
  transform: none;
}
.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-team {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  pointer-events: none;
  max-width: 100%;
}
.coop-team-row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 3px 9px 4px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: linear-gradient(180deg, #fff6df, #ecd4a4);
  box-shadow: 0 2px 0 rgba(24,14,38,.35);
  font-family: var(--num);
  font-size: 9px;
  letter-spacing: .06em;
  color: var(--ink);
  white-space: nowrap;
  max-width: 100%;
}
.coop-team-row b {
  color: var(--teal-deep);
  max-width: 116px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.coop-team-tier {
  color: #a86b00;
  font-size: 8px;
  letter-spacing: .04em;
  max-width: 78px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.coop-team-hp { color: var(--ink-soft); }
.coop-team-rev { color: var(--magenta); }
.coop-team-row.down { background: linear-gradient(180deg, #ffd9d4, #ef9b8f); }
.coop-team-row.down b { color: #8a2419; }

/* Portrait: the teammate strip belongs at the top, beside the clock-map.
   The centre row sat under the tall right column, which put it just above
   the middle of the screen. */
@media (orientation: portrait) {
  #coop-team,
  #coop-chip {
    position: absolute;
    top: calc(var(--safe-t) + 104px);
    right: calc(var(--safe-r) + 118px);
    align-items: flex-end;
    max-width: calc(100% - 142px);
  }
  .coop-team-row { max-width: 100%; }
}
.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 ---------- */

/* A portrait tablet has one more row of title furniture than a phone. The
   default title is a little taller than 4:3, so the last badge row fell
   below the fold. Tighten the wordmark and the gaps just enough that the
   title and every button group sit together in the middle of the screen. */
@media (orientation: portrait) and (min-width: 600px) {
  /* The wordmark is wider than its wrapper; without this the canvas overflows
     to the right and the title reads off-centre on a portrait tablet. */
  .wordmark-wrap { width: min(76vw, 760px); margin-top: 0; }
  .wordmark-3d-wrap { width: 100%; max-width: none; }
  .tagline { margin-top: 8px; }
  .title-inner { gap: 6px; }
  .title-bottom { gap: 8px; margin-top: 1vh; }
  .badge-row { gap: 4px; }
}

@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); }
}

/* ---------- arcade pet select ---------- */

.medallion {
  position: relative;
  filter: drop-shadow(0 0 16px rgba(255, 201, 77, .28));
}
.pet-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  margin: 2px 0 3px;
  padding: 4px 12px 5px;
  border: 2px dashed rgba(255, 201, 77, .7);
  border-radius: 8px;
  background: rgba(24, 14, 38, .78);
  color: var(--cream);
  text-align: center;
}
.pet-empty.hidden { display: none; }
.pet-empty-title {
  font-family: var(--display);
  font-size: 11px;
  letter-spacing: .12em;
  color: var(--gold);
  text-shadow: 0 0 9px rgba(255, 201, 77, .8);
}
.pet-empty-sub {
  font-family: var(--num);
  font-size: 7px;
  letter-spacing: .18em;
  opacity: .85;
}
.arcade-pet-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  margin: 3px 0 2px;
  padding: 3px 14px 4px;
  border: 2px solid var(--ink);
  border-radius: 7px;
  background:
    repeating-linear-gradient(180deg, rgba(255,255,255,.08) 0 2px, rgba(0,0,0,.16) 2px 4px),
    linear-gradient(180deg, #3a2457, #1b1229 70%);
  box-shadow: inset 0 0 0 2px rgba(255, 201, 77, .65), 0 3px 0 rgba(24,14,38,.55), 0 0 18px rgba(255, 201, 77, .3);
}
.arcade-pet-kicker {
  font-family: var(--num);
  font-size: 7px;
  letter-spacing: .3em;
  color: #8ff5ff;
  text-shadow: 0 0 8px rgba(143, 245, 255, .8);
}
.arcade-pet-title {
  font-family: var(--display);
  font-size: 11px;
  letter-spacing: .09em;
  color: var(--gold);
  text-shadow: 0 2px 0 rgba(24,14,38,.85), 0 0 10px rgba(255, 201, 77, .65);
}
.pet-switch {
  gap: 5px;
  padding: 6px;
  border: 2.5px solid var(--ink);
  border-radius: 12px;
  background:
    repeating-linear-gradient(180deg, rgba(255,255,255,.05) 0 3px, rgba(0,0,0,.18) 3px 6px),
    linear-gradient(180deg, #2e1c49, #171021 75%);
  box-shadow: inset 0 0 0 2px rgba(255, 201, 77, .55), 0 4px 0 rgba(24,14,38,.55), 0 0 22px rgba(255, 201, 77, .22);
}
.pet-tab {
  color: var(--cream);
  background: linear-gradient(180deg, #4b3268, #271838);
  border-color: #120b1c;
  box-shadow: 0 2px 0 rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.25);
}
.pet-tab:hover { box-shadow: 0 2px 0 rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.4); }
.pet-tab.on {
  color: var(--ink);
  background: linear-gradient(180deg, #fff3b8, var(--gold) 72%);
  box-shadow: inset 0 0 0 2px #fff6d8, 0 0 0 2px var(--ink), 0 0 18px rgba(255, 201, 77, .9);
}
.pet-tab.on .tab-label { color: var(--ink); }
.pet-tab .tab-face {
  width: 26px;
  height: 26px;
  border-color: #120b1c;
  box-shadow: 0 0 0 1px rgba(255,255,255,.3), inset 0 0 5px rgba(0,0,0,.4);
}
.shake { animation: petShake .38s ease; }
@keyframes petShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}
.pet-required {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 60;
  translate: -50% -50%;
  margin: 0;
  padding: 4px 12px 5px;
  pointer-events: none;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: #ffd35c;
  color: #3a1f14;
  font-family: var(--display);
  font-size: 12px;
  letter-spacing: .07em;
  text-align: center;
  white-space: nowrap;
  box-shadow: 0 0 0 3px rgba(255, 211, 92, .25), 0 0 18px rgba(255, 140, 60, .55);
  animation: petShake .38s ease;
}
.pet-required.hidden { display: none; }

/* ---------- in-game pet confirmation ---------- */

.pet-confirm {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
  background:
    radial-gradient(ellipse at 50% 42%, rgba(63, 42, 99, .94), rgba(16, 10, 26, .97) 72%),
    repeating-linear-gradient(180deg, rgba(255,255,255,.045) 0 3px, rgba(0,0,0,.16) 3px 6px);
  backdrop-filter: blur(5px);
}
.pet-confirm.hidden { display: none; }
.pet-confirm-card {
  width: min(460px, 100%);
  max-height: 100%;
  overflow: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 12px 14px 14px;
  border: 3px solid var(--ink);
  border-radius: 16px;
  background:
    repeating-linear-gradient(180deg, rgba(255,255,255,.06) 0 3px, rgba(0,0,0,.16) 3px 6px),
    linear-gradient(180deg, #422b66, #1a1028 76%);
  box-shadow: inset 0 0 0 3px rgba(255, 201, 77, .65), 0 8px 0 rgba(0,0,0,.45), 0 0 40px rgba(255, 201, 77, .3);
}
.pet-confirm-marquee {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 4px 0 6px;
  border-bottom: 2px solid rgba(255, 201, 77, .35);
}
.pet-confirm-kicker {
  font-family: var(--num);
  font-size: 8px;
  letter-spacing: .3em;
  color: #8ff5ff;
  text-shadow: 0 0 9px rgba(143, 245, 255, .85);
}
#pet-confirm-title {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(18px, 5vw, 26px);
  letter-spacing: .06em;
  color: var(--gold);
  text-align: center;
  text-shadow: 0 2px 0 rgba(0,0,0,.8), 0 0 16px rgba(255, 201, 77, .65);
}
.pet-confirm-mode {
  margin: 0;
  font-family: var(--num);
  font-size: 9px;
  letter-spacing: .22em;
  color: var(--cream);
  opacity: .9;
}
.pet-confirm-stage {
  position: relative;
  width: min(320px, 76vw);
  aspect-ratio: 1 / 1;
  max-height: 43vh;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, rgba(255, 201, 77, .14), rgba(0,0,0,0) 68%);
}
.pet-confirm-stage canvas {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: block;
}
.pet-confirm-ring {
  position: absolute;
  left: 50%;
  bottom: 8%;
  width: 74%;
  height: 17%;
  transform: translateX(-50%);
  border: 2px solid rgba(255, 201, 77, .55);
  border-radius: 50%;
  box-shadow: 0 0 16px rgba(255, 201, 77, .45), inset 0 0 16px rgba(255, 201, 77, .25);
}
.pet-confirm-plate {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  min-width: 62%;
  padding: 4px 16px 5px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: linear-gradient(180deg, #fff6d8, var(--gold));
  color: var(--ink);
  box-shadow: 0 3px 0 rgba(0,0,0,.42);
}
.pet-confirm-plate strong {
  font-family: var(--display);
  font-size: 17px;
  letter-spacing: .06em;
}
.pet-confirm-plate small {
  font-family: var(--num);
  font-size: 8px;
  letter-spacing: .16em;
  color: #5a3c14;
}
.pet-confirm-note {
  margin: 0;
  max-width: 330px;
  text-align: center;
  font-family: var(--num);
  font-size: 10px;
  line-height: 1.35;
  letter-spacing: .04em;
  color: var(--cream);
  opacity: .92;
}
.pet-confirm-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
}
.pet-confirm-actions .badge-big { width: min(320px, 100%); }
@media (max-width: 760px) {
  .pet-tab { font-size: 8px; padding: 2px 7px 3px 3px; gap: 4px; }
  .pet-tab .tab-face { width: 22px; height: 22px; }
  .arcade-pet-title { font-size: 10px; }
  .pet-confirm-stage { width: min(290px, 82vw); }
  .pet-confirm-note { font-size: 9px; }
}
@media (max-height: 640px) {
  .pet-confirm-stage { width: min(240px, 65vw); max-height: 36vh; }
  .pet-confirm-card { gap: 5px; padding: 9px 12px 11px; }
  #pet-confirm-title { font-size: 18px; }
}

@media (max-height: 560px) and (orientation: landscape) {
  .arcade-pet-head { display: none; }
  .pet-empty { padding: 1px 8px 2px; }
  .pet-empty-title { font-size: 9px; }
  .pet-empty-sub { display: none; }
  .pet-switch { padding: 4px; }
}

/* Keep the compact landscape picker free of the two duplicate prompts that
   the base arcade rules draw later in this file. The plate under the rim
   already says what to do, and the extra boxes were widening the medallion
   and pushing SINGLE PLAY and CO-OP below the fold on 1024x576 and 844x390. */
@media (max-height: 850px) and (orientation: landscape) {
  .pet-empty { display: none; }
  .arcade-pet-head { display: none; }
}

@media (max-width: 520px) {
  .title-main-row { gap: 5px; }
  .title-main-row .badge-big {
    font-size: clamp(13px, 4vw, 18px);
    padding-left: 6px;
    padding-right: 6px;
    letter-spacing: .01em;
  }
}

/* Short landscape: keep the queue actions and the restart button on screen. */
@media (max-height: 520px) {
  .coop-queue-card { max-height: calc(100dvh - 16px); }
  .coop-queue-list { max-height: 38vh; }
  .coop-queue-card h2 { font-size: 20px; margin-bottom: 4px; }
  .coop-queue-card .coop-status { margin-bottom: 6px; }
  .over-panel { padding: 10px 16px 12px; }
  .over-kicker { display: none; }
  .over-title { font-size: 30px; }
  .over-stats {
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
    margin: 8px 0 6px;
  }
  .stat { padding: 4px 5px 5px; }
  .stat-label { font-size: 8px; }
  .stat-value { font-size: 18px; }
  .over-best { margin-bottom: 6px; font-size: 10px; }
  .over-coop-note { margin-bottom: 6px; font-size: 9px; padding: 4px 6px; }
  .over-panel .badge-big { font-size: 20px; padding: 6px 16px 8px; margin-bottom: 6px; }
  .over-panel .panel-grid { gap: 5px; }
  .over-panel .badge-small { padding: 5px 8px 6px; font-size: 9px; }
}

/* Short landscape: the team creator sees the slots and the room number
   together instead of scrolling past one to reach the other. */
@media (max-height: 520px) {
  .coop-card { max-height: calc(100dvh - 12px); padding: 10px 14px 12px; }
  .coop-card h2 { font-size: 20px; margin-bottom: 4px; }
  .coop-kicker { font-size: 9px; }
  #coop-lobby {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 7px 12px;
    align-items: start;
  }
  #coop-lobby > .coop-status,
  #coop-lobby > .coop-mode,
  #coop-lobby > .coop-actions { grid-column: 1 / -1; }
  #coop-host-opts { grid-column: 1; margin: 0; }
  #coop-room-row,
  #coop-join-row,
  #coop-link-row { grid-column: 2; margin: 0; }
  #coop-room-row { flex-direction: column; align-items: stretch; gap: 3px; }
  #coop-room-row .coop-room-meta { justify-content: space-between; }
  #coop-room-row .coop-room-code { font-size: 22px; letter-spacing: .1em; }
  #coop-room-row .badge-btn { padding: 4px 6px 5px; font-size: 9px; }
  #coop-lobby > .coop-help { display: none; }
  .coop-actions { gap: 6px; }
  .coop-opt-row, .coop-slot-row { gap: 6px; }
  .coop-host-opts { padding: 6px 7px; gap: 4px; }
  .coop-slot-list { gap: 3px; }
  .coop-seg button { padding: 3px 8px 4px; font-size: 10px; }
}

/* In-room heads-up on the title, and the leave-or-stay prompt. */
.coop-inroom {
  position: absolute;
  left: 10px;
  bottom: calc(var(--safe-b) + 82px);
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: stretch;
  max-width: 132px;
}
.coop-inroom button {
  pointer-events: auto;
  font-family: var(--num);
  font-size: 10px;
  letter-spacing: .08em;
  color: var(--ink);
  background: linear-gradient(180deg, #e7fbf7, #74c9b8);
  border: 2px solid var(--ink);
  border-radius: 10px;
  box-shadow: 0 3px 0 var(--ink);
  padding: 5px 8px 6px;
  cursor: pointer;
}
.coop-inroom b { font-size: 13px; letter-spacing: .12em; }
.coop-inroom #coop-inroom-leave {
  background: linear-gradient(180deg, #ffe3d6, #f3a58d);
  font-size: 9px;
}
.coop-leave-prompt {
  position: fixed;
  inset: 0;
  z-index: 97;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(27, 18, 41, 0.62);
  backdrop-filter: blur(3px);
}
.coop-leave-card { width: min(440px, 94vw); }
.coop-leave-card .coop-status { text-align: left; }
@media (max-height: 560px) {
  .coop-inroom { bottom: calc(var(--safe-b) + 12px); max-width: 118px; }
}

/* ---------- card tray: part of the screen, never the whole screen ---------- */

.cards-screen {
  display: block;
  padding: 0;
  background: none;
  backdrop-filter: none;
  overflow: hidden;
  pointer-events: none;
}
.cards-wash { display: none; }
.cards-panel {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 96vw;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: calc(var(--safe-t) + 8px) 10px 10px;
  border-radius: 20px;
  border: 2px solid rgba(255, 243, 214, .28);
  background: rgba(30, 17, 48, .84);
  box-shadow: 0 12px 28px rgba(8, 3, 18, .45), inset 0 1px 0 rgba(255, 255, 255, .14);
  backdrop-filter: blur(5px);
  pointer-events: auto;
}
.cards-screen .cards-head {
  position: static;
  z-index: 2;
  margin: 0;
  padding: 0;
  text-align: center;
  pointer-events: none;
}
.cards-screen .lb-small { font-size: clamp(11px, 2.6vw, 18px); }
.cards-screen .lb-big { font-size: clamp(28px, 6.4vw, 48px); }
.cards-screen .cards-sub {
  margin-top: 1px;
  font-size: clamp(9px, 1.8vw, 12px);
  max-width: min(88vw, 620px);
}
.cards-screen .card-timer { margin-top: 1px; }
.cards-screen .card-row {
  position: static;
  z-index: 3;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(5px, 1.4vw, 14px);
  width: max-content;
  max-width: 100%;
  height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  backdrop-filter: none;
  pointer-events: auto;
  perspective: 1000px;
}
.cards-screen .card { width: clamp(100px, 24vw, 200px); }
.cards-screen .cards-foot {
  position: static;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0;
  flex-wrap: wrap;
  pointer-events: auto;
}
.hud-menu-btn:disabled { opacity: .35; cursor: default; }

@media (max-height: 700px) and (orientation: portrait) {
  .cards-screen .cards-sub { display: none; }
  .cards-screen .lb-big { font-size: 24px; }
  .cards-screen .lb-small { font-size: 10px; }
  .cards-screen .card { width: clamp(80px, 21vw, 128px); }
  .cards-screen .card-icon { width: 36px; height: 36px; }
  .cards-screen .card-nameplate { font-size: 9px; padding: 4px 3px; }
  .cards-screen .card-effect { font-size: 8.5px; }
  .cards-screen .card-synergy { display: none; }
}

@media (max-height: 560px) and (orientation: landscape) {
  .cards-panel {
    top: 0;
    left: calc(8px + var(--safe-l));
    transform: none;
    max-width: 46vw;
    padding: calc(var(--safe-t) + 4px) 8px 8px;
    gap: 4px;
  }
  .cards-screen .cards-head { text-align: left; }
  .cards-screen .lb-small { font-size: 10px; }
  .cards-screen .lb-big { font-size: 24px; }
  .cards-screen .cards-sub { display: none; }
  .cards-screen .card-row {
    gap: 5px;
  }
  .cards-screen .card { width: clamp(76px, 11.6vw, 100px); }
  .cards-screen .card-synergy { display: none; }
  .cards-screen .card-icon { width: 36px; height: 36px; }
  .cards-screen .card-nameplate { font-size: 9px; padding: 4px 3px; }
  .cards-screen .card-effect { font-size: 8.5px; }
  .cards-screen .cards-foot { justify-content: flex-start; }
  .cards-screen .cards-foot .pick-hint { display: none; }
}

/* ---------- opening cutscene ---------- */
/* A first-person waking scene over the game canvas. The overlay sits above
   every menu, so the title is never visible until the white has cleared. */
.opening {
  position: absolute;
  inset: 0;
  z-index: 90;
  overflow: hidden;
  pointer-events: auto;
  background: transparent;
}
.opening.hidden { display: none; }
.opening-black {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: #07060b;
  opacity: 1;
}
.opening-lid {
  position: absolute;
  left: 0;
  right: 0;
  height: 56%;
  z-index: 3;
  pointer-events: none;
  will-change: height;
}
.opening-lid.top {
  top: 0;
  background: linear-gradient(180deg, #08070c 0%, #08070c 74%, rgba(8, 7, 12, 0) 100%);
}
.opening-lid.bottom {
  bottom: 0;
  background: linear-gradient(0deg, #08070c 0%, #08070c 74%, rgba(8, 7, 12, 0) 100%);
}
.opening-vignette {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background:
    radial-gradient(ellipse 82% 70% at 50% 44%, transparent 40%, rgba(14, 10, 24, 0.30) 74%, rgba(10, 7, 18, 0.58) 100%);
  mix-blend-mode: multiply;
}
.opening-white {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  background: #fffdf8;
  opacity: 0;
  will-change: opacity;
}
.opening-line {
  position: absolute;
  left: 6%;
  right: 6%;
  top: 62%;
  z-index: 6;
  margin: 0;
  text-align: center;
  font-family: var(--body);
  font-weight: 700;
  font-size: clamp(18px, 3.8vw, 32px);
  letter-spacing: 0.025em;
  color: #6a4a34;
  text-shadow: 0 1px 0 rgba(255, 253, 248, 0.95), 0 2px 18px rgba(255, 253, 248, 0.95), 0 0 34px rgba(255, 253, 248, 0.9);
  opacity: 0;
  pointer-events: none;
  will-change: opacity;
}
.opening-skip {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(var(--safe-b) + 18px);
  z-index: 7;
  margin: 0;
  text-align: center;
  font-family: var(--num);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.20em;
  text-transform: uppercase;
  color: rgba(255, 247, 230, 0.58);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}
.opening.is-open .opening-skip { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  .opening-lid, .opening-white, .opening-line { transition: none; }
}


/* ---------- queue roster: who is in the team while it waits ---------- */
.coop-roster {
  margin: 4px 0 2px;
  padding: 7px 9px;
  border-radius: 10px;
  background: rgba(42, 31, 58, .07);
  border: 1px solid rgba(42, 31, 58, .18);
  color: var(--ink-soft);
  font-family: var(--display);
  font-size: 11px;
  letter-spacing: .04em;
  line-height: 1.55;
  text-transform: uppercase;
}
.coop-roster b { color: #b07816; }

/* ---------- level-up tray: centre-bottom, half height ---------- */
.cards-screen .cards-panel {
  top: auto;
  bottom: calc(6px + var(--safe-b));
  left: 50%;
  transform: translateX(-50%);
  padding: 5px 8px 6px;
  gap: 3px;
  border-radius: 14px;
}
.cards-screen .cards-head { width: 100%; }
.cards-screen .level-banner { gap: 6px; }
.cards-screen .lb-small { font-size: 9px; }
.cards-screen .lb-big { font-size: 20px; -webkit-text-stroke-width: 3px; }
.cards-screen .cards-sub { display: none; }
.cards-screen .card-timer { margin-top: 0; }
.cards-screen .card-timer-track { width: min(180px, 34vw); height: 5px; border-width: 1px; }
.cards-screen .card-timer-num { font-size: 10px; }
.cards-screen .card-row { gap: clamp(4px, 1vw, 8px); }
.cards-screen .card {
  width: clamp(104px, 27vw, 172px);
  aspect-ratio: 2.05 / 1;
  border-width: 2px;
  border-radius: 9px;
  padding: 4px 6px;
  display: grid;
  grid-template-columns: 30px 1fr;
  grid-template-rows: auto 1fr;
  column-gap: 6px;
  row-gap: 2px;
  align-content: center;
  align-items: center;
  box-shadow: 0 4px 0 var(--ink), 0 8px 14px rgba(8, 3, 18, .42), inset 0 0 0 2px rgba(255,255,255,.28), 0 0 0 2px var(--frame);
}
.cards-screen .card-nameplate {
  grid-column: 2;
  grid-row: 1;
  font-size: 8.5px;
  padding: 2px 3px 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 0;
}
.cards-screen .card-icon {
  grid-column: 1;
  grid-row: 1 / span 2;
  width: 30px;
  height: 30px;
  align-self: center;
  margin: 0;
}
.cards-screen .card-effect {
  grid-column: 2;
  grid-row: 2;
  font-size: 7.6px;
  line-height: 1.12;
  max-height: 2.24em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  text-align: left;
}
.cards-screen .card-synergy, .cards-screen .card-seal, .cards-screen .card-foot { display: none; }
.cards-screen .cards-foot { gap: 6px; }
.cards-screen .cards-foot .badge-btn { font-size: 8px; padding: 4px 8px 5px; }
.cards-screen .cards-foot .pick-hint { font-size: 8px; }
.card.auto-picked {
  animation: autoPick .7s cubic-bezier(.2, 1.3, .35, 1) both;
  filter: brightness(1.25);
  z-index: 4;
}
@keyframes autoPick {
  0% { transform: rotate(var(--tilt)) scale(1); }
  30% { transform: translateY(-10px) rotate(0deg) scale(1.12); box-shadow: 0 0 0 6px var(--gold), 0 18px 30px rgba(255, 220, 120, .6); }
  62% { transform: translateY(-12px) rotate(0deg) scale(1.04); }
  100% { transform: translateY(-26px) rotate(0deg) scale(.8); opacity: 0; }
}
.buff-report {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-b) + 58px);
  transform: translateX(-50%);
  z-index: 56;
  max-width: min(90vw, 460px);
  padding: 7px 14px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  background: linear-gradient(180deg, #ffe9a0, #f0b23c);
  color: var(--ink);
  font-family: var(--display);
  font-weight: 800;
  font-size: 12px;
  letter-spacing: .04em;
  text-align: center;
  box-shadow: 0 5px 0 var(--ink), 0 12px 22px rgba(8,3,18,.4);
  animation: buffIn .3s cubic-bezier(.2,1.3,.35,1) both;
  pointer-events: none;
}
.buff-report.out { animation: buffOut .28s ease-in both; }
@keyframes buffIn { from { transform: translate(-50%, 14px) scale(.9); opacity: 0; } to { transform: translate(-50%, 0) scale(1); opacity: 1; } }
@keyframes buffOut { to { transform: translate(-50%, -10px) scale(.94); opacity: 0; } }

/* ---------- HUD settings + paw stats ---------- */
.paw-emblem {
  pointer-events: auto;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
}
.paw-emblem:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.paw-emblem.on { filter: drop-shadow(0 0 7px rgba(255, 233, 160, .95)); }
.hud-settings-btn { margin-top: 5px; }
.stats-window {
  pointer-events: auto;
  position: fixed;
  left: calc(var(--safe-l) + 10px);
  top: calc(var(--safe-t) + 118px);
  z-index: 34;
  width: min(340px, 68vw);
  max-height: min(58vh, 380px);
  overflow: auto;
  padding: 10px 11px 12px;
  border-radius: 14px;
  border: 2px solid rgba(255, 243, 214, .3);
  background: rgba(30, 17, 48, .92);
  color: var(--cream);
  font-family: var(--display);
  box-shadow: 0 12px 28px rgba(8, 3, 18, .5);
  backdrop-filter: blur(6px);
}
.stats-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 800;
  letter-spacing: .08em;
  font-size: 12px;
  color: var(--gold);
  margin-bottom: 6px;
}
.stats-head button {
  border: 0; background: none; color: var(--cream);
  font-size: 20px; line-height: 1; cursor: pointer; padding: 0 2px;
}
.stats-self { display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; font-size: 11px; }
.stats-self span:nth-child(odd) { color: rgba(255, 243, 214, .72); }
.stats-self b { color: #fff3d6; font-family: var(--num); }
.stats-skills-head, .stats-team-head {
  margin: 9px 0 5px;
  font-size: 10px;
  letter-spacing: .07em;
  color: rgba(255, 243, 214, .72);
}
.stats-skills-head small { font-size: 8px; letter-spacing: 0; opacity: .75; }
.stats-skills { display: flex; flex-wrap: wrap; gap: 5px; }
.stat-skill {
  width: 34px; height: 34px;
  border-radius: 9px;
  border: 2px solid rgba(255, 243, 214, .32);
  background: rgba(255, 243, 214, .1);
  color: var(--cream);
  display: grid; place-items: center;
  position: relative;
  padding: 3px;
  cursor: pointer;
  touch-action: none;
}
.stat-skill svg, .stat-skill img { width: 100%; height: 100%; object-fit: contain; }
.stat-skill:active, .stat-skill.on { border-color: var(--gold); background: rgba(255, 233, 160, .24); }
.stat-skill-tip {
  position: fixed;
  z-index: 60;
  max-width: min(260px, 76vw);
  padding: 7px 10px;
  border-radius: 9px;
  border: 2px solid var(--ink);
  background: #fff3d6;
  color: var(--ink);
  font-family: var(--display);
  font-size: 10px;
  line-height: 1.4;
  box-shadow: 0 6px 14px rgba(8,3,18,.4);
  pointer-events: none;
}
.stats-team { display: flex; flex-direction: column; gap: 5px; font-size: 10px; }
.stats-team-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 8px;
  padding: 5px 6px;
  border-radius: 8px;
  background: rgba(255, 243, 214, .07);
}
.stats-team-row b { color: var(--gold); }
.stats-team-row small { color: rgba(255, 243, 214, .72); font-size: 9px; }

/* ---------- names above heads ---------- */
.name-tags {
  position: fixed;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  overflow: hidden;
}
.name-tag {
  position: absolute;
  transform: translate(-50%, -100%);
  padding: 2px 7px 3px;
  border-radius: 999px;
  border: 1.5px solid rgba(42, 31, 58, .85);
  background: rgba(30, 17, 48, .72);
  color: #fff3d6;
  font-family: var(--display);
  font-weight: 800;
  font-size: 10px;
  letter-spacing: .03em;
  white-space: nowrap;
  text-shadow: 0 1px 0 rgba(0,0,0,.5);
  transition: opacity .15s;
}
.name-tag.me { border-color: var(--gold); color: #ffe9a0; }
.name-tag.ai { opacity: .88; }

/* ---------- leave-game prompt uses the co-op card ---------- */
#leave-game-prompt { z-index: 70; }

/* ---------- portrait title: every pet face reads at a glance ---------- */
/* The picker used to be a column of 17px circular icons, so in portrait the
   hand-drawn pet faces could not be told apart. Give each pet a full tile
   with its face at a readable size, and drop the second empty selection
   prompt that used to sit under the picker. */
@media (orientation: portrait) and (max-width: 1024px) {
  .medallion.is-empty .medallion-plate { display: none; }
  .medallion-rim { width: 104px; height: 104px; }
  .title-main-row { gap: 4px; }
  .title-main-row .badge-big { font-size: clamp(14px, 4.2vw, 24px); }
  #btn-start { padding-left: 10px; padding-right: 10px; }
  #btn-coop, #btn-queue { padding-left: 20px; padding-right: 20px; }
  .pet-switch {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: min(94vw, 430px);
    max-width: 430px;
    gap: 6px;
    padding: 8px;
    margin-top: 3px;
  }
  .pet-tab {
    flex-direction: column;
    justify-content: flex-start;
    gap: 4px;
    padding: 6px 3px 5px;
    border-radius: 12px;
    font-size: 7.5px;
    letter-spacing: .04em;
    line-height: 1.1;
  }
  .pet-tab .tab-face {
    width: clamp(38px, 12.5vw, 60px);
    height: clamp(38px, 12.5vw, 60px);
    border-width: 2px;
  }
  .pet-tab .tab-label {
    display: block;
    max-width: 100%;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    text-align: center;
  }
  .pet-tab .tab-lock {
    display: block;
    font-size: 6px;
    letter-spacing: .06em;
  }
}


/* ---------- landscape title: title and buttons grouped in the centre ---------- */
/* A tablet in landscape has room for one centred column. Short phone
   landscapes keep the compact row, so this only changes screens tall enough
   to stack without pushing anything off the bottom. */
@media (orientation: landscape) and (min-width: 1000px) {
  .title-screen { align-items: center; justify-content: center; }
  .title-inner { justify-content: center; gap: 10px; }
  .wordmark-wrap { width: min(62vw, 780px); margin-top: 0; }
  .wordmark-3d-wrap { width: 100%; }
  .title-bottom {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 12px;
    margin-top: 0;
  }
  .title-buttons {
    width: min(820px, 92vw);
    max-width: 100%;
    padding-bottom: 0;
  }
  .title-main-row { gap: 10px; }
  .badge-row { gap: 6px; }
  .title-credit { margin-top: 6px; }
}

/* ---------- short landscape title: one centred column with a pet strip ---- */
/* On phones in landscape the picker and the buttons used to sit side by side,
   which left the buttons off to the right of the title. The picker becomes a
   single centred strip, so the title and the whole button group share the
   same centre line without pushing anything off the bottom. */
@media (orientation: landscape) and (max-width: 999px) {
  .title-screen {
    align-items: center;
    justify-content: center;
    padding-top: 6px;
    padding-bottom: 6px;
  }
  .title-inner { justify-content: center; gap: 6px; }
  .wordmark-wrap { width: min(66vw, 560px); margin-top: 0; }
  .wordmark-3d-wrap { width: 100%; }
  .title-bottom {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 8px;
    margin-top: 0;
  }
  .medallion {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transform: none;
    filter: none;
  }
  .medallion-rim {
    width: 38px;
    height: 38px;
    padding: 3px;
    border-width: 2px;
  }
  .medallion-empty { font-size: 18px; }
  .medallion-plate { display: none; }
  .pet-empty { display: none; }
  .pet-switch {
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: center;
    width: auto;
    max-width: none;
    gap: 2px;
    padding: 2px;
    margin: 0;
  }
  .pet-tab { padding: 1px; border-radius: 50%; gap: 0; }
  .pet-tab .tab-label, .pet-tab .tab-lock { display: none; }
  .tab-face { width: 22px; height: 22px; }
  .evolve-line, .signature-skills { display: none; }
  .title-buttons {
    width: min(820px, 94vw);
    max-width: 100%;
    padding-bottom: 0;
  }
  .title-main-row { gap: 6px; }
  .badge-row { gap: 4px; }
}
