/* ─── Mintfolk — "museum at night" ─────────────────────────────────────── */
:root {
  --bg: #17151a;
  --bg-2: #1d1a21;
  --bg-3: #232028;
  --bg-4: #2a2631;
  --ink: #e8dcc8;
  --ink-dim: #a89d88;
  --ink-faint: #6e675c;
  --gold: #d9a441;
  --gold-deep: #b98a3a;
  --hairline: rgba(217, 164, 65, 0.16);
  --hairline-strong: rgba(217, 164, 65, 0.34);
  --danger: #c8564e;
  --serif: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --sans: system-ui, -apple-system, 'Segoe UI', 'Helvetica Neue', sans-serif;
  --rail-w: 218px;
  --hdr-h: 64px;
  --tier-common: #9aa3ad; --tier-uncommon: #57a773; --tier-rare: #4b8fd4;
  --tier-epic: #9b6dd6; --tier-legendary: #e0a83a; --tier-mythic: #e05a8a;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
/* atmosphere: candlelit vignette + faint grain */
body::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(1100px 480px at 50% -8%, rgba(217, 164, 65, 0.07), transparent 62%),
    radial-gradient(900px 700px at 108% 112%, rgba(120, 90, 160, 0.05), transparent 60%),
    radial-gradient(140% 120% at 50% 50%, transparent 55%, rgba(0, 0, 0, 0.42) 100%);
}
body::after {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E");
}

::selection { background: rgba(217, 164, 65, 0.32); }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; padding: 0; }
a { color: inherit; text-decoration: none; }
svg { display: block; }
b { font-weight: 600; }
.dim { color: var(--ink-dim); }

/* thin gilded scrollbars */
* { scrollbar-width: thin; scrollbar-color: rgba(217, 164, 65, 0.25) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: rgba(217, 164, 65, 0.22); border-radius: 4px; }
*::-webkit-scrollbar-track { background: transparent; }

/* ─── shell layout ─────────────────────────────────────────────────────── */
#app {
  position: relative; z-index: 1;
  display: grid; height: 100vh; height: 100dvh;
  grid-template-columns: var(--rail-w) 1fr;
  grid-template-rows: var(--hdr-h) 1fr;
  grid-template-areas: 'rail header' 'rail main';
}
#rail { grid-area: rail; }
#topbar { grid-area: header; }
#view { grid-area: main; overflow-y: auto; padding: 26px 32px 72px; scroll-behavior: smooth; }
#tabbar { display: none; }

/* ─── rail ─────────────────────────────────────────────────────────────── */
#rail {
  display: flex; flex-direction: column;
  border-right: 1px solid var(--hairline);
  background: linear-gradient(180deg, #1a1720, #16141a 60%);
  padding: 22px 14px 16px;
}
.rail-brand { padding: 0 12px 22px; }
.brand-m {
  font: 900 34px/1 var(--serif); color: var(--gold); display: block;
  text-shadow: 0 0 22px rgba(217, 164, 65, 0.35);
}
.brand-word { font: 600 21px/1.3 var(--serif); letter-spacing: 0.01em; display: block; margin-top: 6px; }
.brand-sub {
  display: block; margin-top: 3px;
  font-size: 10px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--ink-faint);
}
.rail-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: 8px; border-left: 2px solid transparent;
  color: var(--ink-dim); transition: color 0.15s, background 0.15s;
  font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase;
}
.nav-item:hover { color: var(--ink); background: rgba(217, 164, 65, 0.05); }
.nav-item.active {
  color: var(--gold); border-left-color: var(--gold);
  background: linear-gradient(90deg, rgba(217, 164, 65, 0.1), transparent 75%);
  border-radius: 0 8px 8px 0;
}
.nav-ic { width: 19px; height: 19px; flex: none; }
.nav-ic svg { width: 100%; height: 100%; }
.rail-foot { padding: 10px 12px 0; font-size: 10px; letter-spacing: 0.3em; color: var(--ink-faint); text-transform: uppercase; }

