:root {
  --bg: #050505;
  --bg-lift: #0c0c0c;
  --ink: #f2f2f2;
  --muted: #9a9a9a;
  --line: #ffffff;
  --line-soft: rgba(255, 255, 255, 0.18);
  --fill: #111;
  --fill-hover: #1a1a1a;
  --ok: #37aa42;
  --err: #d45454;
  --rail: 6.75rem;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font: "IBM Plex Mono", monospace;
  --brand: "Syne", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  color-scheme: dark;
}

html,
body {
  min-height: 100%;
}

body {
  display: flex;
  min-height: 100vh;
  font-family: var(--font);
  font-weight: 400;
  color: var(--ink);
  background: #000;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.noise {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 0;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* —— rail —— */
.rail {
  position: relative;
  z-index: 2;
  width: var(--rail);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  padding: 1.5rem 0.75rem;
  border-right: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.55);
}

.rail-brand {
  font-family: var(--brand);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.04em;
  text-decoration: none;
  color: var(--ink);
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  margin-bottom: 0.65rem;
  transition: opacity 0.25s var(--ease);
}

.rail-brand:hover {
  opacity: 0.7;
}

.rail-nav,
.rail-foot {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  width: 100%;
}

.rail-foot {
  margin-top: auto;
}

.rail-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  width: 100%;
  padding: 0.85rem 0.3rem;
  border: 1px solid transparent;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  transition:
    color 0.2s var(--ease),
    border-color 0.2s var(--ease),
    background 0.2s var(--ease),
    transform 0.25s var(--ease);
}

.rail-btn:hover {
  color: var(--ink);
  border-color: var(--line-soft);
}

.rail-btn.is-on {
  color: var(--ink);
  border-color: var(--line);
  background: var(--fill);
}

.rail-ico {
  font-size: 1.25rem;
  line-height: 1;
}

.rail-btn em {
  font-style: normal;
  font-size: 0.62rem;
  color: var(--muted);
  border: 1px solid var(--line-soft);
  padding: 0.08rem 0.3rem;
}

/* —— frame / panels —— */
.frame {
  position: relative;
  z-index: 1;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 2rem;
}

.panel {
  width: min(100%, 42rem);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
  animation: rise 0.55s var(--ease) both;
}

.panel[hidden] {
  display: none !important;
}

.panel-head {
  animation: rise 0.55s var(--ease) 0.05s both;
}

.panel-head-row {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 1rem;
}

.eyebrow {
  font-size: 0.9rem;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: lowercase;
  margin-bottom: 0.3rem;
}

.panel-title {
  font-family: var(--brand);
  font-weight: 800;
  font-size: clamp(3.2rem, 9vw, 5rem);
  line-height: 0.9;
  letter-spacing: -0.04em;
  text-transform: lowercase;
}

.panel-sub {
  margin-top: 0.55rem;
  font-size: 1.05rem;
  color: var(--muted);
}

.save-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.1rem;
  animation: rise 0.55s var(--ease) 0.1s both;
}

.mascot {
  width: 180px;
  height: auto;
  filter: contrast(1.05);
  animation: floaty 4.5s var(--ease) infinite;
}

.mascot-dim {
  opacity: 0.55;
  animation: none;
}

.box {
  display: flex;
  align-items: center;
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg-lift);
  transition:
    box-shadow 0.25s var(--ease),
    border-color 0.25s var(--ease);
}

.box.is-focused,
.box.is-ready {
  box-shadow: 0 0 0 1px var(--ink);
}

.box input {
  flex: 1;
  min-width: 0;
  padding: 1.15rem 1rem;
  border: 0;
  background: transparent;
  outline: none;
  font-size: 1.05rem;
}

.box-x,
.box-go {
  flex-shrink: 0;
  width: 3.1rem;
  height: 3.1rem;
  margin-right: 0.35rem;
  border: 1px solid var(--line-soft);
  color: var(--ink);
  font-size: 1.15rem;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}

