:root {
  --page-bg: #f2f2f7;
  --surface: #ffffff;
  --dot: #e3e3e8;
  --card-bg: #ffffff;
  --card-border: #ececf0;
  --text: #111114;
  --muted: #97979f;
  --eyebrow: #9a9aa2;
  --toggle-bg: #ffffff;
  --toggle-border: #e7e7ec;
  --toggle-text: #111114;
  --watermark: rgba(17,17,20,.03);
  --shadow: 0 4px 20px -10px rgba(17,17,20,.08);
  --blue: #3b5bfd;
}

[data-theme="dark"] {
  --page-bg: #0b0b0d;
  --surface: #131316;
  --dot: #222227;
  --card-bg: #1a1a1f;
  --card-border: #26262c;
  --text: #ffffff;
  --muted: #8d8d96;
  --eyebrow: #77777f;
  --toggle-bg: #1a1a1f;
  --toggle-border: #2b2b32;
  --toggle-text: #ffffff;
  --watermark: rgba(255,255,255,.025);
  --shadow: 0 4px 20px -10px rgba(0,0,0,.5);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background-color: var(--page-bg);
  transition: background-color .35s ease;
  font-family: 'Inter', system-ui, sans-serif;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}

.frame {
  width: 100%;
  max-width: 1100px;
  background: var(--surface);
  border-radius: 32px;
  padding: 50px 50px 40px;
  position: relative;
  overflow: hidden;
  transition: background .35s ease;
  background-image: radial-gradient(var(--dot) 1.5px, transparent 1.5px);
  background-size: 24px 24px;
  background-position: 4px 4px;
  box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.4);
}

/* ── Водяные знаки ── */
.wm {
  position: absolute;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  color: var(--watermark);
  pointer-events: none;
  user-select: none;
  line-height: 1;
  z-index: 0;
}
.wm-p { top: 20px; right: -20px; font-size: 320px; }
.wm-w { bottom: -20px; left: -20px; font-size: 320px; }

.inner { position: relative; z-index: 1; }

/* ── Шапка ── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 48px;
}

.eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .4em;
  text-transform: uppercase;
  color: var(--eyebrow);
}

.theme-toggle {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--toggle-text);
  background: var(--toggle-bg);
  border: 1px solid var(--toggle-border);
  border-radius: 999px;
  padding: 10px 24px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: all .25s ease;
}
.theme-toggle:hover { border-color: var(--muted); transform: translateY(-1px); }
.theme-toggle:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ── Заголовок ── */
.header-content {
  margin-bottom: 48px;
}

h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: clamp(42px, 5vw, 64px);
  line-height: 1.05;
  letter-spacing: -.03em;
  color: var(--text);
  transition: color .25s ease;
}
h1 .dot { color: var(--blue); }

.sub {
  margin-top: 20px;
  font-size: 17px;
  line-height: 1.6;
  color: var(--muted);
  max-width: 50ch;
}

/* ── Сетка 3 колонки для десктопа ── */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 28px 24px;
  box-shadow: var(--shadow);
  transition: transform .22s cubic-bezier(0.2, 0.8, 0.2, 1), border-color .22s ease, background .25s ease;
}
.card:hover, .card:focus-visible {
  transform: translateY(-5px);
  border-color: var(--muted);
}
.card:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

.icon {
  width: 50px; height: 50px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  margin-bottom: 20px;
  color: #fff;
}
.icon svg { width: 24px; height: 24px; }

[data-theme="dark"] .card[href*="tiktok"] .icon {
  background: #fff !important;
  color: #111114 !important;
}

.card-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
  transition: color .25s ease;
}
.card-desc {
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--muted);
}

footer {
  margin-top: 56px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .35em;
  text-transform: uppercase;
  color: var(--eyebrow);
}

/* ── Планшет ── */
@media (max-width: 900px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .frame { padding: 40px 30px 30px; }
  .wm-p { font-size: 240px; }
  .wm-w { font-size: 240px; }
}

/* ── Телефон (до 550px) ── */
@media (max-width: 550px) {
  body { padding: 12px; }
  
  /* Исправление: Оставляем 2 колонки на телефоне */
  .grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  
  .frame { border-radius: 24px; padding: 30px 20px; }
  .header-content { margin-bottom: 32px; }
  h1 { font-size: 34px; }
  .sub { font-size: 14px; }
  
  /* Уменьшаем карточки, чтобы они вмещались в 2 колонки */
  .card { padding: 18px 14px; border-radius: 16px; }
  .icon { width: 40px; height: 40px; margin-bottom: 14px; border-radius: 12px; }
  .icon svg { width: 20px; height: 20px; }
  .card-title { font-size: 15px; }
  .card-desc { font-size: 11.5px; line-height: 1.3; }
  
  .wm { display: none; }
}

/* ── Совсем узкие экраны (например, iPhone SE - до 380px) ── */
@media (max-width: 380px) {
  .grid { gap: 8px; }
  .card { padding: 14px 10px; }
  .card-title { font-size: 14px; }
  .card-desc { font-size: 10.5px; }
  .icon { width: 36px; height: 36px; margin-bottom: 10px; }
  .icon svg { width: 18px; height: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; transform: none !important; }
}