/* ─── header ───────────────────────────────────────────────────────────── */
#topbar {
  position: relative; z-index: 50; /* the settings menu must float above #view */
  display: flex; align-items: center; gap: 20px;
  padding: 0 28px; border-bottom: 1px solid var(--hairline);
  background: rgba(23, 21, 26, 0.82); backdrop-filter: blur(8px);
}
.hdr-brand { display: none; font: 900 20px/1 var(--serif); color: var(--gold); }
.hdr-stats { display: flex; gap: 26px; align-items: center; }
.stat { display: flex; align-items: center; gap: 9px; }
.stat-ic { width: 17px; height: 17px; color: var(--gold); }
.stat-ic svg { width: 100%; height: 100%; }
.stat-ic.renown { font-size: 15px; line-height: 1; width: auto; height: auto; }
.stat-txt { display: flex; flex-direction: column; line-height: 1.15; }
.stat-txt b { font: 600 17px/1.1 var(--serif); font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 10.5px; letter-spacing: 0.08em; color: var(--ink-dim); }
.hdr-user { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.hdr-name { font: 400 14px var(--serif); font-style: italic; color: var(--ink-dim); }
.icon-btn {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  color: var(--ink-dim); border: 1px solid var(--hairline); transition: 0.15s;
}
.icon-btn:hover { color: var(--gold); border-color: var(--hairline-strong); }
.icon-btn svg { width: 18px; height: 18px; }
.settings-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 10px); min-width: 230px; z-index: 60;
  background: var(--bg-3); border: 1px solid var(--hairline-strong); border-radius: 10px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.55); padding: 6px; animation: menu-in 0.14s ease-out;
}
@keyframes menu-in { from { opacity: 0; transform: translateY(-5px); } }
.menu-head { padding: 9px 12px 10px; border-bottom: 1px solid var(--hairline); margin-bottom: 5px; }
.menu-head b { display: block; font: 600 15px var(--serif); }
.menu-head .dim { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; }
.menu-item {
  display: block; width: 100%; text-align: left; padding: 8px 12px; border-radius: 7px;
  font-size: 13.5px; color: var(--ink); transition: background 0.12s;
}
.menu-item:hover { background: rgba(217, 164, 65, 0.09); }
.menu-item.danger { color: #d98a84; }

/* ─── shared bits ──────────────────────────────────────────────────────── */
.kicker {
  font-size: 10.5px; letter-spacing: 0.26em; text-transform: uppercase;
  color: var(--gold); margin-bottom: 6px;
}
.view-title { font: 900 clamp(26px, 3.2vw, 36px)/1.1 var(--serif); margin: 0 0 4px; letter-spacing: 0.005em; }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.gallery-count { color: var(--ink-dim); font-size: 13px; padding-bottom: 6px; }
.gallery-count b { color: var(--ink); font-family: var(--serif); }

.panel {
  background: linear-gradient(180deg, var(--bg-2), #191621 140%);
  border: 1px solid var(--hairline); border-radius: 12px;
  padding: 22px 24px; margin-bottom: 20px;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 9px 18px; border-radius: 8px;
  border: 1px solid var(--hairline-strong); color: var(--ink);
  font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase;
  transition: 0.15s; white-space: nowrap;
}
.btn:hover:not(:disabled) { border-color: var(--gold); color: var(--gold); }
.btn.primary {
  background: linear-gradient(180deg, #e2b155, var(--gold-deep));
  border-color: transparent; color: #1c1408; font-weight: 650;
  box-shadow: 0 4px 18px rgba(217, 164, 65, 0.22);
}
.btn.primary:hover:not(:disabled) { color: #1c1408; filter: brightness(1.08); }
.btn.big { padding: 13px 24px; font-size: 14px; border-radius: 10px; }
.btn:disabled { opacity: 0.38; cursor: not-allowed; }
.btn .cost { font-variant-numeric: tabular-nums; opacity: 0.85; font-weight: 600; }
.btn.ghost { border-color: transparent; color: var(--ink-dim); }
.btn.ghost:hover { color: var(--ink); }
.btn.danger, .btn.danger-ghost { border-color: rgba(200, 86, 78, 0.5); color: #d98a84; }
.btn.danger-ghost:hover:not(:disabled), .btn.danger:hover:not(:disabled) { border-color: var(--danger); color: #eba49e; }
.btn.confirming { border-color: var(--danger); color: #eba49e; background: rgba(200, 86, 78, 0.12); }
.btn.gold-glow { box-shadow: 0 0 34px rgba(217, 164, 65, 0.3); }

.chip {
  display: inline-flex; align-items: center; padding: 2px 9px 2.5px; border-radius: 999px;
  font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; font-weight: 600;
  border: 1px solid; line-height: 1.5;
}
.chip-common    { color: var(--tier-common);    border-color: color-mix(in srgb, var(--tier-common) 50%, transparent);    background: color-mix(in srgb, var(--tier-common) 10%, transparent); }
.chip-uncommon  { color: var(--tier-uncommon);  border-color: color-mix(in srgb, var(--tier-uncommon) 50%, transparent);  background: color-mix(in srgb, var(--tier-uncommon) 10%, transparent); }
.chip-rare      { color: var(--tier-rare);      border-color: color-mix(in srgb, var(--tier-rare) 50%, transparent);      background: color-mix(in srgb, var(--tier-rare) 10%, transparent); }
.chip-epic      { color: var(--tier-epic);      border-color: color-mix(in srgb, var(--tier-epic) 50%, transparent);      background: color-mix(in srgb, var(--tier-epic) 10%, transparent); }
.chip-legendary { color: var(--tier-legendary); border-color: color-mix(in srgb, var(--tier-legendary) 50%, transparent); background: color-mix(in srgb, var(--tier-legendary) 10%, transparent); }
.chip-mythic    { color: var(--tier-mythic);    border-color: color-mix(in srgb, var(--tier-mythic) 50%, transparent);    background: color-mix(in srgb, var(--tier-mythic) 12%, transparent); }

.glow-common    { box-shadow: 0 0 0 1px color-mix(in srgb, var(--tier-common) 55%, transparent),    0 0 22px color-mix(in srgb, var(--tier-common) 24%, transparent); }
.glow-uncommon  { box-shadow: 0 0 0 1px color-mix(in srgb, var(--tier-uncommon) 55%, transparent),  0 0 24px color-mix(in srgb, var(--tier-uncommon) 30%, transparent); }
.glow-rare      { box-shadow: 0 0 0 1px color-mix(in srgb, var(--tier-rare) 60%, transparent),      0 0 26px color-mix(in srgb, var(--tier-rare) 34%, transparent); }
.glow-epic      { box-shadow: 0 0 0 1px color-mix(in srgb, var(--tier-epic) 65%, transparent),      0 0 30px color-mix(in srgb, var(--tier-epic) 40%, transparent); }
.glow-legendary { box-shadow: 0 0 0 1px color-mix(in srgb, var(--tier-legendary) 70%, transparent), 0 0 34px color-mix(in srgb, var(--tier-legendary) 45%, transparent); }
.glow-mythic    { box-shadow: 0 0 0 1px color-mix(in srgb, var(--tier-mythic) 70%, transparent),    0 0 38px color-mix(in srgb, var(--tier-mythic) 50%, transparent); }

.sig-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--gold);
  border: 1px solid var(--hairline-strong); border-radius: 999px; padding: 2px 10px;
  background: rgba(217, 164, 65, 0.07);
}
.sig-badge.big { font-size: 12px; padding: 4px 13px; margin: 4px 0 2px; }
.sig-dot { color: var(--gold); font-size: 12px; }
.vault-dot { font-size: 11px; }
.vault-dot.corner { position: absolute; top: 7px; left: 8px; z-index: 2; }
.serial { color: var(--ink-faint); font-size: 11px; font-variant-numeric: tabular-nums; letter-spacing: 0.05em; }

.bar { height: 6px; border-radius: 3px; background: rgba(232, 220, 200, 0.08); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--gold-deep), var(--gold)); transition: width 0.5s ease; }
.bar.thin { height: 4px; }
.bar.big { height: 9px; border-radius: 5px; }

.empty-note {
  color: var(--ink-dim); border: 1px dashed var(--hairline); border-radius: 12px;
  padding: 34px 20px; text-align: center; font-style: italic; font-family: var(--serif);
}
.render-fail { display: grid; place-items: center; color: var(--ink-faint); }

/* ─── mint view ────────────────────────────────────────────────────────── */
.mint-grid { display: grid; grid-template-columns: minmax(380px, 5fr) minmax(320px, 4fr); gap: 20px; align-items: start; }
.mint-studio { position: relative; overflow: hidden; }
.easel-wrap { margin: 14px 0 6px; text-align: center; }
.easel {
  position: relative; display: inline-block; width: min(320px, 82%);
  cursor: pointer; user-select: none; -webkit-user-select: none; touch-action: manipulation;
  filter: drop-shadow(0 16px 28px rgba(0, 0, 0, 0.45));
}
.easel:focus-visible { outline: 2px solid var(--gold); outline-offset: 6px; border-radius: 10px; }
.easel-art { width: 100%; height: auto; }
.easel.tap .easel-art { animation: easel-tap 0.18s ease-out; }
@keyframes easel-tap { 40% { transform: scale(0.975) rotate(-0.4deg); } }
.easel-hint { margin-top: 10px; color: var(--ink-dim); font-size: 13px; }
.easel-hint b { color: var(--gold); font-family: var(--serif); }
.mote {
  position: absolute; z-index: 5; pointer-events: none;
  font: 600 15px var(--serif); color: var(--gold);
  text-shadow: 0 1px 8px rgba(23, 21, 26, 0.9);
  animation: mote-rise 0.9s ease-out forwards;
}
@keyframes mote-rise {
  0% { opacity: 0; transform: translateY(4px) scale(0.8); }
  18% { opacity: 1; transform: translateY(-6px) scale(1.06); }
  100% { opacity: 0; transform: translateY(-58px) scale(0.94); }
}
.mint-actions { display: flex; gap: 12px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.mint-meta { text-align: center; color: var(--ink-dim); font-size: 12.5px; margin: 14px 0 0; letter-spacing: 0.04em; }
.mint-meta b { color: var(--ink); }

.reveal-panel { min-height: 430px; }
.reveal-zone { display: grid; place-items: center; min-height: 370px; }
.reveal-empty { text-align: center; color: var(--ink-faint); font-family: var(--serif); font-style: italic; }
.reveal-empty-frame {
  width: 168px; height: 205px; margin: 0 auto 16px;
  border: 1px dashed var(--hairline-strong); border-radius: 4px;
  background: radial-gradient(circle at 50% 38%, rgba(217, 164, 65, 0.06), transparent 62%);
}
.minting { animation: pulse-dim 1.1s ease-in-out infinite; }
@keyframes pulse-dim { 50% { opacity: 0.45; } }

.reveal-row { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; }
.reveal-card { text-align: center; animation: deal-in 0.4s ease-out backwards; position: relative; }
.reveal-row.multi .reveal-card:nth-child(2) { animation-delay: 0.06s; }
.reveal-row.multi .reveal-card:nth-child(3) { animation-delay: 0.12s; }
.reveal-row.multi .reveal-card:nth-child(4) { animation-delay: 0.18s; }
.reveal-row.multi .reveal-card:nth-child(5) { animation-delay: 0.24s; }
@keyframes deal-in { from { opacity: 0; transform: translateY(22px) rotate(1.5deg); } }
.flip { perspective: 1100px; }
.flip-inner { position: relative; transform-style: preserve-3d; transition: transform 0.85s cubic-bezier(0.2, 0.75, 0.25, 1); }
.reveal-card.flipped .flip-inner { transform: rotateY(180deg); }
.face { backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 10px; overflow: hidden; }
.face-front { position: absolute; inset: 0; z-index: 2; }
.face-back { transform: rotateY(180deg); }
.face-back .thumb svg { display: block; }
.card-back {
  width: 100%; height: 100%; display: grid; place-items: center;
  background: linear-gradient(160deg, #26222d, #1a1720);
  border: 1px solid var(--hairline-strong);
  border-radius: 10px;
  background-image:
    repeating-linear-gradient(45deg, rgba(217, 164, 65, 0.045) 0 2px, transparent 2px 11px),
    linear-gradient(160deg, #26222d, #1a1720);
}
.card-back-inner { text-align: center; border: 1px solid var(--hairline); border-radius: 6px; padding: 18px 22px; }
.card-back-m { font: 900 44px/1 var(--serif); color: var(--gold); display: block; }
.card-back-sub { font-size: 8.5px; letter-spacing: 0.34em; text-transform: uppercase; color: var(--ink-faint); display: block; margin-top: 6px; }
.reveal-meta { margin-top: 12px; opacity: 0; transform: translateY(6px); transition: 0.4s ease 0.45s; }
.reveal-card.flipped .reveal-meta { opacity: 1; transform: none; }
.reveal-name { font: 600 16px var(--serif); margin-bottom: 5px; }
.reveal-sub { display: flex; gap: 8px; align-items: center; justify-content: center; margin-bottom: 5px; }

.confetti { position: absolute; inset: 0; pointer-events: none; overflow: visible; z-index: 8; }
.confetti i {
  position: absolute; left: 50%; top: 42%; border-radius: 1px;
  animation: confetti-fly 1.9s cubic-bezier(0.16, 0.6, 0.4, 1) forwards;
}
@keyframes confetti-fly {
  0% { opacity: 1; transform: translate(0, 0) rotate(0); }
  55% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--dx), calc(var(--dy) + 130px)) rotate(var(--rot)); }
}

/* ─── gallery ──────────────────────────────────────────────────────────── */
.filters { display: flex; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 18px; flex-wrap: wrap; }
.fgroup { display: flex; gap: 7px; flex-wrap: wrap; }
.fchip {
  padding: 4px 12px 5px; border-radius: 999px; border: 1px solid var(--hairline);
  color: var(--ink-dim); font-size: 11.5px; letter-spacing: 0.07em; transition: 0.14s;
}
.fchip i { font-style: normal; color: var(--ink-faint); margin-left: 3px; font-size: 10.5px; }
.fchip:hover { border-color: var(--hairline-strong); color: var(--ink); }
.fchip.active { border-color: var(--gold); color: var(--gold); background: rgba(217, 164, 65, 0.08); }
.fchip.active i { color: inherit; opacity: 0.75; }
.fsort { color: var(--ink-dim); font-size: 12px; display: flex; gap: 8px; align-items: center; }
.fsort select {
  background: var(--bg-3); color: var(--ink); border: 1px solid var(--hairline);
  border-radius: 7px; padding: 5px 9px; font-size: 12.5px;
}
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 14px; }
.pgrid.small { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 11px; }
.pcard {
  position: relative; text-align: left; border-radius: 11px; overflow: hidden;
  background: var(--bg-2); border: 1px solid var(--hairline);
  transition: transform 0.16s ease, border-color 0.16s, box-shadow 0.16s;
  animation: card-in 0.3s ease-out backwards;
}
@keyframes card-in { from { opacity: 0; transform: translateY(10px); } }
.pcard:hover { transform: translateY(-3px); border-color: var(--hairline-strong); box-shadow: 0 14px 30px rgba(0, 0, 0, 0.4); }
.pcard .thumb { aspect-ratio: 1; background: #211d28; }
.pcard .thumb svg { width: 100%; height: 100%; }
.pcard .thumb:not(.rendered)::before {
  content: ''; display: block; width: 100%; height: 100%;
  background: linear-gradient(110deg, transparent 30%, rgba(232, 220, 200, 0.05) 50%, transparent 70%) #211d28;
  background-size: 220% 100%; animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer { from { background-position: 130% 0; } to { background-position: -110% 0; } }
.pmeta { padding: 10px 12px 12px; }
.pname { font: 600 14px/1.3 var(--serif); margin-bottom: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow { display: flex; gap: 8px; align-items: center; }
.pcard.mini .pname { font-size: 12.5px; margin-bottom: 4px; }
.pcard.mini .pmeta { padding: 8px 10px 10px; }
.pcard.selected { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold), 0 0 24px rgba(217, 164, 65, 0.25); }
.pick-badge {
  position: absolute; z-index: 2; top: 7px; right: 8px; width: 22px; height: 22px;
  border-radius: 50%; display: grid; place-items: center;
  background: var(--gold); color: #1c1408; font: 700 12px var(--serif);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}
.pcard:disabled { opacity: 0.45; cursor: not-allowed; }

/* ─── modal ────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center;
  background: rgba(10, 9, 12, 0.72); backdrop-filter: blur(5px);
  animation: fade-in 0.18s ease-out; padding: 18px; overflow-y: auto;
}
.modal-backdrop.closing { animation: fade-out 0.2s ease-in forwards; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
.modal {
  position: relative; max-width: 860px; width: 100%; max-height: calc(100dvh - 40px); overflow-y: auto;
  background: linear-gradient(180deg, #221e29, #1a1720);
  border: 1px solid var(--hairline-strong); border-radius: 14px;
  padding: 26px 28px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  animation: modal-in 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
@keyframes modal-in { from { opacity: 0; transform: translateY(16px) scale(0.97); } }
.modal-x {
  position: absolute; top: 13px; right: 16px; z-index: 5; font-size: 22px; line-height: 1;
  color: var(--ink-faint); width: 32px; height: 32px; border-radius: 50%;
}
.modal-x:hover { color: var(--ink); background: rgba(232, 220, 200, 0.06); }
.modal-title { font: 900 25px var(--serif); margin: 0 0 14px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.modal-confirm { max-width: 480px; }
.modal-auth { max-width: 420px; }
.modal-reveal { max-width: 460px; text-align: center; }
.modal-exhibition { max-width: 520px; }

/* portrait detail */
.modal-detail { max-width: 940px; }
.detail { display: grid; grid-template-columns: minmax(280px, 440px) 1fr; gap: 26px; }
.detail-art { border-radius: 12px; overflow: hidden; align-self: start; }
.detail-art svg { width: 100%; height: auto; display: block; }
.detail-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.score { color: var(--ink-dim); font-size: 12px; letter-spacing: 0.06em; }
.vault-tag {
  font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold);
  border: 1px solid var(--hairline-strong); padding: 2px 8px; border-radius: 4px;
}
.detail-name { font: 900 27px/1.15 var(--serif); margin: 2px 0 8px; }
.owner-line { color: var(--ink-dim); font-size: 13px; margin-bottom: 6px; }
.bio { font: italic 400 14.5px/1.65 var(--serif); color: var(--ink-dim); margin: 8px 0 14px; }
.trait-scroll { overflow-x: auto; border: 1px solid var(--hairline); border-radius: 9px; }
.traits { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.traits th {
  text-align: left; font-size: 9.5px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--ink-faint); padding: 8px 12px 6px; border-bottom: 1px solid var(--hairline);
  position: sticky; top: 0; background: #1e1a25;
}
.traits td { padding: 5.5px 12px; border-bottom: 1px solid rgba(217, 164, 65, 0.06); }
.traits tr:last-child td { border-bottom: none; }
.tcat { color: var(--ink-faint); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; }
.tval { font-family: var(--serif); }
.tpct, .tcen { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-dim); }
.detail-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }

/* auth */
.auth-copy { margin-top: -4px; }
.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-dim); margin-bottom: 6px; }
.field input {
  width: 100%; background: var(--bg); border: 1px solid var(--hairline-strong);
  color: var(--ink); border-radius: 8px; padding: 10px 12px; font-size: 15px;
}
.field input:focus { outline: none; border-color: var(--gold); }
.auth-err { color: #eba49e; font-size: 13px; margin: -4px 0 12px; }
#auth-form .btn { width: 100%; margin-top: 4px; }

/* ─── fusion ───────────────────────────────────────────────────────────── */
.fuse-tray-panel { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.fuse-tray { display: flex; gap: 12px; align-items: center; }
.fuse-slot {
  width: 88px; height: 88px; border-radius: 10px; overflow: hidden; position: relative;
  border: 1px dashed var(--hairline-strong); display: grid; place-items: center;
  color: var(--ink-faint); font: 600 18px var(--serif); flex: none;
}
.fuse-slot.filled { border-style: solid; cursor: pointer; }
.fuse-slot.filled:hover::after {
  content: '×'; position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(10, 9, 12, 0.6); color: var(--ink); font-size: 26px;
}
.fuse-slot .thumb, .fuse-slot .thumb svg { width: 100%; height: 100%; }
.fuse-slot.target { border-style: solid; border-color: var(--hairline); background: rgba(217, 164, 65, 0.03); }
.fuse-slot.target.known { border-color: var(--hairline-strong); }
.target-tier { font: 700 13px var(--serif); letter-spacing: 0.06em; text-align: center; padding: 0 6px; }
.fuse-arrow { color: var(--gold); font-size: 24px; font-family: var(--serif); }
.fuse-info { flex: 1; min-width: 240px; color: var(--ink-dim); font-size: 13.5px; }
.fuse-info b { color: var(--ink); }
.tier-section { margin-bottom: 22px; transition: opacity 0.2s; }
.tier-section.dimmed { opacity: 0.42; }
.tier-section-head { display: flex; gap: 10px; align-items: center; margin-bottom: 11px; }
.jackpot {
  font: 700 15px var(--serif); letter-spacing: 0.1em; text-transform: uppercase; color: var(--gold);
  padding: 10px; margin-bottom: 8px; position: relative;
  animation: jackpot-glow 1.4s ease-in-out infinite;
}
@keyframes jackpot-glow { 50% { text-shadow: 0 0 26px rgba(217, 164, 65, 0.9); } }
.fuse-reveal { display: grid; place-items: center; padding: 8px 0 4px; }

/* ─── collections ──────────────────────────────────────────────────────── */
.setgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(272px, 1fr)); gap: 14px; }
.setcard {
  background: var(--bg-2); border: 1px solid var(--hairline); border-radius: 11px;
  padding: 17px 18px 15px; display: flex; flex-direction: column; gap: 9px;
}
.setcard.done {
  border-color: var(--hairline-strong);
  background:
    linear-gradient(140deg, rgba(217, 164, 65, 0.09), transparent 45%),
    var(--bg-2);
  box-shadow: inset 0 0 0 1px rgba(217, 164, 65, 0.12);
}
.set-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.set-head h3 { font: 600 16.5px var(--serif); margin: 0; }
.set-count { color: var(--ink-dim); font-size: 12px; font-variant-numeric: tabular-nums; flex: none; }
.done-tag { color: var(--gold); font-size: 10.5px; letter-spacing: 0.15em; text-transform: uppercase; flex: none; }
.set-desc { color: var(--ink-dim); font-size: 12.8px; margin: 0; }
.set-foot { display: flex; justify-content: space-between; font-size: 12px; }
.bonus { color: var(--gold); letter-spacing: 0.05em; }
.missing { font-size: 11.8px; color: var(--ink-faint); border-top: 1px solid var(--hairline); padding-top: 8px; }

