/* =========================================================
   Волшебный вишлист — тема меняется вместе с факультетом
   ========================================================= */

:root {
  --ink: #f3ecdd;
  --muted: #b6a98f;
  --void: #08060c;
  --radius: 16px;
  --shadow: 0 24px 60px rgba(0, 0, 0, .55);
  --ease: cubic-bezier(.2, .8, .25, 1);

  /* Нейтральная тема экрана распределения: ночное небо над замком.
     Намеренно не совпадает ни с одним факультетом — цвет появляется
     только после выбора. */
  --tint: #2b1b3f;
  --tint-2: #150d21;
  --accent: #d4af37;
  --accent-2: #8a6dbf;
}

html[data-house="gryffindor"] {
  --tint: #6d0a10;
  --tint-2: #2c0508;
  --accent: #d9b44a;
  --accent-2: #c0392b;
  --house-name: "Гриффиндор";
}

html[data-house="slytherin"] {
  --tint: #0c3b26;
  --tint-2: #04150e;
  --accent: #c9ced3;
  --accent-2: #2a9d5c;
  --house-name: "Слизерин";
}

html[data-house="ravenclaw"] {
  --tint: #0d2452;
  --tint-2: #050e22;
  --accent: #cb9a52;
  --accent-2: #4a86c8;
  --house-name: "Когтевран";
}

html[data-house="hufflepuff"] {
  --tint: #4a3708;
  --tint-2: #1d1503;
  --accent: #f0c419;
  --accent-2: #d98b2b;
  --house-name: "Пуффендуй";
}

* { box-sizing: border-box; }

/* Классы ниже задают display, поэтому hidden нужно усилить — иначе
   скрытые экраны и модалки остаются видимыми. */
[hidden] { display: none !important; }

html { background: var(--void); }

/* Фон рисуем прямо на body, без fixed-слоёв: закреплённые фоны
   заметно мерцают при прокрутке длинного списка карточек. */
body {
  margin: 0;
  min-height: 100vh;
  font-family: Spectral, Georgia, serif;
  color: var(--ink);
  overflow-x: hidden;
  background:
    radial-gradient(1.4px 1.4px at 12% 22%, rgba(255, 255, 255, .28) 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 74% 14%, rgba(255, 255, 255, .22) 50%, transparent 51%),
    radial-gradient(1.6px 1.6px at 38% 68%, rgba(255, 255, 255, .18) 50%, transparent 51%),
    radial-gradient(1.1px 1.1px at 88% 58%, rgba(255, 255, 255, .25) 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 22% 88%, rgba(255, 255, 255, .2) 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 62% 92%, rgba(255, 255, 255, .15) 50%, transparent 51%),
    radial-gradient(1200px 800px at 50% 0%, var(--tint) 0%, transparent 62%),
    radial-gradient(900px 700px at 85% 100%, var(--tint-2) 0%, transparent 58%),
    var(--void);
  background-size:
    520px 520px, 520px 520px, 520px 520px,
    520px 520px, 520px 520px, 520px 520px,
    auto, auto, auto;
  background-repeat: repeat, repeat, repeat, repeat, repeat, repeat, no-repeat, no-repeat, no-repeat;
  transition: background-color 900ms var(--ease);
}

/* Парящие огоньки свечей */
.embers { position: fixed; inset: 0; pointer-events: none; z-index: 1; }

.ember {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0;
  box-shadow: 0 0 10px 2px color-mix(in srgb, var(--accent) 60%, transparent);
  animation: drift linear infinite;
}

@keyframes drift {
  0%   { transform: translateY(20vh) scale(.6); opacity: 0; }
  15%  { opacity: .8; }
  85%  { opacity: .6; }
  100% { transform: translateY(-100vh) scale(1.1); opacity: 0; }
}

.eyebrow {
  margin: 0 0 10px;
  font-family: Marcellus, serif;
  letter-spacing: .28em;
  text-transform: uppercase;
  font-size: 11px;
  color: var(--accent);
  opacity: .85;
}

/* =========================================================
   Распределяющая шляпа
   ========================================================= */

.sorting {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 48px 20px;
  animation: fadeIn .7s var(--ease) both;
}

.sorting__inner { max-width: 1000px; text-align: center; }

/* Герб Хогвартса над заголовком: PNG из /images, иначе рисованный щит */
/* Высоту не фиксируем: картинка сама задаёт пропорцию, иначе вокруг
   герба остаются пустые поля. */
