/* ════════════════════════════════════════════════════════════════════
   M.U.S.C.L.E. Collector — app.css  (v0.10)
   ────────────────────────────────────────────────────────────────────
   Visual system: "The Arena." M.U.S.C.L.E. is the US release of
   Kinnikuman's Kinkeshi — intergalactic wrestling erasers from Japan.
   So the identity fuses two worlds: sumi-ink + washi + hinomaru red
   (the Kinkeshi heritage) with championship-belt gold + ring ropes (the
   wrestling premise). The signature is the title-belt completion meter.
   Two themes via [data-theme]; Arena (dark) is default.
   ════════════════════════════════════════════════════════════════════ */

/* § TOKENS ─────────────────────────────────────────────────────────── */
:root {
  --font-display: 'Anton', 'Arial Narrow', system-ui, sans-serif;
  --font-body: 'Barlow Semi Condensed', system-ui, -apple-system, sans-serif;
  /* Kanji accents use the platform Japanese font (self-contained, no
     external download). Present on iOS, Android, macOS and Windows. */
  --font-jp: 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic',
             'Yu Gothic UI', 'Noto Sans JP', 'Noto Sans CJK JP', 'Meiryo',
             var(--font-body);

  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 22px;
  --maxw: 520px;

  --ease: cubic-bezier(.4, 0, .2, 1);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tabbar-h: 62px;
}

/* Arena — sumi ink night, hinomaru red, belt gold, keshi salmon */
[data-theme="arena"] {
  --bg: #14100D; --bg2: #1E1813; --bg3: #2A211A; --bd: #3A2E24;
  --acc: #E23B2E; --acc-d: #A81E1E;
  --gold: #E3A93C; --gold-d: #B9822A; --gold-l: #F4CD73;
  --flesh: #E7A794; --flesh-d: #C77E6A;
  --fg: #F7EEE6; --fg2: #C6B3A6; --fg3: #8A7869;
  --owned: var(--gold);
  --scrim: rgba(8, 5, 3, .68);
  --tile-bg: #241C16;
  --ghost-line: rgba(231, 167, 148, .16);
  --plate-1: #F4CD73; --plate-2: #D79E33; --plate-3: #A9781F;
  --leather: #241713;
  color-scheme: dark;
}

/* Poster — washi paper, sumi ink, muted red + brass */
[data-theme="poster"] {
  --bg: #EFE6D5; --bg2: #FBF6EC; --bg3: #E9DEC9; --bd: #D6C6A8;
  --acc: #C0281F; --acc-d: #9E1E17;
  --gold: #B0812A; --gold-d: #8A6520; --gold-l: #D3A544;
  --flesh: #D98C72; --flesh-d: #B96F58;
  --fg: #241A12; --fg2: #55452F; --fg3: #8B7A63;
  --owned: var(--gold);
  --scrim: rgba(40, 26, 18, .46);
  --tile-bg: #F4ECDD;
  --ghost-line: rgba(120, 90, 60, .22);
  --plate-1: #E6C878; --plate-2: #C69A3B; --plate-3: #9A7526;
  --leather: #C9B893;
  color-scheme: light;
}

/* § RESET / BASE ───────────────────────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--fg);
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}
button { font-family: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 16px; color: var(--fg); }
svg { display: block; }
img { max-width: 100%; }
::selection { background: var(--acc); color: #fff; }

/* The app is a centered "arena floor" column; the page behind is the ink. */
#app {
  max-width: var(--maxw);
  margin: 0 auto;
  min-height: 100%;
  background: var(--bg);
  position: relative;
}
@media (min-width: 560px) {
  body {
    background:
      radial-gradient(120% 80% at 50% -10%, color-mix(in srgb, var(--acc) 12%, transparent), transparent 60%),
      var(--bg);
  }
  #app {
    box-shadow: 0 0 0 1px var(--bd), 0 40px 120px rgba(0, 0, 0, .5);
  }
}

.dim { color: var(--fg3); }
.sm { font-size: 13px; }
.center { text-align: center; }
.pad { padding: 40px 22px; }
.kanji { font-family: var(--font-jp); font-weight: 700; }

