:root {
  --bg: #16151a;
  --panel: #211f27;
  --ink: #f2eee6;
  --muted: #a39d93;
  --brass: #e3ad66;
  --verdigris: #74c2b2;
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  --label-font: "Arial Rounded MT Bold", "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: var(--font); }
body { -webkit-text-size-adjust: 100%; overscroll-behavior: none; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }

.pill-btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  border: 0; border-radius: 999px; padding: 12px 20px;
  background: var(--brass); color: #1b1408; font-weight: 700; font-size: 15px; letter-spacing: .01em;
  -webkit-tap-highlight-color: transparent;
}
.pill-btn:active { transform: translateY(1px); filter: brightness(.95); }
.ghost-btn {
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  border: 1px solid #3a3742; border-radius: 999px; padding: 10px 16px; background: transparent;
  color: var(--ink); font-size: 14px; -webkit-tap-highlight-color: transparent;
}
.ghost-btn:active { background: #2a2731; }
:focus-visible { outline: 2px solid var(--verdigris); outline-offset: 2px; }

/* ---------- login ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(360px, 100%); display: grid; gap: 14px; text-align: center; }
.boot-logo {
  font: 800 34px/1 var(--label-font); letter-spacing: .04em; color: #2c2a8f;
  background: #c8cdb4; padding: 22px 0; border-radius: 10px 10px 30px 10px;
  box-shadow: inset 0 0 0 10px #5c5a66;
  animation: drop 1.4s cubic-bezier(.2,.7,.2,1) both;
}
@keyframes drop { from { transform: translateY(-24px); opacity: 0; } }
.login-sub { color: var(--muted); margin: 0; }
.login-card input {
  font: inherit; font-size: 16px; padding: 14px 16px; border-radius: 12px; border: 1px solid #3a3742;
  background: var(--panel); color: var(--ink);
}
.login-card .pill-btn { justify-content: center; }
.login-error { color: #ff8a80; min-height: 1.2em; margin: 0; }

/* ---------- library ---------- */
.library {
  min-height: 100dvh;
  padding: calc(env(safe-area-inset-top) + 20px) max(16px, env(safe-area-inset-right)) calc(env(safe-area-inset-bottom) + 32px) max(16px, env(safe-area-inset-left));
  max-width: 1100px; margin: 0 auto;
}
.lib-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.lib-header h1 { margin: 0; font-size: 30px; letter-spacing: -.01em; }
.lib-sub { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.insert-btn { flex: none; }

.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 22px 16px; }
@media (max-width: 420px) { .shelf { grid-template-columns: 1fr 1fr; gap: 18px 12px; } }

.cart { position: relative; display: grid; gap: 8px; -webkit-tap-highlight-color: transparent; }
.cart-body {
  all: unset; cursor: pointer; display: block; position: relative; aspect-ratio: 57 / 62;
  background: linear-gradient(180deg, #4a4752 0%, #3a3842 100%);
  border-radius: 6px 22px 6px 6px; padding: 12% 9% 0;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.12), inset 0 -3px 0 rgba(0,0,0,.35), 0 8px 18px rgba(0,0,0,.35);
  transition: transform .15s ease;
}
.cart.dmg .cart-body { background: linear-gradient(180deg, #b9b6b0 0%, #a29f99 100%); }
.cart-body:active { transform: scale(.97); }
.cart-body::before { /* grip ridges */
  content: ""; position: absolute; left: 9%; right: 30%; top: 4%; height: 4%;
  background: repeating-linear-gradient(90deg, rgba(0,0,0,.25) 0 2px, transparent 2px 6px); border-radius: 2px;
}
.cart-label {
  position: relative; height: 78%; border-radius: 4px; overflow: hidden;
  background: #1c1b20; box-shadow: inset 0 0 0 2px rgba(0,0,0,.25);
  display: grid; grid-template-rows: 1fr auto;
}
.cart-art { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; display: block; min-height: 0; }
.cart-art.placeholder {
  background:
    radial-gradient(circle at 30% 30%, rgba(227,173,102,.6), transparent 45%),
    radial-gradient(circle at 70% 70%, rgba(116,194,178,.55), transparent 50%), #2b2933;
}
.cart-badge {
  position: absolute; top: 6px; left: 6px; font: 700 9px/1 var(--label-font); letter-spacing: .08em;
  padding: 4px 6px; border-radius: 4px; background: rgba(0,0,0,.6); color: #fff;
}
.cart-badge.cgb { background: linear-gradient(90deg, #e4002b, #7b3fa0, #2a9d3f, #f2b705, #1c63c7); }
.cart-name { margin: 0; font-size: 14px; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.cart-meta { margin: 0; font-size: 12px; color: var(--muted); }
.cart-more {
  position: absolute; top: 6px; right: 8px; z-index: 1; width: 32px; height: 32px; border-radius: 50%;
  border: 0; background: rgba(0,0,0,.45); color: #fff; font-size: 18px; line-height: 1; cursor: pointer;
}
.cart-menu {
  position: absolute; top: 42px; right: 6px; z-index: 2; background: #2a2731; border: 1px solid #3a3742;
  border-radius: 12px; padding: 6px; display: grid; min-width: 150px; box-shadow: 0 12px 28px rgba(0,0,0,.5);
}
.cart-menu button { all: unset; cursor: pointer; padding: 10px 12px; border-radius: 8px; font-size: 14px; }
.cart-menu button:hover, .cart-menu button:focus-visible { background: #3a3742; }
.cart-menu .danger { color: #ff8a80; }

.empty { text-align: center; padding: 64px 16px; color: var(--muted); max-width: 440px; margin: 0 auto; }
.empty h2 { color: var(--ink); margin: 18px 0 8px; }
.empty code { color: var(--brass); }
.empty-cart { width: 90px; aspect-ratio: 57/62; margin: 0 auto; border-radius: 6px 20px 6px 6px; border: 2px dashed #4a4752; }
.drop-zone {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(22,21,26,.85);
  font-size: 22px; font-weight: 700;
}
.drop-zone div { border: 3px dashed var(--brass); border-radius: 24px; padding: 48px 56px; color: var(--brass); }

/* ---------- the handheld ---------- */
.player {
  position: fixed; inset: 0; display: grid; place-items: center; overflow: hidden;
  background: radial-gradient(ellipse at 50% 30%, #24222b, #121116 70%);
  touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.player * { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }

.shell {
  /* shell palette (Berry by default) */
  --shell: #c42a5c; --shell-hi: #dd4f7d; --shell-lo: #8f1a41; --emboss: rgba(0,0,0,.28); --btn: #3b3944; --btn-hi: #57545f;
  --sw: min(100vw, 440px, calc(100dvh * 0.56));
  --s: calc(var(--sw) / 100);
  position: relative; width: var(--sw); height: min(100dvh, calc(var(--sw) * 1.8));
  display: flex; flex-direction: column;
  background:
    radial-gradient(120% 60% at 20% 0%, var(--shell-hi), transparent 60%),
    linear-gradient(180deg, var(--shell) 0%, var(--shell) 70%, var(--shell-lo) 100%);
  border-radius: calc(var(--s) * 5) calc(var(--s) * 5) calc(var(--s) * 14) calc(var(--s) * 14);
  box-shadow: inset 0 calc(var(--s) * .6) 0 rgba(255,255,255,.18), inset 0 calc(var(--s) * -1.2) 0 rgba(0,0,0,.25), 0 30px 80px rgba(0,0,0,.6);
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}
.shell[data-color="grape"] { --shell: #5d3f99; --shell-hi: #7d5fc0; --shell-lo: #3a2468; }
.shell[data-color="kiwi"] { --shell: #93bf2e; --shell-hi: #b4dc52; --shell-lo: #5f8417; --emboss: rgba(0,0,0,.25); }
.shell[data-color="dandelion"] { --shell: #f0c214; --shell-hi: #ffdc55; --shell-lo: #b58b00; --emboss: rgba(60,40,0,.3); }
.shell[data-color="teal"] { --shell: #13a29b; --shell-hi: #3cc6bd; --shell-lo: #0a6b66; }
.shell[data-color="atomic"] {
  --shell: rgba(116,84,176,.92); --shell-hi: rgba(160,130,220,.9); --shell-lo: rgba(70,45,120,.95);
  background:
    radial-gradient(circle at 70% 75%, rgba(40,140,70,.35) 0 8%, transparent 9%),
    repeating-linear-gradient(90deg, rgba(255,255,255,.05) 0 1px, transparent 1px 14px),
    radial-gradient(120% 60% at 20% 0%, var(--shell-hi), transparent 60%),
    linear-gradient(180deg, var(--shell) 0%, var(--shell-lo) 100%);
}
.shell[data-color="brass"] { --shell: #c99a5b; --shell-hi: #e3ad66; --shell-lo: #8a6534; --emboss: rgba(50,30,0,.3); }

@media (max-width: 520px) {
  /* fill the whole player (it can be taller than 100dvh behind Safari's toolbar / the home indicator) */
  .player { place-items: stretch; background: var(--shell-edge, #16151a); }
  .shell { --sw: 100vw; width: 100%; height: 100%; min-height: 100dvh; border-radius: 0; box-shadow: none; }
}

.shell-top {
  position: relative; z-index: 3; display: flex; align-items: center; justify-content: space-between;
  height: calc(var(--s) * 11); padding: 0 calc(var(--s) * 5);
}
.power-switch {
  all: unset; cursor: pointer; display: flex; align-items: center; gap: calc(var(--s) * 1.5);
  font: 700 calc(var(--s) * 2.4)/1 var(--label-font); color: var(--emboss); letter-spacing: .08em;
}
.switch-track {
  width: calc(var(--s) * 10); height: calc(var(--s) * 3.4); border-radius: 99px; background: rgba(0,0,0,.25);
  box-shadow: inset 0 1px 2px rgba(0,0,0,.4); position: relative;
}
.switch-knob {
  position: absolute; top: 12%; right: 6%; width: 40%; height: 76%; border-radius: 99px;
  background: var(--shell-lo); box-shadow: inset 0 1px 0 rgba(255,255,255,.25);
  transition: right .2s ease;
}
.power-switch:active .switch-knob { right: 54%; }
.ir-port {
  width: calc(var(--s) * 9); height: calc(var(--s) * 3); border-radius: calc(var(--s) * 1);
  background: linear-gradient(180deg, #3b0b1c, #170309); opacity: .8;
}
.top-right { display: flex; gap: calc(var(--s) * 2); }
.top-btn {
  all: unset; cursor: pointer; padding: calc(var(--s) * 1.2) calc(var(--s) * 2.6); border-radius: 99px;
  background: rgba(0,0,0,.18); color: rgba(255,255,255,.85);
  font: 700 calc(var(--s) * 2.6)/1 var(--label-font); letter-spacing: .08em;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.3);
}
.top-btn[aria-pressed="true"] { background: rgba(0,0,0,.45); color: #fff59d; }

.bezel {
  position: relative; z-index: 1;
  margin: calc(var(--s) * 1) calc(var(--s) * 5) 0;
  padding: calc(var(--s) * 5) calc(var(--s) * 9) calc(var(--s) * 3);
  background: linear-gradient(180deg, #3e3c47, #2f2d37);
  border-radius: calc(var(--s) * 3) calc(var(--s) * 3) calc(var(--s) * 10) calc(var(--s) * 3);
  box-shadow: inset 0 calc(var(--s) * .4) 0 rgba(255,255,255,.07), inset 0 calc(var(--s) * -.5) 0 rgba(0,0,0,.4), 0 1px 0 rgba(255,255,255,.15);
}
.bezel-line {
  position: absolute; left: calc(var(--s) * 4); right: calc(var(--s) * 4); top: calc(var(--s) * 2);
  height: calc(var(--s) * .5); border-radius: 2px;
  background: linear-gradient(90deg, #6d2c66 0 70%, transparent 70% 72%, #2b3a7a 72%);
  opacity: .9;
}
.power-led {
  position: absolute; left: calc(var(--s) * 2.2); top: 40%; display: grid; justify-items: center; gap: calc(var(--s) * 1);
  font: 700 calc(var(--s) * 1.5)/1 var(--label-font); color: #8e8b98; letter-spacing: .06em;
}
.led { width: calc(var(--s) * 2.6); height: calc(var(--s) * 2.6); border-radius: 50%; background: #4a1a1a; box-shadow: inset 0 1px 1px rgba(0,0,0,.5); }
.led.on { background: radial-gradient(circle at 35% 35%, #ffb3a6, #ff2d1a 55%, #a3110a); box-shadow: 0 0 calc(var(--s) * 2) #ff3b26; }
.screen-wrap {
  background: #0d0d10; padding: calc(var(--s) * .8); border-radius: calc(var(--s) * .8);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.6);
}
#screen {
  display: block; width: 100%; aspect-ratio: 160 / 144; image-rendering: pixelated; image-rendering: crisp-edges;
  background: #e0f8d0;
}
.brand {
  display: flex; justify-content: center; align-items: baseline; gap: calc(var(--s) * 1.8);
  margin-top: calc(var(--s) * 2.6);
  font-family: var(--label-font); font-weight: 800; letter-spacing: .02em;
}
.brand-gb { color: #c9c6d2; font-size: calc(var(--s) * 4); font-style: italic; }
.brand-color { font-size: calc(var(--s) * 4.4); font-style: normal; }
.brand-color i { font-style: normal; display: inline-block; text-shadow: 0 1px 0 rgba(0,0,0,.5); }
.c1 { color: #ff4a3d; } .c2 { color: #b46bff; transform: translateY(-6%); } .c3 { color: #39d353; } .c4 { color: #ffd23f; transform: translateY(-6%); } .c5 { color: #3fa2ff; }


.controls { position: relative; flex: 1; z-index: 2; touch-action: none; }
.dpad {
  position: absolute; left: calc(var(--s) * 6); top: 12%;
  width: calc(var(--s) * 34); height: calc(var(--s) * 34);
  max-height: 46%; aspect-ratio: 1; max-width: none;
}
.dpad::before { /* recessed well */
  content: ""; position: absolute; inset: -6%; border-radius: 50%;
  background: radial-gradient(circle, rgba(0,0,0,.14) 55%, transparent 70%);
}
.dpad-h, .dpad-v {
  position: absolute; background: linear-gradient(180deg, var(--btn-hi), var(--btn));
  border-radius: calc(var(--s) * 1.2);
  box-shadow: 0 calc(var(--s) * .8) 0 rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.15);
}
.dpad-h { left: 0; right: 0; top: 33.5%; height: 33%; }
.dpad-v { top: 0; bottom: 0; left: 33.5%; width: 33%; }
.dpad-dimple {
  position: absolute; left: 39%; top: 39%; width: 22%; height: 22%; border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, rgba(0,0,0,.35), rgba(255,255,255,.06));
}
.arr { position: absolute; width: 0; height: 0; border: calc(var(--s) * 1.4) solid transparent; opacity: .45; }
.arr.up { left: 50%; top: 6%; transform: translateX(-50%); border-bottom-color: #1d1c22; border-top: 0; }
.arr.down { left: 50%; bottom: 6%; transform: translateX(-50%); border-top-color: #1d1c22; border-bottom: 0; }
.arr.left { top: 50%; left: 6%; transform: translateY(-50%); border-right-color: #1d1c22; border-left: 0; }
.arr.right { top: 50%; right: 6%; transform: translateY(-50%); border-left-color: #1d1c22; border-right: 0; }
.dpad.up { transform: perspective(300px) rotateX(10deg); }
.dpad.down { transform: perspective(300px) rotateX(-10deg); }
.dpad.left { transform: perspective(300px) rotateY(-10deg); }
.dpad.right { transform: perspective(300px) rotateY(10deg); }
.dpad.up.left { transform: perspective(300px) rotateX(8deg) rotateY(-8deg); }
.dpad.up.right { transform: perspective(300px) rotateX(8deg) rotateY(8deg); }
.dpad.down.left { transform: perspective(300px) rotateX(-8deg) rotateY(-8deg); }
.dpad.down.right { transform: perspective(300px) rotateX(-8deg) rotateY(8deg); }

.ab {
  position: absolute; right: calc(var(--s) * 5); top: 10%;
  width: calc(var(--s) * 38); height: calc(var(--s) * 26);
  transform: rotate(-24deg); transform-origin: center;
}
.ab::before { /* pill-shaped recess behind A and B */
  content: ""; position: absolute; inset: 4% -2% 22%; border-radius: 99px; background: rgba(0,0,0,.12);
}
.btn-wrap { position: absolute; display: grid; justify-items: center; gap: calc(var(--s) * 1.6); top: 8%; }
.b-wrap { left: 4%; }
.a-wrap { right: 4%; }
.btn-wrap span, .ss-wrap span {
  font: 800 calc(var(--s) * 3)/1 var(--label-font); color: var(--emboss); letter-spacing: .1em;
  text-shadow: 0 1px 0 rgba(255,255,255,.15);
}
.round-btn {
  width: calc(var(--s) * 14); height: calc(var(--s) * 14); border-radius: 50%;
  background: radial-gradient(circle at 40% 30%, var(--btn-hi), var(--btn) 60%);
  box-shadow: 0 calc(var(--s) * 1) 0 rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.2);
  transition: transform .05s, box-shadow .05s;
}
.round-btn.pressed, .pill.pressed {
  transform: translateY(calc(var(--s) * .7));
  box-shadow: 0 calc(var(--s) * .3) 0 rgba(0,0,0,.4), inset 0 1px 3px rgba(0,0,0,.4);
}

.ss {
  position: absolute; left: 50%; bottom: 20%; transform: translateX(-50%);
  display: flex; gap: calc(var(--s) * 6);
}
.ss-wrap { display: grid; justify-items: center; gap: calc(var(--s) * 1.6); transform: rotate(-24deg); }
.pill {
  width: calc(var(--s) * 11); height: calc(var(--s) * 3.2); border-radius: 99px;
  background: linear-gradient(180deg, #6d6a76, #4a4752);
  box-shadow: 0 calc(var(--s) * .6) 0 rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.2);
  outline: calc(var(--s) * 1) solid rgba(0,0,0,.1);
}

.speaker {
  position: absolute; right: calc(var(--s) * 6); bottom: 5%;
  width: calc(var(--s) * 16); height: calc(var(--s) * 16);
  background-image: radial-gradient(circle, rgba(0,0,0,.4) 0 calc(var(--s) * .8), transparent calc(var(--s) * .9));
  background-size: calc(var(--s) * 3.2) calc(var(--s) * 3.2);
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
  opacity: .9;
}

/* Landscape phones: screen in the middle, controls either side */
@media (orientation: landscape) and (max-height: 560px) {
  .shell {
    --sw: 100vw; --s: calc(min(100vw, 210dvh) / 100);
    width: 100vw; height: 100dvh; border-radius: 0;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  }
  .shell-top { position: absolute; top: env(safe-area-inset-top); left: max(env(safe-area-inset-left), 0px); right: env(safe-area-inset-right); height: calc(var(--s) * 7); }
  .ir-port { display: none; }
  .bezel {
    position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
    margin: 0; height: 88dvh; aspect-ratio: auto; display: flex; flex-direction: column; justify-content: center;
    padding: calc(var(--s) * 1.6) calc(var(--s) * 7.5) calc(var(--s) * 1.2);
  }
  .screen-wrap { height: calc(88dvh - calc(var(--s) * 8)); aspect-ratio: 160 / 144; }
  #screen { height: 100%; width: auto; }
  .brand { margin-top: calc(var(--s) * 1); }
  .brand-gb { font-size: calc(var(--s) * 2); } .brand-color { font-size: calc(var(--s) * 2.2); }
  .bezel-line { display: none; }
  .power-led { left: calc(var(--s) * 1.6); font-size: calc(var(--s) * 1); }
  .led { width: calc(var(--s) * 1.6); height: calc(var(--s) * 1.6); }
  .controls { position: absolute; inset: 0; }
  .dpad { left: max(calc(var(--s) * 4), env(safe-area-inset-left)); top: 50%; transform: translateY(-50%); width: calc(var(--s) * 17); height: calc(var(--s) * 17); max-height: none; }
  .dpad.up, .dpad.down, .dpad.left, .dpad.right { transform: translateY(-50%); }
  .ab { right: max(calc(var(--s) * 2), env(safe-area-inset-right)); top: 50%; width: calc(var(--s) * 19); height: calc(var(--s) * 13); transform: translateY(-60%) rotate(-24deg); }
  .round-btn { width: calc(var(--s) * 7); height: calc(var(--s) * 7); }
  .btn-wrap span, .ss-wrap span { font-size: calc(var(--s) * 1.5); }
  .ss { left: auto; right: max(calc(var(--s) * 4), env(safe-area-inset-right)); bottom: 10%; transform: none; gap: calc(var(--s) * 3); }
  .pill { width: calc(var(--s) * 6); height: calc(var(--s) * 1.8); }
  .speaker { display: none; }
  .top-btn { font-size: calc(var(--s) * 1.4); padding: calc(var(--s) * .8) calc(var(--s) * 1.6); }
  .power-switch { font-size: calc(var(--s) * 1.3); }
  .switch-track { width: calc(var(--s) * 5); height: calc(var(--s) * 1.8); }
}

/* link cable: the infrared port glows while linked */
.ir-port.linked { background: radial-gradient(circle, #ff5a4a, #8f1010 70%); opacity: 1; box-shadow: 0 0 calc(var(--s) * 2) #ff3b26; }
.ir-port.waiting { animation: irBlink 1.2s steps(2) infinite; }
@keyframes irBlink { 50% { opacity: .3; } }
.pick-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: -6px 0 18px; padding: 12px 12px 12px 16px; border-radius: 14px;
  background: #2a2731; border: 1px solid var(--brass); font-size: 15px;
}
.code-input {
  width: 7.5em; font: 700 18px/1 ui-monospace, "SF Mono", monospace; letter-spacing: .2em; text-transform: uppercase;
  padding: 9px 12px; border-radius: 999px; border: 1px solid #3a3742; background: #16151a; color: var(--ink);
}
.link-row { align-items: center; }

/* ---------- menu sheet ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.5); }
.sheet {
  position: fixed; z-index: 21; left: 50%; bottom: 0; transform: translateX(-50%);
  width: min(520px, 100vw); max-height: 88dvh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--panel); border-radius: 22px 22px 0 0;
  padding: 10px 20px calc(env(safe-area-inset-bottom) + 20px);
  box-shadow: 0 -20px 60px rgba(0,0,0,.5);
  animation: sheetIn .22s cubic-bezier(.2,.8,.2,1);
}
@keyframes sheetIn { from { transform: translate(-50%, 30px); opacity: 0; } }
.sheet-grip { width: 40px; height: 5px; border-radius: 3px; background: #4a4752; margin: 0 auto 12px; }
.sheet-title { margin: 0 0 6px; font-size: 20px; }
.sheet-group { padding: 14px 0; border-bottom: 1px solid #2f2c36; }
.sheet-group h3 { margin: 0 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.sheet-note { color: var(--muted); font-size: 13px; margin: 0 0 10px; }
.sheet-note.keys { margin-top: 14px; font-size: 12px; }
.slots { display: grid; gap: 8px; }
.slot { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 8px; background: #2a2731; border-radius: 12px; padding: 8px 8px 8px 14px; }
.slot b { display: block; font-size: 14px; }
.slot small { color: var(--muted); font-size: 12px; }
.slot .ghost-btn { padding: 8px 14px; }
.slot .ghost-btn:disabled { opacity: .35; }
.row-btns { display: flex; gap: 10px; flex-wrap: wrap; padding-top: 14px; }
.sheet-group .row-btns { padding-top: 0; }
.row-btns .pill-btn { margin-left: auto; }
.colors { display: flex; gap: 12px; flex-wrap: wrap; }
.swatch {
  all: unset; cursor: pointer; width: 40px; height: 40px; border-radius: 50%;
  box-shadow: inset 0 -4px 0 rgba(0,0,0,.25), 0 0 0 2px transparent;
}
.swatch[aria-pressed="true"] { box-shadow: inset 0 -4px 0 rgba(0,0,0,.25), 0 0 0 3px var(--panel), 0 0 0 5px var(--ink); }
.settings { display: grid; gap: 12px; }
.toggle, .select-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 15px; }
.toggle input { order: 2; width: 46px; height: 28px; appearance: none; -webkit-appearance: none; border-radius: 99px; background: #4a4752; position: relative; cursor: pointer; flex: none; transition: background .15s; }
.toggle input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .15s; }
.toggle input:checked { background: var(--verdigris); }
.toggle input:checked::after { transform: translateX(18px); }
.select-row select { font: inherit; font-size: 15px; background: #2a2731; color: var(--ink); border: 1px solid #3a3742; border-radius: 10px; padding: 8px 10px; }

.toast {
  position: fixed; z-index: 40; left: 50%; top: calc(env(safe-area-inset-top) + 14px); transform: translate(-50%, -20px);
  background: #f2eee6; color: #1b1a1f; font-weight: 600; font-size: 14px; padding: 10px 16px; border-radius: 999px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