.hogwarts {
  width: min(520px, 74vw);
  margin: 0 auto 18px;
  filter: drop-shadow(0 0 44px rgba(212, 175, 55, .4));
  animation: riseIn .7s var(--ease) both, breathe 7s ease-in-out .7s infinite;
}

.hogwarts img,
.hogwarts svg {
  display: block;
  width: 100%;
  height: auto;
}

.sorting__title {
  margin: 0 0 14px;
  font-family: Cinzel, serif;
  font-weight: 600;
  font-size: clamp(30px, 5.5vw, 52px);
  letter-spacing: .01em;
  text-shadow: 0 0 40px color-mix(in srgb, var(--accent) 35%, transparent);
}

.sorting__sub {
  margin: 0 auto 44px;
  max-width: 460px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.7;
}

.crests {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}

/* На телефоне оставляем сетку 2×2: все четыре факультета видно сразу,
   без долгой прокрутки. */
@media (max-width: 860px) {
  .crests { grid-template-columns: repeat(2, 1fr); gap: 12px; }
}

@media (max-width: 520px) {
  .hogwarts { width: min(360px, 86vw); margin-bottom: 12px; }
  .crest { padding: 18px 10px 16px; border-radius: 16px; }
  .crest__art { width: 88px; height: 88px; margin-bottom: 14px; }
  .crest__beast { font-size: 32px; }
  .crest__name { font-size: 15px; }
  .crest__motto { font-size: 11.5px; }
}

/* Кнопка факультета: своя палитра, не зависящая от текущей темы */
.crest {
  --c: var(--crest-accent);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 26px 16px 22px;
  border: 1px solid color-mix(in srgb, var(--c) 28%, transparent);
  border-radius: 20px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--crest-bg) 55%, transparent), rgba(0, 0, 0, .35));
  color: var(--ink);
  cursor: pointer;
  overflow: hidden;
  transition: transform .45s var(--ease), border-color .45s var(--ease), box-shadow .45s var(--ease);
  animation: riseIn .6s var(--ease) both;
  animation-delay: var(--delay, 0s);
}

@keyframes riseIn {
  from { opacity: 0; transform: translateY(26px); }
  to   { opacity: 1; transform: translateY(0); }
}

.crest::after {
  content: "";
  position: absolute;
  inset: -40% -60%;
  background: linear-gradient(115deg, transparent 42%, color-mix(in srgb, var(--c) 26%, transparent) 50%, transparent 58%);
  transform: translateX(-120%);
  transition: transform .9s var(--ease);
}

.crest:hover,
.crest:focus-visible {
  transform: translateY(-10px);
  border-color: color-mix(in srgb, var(--c) 70%, transparent);
  box-shadow: 0 22px 50px rgba(0, 0, 0, .5), 0 0 42px color-mix(in srgb, var(--c) 30%, transparent);
  outline: none;
}

.crest:hover::after,
.crest:focus-visible::after { transform: translateX(120%); }

.crest:active { transform: translateY(-4px) scale(.985); }

/* --- сам герб: PNG или запасной SVG --- */
.crest__art {
  position: relative;
  width: 132px;
  height: 132px;
  display: grid;
  place-items: center;
  margin-bottom: 20px;
  /* Растём от основания вверх, в сторону свободного места: у настоящих
     гербов внизу лента с названием, и она налезала бы на подпись. */
  transform-origin: center bottom;
  transition: transform .5s var(--ease), filter .5s var(--ease);
}

.crest__art img,
.crest__art svg {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.crest:hover .crest__art,
.crest:focus-visible .crest__art {
  transform: scale(1.09);
  filter: drop-shadow(0 0 20px color-mix(in srgb, var(--c) 75%, transparent));
}

/* лёгкое «дыхание» герба в покое */
.crest__art { animation: breathe 5s ease-in-out infinite; }
.crest:hover .crest__art { animation: none; }

@keyframes breathe {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-5px); }
}

.crest__beast {
  position: absolute;
  font-size: 46px;
  line-height: 1;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .5));
}

/* Подписи поверх герба: если картинка окажется выше ожидаемого,
   текст всё равно останется читаемым. */
.crest__name {
  position: relative;
  z-index: 1;
  font-family: Cinzel, serif;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--c);
}

.crest__motto {
  position: relative;
  z-index: 1;
  font-size: 12.5px;
  color: var(--muted);
  font-style: italic;
}

/* =========================================================
   Витрина
   ========================================================= */

