/* Threads-трекер — премиальный минимализм */
:root {
  --bg: #faf9f7;
  --ink: #17150f;
  --muted: #6f6a5f;
  --line: #e5e1d8;
  --accent: #a6471f;
  --ok: #2f6b43;
  --bad: #9c2b2b;
  --serif: Georgia, 'Times New Roman', serif;
  --sans: -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--sans); line-height: 1.55; }
.wrap { max-width: 960px; margin: 0 auto; padding: 0 24px; }

/* Шапка */
.top { border-bottom: 1px solid var(--line); }
.top-in { display: flex; align-items: baseline; justify-content: space-between; padding: 22px 24px; }
.brand { font-family: var(--serif); font-size: 20px; letter-spacing: .02em; color: var(--ink); text-decoration: none; }
.top-nav { display: flex; gap: 18px; align-items: baseline; font-size: 14px; }
.top-nav a { color: var(--ink); text-decoration: none; }
.top-nav a:hover { color: var(--accent); }
.name { color: var(--muted); }

/* Герой */
.hero { padding: 88px 0 56px; max-width: 720px; }
.eyebrow { text-transform: uppercase; letter-spacing: .22em; font-size: 12px; color: var(--accent); margin-bottom: 18px; }
h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(40px, 7vw, 64px); line-height: 1.06; letter-spacing: -.01em; margin-bottom: 24px; }
.lead { font-size: 18px; color: var(--muted); max-width: 560px; margin-bottom: 32px; }
.cta-row { display: flex; gap: 14px; flex-wrap: wrap; flex-direction: column; align-items: flex-start; }
.tg-login-wrap { min-height: 56px; }
.tg-login-wrap iframe { border-radius: 12px; }
.old-login { margin-top: 20px; }
.old-login summary { cursor: pointer; color: var(--muted); font-size: 14px; }
.old-login form { margin-top: 14px; display: flex; flex-direction: column; gap: 12px; max-width: 320px; }

/* Кнопки */
.btn { display: inline-block; background: var(--ink); color: #fff; border: 1px solid var(--ink);
  padding: 13px 26px; font-size: 15px; text-decoration: none; cursor: pointer; border-radius: 2px; transition: .15s; }
.btn:hover { background: var(--accent); border-color: var(--accent); }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: var(--ink); color: #fff; }

