/* CaptureDex Play — design mockup. Dark by intent: this is the brand's world. */

:root {
  --ink: #070E17;
  --bg2: #0B1622;
  --panel: #101E2E;
  --panel-2: #16283C;
  --line: rgba(139, 180, 216, 0.14);
  --text: #EAF2F9;
  --muted: #8CA3B6;
  --accent: #5BB4E8;
  --accent-2: #7CC6F0;
  --good: #4CD08A;
  --bad: #F0647C;

  --r-common: #97A9BC;
  --r-rare: #5BB4E8;
  --r-epic: #B18CF0;
  --r-legendary: #F0B84C;

  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { height: 100%; }
body {
  height: 100%;
  background: var(--ink);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  user-select: none;
}
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }

.app {
  position: relative;
  height: 100dvh;
  max-width: 430px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(120% 50% at 50% -8%, rgba(91, 180, 232, 0.14), transparent 62%),
    linear-gradient(180deg, var(--bg2), var(--ink) 45%);
  overflow: hidden;
}
/* a quiet stage on desktop, an app on the phone */
@media (min-width: 480px) {
  body { background: #04080E; display: grid; place-items: center; }
  .app { height: min(880px, 96dvh); border-radius: 28px; box-shadow: 0 0 0 1px rgba(255,255,255,0.07), 0 40px 90px rgba(0,0,0,0.6); }
}

/* ---------------------------------------------------------------- screens */
.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: calc(var(--sat) + 14px) 20px 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}
.screen::-webkit-scrollbar { display: none; }

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  margin-bottom: 6px;
}
.title { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; }

