@import url("https://fonts.googleapis.com/css2?family=Literata:opsz,wght@7..72,500;700&family=Space+Grotesk:wght@400;500;700&display=swap");

:root {
  --bg: #f5efe2;
  --bg-deep: #d7e4df;
  --panel: rgba(255, 252, 247, 0.84);
  --panel-strong: rgba(255, 252, 247, 0.95);
  --line: rgba(46, 38, 31, 0.12);
  --line-strong: rgba(46, 38, 31, 0.2);
  --ink: #1f1915;
  --muted: #64574e;
  --muted-soft: rgba(100, 87, 78, 0.76);
  --accent: #b55c38;
  --accent-soft: rgba(181, 92, 56, 0.12);
  --teal: #1f6c67;
  --teal-soft: rgba(31, 108, 103, 0.12);
  --gold: #b78c33;
  --gold-soft: rgba(183, 140, 51, 0.14);
  --danger: #bf5244;
  --danger-soft: rgba(191, 82, 68, 0.12);
  --shadow: 0 18px 44px rgba(74, 55, 30, 0.09);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Space Grotesk", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(181, 92, 56, 0.18), transparent 26%),
    radial-gradient(circle at top right, rgba(31, 108, 103, 0.14), transparent 28%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
  overflow-x: hidden;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  color: inherit;
}

.backdrop,
.wash,
.grid-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.wash {
  filter: blur(64px);
  opacity: 0.4;
}

.wash-a {
  inset: -12rem auto auto -8rem;
  width: 24rem;
  height: 24rem;
  border-radius: 999px;
  background: rgba(181, 92, 56, 0.26);
}

.wash-b {
  inset: auto -8rem -10rem auto;
  width: 22rem;
  height: 22rem;
  border-radius: 999px;
  background: rgba(31, 108, 103, 0.22);
}

.grid-noise {
  background-image:
    linear-gradient(rgba(46, 38, 31, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(46, 38, 31, 0.028) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.44), transparent 86%);
}

.app-shell {
  position: relative;
  z-index: 1;
  width: calc(100% - 24px);
  max-width: 500px;
  margin: 0 auto;
  padding: calc(12px + env(safe-area-inset-top)) 0 calc(24px + env(safe-area-inset-bottom));
}

.main-grid {
  display: grid;
  gap: 10px;
}

.sidebar {
  display: grid;
  gap: 10px;
  align-content: start;
}

.sidebar > .panel {
  margin-bottom: 0;
}

.panel {
  margin-bottom: 10px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--panel);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}

.reveal {
  animation: rise 360ms ease both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-nav {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 8px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.page-nav::-webkit-scrollbar {
  display: none;
}

.page-nav-link {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0.62rem 0.9rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
  text-decoration: none;
  transition:
    transform 160ms ease,
    background 160ms ease,
    color 160ms ease;
}

.page-nav-link:hover {
  transform: translateY(-1px);
}

.page-nav-link.nav-launcher {
  background: transparent;
  color: var(--accent);
  font-weight: 600;
  border: 1px solid var(--accent);
}

.page-nav-link.nav-launcher:hover {
  background: var(--accent);
  color: #fff;
}

.page-nav-link.is-current {
  background: var(--ink);
  color: #fff;
}

.hero {
  display: grid;
  gap: 14px;
  position: relative;
  z-index: 50;
}

.hero-copy {
  display: grid;
  gap: 0.7rem;
}

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

/* ── Deck switcher ── */

.deck-bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.7);
}

.deck-bar-label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.deck-select-wrap {
  flex: 1 1 auto;
  min-width: 0;
}

.deck-select {
  width: 100%;
  min-height: 36px;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.85);
  color: var(--ink);
  font-weight: 600;
}

.deck-select:focus {
  outline: none;
  border-color: rgba(31, 108, 103, 0.32);
  box-shadow: 0 0 0 3px rgba(31, 108, 103, 0.14);
}

.deck-menu-button {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 0.65rem;
  font-size: 1.2rem;
  line-height: 1;
}

.deck-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 4px;
  z-index: 30;
  display: flex;
  flex-direction: column;
  min-width: 200px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel-strong);
  box-shadow: var(--shadow);
}

.deck-menu[hidden] {
  display: none;
}

.deck-menu-item {
  text-align: left;
  padding: 0.55rem 0.7rem;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--ink);
  font-weight: 600;
}

.deck-menu-item:hover {
  background: rgba(31, 108, 103, 0.08);
}

.deck-menu-item.is-danger {
  color: #7f2e24;
}

.deck-menu-item.is-danger:hover {
  background: var(--danger-soft);
}

