:root {
  /* Light mode colors */
  --bg: #FBF7F2;
  --surface: #FFFFFF;
  --ink: #1E1B18;
  --muted: #6F6A64;
  --accent: #FF7A45;
  --on-accent: #FFFFFF;
  --region-idle: rgba(30, 27, 24, 0.1);
  --region-selected: rgba(255, 122, 69, 0.35);
  --success: #2FB774;

  /* Spacing */
  --sp-xs: 4px;
  --sp-sm: 8px;
  --sp-md: 12px;
  --sp-lg: 16px;
  --sp-xl: 24px;
  --sp-2xl: 32px;

  /* Shadows */
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);

  /* Border radius */
  --radius-card: 20px;
  --radius-pill: 999px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141210;
    --surface: #1E1B18;
    --ink: #F5F1EC;
    --muted: #A39D96;
    --accent: #FF8A5B;
  }
}

:root[data-theme="dark"] {
  --bg: #141210;
  --surface: #1E1B18;
  --ink: #F5F1EC;
  --muted: #A39D96;
  --accent: #FF8A5B;
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: -apple-system, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100%;
}

/* Top bar */
.top-bar {
  background: var(--surface);
  border-bottom: 1px solid rgba(30, 27, 24, 0.08);
  padding: max(8px, env(safe-area-inset-top)) var(--sp-lg) var(--sp-sm);
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.top-bar-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 100%;
}

.wordmark {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.3px;
}

.paw-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  fill: var(--accent);
}

.btn-new {
  padding: 8px 16px;
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 150ms;
}

.btn-new:not(.hidden):active {
  background: rgba(255, 122, 69, 0.1);
}

.btn-new.hidden {
  display: none;
}

/* Stage area */
.stage {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-xl) var(--sp-lg);
  padding-bottom: calc(300px + var(--sp-xl));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  -webkit-overflow-scrolling: touch;
}

.state-card {
  background: var(--surface);
  border-radius: var(--radius-card);
  padding: var(--sp-2xl);
  text-align: center;
  box-shadow: var(--shadow);
  max-width: 100%;
  width: 100%;
  margin-block: auto;
}

.state-card.hidden {
  display: none;
}

.state-card h1 {
  font-family: ui-rounded, -apple-system, system-ui, sans-serif;
  font-size: 32px;
  font-weight: 700;
  margin: var(--sp-lg) 0 var(--sp-md);
  line-height: 1.2;
}

.state-card p {
  color: var(--muted);
  margin: 0 0 var(--sp-xl);
  font-size: 16px;
}

.stage-paw {
  width: 80px;
  height: 80px;
  margin: 0 auto var(--sp-lg);
  fill: var(--accent);
  opacity: 0.3;
}

.btn-pick {
  display: inline-block;
  padding: 16px 32px;
  background: var(--accent);
  color: var(--on-accent);
  border: none;
  border-radius: var(--radius-pill);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 200ms;
}

.btn-pick:active {
  opacity: 0.9;
  transform: scale(0.98);
}

.continue-pill {
  margin-top: var(--sp-lg);
  padding-top: var(--sp-lg);
  border-top: 1px solid rgba(30, 27, 24, 0.1);
}

.continue-pill button {
  padding: 10px 20px;
  background: rgba(255, 122, 69, 0.1);
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 150ms;
}

.continue-pill button:active {
  opacity: 0.8;
}

.continue-pill.hidden {
  display: none;
}

/* Uploading state */
.upload-progress {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-xl);
}

.progress-ring {
  position: relative;
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.progress-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.progress-ring circle {
  stroke-width: 4;
}

.progress-bg {
  stroke: rgba(30, 27, 24, 0.1);
}

.progress-fg {
  stroke: var(--accent);
  stroke-dasharray: 282.7;
  stroke-dashoffset: 282.7;
  stroke-linecap: round;
  transition: stroke-dashoffset 200ms;
}

.progress-ring span {
  position: absolute;
  font-size: 28px;
  font-weight: 700;
  color: var(--ink);
}

.upload-stage {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
}

.queue-position {
  font-size: 14px;
  color: var(--muted);
  margin: 0 !important;
}

.queue-position.hidden {
  display: none;
}

.btn-cancel-upload {
  padding: 8px 16px;
  background: transparent;
  color: var(--muted);
  border: none;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: all 150ms;
}

.btn-cancel-upload:active {
  background: rgba(30, 27, 24, 0.08);
}

.error-message {
  margin-top: var(--sp-lg);
  padding: var(--sp-lg);
  background: rgba(239, 68, 68, 0.1);
  border-radius: 12px;
  color: #dc2626;
  font-size: 14px;
  text-align: center;
}

.error-message.hidden {
  display: none;
}

/* Ready state */
.state-ready {
  display: flex !important;
  flex-direction: column;
  gap: var(--sp-lg);
  align-items: center;
  width: 100%;
}

.state-ready.hidden {
  display: none !important;
}

.waveform-card {
  background: var(--surface);
  border-radius: var(--radius-card);
  padding: var(--sp-lg);
  box-shadow: var(--shadow);
  width: 100%;
  height: 160px;
  overflow: hidden;
}

#waveform-container {
  width: 100%;
  height: 100%;
}

