/* Гнёздышко — дизайн v3 «стикер / нео-брутал».
   Скоуп: html[data-design="v3"]. Не трогает старые страницы. */

html[data-design="v3"] {
  /* ── чернила, бумага ── */
  --v3-ink: #17130d;
  --v3-ink-2: #4b4237;
  --v3-ink-soft: #8b8070;
  --v3-base: #f4efe0;
  --v3-base-2: #ebe4d1;
  --v3-card: #fffdf6;
  --v3-card-2: #f8f3e4;

  /* ── палитра акцентов (мульти-акцент) ── */
  --v3-lime: #cdf564;
  --v3-coral: #ff9d76;
  --v3-sky: #8ec9ff;
  --v3-violet: #c4a7ff;
  --v3-pink: #ff9ec8;
  --v3-amber: #ffd24a;
  --v3-mint: #79e3bd;
  --v3-blue: #a3b7ff;
  --v3-red: #ff7d6b;
  --v3-accent: var(--v3-lime);

  /* ── геометрия ── */
  --v3-line: 2.5px;
  --v3-line-2: 2px;
  --v3-r-xl: 32px;
  --v3-r-lg: 26px;
  --v3-r-md: 20px;
  --v3-r-sm: 14px;
  --v3-r-pill: 999px;
  --v3-shadow: 4px 4px 0 var(--v3-ink);
  --v3-shadow-sm: 3px 3px 0 var(--v3-ink);
  --v3-shadow-lg: 6px 6px 0 var(--v3-ink);
  --v3-tabbar-h: 68px;

  background-color: var(--v3-base);
  color-scheme: light;
}

html[data-design="v3"] body {
  background-color: var(--v3-base);
  background-image: radial-gradient(rgba(23, 19, 13, 0.045) 1.1px, transparent 1.1px);
  background-size: 22px 22px;
  color: var(--v3-ink);
}

html[data-design="v3"] body::before {
  display: none;
}

/* ── секции → акцент ── */
.v3-root[data-accent="lime"] { --v3-accent: var(--v3-lime); }
.v3-root[data-accent="coral"] { --v3-accent: var(--v3-coral); }
.v3-root[data-accent="sky"] { --v3-accent: var(--v3-sky); }
.v3-root[data-accent="violet"] { --v3-accent: var(--v3-violet); }
.v3-root[data-accent="pink"] { --v3-accent: var(--v3-pink); }
.v3-root[data-accent="amber"] { --v3-accent: var(--v3-amber); }
.v3-root[data-accent="mint"] { --v3-accent: var(--v3-mint); }
.v3-root[data-accent="blue"] { --v3-accent: var(--v3-blue); }
.v3-root[data-accent="red"] { --v3-accent: var(--v3-red); }

/* ════════════════════════════════════════════
   Примитивы
   ════════════════════════════════════════════ */

.v3-card {
  position: relative;
  border: var(--v3-line) solid var(--v3-ink);
  border-radius: var(--v3-r-lg);
  background: var(--v3-card);
  box-shadow: var(--v3-shadow);
}

.v3-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border: var(--v3-line-2) solid var(--v3-ink);
  border-radius: var(--v3-r-pill);
  background: var(--v3-card);
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  color: var(--v3-ink);
}

.v3-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 20px;
  border: var(--v3-line) solid var(--v3-ink);
  border-radius: var(--v3-r-pill);
  background: var(--v3-ink);
  color: #fffdf6;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--v3-shadow-sm);
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}

.v3-btn:hover { transform: translate(-1px, -1px); box-shadow: var(--v3-shadow); }
.v3-btn:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--v3-ink); }

.v3-btn--accent {
  background: var(--v3-accent);
  color: var(--v3-ink);
}

.v3-iconbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: var(--v3-line) solid var(--v3-ink);
  border-radius: var(--v3-r-pill);
  background: var(--v3-card);
  color: var(--v3-ink);
  box-shadow: var(--v3-shadow-sm);
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}
.v3-iconbtn:hover { transform: translate(-1px, -1px); box-shadow: var(--v3-shadow); }
.v3-iconbtn:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--v3-ink); }

