@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@600;700;800&display=swap");

:root {
  color-scheme: light;
  --page: #f4f2ee;
  --surface: #fffefa;
  --ink: #171715;
  --muted: #6c6a64;
  --line: #dfddd6;
  --stage: #1b1d1c;
  --stage-soft: #272a28;
  --accent: #ea5b45;
  --accent-dark: #cf4432;
  --lime: #c7f36b;
  --green: #238a57;
  --shadow: 0 24px 80px rgba(37, 34, 25, 0.1);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  font-family: "DM Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--page);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 82% 5%, rgba(199, 243, 107, 0.2), transparent 25rem),
    radial-gradient(circle at 12% 34%, rgba(234, 91, 69, 0.06), transparent 22rem),
    var(--page);
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
audio:focus-visible,
video:focus-visible {
  outline: 3px solid rgba(70, 114, 255, 0.45);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

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

.page-shell {
  width: min(100% - 40px, 1120px);
  min-height: 100vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.site-header {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid rgba(23, 23, 21, 0.09);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-family: "Manrope", sans-serif;
  font-size: 1.12rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  text-decoration: none;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--ink);
  color: var(--lime);
}

.brand-mark svg {
  width: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.drive-connection,
.connection-label,
.button,
.mode-tab,
.control-button,
.record-button {
  display: inline-flex;
  align-items: center;
}

.drive-connection {
  gap: 16px;
}

.connection-label {
  gap: 8px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 600;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #aaa79f;
  box-shadow: 0 0 0 4px rgba(170, 167, 159, 0.14);
}

.connection-label.is-connected {
  color: var(--green);
}

.connection-label.is-connected .status-dot {
  background: #3ab879;
  box-shadow: 0 0 0 4px rgba(58, 184, 121, 0.14);
}

.button {
  min-height: 48px;
  justify-content: center;
  gap: 9px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 13px;
  cursor: pointer;
  font-weight: 700;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:active:not(:disabled) {
  transform: translateY(0);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.button-small {
  min-height: 40px;
  padding: 0 14px;
  font-size: 0.84rem;
  border-radius: 11px;
}

.button-small svg {
  width: 18px;
  height: 18px;
  stroke: none;
}

.button-secondary {
  background: rgba(255, 255, 255, 0.74);
  border-color: var(--line);
}

.button-secondary:hover:not(:disabled) {
  border-color: #c4c1b9;
  background: #fff;
}

.button-primary {
  color: white;
  background: var(--ink);
  box-shadow: 0 10px 24px rgba(23, 23, 21, 0.17);
}

.button-primary:hover:not(:disabled) {
  background: #30302d;
  box-shadow: 0 13px 28px rgba(23, 23, 21, 0.2);
}

main {
  flex: 1;
}

.hero {
  max-width: 670px;
  margin: 64px auto 34px;
  text-align: center;
}

.eyebrow,
.section-kicker {
  margin: 0 0 12px;
  color: var(--accent-dark);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  font-family: "Manrope", sans-serif;
  font-size: clamp(2.65rem, 7vw, 5.25rem);
  line-height: 0.98;
  letter-spacing: -0.065em;
}

.hero-copy {
  max-width: 560px;
  margin: 20px auto 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.12rem);
  line-height: 1.6;
}

.recorder-card {
  max-width: 780px;
  margin: 0 auto;
  padding: 10px;
  border: 1px solid rgba(23, 23, 21, 0.08);
  border-radius: calc(var(--radius-xl) + 10px);
  background: rgba(255, 254, 250, 0.8);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.mode-tabs {
  width: fit-content;
  margin: 2px auto 12px;
  display: flex;
  gap: 4px;
  padding: 5px;
  border-radius: 15px;
  background: #eae8e2;
}

.mode-tab {
  min-width: 126px;
  min-height: 44px;
  justify-content: center;
  gap: 9px;
  padding: 0 20px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: #74716a;
  cursor: pointer;
  font-weight: 700;
  transition: color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.mode-tab svg {
  width: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mode-tab.is-active {
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 4px 15px rgba(35, 33, 28, 0.08);
}

.mode-tab:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.recorder-stage {
  position: relative;
  min-height: 480px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 26px 30px 30px;
  border-radius: var(--radius-xl);
  color: white;
  background:
    radial-gradient(circle at 50% 46%, rgba(199, 243, 107, 0.08), transparent 38%),
    var(--stage);
}

.recorder-stage[data-mode="video"] {
  background: #101211;
}

.stage-topline {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.recording-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.7);
  background: rgba(0, 0, 0, 0.2);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  backdrop-filter: blur(12px);
}

.recording-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #8b8e8a;
}

[data-state="recording"] .recording-badge {
  color: white;
  border-color: rgba(234, 91, 69, 0.35);
  background: rgba(179, 44, 31, 0.35);
}

[data-state="recording"] .recording-dot {
  background: #ff6d5a;
  box-shadow: 0 0 0 4px rgba(255, 109, 90, 0.18);
  animation: blink 1.4s ease-in-out infinite;
}

[data-state="paused"] .recording-dot {
  border-radius: 1px;
  background: #f5c35c;
}

.timer {
  color: rgba(255, 255, 255, 0.86);
  font-family: "Manrope", sans-serif;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.audio-visual {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 280px;
  padding-top: 18px;
}

.audio-orb {
  position: relative;
  width: 112px;
  height: 112px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(199, 243, 107, 0.15);
  border-radius: 50%;
  background: rgba(199, 243, 107, 0.05);
  box-shadow: 0 0 0 22px rgba(199, 243, 107, 0.025), 0 0 70px rgba(199, 243, 107, 0.06);
  transition: transform 100ms linear, box-shadow 100ms linear;
}

.audio-orb-core {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--stage);
  background: var(--lime);
  box-shadow: 0 12px 34px rgba(199, 243, 107, 0.2);
}

.audio-orb-core svg {
  width: 27px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

#waveformCanvas {
  width: min(100%, 560px);
  height: 88px;
  margin-top: 12px;
}

.stage-prompt {
  margin: 2px 0 0;
  color: rgba(255, 255, 255, 0.52);
  font-size: 0.84rem;
}

.video-visual {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #111312;
}

.video-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.42), transparent 25%, transparent 68%, rgba(0, 0, 0, 0.58));
}

#liveVideo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

.video-placeholder {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: rgba(255, 255, 255, 0.53);
  background:
    radial-gradient(circle at 50% 44%, rgba(199, 243, 107, 0.07), transparent 28%),
    #191b1a;
}

.video-placeholder p {
  margin: 0;
  font-size: 0.86rem;
}

.camera-icon {
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
}

.camera-icon svg {
  width: 28px;
  fill: none;
  stroke: var(--lime);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mic-meter {
  position: absolute;
  right: 24px;
  bottom: 116px;
  z-index: 4;
  width: 150px;
  height: 34px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(10px);
}

.mic-meter svg {
  width: 16px;
  fill: none;
  stroke: rgba(255, 255, 255, 0.78);
  stroke-width: 1.8;
  stroke-linecap: round;
}

.mic-meter-track {
  flex: 1;
  height: 4px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.2);
}

#micMeterLevel {
  display: block;
  width: 3%;
  height: 100%;
  border-radius: inherit;
  background: var(--lime);
  transition: width 80ms linear;
}

.recorder-controls {
  position: relative;
  z-index: 5;
  display: grid;
  grid-template-columns: 1fr 1.4fr 1fr;
  align-items: center;
  gap: 20px;
  margin-top: 16px;
}

.control-button,
.record-button {
  justify-content: center;
  border: 0;
  color: white;
  cursor: pointer;
  font-weight: 700;
}

.control-button {
  gap: 8px;
  min-height: 48px;
  padding: 0 15px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.07);
  transition: background 160ms ease, opacity 160ms ease;
}

