/* Eightmo Web. Tokens follow eightmo_apple DESIGN.md §9 (docs/design.md §10). Dark first, light by media query. */

:root {
  color-scheme: dark;
  --canvas: #061329;
  --background: #0c1e38;
  --surface: #122945;
  --raised: #1a3654;
  --primary-text: #f6faff;
  --secondary-text: #a9b8cc;
  --accent: #12ddf3;
  --on-accent: #061329;
  --control: #12ddf3;
  --selected-surface: #173e54;
  --border: #334962;
  --control-border: #7892ac;
  --practice-canvas: #061329;
  --practice-panel: #0c1e38;
  --practice-action-fill: #12ddf3;
  --on-practice-action: #061329;
  --practice-selected-surface: #173e54;
  --practice-control: #12ddf3;
  --practice-handle-fill: #a2eff7;
  --practice-handle-text: #061329;
  --disabled-surface: #26374b;
  --disabled-text: #a9b8cc;
  --success: #65d6ad;
  --warning: #ffd083;
  --error: #ffb4bc;
  --coral: #ff8a86;
  --video-stage: #000000;
  --video-control-surface: #17191c;

  --glass-fill: rgb(18 41 69 / 0.72);
  --glass-border: rgb(120 146 172 / 0.35);
  --glass-shadow: 0 12px 32px rgb(0 0 0 / 0.35);
  --scrim: rgb(0 0 0 / 0.35);

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --radius-small: 8px;
  --radius-button: 12px;
  --radius-card: 20px;
  --radius-panel: 24px;

  --fade: 200ms;
  --font: system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", sans-serif;
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --canvas: #f7f7f8;
    --background: #eff0f2;
    --surface: #ffffff;
    --raised: #eaedf0;
    --primary-text: #061329;
    --secondary-text: #4c5b6d;
    --control: #006779;
    --selected-surface: #ddeff2;
    --border: #cdd3db;
    --control-border: #66788c;
    --practice-canvas: #f3f5f7;
    --practice-panel: #ffffff;
    --practice-action-fill: #007f94;
    --on-practice-action: #ffffff;
    --practice-selected-surface: #e3f2f5;
    --practice-control: #006779;
    --practice-handle-fill: #e3f2f5;
    --practice-handle-text: #006779;
    --disabled-surface: #e4e6e9;
    --disabled-text: #526071;
    --success: #126b49;
    --warning: #815000;
    --error: #ad2044;
    --coral: #ad4148;

    --glass-fill: rgb(255 255 255 / 0.78);
    --glass-border: rgb(102 120 140 / 0.3);
    --glass-shadow: 0 12px 32px rgb(6 19 41 / 0.14);
    --scrim: rgb(6 19 41 / 0.2);
  }
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --fade: 0ms;
  }
}

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

html,
body {
  margin: 0;
  height: 100%;
}