.mode-pills {
  display: flex;
  gap: var(--sp-sm);
  width: 100%;
  justify-content: center;
}

.mode-pill {
  padding: 10px 16px;
  background: rgba(30, 27, 24, 0.05);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 150ms;
  display: flex;
  align-items: center;
  gap: 6px;
}

.mode-pill.active {
  background: var(--accent);
  color: var(--on-accent);
}

.count-badge {
  font-size: 12px;
  opacity: 0.8;
  font-weight: 600;
}

/* Carousel */
.carousel {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  padding: var(--sp-md) 0;
  gap: var(--sp-lg);
  display: flex;
  -webkit-overflow-scrolling: touch;
}

.carousel::-webkit-scrollbar {
  display: none;
}

.carousel-card {
  flex: 0 0 calc(100% * 0.72);
  background: var(--surface);
  border-radius: var(--radius-card);
  padding: var(--sp-lg);
  box-shadow: var(--shadow);
  scroll-snap-align: center;
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
  cursor: pointer;
  transition: all 150ms;
}

.carousel-card.active {
  border: 2px solid var(--accent);
}

.carousel-card:active {
  transform: scale(0.98);
}

.carousel-card-label {
  font-size: 24px;
  font-weight: 700;
  font-family: ui-rounded, -apple-system, system-ui, sans-serif;
}

.carousel-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  color: var(--muted);
}

.carousel-card-rank {
  background: rgba(255, 122, 69, 0.1);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}

.play-btn-wrapper {
  position: relative;
  width: 72px;
  height: 72px;
  flex-shrink: 0;
  align-self: flex-end;
  display: flex;
  align-items: center;
  justify-content: center;
}

.carousel-play-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  border: none;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 200ms;
  position: relative;
  z-index: 10;
}

.carousel-play-btn:active {
  transform: scale(0.95);
}

.carousel-card {
  position: relative;
}

.progress-ring-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.progress-ring-track {
  fill: none;
  stroke: rgba(255, 122, 69, 0.15);
  stroke-width: 4;
}

.progress-ring-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 4;
  stroke-dasharray: 207.35;
  stroke-dashoffset: 207.35;
  stroke-linecap: round;
  transition: none;
  transform-origin: 36px 36px;
  transform: rotate(-90deg);
}

.clip-error {
  position: fixed;
  bottom: 20px;
  left: 16px;
  right: 16px;
  background: #D32F2F;
  color: white;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 1000;
  animation: slideUp 200ms ease-out;
}