.page {
  position: relative;
  z-index: 2;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px 80px;
  animation: fadeIn .8s var(--ease) both;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.hero {
  text-align: center;
  padding: 56px 0 46px;
}

.hero__crest {
  width: 108px;
  height: 108px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  position: relative;
  filter: drop-shadow(0 0 26px color-mix(in srgb, var(--accent) 45%, transparent));
  animation: breathe 6s ease-in-out infinite;
}

.hero__crest img,
.hero__crest svg { width: 100%; height: 100%; object-fit: contain; }

.hero__crest .crest__beast { font-size: 38px; }

.hero__title {
  margin: 0 0 22px;
  font-family: Cinzel, serif;
  font-weight: 600;
  font-size: clamp(28px, 5vw, 46px);
  line-height: 1.15;
  text-shadow: 0 0 44px color-mix(in srgb, var(--accent) 30%, transparent);
}

/* Блок «про праздник» */
.facts {
  list-style: none;
  margin: 0 auto 22px;
  padding: 16px 22px;
  max-width: 660px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 26px;
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .03);
  backdrop-filter: blur(3px);
}

.facts li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  color: var(--ink);
}

.facts li b {
  font-weight: 400;
  color: var(--accent);
  font-family: Marcellus, serif;
}

.hero__desc {
  max-width: 560px;
  margin: 0 auto 24px;
  color: var(--muted);
  line-height: 1.75;
  font-size: 16px;
}

/* =========================================================
   Кнопки
   ========================================================= */

.btn {
  font-family: Marcellus, serif;
  font-size: 15px;
  letter-spacing: .03em;
  padding: 12px 24px;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease),
              background-color .25s var(--ease), color .25s var(--ease);
}

.btn:active { transform: scale(.97); }

.btn--primary {
  background: var(--accent);
  color: #17110a;
  font-weight: 600;
  box-shadow: 0 10px 30px color-mix(in srgb, var(--accent) 28%, transparent);
}

.btn--primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 38px color-mix(in srgb, var(--accent) 42%, transparent);
}

.btn--primary:disabled {
  opacity: .55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn--ghost {
  background: transparent;
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
}

.btn--ghost:hover {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  transform: translateY(-2px);
}

.btn--full { width: 100%; }

/* =========================================================
   Сетка подарков
   ========================================================= */

.gifts__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  padding-bottom: 14px;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
}

.gifts__title {
  margin: 0;
  font-family: Cinzel, serif;
  font-weight: 600;
  font-size: 24px;
}

.gifts__count { margin: 0; color: var(--muted); font-size: 14px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 22px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, .055), rgba(255, 255, 255, .02));
  overflow: hidden;
  transition: transform .4s var(--ease), border-color .4s var(--ease), box-shadow .4s var(--ease);
  animation: riseIn .5s var(--ease) both;
  animation-delay: var(--delay, 0s);
}

.card:hover {
  transform: translateY(-8px);
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  box-shadow: var(--shadow), 0 0 34px color-mix(in srgb, var(--accent) 16%, transparent);
}

.card--booked { opacity: .62; }
.card--booked:hover { transform: none; box-shadow: none; }

.card__media {
  position: relative;
  aspect-ratio: 4 / 3;
  background: rgba(0, 0, 0, .3);
  overflow: hidden;
}

.card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .6s var(--ease);
}

.card:hover .card__media img { transform: scale(1.06); }

.card__noimg {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-size: 42px;
  opacity: .35;
}

.card--booked .card__media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(6, 4, 10, .55);
}

.badge {
  position: absolute;
  z-index: 2;
  top: 12px;
  left: 12px;
  padding: 5px 12px;
  border-radius: 999px;
  font-family: Marcellus, serif;
  font-size: 11.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.badge--free {
  background: color-mix(in srgb, var(--accent) 22%, rgba(0, 0, 0, .55));
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
}

.badge--taken {
  background: rgba(0, 0, 0, .6);
  color: #cfc6b4;
  border: 1px solid rgba(255, 255, 255, .18);
}

.card__body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
  flex: 1;
}

.card__title {
  margin: 0;
  font-family: Marcellus, serif;
  font-size: 17.5px;
  line-height: 1.4;
}

.card__price {
  margin: 0;
  font-family: Cinzel, serif;
  font-size: 19px;
  color: var(--accent);
}

.card__actions {
  margin-top: auto;
  display: flex;
  gap: 10px;
  padding-top: 6px;
}

.card__actions .btn { flex: 1; text-align: center; padding: 11px 14px; font-size: 14px; }