.v3-icon {
  display: block;
  object-fit: contain;
}
/* PNG/SVG-иконки приложений делаем чёрными силуэтами, если это не кастомный data-URL */
.v3-icon--ink { filter: brightness(0) saturate(100%); }

/* ════════════════════════════════════════════
   Навигация
   ════════════════════════════════════════════ */

.page.v3-root:not(.page--studio) {
  padding-bottom: calc(var(--v3-tabbar-h) + 30px + env(safe-area-inset-bottom));
  min-height: 0;
}

/* ── мобильный нижний таб-бар ── */
.v3-tabbar {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 60;
  border: var(--v3-line) solid var(--v3-ink);
  border-radius: 26px;
  background: var(--v3-card);
  box-shadow: var(--v3-shadow);
}

.v3-tabbar-list {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  align-items: center;
  margin: 0;
  padding: 7px;
  list-style: none;
}

.v3-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 5px 2px;
  border-radius: 18px;
  color: var(--v3-ink-soft);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.v3-tab__ico {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 30px;
  border-radius: 14px;
  transition: background 0.18s ease;
}

.v3-tab__label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.v3-tab--active {
  color: var(--v3-ink);
}
.v3-tab--active .v3-tab__ico {
  background: var(--v3-accent);
  border: var(--v3-line-2) solid var(--v3-ink);
  box-shadow: 2px 2px 0 var(--v3-ink);
}
.v3-tab--active .v3-tab__label { font-weight: 700; }

/* ── десктопный верхний бар ── */
.v3-topbar {
  display: none;
}

@media (min-width: 960px) {
  .v3-tabbar { display: none; }

  .page.v3-root:not(.page--studio) {
    padding-bottom: 40px;
  }

  .v3-topbar {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: -32px -32px 8px;
    padding: 14px 32px;
    border-bottom: var(--v3-line) solid var(--v3-ink);
    background: var(--v3-base);
    position: sticky;
    top: 0;
    z-index: 60;
  }

  .v3-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--v3-ink);
  }

  .v3-brand__mark {
    display: flex;
    width: 42px;
    height: 42px;
    border: var(--v3-line) solid var(--v3-ink);
    border-radius: var(--v3-r-pill);
    overflow: hidden;
    background: var(--v3-card);
    box-shadow: var(--v3-shadow-sm);
  }
  .v3-brand__mark img { width: 100%; height: 100%; object-fit: cover; }

  .v3-brand__name {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
  }

  .v3-topnav {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 auto;
    padding: 6px;
    border: var(--v3-line) solid var(--v3-ink);
    border-radius: var(--v3-r-pill);
    background: var(--v3-card);
    box-shadow: var(--v3-shadow-sm);
  }

  .v3-topnav__item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border-radius: var(--v3-r-pill);
    color: var(--v3-ink-2);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.16s ease, color 0.16s ease;
  }
  .v3-topnav__item:hover { background: var(--v3-card-2); }
  .v3-topnav__item--active {
    background: var(--v3-accent);
    border: var(--v3-line-2) solid var(--v3-ink);
    box-shadow: 2px 2px 0 var(--v3-ink);
    color: var(--v3-ink);
    font-weight: 700;
  }
}

/* ════════════════════════════════════════════
   Главная
   ════════════════════════════════════════════ */

.page--home.v3-root {
  padding-left: 0;
  padding-right: 0;
  padding-top: 0;
}

.v3-home {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.v3-home-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

@media (min-width: 960px) {
  .v3-home-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 20px;
    align-items: start;
  }
  .v3-home-grid > .v3-span-2 { grid-column: 1 / -1; }
}