.box-x:hover,
.box-go:hover {
  background: var(--fill-hover);
  border-color: var(--line);
}

.box-x[hidden],
.box-go[hidden] {
  display: none;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  width: 100%;
  justify-content: space-between;
  align-items: center;
}

.yt-opts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
}

.yt-opts[hidden],
#cobalt-modes[hidden] {
  display: none;
}

.yt-chip {
  padding: 0.75rem 1.05rem;
  font-size: 0.95rem;
  color: var(--muted);
  border-right: 1px solid var(--line-soft);
}

.yt-chip:last-child {
  border-right: 0;
}

.yt-chip:hover {
  color: var(--ink);
}

.yt-chip.is-on {
  color: var(--ink);
  background: var(--fill);
}

.yt-bitrate {
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--line);
  background: var(--bg-lift);
  color: var(--ink);
  font-size: 0.95rem;
}

.yt-bitrate:disabled {
  opacity: 0.4;
}

.modes {
  display: flex;
  border: 1px solid var(--line);
}

.mode {
  padding: 0.75rem 1.05rem;
  font-size: 0.95rem;
  color: var(--muted);
  border-right: 1px solid var(--line-soft);
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}

.mode:last-child {
  border-right: 0;
}

.mode:hover {
  color: var(--ink);
}

.mode.is-on {
  color: var(--ink);
  background: var(--fill);
}

.btn {
  padding: 0.75rem 1.2rem;
  border: 1px solid var(--line);
  background: transparent;
  font-size: 0.95rem;
  transition: background 0.2s var(--ease), transform 0.2s var(--ease);
}

.btn:hover {
  background: var(--fill);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn:disabled:hover {
  background: transparent;
}

.status {
  width: 100%;
  text-align: center;
  font-size: 0.95rem;
  color: var(--muted);
  min-height: 1.2em;
}

.status.is-ok {
  color: var(--ok);
}

.status.is-error {
  color: var(--err);
}

.status[hidden] {
  display: none;
}

.services {
  position: relative;
  width: 100%;
  text-align: center;
}

.services-toggle {
  font-size: 0.85rem;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  cursor: pointer;
}

.services-toggle:hover {
  color: var(--ink);
}

.services-pop {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 0.5rem);
  transform: translateX(-50%);
  width: min(100%, 22rem);
  padding: 0.75rem;
  border: 1px solid var(--line);
  background: #000;
  z-index: 5;
  animation: pop 0.25s var(--ease) both;
}

.services-pop[hidden] {
  display: none;
}

.services:hover .services-pop,
.services:focus-within .services-pop {
  display: block;
}

.services:hover .services-pop[hidden],
.services:focus-within .services-pop[hidden] {
  display: block;
}

.services-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: center;
}

.services-list span {
  border: 1px solid var(--line-soft);
  padding: 0.2rem 0.45rem;
  font-size: 0.65rem;
  color: var(--muted);
}

/* dashed edge hints there's a caveat to hover for */
.services-list span.has-note {
  border-style: dashed;
  cursor: help;
}

.services-list span.has-note:hover {
  border-color: var(--line);
  color: var(--ink);
}

.convert-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  width: min(100%, 36rem);
  margin: 0 auto;
  animation: rise 0.55s var(--ease) 0.08s both;
}

.drop {
  width: 100%;
  padding: 2.4rem 1.25rem;
  border: 1px solid var(--line);
  background: var(--bg-lift);
  text-align: center;
  cursor: pointer;
  transition:
    box-shadow 0.25s var(--ease),
    background 0.25s var(--ease),
    border-color 0.25s var(--ease);
}

.drop:hover,
.drop:focus-visible,
.drop.is-drag {
  box-shadow: 0 0 0 1px var(--ink);
  outline: none;
}

.drop-title {
  font-size: 1.05rem;
  color: var(--ink);
}