.brand { display: flex; align-items: center; gap: 8px; }
.brand-mark { width: 26px; height: 26px; border-radius: 7px; background: linear-gradient(180deg, #1A3D5C, #0A1826); padding: 3px; }
.brand-name { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.brand-name b { color: var(--accent); font-weight: 700; }

.chip {
  min-width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 12px;
  border-radius: 20px;
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--muted);
  font-size: 14px; font-weight: 600;
  transition: scale 0.15s;
}
.chip:active { scale: 0.96; }
.chip.static { pointer-events: none; }

/* ---------------------------------------------------------------- lobby */
.lobby {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 28px;
  padding-bottom: 24px;
  animation: rise 0.45s cubic-bezier(0.2, 0, 0, 1) both;
}
.lobby-vs { display: flex; align-items: center; gap: 22px; }
.fighter { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.fighter-name { font-size: 15px; font-weight: 700; }
.fighter-deck { font-size: 12.5px; color: var(--muted); margin-top: -4px; }
.avatar {
  width: 74px; height: 74px;
  border-radius: 26px;
  display: grid; place-items: center;
  font-size: 28px; font-weight: 800;
  color: #fff;
  background: linear-gradient(180deg, hsl(var(--hue) 62% 58%), hsl(var(--hue) 58% 40%));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.22), 0 10px 26px rgba(0,0,0,0.45);
}
.avatar.sm { width: 30px; height: 30px; border-radius: 10px; font-size: 13px; }
.vs-badge {
  font-size: 15px; font-weight: 800; letter-spacing: 0.08em;
  color: var(--accent);
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(91, 180, 232, 0.12);
  box-shadow: inset 0 0 0 1px rgba(91, 180, 232, 0.28);
}
.lobby-hint { text-align: center; color: var(--muted); font-size: 14.5px; line-height: 1.55; text-wrap: balance; }

.modes { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.mode {
  display: flex; flex-direction: column; gap: 2px;
  text-align: left;
  padding: 13px 16px;
  border-radius: 16px;
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--line);
  transition: scale 0.15s, box-shadow 0.2s, background 0.2s;
}
.mode:active { scale: 0.96; }
.mode.is-active {
  background: rgba(91, 180, 232, 0.12);
  box-shadow: inset 0 0 0 1.5px var(--accent);
}
.mode-name { font-size: 15.5px; font-weight: 750; }
.mode.is-active .mode-name { color: var(--accent-2); }
.mode-desc { font-size: 12.5px; color: var(--muted); }

.col-picker { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.col-chip { font-size: 13.5px; }
.chip.is-on { color: var(--accent-2); background: rgba(91, 180, 232, 0.12); box-shadow: inset 0 0 0 1.5px rgba(91, 180, 232, 0.5); }

.lobby-draw { font-size: 13px; color: var(--muted); text-align: center; }
.lobby-draw b { color: var(--text); font-weight: 650; }
.link-btn { color: var(--accent); font-size: 13px; font-weight: 700; min-height: 40px; }

/* Marina's speech bubble, pinned above her card */
.speech {
  position: absolute;
  top: -4px; left: 50%;
  translate: -50% -100%;
  z-index: 3;
  padding: 8px 14px;
  border-radius: 14px 14px 14px 4px;
  background: var(--panel-2);
  box-shadow: inset 0 0 0 1px var(--line), 0 8px 22px rgba(0,0,0,0.4);
  font-size: 13.5px; font-weight: 700;
  white-space: nowrap;
  animation: pop 0.3s cubic-bezier(0.2, 0, 0, 1) both;
}

.call-row {
  display: flex; gap: 10px;
  width: 100%;
  padding: 8px 6px 2px;
}
.call-btn {
  flex: 1;
  height: 52px;
  border-radius: 16px;
  background: var(--panel-2);
  box-shadow: inset 0 0 0 1.5px rgba(91, 180, 232, 0.4);
  color: var(--accent-2);
  font-size: 16px; font-weight: 800;
  transition: scale 0.15s;
  animation: rise 0.3s cubic-bezier(0.2, 0, 0, 1) both;
}
.call-btn:active { scale: 0.96; }

.dice-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 8px 6px 2px;
  animation: rise 0.3s cubic-bezier(0.2, 0, 0, 1) both;
}
.die {
  width: 56px; height: 56px;
  display: grid; place-items: center;
  border-radius: 16px;
  background: var(--panel-2);
  box-shadow: inset 0 0 0 1px var(--line), 0 8px 20px rgba(0,0,0,0.35);
  font-size: 24px; font-weight: 850;
  font-variant-numeric: tabular-nums;
}
.die.mine { box-shadow: inset 0 0 0 1.5px var(--accent), 0 8px 20px rgba(0,0,0,0.35); color: var(--accent-2); }
.dice-hint { flex: 1; text-align: center; font-size: 13.5px; font-weight: 750; color: var(--accent-2); animation: pulseHint 1s ease-in-out infinite; }
@keyframes pulseHint { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }

.cta {
  width: min(100%, 320px);
  height: 56px;
  border-radius: 18px;
  background: linear-gradient(180deg, var(--accent-2), #3D8FD1);
  color: #06121D;
  font-size: 17px; font-weight: 800; letter-spacing: 0.01em;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.4), 0 12px 30px rgba(61, 143, 209, 0.35);
  transition: scale 0.15s;
}
.cta:active { scale: 0.96; }
.ghost-btn {
  height: 48px; padding: 0 18px;
  border-radius: 14px;
  color: var(--muted); font-size: 15px; font-weight: 600;
  transition: scale 0.15s, color 0.15s;
}
.ghost-btn:active { scale: 0.96; color: var(--text); }

/* ---------------------------------------------------------------- match */
.match { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.match-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 2px 0 10px;
}
.side { display: flex; align-items: center; gap: 8px; }
.side-name { font-size: 13.5px; font-weight: 650; color: var(--muted); }
.count-pill {
  min-width: 26px; height: 26px; padding: 0 8px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 13px;
  background: var(--panel-2);
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: 13px; font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.count-pill.mine { background: rgba(91,180,232,0.16); box-shadow: inset 0 0 0 1px rgba(91,180,232,0.35); color: var(--accent-2); }
.round-label { font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }

.arena {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center;
  justify-content: space-between;
  min-height: 0;
  padding-bottom: 10px;
}
.arena-slot { display: flex; justify-content: center; position: relative; }
.arena-slot.you .card { width: min(240px, 29dvh); }
.arena-slot.them .card { width: min(148px, 17dvh); transition: width 0.5s cubic-bezier(0.2, 0, 0, 1); }
.arena-slot.them .card:not(.is-facedown) { width: min(196px, 22.5dvh); }
.arena-prompt {
  font-size: 14px; font-weight: 650;
  color: var(--muted);
  text-align: center;
  min-height: 20px;
  margin: 6px 0;
  transition: color 0.2s;
}
.arena-prompt.hot { color: var(--accent-2); }

/* ---------------------------------------------------------------- card */
.card {
  --tilt-x: 0deg; --tilt-y: 0deg;
  --rc: var(--r-common);
  width: 236px;
  aspect-ratio: 63 / 88;
  perspective: 900px;
  position: relative;
  container-type: inline-size;
}
.card-inner {
  position: absolute; inset: 0;
  transform-style: preserve-3d;
  transition: transform 0.55s cubic-bezier(0.3, 0, 0.16, 1);
}
.card.is-facedown .card-inner { transform: rotateY(180deg); }

.card-face {
  position: absolute; inset: 0;
  backface-visibility: hidden;
  border-radius: 8.5cqi;
  overflow: hidden;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.1),
    0 18px 44px rgba(0, 0, 0, 0.55);
  transform: rotateX(var(--tilt-x)) rotateY(var(--tilt-y));
  display: flex; flex-direction: column;
}

.card-back {
  transform: rotateY(180deg);
  background:
    radial-gradient(90% 60% at 50% 30%, rgba(91,180,232,0.25), transparent 65%),
    linear-gradient(180deg, #14304A, #0A1826);
  display: grid; place-items: center;
}
.card-back svg { width: 42%; height: 42%; opacity: 0.9; }

.card-art {
  position: relative;
  height: 46%;
  display: grid; place-items: center;
  background:
    radial-gradient(80% 90% at 50% 105%, color-mix(in oklab, var(--rc) 34%, transparent), transparent 70%),
    linear-gradient(180deg, rgba(255,255,255,0.05), transparent 55%);
}
.card-subject {
  font-size: 35.5cqi;
  line-height: 1;
  filter: drop-shadow(0 14px 18px rgba(0,0,0,0.45));
  transform: translateZ(0);
}
.card-serial {
  position: absolute; top: 4.2cqi; left: 5.1cqi;
  font-size: 4.2cqi; font-weight: 700; letter-spacing: 0.1em;
  color: rgba(234, 242, 249, 0.55);
  font-variant-numeric: tabular-nums;
}
.card-rarity {
  position: absolute; top: 3.4cqi; right: 3.4cqi;
  height: 9.3cqi; padding: 0 3.8cqi;
  display: inline-flex; align-items: center; gap: 4px;
  border-radius: 4.7cqi;
  font-size: 4.2cqi; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
  color: #08121C;
  background: var(--rc);
  box-shadow: 0 4px 10px color-mix(in oklab, var(--rc) 45%, transparent);
}

.card-id { padding: 4.2cqi 5.9cqi 2.5cqi; }
.card-name { font-size: 7.6cqi; font-weight: 800; letter-spacing: -0.01em; }
.card-breed { font-size: 4.9cqi; color: var(--muted); font-weight: 600; margin-top: 1px; }

.card-stats { flex: 1; display: flex; flex-direction: column; padding: 1.7cqi 3.4cqi 4.2cqi; gap: 0.9cqi; }
.stat {
  flex: 1;
  display: grid;
  grid-template-columns: 24.5cqi 1fr 12.7cqi;
  align-items: center;
  gap: 3.4cqi;
  padding: 0 3.4cqi;
  min-height: 12.7cqi;
  border-radius: 3.8cqi;
  text-align: left;
  transition: background 0.18s, scale 0.15s, box-shadow 0.18s;
}
.stat-label { font-size: 4.4cqi; font-weight: 750; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
.stat-bar { height: 1.7cqi; border-radius: 1cqi; background: rgba(139,180,216,0.16); overflow: hidden; }
.stat-bar i { display: block; height: 100%; width: calc(var(--v) * 1%); border-radius: 1cqi; background: var(--rc); }
.stat-value { font-size: 5.9cqi; font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; }

.card.is-pickable .stat { background: rgba(139, 180, 216, 0.07); box-shadow: inset 0 0 0 1px rgba(139,180,216,0.1); }
.card.is-pickable .stat:active { scale: 0.96; }
.stat.is-picked {
  background: rgba(91, 180, 232, 0.2) !important;
  box-shadow: inset 0 0 0 1.5px var(--accent) !important;
}
.stat.is-picked .stat-label, .stat.is-picked .stat-value { color: var(--accent-2); }
.stat.is-win { background: rgba(76, 208, 138, 0.18) !important; box-shadow: inset 0 0 0 1.5px var(--good) !important; }
.stat.is-win .stat-label, .stat.is-win .stat-value { color: var(--good); }
.stat.is-lose { background: rgba(240, 100, 124, 0.14) !important; box-shadow: inset 0 0 0 1.5px rgba(240,100,124,0.7) !important; }
.stat.is-lose .stat-label, .stat.is-lose .stat-value { color: var(--bad); }

/* round outcomes */
.card.won-round { animation: cardWin 0.7s cubic-bezier(0.2, 0, 0, 1); }
.card.lost-round { animation: cardLose 0.7s cubic-bezier(0.2, 0, 0, 1); }
@keyframes cardWin {
  0% { transform: translateY(0); }
  35% { transform: translateY(-10px) scale(1.03); }
  100% { transform: translateY(0); }
}
@keyframes cardLose {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-7px); }
  55% { transform: translateX(6px); }
  80% { transform: translateX(-3px); }
}

/* holo foil — epic & legendary only; driven by tilt vars */
.card-foil {
  position: absolute; inset: 0;
  pointer-events: none;
  opacity: 0;
  background:
    linear-gradient(calc(115deg + var(--tilt-y) * 4),
      transparent 20%,
      rgba(255, 130, 190, 0.25) 36%,
      rgba(130, 255, 213, 0.28) 46%,
      rgba(140, 180, 255, 0.3) 56%,
      transparent 74%);
  background-size: 220% 220%;
  background-position: calc(50% + var(--tilt-y) * 9) calc(50% + var(--tilt-x) * 9);
  mix-blend-mode: color-dodge;
  transition: opacity 0.4s;
}
.card[data-rarity="epic"] .card-foil,
.card[data-rarity="legendary"] .card-foil { opacity: 0.85; }
.card[data-rarity="legendary"] .card-face { box-shadow: inset 0 0 0 1.5px color-mix(in oklab, var(--r-legendary) 65%, transparent), 0 18px 44px rgba(0,0,0,0.55), 0 0 34px rgba(240, 184, 76, 0.18); }

/* ---------------------------------------------------------------- result */
.result {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 14px;
  text-align: center;
  padding-bottom: 40px;
  animation: rise 0.5s cubic-bezier(0.2, 0, 0, 1) both;
}
.result-title { font-size: 40px; font-weight: 850; letter-spacing: -0.03em; text-wrap: balance; }
.result-sub { color: var(--muted); font-size: 15.5px; max-width: 30ch; text-wrap: pretty; }
.result .cta { margin-top: 18px; }

.xp-chip {
  padding: 7px 16px;
  border-radius: 999px;
  background: rgba(240, 184, 76, 0.14);
  box-shadow: inset 0 0 0 1.5px rgba(240, 184, 76, 0.5);
  color: var(--r-legendary);
  font-size: 15px; font-weight: 800;
  font-variant-numeric: tabular-nums;
  animation: pop 0.45s cubic-bezier(0.2, 0, 0, 1) 0.25s both;
}
.xp-bar {
  width: min(240px, 70%);
  height: 8px;
  border-radius: 4px;
  background: rgba(139, 180, 216, 0.14);
  overflow: hidden;
}
.xp-bar i {
  display: block; height: 100%; width: 0;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent), var(--r-legendary));
  transition: width 1.1s cubic-bezier(0.2, 0, 0, 1);
}

