: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; }
#bgShade { position: absolute; inset: 0; background: radial-gradient(90% 60% at 50% 45%, rgba(7,6,10,.1), rgba(7,6,10,.55)), linear-gradient(180deg, rgba(7,6,10,.55), rgba(7,6,10,.1) 30%, rgba(7,6,10,.25) 75%, rgba(7,6,10,.8)); }
#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; }
.view { display: none; flex: 1; min-height: 0; flex-direction: column; }
.view.show { display: flex; animation: viewIn .45s ease-out; }
@keyframes viewIn { from { opacity: 0; transform: translateY(10px); } }

#home { overflow-y: auto; overscroll-behavior: contain; }
.titleArt { position: relative; flex: none; width: 100%; aspect-ratio: 16 / 8.5; border-radius: 18px; background: url(media/title.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; } }
h1 { flex: none; 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)); }
.tag { flex: none; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); margin: 8px 0 16px; font-size: 10.5px; letter-spacing: .34em; text-transform: uppercase; }
.tag::before, .tag::after { content: ""; width: 34px; height: 1px; background: linear-gradient(90deg, transparent, var(--gold)); }
.tag::after { transform: scaleX(-1); }
.cards { flex: none; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.card { position: relative; overflow: hidden; border-radius: 16px; padding: 10px 12px; display: flex; align-items: center; gap: 10px; 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 { grid-column: span 2; padding: 14px; background: linear-gradient(135deg, #4a0d1c, #1a0509 70%) padding-box, var(--goldgrad) border-box; }
.card.wide { grid-column: span 2; background: linear-gradient(135deg, #073a2c, #03140f 70%) padding-box, var(--goldgrad) border-box; }
.card:active { transform: scale(.97); }
.card img { width: 48px; height: 48px; object-fit: contain; filter: drop-shadow(0 4px 8px rgba(0,0,0,.6)); animation: bob 3.4s ease-in-out infinite; }
.card.big img { width: 62px; height: 62px; }
@keyframes bob { 50% { transform: translateY(-3px); } }
.card b { display: block; font: 700 16px var(--serif); letter-spacing: .06em; background: var(--goldgrad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.card.big b { font-size: 22px; }
.card small { font-size: 11.5px; color: var(--muted); letter-spacing: .04em; }
.homebtns { flex: none; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0 4px; }
button.mid { border-radius: 14px; padding: 10px 6px; border: 1px solid rgba(233,196,106,.35); background: rgba(12,10,16,.7); font: 600 13px var(--serif); letter-spacing: .08em; color: var(--gold-hi); }
button.mid small { display: block; font: 500 11px var(--sans); letter-spacing: .04em; color: var(--muted); margin-top: 3px; }
.toggles { flex: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 16px; margin: 14px 0 4px; font-size: 13px; color: var(--muted); letter-spacing: .03em; }
.toggles input { width: 17px; height: 17px; vertical-align: -3px; accent-color: #c99a32; }
.fine { flex: none; text-align: center; font-size: 11.5px; color: var(--muted); margin: 12px 0 4px; letter-spacing: .03em; }
.fine a { color: var(--gold); font-weight: 700; text-decoration: none; }

#gtop { flex: none; display: flex; align-items: center; gap: 10px; height: 48px; }
.topbtn { width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid transparent; background: var(--onyx) padding-box, var(--goldgrad) border-box; display: grid; place-items: center; flex: none; color: var(--gold-hi); }
.topbtn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; }
.gstat { flex: 1; display: flex; flex-direction: column; }
.gstat.mid { align-items: center; } .gstat.right { align-items: flex-end; }
.label { font-size: 9.5px; letter-spacing: .26em; text-transform: uppercase; color: var(--muted); }
.gstat b { font: 700 21px var(--serif); font-variant-numeric: lining-nums tabular-nums; background: var(--goldgrad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.gstat b.low { background: none; color: #ff7b8f; -webkit-text-fill-color: #ff7b8f; animation: throb .8s infinite; }
@keyframes throb { 50% { transform: scale(1.1); } }
#stars { flex: none; display: flex; justify-content: center; gap: 5px; height: 16px; }
#stars i { width: 15px; height: 15px; background: rgba(255,240,200,.14); clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); transition: background .3s, transform .3s; }
#stars i.on { background: var(--goldgrad); transform: scale(1.15); }
#stage { position: relative; flex: 1; min-height: 0; }
#cv { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
#boosts { flex: none; display: flex; justify-content: center; gap: 18px; margin-top: 6px; }
.boost { position: relative; width: 74px; border: 0; background: none; padding: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.boost .medal { width: 54px; height: 54px; 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 6px 14px rgba(0,0,0,.6), inset 0 0 12px rgba(233,196,106,.15); transition: transform .15s, box-shadow .2s; }
.boost img { width: 40px; height: 40px; object-fit: contain; }
.boost span { font: 600 10px var(--serif); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.boost em { position: absolute; top: -2px; right: 6px; min-width: 20px; height: 20px; border-radius: 10px; background: var(--goldgrad); color: #2a1a05; font: 800 11px/20px var(--sans); font-style: normal; box-shadow: 0 2px 6px rgba(0,0,0,.5); }
.boost.empty { opacity: .4; } .boost.empty em { background: #4a4150; color: #fff; }
.boost.armed .medal { transform: scale(1.08); box-shadow: 0 0 0 3px rgba(255,241,193,.9), 0 0 26px rgba(233,196,106,.85); }
.boost.armed span { color: var(--gold-hi); }

.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; }
.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 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 .big { margin: 6px 0; font: 700 42px 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; margin: 6px 0; }
.panel img.emb { 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%; margin: 9px 0; padding: 13px; 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.go { border: 0; background: var(--goldgrad); color: #2a1a05; box-shadow: 0 6px 18px rgba(233,196,106,.25); }
.winstars { font-size: 52px; letter-spacing: 8px; line-height: 1.1; margin: 6px 0; }
.winstars span { display: inline-block; color: rgba(255,240,200,.13); }
.winstars span.on { background: var(--goldgrad); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 12px rgba(233,196,106,.6)); animation: starPop .6s cubic-bezier(.3,1.6,.5,1) both; animation-delay: calc(.3s + var(--i) * .3s); }
@keyframes starPop { from { transform: scale(0) rotate(-40deg); opacity: 0; } }
.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; }
.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 { width: 40px; height: 40px; 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 { width: 40px; font-size: 13px; color: var(--gold); }
.lvgrid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 9px; }
.lv { aspect-ratio: 1; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 2px solid transparent; background: radial-gradient(circle at 38% 30%, #2e2735, #0b090e 75%) padding-box, var(--goldgrad) border-box; box-shadow: 0 4px 10px rgba(0,0,0,.5); font: 700 16px var(--serif); color: var(--gold-hi); padding: 0; }
.lv small { font-size: 8.5px; color: var(--gold); letter-spacing: 1px; }
.lv.cur { background: radial-gradient(circle at 38% 30%, #ff5a7a, #8e0f2e 60%, #3a0412) padding-box, var(--goldgrad) border-box; animation: throb 1.6s infinite; }
.lv.locked { background: rgba(255,240,200,.04); border-color: rgba(233,196,106,.15); box-shadow: none; color: rgba(255,240,200,.25); }
table.list { width: 100%; border-collapse: collapse; font-size: 13.5px; text-align: left; }
table.list td { padding: 8px 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); color: var(--gold-hi); }
.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 { font-size: 20px; } .achlist b { display: block; font: 700 14px var(--serif); letter-spacing: .04em; color: var(--gold-hi); } .achlist small { color: var(--muted); }
#toast { position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 58px); transform: translate(-50%, -220%); 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; 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); }
button.mid img.mi { width: 22px; height: 22px; object-fit: contain; vertical-align: -6px; margin-right: 6px; }
/* ---- Golf King ---- */
.titleArt { background: url(media/title.webp) center / cover no-repeat, radial-gradient(circle at 70% 58%, #07060a 0 5%, #e9c46a 5.2% 6%, transparent 6.3%), radial-gradient(circle at 30% 50%, #fff 0 3%, transparent 3.3%), radial-gradient(120% 120% at 50% 30%, #1d7a50, #072a1b 80%); }
.card.big.garden { background: linear-gradient(135deg, #0f4a33, #04160f 70%) padding-box, var(--goldgrad) border-box; }
.cards .card:not(.big) { gap: 8px; padding: 10px; }
.cards .card:not(.big) b { font-size: 14px; letter-spacing: .02em; }
.cards .card:not(.big) img { width: 40px; height: 40px; }
.card.locked img { filter: grayscale(1) brightness(.6); animation: none; }
.card.locked b { opacity: .6; }
.resume { position: relative; flex: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-height: 48px; margin: 0 0 10px; padding: 10px 16px; border-radius: 14px; border: 0; background: var(--goldgrad); color: #2a1a05; font: 700 15px var(--serif); letter-spacing: .08em; text-transform: uppercase; box-shadow: 0 6px 18px rgba(233,196,106,.25); }
.resume small { font: 600 11.5px var(--sans); letter-spacing: .02em; text-transform: none; color: #4a3108; }
button.mid.span2 { grid-column: span 2; }
button.mid { min-height: 48px; }
#stage { touch-action: none; }
#cv { cursor: crosshair; }
#status { flex: none; text-align: center; min-height: 20px; font: 600 12px var(--serif); letter-spacing: .08em; color: var(--gold-hi); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gstat b { font-size: 19px; white-space: nowrap; }
#tools { flex: none; display: flex; justify-content: center; gap: 14px; margin-top: 6px; }
.tool { position: relative; width: 70px; 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); transition: transform .12s; }
.tool:active .medal { transform: scale(.93); }
.tool img { width: 32px; height: 32px; object-fit: contain; }
.tool span { font: 600 11px var(--serif); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.tool em { position: absolute; top: -3px; right: 5px; min-width: 20px; height: 20px; padding: 0 4px; border-radius: 10px; background: var(--goldgrad); color: #2a1a05; font: 800 11px/20px var(--sans); font-style: normal; box-shadow: 0 2px 6px rgba(0,0,0,.5); }
.tool.off { opacity: .38; }
.seg { display: flex; gap: 6px; justify-content: center; margin: 8px 0; flex-wrap: wrap; }
.seg button { flex: 1; min-width: 70px; min-height: 44px; padding: 9px 6px; border-radius: 12px; border: 1px solid rgba(233,196,106,.4); background: rgba(255,240,200,.04); color: var(--muted); font: 700 13px var(--serif); letter-spacing: .05em; }
.seg button.on { background: var(--goldgrad); color: #2a1a05; border-color: transparent; }
.lvgrid { grid-template-columns: repeat(6, 1fr); gap: 7px; margin-top: 10px; }
.lv { position: relative; font-size: 15px; min-width: 44px; }
.lv small { font-size: 11px; letter-spacing: 0; line-height: 1; }
.lv i { position: absolute; top: -4px; right: -4px; min-width: 17px; height: 17px; border-radius: 9px; background: #15111a; border: 1px solid rgba(233,196,106,.5); font: 700 11px/15px var(--sans); font-style: normal; color: var(--gold-hi); }
table.scard { width: 100%; border-collapse: collapse; font-size: 12.5px; margin: 8px 0; font-variant-numeric: tabular-nums; }
table.scard th { font: 600 11px var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding: 5px 2px; border-bottom: 1px solid rgba(233,196,106,.25); }
table.scard td { padding: 5px 2px; border-bottom: 1px solid rgba(233,196,106,.1); color: var(--muted); text-align: center; }
table.scard td:first-child, table.scard th:first-child { text-align: left; }
table.scard td.s { font: 700 13.5px var(--serif); color: var(--gold-hi); }
table.scard td.under { color: #7fe3b0; } table.scard td.over { color: #ff9aa8; }
table.scard tr.cur td { background: rgba(233,196,106,.09); }
table.scard tr.tot td { border-top: 1px solid rgba(233,196,106,.45); border-bottom: 0; font: 700 14px var(--serif); color: var(--gold-hi); }
.panel p.fine { margin-top: 12px; line-height: 1.5; }
.panel .sub { font-size: 12px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); margin: 2px 0 6px; }
.panel button.wide:disabled { opacity: .4; }
#bgShade { transition: background-color .6s; }
body.ingame #bgShade { background-color: rgba(7,6,10,.5); }
.label { font-size: 11px; letter-spacing: .16em; }
.tag { font-size: 11px; letter-spacing: .3em; }
.boost span, .tool span { font-size: 11px; }
#toast { opacity: 0; transition: transform .35s cubic-bezier(.3,1.3,.5,1), opacity .25s; }
#toast.show { opacity: 1; }