/* ─── records ──────────────────────────────────────────────────────────── */
.life-strip { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
.life-stat {
  flex: 1; min-width: 108px; text-align: center;
  border: 1px solid var(--hairline); border-radius: 10px; padding: 12px 8px 10px;
  background: var(--bg-2);
}
.life-stat b { display: block; font: 600 20px var(--serif); color: var(--ink); font-variant-numeric: tabular-nums; }
.life-stat span { font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-faint); }
.achgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(295px, 1fr)); gap: 12px; }
.achcard {
  display: flex; gap: 13px; align-items: flex-start;
  background: var(--bg-2); border: 1px solid var(--hairline); border-radius: 11px; padding: 15px 16px;
  opacity: 0.72;
}
.achcard.earned {
  opacity: 1; border-color: var(--hairline-strong);
  background: linear-gradient(140deg, rgba(217, 164, 65, 0.08), transparent 50%), var(--bg-2);
}
.ach-medal { width: 30px; height: 30px; flex: none; color: var(--ink-faint); margin-top: 2px; }
.achcard.earned .ach-medal { color: var(--gold); filter: drop-shadow(0 0 8px rgba(217, 164, 65, 0.5)); }
.ach-medal svg { width: 100%; height: 100%; }
.ach-main { flex: 1; min-width: 0; }
.ach-name { font: 600 15px var(--serif); }
.ach-desc { color: var(--ink-dim); font-size: 12.5px; margin: 2px 0 8px; }
.ach-bonus { color: var(--gold); font-size: 12px; letter-spacing: 0.05em; }
.ach-progress { color: var(--ink-faint); font-size: 11.5px; margin-top: 6px; font-variant-numeric: tabular-nums; }