.drop-sub {
  margin-top: 0.45rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.convert-files {
  width: 100%;
  list-style: none;
  border: 1px solid var(--line);
}

.convert-files[hidden],
.convert-controls[hidden],
.convert-results[hidden] {
  display: none;
}

.convert-files li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid var(--line-soft);
  font-size: 0.85rem;
}

.convert-files li:last-child {
  border-bottom: 0;
}

.convert-files .meta {
  color: var(--muted);
  font-size: 0.75rem;
  white-space: nowrap;
}

.convert-controls {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  width: 100%;
}

.convert-format {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  width: 100%;
  font-size: 0.8rem;
  color: var(--muted);
}

.convert-format input[type="search"] {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--line);
  background: var(--bg-lift);
  color: var(--ink);
  outline: none;
}

.convert-format input[type="search"]:focus {
  box-shadow: 0 0 0 1px var(--ink);
}

.convert-picker {
  max-height: 14rem;
  overflow: auto;
  border: 1px solid var(--line);
  background: #000;
}

.convert-group-label {
  padding: 0.45rem 0.75rem 0.25rem;
  font-size: 0.68rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: lowercase;
  border-bottom: 1px solid var(--line-soft);
  position: sticky;
  top: 0;
  background: #000;
}

.convert-opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
}

.convert-opt:hover {
  background: var(--fill);
}

.convert-opt.is-on {
  background: var(--fill-hover);
  box-shadow: inset 2px 0 0 var(--ink);
}

.convert-opt .ext {
  font-weight: 500;
}

.convert-opt .via {
  font-size: 0.68rem;
  color: var(--muted);
}

.convert-opt.is-odd .ext {
  color: #e8a0a0;
}

.convert-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.convert-warn {
  width: 100%;
  margin: 0;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--err);
  color: var(--err);
  font-size: 0.82rem;
  text-align: left;
}

.convert-warn[hidden] {
  display: none;
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
}

.btn-ghost:hover {
  color: var(--ink);
}

.convert-results {
  width: 100%;
  list-style: none;
  border: 1px solid var(--line);
}

.convert-results li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--line-soft);
  font-size: 0.85rem;
}

.convert-results li:last-child {
  border-bottom: 0;
}

.convert-results a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.convert-results .state {
  color: var(--muted);
  font-size: 0.75rem;
}

.convert-results .state.is-ok {
  color: var(--ok);
}

.convert-results .state.is-err {
  color: var(--err);
}

/* —— trim —— */
.panel-trim {
  width: min(100%, 52rem);
}

.trim-stage {
  width: min(100%, 36rem);
  margin: 0 auto;
  animation: rise 0.55s var(--ease) 0.08s both;
}

.trim-editor {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  width: 100%;
  animation: rise 0.55s var(--ease) 0.08s both;
}

.trim-editor[hidden] {
  display: none;
}

.trim-name-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-width: 0;
}

.trim-name {
  margin: 0;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: min(100%, 28rem);
}

.trim-pill {
  flex: 0 0 auto;
  padding: 0.15rem 0.45rem;
  border: 1px solid var(--line);
  background: var(--fill);
  color: var(--muted);
  font-size: 0.65rem;
  letter-spacing: 0.02em;
  text-transform: lowercase;
  white-space: nowrap;
}

.trim-pill.is-ok {
  color: var(--ink);
  border-color: var(--ink);
}

.trim-pill.is-error {
  color: #ff8f8f;
  border-color: #ff8f8f;
}

.trim-meta {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.65rem;
  overflow-x: auto;
  font-size: 0.72rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  line-height: 1;
  scrollbar-width: none;
}

.trim-meta::-webkit-scrollbar {
  display: none;
}

.trim-meta span + span::before {
  content: "·";
  margin-right: 0.65rem;
  opacity: 0.55;
}