.result-burst { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.spark {
  position: absolute;
  width: 8px; height: 8px;
  border-radius: 2px;
  background: var(--c, var(--accent));
  animation: fall var(--d, 2.4s) linear var(--dl, 0s) both;
  top: -20px; left: var(--x, 50%);
  rotate: 25deg;
}
@keyframes fall {
  0% { transform: translateY(0) rotate(0turn); opacity: 1; }
  100% { transform: translateY(110vh) rotate(2turn); opacity: 0.4; }
}

/* ---------------------------------------------------------------- decks */
.deck-list { display: flex; flex-direction: column; gap: 14px; padding: 8px 0 16px; }
.deck-tile {
  display: flex; align-items: center; gap: 14px;
  padding: 16px;
  border-radius: 22px;
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--line);
  text-align: left;
  transition: scale 0.15s;
}
.deck-tile:active { scale: 0.96; }
.deck-fan { display: flex; }
.deck-fan .mini {
  width: 34px; height: 48px;
  border-radius: 7px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.12), 0 4px 10px rgba(0,0,0,0.35);
  display: grid; place-items: center;
  font-size: 19px;
  margin-left: -14px;
  rotate: calc(var(--i) * 5deg - 7deg);
}
.deck-fan .mini:first-child { margin-left: 0; }
.deck-meta { flex: 1; min-width: 0; }
.deck-name { font-size: 17px; font-weight: 750; }
.deck-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.deck-cta { color: var(--accent); font-size: 13.5px; font-weight: 700; white-space: nowrap; }