/* ─── studio ───────────────────────────────────────────────────────────── */
.up-section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.up-section-head h2 { font: 600 21px var(--serif); margin: 0; }
.upgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.upcard {
  display: flex; gap: 14px; align-items: center;
  background: var(--bg-3); border: 1px solid var(--hairline); border-radius: 11px; padding: 14px 16px;
}
.upcard.maxed { border-color: var(--hairline-strong); background: linear-gradient(140deg, rgba(217, 164, 65, 0.07), transparent 55%), var(--bg-3); }
.up-ico { font-size: 24px; flex: none; width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--hairline); border-radius: 9px; background: var(--bg-2); }
.up-main { flex: 1; min-width: 0; }
.up-name { font: 600 15px var(--serif); }
.up-desc { color: var(--ink-dim); font-size: 12.3px; margin: 1px 0 7px; }
.pips { display: flex; gap: 3.5px; flex-wrap: wrap; }
.pips i { width: 7px; height: 7px; border-radius: 50%; background: rgba(232, 220, 200, 0.12); }
.pips i.on { background: var(--gold); box-shadow: 0 0 6px rgba(217, 164, 65, 0.55); }
.btn.buy { min-width: 92px; flex: none; font-variant-numeric: tabular-nums; }
.btn.buy.renown { color: #cdb4ec; border-color: rgba(155, 109, 214, 0.45); }
.btn.buy.renown:hover:not(:disabled) { color: #ddc9f5; border-color: var(--tier-epic); }

/* ─── museum ───────────────────────────────────────────────────────────── */
.mfeed { display: flex; gap: 12px; overflow-x: auto; padding: 6px 2px 10px; }
.feed-card {
  flex: none; width: 150px; text-align: left; border-radius: 10px; overflow: hidden;
  background: var(--bg-3); border: 1px solid var(--hairline); transition: 0.15s;
}
.feed-card:hover { transform: translateY(-3px); border-color: var(--hairline-strong); }
.feed-card .thumb { width: 100%; aspect-ratio: 1; background: #211d28; }
.feed-card .thumb svg { width: 100%; height: 100%; }
.feed-meta { padding: 9px 11px 11px; display: flex; flex-direction: column; gap: 5px; align-items: flex-start; }
.feed-meta .pname { font-size: 12.5px; margin: 0; max-width: 100%; }
.feed-owner { color: var(--ink-faint); font-size: 11px; }
.museum-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.census-cats { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0 14px; }
.census-bars { display: flex; flex-direction: column; gap: 7px; max-height: 430px; overflow-y: auto; padding-right: 6px; }
.cbar-row { display: grid; grid-template-columns: 110px 1fr 48px; gap: 10px; align-items: center; font-size: 12px; }
.cbar-label { color: var(--ink-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cbar-track { height: 8px; background: rgba(232, 220, 200, 0.07); border-radius: 4px; overflow: hidden; }
.cbar-track i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-deep), var(--gold)); border-radius: 4px; }
.cbar-n { text-align: right; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.lb-scroll { overflow-x: auto; margin-top: 10px; }
.lb-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.lb-table th {
  text-align: left; font-size: 9.5px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--ink-faint); padding: 6px 10px; border-bottom: 1px solid var(--hairline);
}
.lb-table td { padding: 7.5px 10px; border-bottom: 1px solid rgba(217, 164, 65, 0.06); font-variant-numeric: tabular-nums; }
.lb-table tr.me td { background: rgba(217, 164, 65, 0.09); }
.lb-table tr.me .lb-name::after { content: ' — you'; color: var(--gold); font-size: 11px; }
.lb-rank { color: var(--ink-faint); width: 26px; }
.lb-rank.r1 { color: var(--gold); font-weight: 700; }
.lb-rank.r2 { color: #c8c8d2; font-weight: 700; }
.lb-rank.r3 { color: #c96b35; font-weight: 700; }
.lb-name { font-family: var(--serif); }
.lb-fame { color: var(--gold); }
.disc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(172px, 1fr)); gap: 10px; margin-top: 12px; }
.disc-card {
  border: 1px solid var(--hairline); border-radius: 10px; padding: 13px 14px;
  display: flex; flex-direction: column; gap: 3px; background: var(--bg-2);
}
.disc-card.found { border-color: var(--hairline-strong); background: linear-gradient(150deg, rgba(217, 164, 65, 0.07), transparent 55%), var(--bg-2); }
.disc-card.locked { opacity: 0.55; }
.disc-glyph { color: var(--gold); font-size: 15px; }
.disc-card.locked .disc-glyph { color: var(--ink-faint); }
.disc-card b { font: 600 14px var(--serif); }
.disc-by { color: var(--ink-dim); font-size: 11.5px; }
.disc-at { color: var(--ink-faint); font-size: 10.5px; }

/* ─── exhibition ───────────────────────────────────────────────────────── */
.exh-hero { position: relative; overflow: hidden; }
.exh-hero::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(600px 200px at 50% 0%, rgba(217, 164, 65, 0.08), transparent 70%);
}
.exh-copy { font: 400 16px/1.65 var(--serif); color: var(--ink-dim); max-width: 640px; margin: 4px 0 18px; }
.exh-copy b { color: var(--gold); }
.exh-score { max-width: 640px; }
.exh-score-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; font-size: 13px; color: var(--ink-dim); }
.exh-score-row b { font: 600 19px var(--serif); color: var(--ink); font-variant-numeric: tabular-nums; }
.exh-score-row b.ok { color: var(--gold); }
.exh-preview { margin-top: 12px; font-size: 13.5px; }
.renown-gain { color: var(--gold); font-family: var(--serif); font-size: 16px; }
.renown-gain.huge { font-size: 40px; font-weight: 900; display: block; margin: 12px 0; text-shadow: 0 0 32px rgba(217, 164, 65, 0.45); }
.exh-resets { margin: 18px 0 0; padding: 0; list-style: none; color: var(--ink-dim); font-size: 12.8px; display: flex; flex-direction: column; gap: 4px; }
.exh-resets b { color: var(--ink); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; margin-right: 6px; }
.exh-cta { text-align: center; padding: 6px 0 26px; }
.exh-confirm-copy { font-family: var(--serif); font-style: italic; color: var(--ink-dim); }
.exh-confirm-list { margin: 12px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 7px; font-size: 14px; }
.exh-celebrate { text-align: center; padding: 12px 6px 6px; position: relative; }
.exh-celebrate-title { font: 900 30px var(--serif); margin: 6px 0; }

