/* PSL card maker. Colours are the SoftAscend app's design tokens (C:\dev\ascend\apps\web\lib\design\tokens.ts), plus
   the four band colours of the reference cards; the canvas card reads the same variables (src/main.js, palette()). */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('assets/fonts/Inter-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('assets/fonts/Inter-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('assets/fonts/SpaceGrotesk-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #070A0F;
  --surface: #0F151D;
  --surface-raised: #121A24;
  --inset: #0B1017;
  --border: #1B2733;
  --border-strong: #263646;
  --text: #F2F6FA;
  --muted: #7D8CA0;
  --accent: #38BDF8;
  --accent-strong: #0EA5E9;
  --on-accent: #000000;
  --bad: #EF5B5B;
  --low: #F28B3C;
  --mid: #F5B544;
  --good: #3CCB7F;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --heading: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  --body: 'Inter', system-ui, sans-serif;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(70rem 36rem at 50% -12rem, color-mix(in srgb, var(--accent) 13%, transparent), transparent 70%),
    var(--bg);
  color: var(--text);
  font: 400 15px/1.45 var(--body);
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
svg { display: block; }
a { color: inherit; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.page {
  max-width: 640px;
  margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
}

/* ---------- top bar ---------- */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font: 700 18px/1 var(--heading);
  letter-spacing: -0.01em;
}
.brand b { color: var(--accent); font-weight: 700; }
.brand img { width: 25px; height: 30px; }
.get-rated {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: border-color 160ms ease-out, background-color 160ms ease-out;
}
.get-rated svg { width: 16px; height: 16px; fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.get-rated:hover { border-color: var(--border-strong); background: var(--surface-raised); }
@media (max-width: 380px) { .get-rated span { font-size: 12px; } .get-rated { padding: 0 11px; } }

/* ---------- layout: the editor, and on wide screens the live card beside it ---------- */

.live { display: none; }

@media (min-width: 1040px) {
  .page { max-width: 1140px; padding-left: 32px; padding-right: 32px; }
  .layout {
    display: grid;
    grid-template-columns: minmax(0, 600px) minmax(380px, 460px);
    justify-content: center;
    align-items: start;
    gap: 48px;
  }
  .live {
    position: sticky;
    top: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    margin-top: 34px;
  }
  .live-card {
    width: 100%;
    aspect-ratio: 1;
    border: 1px solid var(--border);
    border-radius: 22px;
    overflow: hidden;
    background: var(--bg);
    box-shadow: 0 40px 90px -40px color-mix(in srgb, var(--accent) 45%, transparent), 0 30px 60px -30px rgba(0, 0, 0, 0.9);
  }
  .live canvas { display: block; width: 100%; height: 100%; }
  .live-note { margin: 0; color: var(--muted); font-size: 12.5px; }
  .editor .actions { display: none; }
}

/* ---------- editor ---------- */

.editor {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 6px;
}
.eyebrow {
  margin: 0 0 14px;
  color: var(--muted);
  font: 600 11px/1 var(--body);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.hero { display: flex; flex-direction: column; align-items: center; width: 100%; }

.avatar-wrap {
  position: relative;
  width: 132px;
  height: 132px;
  border-radius: 50%;
  margin-bottom: 14px;
}
.avatar-wrap::before {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  padding: 2px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong) 60%, var(--border));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
.avatar-wrap::after {
  content: '';
  position: absolute;
  inset: -30px;
  border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 22%, transparent), transparent);
  z-index: -1;
  pointer-events: none;
}
.avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  touch-action: none;
  cursor: grab;
  outline-offset: 6px;
}
.avatar:active { cursor: grabbing; }
.photo-add {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1.5px dashed var(--border-strong);
  border-radius: 50%;
  background: color-mix(in srgb, var(--inset) 70%, transparent);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  transition: border-color 160ms ease-out, background-color 160ms ease-out;
}
.photo-add svg { width: 26px; height: 26px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.photo-add:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--inset)); }
.photo-edit {
  position: absolute;
  right: -2px;
  bottom: -2px;
  display: none;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface-raised);
}
.photo-edit svg { width: 16px; height: 16px; fill: none; stroke: var(--text); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.has-photo .photo-add { display: none; }
.has-photo .photo-edit { display: grid; }

/* Tier */

.tier-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 260px) 40px;
  align-items: center;
  gap: 10px;
  width: 100%;
  justify-content: center;
}
.arrow, .step, .page-arrow {
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface-raised);
  transition: transform 120ms ease-out, background-color 160ms ease-out, border-color 160ms ease-out, opacity 160ms ease-out;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}
