/* Reusable pieces: glass, buttons, tiles, switches, dock, toast, sheet. */
.ico { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- Glass ---------- */
.glass {
  position: relative; isolation: isolate; overflow: hidden;
  border-radius: var(--r-lg);
  border: 1px solid rgb(170 200 255 / .15);
  background:
    radial-gradient(220px circle at var(--mx, 50%) var(--my, 0%), rgb(var(--a3-rgb) / calc(.18 * var(--spot))), transparent 70%),
    linear-gradient(150deg, rgb(255 255 255 / .09), rgb(255 255 255 / .02) 55%),
    rgb(var(--bg-rgb) / .5);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .12), 0 18px 40px -20px rgb(0 0 0 / .85);
  -webkit-backdrop-filter: blur(14px) saturate(150%); backdrop-filter: blur(14px) saturate(150%);
  transition: --spot .35s ease, border-color .3s, transform .2s var(--ease);
}
html[data-glass="0"] .glass { -webkit-backdrop-filter: none; backdrop-filter: none; background-color: rgb(var(--bg-rgb) / .88); }

/* neon hairline that fades from one corner to the other */
.edge::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(135deg, rgb(var(--a3-rgb) / .75), transparent 38%, transparent 62%, rgb(var(--a1-rgb) / .75));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}

/* ---------- Buttons ---------- */
.btn {
  --spot: 0;
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 22px; border-radius: 16px;
  font: 700 18px/1 var(--f-display); letter-spacing: .16em; text-transform: uppercase;
  transition: transform .15s var(--ease), box-shadow .3s, filter .3s;
}
.btn:active { transform: scale(.965); }
.btn { white-space: nowrap; }
.btn-sm { min-height: 44px; padding: 0 12px; font-size: 16px; letter-spacing: .1em; border-radius: 13px; }
.btn-block { display: flex; width: 100%; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn-primary {
  color: #06030f;
  background: linear-gradient(110deg, var(--a3), var(--a2) 58%, var(--a1));
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / .28), 0 10px 34px -6px rgb(var(--a1-rgb) / .75), 0 0 28px rgb(var(--a3-rgb) / .3);
}
.btn-primary::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(100deg, transparent 32%, rgb(255 255 255 / .55) 50%, transparent 68%);
  transform: translateX(-130%);
}
html[data-fx="2"] .btn-primary::after, html[data-fx="3"] .btn-primary::after { animation: shine 3.8s var(--ease) infinite; }
@keyframes shine { 0%, 55% { transform: translateX(-130%); } 100% { transform: translateX(130%); } }
.btn-ghost {
  color: var(--a3);
  background: radial-gradient(160px circle at var(--mx, 50%) var(--my, 50%), rgb(var(--a3-rgb) / calc(.25 * var(--spot))), transparent 70%), rgb(var(--bg-rgb) / .5);
  border: 1px solid rgb(var(--a3-rgb) / .5);
  transition: --spot .3s ease, transform .15s var(--ease), box-shadow .3s;
}
.btn-ghost:hover { box-shadow: 0 0 22px rgb(var(--a3-rgb) / .3); }
.rip { position: absolute; border-radius: 50%; background: rgb(255 255 255 / .42); transform: scale(0); animation: rip .6s var(--ease) forwards; pointer-events: none; }
@keyframes rip { to { transform: scale(1); opacity: 0; } }

/* ---------- Chips, tiles ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid rgb(var(--a3-rgb) / .45); color: var(--a3);
  font: 600 12px/1 var(--f-mono); letter-spacing: .08em; text-transform: uppercase;
  background: rgb(var(--a3-rgb) / .07);
}
.chip .ico { width: 14px; height: 14px; }
.chip.is-hot { color: var(--hot); border-color: rgb(var(--hot-rgb) / .5); background: rgb(var(--hot-rgb) / .07); }

.tile { --spot: 0; display: flex; flex-direction: column; gap: 6px; padding: 16px; min-height: 150px; text-align: left; }
.tile:active { transform: scale(.975); }
.tile > .ico { width: 32px; height: 32px; color: var(--a3); filter: drop-shadow(0 0 8px rgb(var(--a3-rgb) / .75)); }
.tile h3 { margin-top: auto; font: 700 22px/1.05 var(--f-display); letter-spacing: .06em; text-transform: uppercase; }
.tile p { color: var(--ink-dim); font-size: 14px; line-height: 1.35; }
.tile .go { position: absolute; right: 14px; top: 14px; width: 20px; height: 20px; opacity: .55; }

/* ---------- Settings controls ---------- */
.set-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; min-height: 64px; text-align: left; width: 100%; }
.set-row + .set-row { border-top: 1px solid rgb(170 200 255 / .1); }
.set-row .txt { flex: 1; min-width: 0; }
.set-row b { display: block; font-weight: 600; font-size: 16px; }
.set-row small { display: block; color: var(--ink-dim); font-size: 13.5px; line-height: 1.35; margin-top: 1px; }

