/* Prism Phase mobile — screens and HUD. The game itself is the canvas. */
:root {
  --sa-t: env(safe-area-inset-top); --sa-r: env(safe-area-inset-right);
  --sa-b: env(safe-area-inset-bottom); --sa-l: env(safe-area-inset-left);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font: -apple-system, "SF Pro Display", "SF Pro Text", system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: #1e2025; color: #f2f2f7;
  font-family: var(--font); -webkit-font-smoothing: antialiased;
  /* no web tells: no selection, no callouts, no rubber-banding */
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  overscroll-behavior: none; touch-action: none;
}
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; }
#game { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
.hidden { display: none !important; }

/* glass */
.glass-btn, .sheet, .pill {
  background: rgba(30, 32, 40, 0.55);
  backdrop-filter: blur(22px) saturate(160%); -webkit-backdrop-filter: blur(22px) saturate(160%);
  border: 1px solid rgba(255,255,255,0.1);
}
.round { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; grid-auto-flow: column; gap: 4px; }
#pauseBtn { position: fixed; top: calc(10px + var(--sa-t)); right: calc(14px + var(--sa-r)); z-index: 5; opacity: 0.7; transition: transform .3s var(--spring), opacity .2s; }
#pauseBtn { justify-content: center; align-content: center; }   /* else the two bars sit in half-width columns */
#rotate { display: none; }
@media (orientation: portrait) { #rotate { display: grid; place-items: center; position: fixed; inset: 0; z-index: 100; background: #1e2025; font-weight: 600; letter-spacing: .04em; opacity: .85; } }
#pauseBtn i { width: 4px; height: 13px; border-radius: 2px; background: #fff; }
#pauseBtn:active { transform: scale(0.88); opacity: 1; }
#fps { position: fixed; left: calc(10px + var(--sa-l)); top: calc(8px + var(--sa-t)); z-index: 5; font: 600 11px ui-monospace, Menlo, monospace; color: rgba(255,255,255,0.55); }

.screen {
  position: fixed; inset: 0; z-index: 10; display: grid; place-items: center;
  background: rgba(10, 11, 16, 0.35);
  padding: calc(12px + var(--sa-t)) calc(16px + var(--sa-r)) calc(12px + var(--sa-b)) calc(16px + var(--sa-l));
  animation: fadeIn .25s var(--ease);
}
@keyframes fadeIn { from { opacity: 0; } }
.sheet { border-radius: 26px; padding: 26px 34px; box-shadow: 0 30px 80px rgba(0,0,0,0.45); animation: pop .45s var(--spring); }
@keyframes pop { from { transform: scale(0.92); opacity: 0; } }
.sheet.center { text-align: center; min-width: 320px; }
.sheet.wide { width: min(100%, 760px); max-height: 100%; overflow: auto; }
.eyebrow { font-size: 11px; letter-spacing: 0.16em; color: rgba(235,235,245,0.6); font-weight: 600; }
.muted { color: rgba(235,235,245,0.35); letter-spacing: 0.04em; font-weight: 500; }
h1 { margin: 6px 0 16px; font-size: 30px; letter-spacing: 0.06em; font-weight: 800; }
.sub { color: rgba(235,235,245,0.65); font-size: 14px; margin: -8px 0 16px; }
.cta {
  display: block; width: 100%; padding: 14px 22px; border-radius: 16px; font-weight: 700; font-size: 17px;
  background: #f2f2f7; color: #15161b; transition: transform .3s var(--spring);
}
.cta:active, .pill:active { transform: scale(0.95); }
.row { display: flex; gap: 10px; margin-top: 10px; }
.pill { flex: 1; padding: 11px 16px; border-radius: 14px; font-weight: 600; font-size: 15px; transition: transform .3s var(--spring); }
.link { margin-top: 12px; color: rgba(235,235,245,0.6); font-size: 14px; }
.close { margin-top: 14px; width: 100%; }

#safeProbe { position: fixed; visibility: hidden; pointer-events: none; padding: var(--sa-t) var(--sa-r) var(--sa-b) var(--sa-l); }

/* run options */
.mods { display: flex; gap: 8px; margin: 0 0 14px; }
.mod {
  flex: 1; display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: 14px; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1);
  font-size: 14px; font-weight: 600; transition: transform .3s var(--spring), background .2s, border-color .2s;
}
.mod em { font-style: normal; font-size: 12px; color: rgba(235,235,245,0.5); }
.mod.on { background: rgba(255,255,255,0.14); border-color: rgba(255,255,255,0.28); }
.mod.on em { color: #4cd964; }
.mod:active { transform: scale(0.95); }

/* shop */
.shophead { display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.shophead .wallet { margin-left: auto; }
.shophead .pill { padding: 6px 16px; width: auto; flex: 0 0 auto; margin: 0; }
/* the shop fits the screen: the skins scroll (by drag, see input.js), the header and Close stay put */
#scrShop .sheet { display: flex; flex-direction: column; overflow: hidden; }
/* a full page, not a card over the menu */
#scrShop { padding: 0; }
#scrShop .sheet.wide { width: 100%; height: 100%; max-height: none; border-radius: 0; border: 0; box-shadow: none; box-sizing: border-box; animation: none;
  padding: calc(16px + var(--sa-t)) calc(24px + var(--sa-r)) calc(14px + var(--sa-b)) calc(24px + var(--sa-l)); background: #15161b; }
#scrShop .close { display: none; }
#scrShop #shopGrid { align-content: start; }   /* Done, top right, is the way out */
#shopGrid { flex: 1; min-height: 0; overflow-y: auto; padding: 2px; }
.wallet { font-size: 14px; color: rgba(235,235,245,0.7); display: flex; align-items: center; gap: 6px; }
.wallet b { color: #fff; font-size: 17px; }
.orbdot { width: 11px; height: 11px; transform: rotate(30deg); background: #f2f2f7; clip-path: polygon(25% 5%, 75% 5%, 100% 50%, 75% 95%, 25% 95%, 0 50%); }
#shopGrid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-top: 12px; }
.skin { border-radius: 14px; padding: 8px 6px 9px; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.08); text-align: center; font-size: 12px; font-weight: 700; transition: transform .3s var(--spring); }
.skin canvas { width: 72px; height: 72px; display: block; margin: 0 auto 4px; }
.skin small { display: block; font-weight: 500; color: rgba(235,235,245,0.5); margin-top: 2px; }
.skin.on { border-color: rgba(76,217,100,0.7); background: rgba(76,217,100,0.1); }
.skin.on small { color: #4cd964; }
.skin.poor { opacity: 0.45; }
.skin:active { transform: scale(0.95); }
.shopnote { margin: 12px 0 0; font-size: 12px; }


/* ---------- the desktop's screens, for a phone ---------- */
.spaced { letter-spacing: 0.32em; font-weight: 300; margin: 4px 0 10px; padding-left: 0.32em; }
.spaced.big { font-size: 44px; }
.screen.launch, .screen.won { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; background: radial-gradient(ellipse at 50% 45%, rgba(40,40,58,0.55), rgba(12,12,18,0.82)); }
.lhead { text-align: center; z-index: 1; }
.echoes { position: absolute; inset: 0; pointer-events: none; }
.echoes i { position: absolute; left: 50%; top: 50%; border-radius: 22px; border: 1px solid; transform: translate(-50%, -50%); animation: echo 0.9s var(--ease) both; }
@keyframes echo { from { opacity: 0; transform: translate(-50%, -50%) scale(0.9); } }
.stats { display: flex; gap: 22px; justify-content: center; margin-top: 4px; padding: 9px 22px; border-radius: 12px; background: rgba(8,9,13,0.6); border: 1px solid rgba(255,255,255,0.08); }
.stats div { text-align: center; font: 600 17px ui-monospace, Menlo, monospace; min-width: 62px; }
.stats small { display: block; font: 600 9px var(--font); letter-spacing: 0.18em; color: rgba(235,235,245,0.45); margin-bottom: 3px; text-transform: uppercase; }
.badge { display: inline-block; width: 11px; height: 11px; transform: rotate(45deg); background: #f4f6fb; box-shadow: 0 0 8px rgba(255,255,255,0.7); margin-right: 6px; vertical-align: 1px; }
.badge.off { background: none; border: 1px solid rgba(255,255,255,0.3); box-shadow: none; }
/* Play: a dark pill whose edge runs through the level's colours (--edge) */
.play { z-index: 1; position: relative; display: flex; align-items: center; justify-content: center; gap: 18px; width: 260px; padding: 14px 0; border-radius: 40px;
  background: linear-gradient(#17181f, #17181f) padding-box, var(--edge, linear-gradient(90deg, #888, #ccc)) border-box; border: 2px solid transparent;
  font: 600 15px var(--font); letter-spacing: 0.42em; box-shadow: 0 0 26px -6px var(--glow, rgba(255,255,255,0.3)); transition: transform .3s var(--spring); }
.play b { font-size: 12px; letter-spacing: 0; opacity: 0.8; }
.play:active { transform: scale(0.95); }
.play.dim { width: 200px; padding: 12px 0; }
.row.small { gap: 8px; z-index: 1; margin-top: 2px; justify-content: center; }
.hexbtn { padding: 8px 16px; font: 600 10px var(--font); letter-spacing: 0.16em; text-transform: uppercase; color: rgba(235,235,245,0.8);
  background: rgba(16,17,23,0.8); border: 1px solid rgba(255,255,255,0.16);
  clip-path: polygon(10px 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 10px 100%, 0 50%); transition: transform .3s var(--spring); }
.hexbtn em { font-style: normal; color: #9fe6b0; margin-left: 4px; }
.hexbtn:active { transform: scale(0.94); }
.eyebrow.ruled { display: flex; align-items: center; gap: 12px; z-index: 1; }
.eyebrow.ruled::before, .eyebrow.ruled::after { content: ''; width: 60px; height: 1px; background: rgba(255,255,255,0.2); }
.results { z-index: 1; display: flex; gap: 24px; padding: 10px 26px; border-radius: 12px; background: rgba(8,9,13,0.7); border: 1px solid rgba(255,255,255,0.08); }
.results div { text-align: center; font: 600 16px ui-monospace, Menlo, monospace; }
.results small { display: block; font: 600 9px var(--font); letter-spacing: 0.18em; color: rgba(235,235,245,0.45); margin-bottom: 3px; text-transform: uppercase; }
.results .gain { color: #9fe6b0; }

/* shattered */
.screen.over { background: rgba(6,7,10,0.62); }
.overcard { display: flex; align-items: center; gap: 30px; padding: 20px 34px; border-radius: 26px; background: rgba(14,15,20,0.88); border: 1px solid rgba(255,255,255,0.07); box-shadow: 0 30px 80px rgba(0,0,0,0.5); animation: pop .45s var(--spring); }
#overArt { width: 180px; height: 180px; }
.overtext { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; max-width: 320px; }
.overtext h2 { margin: 0; font-size: 17px; letter-spacing: 0.24em; font-weight: 800; }
.overtext .tip { font-size: 12px; color: rgba(235,235,245,0.6); line-height: 1.45; }

/* ---------- level select: swipe cards ---------- */
.screen.cards { display: flex; flex-direction: column; align-items: stretch; justify-content: space-between; gap: 6px; background: radial-gradient(ellipse at 50% 55%, rgba(10,11,15,0.12), rgba(6,7,10,0.55)); overflow: hidden; }   /* the floor shows through (lab-floor.js menu look) */
.cardhead { margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; gap: 10px; z-index: 2; }
.cardhead .wallet b { font-size: 15px; }
.tiers { display: flex; gap: 6px; }
.tier { display: flex; gap: 3px; align-items: center; padding: 7px 10px; border-radius: 20px; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.08); transition: transform .3s var(--spring), border-color .2s, background .2s; }
.tier i { width: 7px; height: 7px; border-radius: 50%; }
.tier.on { border-color: var(--tc); background: color-mix(in srgb, var(--tc) 18%, transparent); transform: scale(1.06); }
.tier:active { transform: scale(0.94); }
.track { position: relative; flex: 1; touch-action: none; }
.cardfoot { margin-top: 8px; display: flex; justify-content: center; align-items: center; gap: 14px; z-index: 2; }
.arrow { width: 34px; height: 30px; font-size: 24px; line-height: 1; color: rgba(235,235,245,0.7); border-radius: 10px; background: rgba(255,255,255,0.05); }
.arrow:active { transform: scale(0.9); }
.pdots { display: flex; gap: 6px; }
.pdots i { width: 6px; height: 6px; border-radius: 3px; background: rgba(255,255,255,0.22); transition: width .25s var(--ease), background .25s; }
.pdots i.on { width: 18px; background: var(--tc, #fff); }
.walletbtn { padding: 6px 12px; border-radius: 20px; cursor: pointer; transition: transform .3s var(--spring); }
.walletbtn:active { transform: scale(0.92); }
.walletbtn .chev { font-size: 18px; line-height: 1; opacity: 0.6; margin-left: 2px; }

/* a card: the same parts in every style; the style decides which show and how */
.lcard { position: absolute; left: 50%; top: 50%; width: var(--cw, 300px); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: 12px 14px 12px; text-align: center; will-change: transform, opacity; }
.lcard .cnum { display: none; }
.lcard .ctop { display: flex; justify-content: space-between; align-items: center; width: 100%; font-size: 9px; letter-spacing: 0.2em; font-weight: 700; color: rgba(235,235,245,0.6); }
.lcard .cfeats { display: flex; gap: 1px; margin: -6px -6px -6px 0; }
.lcard .cfeats img { width: 22px; height: 22px; display: block; }
.lcard .cfeats img:not(.on) { opacity: 0.2; filter: grayscale(1); }
.lcard .cfeats img.on { filter: drop-shadow(0 1px 2px rgba(0,0,0,0.6)); }
/* best run as a bar, filled as far as it got; the % sits small inside */
.lcard .cbar { position: relative; width: 82%; height: 16px; border-radius: 8px; overflow: hidden; background: rgba(0,0,0,0.45); border: 1px solid rgba(255,255,255,0.18); }
.lcard .cbar i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(180deg, rgba(255,255,255,0.35), transparent 60%), var(--tc); border-radius: 7px; }
.lcard.done .cbar { border-color: var(--tc); box-shadow: 0 0 10px -2px var(--tc); }
.lcard .cbar span { position: absolute; inset: 0; display: grid; place-items: center; font: 700 10px ui-monospace, Menlo, monospace; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.9); }
.lcard .cdots { align-items: center; }
.lcard .cdots span { margin-left: 6px; font: 600 10px ui-monospace, Menlo, monospace; color: rgba(235,235,245,0.55); }
/* the cleared screen's badges (desktop .wb) */
.wbadges { z-index: 1; display: flex; gap: 26px; justify-content: center; }
.wbadges:empty { display: none; }
.wb { position: relative; display: flex; flex-direction: column; align-items: center; gap: 7px; }
.wb img { width: 44px; height: 44px; display: block; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.6)); }
.wb i { font: 700 9px ui-monospace, Menlo, monospace; font-style: normal; letter-spacing: 0.26em; color: #80849a; }
.wb.on i, .wb.new i { color: var(--c); }
.wb.off img { opacity: 0.2; filter: grayscale(1); }
.wb.new img { animation: wbFill .7s var(--d) cubic-bezier(.2,1.8,.4,1) both; }
.wb.new i { animation: earnIn .4s calc(var(--d) + .25s) ease-out both; }
.wb.new::before, .wb.new::after { content: ''; position: absolute; left: 50%; top: 22px; width: 44px; height: 44px; margin: -22px 0 0 -22px;
  border-radius: 50%; border: 2px solid var(--c); opacity: 0; pointer-events: none; }
.wb.new::before { animation: atRing .9s calc(var(--d) + .2s) ease-out both; }
.wb.new::after { animation: atRing .9s calc(var(--d) + .35s) ease-out both; }
@keyframes wbFill { 0%, 30% { opacity: .2; filter: grayscale(1); transform: scale(.7); } 100% { opacity: 1; filter: grayscale(0) drop-shadow(0 0 10px var(--c)); transform: none; } }
@keyframes earnIn { from { opacity: 0; transform: translateY(-7px) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes atRing { 0% { transform: scale(.7); opacity: .95; } 100% { transform: scale(1.9); opacity: 0; } }
.lcard canvas { width: 100%; aspect-ratio: 16 / 9; flex: none; border-radius: 12px; background: #1e2025; }
.lcard.boss canvas { width: 48%; aspect-ratio: 1; background: none; }
.lcard .cname { font-size: 20px; font-weight: 800; letter-spacing: 0.1em; line-height: 1.1; }
.lcard .cdots { display: flex; gap: 4px; }
.lcard .cdots i { width: 8px; height: 8px; border-radius: 50%; }
.lcard .cplay { margin-top: 2px; padding: 9px 34px; border-radius: 30px; font: 700 12px var(--font); letter-spacing: 0.3em; background: #f2f2f7; color: #15161b; transition: opacity .2s, transform .2s; }
.lcard:not(.centre) .cplay { opacity: 0; transform: scale(0.9); }

/* glass: like the desktop grid's cards */
.s-glass .lcard { border-radius: 22px; border: 1.5px solid var(--tc); background: linear-gradient(160deg, var(--tcd), rgba(20,21,28,0.96) 55%); box-shadow: 0 20px 50px rgba(0,0,0,0.5), 0 0 30px -12px var(--tc); }
.s-glass .lcard .cplay { background: linear-gradient(#17181f, #17181f) padding-box, var(--edge) border-box; border: 2px solid transparent; color: #f2f2f7; }
/* toy: thick outline, hard shadow, the row's colour as a header (the Nov 13 mock) */
.s-toy .lcard { border-radius: 28px; border: 4px solid #0b0b10; background: linear-gradient(var(--tc) 0 34%, #262733 34%); box-shadow: 0 8px 0 #0b0b10, 0 18px 40px rgba(0,0,0,0.5); }
.s-toy .lcard .ctop { color: rgba(0,0,0,0.6); }
.s-toy .lcard .cname { font-size: 24px; font-weight: 900; -webkit-text-stroke: 1px #0b0b10; }
.s-toy .lcard .cplay { background: #4cd964; color: #0b0b10; border: 3px solid #0b0b10; box-shadow: 0 4px 0 #0b0b10; font-weight: 900; }
/* poster: a huge colour count behind, the level's colours as a stripe along the bottom */
.s-poster .lcard { border-radius: 18px; overflow: hidden; background: radial-gradient(circle at 30% 20%, var(--tcd), rgba(18,19,25,0.97) 70%); box-shadow: 0 20px 50px rgba(0,0,0,0.55); border-bottom: 6px solid transparent; border-image: var(--edge) 1; }
.s-poster .lcard .cnum { display: block; position: absolute; right: 10px; top: -30px; font-size: 190px; font-weight: 900; color: var(--tc); opacity: 0.13; line-height: 1; }
.s-poster .lcard canvas { display: none; }
.s-poster .lcard .cname { font-size: 26px; text-align: left; align-self: flex-start; }
.s-poster .lcard .cdots, .s-poster .lcard .cstat { align-self: flex-start; }
.s-poster .lcard { justify-content: flex-end; align-items: flex-start; }
/* minimal: no box, the desktop launch screen's spaced title */
.s-minimal .lcard { background: none; border-top: 1px solid var(--tcd); border-bottom: 1px solid var(--tcd); }
.s-minimal .lcard .cname { font-weight: 300; letter-spacing: 0.3em; font-size: 22px; }
.s-minimal .lcard .cplay { background: none; color: #f2f2f7; border: 1.5px solid var(--tc); }

/* ---------------- the title screen (js/title.js; the lab's Title screen section) ---------------- */
.screen.title { display: block; padding: 0; background: #0c0d11; }
#titleBg, #titleBg2 { position: absolute; inset: 0; width: 100%; height: 100%; transition: opacity var(--tfade, .9s) ease; }
#titleBg2 { opacity: 0; }
.title .tdim { position: absolute; inset: 0; pointer-events: none; }
.title .tcol { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  padding: var(--sa-t) var(--sa-r) var(--sa-b) var(--sa-l); }
.tlogo { height: 34vh; width: auto; pointer-events: none; }
.tword { font: 200 46px var(--font); letter-spacing: 0.5em; padding-left: 0.5em; color: #fff; }
.tsub { font: 600 10px var(--font); letter-spacing: 0.34em; padding-left: 0.34em; color: rgba(235,235,245,0.62); }
.tstart { background: none; border: 0; padding: 0; margin-top: 6px; color: #fff; transition: transform .3s var(--spring); }
.tstart:active { transform: scale(0.94); }
#titleRow { gap: 14px; }
#titleRow .hexbtn { padding: 11px 24px; font-size: 12px; }
.tstart img { height: 64px; display: block; }
.tstart span { display: none; font: 600 13px var(--font); letter-spacing: 0.42em; padding-left: 0.42em; }
.tstart.tap img, .tstart.play img { display: none; }
.tstart.tap span { display: block; animation: tpulse 1.8s ease-in-out infinite; }
.tstart.play span { display: block; width: 240px; padding: 14px 0; border-radius: 40px; background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.28); box-shadow: 0 0 26px -6px rgba(255,255,255,0.3); }
@keyframes tpulse { 50% { opacity: 0.35; } }
/* the logo coming in */
.title.go .tlogo, .title.go .tword { animation: var(--tanim, tfade) 1.1s var(--ease) backwards; }
.title.go .tsub { animation: tfade 1s .5s var(--ease) both; }
.title.go .tstart, .title.go #titleRow { animation: tfade .9s .8s var(--ease) both; }
@keyframes tfade { from { opacity: 0; } }
@keyframes tdrop { from { opacity: 0; transform: translateY(-40px) scale(1.08); } }
@keyframes tsplit { 0% { opacity: 0; filter: drop-shadow(-14px 0 0 rgba(255,40,90,0.9)) drop-shadow(14px 0 0 rgba(40,160,255,0.9)); }
  60% { opacity: 1; filter: drop-shadow(-3px 0 0 rgba(255,40,90,0.6)) drop-shadow(3px 0 0 rgba(40,160,255,0.6)); } 100% { filter: none; } }
@keyframes tzoom { from { opacity: 0; transform: scale(0.6); } }

/* the shop's rarity: a tier's colour on the card's edge and its tag */
.skin { position: relative; }
.skin .tier { position: absolute; top: 6px; left: 8px; font: 700 7px var(--font); letter-spacing: 0.14em; text-transform: uppercase; font-style: normal; opacity: 0.7; }
.skin[data-tier=common] .tier { display: none; }
.skin[data-tier=rare] { border-color: rgba(90,170,255,0.45); } .skin[data-tier=rare] .tier { color: #6fb6ff; }
.skin[data-tier=epic] { border-color: rgba(190,110,255,0.5); background: rgba(150,90,255,0.07); } .skin[data-tier=epic] .tier { color: #c48bff; }
.skin[data-tier=legendary] { border-color: rgba(255,200,80,0.6); background: rgba(255,190,60,0.07); box-shadow: 0 0 18px -6px rgba(255,200,80,0.5); } .skin[data-tier=legendary] .tier { color: #ffcc55; }
.skin.on { border-color: rgba(76,217,100,0.8); }

/* the transition into a level (game.js goTo; the lab's Level transition) */
#xfade { position: fixed; inset: 0; z-index: 50; pointer-events: none; background: #0c0d11; opacity: 0; }
#xfade.fade { transition: opacity .22s ease; }
#xfade.fade.on { opacity: 1; }
#xfade.wait::after { content: 'LOADING'; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font: 600 10px var(--font); letter-spacing: 0.4em; color: rgba(235,235,245,0.6); animation: tpulse 1.2s ease-in-out infinite; }
#xfade.swipe { opacity: 1; transform: translateX(105%); background: linear-gradient(90deg, #0c0d11 70%, rgba(12,13,17,0)); width: 140%; left: -20%; transition: transform .3s cubic-bezier(.6,0,.4,1); }
#xfade.swipe.on { transform: translateX(0); }
#xfade.swipe.out { transform: translateX(-105%); }
#xfade.iris { opacity: 1; clip-path: circle(0% at 50% 50%); transition: clip-path .3s ease-in; }
#xfade.iris.on { clip-path: circle(150% at 50% 50%); }
#xfade.flash { background: #fff; transition: opacity .12s ease; }
#xfade.flash.on { opacity: 0.85; }

/* the cleared screen (desktop's): CLEARED letter by letter, the frames rippling out then breathing, two big buttons */
.wonbtns { gap: 16px; margin-top: 14px; z-index: 1; }
.wonbtns .play { width: 210px; padding: 17px 0; font-size: 16px; }
#wonWord span { display: inline-block; animation: wonLetter .5s var(--spring) both; }
@keyframes wonLetter { from { opacity: 0; transform: translateY(14px) scale(0.85); filter: blur(4px); } }
.won .echoes i { animation: echoIn .6s var(--ease) both, echoBreathe var(--bt, 6s) ease-in-out .6s infinite; }
@keyframes echoIn { from { opacity: 0; transform: translate(-50%, -50%) scale(0.85); } }
@keyframes echoBreathe { 50% { transform: translate(-50%, -50%) scale(1.012); } }

/* the title waits for its logo (title.js show): dark, then everything comes in together */
.title.loading .tcol { visibility: hidden; }
.tlogo { will-change: transform, opacity; }

/* ---------- settings (js/settings.js) ---------- */
.screen.settings { z-index: 20; background: rgba(6,7,11,0.6); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.setsheet { position: relative; width: min(100%, 720px); max-height: 100%; overflow: auto; border-radius: 26px; padding: 16px 20px 18px;
  background: linear-gradient(160deg, rgba(40,42,56,0.92), rgba(18,19,26,0.96)); border: 1px solid rgba(255,255,255,0.09);
  box-shadow: 0 30px 80px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.06); animation: pop .45s var(--spring); }
.sethead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.sethead h2 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: 0.02em; }
.setclose { width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,0.1); font-size: 22px; line-height: 1; color: rgba(255,255,255,0.8); transition: transform .3s var(--spring); }
.setclose:active { transform: scale(0.88); }
.setcols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.setlabel { margin: 12px 4px 6px; font-size: 11px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: rgba(235,235,245,0.45); }
.setgroup { border-radius: 16px; background: rgba(255,255,255,0.055); border: 1px solid rgba(255,255,255,0.05); overflow: hidden; }
.setrow { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 50px; padding: 8px 14px; text-align: left; font-size: 15px; font-weight: 600; }
.setrow + .setrow { border-top: 1px solid rgba(255,255,255,0.06); }
.setrow > span { flex: 1; white-space: nowrap; }
.setrow.tap:active { background: rgba(255,255,255,0.06); }
.setrow.danger span { color: #ff6b61; }
.setrow .chev { font-size: 24px; font-weight: 400; color: rgba(235,235,245,0.3); line-height: 1; }
.ico { flex: none; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: linear-gradient(160deg, color-mix(in srgb, var(--ic) 100%, #fff 18%), var(--ic)); box-shadow: 0 2px 6px color-mix(in srgb, var(--ic) 40%, transparent); }
.ico svg { width: 18px; height: 18px; }
.ico.big { width: 54px; height: 54px; border-radius: 15px; margin: 0 auto 10px; }
.ico.big svg { width: 30px; height: 30px; }
/* the slider: a filled track to the thumb */
.setrow input[type=range] { -webkit-appearance: none; appearance: none; width: 42%; height: 6px; border-radius: 3px; touch-action: pan-x;
  background: linear-gradient(90deg, #f2f2f7 var(--p, 50%), rgba(255,255,255,0.16) var(--p, 50%)); }
.setrow input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.45); }
/* the switch */
.switch { position: relative; width: 51px; height: 31px; border-radius: 16px; background: rgba(255,255,255,0.16); transition: background .25s var(--ease); }
.switch i { position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,0.35); transition: transform .3s var(--spring); }
.switch.on { background: #34c77b; }
.switch.on i { transform: translateX(20px); }
/* the segmented control */
.seg { display: flex; padding: 2px; border-radius: 10px; background: rgba(255,255,255,0.1); }
.seg button { padding: 6px 12px; border-radius: 8px; font-size: 13px; font-weight: 600; color: rgba(235,235,245,0.7); transition: background .2s, color .2s; }
.seg button.on { background: #f2f2f7; color: #15161b; box-shadow: 0 2px 6px rgba(0,0,0,0.3); }
.setfoot { margin: 10px 4px 0; font-size: 12px; color: rgba(235,235,245,0.4); line-height: 1.4; }
/* deleting: its own card over the sheet */
.confirm { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(10,11,16,0.72); border-radius: 26px; animation: fadeIn .2s var(--ease); }
.confbox { width: min(90%, 340px); text-align: center; padding: 20px 20px 16px; border-radius: 22px; background: rgba(36,37,48,0.98); border: 1px solid rgba(255,255,255,0.08); box-shadow: 0 20px 60px rgba(0,0,0,0.6); animation: pop .4s var(--spring); }
.confbox h3 { margin: 0 0 6px; font-size: 18px; font-weight: 800; }
.confbox p { margin: 0 0 16px; font-size: 13px; line-height: 1.45; color: rgba(235,235,245,0.65); }
.confrow { display: flex; gap: 10px; }
.confbtn { flex: 1; padding: 12px; border-radius: 14px; font-size: 15px; font-weight: 700; background: rgba(255,255,255,0.1); transition: transform .3s var(--spring); }
.confbtn.red { background: #ff453a; color: #fff; }
.confbtn:active { transform: scale(0.95); }
/* the gear on the level select */
.headr { display: flex; align-items: center; gap: 10px; }
.gearbtn { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: rgba(235,235,245,0.85); transition: transform .3s var(--spring); }
.gearbtn svg { width: 19px; height: 19px; }
.gearbtn:active { transform: scale(0.88) rotate(30deg); }