.arrow svg, .step svg, .page-arrow svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.arrow:not(:disabled):hover, .step:not(:disabled):hover, .page-arrow:not(:disabled):hover { background: var(--border); border-color: var(--border-strong); }
.arrow:not(:disabled):active, .step:not(:disabled):active, .page-arrow:not(:disabled):active { transform: scale(0.92); }
.arrow:disabled, .step:disabled, .page-arrow:disabled { opacity: 0.32; }
.arrow { width: 40px; height: 40px; }

.tier-box {
  position: relative;
  display: block;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: linear-gradient(180deg, var(--surface-raised), var(--surface));
  box-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: border-color 160ms ease-out;
}
.tier-box:focus-within { border-color: var(--accent); }
.tier-box input {
  width: 100%;
  min-height: 58px;
  padding: 0 34px;
  border: 0;
  background: transparent;
  outline: none;
  text-align: center;
  font: 700 30px/1 var(--heading);
  letter-spacing: -0.015em;
  text-overflow: ellipsis;
}
.tier-pen {
  position: absolute;
  right: 12px;
  top: 50%;
  width: 14px;
  height: 14px;
  translate: 0 -50%;
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.7;
  pointer-events: none;
}
.tier-range {
  margin: 8px 0 14px;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

/* Rings */

.rings {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 120px));
  justify-content: center;
  gap: 40px;
}
.ring-block { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.ring-label { color: var(--muted); font-size: 13px; font-weight: 600; }
.ring {
  --p: 0;
  --c: var(--accent);
  position: relative;
  width: 64px;
  height: 64px;
}
.ring[data-band='bad'] { --c: var(--bad); }
.ring[data-band='mid'] { --c: var(--mid); }
.ring[data-band='good'] { --c: var(--good); }
.ring svg { width: 100%; height: 100%; rotate: -90deg; overflow: visible; }
.ring circle { fill: none; stroke-width: 5; }
.ring .track { stroke: var(--border); }
.ring .bar {
  stroke: var(--c);
  stroke-linecap: round;
  stroke-dasharray: calc(var(--p) * 100) 100;
  filter: drop-shadow(0 0 5px color-mix(in srgb, var(--c) 55%, transparent));
  transition: stroke-dasharray 260ms var(--ease-out), stroke 200ms ease-out;
}
.ring-value {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  font: 700 17px/1 var(--heading);
  font-variant-numeric: tabular-nums;
}
button.ring-value:hover { background: color-mix(in srgb, var(--text) 5%, transparent); }
.ring-input {
  position: absolute;
  inset: 12px;
  width: 40px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--inset);
  text-align: center;
  font: 700 16px/1 var(--heading);
  outline: none;
}
.steps { display: flex; gap: 8px; }
.step { width: 34px; height: 34px; }
.step svg { width: 15px; height: 15px; }

/* ---------- metric pages ---------- */

.metrics {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  grid-template-areas: 'prev dots next' 'panel panel panel';
  align-items: center;
  gap: 12px 8px;
  width: 100%;
  margin-top: 22px;
}
.page-arrow.prev { grid-area: prev; }
.page-arrow.next { grid-area: next; }
.page-arrow { width: 44px; height: 44px; }
.dots { grid-area: dots; display: flex; justify-content: center; }
.dot {
  display: grid;
  place-items: center;
  width: 24px;
  height: 32px;
  padding: 0;
  border: 0;
  background: none;
}
.dot::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--border-strong);
  transition: width 200ms var(--ease-out), background-color 200ms ease-out;
}
.dot:hover::before { background: var(--muted); }
.dot[aria-selected='true']::before { width: 18px; background: var(--accent); }

@media (min-width: 620px) {
  .metrics {
    grid-template-columns: 52px 1fr 52px;
    grid-template-areas: '. dots .' 'prev panel next';
    gap: 12px 14px;
  }
  .page-arrow { width: 48px; height: 48px; }
}

.panel {
  grid-area: panel;
  width: 100%;
  max-width: 460px;
  justify-self: center;
  padding: 18px 16px 20px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: 0 24px 60px -30px rgba(0, 0, 0, 0.9);
}
.panel.enter-right { animation: enter-right 240ms var(--ease-out); }
.panel.enter-left { animation: enter-left 240ms var(--ease-out); }
@keyframes enter-right { from { opacity: 0.2; transform: translateX(14px); } }
@keyframes enter-left { from { opacity: 0.2; transform: translateX(-14px); } }