/* ── hero ── */
.v3-hero {
  position: relative;
  overflow: hidden;
  border: var(--v3-line) solid var(--v3-ink);
  border-radius: var(--v3-r-xl);
  background: var(--v3-accent);
  box-shadow: var(--v3-shadow-lg);
  padding: 22px 22px 26px;
}

.v3-hero__date {
  display: inline-block;
  padding: 4px 12px;
  border: var(--v3-line-2) solid var(--v3-ink);
  border-radius: var(--v3-r-pill);
  background: var(--v3-card);
  font-size: 12px;
  font-weight: 700;
  text-transform: lowercase;
}

.v3-hero__title {
  margin: 14px 0 0;
  padding-right: 68px;
  font-size: 34px;
  line-height: 1.02;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--v3-ink);
}

.v3-hero__title em {
  font-style: normal;
  text-decoration: underline;
  text-decoration-thickness: 4px;
  text-underline-offset: 3px;
}

.v3-hero__sub {
  margin: 10px 0 0;
  max-width: 34ch;
  font-size: 14px;
  font-weight: 400;
  color: var(--v3-ink-2);
}

.v3-stamp {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border: var(--v3-line-2) solid var(--v3-ink);
  border-radius: 50%;
  background: var(--v3-card);
  box-shadow: var(--v3-shadow-sm);
  color: var(--v3-ink);
  rotate: -8deg;
  pointer-events: none;
}

.v3-stamp::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 2px dashed var(--v3-ink);
  border-radius: 50%;
  opacity: 0.35;
}

.v3-stamp svg {
  display: block;
}

@media (min-width: 960px) {
  .v3-hero { padding: 30px 32px 34px; }
  .v3-hero__title { font-size: 46px; }
  .v3-hero__title,
  .v3-hero__sub { padding-right: 0; }
}

/* ── карточка-секция ── */
.v3-sec {
  padding: 18px;
}

.v3-sec__head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.v3-sec__dot {
  width: 14px;
  height: 14px;
  border: var(--v3-line-2) solid var(--v3-ink);
  border-radius: 5px;
  background: var(--v3-lime);
  flex-shrink: 0;
}
.v3-sec--coral .v3-sec__dot { background: var(--v3-coral); border-radius: var(--v3-r-pill); }
.v3-sec--sky .v3-sec__dot { background: var(--v3-sky); border-radius: var(--v3-r-pill); }
.v3-sec--amber .v3-sec__dot { background: var(--v3-amber); }
.v3-sec--violet .v3-sec__dot { background: var(--v3-violet); border-radius: 50% 50% 50% 0; }

.v3-sec__title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.v3-sec__link {
  margin-left: auto;
  font-size: 12px;
  font-weight: 500;
  color: var(--v3-ink-2);
  text-decoration: none;
  border-bottom: var(--v3-line-2) solid transparent;
  padding-bottom: 1px;
}
.v3-sec__link:hover { border-bottom-color: var(--v3-ink); color: var(--v3-ink); }

/* ── дела ── */
.v3-seg {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 14px;
  border: var(--v3-line-2) solid var(--v3-ink);
  border-radius: var(--v3-r-pill);
  background: var(--v3-card-2);
}

.v3-seg__btn {
  padding: 5px 14px;
  border: var(--v3-line-2) solid transparent;
  border-radius: var(--v3-r-pill);
  background: transparent;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  color: var(--v3-ink-2);
  cursor: pointer;
}
.v3-seg__btn--on {
  background: var(--v3-accent);
  border-color: var(--v3-ink);
  color: var(--v3-ink);
  font-weight: 700;
}

.v3-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.v3-task {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: var(--v3-line-2) solid var(--v3-ink);
  border-radius: var(--v3-r-sm);
  background: var(--v3-card);
  box-shadow: 2px 2px 0 var(--v3-ink);
}