.deck-tile.ghost { opacity: 0.66; box-shadow: inset 0 0 0 1.5px transparent; outline: 1.5px dashed rgba(139,180,216,0.3); outline-offset: -1.5px; background: transparent; }
.deck-tile.ghost .deck-fan .mini { background: rgba(139,180,216,0.08); box-shadow: inset 0 0 0 1px rgba(139,180,216,0.14); filter: grayscale(1); opacity: 0.7; }

/* deck editor (in-place expansion) */
.deck-editor { padding: 6px 0 18px; animation: rise 0.4s cubic-bezier(0.2, 0, 0, 1) both; }
.deck-editor-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.deck-editor-title { font-size: 21px; font-weight: 800; letter-spacing: -0.015em; }
.deck-slots { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.slot {
  aspect-ratio: 63 / 88;
  border-radius: 14px;
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--line);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 4px;
  padding: 6px;
  transition: scale 0.15s, box-shadow 0.2s;
}
.slot:active { scale: 0.96; }
.slot .em { font-size: 33px; filter: drop-shadow(0 5px 8px rgba(0,0,0,0.4)); }
.slot .nm { font-size: 10.5px; font-weight: 700; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot .rr { width: 60%; height: 3px; border-radius: 2px; background: var(--rc, var(--r-common)); }
.deck-edit-hint { font-size: 12.5px; color: var(--muted); text-align: center; margin-top: 12px; }

.foot-note { color: var(--muted); font-size: 13px; text-align: center; padding: 4px 0 18px; }

/* ---------------------------------------------------------------- dex */
.dex-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 10px 0 20px;
}
.dex-card {
  --rc: var(--r-common);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--line);
  padding: 14px 12px 12px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  transition: scale 0.15s;
  animation: rise 0.4s cubic-bezier(0.2, 0, 0, 1) both;
  animation-delay: calc(var(--i) * 45ms);
}
.dex-card:active { scale: 0.96; }
.dex-card .em {
  font-size: 52px;
  filter: drop-shadow(0 9px 12px rgba(0,0,0,0.42));
  padding: 8px 0 2px;
}
.dex-card .nm { font-size: 14.5px; font-weight: 750; }
.dex-card .br { font-size: 11px; color: var(--muted); font-weight: 600; margin-top: -3px; }
.dex-card .tag {
  margin-top: 4px;
  font-size: 9.5px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
  color: color-mix(in oklab, var(--rc) 80%, white);
  background: color-mix(in oklab, var(--rc) 16%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--rc) 38%, transparent);
  padding: 3px 8px; border-radius: 9px;
}