/* § SCROLL AREAS ───────────────────────────────────────────────────── */
.scroll {
  padding: 14px 14px calc(var(--tabbar-h) + var(--safe-bottom) + 20px);
  min-height: calc(100vh - 54px);
}
.scroll::-webkit-scrollbar { width: 0; }

/* § TOPBAR ─────────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  padding: calc(var(--safe-top) + 10px) 16px 12px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  border-bottom: 1px solid var(--bd);
}
/* Ring ropes: three taut lines under the header — the squared circle. */
.topbar::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 4px;
  background:
    linear-gradient(var(--acc), var(--acc)) left / 100% 1px no-repeat,
    linear-gradient(var(--gold), var(--gold)) left center / 100% 1px no-repeat,
    linear-gradient(var(--flesh), var(--flesh)) left bottom / 100% 1px no-repeat;
  opacity: .55;
}
.brand { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.hinomaru {
  width: 12px; height: 12px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--acc) 70%, #fff), var(--acc));
  box-shadow: 0 0 10px color-mix(in srgb, var(--acc) 60%, transparent);
  align-self: center; flex: none;
}
.wordmark {
  font-family: var(--font-display);
  font-size: 25px; letter-spacing: .5px; line-height: 1;
  color: var(--fg);
  text-shadow: 0 1px 0 rgba(0, 0, 0, .3);
}
.kanji { color: var(--gold); font-size: 15px; opacity: .85; }
.brand .kanji { align-self: center; }

.icon-btn {
  display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 12px;
  color: var(--fg2);
  border: 1px solid transparent;
  transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover { background: var(--bg3); color: var(--fg); }
.icon-btn:active { transform: scale(.94); }

/* § TABBAR ─────────────────────────────────────────────────────────── */
.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0;
  width: 100%; max-width: var(--maxw); z-index: 30;
  display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: color-mix(in srgb, var(--bg2) 94%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--bd);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; color: var(--fg3); position: relative;
  font-size: 11px; font-weight: 600; letter-spacing: .3px;
  transition: color .15s;
}
.tab svg { width: 22px; height: 22px; stroke-width: 2; }
.tab.on { color: var(--gold); }
.tab.on::before {
  content: ""; position: absolute; top: 0; width: 26px; height: 3px; border-radius: 0 0 3px 3px;
  background: var(--gold); box-shadow: 0 0 10px color-mix(in srgb, var(--gold) 70%, transparent);
}
.tab:active { transform: scale(.92); }

/* § BELT — the signature completion meter ──────────────────────────── */
.belt { padding: 6px 4px 16px; }
.belt-plate {
  position: relative;
  margin: 0 auto;
  padding: 16px 20px 18px;
  border-radius: 20px 20px 26px 26px / 22px 22px 34px 34px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--plate-1) 30%, var(--bg2)) 0%, var(--bg2) 42%),
    var(--bg2);
  border: 1.5px solid var(--gold-d);
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, var(--gold-l) 45%, transparent),
    inset 0 0 26px rgba(0, 0, 0, .35),
    0 10px 30px rgba(0, 0, 0, .35);
  text-align: center;
  overflow: hidden;
}
/* Gold rivets in the plate corners */
.belt-plate::before, .belt-plate::after {
  content: ""; position: absolute; top: 12px; width: 7px; height: 7px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--plate-1), var(--plate-3));
  box-shadow: 0 0 4px rgba(0, 0, 0, .4);
}
.belt-plate::before { left: 14px; }
.belt-plate::after { right: 14px; }

.belt-eyebrow {
  font-family: var(--font-jp); font-weight: 700;
  font-size: 11px; letter-spacing: 2px; text-transform: uppercase;
  color: var(--gold); opacity: .9; margin-bottom: 4px;
}
.belt-count {
  font-family: var(--font-display);
  font-size: clamp(46px, 15vw, 62px); line-height: .9; letter-spacing: 1px;
  display: flex; align-items: baseline; justify-content: center; gap: 6px;
}
.belt-count .have {
  color: var(--gold-l); /* solid fallback if background-clip:text is unsupported */
  background: linear-gradient(180deg, var(--plate-1), var(--plate-2) 60%, var(--plate-3));
  -webkit-background-clip: text; background-clip: text;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .3));
}
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .belt-count .have { -webkit-text-fill-color: transparent; }
}
.belt-count .slash { color: var(--bd); font-size: .7em; }
.belt-count .total { color: var(--fg2); font-size: .7em; }

