:root {
  --bg: #0c0c0d;
  --card: #151517;
  --card-2: #1c1c1f;
  --line: #26262a;
  --text: #f2f2f2;
  --muted: #8a8a8f;
  --dim: #55555a;
  --accent: #ff7a45;
  --good: #4cd38a;
  --danger: #ff5a5f;
  --radius: 18px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; color: inherit; }
a { color: inherit; }

/* ---------- Шапка ---------- */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 24px;
  background: rgba(12, 12, 13, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; text-decoration: none; }
.brand-mark {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px;
  background: var(--accent); color: #fff; font-weight: 800; font-size: 12px; letter-spacing: 0.02em;
}
.top-right { display: flex; align-items: center; gap: 10px; }
.top-landing { flex-wrap: wrap; }
.top-landing .top-right { flex-wrap: wrap; justify-content: flex-end; margin-left: auto; }
.btn-login { text-decoration: none; white-space: nowrap; min-height: 40px; }
.landing-signin { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px; margin-top: 18px; }
.landing-signin .muted { margin: 0; }
.landing-signin .btn-login-secondary { background: var(--card-2); color: var(--text); border: 1px solid var(--line); }
.chip { padding: 4px 12px; border-radius: 99px; background: var(--card-2); color: var(--muted); font-size: 13px; white-space: nowrap; }
.langs { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--card-2); }
.langs button { border: 0; background: none; padding: 4px 9px; border-radius: 8px; cursor: pointer; color: var(--muted); font-size: 12px; font-weight: 600; }
.langs button.active { background: var(--line); color: var(--text); }

.banner { margin: 16px 24px 0; padding: 12px 16px; border-radius: 12px; background: #3a1d1d; color: #ffb4b4; }

/* ---------- Лендинг ---------- */
.hero { max-width: 1120px; margin: 0 auto; padding: 56px 24px 24px; }
.hero h1 { margin: 0 0 14px; font-size: clamp(34px, 6.5vw, 64px); line-height: 1.03; letter-spacing: -0.035em; max-width: 820px; }
.hero p { margin: 0; max-width: 620px; color: var(--muted); font-size: 17px; }
.features { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 22px 0 0; list-style: none; }
.features li { padding: 6px 12px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); font-size: 13px; }