@keyframes slideUp {
  from {
    transform: translateY(100px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.carousel-card-label-maybe {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.search-harder-link {
  text-align: center;
  font-size: 0.875rem;
  color: var(--muted);
  margin: var(--sp-md) 0 0 0;
  padding: 0 var(--sp-md);
}

.search-harder-link.hidden {
  display: none;
}

.btn-text-inline {
  background: none;
  border: none;
  color: var(--accent);
  padding: 0;
  margin: 0;
  font-size: inherit;
  cursor: pointer;
  text-decoration: underline;
}

.btn-text-inline:active {
  opacity: 0.7;
}

.effort-note {
  text-align: center;
  font-size: 0.875rem;
  color: var(--muted);
  margin: var(--sp-md) 0 0 0;
  padding: 0 var(--sp-md);
}

.effort-note.hidden {
  display: none;
}

.no-candidates-card {
  background: var(--surface);
  border-radius: var(--radius-card);
  padding: var(--sp-xl);
  box-shadow: var(--shadow);
  text-align: center;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: var(--sp-lg);
}

.no-candidates-card p {
  margin: 0;
}

.no-candidates-card .hint {
  font-size: 0.875rem;
  color: var(--muted);
}

.no-candidates-card button {
  width: 100%;
}

.no-candidates-card.hidden {
  display: none;
}

.carousel-card.hidden {
  display: none;
}

.feedback-buttons {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  justify-content: flex-end;
}

.btn-feedback-good,
.btn-feedback-bad,
.btn-feedback-cutoff {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(30, 27, 24, 0.1);
  background: var(--surface);
  border-radius: 8px;
  font-size: 18px;
  cursor: pointer;
  transition: all 150ms;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.btn-feedback-good:active:not(:disabled),
.btn-feedback-bad:active:not(:disabled),
.btn-feedback-cutoff:active:not(:disabled) {
  background: rgba(30, 27, 24, 0.08);
  transform: scale(0.95);
}

.btn-feedback-good:disabled,
.btn-feedback-bad:disabled,
.btn-feedback-cutoff:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-feedback-not {
  min-height: 36px;
  padding: 6px 12px;
  border: 1px solid var(--muted);
  background: transparent;
  color: var(--muted);
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 150ms;
  white-space: nowrap;
}

.btn-feedback-not:active:not(:disabled) {
  background: rgba(111, 106, 100, 0.1);
  transform: scale(0.95);
}

.btn-feedback-not:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.feedback-confirmation {
  position: fixed;
  bottom: 20px;
  left: 16px;
  right: 16px;
  background: var(--success);
  color: white;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 1000;
  animation: slideUp 200ms ease-out;
  text-align: center;
}

.no-candidates-card .hint {
  font-size: 0.875rem;
  color: var(--muted);
}

.no-candidates-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

/* Fine-tune section */
.finetune-section {
  background: var(--surface);
  border-radius: var(--radius-card);
  padding: var(--sp-lg);
  box-shadow: var(--shadow);
  width: 100%;
}

.finetune-section.hidden {
  display: none;
}

.finetune-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--sp-lg);
  gap: var(--sp-lg);
}

.finetune-row label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
  width: 40px;
}

.finetune-controls {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  flex: 1;
  justify-content: flex-end;
}

.nudge-btn {
  width: 44px;
  height: 44px;
  border: 1px solid rgba(30, 27, 24, 0.2);
  background: var(--bg);
  border-radius: 8px;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  transition: all 150ms;
}

.nudge-btn:active {
  background: rgba(255, 122, 69, 0.1);
  border-color: var(--accent);
}

.time-chip {
  padding: 6px 12px;
  background: rgba(30, 27, 24, 0.05);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  min-width: 60px;
}

.finetune-length {
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
}

.length-display {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: var(--sp-sm);
}

.length-display > span:first-child {
  font-size: 18px;
  font-weight: 700;
  font-family: ui-monospace, monospace;
}

.length-limit {
  font-size: 14px;
  color: var(--muted);
}

.length-bar {
  height: 4px;
  background: rgba(30, 27, 24, 0.1);
  border-radius: 2px;
  overflow: hidden;
}

.length-fill {
  height: 100%;
  background: var(--accent);
  transition: width 200ms;
}

.clamp-message {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
  text-align: center;
}

/* Sheet backdrop */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 99;
  cursor: pointer;
  transition: opacity 300ms;
}

.sheet-backdrop.hidden {
  display: none;
}

/* Bottom sheet */
.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-radius: 28px 28px 0 0;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.12);
  height: auto;
  max-height: 80vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  z-index: 100;
  padding-bottom: max(20px, env(safe-area-inset-bottom));
  transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.bottom-sheet.expanded {
  max-height: 85vh;
}

.sheet-state {
  display: none;
}

.sheet-state:not(.hidden) {
  display: flex;
  flex-direction: column;
}

.sheet-state.hidden {
  display: none !important;
}

.sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--sp-lg) var(--sp-lg) 0;
  min-height: 40px;
}

.drag-handle {
  width: 40px;
  height: 4px;
  background: rgba(30, 27, 24, 0.2);
  border-radius: 2px;
  cursor: grab;
  flex-shrink: 0;
}

.drag-handle:active {
  cursor: grabbing;
}

.btn-close {
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  font-size: 24px;
  cursor: pointer;
  color: var(--ink);
  transition: all 150ms;
}

.btn-close:active {
  opacity: 0.7;
}