/* Leather strap = progress track */
.belt-track {
  margin: 12px auto 8px; height: 12px; border-radius: 7px; overflow: hidden;
  background:
    repeating-linear-gradient(90deg, transparent 0 5px, rgba(0, 0, 0, .12) 5px 6px),
    linear-gradient(180deg, color-mix(in srgb, var(--leather) 80%, #000), var(--leather));
  border: 1px solid rgba(0, 0, 0, .4);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .5);
}
.belt-fill {
  height: 100%; border-radius: 6px;
  background: linear-gradient(180deg, var(--plate-1), var(--plate-2) 55%, var(--plate-3));
  box-shadow: 0 0 12px color-mix(in srgb, var(--gold) 55%, transparent), inset 0 1px 0 rgba(255, 255, 255, .4);
  transition: width .6s var(--ease);
}
.belt-meta {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px;
  font-size: 12.5px; font-weight: 600; color: var(--fg2); letter-spacing: .2px;
}
.belt-meta span { white-space: nowrap; }

/* § FACETS (own filter + color swatches) ───────────────────────────── */
.facets { margin: 4px 2px 14px; display: flex; flex-direction: column; gap: 10px; }
.chips { display: flex; gap: 7px; flex-wrap: wrap; }
.chip {
  padding: 7px 15px; border-radius: 999px;
  font-size: 13.5px; font-weight: 600; letter-spacing: .2px;
  color: var(--fg2); background: var(--bg2); border: 1px solid var(--bd);
  transition: all .14s;
}
.chip:active { transform: scale(.95); }
.chip.on { color: #fff; background: var(--acc); border-color: var(--acc); box-shadow: 0 3px 12px color-mix(in srgb, var(--acc) 40%, transparent); }
[data-theme="poster"] .chip.on { color: #fff; }

.swatches { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }
.sw {
  width: 28px; height: 28px; border-radius: 50%; padding: 0;
  border: 2px solid var(--bd); position: relative;
  display: grid; place-items: center; transition: transform .12s, border-color .12s;
}
.sw span { width: 100%; height: 100%; border-radius: 50%; background: var(--sw); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .18); }
.sw:active { transform: scale(.9); }
.sw.on { border-color: var(--gold); transform: scale(1.08); box-shadow: 0 0 0 2px color-mix(in srgb, var(--gold) 45%, transparent); }
.sw-any {
  width: auto; height: 28px; padding: 0 12px; border-radius: 999px;
  font-size: 12.5px; font-weight: 700; color: var(--fg2); background: var(--bg2);
}
.sw-any.on { color: var(--gold); border-color: var(--gold); }

/* § POSTER WALL (the numbered set) ─────────────────────────────────── */
.poster {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 8px;
}
.tile {
  position: relative; aspect-ratio: 1 / 1.14;
  border-radius: 12px; padding: 6px;
  background: var(--tile-bg);
  border: 1px solid var(--bd);
  display: flex; align-items: center; justify-content: center;
  transition: transform .12s, border-color .15s, box-shadow .15s;
  overflow: hidden;
}
.tile:active { transform: scale(.94); }
.tile-fig { width: 62%; display: block; }
.tile-fig svg { width: 100%; height: auto; }
.tile-num {
  position: absolute; left: 6px; bottom: 3px;
  font-family: var(--font-display); font-size: 15px; line-height: 1;
  color: var(--fg3); letter-spacing: .5px;
}
.tile-flag {
  position: absolute; top: 4px; right: 4px; color: var(--acc);
  display: grid; place-items: center;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .4));
}

/* Missing = ghost outline keshi (expected while collecting) */
.tile.ghost .tile-fig { color: var(--ghost-line); }
.tile.ghost { border-style: dashed; border-color: color-mix(in srgb, var(--bd) 80%, transparent); }