.landing { max-width: 1120px; margin: 0 auto; padding: 8px 24px 64px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.landing .card h2 { margin: 0 0 16px; font-size: 22px; letter-spacing: -0.01em; }
.card-quiet { background: transparent; }
.card-quiet h3 { margin-top: 0; }
.section-title { margin: 28px 0 14px; }
.gallery { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; }
.shot { margin: 0; border-radius: 20px; overflow: hidden; border: 1px solid var(--line); aspect-ratio: 590 / 1278; background: var(--card); }
.shot img { width: 100%; height: 100%; display: block; object-fit: cover; }

.habits { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
.habit {
  min-width: 0; overflow-wrap: anywhere;
  display: flex; align-items: center; gap: 10px; padding: 14px; border-radius: 14px; cursor: pointer;
  background: var(--card-2); border: 1.5px solid transparent; text-align: left;
}
.habit:hover { border-color: var(--line); }
.habit.active { border-color: var(--accent); }
.habit-emoji { font-size: 22px; line-height: 1; }
.habits-small { grid-template-columns: repeat(4, 1fr); gap: 8px; }
.habits-small .habit { padding: 10px 12px; font-size: 13px; }
.habits-small .habit-emoji { font-size: 18px; }

/* ---------- Вкладки счётчиков ---------- */
.tabs { max-width: 1120px; margin: 0 auto; padding: 24px 24px 0; display: flex; gap: 8px; overflow-x: auto; }
.tab {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 12px; cursor: pointer;
  background: var(--card); border: 1px solid var(--line); white-space: nowrap;
}
.tab small { color: var(--muted); }
.tab.active { border-color: var(--accent); background: var(--card-2); }
.tab-add { color: var(--muted); border-style: dashed; }

/* ---------- Раскладка настроек ---------- */
.layout {
  max-width: 1120px; margin: 0 auto; padding: 20px 24px 64px;
  display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 32px; align-items: start;
}
.config { display: grid; gap: 20px; min-width: 0; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.card-head h2 { margin: 0; font-size: 19px; letter-spacing: -0.01em; }
.step {
  display: grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; flex: none;
  background: var(--text); color: var(--bg); font-weight: 700; font-size: 13px;
}
.card-donate .step { background: var(--accent); color: #fff; }
h3 { margin: 22px 0 10px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.muted { color: var(--muted); margin: 0 0 10px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }

.stats { display: grid; grid-template-columns: 1.2fr 0.8fr 1.4fr 0.8fr; gap: 10px; }
.stat { background: var(--card-2); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat b { font-size: 20px; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat span { color: var(--muted); font-size: 12px; }
.stat-main b { font-size: 40px; line-height: 1; }
.next { color: var(--muted); margin: 14px 0 0; min-height: 1.5em; }
.next b { color: var(--good); font-weight: 500; }

.row-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin-top: 18px; }
.field { display: flex; flex-direction: column; gap: 6px; flex: 1 1 150px; margin-bottom: 4px; }
.field-wide { flex: 2 1 220px; }
.field-narrow { flex: 0 1 110px; }
.field span { font-size: 12px; color: var(--muted); }
.field input, .search, .select, .field select {
  width: 100%; padding: 11px 13px; border-radius: 11px;
  background: var(--card-2); border: 1px solid var(--line); outline: none;
}
.field input:focus, .search:focus, .select:focus { border-color: var(--accent); }
.field input[readonly] { color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 11px 18px; border-radius: 11px; border: 0; cursor: pointer; text-decoration: none;
  background: var(--text); color: var(--bg); font-weight: 600; white-space: nowrap;
  transition: transform 0.1s, opacity 0.2s;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-small { padding: 7px 12px; font-size: 13px; }
.btn-big { width: 100%; padding: 16px; font-size: 16px; margin-top: 6px; }
.btn-danger { margin-top: 14px; width: 100%; background: transparent; color: var(--danger); border: 1px solid #4a2426; }
.btn-danger:hover { background: #2a1416; }
.btn-danger-solid { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; color: var(--muted); }
.link-btn { display: block; margin: 12px auto 0; border: 0; background: none; color: var(--dim); cursor: pointer; font-size: 13px; text-decoration: underline; }
.link-btn:hover { color: var(--muted); }

.options { display: grid; gap: 10px; }
.layouts { grid-template-columns: repeat(3, 1fr); }
.themes { grid-template-columns: repeat(5, 1fr); }
.option {
  cursor: pointer; border-radius: 14px; padding: 10px; background: var(--card-2);
  border: 1.5px solid transparent; text-align: center; transition: border-color 0.15s;
}
.option:hover { border-color: var(--line); }
.option.active { border-color: var(--accent); }
.option-name { display: block; margin-top: 8px; font-size: 12px; }

.mini { height: 54px; display: grid; gap: 3px; justify-content: center; align-content: center; }
.mini i { width: 5px; height: 5px; border-radius: 50%; background: var(--dim); }
.mini i.on { background: var(--text); }
.mini i.now { background: var(--accent); }
.mini-weeks i { width: 9px; height: 9px; border-radius: 2px; }
.mini-months { gap: 4px; }
.mini-months i { width: 12px; height: 10px; border-radius: 2px; }
.mini-ring i { width: 38px; height: 38px; border-radius: 50%; background: none !important; border: 5px solid var(--dim); border-top-color: var(--accent); border-right-color: var(--accent); }

.swatch { height: 46px; border-radius: 10px; display: flex; align-items: center; justify-content: center; gap: 4px; }
.swatch i { width: 7px; height: 7px; border-radius: 50%; }

.goal-fields { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 14px; }

.accent-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.accent-row input[type="color"] { width: 44px; height: 36px; border: 1px solid var(--line); border-radius: 10px; background: var(--card-2); padding: 3px; cursor: pointer; }
.accent-presets { display: flex; gap: 6px; flex-wrap: wrap; }
.accent { width: 24px; height: 24px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.accent.active { border-color: var(--text); }
.accent-row .link-btn { margin: 0; }

.toggles { display: grid; gap: 10px; }
.toggle { display: flex; align-items: center; gap: 12px; cursor: pointer; user-select: none; }
.toggle input { position: absolute; opacity: 0; }
.toggle > span:first-of-type { position: relative; width: 42px; height: 25px; border-radius: 99px; background: var(--line); transition: background 0.2s; flex: none; }
.toggle > span:first-of-type::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 19px; height: 19px; border-radius: 50%;
  background: #fff; transition: transform 0.2s;
}
.toggle input:checked + span { background: var(--good); }
.toggle input:checked + span::after { transform: translateX(17px); }
.toggle input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.toggle b { font-weight: 500; }
.toggle-small { font-size: 13px; color: var(--muted); }
.hint-muted { margin: 6px 0 14px 54px; font-size: 13px; color: var(--dim); }

.segmented { display: inline-flex; flex-wrap: wrap; padding: 3px; border-radius: 11px; background: var(--card-2); margin-bottom: 4px; }
.segmented button { border: 0; background: none; padding: 7px 14px; border-radius: 9px; cursor: pointer; color: var(--muted); }
.segmented button.active { background: var(--line); color: var(--text); }
#seg-platform { margin-bottom: 12px; }

.device-list { margin-top: 10px; max-height: 320px; overflow: auto; display: grid; gap: 2px; }
.device-brand { padding: 10px 12px 4px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--dim); }
.device {
  display: flex; justify-content: space-between; gap: 12px; padding: 9px 12px; border-radius: 10px;
  cursor: pointer; border: 1px solid transparent; background: none; text-align: left; width: 100%;
}
.device:hover { background: var(--card-2); }
.device.active { border-color: var(--accent); background: var(--card-2); }
.device small { color: var(--muted); white-space: nowrap; }
.custom-size { display: flex; gap: 12px; margin-top: 12px; }

.url-box { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 14px; border-radius: 12px; background: var(--card-2); border: 1px solid var(--line); margin-bottom: 4px; }
.url-box code { flex: 1; min-width: 0; overflow-wrap: anywhere; font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--accent); }
.hint { margin: 10px 0 0; font-size: 13px; color: #ffcf8a; }

.steps { margin: 18px 0 8px; padding: 0; list-style: none; counter-reset: s; display: grid; gap: 14px; }
.steps li { counter-increment: s; position: relative; padding-left: 38px; color: var(--muted); }
.steps li::before {
  content: counter(s); position: absolute; left: 0; top: 0;
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid var(--line); color: var(--text); font-size: 12px;
}
.steps b { color: var(--text); font-weight: 500; }
.steps .warn { display: block; margin-top: 6px; padding: 8px 12px; border-radius: 10px; background: #2a2114; color: #ffcf8a; font-size: 13px; }

.home-head { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }
.home-head .muted { margin: 0; }
.app-icon { width: 60px; height: 60px; border-radius: 14px; flex: none; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4); }
.app-icon-big { width: 96px; height: 96px; border-radius: 22px; }

/* ---------- Превью ---------- */
.preview { position: sticky; top: 76px; display: grid; gap: 14px; justify-items: center; }
.phone {
  position: relative; width: 300px; aspect-ratio: 1179 / 2556; border-radius: 44px; overflow: hidden;
  background: #000; border: 10px solid #232326; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), 0 0 0 1px #333 inset;
}
.phone img { width: 100%; height: 100%; object-fit: cover; display: block; transition: opacity 0.25s; }
.phone.loading img { opacity: 0.55; }
.lock { position: absolute; inset: 0; text-align: center; color: rgba(255, 255, 255, 0.92); pointer-events: none; padding-top: 13%; }
.lock.light { color: rgba(20, 20, 20, 0.85); }
.lock-date { font-size: 13px; font-weight: 600; }
.lock-time { font-size: 68px; font-weight: 700; line-height: 1; letter-spacing: -0.02em; }
.loader {
  position: absolute; right: 14px; bottom: 14px; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25); border-top-color: #fff; opacity: 0; animation: spin 0.8s linear infinite;
}
.phone.loading .loader { opacity: 1; }
@keyframes spin { to { transform: rotate(360deg); } }
.link { color: var(--muted); font-size: 13px; text-decoration: none; }
.link:hover { color: var(--text); }
.save-note { margin: 0; max-width: 300px; text-align: center; font-size: 12px; color: var(--dim); }

/* ---------- Страница сброса ---------- */
.reset-body { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: env(safe-area-inset-top) 20px env(safe-area-inset-bottom); }
.reset-card { width: 100%; max-width: 420px; display: grid; gap: 14px; justify-items: center; text-align: center; }
.reset-card h1 { margin: 8px 0 0; font-size: 28px; letter-spacing: -0.02em; }
.reset-days { margin: 0; font-size: 44px; font-weight: 800; letter-spacing: -0.03em; }
.reset-actions { width: 100%; display: grid; gap: 8px; }

.foot { text-align: center; color: var(--dim); padding: 0 24px 48px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0;
  padding: 10px 18px; border-radius: 99px; background: var(--text); color: var(--bg); font-weight: 500;
  transition: opacity 0.2s, transform 0.2s; pointer-events: none; z-index: 10; max-width: calc(100% - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; }
  .preview { position: static; order: -1; }
  .phone { width: 240px; }
  .lock-time { font-size: 54px; }
  .gallery { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 600px) {
  .top, .hero, .layout, .landing, .tabs { padding-left: 16px; padding-right: 16px; }
  .chip { display: none; }
  .stats { grid-template-columns: repeat(3, 1fr); }
  .stat-main { grid-column: span 3; }
  .stat b { font-size: 17px; }
  .habits, .habits-small { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .layouts { grid-template-columns: repeat(2, 1fr); }
  .themes { grid-template-columns: repeat(3, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .gallery { grid-template-columns: repeat(2, 1fr); }
  .custom-size { flex-direction: column; }
  .hint-muted { margin-left: 0; }
}

/* Account registration and sign-in */
.auth-layout { max-width: 480px; margin: 56px auto; padding: 0 20px; }
.auth-card h1 { margin: 0 0 12px; font-size: 30px; letter-spacing: -0.03em; }
.auth-form { display: grid; gap: 16px; margin-top: 20px; }
.auth-form .muted { font-size: 12px; margin: -6px 0 0; }
.btn-google { width: 100%; margin-top: 18px; background: var(--card-2); color: var(--text); border: 1px solid var(--line); }
.auth-divider { text-align: center; font-size: 12px; margin-top: 18px; }
.auth-switch { margin: 22px 0 0; font-size: 13px; text-align: center; }
.auth-switch a { color: var(--accent); }
.auth-error { margin: 18px 0 0; }
.account-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 16px 0; }
