:root {
  --bg: #0e0c0b;
  --bg2: #161311;
  --wall: #1c1815;
  --card: #1d1916;
  --line: #2f2925;
  --marble: #efe9df;
  --marble2: #cfc6b8;
  --muted: #9a8f82;
  --gold: #d9a646;
  --gold2: #f3c969;
  --red: #ff3b30;
  --yellow: #ffcc00;
  --green: #30d158;
  --blue: #0a84ff;
  --pink: #ff2d92;
  --purple: #bf5af2;
  --orange: #ff9f0a;
  --teal: #00c7be;
  --radius: 14px;
  --serif: 'Playfair Display', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--marble); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; overflow-x: hidden; }
a { color: var(--gold2); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.serif { font-family: var(--serif); }

/* ------------------------------------------------ header */
header.top {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 18px;
  padding: 12px 22px; background: rgba(14, 12, 11, .82); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.logo { display: flex; align-items: center; gap: 10px; font-family: var(--serif); font-weight: 900; font-size: 24px; letter-spacing: .06em; color: var(--marble); }
.logo:hover { text-decoration: none; }
.logo .drop { width: 28px; height: 28px; }
.logo b { background: linear-gradient(90deg, var(--red), var(--yellow), var(--green), var(--blue), var(--pink)); -webkit-background-clip: text; background-clip: text; color: transparent; }
nav.links { display: flex; gap: 6px; margin-left: 10px; }
nav.links a { color: var(--marble2); padding: 8px 12px; border-radius: 10px; font-weight: 500; font-size: 14px; }
nav.links a.on, nav.links a:hover { background: var(--card); color: var(--marble); text-decoration: none; }
.spacer { flex: 1; }
.net { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--gold); border: 1px solid #4a3a1c; padding: 4px 8px; border-radius: 999px; }
.btn {
  appearance: none; border: 1px solid var(--line); background: var(--card); color: var(--marble); padding: 10px 16px;
  border-radius: 12px; font-weight: 600; font-size: 14px; cursor: pointer; transition: transform .08s, background .2s, border-color .2s;
}
.btn:hover { border-color: #4a413a; background: #241f1b; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.gold { background: linear-gradient(180deg, var(--gold2), var(--gold)); color: #1b1307; border-color: transparent; }
.btn.gold:hover { filter: brightness(1.06); }
.btn.green { background: var(--green); color: #052310; border-color: transparent; }
.btn.red { background: #3a1513; color: #ffb4ae; border-color: #5a201c; }
.btn.small { padding: 6px 10px; font-size: 12px; border-radius: 9px; }
.btn.wide { width: 100%; }

/* ------------------------------------------------ layout */
main { max-width: 1320px; margin: 0 auto; padding: 22px; }
.stage-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 22px; align-items: start; }
@media (max-width: 1020px) { .stage-grid { grid-template-columns: 1fr; } nav.links { display: none; } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card h3 { margin: 0 0 12px; font-family: var(--serif); font-size: 20px; font-weight: 700; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }

/* ------------------------------------------------ the stage */
.stage {
  position: relative; border-radius: 22px; overflow: hidden; border: 1px solid var(--line);
  background:
    radial-gradient(ellipse 55% 60% at 50% 18%, rgba(255, 236, 200, .16), transparent 70%),
    radial-gradient(ellipse 80% 40% at 50% 100%, rgba(0, 0, 0, .7), transparent 70%),
    linear-gradient(180deg, #221d19 0%, #1a1613 60%, #120f0d 100%);
  aspect-ratio: 4 / 4.4; max-height: 860px; width: 100%;
}
.stage svg.scene { position: absolute; inset: 0; width: 100%; height: 100%; }
.stage .plaque {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); min-width: 260px; text-align: center;
  background: linear-gradient(180deg, #e6c06a, #a77b2c); color: #2a1c06; padding: 9px 18px; border-radius: 6px;
  font-family: var(--serif); font-weight: 700; box-shadow: 0 6px 22px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .4);
}
.stage .plaque small { display: block; font-family: var(--sans); font-weight: 600; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; opacity: .75; }
.stage .hud { position: absolute; left: 16px; right: 16px; top: 14px; display: flex; justify-content: space-between; gap: 10px; pointer-events: none; }
.chip { pointer-events: auto; background: rgba(14, 12, 11, .72); border: 1px solid var(--line); padding: 7px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; backdrop-filter: blur(6px); }
.chip:empty { display: none; }
.chip .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--green); margin-right: 6px; box-shadow: 0 0 10px var(--green); animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.stage .banner {
  position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); text-align: center; pointer-events: none;
  font-family: var(--serif); font-weight: 900; font-size: clamp(28px, 5vw, 56px); text-shadow: 0 4px 30px rgba(0, 0, 0, .8); opacity: 0; transition: opacity .4s;
  background: rgba(14, 12, 11, .72); backdrop-filter: blur(6px); padding: 14px 28px 16px; border-radius: 18px; border: 1px solid var(--line); white-space: nowrap;
}
.stage .banner.show { opacity: 1; }
.stage .banner small { display: block; font-family: var(--sans); font-size: 15px; font-weight: 600; color: var(--gold2); margin-top: 8px; letter-spacing: .06em; }

/* paint meter */
.meter { margin-top: 14px; }
.meter .bar { position: relative; height: 22px; border-radius: 999px; background: #120f0d; border: 1px solid var(--line); overflow: hidden; }
.meter .fill {
  position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 999px; transition: width .8s cubic-bezier(.2, .9, .2, 1);
  background: linear-gradient(90deg, var(--red), var(--orange), var(--yellow), var(--green), var(--teal), var(--blue), var(--purple), var(--pink));
  background-size: 1200px 100%;
}
.meter .zone { position: absolute; top: 0; bottom: 0; border-left: 2px dashed rgba(255, 255, 255, .55); }
.meter .zone::after { content: 'curtain may fall'; position: absolute; left: 6px; top: 2px; font-size: 11px; color: rgba(255, 255, 255, .8); white-space: nowrap; font-weight: 600; }
.meter .labels { display: flex; justify-content: space-between; margin-top: 8px; font-size: 13px; color: var(--muted); }
.meter .labels b { color: var(--marble); font-size: 18px; }

/* pots */
.pots { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pot { background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 14px; position: relative; overflow: hidden; }
.pot .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); font-weight: 700; }
.pot .val { font-size: 26px; font-weight: 800; margin-top: 6px; font-variant-numeric: tabular-nums; }
.pot .val small { font-size: 13px; color: var(--muted); font-weight: 600; }
.pot.chest { border-color: #5a4419; background: linear-gradient(160deg, #2a2112, #17130d); }
.pot.chest .val { color: var(--gold2); }
.pot .icon { position: absolute; right: 10px; top: 10px; width: 34px; height: 34px; opacity: .9; }

/* guess */
.guess input, .field input, .field textarea, .trade input {
  width: 100%; background: var(--bg2); border: 1px solid var(--line); color: var(--marble); border-radius: 12px; padding: 13px 14px; font-size: 16px; font-family: inherit; outline: none;
}
.guess input:focus, .field input:focus, .field textarea:focus, .trade input:focus { border-color: var(--gold); }
.note { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.status { font-size: 13px; padding: 10px 12px; border-radius: 10px; background: var(--bg2); border: 1px solid var(--line); }
.status.ok { border-color: #1e5a33; color: #8ff0ae; }
.status.bad { border-color: #5a201c; color: #ffb4ae; }

/* trade */
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--bg2); border-radius: 12px; padding: 4px; border: 1px solid var(--line); }
.tabs button { background: none; border: 0; color: var(--muted); padding: 9px; border-radius: 9px; font-weight: 700; cursor: pointer; }
.tabs button.on.buy { background: var(--green); color: #052310; }
.tabs button.on.sell { background: #c4372d; color: #fff; }
.presets { display: flex; gap: 6px; flex-wrap: wrap; }

/* feed */
.feed { max-height: 380px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.feed .it { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; font-size: 13.5px; background: var(--bg2); animation: slidein .35s ease-out; }
.feed .it .sw { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.feed .it .t { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }
@keyframes slidein { from { opacity: 0; transform: translateY(-6px); } }

/* history */
.history { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.hcard { background: var(--bg2); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.hcard .ph { aspect-ratio: 4 / 3; background: #0b0a09 center / cover no-repeat; position: relative; }
.hcard .ph .won { position: absolute; left: 10px; bottom: 10px; font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; padding: 4px 8px; border-radius: 6px; background: rgba(0, 0, 0, .7); }
.hcard .bd { padding: 12px; font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.hcard .bd b { font-family: var(--serif); font-size: 16px; }

/* gallery */
.hero-title { font-family: var(--serif); font-weight: 900; font-size: clamp(34px, 5vw, 64px); line-height: 1.02; margin: 8px 0 10px; }
.hero-sub { color: var(--marble2); font-size: 18px; max-width: 720px; line-height: 1.5; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.tcard { background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; color: var(--marble); transition: transform .15s, border-color .15s; display: block; }
.tcard:hover { transform: translateY(-3px); border-color: #4a413a; text-decoration: none; }
.tcard .mini { aspect-ratio: 1 / 1; background: radial-gradient(ellipse at 50% 20%, rgba(255, 236, 200, .14), transparent 70%), #1a1613; position: relative; }
.tcard .mini svg { width: 100%; height: 100%; display: block; }
.tcard .bd { padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.tcard .nm { display: flex; align-items: center; gap: 10px; }
.tcard .nm img { width: 36px; height: 36px; border-radius: 10px; object-fit: cover; background: #000; }
.tcard .nm b { font-size: 16px; }
.tcard .mbar { height: 8px; border-radius: 99px; background: #120f0d; overflow: hidden; }
.tcard .mbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--red), var(--yellow), var(--green), var(--blue), var(--pink)); }
.tag { display: inline-block; font-size: 10.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; padding: 3px 7px; border-radius: 6px; background: #2a2112; color: var(--gold2); border: 1px solid #5a4419; }

/* token header */
.thead { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.thead img { width: 56px; height: 56px; border-radius: 14px; object-fit: cover; background: #000; border: 1px solid var(--line); }
.thead h1 { margin: 0; font-family: var(--serif); font-size: 30px; }
.ca { font-family: var(--mono); font-size: 12.5px; background: var(--bg2); border: 1px solid var(--line); border-radius: 9px; padding: 6px 10px; cursor: pointer; color: var(--marble2); }
.ca:hover { border-color: var(--gold); }

/* forms */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; color: var(--marble2); }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form .full { grid-column: 1 / -1; }
@media (max-width: 700px) { .form { grid-template-columns: 1fr; } }
.drop-img { border: 2px dashed var(--line); border-radius: 14px; padding: 18px; display: flex; align-items: center; gap: 16px; cursor: pointer; }
.drop-img:hover { border-color: var(--gold); }
.drop-img img { width: 84px; height: 84px; border-radius: 14px; object-fit: cover; background: var(--bg2); }

/* how */
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.step { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px; }
.step .n { font-family: var(--serif); font-size: 40px; font-weight: 900; color: var(--gold2); line-height: 1; }
.step h4 { margin: 10px 0 6px; font-size: 17px; }
.step p { margin: 0; color: var(--marble2); line-height: 1.5; font-size: 14.5px; }
table.fees { width: 100%; border-collapse: collapse; font-size: 14px; }
table.fees td, table.fees th { padding: 9px 8px; border-bottom: 1px solid var(--line); text-align: left; }
table.fees th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }

/* toast */
#toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 99; max-width: min(420px, calc(100vw - 36px)); }
.toast { background: #221d19; border: 1px solid var(--line); padding: 12px 14px; border-radius: 12px; font-size: 14px; box-shadow: 0 12px 30px rgba(0, 0, 0, .5); animation: slidein .3s; }
.toast.ok { border-color: #1e5a33; }
.toast.bad { border-color: #5a201c; }

footer { max-width: 1320px; margin: 30px auto 40px; padding: 0 22px; color: var(--muted); font-size: 13px; display: flex; gap: 16px; flex-wrap: wrap; }

/* svg animation helpers */
.splash-new { transform-box: fill-box; transform-origin: center; animation: splat .55s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes splat { from { transform: scale(0); opacity: 0; } 60% { opacity: 1; } }
.drape { transition: transform 1.6s cubic-bezier(.6, 0, .3, 1), opacity 1.6s; transform-origin: 50% 100%; }
.drape.fall { transform: translateY(70%) scaleY(.15); opacity: 0; }
.drape.rise { animation: rise 1.4s cubic-bezier(.2, .8, .2, 1); }
@keyframes rise { from { transform: translateY(70%) scaleY(.15); opacity: 0; } }
.statue-photo { transition: opacity 1.2s .6s; }