.eyebrow,
.section-kicker,
.field-label,
.voice-count {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  font-weight: 800;
}

.eyebrow,
.section-kicker,
.field-label {
  color: var(--accent);
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: -0.03em;
}

h1 {
  font-family: "Literata", serif;
  font-size: clamp(1.58rem, 6.4vw, 2rem);
  line-height: 0.98;
}

h2 {
  font-size: 1.12rem;
  font-weight: 800;
  line-height: 1.14;
}

h3 {
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.16;
}

.lede,
.section-note,
.subpanel-note,
.empty-state,
.variant-note,
.library-meta,
.library-note,
.notice,
.hvpt-card p {
  color: var(--muted);
}

.lede {
  margin: 0;
  line-height: 1.58;
}

.subpanel,
.hvpt-card,
.variant-card,
.library-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel-strong);
}

.panel-head,
.subpanel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-note,
.subpanel-note {
  font-size: 0.86rem;
  line-height: 1.4;
}

.notice {
  display: none;
  margin-bottom: 12px;
  padding: 12px 13px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: 0.95rem;
  line-height: 1.45;
}

.notice.is-visible {
  display: block;
}

.notice.notice-info {
  border-color: rgba(31, 108, 103, 0.16);
  background: var(--teal-soft);
  color: #134843;
}

.notice.notice-success {
  border-color: rgba(31, 108, 103, 0.16);
  background: rgba(31, 108, 103, 0.08);
  color: #134843;
}

.notice.notice-warning {
  border-color: rgba(183, 140, 51, 0.18);
  background: var(--gold-soft);
  color: #6f5312;
}

.notice.notice-error {
  border-color: rgba(191, 82, 68, 0.18);
  background: var(--danger-soft);
  color: #7f2e24;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.compact-field {
  margin-bottom: 0;
}

.text-area,
.text-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  padding: 0.92rem 0.98rem;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.text-area {
  resize: vertical;
  min-height: 118px;
  line-height: 1.5;
}

.short-area {
  min-height: 134px;
}

.text-input:focus,
.text-area:focus,
.speed-slider:focus {
  outline: none;
  border-color: rgba(31, 108, 103, 0.28);
  box-shadow: 0 0 0 3px rgba(31, 108, 103, 0.14);
}

.tuning-grid {
  display: grid;
  gap: 10px;
}

.subpanel {
  padding: 13px;
}

.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.preset-chip,
.mini-button,
.ghost-button,
.primary-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  transition:
    transform 160ms ease,
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease;
}

.preset-chip,
.mini-button,
.ghost-button {
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
}

.preset-chip,
.mini-button {
  min-height: 34px;
  padding: 0.55rem 0.82rem;
}

.mini-button {
  white-space: nowrap;
}

.ghost-button,
.primary-button {
  min-height: 44px;
  padding: 0.72rem 1.05rem;
  font-weight: 700;
}

.primary-button {
  border-color: rgba(31, 108, 103, 0.22);
  background: var(--ink);
  color: #fff;
}

.preset-chip:hover,
.mini-button:hover,
.ghost-button:hover,
.primary-button:hover {
  transform: translateY(-1px);
}

.preset-chip.is-active {
  border-color: rgba(181, 92, 56, 0.26);
  background: var(--accent-soft);
  color: #7a391e;
}

.slider-wrap {
  display: block;
  margin: 10px 0 12px;
}

.speed-slider {
  width: 100%;
  accent-color: var(--teal);
}

.speed-value {
  font-size: 1.18rem;
}

.voice-panel {
  margin-top: 2px;
}