/* Owned = keshi filled with the color you have, gold frame, champion glow */
.tile.owned {
  border-color: var(--gold-d);
  background:
    radial-gradient(120% 120% at 50% 20%, color-mix(in srgb, var(--tint) 22%, transparent), transparent 70%),
    var(--tile-bg);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--gold) 30%, transparent);
}
.tile.owned .tile-fig { color: var(--tint); filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .35)); }
.tile.owned .tile-num { color: var(--gold-l); }

/* § ROWS (browse list) ─────────────────────────────────────────────── */
.rows { display: flex; flex-direction: column; gap: 6px; }
.row {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 10px 9px 6px; border-radius: 14px;
  background: var(--bg2); border: 1px solid var(--bd);
  transition: transform .1s, border-color .15s;
  cursor: pointer;
}
.row:active { transform: scale(.99); }
.row-num {
  font-family: var(--font-display); font-size: 20px; min-width: 34px; text-align: center;
  color: var(--fg3); letter-spacing: .5px; flex: none;
}
.row-fig { width: 30px; height: 40px; flex: none; display: grid; place-items: center; }
.row-fig svg { width: 100%; height: 100%; }
.row-fig.ghost { color: var(--ghost-line); }
.row-fig.owned { color: var(--flesh); }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-name { font-weight: 600; font-size: 15px; color: var(--fg); }
.row-name .dim { font-weight: 500; }
.row-origin { font-size: 12.5px; color: var(--fg3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-dots { display: flex; gap: 3px; margin-top: 3px; }
.row-dots i { width: 9px; height: 9px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .2); }
.row-star {
  flex: none; width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center; color: var(--fg3);
  border: 1px solid transparent; transition: all .14s;
}
.row-star:active { transform: scale(.88); }
.row-star.on { color: var(--gold); }
.row-star.on svg { fill: var(--gold); filter: drop-shadow(0 0 6px color-mix(in srgb, var(--gold) 55%, transparent)); }

.result-count { font-size: 12.5px; font-weight: 600; color: var(--fg3); letter-spacing: .3px; margin: 0 4px 10px; text-transform: uppercase; }

/* § SEARCH BAR ─────────────────────────────────────────────────────── */
.searchbar {
  display: flex; align-items: center; gap: 8px;
  padding: 0 12px; margin: 2px 2px 12px; height: 46px;
  background: var(--bg2); border: 1px solid var(--bd); border-radius: 14px;
}
.search-ico { color: var(--fg3); flex: none; display: grid; place-items: center; }
.search-input { flex: 1; background: none; border: none; outline: none; height: 100%; }
.search-input::placeholder { color: var(--fg3); }
.search-clear { color: var(--fg3); display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; }
.search-clear:active { background: var(--bg3); }

/* § COLLECTION (Mine) ──────────────────────────────────────────────── */
.mine-head {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  margin: 2px 2px 16px;
}
.mine-stat {
  background: var(--bg2); border: 1px solid var(--bd); border-radius: 14px;
  padding: 12px 8px; text-align: center;
}
.mine-stat b { display: block; font-family: var(--font-display); font-size: 28px; color: var(--gold); line-height: 1; }
.mine-stat span { font-size: 11.5px; font-weight: 600; color: var(--fg3); text-transform: uppercase; letter-spacing: .3px; }

.sec-h {
  font-family: var(--font-display); font-size: 17px; letter-spacing: .5px;
  color: var(--fg); margin: 20px 4px 12px; text-transform: uppercase;
  display: flex; align-items: center; gap: 8px;
}
.sec-h span {
  font-family: var(--font-body); font-size: 12px; font-weight: 700;
  color: var(--bg); background: var(--gold); padding: 2px 8px; border-radius: 999px; letter-spacing: 0;
}

/* § STATS ──────────────────────────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 4px 2px 6px; }
.stat-card {
  background: var(--bg2); border: 1px solid var(--bd); border-radius: 16px; padding: 16px 14px;
}
.stat-card b { display: block; font-family: var(--font-display); font-size: 34px; color: var(--fg); line-height: 1; }
.stat-card:nth-child(1) b, .stat-card:nth-child(2) b { color: var(--gold); }
.stat-card span { font-size: 12.5px; font-weight: 600; color: var(--fg3); }

.cbars { display: flex; flex-direction: column; gap: 9px; margin: 0 2px; }
.cbar { display: grid; grid-template-columns: 92px 1fr 28px; align-items: center; gap: 10px; }
.cbar-label { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; color: var(--fg2); }
.cbar-label i { width: 12px; height: 12px; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .2); }
.cbar-track { height: 9px; border-radius: 5px; background: var(--bg3); overflow: hidden; }
.cbar-fill { display: block; height: 100%; border-radius: 5px; transition: width .5s var(--ease); }
.cbar-val { font-family: var(--font-display); font-size: 15px; color: var(--fg2); text-align: right; }
.stat-note { margin: 16px 4px 0; line-height: 1.5; }

/* § EMPTY STATE ────────────────────────────────────────────────────── */
.empty { text-align: center; padding: 48px 30px; color: var(--fg3); }
.empty-fig { display: block; width: 72px; margin: 0 auto 16px; color: var(--ghost-line); }
.empty-fig svg { width: 100%; }
.empty p { font-size: 14.5px; line-height: 1.5; max-width: 260px; margin: 0 auto; }

/* § FIGURE DETAIL ──────────────────────────────────────────────────── */
.detail { padding-bottom: calc(var(--safe-bottom) + 26px); min-height: 100vh; }
.detail-bar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(var(--safe-top) + 8px) 12px 10px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.detail-num { font-family: var(--font-display); font-size: 18px; color: var(--fg2); letter-spacing: 1px; }

.hero {
  position: relative; margin: 4px 14px 0; height: 260px; border-radius: 22px;
  background:
    radial-gradient(90% 90% at 50% 34%, var(--bg3), var(--bg2) 72%);
  border: 1px solid var(--bd); overflow: hidden;
  display: grid; place-items: center;
}
.hero.owned { border-color: var(--gold-d); box-shadow: inset 0 0 40px color-mix(in srgb, var(--gold) 12%, transparent); }
.hero-num {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--font-display); font-size: 220px; line-height: 1;
  color: color-mix(in srgb, var(--fg) 5%, transparent);
  letter-spacing: 4px; pointer-events: none; user-select: none;
}
.hero-fig { position: relative; width: 150px; height: 200px; display: grid; place-items: center; }
.hero-keshi { width: 100%; color: var(--tint, var(--flesh)); filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .4)); }
.hero-keshi svg { width: 100%; height: auto; }
.hero-img {
  position: absolute; inset: 0; margin: auto; max-width: 100%; max-height: 100%;
  object-fit: contain; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .4));
}

