/* ─────────────────────────────────────────────────────────────
   Visitka — глобальные переменные и сброс
───────────────────────────────────────────────────────────── */
:root {
  --accent: #3a8dff;
  /* Fallback rgba для iOS Safari 15.0-15.3, у которых нет color-mix().
     Для прочих браузеров эти значения перезаписываются ниже через @supports.
     Если меняешь --accent в config.js — app.js пересчитает эти rgba динамически. */
  --accent-99: rgba(58, 141, 255, 0.60);
  --accent-55: rgba(58, 141, 255, 0.33);
  --accent-40: rgba(58, 141, 255, 0.25);
  --accent-33: rgba(58, 141, 255, 0.20);
  --accent-22: rgba(58, 141, 255, 0.13);
  --accent-11: rgba(58, 141, 255, 0.07);
  --bg-0: #050608;
  --bg-1: #0a0b10;
  --bg-2: #0a0c12;
  --bg-3: #1a1f2e;
}
@supports (color: color-mix(in srgb, red, blue)) {
  :root {
    --accent-99: color-mix(in srgb, var(--accent) 60%, transparent);
    --accent-55: color-mix(in srgb, var(--accent) 33%, transparent);
    --accent-40: color-mix(in srgb, var(--accent) 25%, transparent);
    --accent-33: color-mix(in srgb, var(--accent) 20%, transparent);
    --accent-22: color-mix(in srgb, var(--accent) 13%, transparent);
    --accent-11: color-mix(in srgb, var(--accent)  7%, transparent);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg-0); }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  color: #fff;
  min-height: 100vh;
  min-height: 100dvh;
}
*::-webkit-scrollbar { width: 0; height: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
img { display: block; max-width: 100%; }

/* ─────────────────────────────────────────────────────────────
   Stage и phone frame
───────────────────────────────────────────────────────────── */
.stage {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  background: radial-gradient(ellipse at 50% 30%, var(--bg-3) 0%, var(--bg-1) 60%, var(--bg-0) 100%);
  display: grid;
  place-items: center;
}
@media (min-width: 480px) {
  .stage { padding: 32px 16px; }
}

.phone {
  position: relative;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg-2);
  overflow: hidden;
}
@media (min-width: 480px) {
  .phone {
    width: 390px;
    min-height: 844px;
    max-height: 90vh;
    border-radius: 48px;
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 20px 80px rgba(0,0,0,0.6), 0 0 0 1px rgba(0,0,0,0.5);
    overflow: auto;
  }
}

/* ─────────────────────────────────────────────────────────────
   Backdrop орбы
───────────────────────────────────────────────────────────── */
.backdrop {
  position: absolute; inset: 0; overflow: hidden; z-index: 0;
  background: var(--bg-2);
  pointer-events: none;
}
.backdrop .orb {
  position: absolute;
  border-radius: 50%;
}
.backdrop .orb-1 {
  top: -80px; left: -60px; width: 320px; height: 320px;
  background: var(--accent);
  filter: blur(80px);
  opacity: 0.35;
}
.backdrop .orb-2 {
  top: 200px; right: -100px; width: 280px; height: 280px;
  background: #9d5cff;
  filter: blur(90px);
  opacity: 0.25;
}
.backdrop .orb-3 {
  bottom: -120px; left: -40px; width: 340px; height: 340px;
  background: #3a8dff;
  filter: blur(100px);
  opacity: 0.21;
}
.backdrop .grain {
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 3px 3px;
  opacity: 0.6;
  mix-blend-mode: overlay;
}
.backdrop .top-fade {
  position: absolute; top: 0; left: 0; right: 0; height: 80px;
  background: linear-gradient(180deg, rgba(10,12,18,0.7), transparent);
}

/* ─────────────────────────────────────────────────────────────
   Content
───────────────────────────────────────────────────────────── */
.content {
  position: relative; z-index: 1;
  padding: 54px 16px 28px;
  padding-top: max(54px, env(safe-area-inset-top, 0));
  padding-bottom: max(28px, env(safe-area-inset-bottom, 0));
}

/* ─────────────────────────────────────────────────────────────
   Avatar
───────────────────────────────────────────────────────────── */
.avatar-block {
  display: flex; flex-direction: column; align-items: center;
  padding: 12px 0 20px;
}
.avatar {
  width: 96px; height: 96px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.25);
  padding: 3px;
  background: conic-gradient(from 220deg, var(--accent-55), transparent 50%, var(--accent-33));
  box-sizing: border-box;
}
.avatar-inner {
  width: 100%; height: 100%; border-radius: 50%;
  background-position: center; background-size: cover; background-repeat: no-repeat;
  background-color: var(--bg-3);
  display: grid; place-items: center;
  color: #fff; font-size: 32px; font-weight: 700;
  font-family: 'Space Grotesk', system-ui;
}
.avatar-inner.placeholder {
  background: radial-gradient(circle at 30% 25%, var(--accent-99), var(--bg-3) 70%);
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
  opacity: 0.95;
}
.name {
  margin-top: 12px;
  font-size: 24px; font-weight: 700; color: #fff;
  font-family: 'Space Grotesk', system-ui;
  letter-spacing: -0.3px;
}
.tagline {
  margin-top: 4px;
  font-size: 13px; color: rgba(255,255,255,0.55);
  text-align: center;
  max-width: 280px; padding: 0 16px;
}