.voice-toolbar {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.voice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.voice-option {
  position: relative;
}

.voice-option input {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.voice-option span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0.68rem 0.78rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  font-weight: 700;
  color: var(--muted);
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease,
    color 160ms ease;
}

.voice-option input:checked + span {
  border-color: rgba(31, 108, 103, 0.24);
  background: var(--teal-soft);
  color: #134843;
}

.voice-option span:hover {
  transform: translateY(-1px);
}

.action-row,
.pack-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.action-row[hidden] {
  display: none;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0.48rem 0.82rem;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
}

.variant-list,
.library-list,
.hvpt-grid {
  display: grid;
  gap: 10px;
}

.empty-state {
  padding: 1rem;
  border: 1px dashed rgba(46, 38, 31, 0.16);
  border-radius: var(--radius-lg);
  text-align: center;
  background: rgba(255, 255, 255, 0.45);
  line-height: 1.5;
}

.variant-card {
  padding: 13px;
}

.variant-card.is-playing {
  border-color: rgba(31, 108, 103, 0.3);
  box-shadow: inset 0 0 0 1px rgba(31, 108, 103, 0.16);
}

.variant-top,
.library-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.voice-badge,
.library-date,
.library-tag {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0.36rem 0.72rem;
  border-radius: 999px;
  font-size: 0.77rem;
}

.voice-badge {
  background: var(--accent-soft);
  color: #7a391e;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.library-date,
.library-tag {
  background: rgba(255, 255, 255, 0.74);
  color: var(--muted);
}

.variant-meta {
  color: var(--muted);
  font-size: 0.86rem;
}

.variant-note {
  margin: 0.7rem 0 0.9rem;
  line-height: 1.45;
}

.variant-actions,
.library-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.audio-player {
  width: 100%;
  min-width: 0;
}

.library-card {
  padding: 13px;
}

.library-card.is-active {
  border-color: rgba(181, 92, 56, 0.22);
  box-shadow: inset 0 0 0 1px rgba(181, 92, 56, 0.12);
}

.library-text {
  margin: 0.2rem 0 0;
  font-size: 1rem;
  line-height: 1.35;
}

.library-note {
  margin: 0.5rem 0 0;
  line-height: 1.42;
}

.library-image-frame {
  margin: 12px 0 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.72);
}

.library-image {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.library-meta {
  margin: 0.65rem 0 0.9rem;
  font-size: 0.88rem;
}

.hvpt-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.hvpt-card {
  padding: 14px;
}

.step-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: var(--gold-soft);
  color: #725410;
  font-weight: 800;
}

.hvpt-card h3 {
  margin-top: 0.8rem;
  margin-bottom: 0.5rem;
}

.hvpt-card p {
  margin: 0;
  line-height: 1.5;
}

button:disabled {
  opacity: 0.56;
  cursor: not-allowed;
  transform: none;
}

/* ── Recording ── */

.record-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.record-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--danger);
  opacity: 0.45;
  flex-shrink: 0;
}

.record-button.is-recording {
  border-color: rgba(191, 82, 68, 0.3);
  background: var(--danger-soft);
  color: #7f2e24;
}

.record-button.is-recording .record-dot {
  opacity: 1;
  animation: pulse-dot 1s ease infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.voice-badge-user {
  background: var(--gold-soft);
  color: #725410;
}

.variant-card-user {
  border-color: rgba(183, 140, 51, 0.22);
}

.variant-card-user.is-playing {
  border-color: rgba(183, 140, 51, 0.38);
  box-shadow: inset 0 0 0 1px rgba(183, 140, 51, 0.18);
}

/* ── Mode toggle (single / batch) ── */

.mode-toggle {
  display: inline-flex;
  gap: 4px;
  margin-bottom: 12px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
}

.mode-toggle-button {
  min-height: 32px;
  padding: 0.4rem 0.9rem;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
}

.mode-toggle-button.is-active {
  background: var(--ink);
  color: #fff;
}

.mode-panel[hidden] {
  display: none;
}

.batch-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.batch-meta code {
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--line);
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 0.85em;
}

.inline-field {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.inline-field input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--teal);
}

.inline-field[hidden] {
  display: none;
}

/* ── Groups ── */

.group-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.library-tool-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.55);
}

.image-quality-control {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 0.52rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 0.8rem;
  white-space: nowrap;
}

.quality-select {
  min-height: 28px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  font-weight: 700;
}

.quality-select:focus {
  outline: 2px solid rgba(31, 108, 103, 0.22);
  outline-offset: 2px;
}

.group-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.group-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.36rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  font-size: 0.85rem;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.group-chip:hover {
  transform: translateY(-1px);
}

.group-chip.is-active {
  border-color: rgba(31, 108, 103, 0.32);
  background: var(--teal-soft);
  color: #134843;
}

.group-chip-name {
  font-weight: 700;
}

.group-chip-count {
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(46, 38, 31, 0.06);
  font-size: 0.78rem;
  color: var(--muted);
}

.group-chip.is-active .group-chip-count {
  background: rgba(255, 255, 255, 0.6);
  color: #134843;
}

.group-chip-drill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.6rem;
  line-height: 1;
  cursor: pointer;
}

.group-chip-drill:hover {
  transform: scale(1.08);
}

.group-chip-drill.is-drilling {
  background: #b74b32;
  animation: hvpt-chip-pulse 1.2s ease-in-out infinite;
}

@keyframes hvpt-chip-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(183, 75, 50, 0.5); }
  50% { box-shadow: 0 0 0 6px rgba(183, 75, 50, 0); }
}

.pack.is-just-generated {
  animation: hvpt-pack-pulse 1.2s ease-out;
}

