: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; }
/* ---- Word King ---- */
:root {
  --ivory: linear-gradient(160deg, #fffaf0 0%, #f3e6c8 55%, #d9c497 100%);
  --silver: #d9dde6; --ink: #2a1a05;
}
.titleArt { background: radial-gradient(120% 120% at 50% 0%, #3a2a1c, #120c10 70%); display: grid; place-items: center; }
.titleFb { display: flex; gap: 8px; }
.titleFb i { width: 52px; height: 60px; border-radius: 9px; display: grid; place-items: center; font: 800 32px var(--serif); font-style: normal; color: var(--ink); background: var(--ivory) padding-box, var(--goldgrad) border-box; border: 2px solid transparent; box-shadow: 0 8px 18px rgba(0,0,0,.55); }
.titleFb i:nth-child(odd) { transform: rotate(-4deg) translateY(3px); } .titleFb i:nth-child(even) { transform: rotate(3deg) translateY(-3px); }
.titleImg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.card.big.crown { background: linear-gradient(135deg, #4a3208, #161005 70%) padding-box, var(--goldgrad) border-box; }
.cards .card:not(.big) { gap: 8px; padding: 10px; }
.cards .card:not(.big) b { font-size: 13.5px; letter-spacing: .02em; }
.cards .card:not(.big) img { width: 40px; height: 40px; }
.cards .card.done small { color: var(--gold); }
.homebtns.three { grid-template-columns: repeat(3, 1fr); gap: 8px; }
.homebtns.three button.mid { padding: 9px 2px; font-size: 11px; letter-spacing: .03em; min-height: 44px; }
.homebtns.three button.mid img.mi { display: block; margin: 0 auto 4px; width: 26px; height: 26px; }
.purse { flex: none; display: flex; align-items: center; justify-content: center; gap: 7px; margin: 10px 0 0; color: var(--muted); font-size: 11.5px; }
.purse b { font: 700 16px var(--serif); color: var(--gold-hi); font-variant-numeric: lining-nums; }
.coin { display: inline-block; width: 16px; height: 16px; border-radius: 50%; background: var(--goldgrad); box-shadow: inset 0 0 0 2px rgba(122,83,16,.7), 0 1px 3px rgba(0,0,0,.6); flex: none; }
.coinpill { flex: none; display: flex; align-items: center; gap: 6px; padding: 5px 11px 5px 7px; border-radius: 99px; border: 1px solid rgba(233,196,106,.4); background: rgba(12,10,16,.6); }
.coinpill b { font: 700 15px var(--serif); color: var(--gold-hi); font-variant-numeric: lining-nums tabular-nums; }
.coinpill.bump { animation: bump .45s ease-out; }
@keyframes bump { 40% { transform: scale(1.18); } }
.gstat b { font-size: 19px; white-space: nowrap; }
#status { flex: none; text-align: center; min-height: 20px; font: 600 12.5px var(--serif); letter-spacing: .08em; color: var(--gold-hi); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#stars { margin: 2px 0 4px; }
#stage { touch-action: none; display: flex; flex-direction: column; }
.mode { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; }
#fx { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 20; pointer-events: none; }

/* letter plaques */
.tile, .wt, .rt, .rs { display: grid; place-items: center; font-family: var(--serif); font-weight: 800; text-transform: uppercase; border-radius: 9px; line-height: 1; }

/* ---- Crown Words ---- */
#crown { justify-content: center; }
#grid { --ts: 54px; display: grid; grid-template-rows: repeat(6, var(--ts)); gap: 6px; }
.row { display: grid; grid-template-columns: repeat(5, var(--ts)); gap: 6px; }
.row.shake { animation: shake .42s ease-in-out; }
@keyframes shake { 15% { transform: translateX(-7px); } 35% { transform: translateX(6px); } 55% { transform: translateX(-4px); } 75% { transform: translateX(3px); } }
.tile { position: relative; font-size: calc(var(--ts) * .5); color: var(--ink); border: 1.5px solid rgba(233,196,106,.3); background: rgba(14,11,18,.62); transition: border-color .15s; }
.tile.ghost { color: rgba(233,196,106,.55); border-style: dashed; border-color: rgba(233,196,106,.6); }
.tile.filled { border: 2px solid transparent; background: var(--ivory) padding-box, var(--goldgrad) border-box; box-shadow: 0 4px 10px rgba(0,0,0,.45), inset 0 -3px 0 rgba(122,83,16,.18); animation: pop .13s ease-out; }
@keyframes pop { from { transform: scale(.82); } 60% { transform: scale(1.07); } }
.tile.flip { animation: flip .46s ease-in-out both; }
@keyframes flip { 0% { transform: rotateX(0); } 48% { transform: rotateX(90deg); } 52% { transform: rotateX(90deg); } 100% { transform: rotateX(0); } }
.tile.hit { border: 2px solid transparent; background: var(--goldgrad) padding-box, linear-gradient(#fff3c9, #8a6114) border-box; color: var(--ink); box-shadow: 0 0 16px rgba(233,196,106,.35), 0 4px 10px rgba(0,0,0,.45); }
.tile.near { border: 2px solid var(--silver); background: linear-gradient(160deg, #3b3f4a, #1b1d24); color: #f4f6fb; box-shadow: 0 4px 10px rgba(0,0,0,.45); }
.tile.miss { border: 1.5px solid rgba(255,255,255,.07); background: #121016; color: #7d7686; }
.tile.win { animation: hop .6s cubic-bezier(.3,1.6,.5,1) both; animation-delay: calc(var(--i) * 90ms); }
@keyframes hop { 35% { transform: translateY(-14px) scale(1.06); } }
/* corner marks: never colour alone — tick = right place, dot = in the word, bar = not in the word */
.tile.hit::after, .key.k2::after { content: ""; position: absolute; top: 4px; right: 5px; width: 5px; height: 9px; border: solid var(--ink); border-width: 0 2.2px 2.2px 0; transform: rotate(40deg); }
.tile.near::after, .key.k1::after { content: ""; position: absolute; top: 5px; right: 5px; width: 8px; height: 8px; border-radius: 50%; background: var(--silver); }
.tile.miss::after, .key.k0::after { content: ""; position: absolute; top: 8px; right: 5px; width: 8px; height: 2.2px; border-radius: 2px; background: #6a6472; }

/* keyboard: 10 keys per row, fits 360 px */
#kb { flex: none; display: flex; flex-direction: column; gap: 6px; margin: 8px -6px 0; }
.krow { display: flex; gap: 4px; justify-content: center; }
.key { position: relative; flex: 1 1 0; min-width: 0; height: 52px; padding: 0; border-radius: 8px; border: 1px solid rgba(233,196,106,.38); background: linear-gradient(170deg, #2b2431, #16121b); color: var(--gold-hi); font: 700 17px var(--serif); text-transform: uppercase; box-shadow: 0 3px 0 rgba(0,0,0,.5); transition: transform .06s, background .3s; }
.key:active, .key.press { transform: translateY(2px) scale(.96); box-shadow: 0 1px 0 rgba(0,0,0,.5); }
.key.wide { flex: 1.55 1 0; font: 700 11px var(--serif); letter-spacing: .04em; }
.key.wide svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.kpad { flex: .5 1 0; }
.key.k2 { background: linear-gradient(180deg, #fff3c9, #e9c46a 45%, #c0902c); color: var(--ink); border-color: #8a6114; }
.key.k1 { background: linear-gradient(160deg, #3b3f4a, #1b1d24); color: #f4f6fb; border: 1.5px solid var(--silver); }
.key.k0 { background: #0e0c11; color: #5f5968; border-color: rgba(255,255,255,.06); }
.key.k2::after, .key.k1::after, .key.k0::after { top: 3px; right: 3px; transform-origin: center; scale: .8; }
.key.k2::after { transform: rotate(40deg); }

/* ---- tools ---- */
#tools { flex: none; display: flex; justify-content: center; gap: 10px; margin-top: 8px; min-height: 0; }
#tools:empty { display: none; }
.tool { position: relative; width: 66px; border: 0; background: none; padding: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.tool .medal { width: 46px; height: 46px; 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: 30px; height: 30px; object-fit: contain; }
.tool .medal svg { width: 24px; height: 24px; fill: none; stroke: var(--gold); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.tool span { font: 600 11px var(--serif); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.tool em { position: absolute; top: -3px; right: 2px; min-width: 22px; height: 19px; padding: 0 5px; border-radius: 10px; background: var(--goldgrad); color: var(--ink); font: 800 11px/19px var(--sans); font-style: normal; box-shadow: 0 2px 6px rgba(0,0,0,.5); }
.tool:disabled, .tool.poor { opacity: .4; }

/* ---- Word Wheel ---- */
#wheel { justify-content: space-between; }
#wslots { --ts: 30px; flex: 1; min-height: 0; width: 100%; display: grid; grid-auto-flow: column; justify-content: center; align-content: center; gap: 5px 16px; }
.wword { display: flex; gap: 3px; }
.wword.again { animation: shake .4s; }
.wt { width: var(--ts); height: var(--ts); font-size: calc(var(--ts) * .56); border-radius: calc(var(--ts) * .2); border: 1.5px solid rgba(233,196,106,.32); background: rgba(14,11,18,.66); color: transparent; }
.wt.hinted { color: var(--gold); border-style: dashed; border-color: rgba(233,196,106,.7); }
.wt.on { color: var(--ink); border: 1.5px solid transparent; background: var(--ivory) padding-box, var(--goldgrad) border-box; box-shadow: 0 3px 7px rgba(0,0,0,.45); animation: flipIn .42s ease-out both; animation-delay: calc(var(--i) * 60ms); }
@keyframes flipIn { from { transform: rotateX(90deg) scale(.8); opacity: 0; } 60% { transform: rotateX(-12deg) scale(1.08); opacity: 1; } }
#wcur { flex: none; height: 40px; display: grid; place-items: center; }
#wcurText { min-width: 40px; padding: 5px 16px; border-radius: 99px; font: 800 20px var(--serif); letter-spacing: .16em; text-transform: uppercase; color: var(--ink); background: var(--goldgrad); box-shadow: 0 4px 12px rgba(0,0,0,.5); visibility: hidden; }
#wcurText.on { visibility: visible; }
#wcurText.bad { animation: shake .4s; background: linear-gradient(160deg, #4a4150, #26212b); color: #d9d2e0; }
#wcurText.good { animation: bump .4s; }
#wheelBox { --d: 260px; position: relative; flex: none; width: var(--d); height: var(--d); border-radius: 50%; border: 2px solid transparent; background: radial-gradient(circle at 50% 35%, rgba(52,42,60,.9), rgba(10,8,13,.94) 72%) padding-box, var(--goldgrad) border-box; box-shadow: 0 14px 34px rgba(0,0,0,.6), inset 0 0 30px rgba(233,196,106,.1); touch-action: none; }
#wline { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
#wpoly { fill: none; stroke: #e9c46a; stroke-width: 9; stroke-linecap: round; stroke-linejoin: round; opacity: .85; filter: drop-shadow(0 0 6px rgba(233,196,106,.6)); }
.wl { position: absolute; width: calc(var(--d) * .235); height: calc(var(--d) * .235); margin: calc(var(--d) * -.1175) 0 0 calc(var(--d) * -.1175); border-radius: 50%; display: grid; place-items: center; font: 800 calc(var(--d) * .125) var(--serif); text-transform: uppercase; color: var(--ink); border: 2px solid transparent; background: var(--ivory) padding-box, var(--goldgrad) border-box; box-shadow: 0 5px 10px rgba(0,0,0,.5); pointer-events: none; transition: left .35s cubic-bezier(.4,1.3,.5,1), top .35s cubic-bezier(.4,1.3,.5,1), transform .12s, box-shadow .12s; }
.wl.sel { transform: scale(1.14); background: var(--goldgrad) padding-box, linear-gradient(#fff3c9, #8a6114) border-box; box-shadow: 0 0 0 3px rgba(255,241,193,.85), 0 0 20px rgba(233,196,106,.7); }

/* ---- Word Search ---- */
#search { gap: 6px; }
#slist { flex: none; width: 100%; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 5px; }
.sw { padding: 3px 8px; border-radius: 99px; border: 1px solid rgba(233,196,106,.35); background: rgba(12,10,16,.6); font: 700 11.5px var(--serif); letter-spacing: .06em; text-transform: uppercase; color: var(--gold-hi); }
.sw.found { text-decoration: line-through; text-decoration-thickness: 2px; color: var(--muted); border-color: rgba(233,196,106,.12); background: none; }
.sw.found::before { content: "✓ "; color: var(--gold); text-decoration: none; display: inline-block; }
.sw.just { animation: bump .5s; }
#sgridWrap { flex: 1; min-height: 0; width: 100%; display: grid; place-items: center; }
#sgrid { --g: 300px; --n: 8; position: relative; width: var(--g); height: var(--g); border-radius: 14px; border: 1.5px solid transparent; background: linear-gradient(170deg, rgba(30,24,36,.9), rgba(9,8,12,.94)) padding-box, var(--goldgrad) border-box; box-shadow: 0 12px 30px rgba(0,0,0,.6); touch-action: none; }
#scaps { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#scaps line { stroke-linecap: round; }
#scaps .cap { stroke: url(#capGold); opacity: .96; animation: capIn .35s ease-out; }
#scaps .capEdge { stroke: rgba(122,83,16,.9); }
#scaps .selLine { stroke: rgba(255,241,193,.32); }
@keyframes capIn { from { opacity: 0; } }
#scells { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(var(--n), 1fr); grid-template-rows: repeat(var(--n), 1fr); pointer-events: none; }
.sc { display: grid; place-items: center; font: 700 calc(var(--g) / var(--n) * .56) var(--serif); text-transform: uppercase; color: #f1e6cc; transition: color .2s, transform .12s; }
.sc.sel { color: #fff; transform: scale(1.18); }
.sc.found { color: var(--ink); }
.sc.pulse { animation: pulse .7s ease-in-out 4; color: var(--gold-hi); }
@keyframes pulse { 50% { transform: scale(1.5); text-shadow: 0 0 14px #e9c46a; } }

/* ---- Anagram Rush ---- */
#rush { justify-content: center; gap: 18px; --rs: 44px; }
#rcombo { height: 30px; font: 800 22px var(--serif); letter-spacing: .1em; background: var(--goldgrad); -webkit-background-clip: text; background-clip: text; color: transparent; }
#rcombo.bump { animation: bump .4s; }
#rslots, #rtiles { display: flex; gap: 6px; justify-content: center; min-height: var(--rs); }
#rslots.shake { animation: shake .42s; }
.rs { width: var(--rs); height: calc(var(--rs) * 1.12); font-size: calc(var(--rs) * .52); border: 1.5px dashed rgba(233,196,106,.45); background: rgba(14,11,18,.6); color: var(--ink); padding: 0; }
.rs.full { border: 2px solid transparent; background: var(--ivory) padding-box, var(--goldgrad) border-box; box-shadow: 0 4px 10px rgba(0,0,0,.45); animation: pop .13s ease-out; }
.rs.lock { background: var(--goldgrad) padding-box, linear-gradient(#fff3c9, #8a6114) border-box; }
.rs.lock::after { content: ""; position: absolute; }
.rs.right { animation: hop .45s cubic-bezier(.3,1.6,.5,1) both; animation-delay: calc(var(--i) * 45ms); background: var(--goldgrad) padding-box, linear-gradient(#fff3c9, #8a6114) border-box; }
.rt { width: var(--rs); height: calc(var(--rs) * 1.12); font-size: calc(var(--rs) * .52); padding: 0; color: var(--ink); border: 2px solid transparent; background: var(--ivory) padding-box, var(--goldgrad) border-box; box-shadow: 0 5px 0 rgba(90,62,12,.8), 0 8px 14px rgba(0,0,0,.5); transition: transform .1s, opacity .15s; animation: dealIn .3s ease-out both; animation-delay: calc(var(--i) * 35ms); }
@keyframes dealIn { from { transform: translateY(14px) rotate(-8deg); opacity: 0; } }
.rt:active { transform: translateY(3px); }
.rt.used { opacity: .16; pointer-events: none; box-shadow: none; }

/* ---- panels ---- */
.seg { display: flex; gap: 6px; justify-content: center; margin: 8px 0; flex-wrap: wrap; }
.panel .coinline { display: flex; align-items: center; justify-content: center; gap: 7px; font: 700 16px var(--serif); color: var(--gold-hi); margin: 8px 0; }
.panel .answer { display: flex; justify-content: center; gap: 5px; margin: 10px 0; }
.panel .answer i { width: 40px; height: 44px; border-radius: 8px; display: grid; place-items: center; font: 800 22px var(--serif); font-style: normal; text-transform: uppercase; color: var(--ink); border: 2px solid transparent; background: var(--goldgrad) padding-box, linear-gradient(#fff3c9, #8a6114) border-box; }
.dist { display: grid; grid-template-columns: 18px 1fr; gap: 5px 8px; align-items: center; margin: 10px 0; text-align: left; font: 700 13px var(--serif); color: var(--muted); }
.dist div { min-width: 24px; padding: 2px 7px; border-radius: 6px; background: rgba(233,196,106,.16); color: var(--gold-hi); text-align: right; font-variant-numeric: lining-nums; }
.dist div.cur { background: var(--goldgrad); color: var(--ink); }
.sharegrid { margin: 10px auto; padding: 10px 14px; display: inline-block; border-radius: 12px; border: 1px solid rgba(233,196,106,.25); background: rgba(0,0,0,.3); font: 16px/1.25 var(--sans); letter-spacing: 2px; white-space: pre; color: var(--text); text-align: left; }
.sharebox { display: block; width: 100%; height: 170px; margin: 8px 0; padding: 10px; border-radius: 12px; border: 1px solid rgba(233,196,106,.4); background: rgba(0,0,0,.35); color: var(--text); font: 14px/1.3 var(--sans); resize: none; user-select: text; -webkit-user-select: text; }
.legend { display: grid; grid-template-columns: 34px 1fr; gap: 8px 10px; align-items: center; text-align: left; margin: 12px 0; font-size: 13px; color: var(--muted); }
.legend .tile { --ts: 34px; width: 34px; height: 34px; }
.lv { min-height: 44px; font-variant-numeric: lining-nums; }
.lv.done { background: radial-gradient(circle at 38% 30%, #5a4312, #15100a 75%) padding-box, var(--goldgrad) border-box; }
.panel p.fine { margin-top: 12px; }
@media (max-height: 640px) { .key { height: 46px; } #kb { gap: 5px; } .tool .medal { width: 40px; height: 40px; } .tool img { width: 26px; height: 26px; } }
@media (prefers-reduced-motion: reduce) { .tile.flip, .tile.win, .wt.on, .rt, .rs.right { animation-duration: .01s; } }
.seglabel { font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: var(--muted); margin: 12px 0 0; }
.lv small { font-size: 11px; letter-spacing: 0; line-height: 1; min-height: 11px; }
.label { font-size: 11px; letter-spacing: .2em; }
.tag { font-size: 11px; }
.purse small { font-size: 11px; }
.label { letter-spacing: .14em; white-space: nowrap; }
#gtop { gap: 8px; } .gstat { min-width: 0; }
#toast { opacity: 0; transition: transform .35s cubic-bezier(.3,1.3,.5,1), opacity .25s; }
#toast.show { opacity: 1; }