.trim-preview {
  width: 100%;
  border: 1px solid var(--line);
  background: #000;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.trim-preview video {
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.trim-timeline {
  position: relative;
  width: 100%;
  user-select: none;
  touch-action: none;
}

.trim-film {
  display: flex;
  height: 3.4rem;
  border: 1px solid var(--line);
  overflow: hidden;
  background: var(--fill);
}

.trim-film img {
  flex: 1 1 0;
  min-width: 0;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.trim-range {
  position: absolute;
  inset: 0;
}

.trim-shade {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

.trim-shade-l {
  left: 0;
}

.trim-shade-r {
  right: 0;
}

.trim-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0.7rem;
  margin-left: -0.35rem;
  padding: 0;
  border: 1px solid var(--ink);
  background: #fff;
  cursor: ew-resize;
  z-index: 2;
}

.trim-handle::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 2px;
  height: 1rem;
  transform: translate(-50%, -50%);
  background: #000;
}

.trim-playhead {
  position: absolute;
  top: -0.2rem;
  bottom: -0.2rem;
  width: 3px;
  margin-left: -1px;
  background: var(--ink);
  z-index: 3;
  pointer-events: none;
  box-shadow: 0 0 0 1px #000;
}

.trim-playhead::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -5px;
  width: 0;
  height: 0;
  transform: translateX(-50%);
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 7px solid var(--ink);
}

.trim-playhead span {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 0.45rem);
  transform: translateX(-50%);
  padding: 0.15rem 0.4rem;
  border: 1px solid var(--line);
  background: #000;
  font-size: 0.65rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.trim-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 0.65rem;
  align-items: flex-end;
}

.trim-time {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.7rem;
  color: var(--muted);
}

.trim-time input {
  width: 7.5rem;
  padding: 0.55rem 0.6rem;
  border: 1px solid var(--line);
  background: var(--bg-lift);
  color: var(--ink);
  outline: none;
  font-variant-numeric: tabular-nums;
}

.trim-time input[readonly] {
  color: var(--muted);
  cursor: default;
}

.trim-time input:focus {
  box-shadow: 0 0 0 1px var(--ink);
}

.trim-set {
  width: 7.5rem;
  padding: 0.3rem 0.3rem;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.62rem;
  cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}

.trim-set:hover {
  background: var(--fill);
  color: var(--ink);
}

/* the in/out boxes carry an extra button row, so this one lines its label and
   field up with theirs instead of bottom-aligning to the buttons */
.trim-time-flat {
  align-self: flex-start;
}

.trim-toggle {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  max-width: 13.5rem;
  padding: 0.2rem 0;
  font-size: 0.76rem;
  color: var(--ink);
  cursor: pointer;
}

.trim-toggle input {
  margin-top: 0.15rem;
  width: 1rem;
  height: 1rem;
  accent-color: #fff;
}

.trim-toggle strong {
  display: block;
  font-weight: 600;
}

.trim-toggle small {
  display: block;
  margin-top: 0.12rem;
  color: var(--muted);
  font-size: 0.64rem;
  line-height: 1.25;
}

.trim-bar #trim-export {
  margin-left: auto;
}

@media (max-width: 720px) {
  .trim-bar #trim-export {
    margin-left: 0;
    width: 100%;
  }
}

.terms {
  margin-top: 0.5rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  animation: rise 0.55s var(--ease) 0.15s both;
}

.terms-link {
  display: inline;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 2px;
  font: inherit;
  cursor: pointer;
}

.terms-link:hover {
  opacity: 0.75;
}

/* —— soon / settings —— */
.soon-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  padding: 2rem 0;
  border: 1px solid var(--line);
  animation: rise 0.55s var(--ease) 0.1s both;
}

.soon-line {
  font-size: 1rem;
  color: var(--muted);
}

.settings {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  animation: rise 0.55s var(--ease) 0.1s both;
}

.settings-block {
  border: 1px solid var(--line);
  padding: 0.85rem;
}

.settings-block h2 {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.75rem;
  text-transform: lowercase;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 0;
  border-top: 1px solid var(--line-soft);
}

.settings-row:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.settings-row strong {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
}

.settings-row small {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.65rem;
  color: var(--muted);
}