/* ─── toasts ───────────────────────────────────────────────────────────── */
#toast-root {
  position: fixed; top: 16px; right: 16px; z-index: 200;
  display: flex; flex-direction: column; gap: 9px; width: min(354px, calc(100vw - 32px));
}
.toast {
  display: flex; gap: 12px; align-items: flex-start; cursor: pointer;
  background: linear-gradient(180deg, #262230, #1d1a24);
  border: 1px solid var(--hairline-strong); border-left-width: 3px; border-radius: 10px;
  padding: 12px 15px; box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55);
  animation: toast-in 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.15);
}
@keyframes toast-in { from { opacity: 0; transform: translateX(30px); } }
.toast.out { transition: 0.3s ease; opacity: 0; transform: translateX(24px); }
.toast-ic { width: 21px; height: 21px; flex: none; color: var(--gold); margin-top: 1px; }
.toast-ic svg { width: 100%; height: 100%; }
.toast-txt { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.toast-kicker { font-size: 9px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--gold); }
.toast-title { font: 600 14.5px var(--serif); }
.toast-body { color: var(--ink-dim); font-size: 12.3px; line-height: 1.45; }
.toast.t-error { border-left-color: var(--danger); }
.toast.t-error .toast-ic, .toast.t-error .toast-kicker { color: #d98a84; }
.toast.t-discovery { border-left-color: var(--gold); box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55), 0 0 30px rgba(217, 164, 65, 0.18); }
.toast.t-set { border-left-color: var(--tier-epic); }
.toast.t-set .toast-ic { color: var(--tier-epic); }