.v3-task__check {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border: var(--v3-line-2) solid var(--v3-ink);
  border-radius: 7px;
  background: var(--v3-card);
  cursor: pointer;
  padding: 0;
}
.v3-task__check--on {
  background: var(--v3-accent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2317130d' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12.5l5 5L20 6'/%3E%3C/svg%3E");
  background-size: 16px;
  background-position: center;
  background-repeat: no-repeat;
}

.v3-task__text {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--v3-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.v3-task--done .v3-task__text { color: var(--v3-ink-soft); text-decoration: line-through; }

.v3-task__time {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--v3-ink-2);
}

.v3-empty {
  margin: 4px 0;
  padding: 14px;
  border: var(--v3-line-2) dashed var(--v3-ink-soft);
  border-radius: var(--v3-r-sm);
  font-size: 13px;
  color: var(--v3-ink-soft);
  text-align: center;
}

/* ── смотреть ── */
.v3-watch {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 104px;
  gap: 10px;
  overflow-x: auto;
  margin: 0 -18px;
  padding: 2px 18px 8px;
  scrollbar-width: none;
}
.v3-watch::-webkit-scrollbar { display: none; }

.v3-watch__card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-decoration: none;
  color: var(--v3-ink);
}

.v3-watch__poster {
  position: relative;
  aspect-ratio: 2 / 3;
  border: var(--v3-line-2) solid var(--v3-ink);
  border-radius: var(--v3-r-sm);
  overflow: hidden;
  background: var(--v3-card-2);
  box-shadow: 3px 3px 0 var(--v3-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--v3-ink-soft);
}
.v3-watch__poster img { width: 100%; height: 100%; object-fit: cover; }

.v3-watch__badge {
  position: absolute;
  left: 5px;
  bottom: 5px;
  padding: 2px 7px;
  border: var(--v3-line-2) solid var(--v3-ink);
  border-radius: var(--v3-r-pill);
  background: var(--v3-lime);
  font-size: 9px;
  font-weight: 700;
  line-height: 1.3;
}
.v3-watch__badge--done { background: var(--v3-mint); }
.v3-watch__badge--queue { background: var(--v3-amber); }

.v3-watch__name {
  font-size: 11px;
  font-weight: 500;
  line-height: 1.25;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* ── приложения ── */
.v3-apps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.v3-app {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  color: var(--v3-ink);
  min-width: 0;
}

.v3-app__ico {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 1;
  max-width: 62px;
  border: var(--v3-line-2) solid var(--v3-ink);
  border-radius: var(--v3-r-md);
  background: var(--v3-card);
  box-shadow: var(--v3-shadow-sm);
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}
.v3-app:hover .v3-app__ico { transform: translate(-1px, -1px); box-shadow: var(--v3-shadow); }
.v3-app:active .v3-app__ico { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--v3-ink); }

.v3-app__ico img {
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.v3-app__name {
  font-size: 11px;
  font-weight: 500;
  line-height: 1.15;
  text-align: center;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* ── заметка ── */
.v3-note {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border: var(--v3-line) solid var(--v3-ink);
  border-radius: var(--v3-r-lg);
  background: var(--v3-amber);
  box-shadow: var(--v3-shadow);
  text-decoration: none;
  color: var(--v3-ink);
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}
.v3-note:hover { transform: translate(-1px, -1px); box-shadow: var(--v3-shadow-lg); }
.v3-note:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--v3-ink); }

.v3-note__ico {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  border: var(--v3-line) solid var(--v3-ink);
  border-radius: var(--v3-r-pill);
  background: var(--v3-card);
  box-shadow: var(--v3-shadow-sm);
}

.v3-note__title { font-size: 17px; font-weight: 700; }
.v3-note__sub { font-size: 12px; color: var(--v3-ink-2); }

/* ── splash-loading ── */
.v3-loading {
  padding: 24px;
  text-align: center;
  font-size: 13px;
  color: var(--v3-ink-soft);
}

@media (prefers-reduced-motion: reduce) {
  .v3-btn, .v3-iconbtn, .v3-app__ico, .v3-note { transition: none; }
}
