:root {
  color-scheme: light;
  --bg: #f4f1e8;
  --surface: #fffdf7;
  --surface-strong: #ffffff;
  --ink: #1f2933;
  --muted: #62717d;
  --line: #d9d1c1;
  --teal: #1f8a83;
  --teal-dark: #12615c;
  --coral: #c94b3a;
  --amber: #c68b20;
  --shadow: 0 18px 55px rgba(41, 35, 24, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(244, 241, 232, 0.96)),
    url("data:image/svg+xml,%3Csvg width='88' height='88' viewBox='0 0 88 88' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%23d8c9a9' stroke-opacity='.35'%3E%3Cpath d='M0 44h88M44 0v88'/%3E%3C/g%3E%3C/svg%3E");
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
a {
  font: inherit;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.workspace {
  background: rgba(255, 253, 247, 0.88);
  border: 1px solid rgba(217, 209, 193, 0.9);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 28px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--teal-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.55rem, 2.7vw, 2.5rem);
  line-height: 1.15;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1rem;
}

.status-pill {
  flex: 0 0 auto;
  min-width: 94px;
  padding: 8px 12px;
  border: 1px solid rgba(31, 138, 131, 0.28);
  border-radius: 999px;
  background: rgba(31, 138, 131, 0.08);
  color: var(--teal-dark);
  font-size: 0.9rem;
  font-weight: 700;
  text-align: center;
}

.recording-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(360px, 0.98fr);
  gap: 0;
}

.panel {
  min-width: 0;
  padding: 28px;
}

.capture-panel {
  border-right: 1px solid var(--line);
}

.recorder-card {
  display: grid;
  gap: 18px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.recorder-label {
  margin-bottom: 4px;
  color: var(--teal-dark);
  font-size: 0.82rem;
  font-weight: 900;
}

.recorder-hint {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

.controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 18px;
}

.record-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 152px;
  min-height: 46px;
  padding: 0 18px;
  border: 0;
  border-radius: 8px;
  background: var(--teal);
  color: white;
  cursor: pointer;
  font-weight: 800;
}

.record-button:hover {
  background: var(--teal-dark);
}

.record-button.recording {
  background: var(--coral);
}

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

.record-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: currentColor;
}

.timer {
  min-width: 72px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  text-align: right;
}

.meter {
  height: 8px;
  margin-top: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2dacb;
}

.meter span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--amber));
  transition: width 100ms linear;
}

.output-panel {
  display: grid;
  gap: 18px;
  align-content: start;
  background: rgba(255, 255, 255, 0.52);
}

.result-block {
  min-width: 0;
}

.block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 700;
}

.ghost-button:disabled,
.disabled-link {
  color: var(--muted);
  pointer-events: none;
  opacity: 0.56;
}

.transcript {
  min-height: 154px;
  max-height: 260px;
  margin-bottom: 0;
  padding: 14px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--ink);
  line-height: 1.7;
  white-space: pre-wrap;
}

.transcript.empty {
  color: var(--muted);
}

.image-stage {
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px dashed #c8bda9;
  border-radius: 8px;
  background: #f8f3e8;
  color: var(--muted);
  text-align: center;
}

.image-stage img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.share-note {
  margin-bottom: 10px;
  color: var(--muted);
  line-height: 1.55;
}

.share-link {
  color: var(--teal-dark);
  font-weight: 800;
}

.share-shell {
  width: min(760px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0;
}

.share-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.share-image-button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: #f8f3e8;
  cursor: pointer;
}

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

.share-empty {
  display: grid;
  min-height: 280px;
  place-items: center;
  color: var(--muted);
}

.share-audio,
.share-transcript {
  padding: 18px;
  border-top: 1px solid var(--line);
}

.share-audio audio {
  width: 100%;
}

.share-transcript h1 {
  margin-bottom: 8px;
  font-size: 1.1rem;
}

.share-transcript p {
  margin-bottom: 0;
  line-height: 1.7;
  white-space: pre-wrap;
}

.timeline {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.step {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 16px 28px;
  color: var(--muted);
  border-right: 1px solid var(--line);
}

.step:last-child {
  border-right: 0;
}

.step span {
  display: inline-grid;
  place-items: center;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #e8e0d1;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 900;
}

.step p {
  margin-bottom: 0;
  overflow-wrap: anywhere;
  font-size: 0.92rem;
  font-weight: 800;
}

.step.active,
.step.done {
  color: var(--teal-dark);
}

.step.active span,
.step.done span {
  background: var(--teal);
  color: white;
}

@media (max-width: 860px) {
  .app-shell {
    width: min(100% - 20px, 720px);
    padding: 10px 0;
  }

  .topbar,
  .controls {
    align-items: flex-start;
    flex-direction: column;
  }

  .recording-grid,
  .timeline {
    grid-template-columns: 1fr;
  }

  .capture-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .panel,
  .topbar,
  .step {
    padding: 18px;
  }

  .timer {
    text-align: left;
  }

  .step {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .step:last-child {
    border-bottom: 0;
  }
}
