@font-face {
  font-family: Inter;
  src: url("/fonts/inter-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --surface: hsl(220 6% 9%);
  --surface-hover: hsl(220 6% 16%);
  --hairline: hsl(220 6% 22%);
  --text: hsl(220 10% 96%);
  --muted: hsl(220 7% 68%);
  --tick: hsl(220 6% 36%);
  --accent: hsl(223 55% 72%);
  --ease: cubic-bezier(.16, 1, .3, 1);
  --full-width: min(640px, calc(100vw - 24px));
  --full-height: 118px;
  --mini-height: 40px;
  --gap: 14px;
  --track: 22px;
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; overflow: hidden; background: hsl(220 20% 96%); }

body {
  font: 400 13px/1.35 Inter, system-ui, sans-serif;
  font-feature-settings: "tnum";
  color: var(--text);
}

iframe {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: white;
}

.preview {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  background: white;
  opacity: 0;
  transition: opacity 140ms ease-out;
}
.preview[data-on] { opacity: 1; transition: none; }
.preview img { display: block; width: 100%; height: auto; }

.dock {
  position: fixed;
  left: 50%;
  bottom: var(--gap);
  translate: -50% 0;
  width: var(--full-width);
  height: var(--full-height);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  box-shadow: 0 6px 14px -6px hsl(220 20% 6% / .45);
  transition: width 220ms var(--ease), height 220ms var(--ease), border-radius 220ms var(--ease);
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}
.dock[data-shrunk] { width: 164px; height: var(--mini-height); border-radius: 12px; }

.dock-full, .dock-mini {
  position: absolute;
  left: 50%;
  bottom: 0;
  translate: -50% 0;
  transition: opacity 140ms ease-out;
}

.dock-full { width: var(--full-width); height: var(--full-height); padding: 10px 10px 8px; }
.dock-mini {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  width: 162px;
  height: calc(var(--mini-height) - 2px);
  padding: 0 4px;
  opacity: 0;
}
.dock[data-shrunk] .dock-full { opacity: 0; }
.dock[data-shrunk] .dock-mini { opacity: 1; }

.dock-head { display: flex; align-items: center; gap: 12px; padding-left: 6px; min-height: 26px; }
.dock-version { flex: 1; min-width: 0; margin: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--muted); }
.dock-version strong, .dock-expand strong { font-weight: 600; color: var(--text); }
.dock-meta { flex: none; margin: 0; color: var(--muted); }
.dock-meta code { margin-left: 6px; font: 400 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
.dock-subject {
  margin: 0;
  padding: 0 40px 0 6px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--muted);
}

.dock-scrub { display: grid; grid-template-columns: 26px 1fr 26px; align-items: start; gap: 10px; margin-top: 8px; }

.icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--muted);
  cursor: pointer;
  transition: background-color 120ms ease-out, color 120ms ease-out;
}
.icon:active:not(:disabled) { background: var(--hairline); }
.icon:disabled { opacity: .35; cursor: default; }
.icon svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.dock-expand {
  display: flex;
  justify-content: center;
  gap: 6px;
  height: 28px;
  padding: 0 4px;
  align-items: center;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--muted);
  font: inherit;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 120ms ease-out;
}

:is(.icon, .dock-expand, .bands button):focus-visible,
.ruler:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.ruler {
  position: relative;
  height: calc(var(--track) + 18px);
  border-radius: 4px;
  cursor: ew-resize;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.ticks { position: absolute; inset: 3px 0 auto; height: calc(var(--track) - 6px); }
.ticks i {
  position: absolute;
  bottom: 0;
  left: calc(var(--x) * 100%);
  width: 1px;
  height: 56%;
  background: var(--tick);
}
.ticks i[data-start] { height: 100%; }
.ticks i[data-current] { background: var(--accent); }

.thumb {
  position: absolute;
  top: 0;
  left: calc(var(--x) * 100%);
  width: 3px;
  height: var(--track);
  margin-left: -1px;
  border-radius: 2px;
  background: var(--text);
  pointer-events: none;
}

.ruler input {
  position: absolute;
  inset: 0 0 auto;
  width: 100%;
  height: var(--track);
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.bands { position: absolute; inset: auto 0 0; height: 16px; }
.bands button {
  position: absolute;
  left: calc(var(--x) * 100%);
  translate: -50% 0;
  height: 16px;
  padding: 0 3px;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--muted);
  font: 500 11px/16px Inter, system-ui, sans-serif;
  cursor: pointer;
  transition: color 120ms ease-out;
}
.bands button[aria-current] { color: var(--text); font-weight: 600; }

.note {
  position: fixed;
  left: 50%;
  bottom: calc(var(--gap) + var(--full-height) + 8px);
  translate: -50% 0;
  width: max-content;
  max-width: min(520px, calc(100vw - 24px));
  margin: 0;
  padding: 7px 12px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  transition: bottom 220ms var(--ease);
}
body:has(.dock[data-shrunk]) .note { bottom: calc(var(--gap) + var(--mini-height) + 8px); }

@media (max-width: 480px) {
  .bands button { padding: 0; font-size: 10px; }
}

@media (hover: hover) {
  .icon:hover:not(:disabled) { background: var(--surface-hover); color: var(--text); }
  .dock-expand:hover { background: var(--surface-hover); }
  .bands button:hover { color: var(--text); }
}

@media (pointer: coarse) {
  :root { --track: 34px; --full-height: 130px; --mini-height: 44px; }
  .icon, .dock-expand { position: relative; }
  .icon::after, .dock-expand::after, .bands button::after, .ruler::before { content: ""; position: absolute; }
  .icon::after { inset: -9px; }
  #prev::after { right: 0; }
  #next::after { left: 0; }
  .dock-expand::after { inset: -8px 0; }
  .bands button::after { inset: -2px 0 -8px; }
  .ruler::before { inset: -12px -10px 0; }
}

::selection { background: hsl(223 55% 66% / .45); }

@media (prefers-reduced-motion: reduce) {
  .dock, .dock-full, .dock-mini, .preview, .note { transition: none; }
}