.panel-title {
  margin: 0 0 14px;
  color: var(--accent);
  font: 700 11px/1 var(--body);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.panel[data-tone='bad'] .panel-title { color: var(--bad); }
.panel[data-tone='good'] .panel-title { color: var(--good); }

.cells {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px 18px;
}
.cell { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cell-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; min-height: 16px; }
.cell-icon { flex: none; width: 14px; height: 14px; margin-top: 1px; fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cell-trait[data-tone='bad'] .cell-icon { stroke: var(--bad); }
.cell-trait[data-tone='good'] .cell-icon { stroke: var(--good); }
.cell-label, .cell-name {
  min-width: 2ch;
  border-radius: 4px;
  outline: none;
  cursor: text;
  overflow-wrap: anywhere;
  text-wrap: pretty;
  transition: box-shadow 160ms ease-out, background-color 160ms ease-out;
}
.cell-label {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.cell-name { font: 700 15px/1.2 var(--heading); }
.cell-label:hover, .cell-name:hover { box-shadow: 0 1px 0 0 var(--border-strong); }
.cell-label:focus, .cell-name:focus { background: var(--inset); box-shadow: 0 0 0 1px var(--accent), 0 0 0 4px var(--inset); color: var(--text); }
.cell-tag { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.cell-trait[data-tone='bad'] .cell-tag { color: var(--bad); }
.cell-trait[data-tone='good'] .cell-tag { color: var(--good); }
.cell-value { font: 700 15px/1.2 var(--heading); font-variant-numeric: tabular-nums; }
.cell-rank { color: var(--text); font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums; }
.cell-rank b { color: var(--accent); font-weight: 700; }

/* Sliders */

.slider {
  --fill: 0%;
  --fc: var(--accent);
  width: 100%;
  height: 22px;
  margin: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  touch-action: pan-y;
}
.slider-rank[data-band='bad'] { --fc: var(--bad); }
.slider-rank[data-band='low'] { --fc: var(--low); }
.slider-rank[data-band='mid'] { --fc: var(--mid); }
.slider-rank[data-band='good'] { --fc: var(--good); }
.slider::-webkit-slider-runnable-track {
  height: 5px;
  border-radius: 999px;
  background: linear-gradient(to right, var(--fc) var(--fill), var(--border) var(--fill));
}
.slider::-moz-range-track { height: 5px; border-radius: 999px; background: var(--border); }
.slider::-moz-range-progress { height: 5px; border-radius: 999px; background: var(--fc); }
.slider::-webkit-slider-thumb {
  width: 16px;
  height: 16px;
  margin-top: -5.5px;
  border: 3px solid var(--bg);
  border-radius: 50%;
  background: var(--text);
  box-shadow: 0 0 0 1.5px var(--fc);
  -webkit-appearance: none;
  appearance: none;
  transition: transform 120ms ease-out;
}
.slider::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border: 3px solid var(--bg);
  border-radius: 50%;
  background: var(--text);
  box-shadow: 0 0 0 1.5px var(--fc);
}
.slider:active::-webkit-slider-thumb { transform: scale(1.2); }
.slider:focus-visible { outline: none; }
.slider:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 1.5px var(--fc), 0 0 0 5px color-mix(in srgb, var(--accent) 40%, transparent); }
.slider:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 1.5px var(--fc), 0 0 0 5px color-mix(in srgb, var(--accent) 40%, transparent); }

/* Choice chips */

.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip {
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--inset);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  transition: background-color 160ms ease-out, border-color 160ms ease-out, color 160ms ease-out;
}
.chip:hover { color: var(--text); }
.chip[aria-pressed='true'] {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 16%, var(--inset));
  color: var(--text);
}

/* ---------- actions and footer ---------- */

.actions { margin-top: 26px; }
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 22px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 700;
  overflow: hidden;
  isolation: isolate;
  transition: transform 120ms ease-out, background-color 160ms ease-out, border-color 160ms ease-out, box-shadow 200ms ease-out, opacity 160ms ease-out;
}
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn:not(:disabled):active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; }
.btn-export {
  min-width: 180px;
  border: 1px solid color-mix(in srgb, var(--accent) 65%, transparent);
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 10%, var(--surface)), var(--surface));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 6%, transparent), 0 12px 32px -14px color-mix(in srgb, var(--accent) 60%, transparent);
}
.btn-export:hover { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 10%, transparent), 0 14px 36px -12px color-mix(in srgb, var(--accent) 70%, transparent); }