.detail-body { padding: 20px 20px 0; }
.detail-name { font-family: var(--font-display); font-size: 30px; line-height: 1.02; letter-spacing: .5px; color: var(--fg); }
.detail-origin { font-size: 14.5px; color: var(--fg2); margin-top: 5px; line-height: 1.4; }

.detail-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 11px; }
.badge {
  font-size: 11.5px; font-weight: 700; letter-spacing: .3px;
  padding: 4px 9px; border-radius: 999px;
  color: var(--fg2); background: var(--bg3); border: 1px solid var(--bd);
  display: inline-flex; align-items: center; gap: 4px;
}
.rare-badge { color: var(--bc); border-color: color-mix(in srgb, var(--bc) 55%, transparent); background: color-mix(in srgb, var(--bc) 12%, var(--bg2)); }
.rare-badge svg { stroke: var(--bc); }

.own-actions { display: flex; gap: 10px; margin: 18px 0 4px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 16px; border-radius: 14px; font-weight: 700; font-size: 15px; letter-spacing: .2px;
  border: 1px solid var(--bd); background: var(--bg2); color: var(--fg);
  transition: transform .1s, background .15s, border-color .15s, color .15s;
}
.btn:active { transform: scale(.97); }
.btn.full { width: 100%; }
.own-actions .btn { flex: 1; }
.btn-primary { background: var(--acc); border-color: var(--acc); color: #fff; box-shadow: 0 4px 16px color-mix(in srgb, var(--acc) 35%, transparent); }
.btn-owned {
  background: linear-gradient(180deg, var(--plate-1), var(--plate-2) 65%, var(--plate-3));
  border-color: var(--gold-d); color: #241713;
  box-shadow: 0 4px 16px color-mix(in srgb, var(--gold) 34%, transparent), inset 0 1px 0 rgba(255, 255, 255, .35);
}
.btn-owned svg { fill: #241713; }
.btn-ghost { background: var(--bg2); color: var(--fg2); }
.btn-ghost.on { color: var(--acc); border-color: color-mix(in srgb, var(--acc) 55%, transparent); }
.btn-ghost.on svg { fill: var(--acc); }

.detail-h {
  font-family: var(--font-display); font-size: 15px; letter-spacing: .5px; text-transform: uppercase;
  color: var(--fg2); margin: 24px 0 12px; display: flex; align-items: center; gap: 8px;
}
.detail-h span {
  font-family: var(--font-body); font-size: 12px; font-weight: 700; letter-spacing: 0;
  color: var(--bg); background: var(--gold); padding: 2px 8px; border-radius: 999px;
}

/* Color variant belt (per figure) */
.vbelt { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.vchip {
  display: flex; align-items: center; gap: 8px; padding: 9px 10px; border-radius: 12px;
  background: var(--bg2); border: 1px solid var(--bd); position: relative;
  font-size: 13px; font-weight: 600; color: var(--fg3);
  transition: all .14s; text-align: left;
}
.vchip:active { transform: scale(.96); }
.vchip .vsw { width: 16px; height: 16px; border-radius: 50%; background: var(--sw); flex: none; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .25); opacity: .5; transition: opacity .15s; }
.vchip .vname { flex: 1; min-width: 0; }
.vchip.known { color: var(--fg2); }
.vchip.known .vsw { opacity: 1; }
.vchip.have { background: color-mix(in srgb, var(--sw) 16%, var(--bg2)); border-color: color-mix(in srgb, var(--sw) 55%, var(--bd)); color: var(--fg); }
.vchip.have .vsw { opacity: 1; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .25), 0 0 8px color-mix(in srgb, var(--sw) 60%, transparent); }
.vchip .vtick { color: var(--gold); display: grid; place-items: center; flex: none; }
.vchip .vtick svg { stroke: var(--gold); stroke-width: 3; }

.detail-meta { margin-top: 22px; display: flex; flex-direction: column; gap: 1px; border-radius: 14px; overflow: hidden; border: 1px solid var(--bd); }
.detail-meta > div { display: grid; grid-template-columns: 96px 1fr; gap: 8px; padding: 12px 14px; background: var(--bg2); font-size: 14px; }
.detail-meta > div span { color: var(--fg3); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; align-self: center; }
.detail-meta .notes { grid-template-columns: 1fr; gap: 4px; }
.detail-meta .notes span { text-transform: uppercase; }

.detail-nav { display: flex; gap: 10px; padding: 24px 20px 0; }
.detail-nav .btn { flex: 1; font-family: var(--font-display); font-size: 17px; letter-spacing: .5px; }
.detail-nav .btn[disabled] { opacity: .3; pointer-events: none; }

/* § SHEETS (bottom sheet) ──────────────────────────────────────────── */
#sheet-host:empty { display: none; }
.scrim { position: fixed; inset: 0; z-index: 50; background: var(--scrim); backdrop-filter: blur(2px); animation: fade .2s ease; }
.sheet {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; z-index: 51;
  width: 100%; max-width: var(--maxw); max-height: 88vh;
  background: var(--bg2); border: 1px solid var(--bd); border-bottom: none;
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -20px 60px rgba(0, 0, 0, .5);
  animation: sheetUp .28s var(--ease);
  display: flex; flex-direction: column;
  padding-bottom: var(--safe-bottom);
}
.sheet::before { content: ""; width: 40px; height: 4px; border-radius: 3px; background: var(--bd); position: absolute; top: 9px; left: 50%; transform: translateX(-50%); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 22px 18px 8px; }
.sheet-head h3 { font-family: var(--font-display); font-size: 20px; letter-spacing: .5px; color: var(--fg); }
.sheet-scroll { padding: 8px 18px 26px; overflow-y: auto; }

.field-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--fg3); margin: 18px 0 9px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 12.5px; font-weight: 700; color: var(--fg2); letter-spacing: .2px; }
.field input, .field select, .field textarea {
  background: var(--bg3); border: 1px solid var(--bd); border-radius: 12px;
  padding: 12px 13px; color: var(--fg); outline: none; transition: border-color .15s;
  width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--acc); }
