:root {
  --bg: #f5f7fb;
  --bg-grad-1: #f5f7fb;
  --bg-grad-2: #e8eef7;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #4b5563;
  --primary: #1d3557;
  --danger: #d62828;
  --border: #dbe2ef;
  --button-secondary-bg: #e5ebf5;
  --button-secondary-text: #1b2a41;
  --surface-soft: #f8fafc;
  --entry-bg: #fafcff;
}

body[data-theme="dark"] {
  --bg: #0f172a;
  --bg-grad-1: #0f172a;
  --bg-grad-2: #1e293b;
  --card: #111827;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --primary: #60a5fa;
  --danger: #ef4444;
  --border: #334155;
  --button-secondary-bg: #1f2937;
  --button-secondary-text: #e2e8f0;
  --surface-soft: #0b1220;
  --entry-bg: #0b1220;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, sans-serif;
  background: linear-gradient(145deg, var(--bg-grad-1), var(--bg-grad-2));
  color: var(--text);
}

.app-shell {
  max-width: 760px;
  margin: 0 auto;
  padding: 1rem;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

h1 {
  margin-bottom: 0.35rem;
}

.theme-toggle {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: #111111;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

body[data-theme="dark"] .theme-toggle {
  background: #111111;
  color: #ffffff;
  border-color: #ffffff;
}

.theme-toggle svg {
  width: 1.1rem;
  height: 1.1rem;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.subtitle {
  margin-top: 0;
  color: var(--muted);
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.record-btn,
button {
  appearance: none;
  border: none;
  border-radius: 10px;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  cursor: pointer;
}

.record-btn {
  background: var(--primary);
  color: #fff;
  width: 100%;
  font-size: 1.1rem;
  font-weight: 700;
}

.record-btn.recording {
  background: var(--danger);
}

.status {
  margin: 0.75rem 0;
  color: var(--muted);
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.actions button {
  background: var(--button-secondary-bg);
  color: var(--button-secondary-text);
}

.hint {
  margin-bottom: 0;
  margin-top: 0.75rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.live-text {
  margin: 0;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem;
  min-height: 90px;
  white-space: pre-wrap;
}

.entries {
  display: grid;
  gap: 0.75rem;
}

.entry {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem;
  background: var(--entry-bg);
}

.entry-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.entry-time {
  font-size: 0.9rem;
  color: var(--muted);
}

.entry-delete-btn {
  width: 2rem;
  height: 2rem;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: #111111;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

body[data-theme="dark"] .entry-delete-btn {
  background: #111111;
  color: #ffffff;
  border-color: #ffffff;
}

.entry-delete-btn svg {
  width: 1rem;
  height: 1rem;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.entry-text {
  margin: 0;
  white-space: pre-wrap;
}

@media (max-width: 600px) {
  .actions {
    grid-template-columns: 1fr;
  }
}