/* Карточки / сетка */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; padding-bottom: 80px; }
.card { background: #fff; border: 1px solid var(--line); padding: 28px; border-radius: 3px; }
.card h3 { font-family: var(--serif); font-weight: 400; font-size: 22px; margin-bottom: 8px; }
.card p { color: var(--muted); font-size: 14px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin: 24px 0; }
.card.big .score { font-family: var(--serif); font-size: 52px; line-height: 1.1; margin: 6px 0; }
.dim { color: var(--muted); font-size: .62em; }

/* Формы */
.auth { max-width: 420px; margin: 96px auto 80px; }
.auth h2 { font-family: var(--serif); font-weight: 400; font-size: 34px; margin-bottom: 8px; }
form label { display: block; margin: 14px 0 6px; font-size: 13px; color: var(--muted); }
input[type=email], input[type=password], input[type=text], input[type=url] {
  width: 100%; padding: 12px 14px; font-size: 15px; border: 1px solid var(--line);
  border-radius: 2px; background: #fff; color: var(--ink); margin-top: 4px; }
input:focus { outline: none; border-color: var(--ink); }
form .btn { margin-top: 20px; width: 100%; }
.muted { color: var(--muted); }
.tiny { font-size: 13px; }
.muted a { color: var(--accent); }

/* Оплата */
.big-amount { font-family: var(--serif); font-size: 56px; margin: 12px 0 8px; }
.pay-box { text-align: center; }
.pay-box form .btn { width: auto; }

/* Флеш-сообщения */
.flash { padding: 14px 18px; margin: 18px 0; border-radius: 3px; font-size: 14px; }
.flash.ok { background: #eef5ef; border: 1px solid #cfe3d5; color: var(--ok); }
.flash.err { background: #fbecec; border: 1px solid #f0d0d0; color: var(--bad); }

/* Баннер штрафа */
.banner { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  background: #fff5f2; border: 1px solid #eccfc2; padding: 24px 28px; margin: 20px 0; border-radius: 3px; }
.banner h2 { font-family: var(--serif); font-weight: 400; font-size: 24px; margin-bottom: 4px; }
.banner.fine form .btn { background: var(--bad); border-color: var(--bad); margin-top: 0; width: auto; }
.banner.fine form .btn:hover { background: #7d1f1f; }

/* Уровни */
.levels { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin: 18px 0 6px; }
.level { display: block; border: 1px solid var(--line); background: #fff; padding: 16px; border-radius: 3px; cursor: pointer; }
.level:has(input:checked) { border-color: var(--ink); }
.level span { display: block; font-weight: 600; font-size: 15px; }
.level small { color: var(--muted); font-size: 13px; }

/* Отметки / ачивки */
.form-card input[type=url] { width: calc(100% - 150px); margin-right: 10px; }
.form-card form .btn { width: auto; margin-top: 0; }
.marks { list-style: none; }
.marks li { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; overflow: hidden; text-overflow: ellipsis; }
.marks li:last-child { border-bottom: none; }
.marks a { color: var(--ink); }
.day { font-size: 12px; color: var(--accent); margin-right: 10px; }
.ach { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.ach li { background: #f3f0e9; border: 1px solid var(--line); padding: 7px 14px; border-radius: 20px; font-size: 14px; }

.foot { color: var(--muted); font-size: 13px; text-align: center; padding: 40px 24px 56px; border-top: 1px solid var(--line); margin-top: 40px; }

/* ---- Экран приложения (Telegram Mini App, как Coachpad) ---- */
.app { max-width: 560px; margin: 24px auto; padding: 30px 28px; }
.app-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.app-title { font-family: var(--serif); font-weight: 400; font-size: 24px; line-height: 1.2; margin-top: 8px; }
.day-badge { min-width: 58px; height: 58px; border-radius: 50%; background: var(--ok); color: #fff;
  display: flex; align-items: center; justify-content: center; font-family: var(--serif); font-size: 26px; }

.ring-wrap { position: relative; width: 210px; height: 210px; margin: 4px auto 20px; }
.ring { transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 12; }
.ring-bg { stroke: #f0ece3; }
.ring-fg { stroke: var(--accent); stroke-linecap: round; transition: stroke-dasharray .6s ease; }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-num { font-family: var(--serif); font-size: 58px; line-height: 1; }
.ring-label { color: var(--muted); font-size: 14px; }

.mark-box { text-align: center; }
.mark-box h3 { font-family: var(--sans); font-size: 16px; font-weight: 600; margin-bottom: 12px; }
.mark-box form { display: flex; flex-direction: column; gap: 10px; }
.mark-btn { width: 100%; margin-top: 2px; background: #7cb342; border-color: #7cb342; font-size: 16px; padding: 15px; }
.mark-btn:hover { background: #689f38; border-color: #689f38; }
.mark-btn:disabled { opacity: .6; cursor: default; }
.done-line { margin-top: 12px; color: var(--ok); font-weight: 600; font-size: 15px; }

.streak-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  border-top: 1px solid var(--line); margin-top: 24px; padding-top: 18px; }
.streak-num { font-family: var(--serif); font-size: 22px; margin: 4px 0 0; }
.streak-ovr { color: var(--muted); font-size: 13px; }

.marks-block { margin-top: 22px; }
.marks-block h3 { font-size: 15px; }

.app-tabs { position: sticky; bottom: 0; background: #fff; border-top: 1px solid var(--line);
  display: flex; justify-content: space-around; margin: 28px -24px -24px; padding: 10px 0 14px; }
.tab { color: var(--muted); text-decoration: none; font-size: 13px; padding: 6px 18px; border-bottom: 2px solid transparent; }
.tab.active { color: var(--ink); border-bottom-color: var(--accent); }