:root {
  --text: #f6ecd6; --muted: #bfae8c; --gold: #e9c46a; --gold-hi: #fff1c1;
  --goldgrad: linear-gradient(135deg, #7a5310 0%, #e9c46a 22%, #fff3c9 38%, #c99a32 55%, #f7df95 72%, #8a6114 100%);
  --onyx: linear-gradient(160deg, rgba(34, 28, 38, .94), rgba(9, 8, 12, .97));
  --serif: "Cinzel", "Cormorant Garamond", Georgia, "Noto Serif", serif;
  --sans: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; background: #07060a; color: var(--text); font-family: var(--sans); user-select: none; -webkit-user-select: none; }
body { position: fixed; inset: 0; background: radial-gradient(120% 80% at 50% 0%, #2a1f2e, #07060a 70%); }
button { font-family: inherit; cursor: pointer; color: var(--text); }
[hidden] { display: none !important; }

#bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
#bgv { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .9s; background: center / cover no-repeat; }
#bgv.on { opacity: 1; }
/* dark veil so the blocks stay readable over the video */
#bgShade { position: absolute; inset: 0; background: radial-gradient(90% 60% at 50% 45%, rgba(7,6,10,.36), rgba(7,6,10,.58)), linear-gradient(180deg, rgba(7,6,10,.7), rgba(7,6,10,.2) 30%, rgba(7,6,10,.3) 75%, rgba(7,6,10,.85)); transition: opacity .4s; }
body.athome #bgShade { opacity: .55; }

#app { position: relative; z-index: 1; height: 100%; max-width: 560px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 8px) 12px calc(env(safe-area-inset-bottom) + 8px); display: flex; flex-direction: column; }
body.athome #app { visibility: hidden; }

/* ---------- HUD ---------- */
#hud { flex: none; display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; padding: 2px 4px 0; }
.gstat { display: flex; flex-direction: column; width: 88px; padding-top: 2px; }
.gstat.right { align-items: flex-end; }
.center { display: flex; flex-direction: column; align-items: center; flex: 1; min-width: 0; }
.label { font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.gstat b { font: 700 19px/1.25 var(--serif); font-variant-numeric: lining-nums tabular-nums; background: var(--goldgrad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.value { font: 700 38px/1 var(--serif); font-variant-numeric: lining-nums tabular-nums; background: var(--goldgrad); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 2px 0 rgba(0,0,0,.6)) drop-shadow(0 0 16px rgba(233,196,106,.25)); }
.value.bump { animation: bump .35s ease-out; }
@keyframes bump { 30% { transform: scale(1.14); filter: drop-shadow(0 2px 0 rgba(0,0,0,.6)) drop-shadow(0 0 22px rgba(255,241,193,.75)) brightness(1.25); } }
#combo { height: 22px; display: flex; align-items: center; gap: 6px; margin-top: 4px; opacity: 0; transition: opacity .25s; }
#combo.show { opacity: 1; }
#comboText { font: 700 12.5px var(--serif); letter-spacing: .14em; text-transform: uppercase; color: var(--gold-hi); margin-right: 3px; text-shadow: 0 0 10px rgba(233,196,106,.55); }
#combo i { width: 8px; height: 8px; transform: rotate(45deg); border: 1px solid rgba(233,196,106,.45); background: rgba(255,240,200,.06); }
#combo i.on { background: var(--gold); border-color: var(--gold-hi); box-shadow: 0 0 8px rgba(233,196,106,.9); }

/* ---------- Stage ---------- */
#stage { position: relative; flex: 1; min-height: 0; }
#cv { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }

/* ---------- Tools ---------- */
#tools { flex: none; display: flex; justify-content: center; gap: 34px; margin-top: 4px; }
.tool { position: relative; width: 72px; border: 0; background: none; padding: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.tool .medal { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; border: 2px solid transparent; background: radial-gradient(circle at 40% 30%, #2c2433, #0a080d) padding-box, var(--goldgrad) border-box; box-shadow: 0 5px 12px rgba(0,0,0,.55), inset 0 0 12px rgba(233,196,106,.12); transition: transform .12s; }
.tool:active .medal { transform: scale(.93); }
.tool img { width: 32px; height: 32px; object-fit: contain; }
.tool svg { width: 22px; height: 22px; fill: none; stroke: var(--gold); stroke-width: 2.2; stroke-linecap: round; }
.tool span { font: 600 11px var(--serif); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }

/* ---------- Overlay & panels ---------- */
.overlay { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; padding: calc(env(safe-area-inset-top) + 12px) 14px calc(env(safe-area-inset-bottom) + 12px); background: rgba(4,3,6,.72); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); opacity: 0; pointer-events: none; transition: opacity .25s; }
.overlay.show { opacity: 1; pointer-events: auto; }
.overlay.home { background: none; backdrop-filter: none; -webkit-backdrop-filter: none; padding: calc(env(safe-area-inset-top) + 8px) 12px calc(env(safe-area-inset-bottom) + 8px); align-items: stretch; }
.panel { width: 100%; max-width: 400px; max-height: 100%; overflow-y: auto; padding: 22px 18px; border-radius: 22px; border: 1.5px solid transparent; background: linear-gradient(170deg, #1d1822, #0b090e) padding-box, var(--goldgrad) border-box; box-shadow: 0 24px 70px rgba(0,0,0,.75); text-align: center; overscroll-behavior: contain; }
.panel.tall { height: 100%; }
.panel h2 { margin: 4px 0; font: 700 24px var(--serif); letter-spacing: .08em; background: var(--goldgrad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.panel .final { margin: 6px 0; font: 700 44px/1.1 var(--serif); color: var(--gold-hi); font-variant-numeric: lining-nums tabular-nums; text-shadow: 0 0 22px rgba(233,196,106,.35); }
.panel p { color: var(--muted); font-size: 13.5px; line-height: 1.45; margin: 6px 0; }
.panel p.sub { margin: 4px 0 12px; }
.panel img.emb { display: block; margin: 0 auto 2px; width: 64px; height: 64px; object-fit: contain; filter: drop-shadow(0 6px 12px rgba(0,0,0,.6)); }
.panel button.wide { position: relative; overflow: hidden; display: block; width: 100%; min-height: 46px; margin: 9px 0; padding: 12px; border-radius: 13px; border: 1px solid rgba(233,196,106,.4); background: rgba(255,240,200,.04); font: 700 15px var(--serif); letter-spacing: .1em; text-transform: uppercase; color: var(--gold-hi); }
.panel button.wide:active { background: rgba(255,240,200,.12); }
.panel button.wide.go { border: 0; background: var(--goldgrad); color: #2a1a05; box-shadow: 0 6px 18px rgba(233,196,106,.25); }
.panel button.wide small { display: block; margin-top: 3px; font: 600 11.5px var(--sans); letter-spacing: .06em; text-transform: none; color: rgba(42,26,5,.8); }
.badge { display: inline-block; margin: 4px 0; padding: 5px 14px; border-radius: 99px; border: 1px solid rgba(233,196,106,.5); color: var(--gold-hi); font-weight: 700; font-size: 13px; letter-spacing: .04em; }
.badge.pop { animation: pop .5s cubic-bezier(.3,1.6,.5,1) both .3s; }
@keyframes pop { from { transform: scale(0); } to { transform: none; } }

/* ---------- Home (rendered into the panel, without the frame) ---------- */
.panel.home { max-width: 536px; max-height: none; height: 100%; padding: 0 0 4px; border: 0; border-radius: 0; background: none; box-shadow: none; animation: viewIn .45s ease-out; }
@keyframes viewIn { from { opacity: 0; transform: translateY(10px); } }
.titleArt { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 18px; background: url(media/title-lux.webp) center / cover no-repeat; box-shadow: 0 14px 40px rgba(0,0,0,.6); overflow: hidden; }
.titleArt::before { content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1.5px; background: var(--goldgrad); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; }
.titleArt::after, .card::after, .panel button.wide.go::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; background: linear-gradient(105deg, transparent 40%, rgba(255,245,215,.2) 50%, transparent 60%) no-repeat; background-size: 250% 100%; animation: sheen 7s ease-in-out infinite; }
@keyframes sheen { 0%, 60% { background-position: 150% 0; } 100% { background-position: -60% 0; } }
#logo { width: 220px; height: 44px; display: block; margin: 22px auto 0; filter: drop-shadow(0 6px 12px rgba(0,0,0,.6)); }
h1 { margin: 16px 0 0; text-align: center; font: 700 38px/1.05 var(--serif); letter-spacing: .1em; text-transform: uppercase; background: var(--goldgrad); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 2px 0 rgba(0,0,0,.6)) drop-shadow(0 0 18px rgba(233,196,106,.25)); }
.panel p.tag { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); margin: 8px 0 16px; font-size: 11px; letter-spacing: .32em; text-transform: uppercase; }
.tag::before, .tag::after { content: ""; width: 30px; height: 1px; background: linear-gradient(90deg, transparent, var(--gold)); }
.tag::after { transform: scaleX(-1); }
.panel.home button.wide.go { margin: 0 0 10px; }
.cards { display: grid; grid-template-columns: 1fr; gap: 10px; }
.card { position: relative; overflow: hidden; width: 100%; min-height: 64px; border-radius: 16px; padding: 12px 14px; display: flex; align-items: center; gap: 12px; text-align: left; border: 1.5px solid transparent; background: var(--onyx) padding-box, var(--goldgrad) border-box; box-shadow: 0 10px 24px rgba(0,0,0,.5); transition: transform .12s; }
.card.big { background: linear-gradient(135deg, #4a0d1c, #1a0509 70%) padding-box, var(--goldgrad) border-box; }
.card.daily { background: linear-gradient(135deg, #073a2c, #03140f 70%) padding-box, var(--goldgrad) border-box; }
.card:active { transform: scale(.97); }
.card img { flex: none; width: 54px; height: 54px; object-fit: contain; filter: drop-shadow(0 4px 8px rgba(0,0,0,.6)); animation: bob 3.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-3px); } }
.card b { display: block; font: 700 19px var(--serif); letter-spacing: .06em; background: var(--goldgrad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.card small { display: block; margin-top: 2px; font-size: 11.5px; line-height: 1.35; color: var(--muted); letter-spacing: .03em; }
.homebtns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0 4px; }
button.mid { min-height: 52px; border-radius: 14px; padding: 9px 6px; border: 1px solid rgba(233,196,106,.35); background: rgba(12,10,16,.7); font: 600 13px var(--serif); letter-spacing: .06em; color: var(--gold-hi); }
button.mid:active { background: rgba(233,196,106,.14); }
button.mid.span2 { grid-column: span 2; }
button.mid small { display: block; font: 500 11px var(--sans); letter-spacing: .04em; color: var(--muted); margin-top: 3px; }
button.mid img.mi { width: 22px; height: 22px; object-fit: contain; vertical-align: -6px; margin-right: 6px; }
.toggles { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 16px; margin: 12px 0 2px; font-size: 13px; color: var(--muted); letter-spacing: .03em; }
.toggles label { display: inline-flex; align-items: center; gap: 7px; min-height: 44px; }
.toggles input { width: 18px; height: 18px; margin: 0; accent-color: #c99a32; }
details { margin-top: 6px; text-align: left; font-size: 13px; color: var(--muted); border: 1px solid rgba(233,196,106,.22); border-radius: 14px; background: rgba(12,10,16,.7); padding: 0 14px; }
summary { cursor: pointer; text-align: center; min-height: 44px; line-height: 44px; font: 600 13px/44px var(--serif); letter-spacing: .1em; text-transform: uppercase; color: var(--gold-hi); }
details p { margin: 0 0 10px; }
details b { color: var(--gold-hi); font-weight: 600; }
.panel p.fine { text-align: center; font-size: 11.5px; color: var(--muted); margin: 14px 0 6px; letter-spacing: .03em; }
.fine a { display: inline-block; padding: 15px 6px; margin: -15px -2px; color: var(--gold); font-weight: 700; text-decoration: none; }

/* ---------- Lists ---------- */
.head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; position: sticky; top: -22px; padding: 6px 0; background: #1a1620; box-shadow: 0 -22px 0 #1a1620; z-index: 1; }
.head h2 { flex: 1; }
.back { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(233,196,106,.45); background: none; color: var(--gold-hi); font-size: 26px; line-height: 1; padding-bottom: 4px; }
.headpad { flex: none; width: 44px; font-size: 13px; color: var(--gold); }
.achlist { list-style: none; padding: 0; margin: 6px 0; text-align: left; }
.achlist li { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 12px; margin: 6px 0; border: 1px solid rgba(233,196,106,.1); opacity: .5; }
.achlist li.got { opacity: 1; border-color: rgba(233,196,106,.45); background: rgba(233,196,106,.06); }
.achlist .ic { width: 22px; text-align: center; font-size: 20px; color: var(--gold); }
.achlist b { display: block; font: 700 14px var(--serif); letter-spacing: .04em; color: var(--gold-hi); }
.achlist small { font-size: 12px; color: var(--muted); }
table.list { width: 100%; border-collapse: collapse; font-size: 13.5px; text-align: left; }
table.list td { padding: 9px 4px; border-bottom: 1px solid rgba(233,196,106,.12); color: var(--muted); }
table.list td + td { text-align: right; font: 700 14px var(--serif); font-variant-numeric: lining-nums tabular-nums; color: var(--gold-hi); }

#toast { position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 12px); transform: translate(-50%, -220%); width: max-content; max-width: 90vw; padding: 10px 18px; border-radius: 14px; border: 1.5px solid transparent; background: linear-gradient(#17131b, #0b090e) padding-box, var(--goldgrad) border-box; color: var(--gold-hi); font: 700 13.5px var(--serif); letter-spacing: .05em; text-align: center; box-shadow: 0 12px 34px rgba(0,0,0,.6); transition: transform .35s cubic-bezier(.3,1.3,.5,1); z-index: 40; pointer-events: none; }
#toast.show { transform: translate(-50%, 0); }