.settings-row select {
  background: #000;
  border: 1px solid var(--line);
  padding: 0.35rem 0.45rem;
  font-size: 0.75rem;
  min-width: 5.5rem;
}

.settings-toggle input {
  width: 1rem;
  height: 1rem;
  accent-color: #fff;
}

.settings-foot {
  font-size: 0.7rem;
  color: var(--muted);
}

/* —— overlays —— */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.72);
  animation: fade 0.2s var(--ease) both;
}

.overlay[hidden] {
  display: none;
}

#yt-warn {
  z-index: 12000;
}

.dialog {
  width: min(100%, 22rem);
  padding: 1.1rem;
  border: 1px solid var(--line);
  background: #000;
  text-align: center;
  animation: pop 0.28s var(--ease) both;
}

.dialog-wide {
  width: min(100%, 32rem);
  text-align: left;
}

.dialog h2 {
  font-family: var(--brand);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.03em;
  margin-bottom: 0.45rem;
}

.dialog-body {
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.45;
}

.dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
  margin: 0.9rem 0;
}

.dialog-actions[hidden] {
  display: none;
}

.dialog-actions button {
  padding: 0.75rem 0.5rem;
  border: 1px solid var(--line);
  font-size: 0.8rem;
  transition: background 0.2s var(--ease);
}

.dialog-actions button:hover {
  background: var(--fill);
}

.dialog-done {
  width: 100%;
  margin-top: 0.35rem;
}

.yt-warn-actions {
  grid-template-columns: 1fr;
}

.dialog-body a {
  color: #fff;
  text-underline-offset: 0.15em;
}

.yt-warn-skip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  margin-top: 0.15rem;
  font-size: 0.7rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.yt-warn-skip input {
  width: 1rem;
  height: 1rem;
  accent-color: #fff;
}

/* IG picker */
.picker-head {
  margin-bottom: 0.85rem;
}

.picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
  gap: 0.55rem;
  max-height: min(55vh, 28rem);
  overflow: auto;
  margin-bottom: 0.9rem;
}

.picker-tile {
  position: relative;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  background: var(--fill);
  overflow: hidden;
  padding: 0;
  animation: rise 0.4s var(--ease) both;
  transition:
    transform 0.2s var(--ease),
    box-shadow 0.2s var(--ease);
}

.picker-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 0 1px var(--ink);
}

.picker-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.picker-tile .tag {
  position: absolute;
  left: 0.3rem;
  top: 0.3rem;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.75);
  font-size: 0.6rem;
  padding: 0.1rem 0.3rem;
}

.picker-tile .idx {
  position: absolute;
  right: 0.3rem;
  bottom: 0.3rem;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.75);
  font-size: 0.65rem;
  padding: 0.1rem 0.35rem;
}

.picker-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: flex-end;
}

.picker-foot .btn[hidden] {
  display: none;
}

.terms-layout {
  display: flex;
  gap: 0.9rem;
  align-items: flex-start;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.terms-img {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border: 1px solid var(--line);
  flex-shrink: 0;
}

.terms-copy h2 {
  margin-bottom: 0.4rem;
}

.terms-copy p {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--muted);
}

/* —— motion —— */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes floaty {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

html[data-reduce-motion="true"] *,
html[data-reduce-motion="true"] *::before,
html[data-reduce-motion="true"] *::after {
  animation: none !important;
  transition: none !important;
}

@media (max-width: 720px) {
  body {
    flex-direction: column;
  }

  .rail {
    width: 100%;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 0.75rem;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .rail-brand {
    writing-mode: horizontal-tb;
    transform: none;
    margin: 0 0.5rem 0 0;
  }

  .rail-nav,
  .rail-foot {
    flex-direction: row;
    width: auto;
    margin: 0;
  }

  .rail-foot {
    margin-left: auto;
  }

  .rail-btn {
    flex-direction: row;
    gap: 0.35rem;
    padding: 0.45rem 0.55rem;
    font-size: 0.68rem;
  }

  .frame {
    padding: 0.85rem;
    align-items: flex-start;
  }
}
