:root {
  color-scheme: light;
  --ink: #24231f;
  --muted: #777268;
  --paper: #f7f5ef;
  --card: rgba(255, 255, 255, 0.92);
  --line: #e7e1d6;
  --accent: #df6b3b;
  --accent-dark: #b94c24;
  --green: #426a52;
  --danger: #b7453d;
  --shadow: 0 18px 50px rgba(74, 58, 39, 0.09);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 0%, rgba(223, 107, 59, 0.14), transparent 30rem),
    linear-gradient(180deg, #faf8f3 0%, var(--paper) 100%);
}

button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.page-shell {
  width: min(100%, 640px);
  margin: 0 auto;
  padding: max(28px, env(safe-area-inset-top)) 18px max(32px, env(safe-area-inset-bottom));
}

.hero { padding: 18px 4px 26px; }
.eyebrow, .step {
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.hero h1 { margin: 8px 0 8px; font-family: Georgia, "Songti SC", serif; font-size: clamp(38px, 12vw, 58px); line-height: 1; }
.hero p { margin: 0; max-width: 30em; color: var(--muted); line-height: 1.7; }

.card {
  margin-bottom: 14px;
  padding: 20px;
  border: 1px solid rgba(231, 225, 214, 0.9);
  border-radius: 22px;
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.section-heading h2 { margin: 4px 0 0; font-size: 21px; }
.badge { flex: none; padding: 6px 10px; border-radius: 999px; color: var(--green); background: #edf4ef; font-size: 12px; font-weight: 700; }
.badge-idle { color: var(--muted); background: #f0eee9; }
.badge-recording { color: #fff; background: var(--danger); }
.badge-ready { color: #fff; background: var(--green); }

.environment-grid, .file-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 18px; }
.environment-grid div, .file-grid div { min-width: 0; padding: 12px; border-radius: 14px; background: #f7f4ed; }
dt { margin-bottom: 5px; color: var(--muted); font-size: 12px; }
dd { margin: 0; overflow-wrap: anywhere; font-size: 14px; font-weight: 650; }

.button {
  width: 100%; min-height: 48px; padding: 12px 16px; border: 0; border-radius: 14px;
  font-weight: 750; cursor: pointer; transition: transform 0.15s, opacity 0.15s;
}
.button:active:not(:disabled) { transform: scale(0.98); }
.button:disabled { cursor: not-allowed; opacity: 0.42; }
.button-primary { color: #fff; background: var(--accent); }
.button-danger { color: #fff; background: var(--danger); }
.button-secondary { color: var(--ink); background: #eee8dc; }
.button-ghost { color: var(--ink); border: 1px solid var(--line); background: transparent; }

.timer-wrap { display: grid; justify-items: center; padding: 12px 0 22px; }
.timer { margin: 4px 0; font-variant-numeric: tabular-nums; font-size: 52px; letter-spacing: -0.04em; }
.timer-wrap span { color: var(--muted); font-size: 13px; }
.record-pulse { width: 10px; height: 10px; border-radius: 50%; background: #cbc6bd; }
.record-pulse.active { background: var(--danger); animation: pulse 1.25s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 9px rgba(183, 69, 61, 0.12); } }

.primary-actions, .secondary-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.notice, .hint { margin: 12px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.result-panel { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
audio { width: 100%; margin-bottom: 14px; }

.fallback-card p { color: var(--muted); font-size: 14px; line-height: 1.6; }
.file-picker { display: flex; align-items: center; justify-content: center; min-height: 48px; border: 1px dashed #c9bca8; border-radius: 14px; color: var(--accent-dark); font-weight: 750; cursor: pointer; }
.file-picker input { position: absolute; width: 1px; height: 1px; opacity: 0; }

details summary { cursor: pointer; font-weight: 750; }
.diagnostics-toolbar { display: flex; justify-content: space-between; gap: 12px; margin-top: 16px; color: var(--muted); font-size: 12px; }
.text-button { border: 0; padding: 0; color: var(--accent-dark); background: transparent; font-weight: 700; }
pre { max-height: 260px; overflow: auto; margin: 12px 0 0; padding: 14px; border-radius: 12px; color: #d8eadc; background: #232823; font: 11px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
footer { padding: 14px 0 0; color: var(--muted); text-align: center; font-size: 11px; }

@media (max-width: 380px) {
  .card { padding: 17px; border-radius: 18px; }
  .primary-actions, .secondary-actions { grid-template-columns: 1fr; }
  .timer { font-size: 46px; }
}