.card__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 70px 20px;
  color: var(--muted);
  border: 1px dashed color-mix(in srgb, var(--accent) 25%, transparent);
  border-radius: var(--radius);
}

.empty__icon { font-size: 46px; display: block; margin-bottom: 14px; opacity: .7; }

.footer {
  margin-top: 64px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  opacity: .7;
}

/* =========================================================
   Модальные окна
   ========================================================= */

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 2, 8, .78);
  backdrop-filter: blur(6px);
  animation: fadeIn .3s var(--ease) both;
}

.modal__box {
  position: relative;
  width: min(460px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  padding: 30px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-radius: 20px;
  background: linear-gradient(180deg, #17111d, #100b16);
  box-shadow: var(--shadow), 0 0 70px color-mix(in srgb, var(--accent) 18%, transparent);
  animation: popIn .4s var(--ease) both;
}

@keyframes popIn {
  from { opacity: 0; transform: translateY(24px) scale(.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal__x {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  transition: color .2s, background-color .2s;
}

.modal__x:hover { color: var(--accent); background: rgba(255, 255, 255, .06); }

.modal__title {
  margin: 0 0 20px;
  font-family: Cinzel, serif;
  font-weight: 600;
  font-size: 25px;
}

.modal__gift {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 14px;
  margin-bottom: 22px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .07);
}

.modal__gift img {
  width: 62px;
  height: 62px;
  object-fit: cover;
  border-radius: 9px;
  flex-shrink: 0;
}

.modal__giftTitle { margin: 0 0 4px; font-family: Marcellus, serif; font-size: 16px; }
.modal__giftPrice { margin: 0; color: var(--accent); font-size: 15px; }
.modal__giftPrice:empty { display: none; }

.field { display: block; margin-bottom: 8px; }

.field__label {
  display: block;
  margin-bottom: 7px;
  font-family: Marcellus, serif;
  font-size: 13.5px;
  color: var(--muted);
  letter-spacing: .04em;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .14);
  background: rgba(0, 0, 0, .3);
  color: var(--ink);
  font-family: Spectral, Georgia, serif;
  font-size: 15px;
  transition: border-color .25s, box-shadow .25s;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.field input::placeholder { color: rgba(255, 255, 255, .25); }

.field__hint {
  margin: 0 0 18px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--muted);
  opacity: .85;
}

.field__error {
  margin: 0 0 16px;
  padding: 10px 13px;
  border-radius: 9px;
  background: rgba(192, 57, 43, .16);
  border: 1px solid rgba(192, 57, 43, .45);
  color: #f0b8b2;
  font-size: 13.5px;
}

.done { text-align: center; padding: 6px 0; }

.done__seal {
  font-size: 62px;
  margin-bottom: 14px;
  animation: popIn .6s var(--ease) both, breathe 4s ease-in-out 1s infinite;
}

.done__text {
  margin: 0 0 26px;
  color: var(--muted);
  line-height: 1.75;
  font-size: 15px;
}

.done__text b { color: var(--accent); font-weight: 400; }

/* =========================================================
   Звук
   ========================================================= */

.sound {
  position: fixed;
  z-index: 40;
  right: 20px;
  bottom: 20px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  cursor: pointer;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  background: rgba(10, 7, 14, .8);
  color: var(--accent);
  backdrop-filter: blur(8px);
  transition: transform .3s var(--ease), box-shadow .3s var(--ease);
}

.sound:hover {
  transform: scale(1.1);
  box-shadow: 0 0 24px color-mix(in srgb, var(--accent) 40%, transparent);
}

.sound__icon { font-size: 19px; line-height: 1; }

.sound--off { opacity: .55; }
.sound--off .sound__icon::after {
  content: "";
  position: absolute;
  left: 12px;
  top: 22px;
  width: 22px;
  height: 1.5px;
  background: currentColor;
  transform: rotate(-45deg);
}

.sound--pulse { animation: pulse 2.2s ease-in-out infinite; }

/* Пока браузер ждёт действия человека, подсказываем, что звук вообще есть:
   одна пульсирующая иконка в углу слишком легко теряется. */
.sound--pulse::before {
  content: "Включить музыку";
  position: absolute;
  right: 58px;
  top: 50%;
  transform: translateY(-50%);
  padding: 7px 13px;
  border-radius: 8px;
  white-space: nowrap;
  font-family: Marcellus, serif;
  font-size: 13px;
  color: var(--accent);
  background: rgba(10, 7, 14, .92);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  animation: fadeIn .5s var(--ease) both;
  pointer-events: none;
}

@media (max-width: 420px) {
  .sound--pulse::before { font-size: 12px; padding: 6px 10px; right: 54px; }
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent); }
  50%      { box-shadow: 0 0 0 12px transparent; }
}

/* =========================================================
   Искры при клике
   ========================================================= */

.spark {
  position: fixed;
  z-index: 60;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  pointer-events: none;
  box-shadow: 0 0 8px 2px color-mix(in srgb, var(--accent) 70%, transparent);
  animation: sparkFly .75s ease-out forwards;
}

@keyframes sparkFly {
  from { transform: translate(0, 0) scale(1); opacity: 1; }
  to   { transform: translate(var(--dx), var(--dy)) scale(0); opacity: 0; }
}

/* =========================================================
   Тайная комната
   ========================================================= */

.secret {
  position: relative;
  z-index: 2;
  max-width: 940px;
  margin: 0 auto;
  padding: 44px 20px 80px;
}

.secret__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 30px;
  padding-bottom: 18px;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 20%, transparent);
}

