/* Dueling App — face-lift design tokens */
:root {
  /* palette — anchored on the current dark navy + gold */
  --bg-0:    #0B1220;     /* app background */
  --bg-1:    #111A2C;     /* raised surface */
  --bg-2:    #172235;     /* card */
  --bg-3:    #1F2D45;     /* card hover / input */
  --line:    rgba(255,255,255,0.06);
  --line-strong: rgba(255,255,255,0.10);

  --text:    #F3F5FA;
  --text-2:  #B3BBCE;     /* secondary */
  --text-3:  #7C869E;     /* tertiary / meta */
  --text-4:  #4F5A74;

  --gold:     #FFC53D;
  --gold-2:   #FFD76B;
  --gold-ink: #1A1203;    /* text on gold */
  --gold-dim: rgba(255,197,61,0.14);

  --danger:  #FF5D6C;
  --success: #3DDC97;
  --info:    #5BB5FF;
  --live:    #FF5D6C;

  /* spacing & radius */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-pill: 999px;

  --shadow-card: 0 1px 0 rgba(255,255,255,0.04) inset, 0 10px 24px -12px rgba(0,0,0,0.6);
  --shadow-soft: 0 8px 30px -8px rgba(0,0,0,0.5);
}

/* density variants */
.density-airy      { --pad-y: 18px; --pad-x: 16px; --row-h: 72px; --gap: 14px; }
.density-balanced  { --pad-y: 14px; --pad-x: 14px; --row-h: 64px; --gap: 12px; }
.density-dense     { --pad-y: 10px; --pad-x: 12px; --row-h: 56px; --gap: 8px;  }

/* accent variants — keep gold primary, offer subtle shifts */
.accent-gold      { --accent: var(--gold); --accent-2: var(--gold-2); --accent-ink: var(--gold-ink); --accent-dim: var(--gold-dim); }
.accent-amber     { --accent: #F5A524; --accent-2: #FFBE4A; --accent-ink: #1A0F00; --accent-dim: rgba(245,165,36,0.16); }
.accent-electric  { --accent: #FFE155; --accent-2: #FFED8A; --accent-ink: #171200; --accent-dim: rgba(255,225,85,0.14); }

/* style variants — how much "gamified" we go */
.style-clean    { --display-font: "Sora", ui-sans-serif, system-ui; --body-font: "Sora", system-ui; --title-weight: 700; --title-tracking: -0.01em; }
.style-editorial{ --display-font: "Fraunces", Georgia, serif; --body-font: "Sora", system-ui; --title-weight: 600; --title-tracking: -0.02em; }
.style-arena    { --display-font: "Oswald", Impact, sans-serif; --body-font: "Sora", system-ui; --title-weight: 600; --title-tracking: 0.02em; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: #0E111A; color: var(--text); font-family: var(--body-font, "Sora", system-ui); -webkit-font-smoothing: antialiased; }
button { color: inherit; font-family: inherit; }

/* ── app surface inside the iOS frame ── */
.app {
  position: absolute; inset: 0;
  background: var(--bg-0);
  color: var(--text);
  display: flex; flex-direction: column;
  font-family: var(--body-font);
  overflow: hidden;
}
.app-scroll {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding-bottom: 110px;  /* clear tab bar */
  scrollbar-width: none;
}
.app-scroll::-webkit-scrollbar { display: none; }

/* ── top bar — sticky at top, content scrolls behind it ── */
.topbar {
  position: sticky; top: 0; z-index: 10;
  padding: 62px 20px 22px;
  background: var(--bg-0);
  display: flex; align-items: center; gap: 12px;
}
.topbar .spacer { flex: 1; }
.iconbtn {
  width: 40px; height: 40px; border-radius: var(--r-md);
  background: var(--bg-2); display: grid; place-items: center;
  color: var(--text-2); border: 1px solid var(--line);
  cursor: pointer; flex-shrink: 0;
}
.iconbtn:hover { background: var(--bg-3); color: var(--text); }
.iconbtn.ghost { background: transparent; border: none; }

.title-xl {
  font-family: var(--display-font);
  font-weight: var(--title-weight);
  letter-spacing: var(--title-tracking);
  font-size: 28px; line-height: 1.1; color: var(--text);
}
.title-lg {
  font-family: var(--display-font);
  font-weight: var(--title-weight);
  letter-spacing: var(--title-tracking);
  font-size: 22px; line-height: 1.15;
}
.title-md {
  font-family: var(--display-font);
  font-weight: 600; font-size: 17px; letter-spacing: -0.01em;
}
.eyebrow {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--text-3); font-weight: 600;
}
.meta { font-size: 12.5px; color: var(--text-3); }
.body { font-size: 14px; color: var(--text-2); line-height: 1.5; }
.num-stat {
  font-family: var(--display-font);
  font-feature-settings: "tnum" 1, "lnum" 1;
  font-weight: 700; letter-spacing: -0.02em;
}

/* ── cards ── */
.card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--pad-y, 14px) var(--pad-x, 14px);
  box-shadow: var(--shadow-card);
}
.card.flush { padding: 0; overflow: hidden; }
.card-row {
  display: flex; align-items: center; gap: 12px;
}