@keyframes hvpt-pack-pulse {
  0% { box-shadow: 0 0 0 0 rgba(31, 108, 103, 0.45); }
  40% { box-shadow: 0 0 0 10px rgba(31, 108, 103, 0.14); }
  100% { box-shadow: 0 0 0 0 rgba(31, 108, 103, 0); }
}

.library-groups {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 0.6rem;
}

.group-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.55rem;
  border: 1px solid rgba(31, 108, 103, 0.22);
  border-radius: 999px;
  background: var(--teal-soft);
  color: #134843;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.group-badge:hover {
  background: rgba(31, 108, 103, 0.18);
}

.group-badge-add {
  border-style: dashed;
  background: transparent;
  color: var(--muted);
  border-color: var(--line-strong);
}

.group-badge-add:hover {
  background: rgba(255, 255, 255, 0.6);
  color: var(--ink);
}

/* ── Group popover ── */

.group-popover {
  position: absolute;
  z-index: 40;
  width: 260px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel-strong);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.group-popover-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 220px;
  overflow-y: auto;
}

.group-popover-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0.35rem 0.4rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.group-popover-item:hover {
  background: rgba(31, 108, 103, 0.08);
}

.group-popover-item input {
  width: 16px;
  height: 16px;
  accent-color: var(--teal);
}

.group-popover-empty {
  margin: 0;
  padding: 6px 4px;
  color: var(--muted);
  font-size: 0.86rem;
}

.group-popover-new {
  width: 100%;
}

/* ── Modal ── */

.modal-root {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-root[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 12, 9, 0.42);
  backdrop-filter: blur(3px);
}

.modal-panel {
  position: relative;
  width: min(520px, 100%);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 18px;
  border-radius: var(--radius-lg);
  background: var(--panel-strong);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-title {
  font-size: 1.05rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.manage-groups-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.manage-group-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.7);
}

.mini-button.is-danger {
  border-color: rgba(191, 82, 68, 0.26);
  color: #7f2e24;
}

.mini-button.is-danger:hover {
  background: var(--danger-soft);
}

/* ── Drill mode ── */

.drill-status {
  display: none;
  margin-bottom: 10px;
  padding: 10px 13px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(31, 108, 103, 0.16);
  background: var(--teal-soft);
  color: #134843;
  font-size: 0.88rem;
  line-height: 1.4;
}

.drill-status.is-visible {
  display: block;
}

.library-top-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.library-card.is-drill-playing {
  border-color: rgba(31, 108, 103, 0.3);
  box-shadow: inset 0 0 0 1px rgba(31, 108, 103, 0.16);
}

.library-card.is-drill-excluded {
  opacity: 0.5;
}

.drill-include-toggle {
  display: inline-flex;
  align-items: center;
  margin-right: 2px;
  cursor: pointer;
}

.drill-include-toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--ink);
  cursor: pointer;
}

.wait-slider {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 6px;
  font-size: 0.78rem;
  color: var(--muted);
}

.wait-slider-label {
  letter-spacing: 0.02em;
}

.wait-slider input[type="range"] {
  width: 84px;
  accent-color: var(--accent);
  cursor: pointer;
}

.wait-slider-value {
  min-width: 28px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.shuffle-toggle.is-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.play-phrase-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  padding: 0.4rem 0.7rem;
  font-size: 0.8rem;
}

.play-phrase-button.is-playing {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.drill-select-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  margin-bottom: 6px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.55);
  border: 1px dashed rgba(46, 38, 31, 0.16);
  flex-wrap: wrap;
}

/* ── Responsive: phone ── */

@media (max-width: 599px) {
  .hero {
    gap: 10px;
  }

  .lede {
    font-size: 0.96rem;
    line-height: 1.5;
  }

  .hvpt-grid {
    grid-template-columns: 1fr;
  }

  .variant-note {
    display: none;
  }

  .library-tool-row > .mini-button,
  .image-quality-control {
    flex: 1 1 142px;
    justify-content: center;
  }
}

/* ── Responsive: tablet and up ── */

@media (min-width: 600px) {
  .app-shell {
    max-width: 640px;
  }

  .voice-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* ── Responsive: desktop two-column ── */

@media (min-width: 900px) {
  .app-shell {
    max-width: 1120px;
  }

  .main-grid {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }

  .sidebar {
    position: sticky;
    top: 16px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    scrollbar-width: thin;
  }

  .voice-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .hvpt-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .text-area {
    min-height: 96px;
  }

  .short-area {
    min-height: 110px;
  }
}

/* ── Responsive: wide desktop ── */

@media (min-width: 1200px) {
  .app-shell {
    max-width: 1280px;
  }

  .main-grid {
    grid-template-columns: 1.15fr 1fr;
  }

  .voice-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