.foot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 34px;
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
}
.note { margin: 0; text-wrap: balance; }
.note svg { display: inline-block; width: 13px; height: 13px; margin: 0 6px -2px 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 18px; }
.links a, .link {
  min-height: 32px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 12.5px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.links a:hover, .link:hover { color: var(--text); }

/* ---------- sheets ---------- */

.sheet {
  width: min(100% - 16px, 460px);
  max-height: min(94dvh, 900px);
  margin: auto auto 8px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.9);
  overflow: auto;
  overscroll-behavior: contain;
}
@media (min-width: 620px) { .sheet { margin: auto; } }
.sheet[open] { animation: sheet-in 260ms var(--ease-out); }
.sheet::backdrop { background: rgba(3, 5, 8, 0.72); backdrop-filter: blur(6px); }
@keyframes sheet-in { from { opacity: 0; transform: translateY(18px); } }
.sheet-body { display: flex; flex-direction: column; gap: 14px; padding: 20px 18px 14px; }
.sheet-head h2 { margin: 0; font: 700 21px/1.2 var(--heading); }
.sheet-head p { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; }

.preview {
  position: relative;
  width: min(100%, 300px);
  aspect-ratio: 1;
  align-self: center;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: var(--bg);
}
.preview canvas { display: block; width: 100%; height: 100%; }
.replay {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: color-mix(in srgb, var(--surface-raised) 85%, transparent);
  backdrop-filter: blur(4px);
}
.replay svg { width: 14px; height: 14px; margin-left: 2px; fill: var(--text); }
.sheet-pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: -4px; font-size: 13px; font-weight: 600; }
.sheet-pager span { min-width: 110px; text-align: center; }

.group { margin: 0; padding: 0; border: 0; }
.group legend { margin-bottom: 8px; padding: 0; color: var(--muted); font-size: 13px; font-weight: 600; }
.sizes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.size, .types label {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--inset);
  cursor: pointer;
  transition: border-color 160ms ease-out, background-color 160ms ease-out;
}
.size { min-height: 64px; gap: 2px; }
.size b { font: 700 17px/1.1 var(--heading); }
.size span { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.size input, .types input { position: absolute; opacity: 0; pointer-events: none; }
.size:has(input:checked), .types label:has(input:checked) {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--inset));
}
.types label:has(input:checked) span { color: var(--accent); }
.size:has(input:focus-visible), .types label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.size:hover, .types label:hover { border-color: var(--border-strong); }
.types { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 4px; border: 1px solid var(--border); border-radius: 16px; background: var(--inset); }
.types label { min-height: 44px; border-color: transparent; background: transparent; border-radius: 12px; }
.types span { font-size: 13px; font-weight: 700; letter-spacing: 0.06em; color: var(--muted); }

.btn-primary {
  width: 100%;
  border: 0;
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
  color: var(--on-accent);
  box-shadow: 0 14px 36px -14px color-mix(in srgb, var(--accent) 80%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.btn-primary:not(:disabled):hover { box-shadow: 0 16px 40px -12px color-mix(in srgb, var(--accent) 90%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.35); }
.btn-ghost { width: 100%; border: 1px solid var(--border-strong); background: var(--surface-raised); }
.btn-ghost:not(:disabled):hover { background: var(--border); }
.btn-danger { color: var(--bad); }
.btn.working { opacity: 1; }
.btn.working::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--progress, 100%);
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  z-index: -1;
  transition: width 120ms linear;
}
.btn-primary.working::before { background: rgba(255, 255, 255, 0.25); animation: pulse 900ms ease-in-out infinite alternate; }
@keyframes pulse { from { opacity: 0.2; } to { opacity: 0.8; } }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: -2px 0; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.hint { margin: -6px 0 0; color: var(--muted); font-size: 12px; text-align: center; text-wrap: balance; }
.hint + .hint { margin-top: 2px; }
.btn-cancel {
  min-height: 44px;
  border: 0;
  background: none;
  color: var(--muted);
  font-weight: 600;
}
.btn-cancel:hover { color: var(--text); }

.zoom { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 600; }

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 10;
  max-width: calc(100% - 32px);
  padding: 11px 16px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface-raised);
  box-shadow: 0 16px 40px -16px rgba(0, 0, 0, 0.9);
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  translate: -50% 12px;
  pointer-events: none;
  transition: opacity 200ms ease-out, translate 200ms var(--ease-out);
}
.toast.show { opacity: 1; translate: -50% 0; }
.toast:empty { display: none; }

.noscript { position: fixed; inset: auto 16px 16px; padding: 12px; border-radius: 12px; background: var(--surface-raised); text-align: center; }

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