/* ── chips / pills ── */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 10px; border-radius: var(--r-pill);
  font-size: 12px; font-weight: 600; color: var(--text-2);
  background: var(--bg-3);
  border: 1px solid var(--line-strong);
}
.chip.accent {
  background: var(--accent-dim); color: var(--accent);
  border-color: transparent;
}
.chip.live {
  background: rgba(255,93,108,0.14); color: var(--live);
  border-color: rgba(255,93,108,0.3);
}
.chip.success {
  background: rgba(61,220,151,0.12); color: var(--success);
  border-color: rgba(61,220,151,0.25);
}
.chip.ghost {
  background: transparent;
}

@keyframes livePulse {
  0%   { box-shadow: 0 0 0 0 rgba(255,93,108,0.55); }
  70%  { box-shadow: 0 0 0 7px rgba(255,93,108,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,93,108,0); }
}

/* ── segmented control ── */
.segmented {
  display: inline-flex; padding: 4px; gap: 2px;
  background: var(--bg-2); border-radius: 14px;
  border: 1px solid var(--line);
}
.segmented button {
  appearance: none; border: 0; background: transparent;
  color: var(--text-2); font-weight: 600; font-size: 13.5px;
  padding: 9px 16px; border-radius: 10px;
  cursor: pointer; white-space: nowrap;
  font-family: inherit;
  transition: all .15s ease;
}
.segmented button.active {
  background: var(--accent); color: var(--accent-ink);
  box-shadow: 0 4px 12px -4px rgba(255,197,61,0.5);
}
.segmented.full { display: flex; width: 100%; }
.segmented.full button { flex: 1; text-align: center; padding-inline: 10px; }

/* ── search field ── */
.search {
  display: flex; align-items: center; gap: 10px;
  height: 44px; padding: 0 14px;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--r-md); color: var(--text-2);
}
.search input {
  flex: 1; background: transparent; border: 0; outline: none;
  color: var(--text); font-size: 15px;
  font-family: inherit;
}
.search input::placeholder { color: var(--text-3); }

/* ── buttons ── */
.btn {
  appearance: none; border: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 46px; padding: 0 18px; border-radius: 14px;
  font-weight: 700; font-size: 15px; font-family: inherit;
  transition: transform .08s ease, filter .15s ease;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: var(--accent); color: var(--accent-ink);
  box-shadow: 0 10px 24px -10px rgba(255,197,61,0.6);
}
.btn-primary:hover { filter: brightness(1.06); }
.btn-secondary {
  background: var(--bg-2); color: var(--text); border: 1px solid var(--line-strong);
}
.btn-danger {
  background: transparent; color: var(--danger); border: 1px solid rgba(255,93,108,0.4);
}
.btn-block { width: 100%; }