.sheet-content {
  padding: var(--sp-lg);
  display: flex;
  flex-direction: column;
  gap: var(--sp-lg);
}

/* Make primary button full width in collapsed state */
#sheet-collapsed .sheet-content {
  flex-direction: row;
  align-items: center;
}

#sheet-collapsed .btn-primary {
  flex: 1;
}

#sheet-collapsed .btn-secondary {
  flex-shrink: 0;
}

.sheet-content h2 {
  font-family: ui-rounded, -apple-system, system-ui, sans-serif;
  font-size: 22px;
  font-weight: 700;
  margin: 0;
}

/* Forms */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
}

.form-group label {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.cleanup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.btn-ab-listen {
  padding: 6px 12px;
  background: rgba(255, 122, 69, 0.1);
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 150ms;
}

.btn-ab-listen:active {
  opacity: 0.8;
}

#name-input {
  padding: 12px var(--sp-lg);
  border: 1px solid rgba(30, 27, 24, 0.2);
  border-radius: 12px;
  font-size: 16px;
  font-family: inherit;
  background: var(--bg);
  color: var(--ink);
  transition: all 150ms;
}

#name-input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
}

.toggle-switch {
  position: relative;
  width: 50px;
  height: 28px;
  background: rgba(30, 27, 24, 0.1);
  border-radius: 14px;
  cursor: pointer;
  transition: all 150ms;
}

#cleanup-checkbox {
  display: none;
}

#cleanup-checkbox:checked + .toggle-track {
  background: var(--accent);
}

.toggle-track {
  position: absolute;
  inset: 0;
  border-radius: 14px;
  background: rgba(30, 27, 24, 0.1);
  transition: all 150ms;
  display: flex;
  align-items: center;
}

.toggle-track::after {
  content: '';
  position: absolute;
  width: 24px;
  height: 24px;
  background: var(--surface);
  border-radius: 12px;
  left: 2px;
  transition: all 150ms;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#cleanup-checkbox:checked + .toggle-track::after {
  left: calc(100% - 26px);
}

/* Expanded and done states */
#sheet-expanded .sheet-content,
#sheet-done .sheet-content {
  flex-direction: column;
  width: 100%;
}

/* Done state */
.done-check {
  display: flex;
  justify-content: center;
  margin-bottom: var(--sp-lg);
}

