/* Общие стили сайта по согласованному макету (#37). Колонка как экран колоды в приложении; на широком экране обложка и кнопка слева, карточки справа */
:root {
  --bg: #f1f1f4;
  --paper: #ffffff;
  --ink: #1c1c1e;
  --ink2: #6c6c72;
  --ink3: #8e8e93;
  --line: #e3e1e6;
  --accent: #ff6b4d;
  --accent-top: #ff8569;
  --accent-ink: #c9411f;
  --accent-soft: #fde4dd;
  --glass: rgba(255, 255, 255, 0.62);
  --glass-edge: rgba(255, 255, 255, 0.85);
  --shadow: 0 8px 28px rgba(28, 28, 50, 0.1);
  --on-accent: #ffffff;
  --display: 'Wix Madefor Display', -apple-system, system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  --r-card: 22px;
  --r-cover: 26px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #121114;
    --paper: #1b1a1e;
    --ink: #f2f0f4;
    --ink2: #a7a3ad;
    --ink3: #7d7983;
    --line: #2c2a30;
    --accent: #f0674c;
    --accent-top: #f47b62;
    --accent-ink: #ff8a70;
    --accent-soft: #3b231e;
    --glass: rgba(27, 26, 30, 0.66);
    --glass-edge: rgba(255, 255, 255, 0.08);
    --shadow: 0 8px 28px rgba(0, 0, 0, 0.4);
    --on-accent: #ffffff;
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --bg: #121114;
  --paper: #1b1a1e;
  --ink: #f2f0f4;
  --ink2: #a7a3ad;
  --ink3: #7d7983;
  --line: #2c2a30;
  --accent: #f0674c;
  --accent-top: #f47b62;
  --accent-ink: #ff8a70;
  --accent-soft: #3b231e;
  --glass: rgba(27, 26, 30, 0.66);
  --glass-edge: rgba(255, 255, 255, 0.08);
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.4);
  --on-accent: #ffffff;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}
body {
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.45 var(--display);
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: '';
  position: fixed;
  inset: 0 0 auto;
  height: env(safe-area-inset-top, 0px);
  z-index: 10;
  background: var(--bg);
}
a {
  color: inherit;
}
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 12px;
}

.wrap {
  max-width: 1040px;
  margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/* Верхняя панель — стекло, как навигация в приложении */
.bar {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 5;
  padding-block: 10px;
}
.bar-in {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 52px;
  padding: 0 8px 0 18px;
  border-radius: 26px;
  background: var(--glass);
  border: 1px solid var(--glass-edge);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
}
/* Логотип как в приложении: иконка-жёлудь и слово Nooli шрифтом Wix Madefor Display */
.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.4px;
  text-decoration: none;
}
.logo img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: block;
}

/* Основная сетка */
.page {
  display: grid;
  gap: 28px;
  padding-block: 18px 40px;
}
@media (min-width: 860px) {
  .page {
    grid-template-columns: 380px minmax(0, 1fr);
    gap: 48px;
    padding-block: 36px 64px;
    align-items: start;
  }
  .deck {
    position: sticky;
    top: calc(env(safe-area-inset-top, 0px) + 92px);
  }
}

/* Колода */
.deck {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}
.cover {
  width: 104px;
  aspect-ratio: 1;
  max-width: 100%;
  border-radius: var(--r-cover);
  display: grid;
  place-items: center;
  font-size: 52px;
  line-height: 1;
  background: radial-gradient(120% 90% at 30% 15%, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0) 60%), var(--cover);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 12px 30px -10px var(--cover);
}
h1 {
  margin: 0;
  font-size: clamp(30px, 7.4vw, 40px);
  line-height: 1.08;
  font-weight: 700;
  letter-spacing: -0.8px;
  text-wrap: balance;
}
.meta {
  margin: 6px 0 0;
  color: var(--ink2);
  font-size: 15px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
}
.meta span + span::before {
  content: '·';
  margin-right: 10px;
  color: var(--ink3);
}
.desc {
  margin: 0;
  font-size: 17px;
  line-height: 1.5;
  color: var(--ink);
  max-width: 38ch;
}

.cta {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.open {
  height: 56px;
  border-radius: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(180deg, var(--accent-top), var(--accent));
  color: var(--on-accent);
  font: 600 18px var(--display);
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    0 10px 24px -6px rgba(255, 107, 77, 0.45);
  transition: transform 0.15s ease;
}
.open:hover {
  transform: translateY(-1px);
}
.open:active {
  transform: translateY(1px);
}
/* Кнопка App Store в шапке на всех экранах: компактная, на телефоне только «App Store» */
.store {
  height: 34px;
  padding: 0 13px 0 11px;
  border-radius: 17px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--ink);
  color: var(--bg);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}