body {
  background: var(--practice-canvas);
  color: var(--primary-text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

[hidden] {
  display: none !important;
}

button,
input {
  font: inherit;
  color: inherit;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

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

.icon {
  display: inline-flex;
  flex: none;
}

/* Glass: one surface per group, never nested. */
.glass {
  background: var(--glass-fill);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
}

@media (prefers-reduced-transparency: reduce) {
  .glass {
    background: var(--surface);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

@media (prefers-contrast: more) {
  .glass,
  .tile,
  .button.plain,
  .chip {
    border-width: 2px;
    border-color: var(--control-border);
  }
}

/* Buttons */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 40px;
  padding: 0 var(--space-4);
  border-radius: var(--radius-button);
  border: 1px solid transparent;
  background: transparent;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 100ms, opacity var(--fade);
}

.button:disabled {
  cursor: default;
  background: var(--disabled-surface);
  color: var(--disabled-text);
  border-color: transparent;
}

.button.plain {
  background: transparent;
  border-color: var(--border);
  color: var(--primary-text);
}

.button.plain:hover:not(:disabled) {
  background: var(--selected-surface);
}

.button.primary,
.button.practice-action {
  background: var(--practice-action-fill);
  color: var(--on-practice-action);
}

/* Cyan fills in light mode carry a --control outline (DESIGN.md §9). */
@media (prefers-color-scheme: light) {
  .button.primary,
  .button.practice-action {
    border-color: var(--control);
  }
}

.button.primary:hover:not(:disabled),
.button.practice-action:hover:not(:disabled) {
  filter: brightness(1.06);
}

.button.round {
  min-width: 40px;
  min-height: 40px;
  padding: 0;
  border-radius: 999px;
  border-color: var(--border);
  font-size: 18px;
  font-weight: 500;
}

.button.small {
  min-height: 32px;
  font-size: 13px;
}

.button.round.small {
  min-width: 32px;
  min-height: 32px;
  font-size: 16px;
}

.button.round:disabled {
  background: transparent;
  opacity: 0.45;
}

/* File picker card on the idle stage */

.drop-card {
  grid-area: 1 / 1;
  pointer-events: auto;
  width: min(520px, 100%);
  max-height: 100%;
  overflow: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-6) var(--space-5);
  border-radius: var(--radius-panel);
  border: 2px dashed var(--border);
  background: var(--background);
  text-align: center;
  transition: border-color var(--fade), background-color var(--fade);
}

.dragging-file .drop-card {
  border-color: var(--control);
  background: var(--selected-surface);
}

.dragging-file .studio .stage {
  outline: 3px solid var(--control);
  outline-offset: -3px;
}

.drop-icon {
  color: var(--control);
}

.drop-icon svg {
  width: 48px;
  height: 48px;
}

.drop-title {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
}

.drop-card .button {
  min-height: 52px;
  min-width: 200px;
  font-size: 16px;
}

.drop-privacy,
.drop-formats {
  margin: 0;
  color: var(--secondary-text);
  text-wrap: balance;
  word-break: auto-phrase;
}

.drop-formats {
  font-size: 13px;
}

/* Short stages (e.g. 900×600) drop the icon and tighten the card so the notes stay visible. */
@container stage (max-height: 380px) {
  .drop-card {
    gap: var(--space-2);
    padding: var(--space-4);
  }

  .drop-icon {
    display: none;
  }

  .drop-title {
    font-size: 20px;
  }

  .drop-card .button {
    min-height: 44px;
  }
}

/* Studio: idle and preparing share the same rows so the video rect never moves (D06). */

.studio {
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3) var(--space-3);
  background: var(--practice-canvas);
}

.dock {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
}

/* Practice: the stage fills the screen, the HUD and a thin timeline float over it (docs/design.md §4.4). */

.studio.practice-layout {
  display: block;
  position: relative;
  padding: 0;
}

.practice-layout .stage {
  position: absolute;
  inset: 0;
  border-radius: 0;
}

.practice-layout .topbar {
  position: absolute;
  top: var(--space-2);
  left: var(--space-3);
  right: var(--space-3);
  z-index: 5;
}

.practice-layout .dock {
  position: absolute;
  left: var(--space-3);
  right: var(--space-3);
  bottom: var(--space-3);
  z-index: 5;
}

/* 条件を調整 while paused: the settings row floats above the timeline on one glass surface. */
.practice-layout .settings-row {
  padding: var(--space-2);
  border-radius: var(--radius-panel);
  background: var(--glass-fill);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  animation: fade-in var(--fade) ease-out;
}

@media (prefers-reduced-transparency: reduce) {
  .practice-layout .settings-row {
    background: var(--surface);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

.practice-layout .timeline {
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-button);
}

.practice-layout .tl-context,
.practice-layout .tl-times {
  display: none;
}

.practice-layout .tl-track-wrap {
  height: 28px;
  padding: 0 14px;
}

.practice-layout .tl-track {
  height: 20px;
  border-radius: 6px;
}

.practice-layout .tl-handle {
  width: 14px;
  height: 28px;
  margin-top: -14px;
}

.practice-layout .tl-grip {
  width: 12px;
  height: 26px;
  font-size: 10px;
}

.practice-layout .tl-playhead {
  top: -3px;
  bottom: -3px;
}

.practice-layout .tl-playhead::before {
  display: none;
}

.topbar {
  position: relative;
  height: 52px;
  border-radius: var(--radius-card);
  padding: 0 var(--space-2);
  transition: opacity var(--fade);
}

.topbar.dimmed,
.timeline.dimmed {
  opacity: 0.15;
}

.topbar.dimmed:hover,
.topbar.dimmed:focus-within,
.timeline.dimmed:hover,
.timeline.dimmed:focus-within {
  opacity: 1;
}

.bar-content {
  height: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.bar-config {
  display: grid;
  grid-template-columns: 1fr minmax(0, auto) 1fr;
}

.bar-side {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  min-width: 0;
}

.bar-end {
  justify-content: flex-end;
  margin-left: auto;
}

.bar-center {
  min-width: 0;
  text-align: center;
}

.file-name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.bar-button {
  min-height: 40px;
  padding: 0 var(--space-3);
  color: var(--primary-text);
}

.bar-button:hover:not(:disabled) {
  background: var(--selected-surface);
}

.bar-button.primary {
  color: var(--on-practice-action);
}

.bar-button:disabled {
  background: transparent;
  opacity: 0.45;
}

.bar-button[aria-pressed="true"] {
  background: var(--practice-selected-surface);
}

.hud-info {
  gap: var(--space-3);
  padding-left: var(--space-2);
  font-variant-numeric: tabular-nums;
}

.hud-loop {
  font-weight: 700;
  white-space: nowrap;
}

.hud-speed {
  padding: 2px var(--space-2);
  border-radius: var(--radius-small);
  background: var(--practice-selected-surface);
  font-weight: 600;
}

/* Stage */

.stage {
  position: relative;
  min-height: 0;
  container: stage / size;
  background: var(--video-stage);
  border-radius: var(--radius-button);
  overflow: hidden;
}

.stage.previewable {
  cursor: pointer;
}

.stage-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--video-stage);
}

.stage-video.mirrored {
  transform: scaleX(-1);
}

.overlays {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: var(--space-4);
  pointer-events: none;
}

.overlay-card {
  grid-area: 1 / 1;
  pointer-events: auto;
  max-width: min(440px, 100%);
  max-height: 100%;
  overflow: auto;
  padding: var(--space-5);
  border-radius: var(--radius-card);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  animation: fade-in var(--fade) ease-out;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

.overlay-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}

.overlay-caption {
  color: var(--secondary-text);
  font-weight: 600;
}

.overlay-detail,
.overlay-code {
  margin: 0;
  color: var(--secondary-text);
}

.overlay-code {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.overlay-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2);
  margin-top: var(--space-1);
}

.countdown-card {
  min-width: 180px;
  padding: var(--space-4) var(--space-6);
  gap: 0;
}

.countdown-number {
  font-size: clamp(56px, 14vh, 112px);
  line-height: 1.05;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.rest-card {
  min-width: 280px;
}

.rest-seconds {
  font-size: 40px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.rest-speed {
  margin: 0;
  font-weight: 600;
  color: var(--practice-control);
  font-variant-numeric: tabular-nums;
}

.result-figures {
  display: flex;
  gap: var(--space-5);
}

.result-figure {
  font-size: 24px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.result-condition {
  margin: 0;
  color: var(--secondary-text);
  font-variant-numeric: tabular-nums;
}

/* Settings card row */

.settings-row {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  transition: opacity var(--fade);
}

/* Without a video the settings row and timeline stay in place, inert and faded. */
.settings-row.faded,
.timeline.faded {
  opacity: 0.4;
}

.tiles {
  flex: 1;
  min-width: 0;
  display: flex;
  gap: var(--space-2);
}

.tile {
  flex: 1 1 0;
  min-width: 0;
  height: 56px;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0 var(--space-3);
  border-radius: var(--radius-button);
  border: 1px solid var(--border);
  background: var(--practice-panel);
  cursor: pointer;
  text-align: left;
  transition: background-color 100ms;
}

.tile:hover {
  border-color: var(--control-border);
}

.tile.selected {
  background: var(--practice-selected-surface);
  border-color: var(--practice-control);
}

.tile .icon {
  color: var(--practice-control);
}

.tile-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
}

.tile-label {
  font-size: 12px;
  color: var(--secondary-text);
}

.tile-value {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile-more {
  flex: 0 0 56px;
  justify-content: center;
  padding: 0;
}

.practice-action {
  min-height: 54px;
  padding: 0 var(--space-5);
  font-size: 16px;
}

.settings-row > .practice-action {
  flex: none;
  min-width: 168px;
}

/* Timeline */

.timeline {
  border-radius: var(--radius-card);
  padding: var(--space-2) var(--space-3) var(--space-2);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  transition: opacity var(--fade);
}

.tl-context {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 32px;
}

.tl-range-label {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.tl-message {
  color: var(--warning);
  font-size: 13px;
  font-weight: 600;
}

.tl-context .button {
  margin-left: auto;
}

.tl-track-wrap {
  position: relative;
  padding: 0 44px;
  height: 44px;
  display: flex;
  align-items: center;
  touch-action: none;
}

.tl-track-wrap.seekable {
  cursor: pointer;
}

.tl-track {
  position: relative;
  width: 100%;
  height: 40px;
  border-radius: var(--radius-small);
  background: var(--video-control-surface);
}

/* Filmstrip (ui/thumbnails.js): equal slots under the selection, no borders or labels. */
.tl-film {
  position: absolute;
  inset: 0;
  display: flex;
  overflow: hidden;
  border-radius: inherit;
  pointer-events: none;
}

.tl-thumb {
  display: block;
  flex: none;
  width: calc(100% / var(--thumb-count, 8));
  height: 100%;
  object-fit: cover;
}

.tl-dim {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgb(0 0 0 / 0.55);
  border-radius: var(--radius-small);
}

.tl-selection {
  position: absolute;
  top: 0;
  bottom: 0;
  border: 2px solid var(--accent);
  border-radius: 6px;
  background: rgb(18 221 243 / 0.08);
}

.tl-playhead {
  position: absolute;
  top: -6px;
  bottom: -6px;
  width: 2px;
  margin-left: -1px;
  background: #ffffff;
  box-shadow: 0 0 0 1px #000000;
  pointer-events: none;
  z-index: 2;
}

.tl-playhead::before {
  content: "";
  position: absolute;
  top: -5px;
  left: -5px;
  border: 6px solid transparent;
  border-top-color: #ffffff;
  border-bottom: 0;
}

/* A/B: 18px visible grip, 44px hit area; A's grip sits left of its boundary, B's right. */
.tl-handle {
  position: absolute;
  top: 50%;
  width: 44px;
  height: 44px;
  margin-top: -22px;
  display: flex;
  align-items: center;
  cursor: ew-resize;
  z-index: 3;
  touch-action: none;
}

.tl-handle-a {
  transform: translateX(-100%);
  justify-content: flex-end;
}

.tl-handle-b {
  justify-content: flex-start;
}

.tl-grip {
  width: 18px;
  height: 40px;
  display: grid;
  place-items: center;
  background: var(--practice-handle-fill);
  color: var(--practice-handle-text);
  border: 1px solid var(--practice-control);
  font-size: 12px;
  font-weight: 800;
}

.tl-handle-a .tl-grip {
  border-radius: 8px 0 0 8px;
}

.tl-handle-b .tl-grip {
  border-radius: 0 8px 8px 0;
}

.tl-handle.dragging .tl-grip,
.tl-handle:hover .tl-grip {
  filter: brightness(1.08);
}

/* No video yet: a plain track without the selection, handles or playhead. */
.timeline.empty :is(.tl-dim, .tl-selection, .tl-handle, .tl-playhead) {
  display: none;
}

.timeline.locked .tl-handle {
  cursor: default;
  opacity: 0.6;
}

.tl-times {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.tl-time-group {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.tl-time-key {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--practice-handle-fill);
  color: var(--practice-handle-text);
  font-size: 12px;
  font-weight: 800;
}

.tl-time {
  min-width: 64px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.tl-now {
  color: var(--secondary-text);
}

/* Popup: one at a time, a card above the settings row or a bottom sheet. */

.popup-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 20;
}

.popup-backdrop {
  position: absolute;
  inset: 0;
  pointer-events: auto;
  background: transparent;
}

.popup {
  position: absolute;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-card);
  animation: fade-in var(--fade) ease-out;
}

.popup.as-sheet {
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 85dvh;
  border-radius: var(--radius-panel) var(--radius-panel) 0 0;
  background: var(--surface);
}

.popup-title {
  margin: 0;
  padding: var(--space-4) var(--space-5) var(--space-2);
  font-size: 17px;
  font-weight: 700;
}

.popup-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: var(--space-2) var(--space-5);
  overscroll-behavior: contain;
}

.popup-footer {
  padding: var(--space-3) var(--space-5) var(--space-4);
  border-top: 1px solid var(--glass-border);
}

.popup-hint {
  margin: 0 0 var(--space-2);
  font-size: 12px;
  color: var(--secondary-text);
}

.popup-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
}

.popup-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.popup-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--glass-border);
}

.popup-value {
  font-size: 32px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.popup-note {
  margin: 0;
  font-size: 13px;
  color: var(--secondary-text);
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.chip-list.presets {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.chip-list.presets .chip {
  min-width: 0;
  padding: 0;
}

.chip {
  min-height: 36px;
  min-width: 52px;
  padding: 0 var(--space-3);
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.chip[aria-pressed="true"] {
  background: var(--practice-selected-surface);
  border-color: var(--practice-control);
  color: var(--primary-text);
}

.chips {
  margin: 0;
  padding: 0;
  border: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.chips legend {
  padding: 0;
  margin-bottom: var(--space-2);
  font-weight: 600;
}

.slider-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.slider-row input[type="range"] {
  flex: 1;
  min-width: 0;
  accent-color: var(--practice-control);
  height: 28px;
}

.slider-row input[type="range"]:focus-visible {
  outline-offset: 4px;
  border-radius: var(--radius-small);
}

.slider-row input.inactive {
  opacity: 0.45;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  font-weight: 600;
  cursor: pointer;
}

.switch {
  position: relative;
  flex: none;
  width: 48px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid var(--control-border);
  background: var(--disabled-surface);
  cursor: pointer;
  padding: 0;
  transition: background-color 100ms;
}

.switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary-text);
  transition: transform 100ms;
}

.switch[aria-checked="true"] {
  background: var(--practice-control);
  border-color: var(--practice-control);
}

.switch[aria-checked="true"] .switch-thumb {
  transform: translateX(20px);
  background: var(--canvas);
}

@media (prefers-color-scheme: light) {
  .switch[aria-checked="true"] .switch-thumb {
    background: #ffffff;
  }
}

.accel-speeds {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.stepper-controls {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.stepper-value {
  min-width: 64px;
  text-align: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.guide {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-2) var(--space-3);
  margin: 0;
}

.guide dt {
  white-space: nowrap;
}

.guide dd {
  margin: 0;
  color: var(--secondary-text);
}

kbd {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--raised);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
}

/* Toast */

.toast {
  position: fixed;
  left: 50%;
  top: var(--space-6);
  transform: translateX(-50%);
  max-width: min(520px, calc(100% - 32px));
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-button);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--glass-shadow);
  z-index: 30;
  font-weight: 600;
}

/* Mid-width windows keep the full tile values by dropping their icons. */
@media (max-width: 1000px) {
  .tile:not(.tile-more) .icon {
    display: none;
  }
}

@media (max-width: 900px) {
  .bar-button.label-collapsible span:not(.icon) {
    display: none;
  }
}

/* Narrow windows: tiles wrap instead of overlapping. */
@media (max-width: 699px) {
  .settings-row {
    flex-wrap: wrap;
  }

  .tiles {
    flex-basis: 100%;
  }

  .settings-row > .practice-action {
    flex: 1;
  }

  .tile-label,
  .bar-button span:not(.icon) {
    display: none;
  }

  .bar-button {
    padding: 0 var(--space-2);
  }
}

@media (max-height: 640px) {
  .popup-title {
    padding-top: var(--space-3);
    padding-bottom: var(--space-1);
  }

  .popup-value {
    font-size: 24px;
  }

  .popup-stack {
    gap: var(--space-3);
  }

  .popup-footer {
    padding-top: var(--space-2);
    padding-bottom: var(--space-3);
  }

  .popup-hint {
    display: none;
  }

  .studio {
    gap: 6px;
    padding-top: 6px;
    padding-bottom: var(--space-2);
  }

  .topbar {
    height: 46px;
  }

  .tl-context {
    min-height: 28px;
  }
}