.done-check svg {
  width: 64px;
  height: 64px;
  color: var(--success);
  animation: checkPop 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes checkPop {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

#done-clip-name {
  text-align: center;
  margin: var(--sp-lg) 0;
  width: 100%;
}

.done-downloads {
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
}

.done-downloads a {
  padding: 12px var(--sp-lg);
  background: rgba(30, 27, 24, 0.05);
  color: var(--accent);
  border: none;
  border-radius: 12px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: all 150ms;
}

.done-downloads a:active {
  opacity: 0.8;
}

.done-downloads-row {
  display: flex;
  gap: var(--sp-sm);
  justify-content: center;
}

.btn-small-secondary {
  padding: 8px 12px;
  background: rgba(30, 27, 24, 0.05);
  color: var(--ink);
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 150ms;
}

.btn-small-secondary:active {
  opacity: 0.8;
}

.done-steps {
  border-top: 1px solid rgba(30, 27, 24, 0.1);
  padding-top: var(--sp-lg);
}

.done-steps details {
  cursor: pointer;
  margin-bottom: var(--sp-md);
}

.done-steps summary {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  padding: var(--sp-sm) 0;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

.done-steps summary::-webkit-details-marker {
  margin-right: var(--sp-sm);
  color: var(--muted);
}

.done-steps ol {
  margin: var(--sp-md) 0 0 var(--sp-lg);
  padding: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.done-steps li {
  margin-bottom: var(--sp-sm);
}

/* Clips list */
.clips-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
}

.clip-item {
  padding: var(--sp-lg);
  background: rgba(30, 27, 24, 0.02);
  border-radius: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-lg);
}

.clip-info {
  flex: 1;
  min-width: 0;
}

.clip-name {
  font-weight: 600;
  margin-bottom: var(--sp-xs);
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clip-meta {
  font-size: 13px;
  color: var(--muted);
}

.clip-actions {
  display: flex;
  gap: var(--sp-sm);
  flex-shrink: 0;
}

.btn-clip-play {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  border: none;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 150ms;
}

.btn-clip-play:active {
  transform: scale(0.95);
}

.btn-clip-share, .btn-clip-download {
  padding: 8px 12px;
  background: transparent;
  border: 1px solid rgba(30, 27, 24, 0.2);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: var(--ink);
  text-decoration: none;
  transition: all 150ms;
}

.btn-clip-share:active, .btn-clip-download:active {
  background: rgba(30, 27, 24, 0.08);
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-text {
  padding: 12px 20px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 200ms;
  font-family: inherit;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
}

.btn-primary:not(:disabled):active {
  opacity: 0.9;
  transform: scale(0.98);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  background: rgba(30, 27, 24, 0.05);
  color: var(--ink);
  border: 1px solid transparent;
}

.btn-secondary:not(:disabled):active {
  background: rgba(30, 27, 24, 0.1);
}

.btn-secondary.hidden {
  display: none;
}

.btn-text {
  background: transparent;
  color: var(--muted);
  padding: 8px 12px;
}

.btn-text:active {
  opacity: 0.7;
}

/* Utilities */
.hidden {
  display: none !important;
}

/* Responsive */
@media (max-width: 430px) {
  .state-card {
    padding: var(--sp-xl) var(--sp-lg);
  }

  .stage-paw {
    width: 64px;
    height: 64px;
  }

  .state-card h1 {
    font-size: 28px;
  }

  .finetune-row {
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-md);
  }

  .carousel-card {
    flex: 0 0 calc(100% * 0.72);
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Safari specific */
@supports (-webkit-touch-callout: none) {
  body {
    height: 100dvh;
  }

  #app {
    height: 100dvh;
  }

  .stage {
    min-height: calc(100dvh - 60px - 200px);
  }
}

/* Each sheet state fills the sheet; without this they shrink to fit and sit off-center */
.sheet-state {
  width: 100%;
}

/* Consent banner (non-blocking) */
.consent-banner {
  position: fixed;
  /* Sits just above the collapsed sheet (z-index 100), never under it */
  bottom: calc(148px + env(safe-area-inset-bottom));
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: var(--sp-md) var(--sp-lg);
  z-index: 110;
  animation: slideUp 300ms ease-out;
  pointer-events: auto;
}

.consent-banner.hidden {
  display: none;
}

.consent-banner-content {
  display: flex;
  gap: var(--sp-md);
  align-items: center;
  justify-content: space-between;
  max-width: 100%;
}

.consent-banner-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--sp-xs);
}

.consent-banner-text strong {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.consent-banner-text p {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.3;
}

.consent-banner-actions {
  display: flex;
  gap: var(--sp-sm);
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-consent-got-it {
  background: var(--accent);
  color: var(--surface);
  border: none;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 200ms;
}

.btn-consent-got-it:active {
  opacity: 0.8;
}

.btn-consent-turn-off {
  background: none;
  color: var(--muted);
  border: none;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  cursor: pointer;
  transition: color 200ms;
  text-decoration: underline;
}

.btn-consent-turn-off:active {
  color: var(--ink);
}

/* Top bar actions */
.top-bar-actions {
  display: flex;
  gap: var(--sp-sm);
  align-items: center;
}

.btn-icon {
  background: none;
  border: none;
  font-size: 20px;
  padding: var(--sp-sm);
  cursor: pointer;
  color: var(--ink);
}

.btn-icon:active {
  opacity: 0.7;
}

/* Settings toggle */
.toggle-label {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  padding: var(--sp-md);
  border-radius: var(--radius-pill);
  cursor: pointer;
  user-select: none;
}

.toggle-input {
  display: none;
}

.toggle-track {
  display: inline-block;
  width: 44px;
  height: 24px;
  background: #D0D0D0;
  border-radius: var(--radius-pill);
  position: relative;
  transition: background 200ms;
  flex-shrink: 0;
}

.toggle-track::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  background: var(--surface);
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: left 200ms;
  box-shadow: var(--shadow-sm);
}

.toggle-input:checked + .toggle-track {
  background: var(--success);
}

.toggle-input:checked + .toggle-track::before {
  left: 22px;
}

.toggle-text {
  font-weight: 500;
  flex: 1;
}

.toggle-description {
  margin: 0 0 var(--sp-md) 0;
  padding: 0 var(--sp-md);
  font-size: 13px;
  color: var(--muted);
}

.settings-group {
  padding: var(--sp-md) 0;
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}
