:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --text: #111827;
  --muted: #667085;
  --line: #e4e7ec;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --blue-soft: #eff6ff;
  --danger: #b42318;
  --good: #067647;
  --shadow: 0 10px 30px rgba(16, 24, 40, .06);
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
button, select, textarea, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
#app { min-height: 100dvh; padding-bottom: calc(90px + env(safe-area-inset-bottom)); }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; justify-content: space-between; align-items: center;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  background: rgba(244,247,251,.94); backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(228,231,236,.9);
}
.brand-row { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center;
  color: #fff; background: linear-gradient(145deg, #2563eb, #4f46e5);
  font-size: 24px; font-weight: 900; box-shadow: 0 7px 18px rgba(37,99,235,.25);
}
h1 { font-size: 20px; margin: 0; letter-spacing: -.3px; }
h2 { margin: 0 0 8px; font-size: 21px; }
h3 { margin: 16px 0 8px; }
.subtitle { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
main { width: min(760px, 100%); margin: 0 auto; padding: 14px 14px 28px; }
.view { display: none; }
.view.active { display: block; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  padding: 16px; box-shadow: var(--shadow);
}
.notice {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px; margin-bottom: 12px;
  background: #fff; border: 1px solid var(--line); border-radius: 14px; font-size: 13px; color: var(--muted);
}
.dot { width: 9px; height: 9px; border-radius: 50%; background: #98a2b3; }
.dot.online { background: #12b76a; }
.dot.offline { background: #f04438; }
label { display: block; font-size: 13px; font-weight: 750; margin-bottom: 6px; color: #344054; }
select, textarea, input[type="email"] {
  width: 100%; border: 1px solid #d0d5dd; border-radius: 13px; background: #fff; color: var(--text);
  padding: 12px 13px; outline: none; transition: border-color .15s, box-shadow .15s;
}
select:focus, textarea:focus, input[type="email"]:focus { border-color: #84adff; box-shadow: 0 0 0 4px rgba(37,99,235,.10); }
textarea { resize: vertical; line-height: 1.5; min-height: 110px; }
.mt { margin-top: 14px; }
.text-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; padding: 7px 2px 12px; }
.primary, .secondary, .ghost {
  border: 0; border-radius: 13px; min-height: 46px; padding: 11px 15px; font-weight: 800; cursor: pointer;
}
.primary { width: 100%; color: #fff; background: var(--blue); }
.primary:active { background: var(--blue-dark); }
.primary:disabled { opacity: .55; cursor: default; }
.secondary { width: 100%; background: #eef2f6; color: #344054; margin-top: 10px; }
.ghost { background: #fff; border: 1px solid var(--line); color: #344054; }
.small { min-height: 34px; padding: 6px 10px; font-size: 12px; }
.hidden { display: none !important; }
.link-btn { border: 0; background: transparent; padding: 0; color: var(--blue); font-weight: 700; }
.status { margin-top: 10px; min-height: 20px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.status.error { color: var(--danger); }
.status.good { color: var(--good); }
.results { display: grid; gap: 11px; margin-top: 12px; }
.result-card {
  background: #fff; border: 1px solid var(--line); border-radius: 17px; padding: 14px 14px 15px;
  box-shadow: 0 5px 18px rgba(16,24,40,.04);
}
.result-head { display: flex; align-items: center; gap: 8px; }
.result-title { flex: 1; font-weight: 850; font-size: 17px; }
.icon-btn {
  width: 37px; height: 37px; border: 1px solid var(--line); background: #fff; border-radius: 11px; cursor: pointer;
}
.result-text { margin-top: 10px; white-space: pre-wrap; font-size: 18px; line-height: 1.55; word-break: break-word; }
.result-placeholder { color: #98a2b3; }
.result-error { color: var(--danger); font-size: 14px; line-height: 1.45; }
.loading-line { height: 3px; background: linear-gradient(90deg, transparent, #60a5fa, transparent); background-size: 200% 100%; animation: slide 1.2s linear infinite; margin-top: 10px; border-radius: 999px; }
@keyframes slide { to { background-position: -200% 0; } }
.button-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.button-row .secondary { margin: 0; }
.muted { color: var(--muted); line-height: 1.5; margin: 5px 0 14px; }
.fineprint { color: var(--muted); line-height: 1.45; font-size: 12px; }
.phrase-list { display: grid; gap: 8px; }
.phrase-btn { text-align: left; border: 1px solid var(--line); border-radius: 13px; background: #fff; padding: 12px; line-height: 1.35; cursor: pointer; }
.phrase-btn:active { background: var(--blue-soft); }
.section-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.history-list { display: grid; gap: 10px; margin-top: 12px; }
.history-item { border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.history-source { font-weight: 800; line-height: 1.4; }
.history-date { color: var(--muted); font-size: 11px; margin: 4px 0 8px; }
.history-mini { color: #475467; font-size: 13px; line-height: 1.45; }
.history-actions { display: flex; gap: 8px; margin-top: 9px; }
.history-actions button { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 7px 9px; }
.toggle-row { display: flex; align-items: center; gap: 10px; margin: 16px 0; font-weight: 650; }
.toggle-row input { width: 20px; height: 20px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
.bottom-nav {
  position: fixed; z-index: 30; left: 0; right: 0; bottom: 0;
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 2px;
  background: rgba(255,255,255,.96); backdrop-filter: blur(18px);
  border-top: 1px solid var(--line); padding: 7px 4px calc(7px + env(safe-area-inset-bottom));
}
.nav-btn { border: 0; background: transparent; color: #667085; padding: 5px 2px; border-radius: 12px; display: grid; gap: 2px; place-items: center; cursor: pointer; }
.nav-btn span { font-size: 19px; }
.nav-btn small { font-size: 9.5px; }
.nav-btn.active { color: var(--blue); background: var(--blue-soft); }
@media (min-width: 720px) {
  main { padding-top: 20px; }
  .results { grid-template-columns: 1fr 1fr; }
  .bottom-nav { left: 50%; transform: translateX(-50%); width: min(760px, 100%); border-left: 1px solid var(--line); border-right: 1px solid var(--line); border-radius: 18px 18px 0 0; }
}