.control-button:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
}

.control-button:disabled {
  cursor: not-allowed;
  opacity: 0.32;
}

.control-icon {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
}

.control-icon svg {
  width: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.resume-icon {
  display: none;
}

.is-paused .pause-icon {
  display: none;
}

.is-paused .resume-icon {
  display: block;
}

.record-button {
  min-width: 180px;
  flex-direction: column;
  gap: 8px;
  background: transparent;
}

.record-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.record-button-ring {
  width: 66px;
  height: 66px;
  display: grid;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.82);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  transition: transform 180ms ease, border-color 180ms ease;
}

.record-button:hover:not(:disabled) .record-button-ring {
  transform: scale(1.04);
  border-color: white;
}

.record-button-core {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(234, 91, 69, 0.3);
  transition: width 180ms ease, height 180ms ease, border-radius 180ms ease;
}

[data-state="recording"] .record-button-core,
[data-state="paused"] .record-button-core {
  width: 24px;
  height: 24px;
  border-radius: 6px;
}

[data-state="recording"] .audio-orb {
  animation: orb-breathe 2.2s ease-in-out infinite;
}

.review-panel {
  padding: 30px 28px 24px;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.section-kicker {
  margin-bottom: 7px;
  font-size: 0.65rem;
}

.section-heading h3 {
  margin: 0;
  font-family: "Manrope", sans-serif;
  font-size: 1.45rem;
  letter-spacing: -0.035em;
}

.duration-chip {
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--muted);
  background: #efede7;
  font-size: 0.78rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.media-preview {
  margin-bottom: 22px;
}

.media-preview audio {
  width: 100%;
  height: 48px;
}

.media-preview video {
  width: 100%;
  max-height: 390px;
  display: block;
  border-radius: 16px;
  background: #111;
}

.field-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.76rem;
  font-weight: 800;
}