.field textarea { resize: vertical; min-height: 68px; line-height: 1.4; }

.theme-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.theme-opt {
  padding: 14px; border-radius: 16px; border: 1.5px solid var(--bd); background: var(--tbg);
  display: flex; flex-direction: column; gap: 10px; align-items: flex-start; transition: border-color .15s, transform .1s;
}
.theme-opt:active { transform: scale(.97); }
.theme-opt.on { border-color: var(--gold); box-shadow: 0 0 0 2px color-mix(in srgb, var(--gold) 30%, transparent); }
.theme-swatches { display: flex; gap: 5px; }
.theme-swatches i { width: 20px; height: 20px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .25); }
.theme-name { font-weight: 700; font-size: 14px; color: var(--tflesh); font-family: var(--font-display); letter-spacing: .5px; }

.list-btn {
  width: 100%; display: flex; align-items: center; gap: 12px;
  padding: 14px 14px; border-radius: 13px; background: var(--bg3); border: 1px solid var(--bd);
  color: var(--fg); font-weight: 600; font-size: 14.5px; margin-bottom: 8px; transition: background .15s;
  text-align: left;
}
.list-btn svg { color: var(--gold); flex: none; }
.list-btn:active { background: var(--bd); }

.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--fg2); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--acc); }
.check i { width: 13px; height: 13px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .2); }
.check-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 14px; margin-bottom: 6px; }
.check-grid .check.on { color: var(--fg); }