.store svg {
  flex: none;
  margin-top: -1px;
}
.store-long {
  display: none;
}
@media (min-width: 600px) {
  .store-long {
    display: inline;
  }
  .store-short {
    display: none;
  }
}
.hint {
  margin: 2px 0 0;
  text-align: center;
  color: var(--ink3);
  font-size: 13px;
}

.code {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 16px;
  border: 1px dashed var(--line);
}
.code-label {
  font-size: 13px;
  color: var(--ink2);
}
.code-value {
  font: 500 15px var(--mono);
  letter-spacing: 0.08em;
  user-select: all;
}

/* Карточки */
.cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.cards-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 0 4px 4px;
}
.cards-head h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
}
.cards-head span {
  color: var(--ink2);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}
.card {
  background: var(--paper);
  border-radius: var(--r-card);
  padding: 15px 18px 16px;
  display: grid;
  gap: 4px;
  min-width: 0;
}
.term {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.def {
  font-size: 15px;
  color: var(--ink2);
  line-height: 1.38;
  overflow-wrap: anywhere;
}
.ex {
  margin-top: 6px;
  font-size: 14px;
  color: var(--ink3);
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.ex::before {
  content: '\201C';
}
.ex::after {
  content: '\201D';
}

/* Оставшиеся карточки: стопка, уходящая под низ */
.more {
  position: relative;
  padding-top: 2px;
}
.more .card {
  position: relative;
  z-index: 2;
  text-align: center;
  display: block;
  padding: 16px 18px;
}
.more .card strong {
  font-weight: 600;
}
.more .card p {
  margin: 2px 0 0;
  color: var(--ink2);
  font-size: 14px;
}
.more::before,
.more::after {
  content: '';
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: -7px;
  height: 20px;
  border-radius: 0 0 18px 18px;
  background: var(--paper);
  opacity: 0.6;
  z-index: 1;
}
.more::after {
  left: 28px;
  right: 28px;
  bottom: -14px;
  opacity: 0.3;
}

/* Карточки после первых пяти: в разметке (их видят поисковики), но свёрнуты под «Show N more cards».
   После раскрытия кнопка пропадает, а счётчик показывает все карточки на странице */
.rest {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.rest > summary {
  list-style: none;
  cursor: pointer;
}
.rest > summary::-webkit-details-marker {
  display: none;
}
.rest[open] > summary,
.rest:not([open]) > article {
  display: none;
}
.rest .chev {
  vertical-align: -2px;
  margin-left: 2px;
}
.shown-all {
  display: none;
}
.cards:has(.rest[open]) .shown-all {
  display: inline;
}
.cards:has(.rest[open]) .shown-part,
.cards:has(.rest:not([open])) > .more {
  display: none;
}

.foot {
  padding-block: 24px 40px;
  color: var(--ink3);
  font-size: 13px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  justify-content: space-between;
}
.foot a {
  color: var(--ink2);
  text-decoration: none;
}

/* 404 */
.gone {
  min-height: 420px;
  display: grid;
  place-items: center;
  text-align: center;
  padding-block: 32px 56px;
}
.gone-in {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: 360px;
}
.gone-cover {
  width: 96px;
  aspect-ratio: 1;
  border-radius: var(--r-cover);
  display: grid;
  place-items: center;
  border: 2px dashed var(--line);
  color: var(--ink3);
}
.gone h1 {
  font-size: 28px;
}
.gone p {
  margin: 0;
  color: var(--ink2);
  font-size: 16px;
}
.gone .open {
  width: 100%;
  margin-top: 8px;
}

/* Колода по ссылке: не в каталоге */
.access {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px 6px 10px;
  border-radius: 15px;
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--ink2);
  font-size: 13px;
  font-weight: 500;
}
.access svg {
  flex: none;
  color: var(--ink3);
}

/* Колода на проверке */
.wait-cover {
  width: 96px;
  aspect-ratio: 1;
  border-radius: var(--r-cover);
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.code-inline {
  font: 500 14px var(--mono);
  letter-spacing: 0.08em;
  color: var(--ink3);
}

@media (prefers-reduced-motion: reduce) {
  .open {
    transition: none;
  }
}