.filename-field {
  min-height: 52px;
  display: flex;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.filename-field:focus-within {
  border-color: #8f8c84;
  box-shadow: 0 0 0 4px rgba(23, 23, 21, 0.05);
}

.filename-field input {
  min-width: 0;
  flex: 1;
  padding: 0 0 0 16px;
  border: 0;
  outline: 0;
  background: transparent;
  font-weight: 600;
}

.file-extension {
  align-self: stretch;
  display: flex;
  align-items: center;
  padding: 0 16px;
  color: var(--muted);
  border-left: 1px solid var(--line);
  background: #f4f2ed;
  font-size: 0.86rem;
  font-weight: 700;
}

.upload-status {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 12px;
  background: #eeece6;
}

.upload-copy {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 0.78rem;
}

.upload-copy strong {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.progress-track {
  height: 6px;
  overflow: hidden;
  border-radius: 99px;
  background: #d9d6ce;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
  transition: width 120ms linear;
}

.success-message {
  min-height: 50px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  padding: 10px 14px;
  border: 1px solid rgba(35, 138, 87, 0.18);
  border-radius: 12px;
  color: #17683f;
  background: rgba(62, 176, 111, 0.08);
  font-size: 0.84rem;
  font-weight: 700;
}

.success-icon {
  width: 27px;
  height: 27px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--green);
}

.success-icon svg {
  width: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.success-message a {
  margin-left: auto;
  color: inherit;
  white-space: nowrap;
}

.review-actions {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 12px;
  margin-top: 22px;
}

.review-actions .button {
  min-height: 54px;
}

.privacy-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 22px auto 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.privacy-note svg {
  width: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

footer {
  min-height: 108px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 64px;
  color: #8e8b84;
  border-top: 1px solid rgba(23, 23, 21, 0.09);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 100;
  max-width: min(430px, calc(100% - 32px));
  min-height: 54px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 12px 11px 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  color: white;
  background: #292b29;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.24);
  font-size: 0.84rem;
  font-weight: 600;
  animation: toast-in 200ms ease-out;
}

.toast-icon {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--lime);
}

.toast.is-error .toast-icon {
  background: #ff715f;
}

.toast button {
  width: 32px;
  height: 32px;
  margin-left: auto;
  border: 0;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.65);
  background: transparent;
  cursor: pointer;
  font-size: 1.3rem;
}

.toast button:hover {
  color: white;
  background: rgba(255, 255, 255, 0.08);
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.42; }
}

@keyframes orb-breathe {
  0%, 100% { box-shadow: 0 0 0 22px rgba(199, 243, 107, 0.025), 0 0 70px rgba(199, 243, 107, 0.06); }
  50% { box-shadow: 0 0 0 28px rgba(199, 243, 107, 0.035), 0 0 90px rgba(199, 243, 107, 0.1); }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 24px, 1120px);
  }

  .site-header {
    min-height: 72px;
  }

  .connection-label {
    display: none;
  }

  .button-small span {
    display: none;
  }

  .button-small {
    width: 42px;
    padding: 0;
  }

  .hero {
    margin: 48px auto 28px;
  }

  .hero h1 {
    font-size: clamp(2.75rem, 14vw, 4rem);
  }

  .recorder-card {
    padding: 7px;
    border-radius: 28px;
  }

  .mode-tab {
    min-width: 112px;
    padding: 0 14px;
  }

  .recorder-stage {
    min-height: 455px;
    padding: 20px 18px 22px;
    border-radius: 22px;
  }

  .recorder-controls {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .record-button {
    grid-column: 1 / -1;
    grid-row: 1;
    min-width: 0;
    margin-bottom: 4px;
  }

  .control-button {
    grid-row: 2;
  }

  .mic-meter {
    right: 18px;
    bottom: 157px;
  }

  .review-panel {
    padding: 26px 15px 17px;
  }

  .review-actions {
    grid-template-columns: 1fr;
  }

  .review-actions .button-primary {
    grid-row: 1;
  }

  .success-message {
    flex-wrap: wrap;
  }

  footer {
    min-height: 88px;
    margin-top: 44px;
  }
}

@media (max-width: 420px) {
  .eyebrow {
    font-size: 0.66rem;
  }

  .hero-copy {
    max-width: 320px;
  }

  .mode-tabs {
    width: 100%;
  }

  .mode-tab {
    min-width: 0;
    flex: 1;
  }

  .stage-prompt {
    text-align: center;
  }

  .record-button-ring {
    width: 60px;
    height: 60px;
  }

  .record-button-core {
    width: 44px;
    height: 44px;
  }

  .privacy-note {
    padding: 0 12px;
    text-align: center;
  }
}

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