:root {
  --bg: #f5f7fa; --surface: #ffffff; --line: #e4e8ef; --text: #1a1d24; --muted: #667085;
  --accent: #0519B0; --accent-soft: #eef0fd; --good: #047857; --good-soft: #ecfdf5; --bad: #BE123C; --bad-soft: #fff1f3;
  --radius: 10px; --shadow: 0 1px 2px rgba(16,24,40,.06);
  color-scheme: light;
}
[hidden] { display: none !important; }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 Inter, system-ui, sans-serif; -webkit-text-size-adjust: 100%; }
h1, h2, .brand { font-family: "Plus Jakarta Sans", Inter, sans-serif; }
h1 { font-size: 22px; margin: 8px 0 2px; }
h2 { font-size: 14px; font-weight: 700; margin: 0 0 10px; }
.mt { margin-top: 18px; }
.muted { color: var(--muted); }
.err { color: var(--bad); min-height: 20px; margin: 8px 0 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
a { color: var(--accent); }
button, select, input { font: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); text-decoration: none; cursor: pointer; font-weight: 500; }
.btn:hover { border-color: #c8cfdb; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #04148f; }
.btn.good { background: var(--good-soft); border-color: #a7f3d0; color: var(--good); }
.btn.bad { background: var(--bad-soft); border-color: #fecdd3; color: var(--bad); }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 320px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 28px 24px; text-align: center; box-shadow: var(--shadow); }
.login-card .btn { width: 100%; margin-top: 12px; }
.pin-wrap { position: relative; margin-top: 18px; }
.pin-wrap input { width: 100%; height: 44px; padding: 0 44px 0 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 16px; letter-spacing: 2px; }
.pin-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; background: none; border: none; cursor: pointer; font-size: 1.1rem; }

.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; }
.tabs { display: flex; gap: 2px; margin-left: 12px; }
.tabs button { min-height: 36px; padding: 0 12px; border: none; background: none; border-radius: 8px; color: var(--muted); cursor: pointer; font-weight: 500; }
.tabs button.on { background: var(--accent-soft); color: var(--accent); }
.tg { margin-left: auto; }
main { max-width: 1080px; margin: 0 auto; padding: 16px; padding-bottom: max(24px, env(safe-area-inset-bottom)); }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.stat b { display: block; font: 700 22px/1.2 "Plus Jakarta Sans", sans-serif; }
.stat span { color: var(--muted); font-size: 12px; }
.stat.hl b { color: var(--accent); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.phrase { font: 700 18px/1.3 "Plus Jakarta Sans", sans-serif; color: var(--accent); }
.kv { margin: 10px 0 0; }
.kv dt { font-size: 12px; color: var(--muted); margin-top: 10px; }
.kv dd { margin: 2px 0 0; }

.bar { display: grid; grid-template-columns: 110px 1fr 28px; align-items: center; gap: 8px; margin: 6px 0; font-size: 13px; }
.bar i { display: block; height: 8px; border-radius: 4px; background: var(--accent); opacity: .85; }
.bar em { font-style: normal; color: var(--muted); text-align: right; }
.empty { color: var(--muted); padding: 8px 0; }

.links a { display: flex; flex-direction: column; padding: 10px 0; border-top: 1px solid var(--line); text-decoration: none; color: var(--text); }
.links a:first-of-type { border-top: none; }
.links a span { color: var(--muted); font-size: 13px; }
.links a b { color: var(--accent); }

.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
select { height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.list { display: flex; flex-direction: column; gap: 8px; }
.item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; }
.item .orig { color: var(--bad); text-decoration: line-through; text-decoration-color: rgba(190,18,60,.4); }
.item .better { color: var(--good); font-weight: 500; }
.item .pro { color: var(--accent); }
.item .why, .item .meta { color: var(--muted); font-size: 13px; }
.tag { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); margin-right: 6px; }
.del { align-self: start; background: none; border: none; color: var(--muted); cursor: pointer; min-width: 32px; min-height: 32px; border-radius: 6px; }
.del:hover { background: var(--bad-soft); color: var(--bad); }

.review { text-align: center; padding: 24px 16px; margin-bottom: 12px; }
.review .q { font: 700 20px/1.3 "Plus Jakarta Sans", sans-serif; margin: 6px 0 14px; }
.review .ans { margin: 0 auto 16px; max-width: 520px; }
.review .row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

@media (max-width: 760px) {
  .top { flex-wrap: wrap; }
  .tabs { order: 3; width: 100%; margin: 0; }
  .tabs button { flex: 1; }
  .tg { min-height: 36px; padding: 0 10px; font-size: 13px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grid2 { grid-template-columns: 1fr; }
  .bar { grid-template-columns: 96px 1fr 24px; }
}