.switch {
  position: relative; flex: none; width: 58px; height: 32px; border-radius: 9px;
  background: rgb(255 255 255 / .06); border: 1px solid rgb(170 200 255 / .3);
  transition: background .25s, border-color .25s, box-shadow .25s;
}
.switch::after {
  content: ""; position: absolute; left: 4px; top: 4px; width: 22px; height: 22px; border-radius: 5px;
  background: var(--ink-faint); transition: transform .25s var(--ease), background .25s, box-shadow .25s;
}
.switch[aria-checked="true"] { border-color: rgb(var(--a3-rgb) / .85); background: rgb(var(--a3-rgb) / .14); box-shadow: 0 0 18px rgb(var(--a3-rgb) / .35); }
.switch[aria-checked="true"]::after { transform: translateX(26px); background: var(--a3); box-shadow: 0 0 12px var(--a3); }
.switch[disabled] { opacity: .4; }

.seg {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px;
  border-radius: 16px; background: rgb(0 0 0 / .38); border: 1px solid rgb(170 200 255 / .14);
}
.seg button {
  min-height: 44px; border-radius: 12px; color: var(--ink-dim);
  font: 700 15px/1 var(--f-display); letter-spacing: .12em; text-transform: uppercase;
  transition: background .25s, color .25s, box-shadow .25s;
}
.seg button[aria-checked="true"] { color: #06030f; background: linear-gradient(110deg, var(--a3), var(--a2)); box-shadow: 0 0 18px rgb(var(--a3-rgb) / .45); }

.range { -webkit-appearance: none; appearance: none; width: 100%; height: 32px; margin: 0; background: transparent; }
.range::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--a3) var(--fill, 50%), rgb(255 255 255 / .16) var(--fill, 50%)); }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; margin-top: -10px; border-radius: 7px; background: var(--ink); box-shadow: 0 0 0 3px rgb(var(--a3-rgb) / .65), 0 0 16px var(--a3); }
.range::-moz-range-track { height: 6px; border-radius: 3px; background: rgb(255 255 255 / .16); }
.range::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--a3); }
.range::-moz-range-thumb { width: 24px; height: 24px; border: 0; border-radius: 7px; background: var(--ink); box-shadow: 0 0 0 3px rgb(var(--a3-rgb) / .65); }

/* ---------- Dock ---------- */
#dock {
  position: fixed; z-index: 5; left: 12px; right: 12px; bottom: calc(var(--safe-b) + 8px);
  max-width: 520px; margin: 0 auto; height: var(--dock-h); padding: 6px;
  display: grid; grid-template-columns: repeat(5, 1fr); border-radius: 24px;
}
#dock a {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  border-radius: 18px; color: var(--ink-faint);
  font: 600 11px/1 var(--f-mono); letter-spacing: .06em; text-transform: uppercase;
  transition: color .25s, background .25s, transform .15s var(--ease);
}
#dock a:active { transform: scale(.94); }
#dock a[aria-current="page"] { color: var(--a3); background: rgb(var(--a3-rgb) / .1); }
#dock a[aria-current="page"] .ico { filter: drop-shadow(0 0 6px var(--a3)); }
#dock a[aria-current="page"]::after { content: ""; position: absolute; bottom: 4px; width: 18px; height: 2px; border-radius: 2px; background: var(--a3); box-shadow: 0 0 8px var(--a3); }
@media (max-width: 350px) { #dock a { font-size: 9.5px; letter-spacing: .03em; } }

/* ---------- Toast + sheet ---------- */
#toast {
  position: fixed; z-index: 9; left: 50%; bottom: calc(var(--safe-b) + var(--dock-h) + 24px);
  max-width: min(88vw, 420px); padding: 12px 18px; border-radius: 14px; text-align: center;
  background: rgb(var(--bg-rgb) / .94); border: 1px solid rgb(var(--a3-rgb) / .5);
  font: 500 14px/1.35 var(--f-body); box-shadow: 0 0 24px rgb(var(--a3-rgb) / .25);
  opacity: 0; pointer-events: none; transform: translate(-50%, 16px);
  transition: opacity .25s, transform .3s var(--ease);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

#sheet { position: fixed; inset: 0; z-index: 10; display: flex; align-items: flex-end; justify-content: center; }
#sheet .scrim { position: absolute; inset: 0; background: rgb(2 0 8 / .68); opacity: 0; transition: opacity .3s; }
#sheet .panel {
  position: relative; width: min(100%, 520px); max-height: 86vh; max-height: 86dvh; overflow-y: auto;
  padding: 20px 20px calc(var(--safe-b) + 24px); border-radius: 26px 26px 0 0;
  transform: translateY(100%); transition: transform .4s var(--ease);
  -webkit-user-select: text; user-select: text;
}
#sheet.open .scrim { opacity: 1; }
#sheet.open .panel { transform: none; }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.sheet-head h2 { font: 700 30px/1 var(--f-display); letter-spacing: .08em; text-transform: uppercase; }
.sheet-x { width: 44px; height: 44px; margin: -8px -8px 0 0; display: grid; place-items: center; color: var(--ink-dim); }

.steps { list-style: none; counter-reset: s; padding: 0; margin: 16px 0 0; display: grid; gap: 14px; }
.steps li { counter-increment: s; position: relative; padding-left: 46px; min-height: 32px; color: var(--ink-dim); }
.steps li::before {
  content: counter(s); position: absolute; left: 0; top: -2px; width: 32px; height: 32px; display: grid; place-items: center;
  border-radius: 9px; border: 1px solid rgb(var(--a3-rgb) / .6); color: var(--a3);
  font: 700 17px/1 var(--f-display); box-shadow: 0 0 12px rgb(var(--a3-rgb) / .25);
}
.steps b { color: var(--ink); font-weight: 600; }