/* ---------------------------------------------------------------- profile */
.avatar.lg { width: 66px; height: 66px; border-radius: 23px; font-size: 26px; }
.profile-head { display: flex; align-items: center; gap: 14px; padding: 10px 0 14px; }
.profile-id { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.profile-name { font-size: 20px; font-weight: 800; letter-spacing: -0.01em; }
.profile-tag { font-size: 13px; color: var(--muted); font-weight: 600; }
.profile-tag b { color: var(--r-legendary); font-weight: 800; }
.follow-nums { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); text-align: right; }
.follow-nums b { color: var(--text); font-weight: 800; font-variant-numeric: tabular-nums; }

.profile-xp { width: 100%; }
.xp-note { font-size: 12px; color: var(--muted); margin: 6px 0 16px; font-variant-numeric: tabular-nums; }

.record {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 22px;
}
.record-cell {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 14px 6px;
  border-radius: 16px;
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--line);
}
.record-cell b { font-size: 22px; font-weight: 850; font-variant-numeric: tabular-nums; }
.record-cell span { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }

.section-label { font-size: 13px; font-weight: 750; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin: 4px 0 10px; }

.deck-covers { display: flex; gap: 12px; margin-bottom: 22px; }
.deck-cover {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 14px 18px 12px;
  border-radius: 18px;
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--line);
  transition: scale 0.15s;
}
.deck-cover:active { scale: 0.96; }
.deck-cover .cover-art { font-size: 34px; filter: drop-shadow(0 6px 9px rgba(0,0,0,0.4)); }
.deck-cover .cover-name { font-size: 13.5px; font-weight: 750; }
.deck-cover .cover-sub { font-size: 11px; color: var(--muted); font-weight: 600; }
.deck-cover.ghost { opacity: 0.6; outline: 1.5px dashed rgba(139,180,216,0.3); outline-offset: -1.5px; background: transparent; box-shadow: none; }
.deck-cover.ghost .cover-art { filter: grayscale(1); opacity: 0.7; }