/* ── tab bar ── */
.tabbar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 30;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 24px));
  padding-bottom: 34px;
  background: linear-gradient(to top, var(--bg-0) 60%, rgba(11,18,32,0.0));
}
.tabbar-inner {
  display: flex; justify-content: space-around; align-items: center;
  background: rgba(17,26,44,0.72);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  padding: 8px;
  box-shadow: 0 20px 40px -20px rgba(0,0,0,0.6);
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 4px; border-radius: 14px;
  color: var(--text-3); font-size: 10.5px; font-weight: 600;
  cursor: pointer; border: 0; background: transparent; font-family: inherit;
  position: relative;
}
.tab svg { width: 22px; height: 22px; }
.tab.active { color: var(--accent); }
.tab.active::before {
  content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 22px; height: 2px; border-radius: 2px; background: var(--accent);
}

/* ── divider ── */
.divider { height: 1px; background: var(--line); margin: 12px 0; }
.v-divider { width: 1px; background: var(--line); align-self: stretch; }

/* ── utility ── */
.stack { display: flex; flex-direction: column; gap: var(--gap, 12px); }
.row   { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.pad { padding: 0 20px; }
.pad-top  { padding-top: 8px; }
.pad-bot  { padding-bottom: 18px; }
.center { display: grid; place-items: center; }

/* ── placeholder art: card-art gradient tiles ── */
.art {
  position: relative; overflow: hidden; border-radius: var(--r-md);
  background: linear-gradient(135deg, #2A3656 0%, #101828 100%);
  display: grid; place-items: center; color: var(--text-3); font-size: 12px;
}
.art.p-fire    { background: radial-gradient(120% 80% at 30% 20%, #FF8A5B 0%, #B24123 45%, #3A1706 100%); }
.art.p-water   { background: radial-gradient(120% 80% at 30% 20%, #6BB6FF 0%, #2A5FA8 45%, #0A1B39 100%); }
.art.p-grass   { background: radial-gradient(120% 80% at 30% 20%, #7BDE8A 0%, #2B7A3F 45%, #0A2416 100%); }
.art.p-bolt    { background: radial-gradient(120% 80% at 30% 20%, #FFE081 0%, #D68F13 45%, #3B2100 100%); }
.art.p-dark    { background: radial-gradient(120% 80% at 30% 20%, #7A6BFF 0%, #3B2A8A 45%, #120A2F 100%); }
.art.p-steel   { background: radial-gradient(120% 80% at 30% 20%, #B8C3D0 0%, #566475 45%, #121820 100%); }
.art.p-void    { background: radial-gradient(120% 80% at 30% 20%, #FF6BB6 0%, #7A2A6B 45%, #1A0620 100%); }

/* soft grid overlay for texture on art */
.art::after {
  content: ''; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 14px 14px;
  pointer-events: none;
}

/* ── TCG card-art tile (portrait) ── */
.tcg-card {
  aspect-ratio: 5/7;
  border-radius: 12px;
  position: relative;
  overflow: hidden;
  border: 2px solid rgba(255,255,255,0.08);
}
.tcg-card .art { position: absolute; inset: 0; border-radius: 10px; }
.tcg-card .frame-text {
  position: absolute; left: 8px; right: 8px; bottom: 8px;
  color: rgba(0,0,0,0.85); font-weight: 700; font-size: 10px;
  text-shadow: 0 1px 0 rgba(255,255,255,0.2);
}
.tcg-card .holo {
  position: absolute; inset: 0;
  background: linear-gradient(120deg, rgba(255,255,255,0) 40%, rgba(255,255,255,0.25) 50%, rgba(255,255,255,0) 60%);
  mix-blend-mode: overlay;
  pointer-events: none;
}

/* ── bracket connectors for live screen ── */
.bracket-line {
  border-left: 1px solid var(--line-strong);
}

/* ── avatar ── */
.avatar {
  width: 44px; height: 44px; border-radius: 50%; overflow: hidden;
  background: linear-gradient(135deg, var(--bg-3), var(--bg-2));
  display: grid; place-items: center; color: var(--text-2);
  font-weight: 700; font-size: 15px; flex-shrink: 0;
  border: 1px solid var(--line-strong);
}
.avatar.lg { width: 80px; height: 80px; font-size: 26px; }
.avatar.xl { width: 112px; height: 112px; font-size: 34px; }
.avatar.sm { width: 32px; height: 32px; font-size: 12px; }

/* ── logo mark ── */
.logo-mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent) 0%, #D79618 100%);
  display: grid; place-items: center;
  color: var(--accent-ink);
  font-family: var(--display-font);
  font-weight: 800; font-size: 18px;
  box-shadow: 0 6px 16px -6px rgba(255,197,61,0.6);
  position: relative;
}
.logo-mark::after {
  content: ''; position: absolute; inset: 0; border-radius: 10px;
  background: linear-gradient(180deg, rgba(255,255,255,0.25), transparent 50%);
  pointer-events: none;
}

/* ── "game mark" — little shield for TCG type ── */
.game-mark {
  width: 28px; height: 28px; border-radius: 8px;
  display: grid; place-items: center;
  font-weight: 800; font-size: 12px;
  color: #fff; flex-shrink: 0;
  font-family: var(--display-font);
}
.game-mark.pokemon { background: linear-gradient(135deg, #ffd000, #c28300); color: #2a1a00; }
.game-mark.mtg     { background: linear-gradient(135deg, #c5a77d, #3c3125); }
.game-mark.yugioh  { background: linear-gradient(135deg, #9d2e38, #4e1015); }
.game-mark.onepiece{ background: linear-gradient(135deg, #e84545, #6b1818); }
.game-mark.lorcana { background: linear-gradient(135deg, #7ea8e0, #243c5e); }

/* ── toggle (switch) ── */
.switch { width: 42px; height: 26px; border-radius: 13px; background: var(--bg-3); position: relative; cursor: pointer; transition: background .15s; flex-shrink: 0; border: 1px solid var(--line-strong); }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch.on { background: var(--accent); border-color: transparent; }
.switch.on::after { transform: translateX(16px); }

/* ── scrollable horizontal ── */
.hscroll {
  display: flex; gap: 12px;
  overflow-x: auto; scroll-snap-type: x mandatory;
  padding: 0 20px 4px;
  scrollbar-width: none;
}
.hscroll::-webkit-scrollbar { display: none; }
.hscroll > * { scroll-snap-align: start; flex-shrink: 0; }

/* ── tweak panel ── */
.tweak-fab {
  position: absolute; right: 16px; bottom: 118px; z-index: 40;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--bg-2); border: 1px solid var(--line-strong);
  display: grid; place-items: center; color: var(--accent);
  cursor: pointer; box-shadow: var(--shadow-soft);
}
.tweak-panel {
  position: absolute; right: 12px; bottom: 170px; z-index: 41;
  width: 260px; background: rgba(17,26,44,0.92);
  backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid var(--line-strong);
  border-radius: 18px; padding: 14px;
  box-shadow: 0 20px 60px -20px rgba(0,0,0,0.8);
  color: var(--text);
}
.tweak-row {
  display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap;
}
.tweak-chip {
  padding: 7px 10px; border-radius: 10px;
  background: var(--bg-2); color: var(--text-2);
  border: 1px solid var(--line); font-size: 12px;
  cursor: pointer; font-family: inherit; font-weight: 600;
}
.tweak-chip.active { background: var(--accent); color: var(--accent-ink); border-color: transparent; }

/* screen picker top strip */
.screen-picker {
  position: absolute; left: 12px; top: 12px; z-index: 60;
  background: rgba(17,26,44,0.92);
  backdrop-filter: blur(16px);
  border: 1px solid var(--line-strong);
  border-radius: 14px; padding: 8px;
  display: flex; gap: 4px; flex-wrap: wrap;
  max-width: calc(100% - 24px);
}
.screen-pill {
  padding: 6px 10px; font-size: 11.5px; font-weight: 600;
  border-radius: 9px; background: transparent; color: var(--text-2);
  border: 0; cursor: pointer; font-family: inherit;
}
.screen-pill.active { background: var(--accent); color: var(--accent-ink); }

/* small helpers */
.mt-4 { margin-top: 4px; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-20 { margin-top: 20px; } .mt-24 { margin-top: 24px; } .mt-32 { margin-top: 32px; }
.mb-4 { margin-bottom: 4px; } .mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; }
.px-20 { padding-inline: 20px; }
.gap-6 { gap: 6px; } .gap-8 { gap: 8px; } .gap-10 { gap: 10px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