.secret__title {
  margin: 0;
  font-family: Cinzel, serif;
  font-weight: 600;
  font-size: clamp(24px, 4vw, 34px);
}

.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  position: relative;
  z-index: 2;
}

.gate__box {
  width: min(400px, 100%);
  padding: 36px 30px;
  text-align: center;
  border: 1px solid color-mix(in srgb, var(--accent) 32%, transparent);
  border-radius: 20px;
  background: linear-gradient(180deg, #17111d, #100b16);
  box-shadow: var(--shadow);
  animation: popIn .5s var(--ease) both;
}

.gate__icon { font-size: 50px; margin-bottom: 12px; }

.panel {
  padding: 26px;
  border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .035);
  margin-bottom: 30px;
}

.panel__title {
  margin: 0 0 20px;
  font-family: Cinzel, serif;
  font-size: 19px;
  font-weight: 600;
  color: var(--accent);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.form-grid .field { margin-bottom: 0; }
.form-grid .field--wide { grid-column: 1 / -1; }

.rows { display: flex; flex-direction: column; gap: 12px; }

.row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 12px;
  background: rgba(0, 0, 0, .22);
  transition: border-color .3s var(--ease);
}

.row:hover { border-color: color-mix(in srgb, var(--accent) 40%, transparent); }

.row__img {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: rgba(255, 255, 255, .05);
}

.row__main { flex: 1; min-width: 0; }

.row__title {
  margin: 0 0 3px;
  font-family: Marcellus, serif;
  font-size: 15.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row__meta { margin: 0; font-size: 13px; color: var(--muted); }
.row__meta a { color: var(--accent); opacity: .8; }

.row__actions { display: flex; gap: 8px; flex-shrink: 0; }

.icon-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, .14);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 15px;
  transition: all .25s var(--ease);
}

.icon-btn:hover { color: var(--accent); border-color: var(--accent); }
.icon-btn--danger:hover { color: #ef8b80; border-color: #ef8b80; background: rgba(192, 57, 43, .14); }

/* Подсказка со списком плейсхолдеров письма */
.hints {
  margin-top: 6px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 10px;
  background: rgba(0, 0, 0, .2);
  font-size: 13px;
  color: var(--muted);
}

.hints summary {
  cursor: pointer;
  font-family: Marcellus, serif;
  color: var(--accent);
  letter-spacing: .03em;
}

.hints__grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 7px 14px;
  align-items: baseline;
  margin: 14px 0 10px;
}

.hints code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  color: var(--accent);
  background: rgba(255, 255, 255, .06);
  padding: 2px 7px;
  border-radius: 5px;
  white-space: nowrap;
}

.hints p { margin: 0; opacity: .8; }

/* Предпросмотр текста письма */
.preview {
  margin: 18px 0 0;
  padding: 18px;
  max-height: 340px;
  overflow: auto;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: 12px;
  background: rgba(0, 0, 0, .34);
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.toast {
  position: fixed;
  z-index: 70;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  padding: 13px 22px;
  border-radius: 11px;
  background: rgba(12, 8, 16, .95);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  color: var(--ink);
  font-size: 14.5px;
  box-shadow: var(--shadow);
  animation: popIn .35s var(--ease) both;
}

.toast--bad { border-color: rgba(192, 57, 43, .6); color: #f0b8b2; }

/* =========================================================
   Доступность
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
