:root {
  color-scheme: light dark;
  --bg: #0f1419;
  --surface: #1a2332;
  --text: #f5f7fa;
  --muted: #9aa5b1;
  --accent: #ff4757;
  --accent-active: #ff6b81;
  --success: #2ed573;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, system-ui, -apple-system, sans-serif;
  background: radial-gradient(circle at top, #1f2a44, var(--bg));
  color: var(--text);
}

.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
}

.header {
  text-align: center;
  margin-bottom: 2rem;
}

.header h1 {
  margin: 0 0 0.5rem;
  font-size: 2.5rem;
  font-weight: 700;
}

.subtitle {
  margin: 0;
  color: var(--muted);
}

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  padding: 2rem;
  border-radius: 24px;
  background: color-mix(in srgb, var(--surface) 88%, white 12%);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

.hero-gif {
  display: block;
  width: min(100%, 512px);
  height: auto;
  border-radius: 16px;
  object-fit: contain;
}

.controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
}

.record-timer {
  width: min(100%, 420px);
  padding: 1rem 1.1rem 0.85rem;
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.record-timer-countdown {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.45rem;
  margin-bottom: 0.85rem;
}

.record-timer-value {
  font-size: 3rem;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #fff 0%, #ffb3bc 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  transition: transform 0.15s ease;
}

.record-timer-value.is-tick {
  animation: timer-tick 0.35s ease;
}

.record-timer-label {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.record-timer-bar {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.record-timer-track {
  position: relative;
  height: 52px;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.record-timer-wave {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 3;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.record-timer.is-active .record-timer-wave {
  opacity: 1;
}

.record-timer-markers {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.record-timer-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.14);
}

.record-timer-marker:first-child,
.record-timer-marker:last-child {
  background: rgba(255, 255, 255, 0.28);
}

.record-timer-marker-label {
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.62rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.45);
  font-variant-numeric: tabular-nums;
}

.record-timer-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  z-index: 2;
  background: linear-gradient(
    90deg,
    rgba(255, 71, 87, 0.35) 0%,
    rgba(255, 107, 129, 0.55) 100%
  );
  transition: width 0.05s linear;
}

.record-timer-head {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0%;
  width: 3px;
  transform: translateX(-50%);
  z-index: 4;
  background: #fff;
  box-shadow:
    0 0 8px rgba(255, 107, 129, 0.9),
    0 0 18px rgba(255, 71, 87, 0.65);
  transition: left 0.05s linear;
}

.record-timer.is-active .record-timer-fill {
  background: linear-gradient(
    90deg,
    rgba(255, 71, 87, 0.55) 0%,
    rgba(255, 193, 7, 0.65) 70%,
    rgba(46, 213, 115, 0.75) 100%
  );
}

.record-timer-scale {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  padding: 0 0.1rem;
}

.record-btn {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 1rem 2rem;
  font-size: 1.125rem;
  font-weight: 600;
  color: white;
  background: var(--accent);
  cursor: pointer;
  user-select: none;
  touch-action: none;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.record-btn:hover {
  background: var(--accent-active);
  transform: translateY(-1px);
}

.record-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.record-btn.is-holding {
  transform: scale(0.97);
  box-shadow: inset 0 4px 16px rgba(0, 0, 0, 0.35);
}

.record-btn.is-recording {
  background: #c0392b;
  animation: pulse 1.2s infinite;
}

@keyframes timer-tick {
  0% {
    transform: scale(1);
  }

  40% {
    transform: scale(1.12);
  }

  100% {
    transform: scale(1);
  }
}

.status {
  margin: 0;
  min-height: 1.5rem;
  color: var(--muted);
  text-align: center;
}

.status.is-success {
  color: var(--success);
}

.status.is-error {
  color: var(--accent-active);
}

@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(255, 71, 87, 0.45);
  }

  50% {
    box-shadow: 0 0 0 14px rgba(255, 71, 87, 0);
  }
}

.recent {
  margin-top: 2.5rem;
}

.recent-header {
  margin-bottom: 1rem;
}

.recent-header h2 {
  margin: 0 0 0.35rem;
  font-size: 1.5rem;
}

.recent-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.recent-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.recent-empty {
  margin: 0;
  padding: 1.25rem;
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 88%, white 12%);
  color: var(--muted);
  text-align: center;
}

.recording-card {
  padding: 1.25rem;
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 88%, white 12%);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
}

.recording-card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.recording-meta {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.recording-time {
  margin: 0;
  font-weight: 600;
}

.recording-id {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  word-break: break-all;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.25rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(154, 165, 177, 0.18);
  color: var(--muted);
}

.status-badge.is-completed {
  background: rgba(46, 213, 115, 0.18);
  color: var(--success);
}

.status-badge.is-failed {
  background: rgba(255, 107, 129, 0.18);
  color: var(--accent-active);
}

.status-badge.is-processing {
  background: rgba(255, 193, 7, 0.18);
  color: #ffc107;
}

.recording-block {
  margin-top: 0.75rem;
}

.recording-block h3 {
  margin: 0 0 0.35rem;
  font-size: 0.85rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.recording-block pre,
.recording-block p {
  margin: 0;
}

.recording-block pre {
  padding: 0.85rem;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.25);
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.recording-error {
  color: var(--accent-active);
}
