:root {
  color-scheme: light;
  --ink: #26332f;
  --muted: #77817b;
  --paper: #f7f6f2;
  --surface: #fffefa;
  --line: #e5e5dc;
  --green: #4d695b;
  --green-dark: #3b5548;
  --green-pale: #e8eee8;
  --shadow: 0 8px 28px rgba(48, 58, 48, .045);
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.journal-app {
  width: min(100%, 780px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(34px, env(safe-area-inset-top)) 22px max(24px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}

.app-header { margin-bottom: 28px; }
.eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
}
h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.75rem, 7vw, 2.2rem);
  font-weight: 400;
  letter-spacing: -.035em;
}

.recording-section { margin-bottom: 30px; }
.record-button {
  display: inline-grid;
  width: 72px;
  height: 72px;
  place-items: center;
  border: 8px solid #e8eee8;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 3px 8px rgba(48, 68, 54, .12);
  cursor: not-allowed;
}
.record-button svg { width: 27px; height: 27px; fill: #fff; }
.recording-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
  color: var(--muted);
  font-size: .84rem;
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #aab2a8; }
.status-divider { color: #b4bab4; }
#elapsed-time { font-variant-numeric: tabular-nums; }

.text-panels { display: grid; gap: 20px; }
.text-panel { min-width: 0; }
.panel-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 2px 9px; }
.panel-title { color: var(--ink); font-size: .95rem; font-weight: 650; }
.panel-hint { color: var(--muted); font-size: .76rem; }
.text-box {
  position: relative;
  min-height: 188px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.text-box:focus-within { border-color: #a8b9aa; box-shadow: 0 0 0 3px rgba(77, 105, 91, .1); }
.text-box textarea {
  display: block;
  width: 100%;
  min-height: 188px;
  resize: vertical;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 17px 17px 60px;
  color: var(--ink);
  font: 400 .98rem/1.65 Georgia, "Times New Roman", serif;
}
.text-box textarea::placeholder { color: #a2aaa3; }
.copy-button {
  position: absolute;
  right: 11px;
  bottom: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 35px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fffefa;
  color: #536359;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
}
.copy-button:hover { background: var(--green-pale); }
.copy-button:focus-visible, .action-button:focus-visible, .record-button:focus-visible { outline: 3px solid #91a997; outline-offset: 3px; }
.copy-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

.action-bar {
  display: grid;
  grid-template-columns: 1fr 1fr 1.35fr;
  gap: 9px;
  margin-top: auto;
  padding-top: 24px;
}
.action-button {
  min-height: 48px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: .84rem;
  font-weight: 650;
  white-space: nowrap;
}
.secondary-action { border-color: var(--line); background: transparent; color: #526057; }
.clear-action { border-color: var(--line); background: #fffefa; color: #526057; }
.primary-action { background: var(--green); color: white; }
.action-button[aria-disabled="true"] { cursor: not-allowed; opacity: .72; }
.clear-action:hover { background: var(--green-pale); }
.copy-feedback { min-height: 1.2em; margin: 7px 0 0; color: var(--green-dark); text-align: center; font-size: .8rem; }

@media (min-width: 700px) {
  .journal-app { padding: 48px 36px 32px; }
  .app-header { margin-bottom: 32px; }
  .recording-section { margin-bottom: 34px; }
  .text-panels { grid-template-columns: 1fr 1fr; gap: 18px; }
  .text-box, .text-box textarea { min-height: 300px; }
  .action-bar { width: min(100%, 560px); margin-left: auto; margin-right: auto; padding-top: 28px; }
  .action-button { min-height: 50px; font-size: .9rem; }
}

@media (max-width: 380px) {
  .journal-app { padding-left: 16px; padding-right: 16px; }
  .action-bar { gap: 6px; }
  .action-button { padding-left: 6px; padding-right: 6px; font-size: .76rem; }
}
