[hidden] { display: none !important; }
:root {
  --ink: #1a1a1a;
  --muted: #5c5c5c;
  --line: #d8d4cc;
  --bg: #f7f5f0;
  --card: #ffffff;
  --primary: #1a1a1a;
  --sure: #5c5c5c;
  --low: #b45309;
  --notsure: #b91c1c;
  --danger: #b91c1c;
  --radius: 10px;
  --tap: 48px;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); }
/* 100vh first for older browsers; dvh when supported */
body { min-height: 100vh; min-height: 100dvh; }
button, textarea, input {
  font: inherit;
  -webkit-appearance: none;
  appearance: none;
  border-radius: var(--radius);
}
button { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
textarea {
  font-size: 16px; /* avoid iOS focus zoom */
}

.app {
  max-width: 420px;
  margin: 0 auto;
  padding: 16px 16px 40px;
}

.top { margin-bottom: 20px; }
.brand {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.tag {
  margin: 6px 0 16px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.lists {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.list-tab {
  min-height: var(--tap);
  border: 1.5px solid var(--line);
  background: var(--card);
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}
.list-tab.is-on {
  border-color: var(--ink);
  color: var(--ink);
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--ink);
}

.label, .section-title {
  display: block;
  font-size: 0.95rem;
  font-weight: 650;
  margin: 0 0 8px;
}
textarea {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  font: inherit;
  font-size: 1rem;
  line-height: 1.4;
  resize: vertical;
  min-height: 160px;
  background: var(--card);
  color: var(--ink);
}
.hint {
  margin: 8px 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}
.coach {
  margin: 10px 0 0;
  font-size: 0.9rem;
  color: var(--ink);
  background: #f0ebe3;
  border-radius: 8px;
  padding: 10px 12px;
}
.error {
  margin: 0 0 12px;
  padding: 12px;
  border-radius: var(--radius);
  background: #fef2f2;
  color: var(--danger);
  font-weight: 650;
  border: 1px solid #fecaca;
}
.busy {
  margin: 0 0 12px;
  font-weight: 600;
  color: var(--muted);
}

.row { margin-top: 14px; }
.row.pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.btn {
  min-height: var(--tap);
  width: 100%;
  border: none;
  border-radius: var(--radius);
  font: inherit;
  font-size: 1rem;
  font-weight: 650;
  cursor: pointer;
  padding: 0 14px;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.primary { background: var(--primary); color: #fff; }
.btn.ghost {
  background: var(--card);
  color: var(--ink);
  border: 1.5px solid var(--line);
}
.btn.danger-link {
  margin-top: 12px;
  background: transparent;
  color: var(--danger);
  font-weight: 600;
  min-height: 40px;
}

.cards { display: flex; flex-direction: column; gap: 10px; }
.card {
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  text-align: left;
}
.card-title {
  margin: 0 0 4px;
  font-size: 1.05rem;
  font-weight: 650;
}
.card-blurb {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  line-clamp: 3;
  overflow: hidden;
}
.card-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
}
.card-actions .btn { width: auto; min-height: 40px; padding: 0 12px; font-size: 0.9rem; }

.band {
  display: inline-block;
  margin: 0 0 8px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.band-sure {
  background: #ececec;
  color: var(--sure);
  font-weight: 600;
}
.band-low {
  background: #ffedd5;
  color: var(--low);
  font-size: 0.9rem;
  font-weight: 800;
  box-shadow: 0 0 0 1px #fdba74;
}
.band-notsure {
  background: #fee2e2;
  color: var(--notsure);
  font-size: 0.95rem;
  font-weight: 800;
  box-shadow: 0 0 0 1.5px #f87171;
}

.judgment-line {
  margin: 4px 0 0;
  font-size: 0.95rem;
  font-weight: 600;
}
.judgment-sub {
  margin: 2px 0 0;
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 500;
}
.urls { margin: 8px 0 0; padding: 0; list-style: none; }
.urls a { color: var(--ink); font-size: 0.85rem; word-break: break-all; }

.detail {
  margin-top: 12px;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  overflow: hidden;
  min-width: 0;
  max-width: 100%;
}
.detail a,
.detail-link {
  display: block;
  margin-top: 12px;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
  color: var(--ink);
  font-size: 0.85rem;
  line-height: 1.35;
}
.detail pre {
  white-space: pre-wrap;
  font: inherit;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
}

#source-line { margin: 0 0 4px; }
#btn-manual { color: var(--muted); font-weight: 500; }

.field {
  width: 100%;
  min-height: var(--tap);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  font: inherit;
  font-size: 16px;
  background: var(--card);
  color: var(--ink);
}
.rank-badge {
  display: inline-block;
  margin: 0 0 8px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 800;
  background: #1a1a1a;
  color: #fff;
  letter-spacing: 0.02em;
}
.list-lead, #list-lead { margin: 0 0 12px; }

.tag strong { font-weight: 700; color: var(--ink); }

.field-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
  width: 100%;
}
.field-row .field {
  flex: 1 1 auto;
  min-width: 0;
}
.btn-mic {
  flex: 0 0 auto;
  width: var(--tap);
  min-width: var(--tap);
  min-height: var(--tap);
  padding: 0;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-mic:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.btn-mic.is-listening {
  border-color: var(--ink);
  background: #1a1a1a;
  color: #fff;
  box-shadow: inset 0 0 0 1px #1a1a1a;
}
.btn-mic .mic-icon { display: block; }

.clear-row {
  margin-top: 8px;
}
.clear-row .btn.ghost {
  font-weight: 600;
  color: var(--muted);
  border-color: var(--line);
}