.export-box {
  width: 100%; margin-top: 14px; min-height: 90px; max-height: 160px; resize: vertical;
  background: var(--bg3); border: 1px solid var(--bd); border-radius: 12px; padding: 12px;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 11px; color: var(--fg2); line-height: 1.4;
}

.about { margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--bd); }
.about-mark { font-family: var(--font-display); font-size: 22px; color: var(--fg); letter-spacing: 1px; margin-bottom: 8px; }
.about-mark .kanji { color: var(--gold); font-size: 16px; margin-left: 4px; }
.about p { margin-bottom: 8px; line-height: 1.5; }

/* § TOAST ──────────────────────────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 16px);
  transform: translate(-50%, 20px); z-index: 80;
  background: var(--bg3); color: var(--fg); border: 1px solid var(--gold-d);
  padding: 11px 18px; border-radius: 999px; font-size: 14px; font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; max-width: 86vw; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* § BOOT SCREEN ────────────────────────────────────────────────────── */
.boot { position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 12px; background: var(--bg); text-align: center; }
.boot-mark {
  font-family: var(--font-display); font-size: 40px; letter-spacing: 1px; color: var(--fg);
  text-shadow: 0 0 30px color-mix(in srgb, var(--acc) 40%, transparent);
}
.boot-sub { font-family: var(--font-jp); font-size: 13px; color: var(--gold); letter-spacing: 2px; }
.boot-bar { width: 140px; height: 4px; border-radius: 3px; background: var(--bg3); overflow: hidden; margin-top: 6px; }
.boot-bar span { display: block; height: 100%; width: 40%; border-radius: 3px; background: linear-gradient(90deg, var(--gold), var(--acc)); animation: bootslide 1.1s var(--ease) infinite; }

.err-glyph { font-size: 44px; color: var(--acc); margin-bottom: 10px; }
.err-title { font-family: var(--font-display); font-size: 20px; margin-bottom: 6px; }

/* § FOCUS / A11Y ───────────────────────────────────────────────────── */
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
.skip-link { position: fixed; left: -999px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* § ANIMATION ──────────────────────────────────────────────────────── */
@keyframes fade { from { opacity: 0; } }
@keyframes sheetUp { from { transform: translate(-50%, 100%); } }
@keyframes bootslide { 0% { transform: translateX(-120%); } 100% { transform: translateX(360%); } }

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