/* ─────────────────────────────────────────────────────────────
   Music player
───────────────────────────────────────────────────────────── */
.player {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  margin-bottom: 16px;
}
.player-btn {
  width: 38px; height: 38px; border-radius: 999px;
  border: none;
  background: var(--accent); color: #0b0d14;
  display: grid; place-items: center;
  flex-shrink: 0;
  box-shadow: 0 6px 20px var(--accent-33);
  transition: transform 0.12s ease, box-shadow 0.18s ease;
}
.player-btn:active { transform: scale(0.94); }
.player-btn:disabled { opacity: 0.55; cursor: not-allowed; box-shadow: none; }
.player-skip {
  width: 28px; height: 28px; border-radius: 8px;
  border: none;
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.7);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.player-skip:hover { background: rgba(255,255,255,0.10); color: #fff; }
.player-skip:disabled { opacity: 0.35; cursor: not-allowed; }
.player-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.player-title {
  font-size: 13px; font-weight: 600; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.player-progress-row {
  display: flex; align-items: center; gap: 8px;
}
.player-progress {
  flex: 1; height: 3px; border-radius: 3px;
  background: rgba(255,255,255,0.12); overflow: hidden;
}
.player-progress-fill {
  height: 100%; width: 0%;
  background: var(--accent);
  transition: width 0.2s linear;
}
.player-status {
  font-size: 10px; color: rgba(255,255,255,0.5);
  min-width: 36px; text-align: right;
}

/* ─────────────────────────────────────────────────────────────
   Cards — общая база
───────────────────────────────────────────────────────────── */
.cards { display: flex; flex-direction: column; gap: 10px; }
.cards-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.card {
  position: relative;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  color: #fff;
  transition: background 0.18s ease, transform 0.18s ease;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
  overflow: hidden;
}
.card:hover { background: rgba(255,255,255,0.09); transform: translateY(-1px); }
.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.card.highlighted {
  border: 1.5px solid var(--accent);
  box-shadow:
    0 0 0 1px var(--accent-33),
    0 8px 32px var(--accent-40),
    inset 0 1px 0 rgba(255,255,255,0.06);
}

/* ─────────────────────────────────────────────────────────────
   Mini card (YT / TG)
───────────────────────────────────────────────────────────── */
.mini-card {
  display: flex; flex-direction: column;
  padding: 12px;
  border-radius: 16px;
  min-height: 152px;
}
.mini-top {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 6px;
}
.icon-tile {
  width: 34px; height: 34px; border-radius: 10px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  display: grid; place-items: center;
  color: var(--accent);
  flex-shrink: 0;
}
.highlighted .icon-tile {
  background: linear-gradient(180deg, var(--accent-33), var(--accent-11));
  border: 1px solid var(--accent-55);
}
.ago-pill {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 9px; font-weight: 700; letter-spacing: 0.6px;
  padding: 3px 7px; border-radius: 999px;
  text-transform: uppercase;
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.7);
  border: 1px solid rgba(255,255,255,0.08);
}
.ago-pill.live {
  background: #ff3a55; color: #fff; border: none;
}
.ago-pill.live::before {
  content: ''; display: inline-block;
  width: 5px; height: 5px; border-radius: 999px;
  background: #fff;
  animation: live-pulse 1.5s ease-in-out infinite;
}
.mini-label {
  margin-top: 10px;
  font-size: 9px; color: rgba(255,255,255,0.45);
  letter-spacing: 1px; text-transform: uppercase; font-weight: 700;
}
.highlighted .mini-label { color: var(--accent); }
.mini-latest {
  margin-top: 4px;
  font-size: 13px; font-weight: 600; line-height: 1.25; color: #fff;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-clamp: 2;
  overflow: hidden;
  word-break: break-word;
}
.mini-spacer { flex: 1; min-height: 6px; }
.mini-meta {
  display: flex; align-items: center; justify-content: space-between;
  gap: 6px; font-size: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.mini-handle {
  color: rgba(255,255,255,0.5);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mini-count {
  color: rgba(255,255,255,0.85);
  font-weight: 700; font-size: 11px; flex-shrink: 0;
}
.highlighted .mini-count { color: var(--accent); }

.new-ribbon {
  position: absolute; top: 8px; right: -22px;
  transform: rotate(35deg);
  font-size: 8px; font-weight: 800; letter-spacing: 1px;
  padding: 2px 24px;
  background: var(--accent); color: #0b0d14;
  display: none;
}
.card.highlighted .new-ribbon { display: block; }

/* ─────────────────────────────────────────────────────────────
   Twitch hero
───────────────────────────────────────────────────────────── */
.twitch-hero {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  border-radius: 18px;
}
.twitch-glow {
  position: absolute; right: -40px; top: -20px;
  width: 160px; height: 160px;
  border-radius: 50%; filter: blur(40px);
  background: #9d5cff; opacity: 0.25;
  pointer-events: none;
}
.twitch-hero .icon-tile {
  width: 46px; height: 46px; border-radius: 12px;
}
.twitch-body { flex: 1; min-width: 0; z-index: 1; position: relative; }
.twitch-title-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.twitch-title { font-size: 15px; font-weight: 600; color: #fff; }
.live-pill {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 9px; font-weight: 700; letter-spacing: 0.8px;
  padding: 2px 6px; border-radius: 4px;
  background: #ff3a55; color: #fff;
  text-transform: uppercase;
}
.live-pill::before {
  content: ''; display: inline-block;
  width: 5px; height: 5px; border-radius: 999px;
  background: #fff;
  animation: live-pulse 1.5s ease-in-out infinite;
}
.twitch-handle-row {
  font-size: 12px; margin-top: 2px; color: rgba(255,255,255,0.55);
  display: flex; align-items: center; gap: 8px;
  white-space: nowrap; overflow: hidden;
}
.twitch-handle-row .dot { opacity: 0.4; }
.twitch-followers { color: rgba(255,255,255,0.75); font-weight: 500; }
.twitch-chevron {
  color: rgba(255,255,255,0.35); font-size: 18px; z-index: 1; line-height: 1;
}
@keyframes live-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* ─────────────────────────────────────────────────────────────
   Section divider
───────────────────────────────────────────────────────────── */
.section-divider {
  display: flex; align-items: center; gap: 10px;
  margin: 6px 2px 2px;
  font-size: 10px; color: rgba(255,255,255,0.4);
  letter-spacing: 1.4px; font-weight: 600;
}
.section-divider .line {
  flex: 1; height: 1px; background: rgba(255,255,255,0.08);
}

/* ─────────────────────────────────────────────────────────────
   Full-width card (projects)
───────────────────────────────────────────────────────────── */
.full-card {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  border-radius: 18px;
}
.full-card .icon-tile {
  width: 42px; height: 42px; border-radius: 12px;
}
.full-body { flex: 1; min-width: 0; }
.full-title {
  font-size: 15px; font-weight: 600; line-height: 1.2; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.full-meta {
  font-size: 12px; margin-top: 2px; color: rgba(255,255,255,0.55);
  display: flex; align-items: center; gap: 8px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.full-handle {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 60%;
}
.full-meta .dot { opacity: 0.4; }
.full-count {
  color: rgba(255,255,255,0.75); font-weight: 500;
}
.highlighted .full-count { color: var(--accent); }
.full-chevron {
  color: rgba(255,255,255,0.35); font-size: 18px; flex-shrink: 0; line-height: 1;
}

/* ─────────────────────────────────────────────────────────────
   Footer
───────────────────────────────────────────────────────────── */
.footer {
  margin-top: 18px; text-align: center;
  font-size: 10px; color: rgba(255,255,255,0.35);
  letter-spacing: 1px;
}

/* ─────────────────────────────────────────────────────────────
   Pulse выделение
───────────────────────────────────────────────────────────── */
.pulse {
  animation: visitka-pulse 2.2s ease-out infinite;
}
@keyframes visitka-pulse {
  0% {
    box-shadow:
      0 0 0 0 var(--accent-55),
      0 8px 32px var(--accent-33),
      inset 0 1px 0 rgba(255,255,255,0.06);
  }
  70% {
    box-shadow:
      0 0 0 12px transparent,
      0 8px 32px var(--accent-33),
      inset 0 1px 0 rgba(255,255,255,0.06);
  }
  100% {
    box-shadow:
      0 0 0 0 transparent,
      0 8px 32px var(--accent-33),
      inset 0 1px 0 rgba(255,255,255,0.06);
  }
}
@media (prefers-reduced-motion: reduce) {
  .pulse, .live-pill::before, .ago-pill.live::before { animation: none; }
}

/* ─────────────────────────────────────────────────────────────
   Loading / skeleton текста
───────────────────────────────────────────────────────────── */
.skeleton {
  color: transparent !important;
  background: linear-gradient(90deg, rgba(255,255,255,0.06), rgba(255,255,255,0.12), rgba(255,255,255,0.06));
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
  border-radius: 4px;
}
@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
