:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #1a1f2e;
  --muted: #6b7385;
  --border: #dfe3ec;
  --accent: #2f6bff;
  --accent-text: #ffffff;
  --accent-soft: #e6eeff;
  --danger-bg: #fdecec;
  --danger-text: #a12626;
  --warn-bg: #fff6e0;
  --warn-text: #7a5300;
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10131b;
    --card: #191d28;
    --text: #e8ebf3;
    --muted: #9099ad;
    --border: #2b3142;
    --accent: #5b8cff;
    --accent-soft: #22305a;
    --danger-bg: #3a1c1f;
    --danger-text: #ff9c9c;
    --warn-bg: #3a2f14;
    --warn-text: #ffd27a;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1;
}
.brand { font-weight: 700; font-size: 1.1rem; }
.logo { color: var(--accent); }
.usage { font-size: .8rem; color: var(--muted); text-align: right; }

.wrap { max-width: 720px; margin: 0 auto; padding: 16px; }

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

label { display: block; font-weight: 600; font-size: .9rem; margin: 0 0 6px; }
label:not(:first-child) { margin-top: 16px; }

.top-right { display: flex; align-items: center; gap: 12px; }
.link { background: none; border: 0; padding: 0; font: inherit; font-size: .85rem; color: var(--accent); cursor: pointer; }

textarea, select, input[type=password] {
  width: 100%;
  font: inherit;
  color: inherit;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
}
textarea { resize: vertical; min-height: 140px; }
textarea:focus, select:focus, input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.meta { display: flex; justify-content: space-between; font-size: .8rem; color: var(--muted); margin-top: 6px; }
.meta .over { color: var(--danger-text); font-weight: 600; }
.hint { font-size: .8rem; color: var(--muted); margin: 8px 0 0; }
.muted { color: var(--muted); font-size: .9rem; margin: 0; }

.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  border: 1px solid var(--border);
  background: var(--bg);
  color: inherit;
  font: inherit;
  font-size: .85rem;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
}
.pill.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }

.btn {
  display: block;
  width: 100%;
  margin-top: 20px;
  padding: 14px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-text);
  font: inherit;
  font-weight: 700;
  font-size: 1rem;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.btn:disabled { opacity: .6; cursor: wait; }
.btn.secondary { background: var(--accent-soft); color: var(--accent); margin-top: 12px; }

audio { width: 100%; }

.alert { border-radius: 10px; padding: 12px 14px; margin-bottom: 16px; font-size: .9rem; background: var(--danger-bg); color: var(--danger-text); }
.alert.warn { background: var(--warn-bg); color: var(--warn-text); }

.history { list-style: none; margin: 0; padding: 0; }
.history li { padding: 12px 0; border-top: 1px solid var(--border); }
.history li:first-child { border-top: 0; padding-top: 0; }
.history .txt { margin: 0 0 4px; font-size: .9rem; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.history .info { font-size: .75rem; color: var(--muted); margin-bottom: 8px; }
.history .row { display: flex; gap: 8px; align-items: center; }
.history .row audio { flex: 1; min-width: 0; height: 36px; }
.history .row a { font-size: .85rem; color: var(--accent); white-space: nowrap; }

.tag { display: inline-block; font-size: .7rem; font-weight: 700; padding: 1px 6px; border-radius: 4px; background: var(--accent-soft); color: var(--accent); }