/* ─── onboarding ───────────────────────────────────────────────────────── */
.onb-backdrop {
  position: fixed; inset: 0; z-index: 300; display: grid; place-items: center;
  background: rgba(10, 9, 12, 0.8); backdrop-filter: blur(7px);
  animation: fade-in 0.25s ease-out; padding: 18px;
}
.onb-backdrop.closing { animation: fade-out 0.25s ease-in forwards; }
.onb-card {
  max-width: 430px; width: 100%; text-align: center;
  background: linear-gradient(180deg, #242030, #1a1720);
  border: 1px solid var(--hairline-strong); border-radius: 16px;
  padding: 34px 34px 26px; box-shadow: 0 30px 90px rgba(0, 0, 0, 0.65);
  animation: modal-in 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.onb-ic { display: inline-grid; place-items: center; width: 58px; height: 58px; margin: 14px 0 6px; color: var(--gold); border: 1px solid var(--hairline-strong); border-radius: 50%; padding: 13px; }
.onb-ic svg { width: 100%; height: 100%; }
.onb-title { font: 900 27px var(--serif); margin: 8px 0 6px; }
.onb-body { color: var(--ink-dim); font-size: 14px; line-height: 1.6; min-height: 68px; margin: 0 0 16px; }
.onb-dots { display: flex; gap: 7px; justify-content: center; margin-bottom: 20px; }
.onb-dots i { width: 7px; height: 7px; border-radius: 50%; background: rgba(232, 220, 200, 0.16); transition: 0.2s; }
.onb-dots i.on { background: var(--gold); box-shadow: 0 0 8px rgba(217, 164, 65, 0.6); }
.onb-actions { display: flex; justify-content: space-between; gap: 10px; }

.boot-error { max-width: 460px; margin: 60px auto; text-align: center; }
.boot-error .btn { margin-top: 14px; }

/* ─── responsive ───────────────────────────────────────────────────────── */
@media (max-width: 1120px) {
  .mint-grid { grid-template-columns: 1fr; }
  .museum-cols { grid-template-columns: 1fr; }
  .detail { grid-template-columns: 1fr; }
  .detail-art { max-width: 380px; margin: 0 auto; }
}

@media (max-width: 880px) {
  #app {
    grid-template-columns: 1fr;
    grid-template-rows: var(--hdr-h) 1fr auto;
    grid-template-areas: 'header' 'main' 'tabs';
  }
  #rail { display: none; }
  #view { padding: 18px 14px 90px; }
  .hdr-brand { display: block; }
  #topbar { padding: 0 16px; gap: 14px; }
  .hdr-stats { gap: 16px; }
  .hdr-name { display: none; }
  .stat-sub { display: none; }
  .stat-txt b { font-size: 15px; }
  #tabbar {
    grid-area: tabs; display: flex; align-items: stretch;
    border-top: 1px solid var(--hairline);
    background: rgba(23, 21, 26, 0.94); backdrop-filter: blur(10px);
    overflow-x: auto; padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
  }
  .tab-item {
    flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 8px 2px 6px; color: var(--ink-faint); border-radius: 8px;
  }
  .tab-item.active { color: var(--gold); }
  .tab-item .nav-ic { width: 20px; height: 20px; }
  .tab-label {
    font-size: 8px; letter-spacing: 0.05em; text-transform: uppercase;
    max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .view-title { font-size: 24px; }
  .panel { padding: 16px; }
  .pgrid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .fuse-tray-panel { justify-content: center; text-align: center; }
  .fuse-slot { width: 68px; height: 68px; }
  .modal { padding: 20px 18px; }
  .cbar-row { grid-template-columns: 88px 1fr 44px; }
}

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