:root {
  --bg: #f3f0e8;
  --panel: #fffdf8;
  --text: #1f2420;
  --muted: #74786f;
  --line: #ddd7ca;
  --accent: #2f7d62;
  --accent-press: #286b54;
  --recording: #b7352f;
  --recording-press: #982c28;
  --danger: #b94a45;
  --shadow: 0 14px 40px rgba(39, 44, 38, 0.10);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body { -webkit-font-smoothing: antialiased; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }

.app { width: min(720px, 100%); margin: 0 auto; padding: 22px 16px calc(28px + env(safe-area-inset-bottom)); }
.hero { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 12px 2px 18px; }
.eyebrow { margin: 0 0 6px; color: var(--accent); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
h1 { margin: 0; font-size: clamp(34px, 11vw, 56px); line-height: .92; letter-spacing: -0.04em; }
h2 { margin: 0; font-size: 20px; letter-spacing: -0.02em; }
.sub { max-width: 330px; margin: 12px 0 0; color: var(--muted); line-height: 1.35; }
.muted { color: var(--muted); margin: 4px 0 0; font-size: 13px; }

.panel { background: var(--panel); border: 1px solid rgba(60, 54, 45, .08); border-radius: 22px; padding: 16px; box-shadow: var(--shadow); margin: 0 0 16px; }
.section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }

.field { display: grid; gap: 7px; margin-bottom: 13px; }
.field span { color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; }
textarea, input { width: 100%; border: 1px solid var(--line); border-radius: 16px; background: #fff; color: var(--text); padding: 13px 14px; outline: none; }
textarea { resize: vertical; min-height: 116px; line-height: 1.35; }
textarea:focus, input:focus { border-color: rgba(47, 125, 98, .65); box-shadow: 0 0 0 4px rgba(47, 125, 98, .12); }

.grid.two, .export-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.export-row { grid-template-columns: 1fr 1fr auto; margin-bottom: 14px; }

.primary, .secondary, .ghost { min-height: 46px; border: 0; border-radius: 999px; padding: 0 16px; font-weight: 800; }
.primary { background: var(--accent); color: #fff; }
.primary:active { background: var(--accent-press); }
.secondary { background: #e8efe8; color: var(--accent); }
.ghost { background: transparent; color: var(--accent); }
.danger { color: var(--danger); }
.save { width: 100%; margin-top: 4px; }
.hidden { display: none !important; }

#record-btn { position: relative; transition: background-color .18s ease, box-shadow .18s ease, transform .18s ease; }
#record-btn.is-recording { background: var(--recording); box-shadow: 0 0 0 5px rgba(183, 53, 47, .14), 0 14px 30px rgba(183, 53, 47, .28); }
#record-btn.is-recording:active { background: var(--recording-press); transform: scale(.99); }
#record-btn.is-recording::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 9px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 0 rgba(255, 255, 255, .7);
  animation: recording-pulse 1.2s ease-out infinite;
}

@keyframes recording-pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, .75); }
  70% { box-shadow: 0 0 0 10px rgba(255, 255, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

.photo-box { display: grid; place-items: center; min-height: 82px; border: 1px dashed #b9b0a2; border-radius: 18px; margin: 13px 0; background: #fbf8f1; color: var(--muted); font-weight: 800; text-align: center; }
.photo-box input { display: none; }
.photo-preview { display: grid; grid-template-columns: 92px 1fr; gap: 12px; align-items: center; margin: 12px 0; }
.photo-preview img, .entry-thumb { width: 92px; height: 92px; object-fit: cover; border-radius: 16px; background: #eee; }

.status { min-height: 20px; margin: 8px 0 10px; color: var(--muted); font-size: 13px; }
.status.error { color: var(--danger); }

.entries-list { display: grid; gap: 10px; }
.entry { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; border: 1px solid var(--line); border-radius: 18px; padding: 12px; background: #fff; }
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check span { display: block; width: 26px; height: 26px; border-radius: 9px; border: 2px solid #c8c0b4; }
.check input:checked + span { background: var(--accent); border-color: var(--accent); box-shadow: inset 0 0 0 5px #fff; }
.entry-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.entry-date { font-size: 14px; }
.entry-note { margin: 0; color: #343832; line-height: 1.32; white-space: pre-wrap; }

@media (max-width: 460px) {
  .app { padding-inline: 12px; }
  .grid.two { grid-template-columns: 1fr; }
  .export-row { grid-template-columns: 1fr 1fr; }
  #delete-btn { grid-column: 1 / -1; }
  .entry { grid-template-columns: auto 1fr; }
  .entry-thumb { grid-column: 2; width: 100%; height: 150px; }
}