.rivals { display: flex; flex-direction: column; gap: 10px; padding-bottom: 20px; }
.rival {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  border-radius: 18px;
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--line);
  animation: rise 0.4s cubic-bezier(0.2, 0, 0, 1) both;
  animation-delay: calc(var(--i) * 70ms);
}
.rival-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.rival-name { font-size: 15px; font-weight: 750; }
.rival-sub { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.chip.follow { font-size: 12.5px; }
.chip.follow.is-on { color: var(--accent-2); box-shadow: inset 0 0 0 1.5px rgba(91,180,232,0.45); background: rgba(91,180,232,0.1); }
.chip.duel { font-size: 15px; }

.overlay-hint { font-size: 12.5px; color: var(--muted); }
.overlay-actions { display: flex; align-items: center; gap: 8px; }
.ghost-btn.danger { color: #E8899B; }
.ghost-btn.danger.confirm { color: #F0647C; font-weight: 750; }

/* settings sheet */
.set-block { margin-bottom: 20px; }
.set-label { display: block; font-size: 11.5px; font-weight: 750; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.set-account { display: flex; align-items: center; gap: 12px; }
.set-account-meta { flex: 1; display: flex; flex-direction: column; gap: 1px; }
.set-account-meta b { font-size: 15px; font-weight: 750; }
.set-account-meta span { font-size: 12.5px; color: var(--muted); }
.set-langs { display: flex; gap: 8px; }
.set-about { font-size: 13px; color: var(--muted); }

.rename-input {
  width: 100%;
  height: 52px;
  border-radius: 14px;
  border: none;
  background: var(--panel-2);
  box-shadow: inset 0 0 0 1.5px var(--line);
  color: var(--text);
  font: inherit; font-size: 17px; font-weight: 700;
  padding: 0 16px;
  margin-bottom: 14px;
  outline: none;
}
.rename-input:focus { box-shadow: inset 0 0 0 1.5px var(--accent); }

/* ---------------------------------------------------------------- tabbar */
.tabbar {
  display: flex;
  padding: 8px 18px calc(var(--sab) + 10px);
  gap: 6px;
  background: color-mix(in oklab, var(--ink) 78%, transparent);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 -1px 0 var(--line);
}
.tab {
  flex: 1;
  min-height: 52px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px;
  border-radius: 14px;
  color: var(--muted);
  transition: color 0.2s, scale 0.15s;
}
.tab:active { scale: 0.96; }
.tab svg { width: 23px; height: 23px; }
.tab span { font-size: 10.5px; font-weight: 700; letter-spacing: 0.02em; }
.tab.is-active { color: var(--accent-2); }

/* the capture button — a mini app icon floating above the bar */
.tab-capture {
  width: 60px; height: 60px;
  margin-top: -22px;
  flex: none;
  align-self: flex-start;
  border-radius: 19px;
  color: #fff;
  background: linear-gradient(180deg, #7CC6F0, #2E7CC4);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.45),
    0 0 0 5px var(--ink),
    0 10px 26px rgba(61, 143, 209, 0.45);
  display: grid; place-items: center;
  transition: scale 0.15s;
}
.tab-capture:active { scale: 0.96; }
.tab-capture svg { width: 30px; height: 30px; }

/* ---------------------------------------------------------------- feed */
.feed { display: flex; flex-direction: column; gap: 14px; padding: 8px 0 20px; }
.post {
  border-radius: 20px;
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--line);
  padding: 14px;
  animation: rise 0.4s cubic-bezier(0.2, 0, 0, 1) both;
  animation-delay: calc(var(--i) * 60ms);
}
.post-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.post-line { flex: 1; font-size: 14px; color: var(--muted); }
.post-line b { color: var(--text); font-weight: 700; }
.post-time { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.post-card { width: 152px; margin: 0 auto; }
.post-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }
.post-like {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 40px; padding: 0 12px;
  border-radius: 12px;
  font-size: 16px; font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  transition: color 0.15s, scale 0.15s;
}
.post-like span { font-size: 13.5px; }
.post-like:active { scale: 0.96; }
.post-like.is-on { color: #F0647C; }
.post-duel {
  min-height: 40px; padding: 0 14px;
  border-radius: 12px;
  background: rgba(91, 180, 232, 0.1);
  box-shadow: inset 0 0 0 1px rgba(91, 180, 232, 0.35);
  color: var(--accent-2);
  font-size: 13.5px; font-weight: 750;
  transition: scale 0.15s;
}
.post-duel:active { scale: 0.96; }

/* ---------------------------------------------------------------- dex collections */
.title.sm { font-size: 20px; flex: 1; text-align: center; }
.col-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 10px 0 20px;
}
.col-tile {
  aspect-ratio: 1;
  border-radius: 22px;
  background:
    radial-gradient(90% 80% at 50% 108%, color-mix(in oklab, var(--rc, var(--accent)) 26%, transparent), transparent 66%),
    var(--panel);
  box-shadow: inset 0 0 0 1px var(--line);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 4px;
  transition: scale 0.15s;
  animation: rise 0.4s cubic-bezier(0.2, 0, 0, 1) both;
  animation-delay: calc(var(--i) * 55ms);
}
.col-tile:active { scale: 0.96; }
.col-em { font-size: 52px; filter: drop-shadow(0 10px 14px rgba(0,0,0,0.42)); margin-bottom: 4px; }
.col-name { font-size: 16px; font-weight: 800; letter-spacing: -0.01em; }
.col-count { font-size: 11.5px; color: var(--muted); font-weight: 650; font-variant-numeric: tabular-nums; }
.col-tile.ghost {
  background: transparent;
  box-shadow: none;
  outline: 1.5px dashed rgba(139, 180, 216, 0.32);
  outline-offset: -1.5px;
}
.col-tile.ghost .col-em { filter: none; opacity: 0.85; }
.col-tile.ghost .col-name { color: var(--accent); }

/* ---------------------------------------------------------------- capture flow */
.capture {
  position: absolute; inset: 0;
  z-index: 60;
  background: #05090F;
  overflow: hidden;
}
.capture[hidden] { display: none; }
#cam {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.cap-fallback {
  position: absolute; inset: 0;
  background:
    radial-gradient(70% 46% at 50% 42%, rgba(91, 180, 232, 0.2), transparent 70%),
    radial-gradient(120% 80% at 50% 110%, #12283E, transparent 70%),
    linear-gradient(180deg, #0A1624, #060B12);
  display: grid; place-items: end center;
  padding-bottom: 180px;
}
.cap-fallback-note { font-size: 12px; color: var(--muted); letter-spacing: 0.04em; }
.cap-dim { position: absolute; inset: 0; background: rgba(5, 8, 13, 0.5); }

/* the reticle — same corner brackets as the brand */
.cap-reticle {
  position: absolute;
  top: 50%; left: 50%;
  width: min(62vw, 250px); aspect-ratio: 1;
  translate: -50% -58%;
  pointer-events: none;
}
.cap-reticle i {
  position: absolute;
  width: 34px; height: 34px;
  border: 3.5px solid rgba(255, 255, 255, 0.95);
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.45));
}
.cap-reticle i:nth-child(1) { top: 0; left: 0; border-right: 0; border-bottom: 0; border-top-left-radius: 12px; }
.cap-reticle i:nth-child(2) { top: 0; right: 0; border-left: 0; border-bottom: 0; border-top-right-radius: 12px; }
.cap-reticle i:nth-child(3) { bottom: 0; left: 0; border-right: 0; border-top: 0; border-bottom-left-radius: 12px; }
.cap-reticle i:nth-child(4) { bottom: 0; right: 0; border-left: 0; border-top: 0; border-bottom-right-radius: 12px; }

.scanband {
  position: absolute; left: 0; right: 0; top: -180px;
  height: 180px;
  pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(91, 180, 232, 0.16) 55%, rgba(91, 180, 232, 0.42) 92%, transparent);
  animation: sweep 1.5s cubic-bezier(0.45, 0, 0.55, 1) infinite alternate;
}
.scanband i {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 2.5px;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
}
@keyframes sweep { from { transform: translateY(0); } to { transform: translateY(calc(100dvh + 180px)); } }

.cap-hint {
  position: absolute;
  left: 0; right: 0;
  bottom: calc(var(--sab) + 132px);
  text-align: center;
  color: #fff;
  font-size: 15px; font-weight: 700;
  text-shadow: 0 2px 10px rgba(0,0,0,0.6);
}
.cap-close {
  position: absolute;
  top: calc(var(--sat) + 14px); left: 16px;
  background: rgba(8, 13, 20, 0.55);
  color: #fff;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.cap-shutter {
  position: absolute;
  left: 50%; bottom: calc(var(--sab) + 40px);
  translate: -50%;
  width: 78px; height: 78px;
  border-radius: 24px;
  background: linear-gradient(180deg, #7CC6F0, #2E7CC4);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.45),
    0 0 0 4px rgba(255, 255, 255, 0.92),
    0 14px 34px rgba(0, 0, 0, 0.5);
  display: grid; place-items: center;
  transition: scale 0.15s;
}
.cap-shutter:active { scale: 0.96; }
.cap-shutter svg { width: 40px; height: 40px; }

.cap-reveal {
  position: absolute; inset: 0;
  background: rgba(4, 8, 14, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 18px;
  padding: 20px;
}
.cap-reveal[hidden] { display: none; }
.cap-reveal-label {
  font-size: 21px; font-weight: 850; letter-spacing: -0.01em;
  animation: pop 0.5s cubic-bezier(0.2, 0, 0, 1) 0.1s both;
}
.cap-reveal .card { width: min(272px, 68vw, 34dvh); animation: capCard 0.65s cubic-bezier(0.2, 0, 0, 1) both; }
@keyframes capCard {
  0% { opacity: 0; transform: translateY(26px) scale(0.85) rotate(-3deg); }
  100% { opacity: 1; transform: none; }
}
.cap-actions {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  width: min(300px, 80%);
  animation: rise 0.4s cubic-bezier(0.2, 0, 0, 1) 0.35s both;
}

/* ---------------------------------------------------------------- overlay & sheets */
.overlay { position: absolute; inset: 0; z-index: 40; display: grid; place-items: center; }
.overlay[hidden], .sheet[hidden] { display: none; }
.overlay-backdrop, .sheet-backdrop {
  position: absolute; inset: 0;
  background: rgba(4, 8, 14, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fadeIn 0.25s both;
}
.overlay-body {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  animation: pop 0.4s cubic-bezier(0.2, 0, 0, 1) both;
}
.overlay-card .card { width: min(292px, 74vw); }

.sheet { position: absolute; inset: 0; z-index: 50; }
.sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: var(--panel);
  border-radius: 26px 26px 0 0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.09), 0 -18px 50px rgba(0,0,0,0.5);
  padding: 10px 20px calc(var(--sab) + 22px);
  max-height: 72%;
  overflow-y: auto;
  animation: sheetUp 0.35s cubic-bezier(0.2, 0, 0, 1) both;
}
.sheet-handle { width: 38px; height: 4px; border-radius: 2px; background: rgba(139,180,216,0.35); margin: 4px auto 14px; }
.sheet-title { font-size: 19px; font-weight: 800; letter-spacing: -0.01em; margin-bottom: 14px; }
.picker-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.howto-list { padding-left: 20px; display: flex; flex-direction: column; gap: 10px; color: var(--text); font-size: 15px; line-height: 1.5; }
.howto-list b { color: var(--accent-2); }
.howto-foot { margin-top: 16px; color: var(--muted); font-size: 13.5px; text-wrap: pretty; }

/* ---------------------------------------------------------------- motion */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(0.92) translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheetUp { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }

.stagger > * { animation: rise 0.45s cubic-bezier(0.2, 0, 0, 1) both; }
.stagger > *:nth-child(1) { animation-delay: 0ms; }
.stagger > *:nth-child(2) { animation-delay: 90ms; }
.stagger > *:nth-child(3) { animation-delay: 180ms; }
.stagger > *:nth-child(4) { animation-delay: 270ms; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
