/* ==========================================================================
   Логово Утех — дизайн-система
   Чёрный фон, красный — главный цвет (кнопки, активные состояния),
   тёплый оранжевый — ссылки, даты, цифры и иконки.
   ========================================================================== */

:root {
  --bg: #0b0807;
  --bg-2: #110b0a;
  --surface: #171010;
  --surface-2: #1f1614;
  --surface-3: #2b1c19;
  --border: #35231f;
  --border-strong: #4d2f28;
  --text: #f8eee8;
  --text-2: #d9c5ba;
  --muted: #a2887b;
  --accent: #e0383c;
  --accent-hover: #f24d45;
  --accent-text: #ff6f5e;
  --accent-ink: #fff6f1;
  --accent-soft: rgba(224, 56, 60, 0.15);
  --warm: #ff8a3d;
  --warm-hover: #ffa564;
  --warm-soft: rgba(255, 138, 61, 0.14);
  --fire: linear-gradient(135deg, #ff7a3d 0%, #e0383c 55%, #b81d2e 100%);
  --wine: #8c1d2b;
  --success: #f2c14e;
  --warning: #ff8a3d;
  --danger: #ff5a5f;
  --info: #ffb38a;
  --glow: rgba(224, 56, 60, 0.17);
  --glow-warm: rgba(255, 138, 61, 0.09);
  --shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.85);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.35);
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --header-h: 68px;
  color-scheme: dark;
}

/* ---------- База ---------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background:
    radial-gradient(1100px 520px at 50% -200px, var(--glow), transparent 70%),
    radial-gradient(700px 420px at 100% -60px, var(--glow-warm), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: lining-nums;
  overflow-x: hidden;
}

main { flex: 1 0 auto; }

h1, h2, h3, h4 { margin: 0 0 0.4em; line-height: 1.15; color: var(--text); }
h1, h2 { font-family: var(--font-display); font-weight: 700; letter-spacing: 0.005em; }
h1 { font-size: clamp(2.1rem, 4.4vw, 3rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.1rem); }
h3 { font-size: 1.15rem; font-weight: 800; }
h4 { font-size: 1rem; font-weight: 800; }
p { margin: 0 0 1em; }
a { color: var(--warm); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--warm-hover); }
img { max-width: 100%; display: block; }
hr { border: 0; border-top: 1px solid var(--border); margin: 24px 0; }
code { font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; font-size: 0.9em; }
::selection { background: var(--accent); color: var(--accent-ink); }

:focus-visible { outline: 2px solid var(--warm); outline-offset: 2px; border-radius: 6px; }

.icon {
  width: 1.15em;
  height: 1.15em;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -0.2em;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---------- Раскладка ---------- */

.container { width: min(1200px, 100% - 32px); margin-inline: auto; }
.container-narrow { width: min(760px, 100% - 32px); margin-inline: auto; }
.section { padding-block: 56px; }
.section-tight { padding-block: 32px; }
.section-alt { background: linear-gradient(180deg, transparent, var(--bg-2) 18%, var(--bg-2) 82%, transparent); }

.section-head {
  display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: flex-end; justify-content: space-between;
  margin-bottom: 24px;
}
.section-head h2 { margin: 0; }
.section-head p { margin: 4px 0 0; color: var(--muted); }

.page-head {
  display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: flex-end; justify-content: space-between;
  padding: 40px 0 24px;
}
.page-head h1 { margin: 0; }
.page-head .lead { margin: 6px 0 0; color: var(--text-2); max-width: 640px; }
.breadcrumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 0.88rem; color: var(--muted); margin-bottom: 10px; }
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--warm); }

.grid { display: grid; gap: 20px; }
.grid-cards { grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.stack > * + * { margin-top: var(--gap, 16px); }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row-between { justify-content: space-between; }
.row-end { justify-content: flex-end; }
.nowrap { white-space: nowrap; }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.small { font-size: 0.875rem; }
.tiny { font-size: 0.78rem; }
.strong { font-weight: 700; }
.center { text-align: center; }
.mt-0 { margin-top: 0 !important; }
.mb-0 { margin-bottom: 0 !important; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.w-full { width: 100%; }

/* ---------- Шапка ---------- */

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.header-inner { height: var(--header-h); display: flex; align-items: center; gap: 20px; }

.brand {
  display: flex; align-items: center; gap: 10px; flex-shrink: 0;
  font-family: var(--font-display); font-weight: 700; font-size: 1.55rem; line-height: 1;
  color: var(--text); text-decoration: none; white-space: nowrap;
}
.brand:hover { color: var(--text); }
.brand img { width: 36px; height: 36px; border-radius: 10px; }

.main-nav { display: flex; gap: 2px; }
.main-nav a {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: 10px;
  color: var(--text-2); text-decoration: none; font-weight: 700; font-size: 0.94rem;
  transition: background 0.15s, color 0.15s;
}
.main-nav a .icon { display: none; }
.main-nav a:hover { background: var(--surface-2); color: var(--text); }
.main-nav a.active { color: var(--accent-text); background: var(--accent-soft); }

.header-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }

.icon-btn {
  position: relative; width: 40px; height: 40px; flex-shrink: 0;
  display: inline-grid; place-items: center;
  border-radius: 12px; border: 1px solid transparent; background: transparent;
  color: var(--text-2); cursor: pointer; text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn .icon { width: 20px; height: 20px; }
.count-badge {
  position: absolute; top: 3px; right: 2px;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--danger); color: #fff; font-size: 11px; font-weight: 800; line-height: 18px; text-align: center;
  box-shadow: 0 0 0 2px var(--bg);
}

.burger { display: none; }

.dropdown { position: relative; }
.user-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 10px 4px 4px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font: inherit; font-weight: 700; font-size: 0.9rem; cursor: pointer;
}
.user-chip:hover { border-color: var(--border-strong); }
.user-chip .icon { width: 16px; height: 16px; color: var(--muted); transition: transform 0.15s; }
.dropdown.open .user-chip .icon { transform: rotate(180deg); }
.user-chip-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 60;
  min-width: 250px; padding: 8px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius);
  box-shadow: var(--shadow);
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity 0.15s, transform 0.15s, visibility 0.15s;
}
.dropdown.open .dropdown-menu { opacity: 1; visibility: visible; transform: none; }
.dropdown-head { padding: 10px 12px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.dropdown-head strong { display: block; }
.dropdown-menu a, .dropdown-menu button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 12px; border-radius: 10px; border: 0; background: none;
  color: var(--text-2); font: inherit; font-weight: 600; font-size: 0.93rem; text-align: left; text-decoration: none; cursor: pointer;
}
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--surface-2); color: var(--text); }
.dropdown-menu hr { margin: 6px 0; }
.dropdown-menu .count { margin-left: auto; }

@media (max-width: 1100px) {
  .burger { display: inline-grid; }
  /* backdrop-filter шапки делает её контейнером для fixed, поэтому высоту задаём явно. */
  .main-nav {
    position: fixed; left: 0; right: 0; top: var(--header-h); height: calc(100dvh - var(--header-h));
    flex-direction: column; gap: 4px; padding: 16px;
    background: var(--bg); border-top: 1px solid var(--border);
    overflow-y: auto;
    opacity: 0; visibility: hidden; transform: translateY(-8px);
    transition: opacity 0.18s, transform 0.18s, visibility 0.18s;
  }
  .main-nav.open { opacity: 1; visibility: visible; transform: none; }
  .main-nav a { padding: 14px 16px; font-size: 1.05rem; }
  .main-nav a .icon { display: block; color: var(--warm); }
  body.nav-open { overflow: hidden; }
}
@media (max-width: 560px) {
  .brand { font-size: 1.3rem; }
  .brand span { display: none; }
  .user-chip-name, .user-chip .icon { display: none; }
  .user-chip { padding: 3px; }
  .header-auth .btn-ghost { display: none; }
}

.announce {
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 22%, var(--surface)), var(--surface));
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem; font-weight: 600;
}
.announce .container { display: flex; gap: 10px; align-items: center; padding: 10px 0; }
.announce .icon { color: var(--warm); }

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

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; min-height: 42px;
  border-radius: 12px; border: 1px solid var(--border-strong);
  background: var(--surface-2); color: var(--text);
  font: inherit; font-weight: 700; font-size: 0.94rem; line-height: 1.2;
  text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.05s, box-shadow 0.15s;
}
.btn:hover { border-color: var(--accent); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn .icon { width: 18px; height: 18px; }
.btn-primary {
  background: var(--fire);
  border-color: #c92a34; color: var(--accent-ink);
  text-shadow: 0 1px 1px rgba(80, 0, 0, 0.35);
  box-shadow: 0 8px 22px -10px color-mix(in srgb, var(--accent) 85%, transparent);
}
.btn-primary:hover { border-color: var(--accent-hover); color: var(--accent-ink); filter: brightness(1.08) saturate(1.05); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); border-color: transparent; color: var(--text); }
.btn-outline { background: transparent; }
.btn-danger { background: transparent; border-color: color-mix(in srgb, var(--danger) 45%, transparent); color: var(--danger); }
.btn-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-success { background: transparent; border-color: color-mix(in srgb, var(--success) 45%, transparent); color: var(--success); }
.btn-success:hover { background: var(--success); border-color: var(--success); color: #fff; }
.btn-sm { min-height: 34px; padding: 6px 12px; font-size: 0.85rem; border-radius: 10px; }
.btn-sm .icon { width: 16px; height: 16px; }
.btn-lg { min-height: 52px; padding: 14px 26px; font-size: 1.04rem; border-radius: 14px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }
.btn-icon { width: 38px; padding: 0; }
.btn-icon.btn-sm { width: 34px; }
.link-btn { border: 0; background: none; padding: 0; font: inherit; color: var(--warm); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
form.inline { display: inline; }

/* ---------- Формы ---------- */

.form { display: flex; flex-direction: column; gap: 18px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.span-2, .span-all { grid-column: 1 / -1; }
@media (max-width: 720px) {
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
}

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-weight: 700; font-size: 0.9rem; color: var(--text-2); }
.req::after { content: ' *'; color: var(--accent); }

.input {
  width: 100%; min-height: 44px; padding: 10px 14px;
  border-radius: 12px; border: 1px solid var(--border-strong);
  background: var(--bg-2); color: var(--text);
  font: inherit; font-size: 0.97rem;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.input::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
.input:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--border-strong)); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--surface); }
textarea.input { min-height: 120px; resize: vertical; line-height: 1.55; }
textarea.input.tall { min-height: 280px; }
select.input {
  appearance: none; -webkit-appearance: none; padding-right: 40px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a2887b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 18px;
}
input[type="color"].input { padding: 4px; height: 44px; cursor: pointer; }
input[type="file"].input { padding: 9px 12px; cursor: pointer; }
input[type="file"].input::file-selector-button {
  margin-right: 12px; padding: 6px 12px; border-radius: 8px; border: 1px solid var(--border-strong);
  background: var(--surface-2); color: var(--text); font: inherit; font-weight: 700; font-size: 0.85rem; cursor: pointer;
}
.input.has-error { border-color: var(--danger); }
.hint { font-size: 0.82rem; color: var(--muted); }
.field-error { font-size: 0.85rem; color: var(--danger); font-weight: 600; }

.input-group { position: relative; }
.input-group .input { padding-right: 46px; }
.input-group .icon-btn { position: absolute; right: 2px; top: 2px; }

.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; font-weight: 600; color: var(--text-2); }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--accent); flex-shrink: 0; cursor: pointer; }
.check small { display: block; font-weight: 500; color: var(--muted); }

.fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin: 0; }
.fieldset legend { padding: 0 8px; font-weight: 800; color: var(--text); }

.form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding-top: 4px; }

.cover-preview {
  position: relative; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border);
  max-width: 360px; aspect-ratio: 16 / 9; background: var(--surface-2);
}
.cover-preview img { width: 100%; height: 100%; object-fit: cover; }
.cover-preview[hidden] { display: none; }

.honeypot { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Карточки и панели ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-body { padding: 22px; }
.card-body-lg { padding: 28px; }
@media (max-width: 560px) { .card-body-lg { padding: 20px; } }
.card-head {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between;
  padding: 16px 22px; border-bottom: 1px solid var(--border);
}
.card-head h2, .card-head h3 { margin: 0; font-size: 1.15rem; font-family: var(--font); font-weight: 800; }
.card-foot { padding: 14px 22px; border-top: 1px solid var(--border); }
.card-link { color: inherit; text-decoration: none; transition: border-color 0.15s, transform 0.15s; }
.card-link:hover { color: inherit; border-color: var(--border-strong); transform: translateY(-2px); }

/* ---------- Бейджи ---------- */

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 0.76rem; font-weight: 800; line-height: 1.5; letter-spacing: 0.01em; white-space: nowrap;
  background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border);
}
.badge .icon { width: 13px; height: 13px; }
.badge-success { color: var(--success); background: color-mix(in srgb, var(--success) 13%, transparent); border-color: color-mix(in srgb, var(--success) 30%, transparent); }
.badge-warning { color: var(--warning); background: color-mix(in srgb, var(--warning) 13%, transparent); border-color: color-mix(in srgb, var(--warning) 30%, transparent); }
.badge-danger { color: var(--danger); background: color-mix(in srgb, var(--danger) 13%, transparent); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.badge-info { color: var(--info); background: color-mix(in srgb, var(--info) 13%, transparent); border-color: color-mix(in srgb, var(--info) 30%, transparent); }
.badge-accent { color: var(--accent-text); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.badge-muted { color: var(--muted); }
.badge-kind { color: var(--kind); background: color-mix(in srgb, var(--kind) 14%, transparent); border-color: color-mix(in srgb, var(--kind) 32%, transparent); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 4px 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: 0.84rem; font-weight: 600; color: var(--text-2); }

/* ---------- Аватары ---------- */

.avatar {
  display: inline-grid; place-items: center; flex-shrink: 0;
  border-radius: 50%; object-fit: cover;
  background: hsl(var(--hue, 30) 42% 36%); color: #fff;
  font-weight: 800; letter-spacing: 0.02em; line-height: 1;
}
.avatar-empty { background: var(--surface-3); color: var(--muted); }
.avatar-empty .icon { width: 55%; height: 55%; }
.avatar-xs { width: 22px; height: 22px; font-size: 0.6rem; }
.avatar-sm { width: 28px; height: 28px; font-size: 0.7rem; }
.avatar-md { width: 40px; height: 40px; font-size: 0.9rem; }
.avatar-lg { width: 64px; height: 64px; font-size: 1.3rem; }
.avatar-xl { width: 112px; height: 112px; font-size: 2.2rem; box-shadow: 0 0 0 4px var(--surface), 0 0 0 5px var(--border-strong); }

.person { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; min-width: 0; }
.person:hover { color: var(--warm); }
.person-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person small { display: block; color: var(--muted); font-weight: 500; }

/* ---------- Уведомления на странице ---------- */

.flash-stack {
  position: fixed; top: calc(var(--header-h) + 12px); right: 16px; z-index: 80;
  display: flex; flex-direction: column; gap: 10px;
  width: min(400px, calc(100% - 32px));
  pointer-events: none;
}
.flash {
  pointer-events: auto;
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 14px 14px 16px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-left: 4px solid var(--info);
  box-shadow: var(--shadow);
  animation: flash-in 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.2);
  transition: opacity 0.25s, transform 0.25s;
}
.flash.hide { opacity: 0; transform: translateX(20px); }
.flash-text { flex: 1; font-weight: 600; font-size: 0.93rem; padding-top: 1px; }
.flash > .icon { width: 20px; height: 20px; margin-top: 1px; color: var(--info); }
.flash-success { border-left-color: var(--success); }
.flash-success > .icon { color: var(--success); }
.flash-error { border-left-color: var(--danger); }
.flash-error > .icon { color: var(--danger); }
.flash-warning { border-left-color: var(--warning); }
.flash-warning > .icon { color: var(--warning); }
.flash-close { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 2px; border-radius: 6px; display: grid; }
.flash-close:hover { color: var(--text); }
.flash-close .icon { width: 16px; height: 16px; }
@keyframes flash-in { from { opacity: 0; transform: translateY(-10px) scale(0.98); } }

.alert {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 16px; border-radius: 14px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-2); font-size: 0.94rem;
}
.alert > .icon { width: 20px; height: 20px; margin-top: 1px; }
.alert strong { color: var(--text); }
.alert p:last-child { margin-bottom: 0; }
.alert-info { background: color-mix(in srgb, var(--info) 9%, var(--surface)); border-color: color-mix(in srgb, var(--info) 28%, transparent); }
.alert-info > .icon { color: var(--info); }
.alert-success { background: color-mix(in srgb, var(--success) 9%, var(--surface)); border-color: color-mix(in srgb, var(--success) 28%, transparent); }
.alert-success > .icon { color: var(--success); }
.alert-warning { background: color-mix(in srgb, var(--warning) 9%, var(--surface)); border-color: color-mix(in srgb, var(--warning) 28%, transparent); }
.alert-warning > .icon { color: var(--warning); }
.alert-danger { background: color-mix(in srgb, var(--danger) 9%, var(--surface)); border-color: color-mix(in srgb, var(--danger) 28%, transparent); }
.alert-danger > .icon { color: var(--danger); }

/* ---------- Главная: hero ---------- */

.hero { position: relative; padding: 64px 0 40px; overflow: hidden; }
.hero-inner { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 40px; align-items: center; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-text);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  font-weight: 800; font-size: 0.82rem; letter-spacing: 0.04em; text-transform: uppercase;
}
.hero-title {
  font-size: clamp(3rem, 8vw, 5.6rem); line-height: 0.95; margin: 20px 0 18px;
  background: linear-gradient(180deg, var(--text) 20%, var(--warm) 70%, var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-lead { font-size: clamp(1.05rem, 1.6vw, 1.25rem); color: var(--text-2); max-width: 540px; margin-bottom: 28px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 12px 36px; margin: 36px 0 0; }
.hero-stats div { display: flex; flex-direction: column; }
.hero-stats dt { font-family: var(--font-display); font-size: 2.4rem; font-weight: 700; line-height: 1; color: var(--warm); }
.hero-stats dd { margin: 4px 0 0; color: var(--muted); font-weight: 600; font-size: 0.9rem; }

.hero-art { position: relative; display: grid; place-items: center; min-height: 420px; }
.hero-d20 {
  width: min(360px, 80%); height: auto;
  filter: drop-shadow(0 30px 60px color-mix(in srgb, var(--accent) 45%, transparent));
  animation: float 7s ease-in-out infinite;
}
.hero-d20 .face { fill: color-mix(in srgb, var(--accent) 22%, var(--surface)); stroke: var(--warm); stroke-width: 2.2; stroke-linejoin: round; }
.hero-d20 .face-top { fill: color-mix(in srgb, var(--accent) 42%, var(--surface)); }
.hero-d20 .face-dark { fill: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.hero-d20 text { fill: var(--warm); font-family: var(--font-display); font-weight: 700; }
.hero-glow {
  position: absolute; inset: 10% 10%; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 30%, transparent), transparent 65%);
  filter: blur(20px);
}
@keyframes float { 50% { transform: translateY(-14px) rotate(3deg); } }
@media (prefers-reduced-motion: reduce) { .hero-d20 { animation: none; } }

.next-card {
  position: absolute; left: 0; bottom: 18px; width: min(300px, 90%);
  padding: 16px 18px; border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border-strong); box-shadow: var(--shadow);
  color: var(--text); text-decoration: none;
  transition: transform 0.15s, border-color 0.15s;
}
.next-card:hover { color: var(--text); transform: translateY(-3px); border-color: var(--accent); }
.next-card .tiny { text-transform: uppercase; letter-spacing: 0.06em; font-weight: 800; color: var(--warm); }
.next-card strong { display: block; font-size: 1.05rem; margin: 4px 0 6px; }

@media (max-width: 900px) {
  .hero { padding-top: 36px; }
  .hero-inner { grid-template-columns: 1fr; gap: 12px; }
  .hero-art { min-height: 0; }
  .hero-d20 { display: none; }
  .hero-glow { display: none; }
  .next-card { position: static; width: 100%; }
}

.steps { counter-reset: step; }
.step { position: relative; padding: 26px 24px 24px; }
.step-num {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; margin-bottom: 14px;
  background: var(--accent-soft); color: var(--accent-text); font-family: var(--font-display); font-weight: 700; font-size: 1.5rem;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}
.step h3 { margin-bottom: 6px; }
.step p { margin: 0; color: var(--muted); }

.cta-band {
  display: flex; flex-wrap: wrap; gap: 24px; align-items: center; justify-content: space-between;
  padding: 36px; border-radius: var(--radius-lg);
  background:
    radial-gradient(600px 220px at 0% 0%, color-mix(in srgb, var(--accent) 30%, transparent), transparent),
    radial-gradient(500px 200px at 100% 100%, color-mix(in srgb, var(--warm) 14%, transparent), transparent),
    linear-gradient(135deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border-strong);
}
.cta-band h2 { margin: 0 0 6px; }
.cta-band p { margin: 0; color: var(--text-2); max-width: 560px; }

/* ---------- Карточка события ---------- */

.event-card {
  --kind: var(--accent);
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; color: inherit; text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s, border-color 0.18s, box-shadow 0.18s;
}
.event-card:hover { color: inherit; transform: translateY(-3px); border-color: color-mix(in srgb, var(--kind) 55%, var(--border)); box-shadow: var(--shadow); }
.event-card.is-cancelled { opacity: 0.65; }
.event-card.is-cancelled .event-title { text-decoration: line-through; text-decoration-thickness: 2px; }

.event-cover { position: relative; aspect-ratio: 16 / 8; overflow: hidden; background: var(--surface-2); }
.event-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s; }
.event-card:hover .event-cover img { transform: scale(1.04); }
.cover-placeholder {
  width: 100%; height: 100%; display: grid; place-items: center;
  background:
    radial-gradient(circle at 25% 20%, color-mix(in srgb, var(--kind) 45%, transparent), transparent 55%),
    radial-gradient(circle at 85% 90%, color-mix(in srgb, var(--kind) 22%, transparent), transparent 50%),
    linear-gradient(135deg, var(--surface-3), var(--surface-2));
}
.cover-placeholder .icon { width: 64px; height: 64px; color: color-mix(in srgb, var(--kind) 70%, var(--text)); opacity: 0.55; stroke-width: 1.4; }
.cover-badges { position: absolute; left: 12px; right: 12px; top: 12px; display: flex; gap: 6px; flex-wrap: wrap; justify-content: space-between; }
.badge-cover { background: rgba(15, 11, 8, 0.72); color: #fff; border-color: rgba(255, 255, 255, 0.14); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.badge-cover .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--kind); }
.badge-cover.mine { background: color-mix(in srgb, var(--success) 85%, #000); border-color: transparent; }

.event-body { flex: 1; display: flex; flex-direction: column; gap: 6px; padding: 16px 18px 18px; }
.event-when { display: flex; align-items: center; gap: 6px; font-size: 0.84rem; font-weight: 800; color: var(--warm); }
.event-when .icon { width: 15px; height: 15px; }
.event-title { margin: 2px 0 0; font-size: 1.14rem; line-height: 1.25; }
.event-system { font-size: 0.86rem; color: var(--text-2); font-weight: 600; }
.event-summary { margin: 2px 0 0; font-size: 0.9rem; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.event-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.event-foot {
  margin-top: auto; padding-top: 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border-top: 1px dashed var(--border);
  font-size: 0.86rem;
}
.event-foot .person-name { font-weight: 600; color: var(--text-2); max-width: 150px; }

.seats-mini { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; white-space: nowrap; color: var(--success); }
.seats-mini::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.seats-mini.low { color: var(--warning); }
.seats-mini.full, .seats-mini.danger { color: var(--danger); }

.seat-bar { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.seat-bar > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--success), color-mix(in srgb, var(--success) 70%, var(--accent))); }
.seat-bar.low > i { background: var(--warning); }
.seat-bar.full > i { background: var(--danger); }

/* ---------- Афиша ---------- */

.filters {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  padding: 12px; margin-bottom: 28px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.filters .input { width: auto; min-height: 40px; padding-block: 8px; font-size: 0.92rem; }
.filters select.input { max-width: 200px; }
.filters .search { flex: 1 1 220px; position: relative; }
.filters .search .input { width: 100%; padding-left: 40px; }
.filters .search .icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); }
@media (max-width: 640px) { .filters select.input { max-width: none; flex: 1 1 140px; } }

.chip-check {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px;
  padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border-strong);
  font-weight: 700; font-size: 0.87rem; color: var(--text-2); cursor: pointer; user-select: none;
  transition: 0.15s;
}
.chip-check input { position: absolute; opacity: 0; pointer-events: none; }
.chip-check .icon { width: 16px; height: 16px; }
.chip-check:hover { border-color: var(--accent); }
.chip-check:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.chip-check:has(input:focus-visible) { outline: 2px solid var(--warm); outline-offset: 2px; }

.segmented { display: inline-flex; gap: 4px; padding: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 13px; }
.segmented a, .segmented button {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 9px; border: 0; background: none;
  color: var(--text-2); font: inherit; font-weight: 700; font-size: 0.87rem; text-decoration: none; white-space: nowrap; cursor: pointer;
}
.segmented a:hover { color: var(--text); }
.segmented .active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.segmented .icon { width: 16px; height: 16px; }

.day-group { margin-bottom: 40px; }
.day-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 16px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.day-head h2 { margin: 0; font-size: 1.7rem; }
.day-head span { color: var(--muted); font-weight: 600; }
.day-head .badge { margin-left: auto; }

/* календарь */
.cal-nav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.cal-nav h2 { margin: 0 8px 0 0; min-width: 200px; }
.cal {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px;
  background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
}
.cal-wd { background: var(--surface-2); padding: 10px 8px; text-align: center; font-size: 0.76rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.cal-day { background: var(--surface); min-height: 124px; padding: 8px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cal-day.other { background: var(--bg-2); }
.cal-day.other .cal-num { opacity: 0.45; }
.cal-day.past:not(.other) { background: color-mix(in srgb, var(--surface) 70%, var(--bg-2)); }
.cal-num { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; font-weight: 800; font-size: 0.86rem; color: var(--text-2); }
.cal-day.today .cal-num { background: var(--accent); color: var(--accent-ink); }
.cal-evs { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-ev {
  --kind: var(--accent);
  display: block; padding: 3px 7px; border-radius: 6px;
  background: color-mix(in srgb, var(--kind) 16%, transparent); border-left: 3px solid var(--kind);
  color: var(--text); text-decoration: none; font-size: 0.76rem; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-ev:hover { background: color-mix(in srgb, var(--kind) 28%, transparent); color: var(--text); }
.cal-ev b { font-weight: 800; color: var(--kind); margin-right: 4px; }
.cal-ev.is-cancelled { text-decoration: line-through; opacity: 0.6; }
.cal-mobile { display: none; }
@media (max-width: 760px) {
  .cal-day { min-height: 58px; padding: 5px; align-items: center; }
  .cal-num { width: 26px; height: 26px; font-size: 0.8rem; }
  .cal-evs { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 3px; }
  .cal-ev { width: 8px; height: 8px; padding: 0; border: 0; border-radius: 50%; background: var(--kind); font-size: 0; }
  .cal-wd { padding: 8px 2px; font-size: 0.68rem; letter-spacing: 0; }
  .cal-mobile { display: block; margin-top: 28px; }
}

/* ---------- Страница события ---------- */

.event-hero {
  --kind: var(--accent);
  position: relative; margin-top: 20px; border-radius: var(--radius-lg); overflow: hidden;
  height: clamp(180px, 32vw, 400px); background: var(--surface-2); border: 1px solid var(--border);
}
.event-hero img { width: 100%; height: 100%; object-fit: cover; }
.event-hero .cover-placeholder .icon { width: 110px; height: 110px; }
.event-hero::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 45%, rgba(10, 8, 6, 0.6)); pointer-events: none; }

.event-layout { display: grid; grid-template-columns: minmax(0, 1fr) 370px; gap: 36px; align-items: start; padding: 28px 0 72px; }
.event-aside { position: sticky; top: calc(var(--header-h) + 20px); display: flex; flex-direction: column; gap: 16px; }
/* На узком экране карточка записи встаёт сразу после заголовка, до описания. */
@media (max-width: 980px) {
  .event-layout { grid-template-columns: 1fr; gap: 20px; }
  .event-main { display: contents; }
  .event-main > * { min-width: 0; }
  .event-main > hr { margin: 4px 0; }
  .event-main-intro { order: -2; }
  .event-aside { position: static; }
  .event-main + .event-aside { order: -1; }
}
.event-title-block h1 { margin: 12px 0 8px; }
.event-title-block .row { gap: 8px; }

.meta-list { display: flex; flex-direction: column; gap: 16px; margin: 0; padding: 0; list-style: none; }
.meta-item { display: flex; gap: 12px; align-items: flex-start; }
.meta-item > .icon { width: 20px; height: 20px; color: var(--warm); margin-top: 2px; }
.meta-item strong { display: block; font-weight: 700; }
.meta-item span { color: var(--muted); font-size: 0.87rem; }

.reg-box { padding: 20px 22px 22px; }
.reg-box .status-line { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-weight: 800; }
.reg-box .status-line .icon { width: 22px; height: 22px; }

.participants { display: flex; flex-wrap: wrap; gap: 8px; }
.participant {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 12px 4px 4px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); text-decoration: none; font-size: 0.88rem; font-weight: 700;
}
.participant:hover { border-color: var(--warm); color: var(--text); }
.seat-empty { width: 36px; height: 36px; border-radius: 50%; border: 2px dashed var(--border-strong); display: inline-grid; place-items: center; color: var(--muted); }
.seat-empty .icon { width: 14px; height: 14px; }

.master-card { display: flex; gap: 16px; align-items: flex-start; }
.master-card p { margin: 6px 0 0; color: var(--text-2); font-size: 0.93rem; }

/* ---------- Текст из Markdown ---------- */

.prose { color: var(--text-2); font-size: 1.02rem; line-height: 1.75; overflow-wrap: anywhere; }
.prose > :first-child { margin-top: 0; }
.prose h2, .prose h3, .prose h4 { color: var(--text); margin: 1.5em 0 0.5em; }
.prose h2 { font-size: 1.7rem; }
.prose h3 { font-size: 1.2rem; }
.prose p, .prose ul, .prose ol, .prose blockquote { margin: 0 0 1.05em; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li { margin: 0.25em 0; }
.prose li::marker { color: var(--accent); }
.prose strong { color: var(--text); }
.prose blockquote { padding: 10px 18px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 12px 12px 0; color: var(--text); }
.prose code { background: var(--surface-3); padding: 2px 6px; border-radius: 6px; }
.prose hr { margin: 2em 0; }
.prose-sm { font-size: 0.95rem; line-height: 1.65; }

/* ---------- Новости ---------- */

.news-card { display: flex; flex-direction: column; overflow: hidden; }
.news-cover { aspect-ratio: 16 / 9; background: var(--surface-2); overflow: hidden; position: relative; }
.news-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s; }
.news-card:hover .news-cover img { transform: scale(1.04); }
.news-cover .cover-placeholder { --kind: var(--accent); }
.news-cover .cover-placeholder .icon { width: 48px; height: 48px; }
.news-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.news-body h3 { margin: 0; font-size: 1.15rem; line-height: 1.3; }
.news-body p { margin: 0; color: var(--muted); font-size: 0.93rem; }
.news-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: 0.82rem; color: var(--muted); font-weight: 600; margin-top: auto; padding-top: 6px; }
.news-meta .icon { width: 14px; height: 14px; }
.news-pin { position: absolute; top: 12px; left: 12px; }

.article { padding: 12px 0 72px; }
.article-cover { border-radius: var(--radius-lg); overflow: hidden; margin: 20px 0 28px; border: 1px solid var(--border); }
.article-cover img { width: 100%; max-height: 460px; object-fit: cover; }
.article-lead { font-size: 1.2rem; color: var(--text); margin-bottom: 1.2em; font-weight: 500; }

.comments { margin-top: 48px; }
.comment { display: flex; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.comment:last-child { border-bottom: 0; }
.comment-body { flex: 1; min-width: 0; }
.comment-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 4px; }
.comment-head a { font-weight: 800; color: var(--text); text-decoration: none; }
.comment-text { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text-2); }

/* ---------- Бронь: сетка занятости ---------- */

.date-chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; scrollbar-width: thin; }
.date-chip {
  flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 64px; padding: 8px 10px; border-radius: 14px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-2); text-decoration: none; line-height: 1.15;
  transition: 0.15s;
}
.date-chip small { font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.date-chip strong { font-size: 1.3rem; font-family: var(--font-display); }
.date-chip:hover { border-color: var(--accent); color: var(--text); }
.date-chip.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.date-chip.active small { color: var(--accent-ink); opacity: 0.8; }
.date-chip.weekend:not(.active) small { color: var(--warm); }

.booking-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 28px; align-items: start; }
.booking-aside { position: sticky; top: calc(var(--header-h) + 20px); }
@media (max-width: 1060px) {
  .booking-layout { grid-template-columns: 1fr; }
  .booking-aside { position: static; }
}

.bgrid-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); scrollbar-width: thin; }
.bgrid {
  --room-col: 170px;
  display: grid;
  grid-template-columns: var(--room-col) repeat(var(--slots), minmax(30px, 1fr));
  min-width: calc(var(--room-col) + var(--slots) * 30px);
}
.bgrid-corner, .bgrid-room {
  position: sticky; left: 0; z-index: 2;
  background: var(--surface); border-right: 1px solid var(--border);
}
.bgrid-corner { border-bottom: 1px solid var(--border); }
.bgrid-time {
  grid-column: span 2;
  padding: 10px 0 8px 6px; border-bottom: 1px solid var(--border); border-left: 1px solid var(--border);
  font-size: 0.72rem; font-weight: 800; color: var(--muted); white-space: nowrap;
}
.bgrid-room {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  border-bottom: 1px solid var(--border); min-height: 58px;
}
.bgrid-room .swatch { width: 10px; height: 34px; border-radius: 4px; flex-shrink: 0; }
.bgrid-room strong { display: block; font-size: 0.88rem; line-height: 1.2; }
.bgrid-room small { color: var(--muted); font-size: 0.75rem; }
.bgrid-row-last { border-bottom: 0 !important; }

.slot {
  position: relative; min-height: 58px; padding: 0; margin: 0;
  border: 0; border-bottom: 1px solid var(--border); border-left: 1px solid color-mix(in srgb, var(--border) 55%, transparent);
  background: transparent; font: inherit; color: inherit;
}
.slot.hour { border-left-color: var(--border); }
.slot.free { cursor: pointer; }
.slot.free:hover { background: var(--warm-soft); }
.slot.free:hover::after { content: '+'; position: absolute; inset: 0; display: grid; place-items: center; color: var(--warm); font-weight: 800; }
.slot.selected { background: var(--warm) !important; }
.slot.selected::after { content: none !important; }
.slot.past { background: repeating-linear-gradient(135deg, transparent 0 6px, color-mix(in srgb, var(--border) 45%, transparent) 6px 7px); }
.slot-block {
  display: flex; align-items: center; min-width: 0; padding: 4px 6px; margin: 5px 2px;
  border-radius: 8px; font-size: 0.74rem; font-weight: 700; line-height: 1.2; text-decoration: none;
  overflow: hidden;
}
.slot-block span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot-block.booked { background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border-strong); }
.slot-block.event { background: color-mix(in srgb, var(--wine) 30%, var(--surface)); color: var(--text); border: 1px solid color-mix(in srgb, var(--wine) 60%, transparent); }
.slot-block.event:hover { background: color-mix(in srgb, var(--wine) 45%, var(--surface)); color: var(--text); }
.slot-block.mine { background: color-mix(in srgb, var(--success) 22%, var(--surface)); color: var(--text); border: 1px solid color-mix(in srgb, var(--success) 55%, transparent); }
.slot-cell-wrap { border-bottom: 1px solid var(--border); border-left: 1px solid var(--border); display: flex; min-width: 0; }
.slot-cell-wrap .slot-block { flex: 1; }

.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 0.84rem; color: var(--muted); font-weight: 600; margin-top: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 16px; height: 16px; border-radius: 5px; border: 1px solid var(--border-strong); }
.legend .l-free { background: var(--surface); }
.legend .l-sel { background: var(--warm); border-color: var(--warm); }
.legend .l-booked { background: var(--surface-3); }
.legend .l-event { background: color-mix(in srgb, var(--wine) 30%, var(--surface)); }
.legend .l-mine { background: color-mix(in srgb, var(--success) 22%, var(--surface)); }

.selection-summary {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px;
  background: var(--warm-soft); border: 1px dashed color-mix(in srgb, var(--warm) 50%, transparent);
  color: var(--text); font-weight: 700; font-size: 0.92rem;
}
.selection-summary .icon { color: var(--warm); }
.selection-summary[hidden] { display: none; }

.room-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 14px; }
.room-card { padding: 16px 18px; border-top: 4px solid var(--room, var(--accent)); }
.room-card h3 { margin: 0 0 4px; font-size: 1.02rem; }
.room-card p { margin: 0; color: var(--muted); font-size: 0.88rem; }

/* ---------- Кабинет и админка: боковое меню ---------- */

.side-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 32px; padding: 32px 0 72px; align-items: start; }
.side-nav { position: sticky; top: calc(var(--header-h) + 20px); display: flex; flex-direction: column; gap: 2px; }
.side-nav-title { padding: 0 12px 10px; font-size: 0.76rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.side-nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 12px;
  color: var(--text-2); text-decoration: none; font-weight: 700; font-size: 0.94rem;
  transition: background 0.15s, color 0.15s;
}
.side-nav a .icon { width: 19px; height: 19px; color: var(--muted); }
.side-nav a:hover { background: var(--surface-2); color: var(--text); }
.side-nav a.active { background: var(--accent-soft); color: var(--accent-text); }
.side-nav a.active .icon { color: var(--accent-text); }
.side-nav .count { margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 0.74rem; font-weight: 800; text-align: center; }
.side-nav hr { margin: 10px 12px; }
.side-content { min-width: 0; }
.side-content > .page-head { padding-top: 0; }
@media (max-width: 900px) {
  .side-layout { grid-template-columns: 1fr; gap: 20px; padding-top: 20px; }
  .side-nav { position: static; flex-direction: row; overflow-x: auto; gap: 6px; padding-bottom: 6px; scrollbar-width: none; }
  .side-nav::-webkit-scrollbar { display: none; }
  .side-nav a { flex: 0 0 auto; border: 1px solid var(--border); background: var(--surface); padding: 8px 12px; font-size: 0.88rem; }
  .side-nav-title, .side-nav hr { display: none; }
}

/* ---------- Таблицы ---------- */

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.table th {
  padding: 12px 16px; text-align: left; white-space: nowrap;
  font-size: 0.74rem; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted);
  background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.table td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 50%, transparent); }
.table .actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.table a.strong { color: var(--text); text-decoration: none; }
.table a.strong:hover { color: var(--warm); }

/* ---------- Списки-строки (брони, обращения, уведомления) ---------- */

.list-rows { display: flex; flex-direction: column; }
.list-row {
  display: flex; gap: 16px; align-items: center; flex-wrap: wrap;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.list-row:last-child { border-bottom: 0; }
.list-row-main { flex: 1 1 260px; min-width: 0; }
.list-row-main strong { display: block; }
.list-row-main a { color: var(--text); text-decoration: none; font-weight: 800; }
.list-row-main a:hover { color: var(--warm); }
.list-row-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 3px; color: var(--muted); font-size: 0.86rem; font-weight: 600; }
.list-row-meta .icon { width: 14px; height: 14px; }
.list-row-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.date-tile {
  flex-shrink: 0; width: 58px; padding: 8px 0; border-radius: 12px; text-align: center; line-height: 1.1;
  background: var(--surface-2); border: 1px solid var(--border);
}
.date-tile strong { display: block; font-family: var(--font-display); font-size: 1.5rem; color: var(--warm); }
.date-tile small { font-size: 0.7rem; font-weight: 800; text-transform: uppercase; color: var(--muted); }

.notif { display: flex; gap: 14px; align-items: flex-start; padding: 14px 20px; border-bottom: 1px solid var(--border); color: inherit; text-decoration: none; }
.notif:last-child { border-bottom: 0; }
.notif:hover { background: var(--surface-2); color: inherit; }
.notif-dot { width: 10px; height: 10px; border-radius: 50%; background: transparent; margin-top: 7px; flex-shrink: 0; }
.notif.unread .notif-dot { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.notif.unread .notif-text { color: var(--text); font-weight: 700; }
.notif-text { color: var(--text-2); }
.notif time { display: block; font-size: 0.8rem; color: var(--muted); margin-top: 2px; }

/* ---------- Переписка ---------- */

.thread { display: flex; flex-direction: column; gap: 16px; }
.msg { display: flex; gap: 12px; max-width: 86%; }
.msg-bubble { padding: 12px 16px; border-radius: 4px 16px 16px 16px; background: var(--surface-2); border: 1px solid var(--border); min-width: 0; }
.msg-head { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; margin-bottom: 4px; font-size: 0.84rem; }
.msg-head strong { color: var(--text); }
.msg-head time { color: var(--muted); }
.msg-text { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text-2); }
.msg.mine { margin-left: auto; flex-direction: row-reverse; }
.msg.mine .msg-bubble { border-radius: 16px 4px 16px 16px; background: color-mix(in srgb, var(--accent) 12%, var(--surface)); border-color: color-mix(in srgb, var(--accent) 28%, transparent); }
.msg.staff .msg-bubble { border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
@media (max-width: 640px) { .msg { max-width: 100%; } }

/* ---------- Статистика ---------- */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
@media (max-width: 480px) {
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 14px 16px; }
  .stat-value { font-size: 2rem; }
  .room-card p { display: none; }
  .room-cards { gap: 8px; }
  .room-card { padding: 12px 14px; }
}
.stat { padding: 18px 20px; }
.stat-top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-weight: 700; font-size: 0.86rem; }
.stat-top .icon { width: 20px; height: 20px; color: var(--warm); }
.stat-value { font-family: var(--font-display); font-size: 2.5rem; font-weight: 700; line-height: 1; margin-top: 10px; }
.stat-sub { margin-top: 6px; font-size: 0.82rem; color: var(--muted); font-weight: 600; }

/* ---------- Профиль ---------- */

.profile-head { display: flex; gap: 28px; align-items: center; flex-wrap: wrap; padding: 28px; }
.profile-head h1 { margin: 0; font-size: clamp(2rem, 4vw, 2.6rem); }
.profile-info { flex: 1; min-width: 240px; }
.profile-handle { color: var(--muted); font-weight: 700; }
.profile-stats { display: flex; gap: 28px; flex-wrap: wrap; }
.profile-stats div strong { display: block; font-family: var(--font-display); font-size: 2rem; line-height: 1; color: var(--warm); }
.profile-stats div span { font-size: 0.84rem; color: var(--muted); font-weight: 600; }
.contact-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.masters { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 14px; }
.master-tile { display: flex; gap: 14px; align-items: center; padding: 16px; }
.master-tile p { margin: 2px 0 0; color: var(--muted); font-size: 0.85rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- FAQ ---------- */

.faq { display: flex; flex-direction: column; gap: 10px; }
.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.faq summary {
  list-style: none; cursor: pointer; padding: 16px 20px; font-weight: 800;
  display: flex; justify-content: space-between; gap: 16px; align-items: center;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary .icon { color: var(--warm); transition: transform 0.2s; }
.faq details[open] summary .icon { transform: rotate(180deg); }
.faq details > div { padding: 0 20px 18px; }

/* ---------- Пустые состояния, пагинация ---------- */

.empty {
  text-align: center; padding: 56px 24px;
  border: 1px dashed var(--border-strong); border-radius: var(--radius);
  color: var(--muted);
}
.empty > .icon { width: 46px; height: 46px; color: var(--accent); opacity: 0.8; margin-bottom: 14px; stroke-width: 1.6; }
.empty h3 { color: var(--text); margin-bottom: 6px; }
.empty p { max-width: 440px; margin: 0 auto 18px; }
.empty-sm { padding: 28px 20px; }
.empty-sm > .icon { width: 32px; height: 32px; margin-bottom: 8px; }

.pagination { display: flex; justify-content: center; gap: 6px; margin-top: 32px; flex-wrap: wrap; }
.pagination a, .pagination span {
  min-width: 40px; height: 40px; padding: 0 12px; border-radius: 11px;
  display: inline-grid; place-items: center;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-2); text-decoration: none; font-weight: 700;
}
.pagination a:hover { border-color: var(--accent); color: var(--text); }
.pagination .current { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* ---------- Авторизация ---------- */

.auth-wrap { display: grid; place-items: center; padding: 48px 16px 72px; }
.auth-card { width: min(460px, 100%); padding: 32px; }
.auth-card h1 { font-size: 2.3rem; margin-bottom: 6px; text-align: center; }
.auth-card .lead { text-align: center; color: var(--muted); margin-bottom: 24px; }
.auth-logo { display: block; width: 58px; height: 58px; margin: 0 auto 14px; border-radius: 16px; }
.auth-foot { text-align: center; margin-top: 20px; color: var(--muted); font-size: 0.93rem; }
@media (max-width: 480px) { .auth-card { padding: 24px 20px; } }

/* ---------- Ошибка ---------- */

.error-page { text-align: center; padding: 88px 16px 110px; }
.error-code {
  font-family: var(--font-display); font-size: clamp(5rem, 16vw, 9rem); line-height: 1; font-weight: 700;
  background: var(--fire); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.error-code .icon { color: var(--warm); }
.error-page p { color: var(--text-2); max-width: 520px; margin: 0 auto 26px; }

/* ---------- Подвал ---------- */

.site-footer { margin-top: 40px; border-top: 1px solid var(--border); background: var(--bg-2); color: var(--muted); font-size: 0.92rem; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1.2fr; gap: 32px; padding: 44px 0 32px; }
.footer-grid h4 { color: var(--text); margin-bottom: 12px; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.07em; }
.footer-grid ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.footer-grid a { color: var(--text-2); text-decoration: none; }
.footer-grid a:hover { color: var(--warm); }
.footer-contact { display: flex; gap: 10px; align-items: flex-start; }
.footer-contact .icon { color: var(--warm); margin-top: 3px; }
.footer-bottom { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; padding: 18px 0 26px; border-top: 1px solid var(--border); font-size: 0.84rem; }
.pre-line { white-space: pre-line; }
@media (max-width: 800px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-grid > :first-child { grid-column: 1 / -1; } }
@media (max-width: 520px) { .footer-grid { grid-template-columns: 1fr; } }

/* ---------- Диалог подтверждения ---------- */

dialog.modal {
  width: min(440px, calc(100% - 32px)); padding: 0;
  border: 1px solid var(--border-strong); border-radius: var(--radius-lg);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow);
}
dialog.modal::backdrop { background: rgba(8, 6, 4, 0.6); backdrop-filter: blur(3px); }
dialog.modal[open] { animation: flash-in 0.2s ease-out; }
.modal-body { padding: 26px 26px 8px; }
.modal-body h3 { font-size: 1.2rem; margin-bottom: 8px; }
.modal-body p { color: var(--text-2); margin: 0; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; padding: 20px 26px 24px; flex-wrap: wrap; }

/* ---------- Разное ---------- */

.kbd-hint { font-size: 0.82rem; color: var(--muted); }
.divider-text { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 0.85rem; margin: 6px 0; }
.divider-text::before, .divider-text::after { content: ''; flex: 1; border-top: 1px solid var(--border); }
.color-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; vertical-align: middle; }
details.more summary { cursor: pointer; color: var(--muted); font-weight: 700; padding: 8px 0; }
.copy-field { display: flex; gap: 8px; }
.copy-field .input { font-family: ui-monospace, Consolas, monospace; font-size: 0.85rem; }

/* ---------- Роли и префиксы ---------- */

.prefix {
  --c: var(--warm);
  display: inline-flex; align-items: center;
  margin-right: 6px; padding: 0 7px;
  border-radius: 6px; line-height: 1.55;
  font-size: 0.72em; font-weight: 800; letter-spacing: 0.02em; white-space: nowrap;
  vertical-align: 0.12em;
  color: var(--c);
  background: color-mix(in srgb, var(--c) 15%, transparent);
  border: 1px solid color-mix(in srgb, var(--c) 45%, transparent);
  font-family: var(--font);
}
.prefix-lg { font-size: 0.42em; vertical-align: 0.4em; padding: 1px 9px; }
.participant .prefix { font-size: 0.7rem; margin-right: 0; }

.role-chip {
  --c: var(--warm);
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 0.78rem; font-weight: 800; white-space: nowrap;
  color: var(--text);
  background: color-mix(in srgb, var(--c) 14%, var(--surface-2));
  border: 1px solid color-mix(in srgb, var(--c) 40%, transparent);
}
.role-chip::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.role-chip .icon { width: 13px; height: 13px; color: var(--c); }
.role-chip:has(.icon)::before { display: none; }

.role-card { border-left: 4px solid var(--c); }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 10px 18px; }
.perm-option, .role-option { padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-2); }
.perm-option:has(input:checked), .role-option:has(input:checked) { border-color: color-mix(in srgb, var(--accent) 50%, transparent); background: var(--accent-soft); }
.role-option small { margin-top: 4px; }
.is-locked { opacity: 0.55; cursor: not-allowed; }
.is-locked input { cursor: not-allowed; }
.flip-y { transform: rotate(180deg); }

/* ---------- Режим правки текстов ---------- */

.editable-text {
  outline: 1px dashed color-mix(in srgb, var(--warm) 75%, transparent);
  outline-offset: 3px; border-radius: 4px; cursor: text;
  transition: background 0.15s;
}
.editable-text:hover { background: var(--warm-soft); }
.editable-text.editing {
  outline: 2px solid var(--warm);
  background: color-mix(in srgb, var(--warm) 14%, var(--surface));
  color: var(--text); -webkit-text-fill-color: var(--text);
}
.editable-text.saved { animation: text-saved 1.2s ease-out; }
@keyframes text-saved { 0% { background: color-mix(in srgb, var(--success) 45%, transparent); } }
.edit-bar {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 90;
  display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap;
  width: min(920px, calc(100% - 24px)); padding: 12px 16px;
  border-radius: 16px; background: var(--surface); border: 1px solid var(--warm); box-shadow: var(--shadow);
  font-size: 0.88rem;
}
.edit-bar > .icon { color: var(--warm); width: 20px; height: 20px; }
.edit-bar > span { flex: 1 1 300px; }
body[data-edit-texts] { padding-bottom: 110px; }
.save-sticky {
  position: sticky; bottom: 12px; z-index: 5; padding: 12px;
  background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(8px); border-radius: 14px;
}

/* ---------- Маскот ---------- */

.mascot { position: relative; margin: 0; display: flex; flex-direction: column; align-items: center; cursor: pointer; user-select: none; }
.mascot img { max-width: 100%; height: auto; filter: drop-shadow(0 18px 36px rgba(0, 0, 0, 0.55)); }
.mascot figcaption { margin-top: 6px; font-family: var(--font-display); font-size: 1.4rem; font-weight: 700; color: var(--warm); }
.mascot-hero { z-index: 1; }
.mascot-hero img { max-height: 380px; width: auto; animation: float 7s ease-in-out infinite; }
.mascot-bubble {
  position: relative; margin: 0 0 16px; padding: 12px 16px; max-width: 300px;
  border-radius: 16px; background: var(--surface-2); border: 1px solid var(--border-strong);
  color: var(--text); font-weight: 600; font-size: 0.95rem; line-height: 1.45; box-shadow: var(--shadow-sm);
  transition: opacity 0.2s;
}
.mascot-bubble::after {
  content: ''; position: absolute; left: 50%; bottom: -8px; width: 14px; height: 14px;
  background: var(--surface-2); border-right: 1px solid var(--border-strong); border-bottom: 1px solid var(--border-strong);
  transform: translateX(-50%) rotate(45deg);
}
.mascot-bubble-inline { margin: 12px 0 0; }
.mascot-bubble-inline::after { left: 26px; top: -8px; bottom: auto; transform: rotate(225deg); }
.mascot-card { display: flex; gap: 24px; align-items: center; padding: 24px; flex-wrap: wrap; }
.mascot-card .mascot img { max-height: 170px; width: auto; }
.mascot-error { margin-bottom: 8px; }
.mascot-error img { max-height: 220px; width: auto; }
.error-code-sm { font-size: 3.2rem; }
.empty-mascot { display: block; margin: 0 auto 14px; max-height: 120px; width: auto; filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.45)); }
.empty-sm .empty-mascot { max-height: 72px; }

/* ---------- Главный экран: картинка и фон ---------- */

.hero-picture { position: relative; z-index: 1; max-height: 440px; width: auto; max-width: 100%; border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.hero.has-bg {
  background:
    linear-gradient(90deg, rgba(11, 8, 7, 0.94) 0%, rgba(11, 8, 7, 0.78) 45%, rgba(11, 8, 7, 0.5) 100%),
    var(--hero-bg) center / cover no-repeat;
  border-bottom: 1px solid var(--border);
}
.about-cover img { max-height: 380px; }
@media (max-width: 900px) {
  .hero.has-bg { background: linear-gradient(180deg, rgba(11, 8, 7, 0.72), rgba(11, 8, 7, 0.94)), var(--hero-bg) center / cover no-repeat; }
  .hero-art.has-picture { order: 2; }
  .mascot-hero img { max-height: 220px; }
  .hero-picture { max-height: 280px; }
}

/* ---------- Фотографии ---------- */

.photo-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.photo-tile { display: block; aspect-ratio: 1; overflow: hidden; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.photo-tile img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s; }
.photo-tile:hover img { transform: scale(1.05); }
@media (max-width: 720px) { .photo-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.album-cover { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: var(--surface-2); }
.album-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s; }
.album-card:hover .album-cover img { transform: scale(1.04); }
.album-cover .badge-cover { position: absolute; right: 12px; bottom: 12px; }
.album-cover .cover-placeholder { --kind: var(--warm); }

.masonry { columns: 4 230px; column-gap: 12px; }
.masonry-item { position: relative; display: block; margin-bottom: 12px; break-inside: avoid; border-radius: 12px; overflow: hidden; background: var(--surface-2); }
.masonry-item img { width: 100%; height: auto; transition: transform 0.3s; }
.masonry-item:hover img { transform: scale(1.03); }
.masonry-caption {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 28px 12px 10px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.78)); color: #fff; font-size: 0.85rem; font-weight: 600;
  opacity: 0; transition: opacity 0.2s;
}
.masonry-item:hover .masonry-caption { opacity: 1; }
@media (hover: none) { .masonry-caption { opacity: 1; } }

.lightbox { position: fixed; inset: 0; z-index: 120; display: grid; grid-template-rows: minmax(0, 1fr) auto; background: rgba(6, 3, 3, 0.95); }
.lightbox-stage { display: flex; align-items: center; justify-content: center; padding: 60px 72px 8px; min-height: 0; }
.lightbox-stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6); }
.lightbox-bar { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 20px 22px; color: #eee; font-size: 0.92rem; }
.lightbox-bar a { color: var(--warm); }
.lightbox-btn { position: absolute; width: 48px; height: 48px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.1); color: #fff; display: grid; place-items: center; cursor: pointer; }
.lightbox-btn:hover { background: rgba(255, 255, 255, 0.22); }
.lightbox-btn .icon { width: 22px; height: 22px; }
.lb-prev { left: 14px; top: calc(50% - 24px); }
.lb-next { right: 14px; top: calc(50% - 24px); }
.lb-close { right: 14px; top: 12px; }
body.lightbox-open { overflow: hidden; }
@media (max-width: 640px) {
  .lightbox-stage { padding: 60px 6px 6px; }
  .lb-prev, .lb-next { top: auto; bottom: 70px; }
}

/* ---------- Загрузка файлов ---------- */

.dropzone {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 34px 20px; border: 2px dashed var(--border-strong); border-radius: var(--radius);
  text-align: center; cursor: pointer; transition: 0.15s;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--warm); background: var(--warm-soft); }
.dropzone > .icon { width: 38px; height: 38px; color: var(--warm); }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.upload-progress { margin-top: 14px; display: flex; flex-direction: column; gap: 6px; }
.upload-progress[hidden] { display: none; }
.admin-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.admin-photo { display: flex; flex-direction: column; gap: 8px; padding: 8px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-2); }
.admin-photo img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; }
.admin-photo.is-cover { border-color: var(--warm); }
.admin-photo .input { min-height: 36px; padding: 6px 10px; font-size: 0.85rem; }

.design-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 22px 18px; }
.design-slot { display: flex; flex-direction: column; gap: 8px; }
.design-preview {
  aspect-ratio: 16 / 10; border-radius: 12px; border: 1px dashed var(--border-strong); overflow: hidden;
  display: grid; place-items: center;
  background: repeating-conic-gradient(var(--surface-2) 0 25%, var(--surface) 0 50%) 0 0 / 16px 16px;
}
.design-preview img { width: 100%; height: 100%; object-fit: cover; }
.design-preview.is-contain img { object-fit: contain; padding: 8px; }
.file-btn { cursor: pointer; }

/* ---------- Картинки в текстах ---------- */

.md-figure { margin: 1.4em 0; }
.md-figure img { display: block; max-width: 100%; max-height: 560px; width: auto; margin: 0 auto; border-radius: 14px; border: 1px solid var(--border); }
.md-figure figcaption { text-align: center; margin-top: 8px; font-size: 0.88rem; color: var(--muted); }
.prose p .md-img { display: inline-block; max-height: 320px; max-width: 100%; border-radius: 10px; vertical-align: middle; }
.md-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 6px; }
.md-toolbar .hint { margin-left: auto; }
textarea.dragover { border-color: var(--warm); box-shadow: 0 0 0 3px var(--warm-soft); }

/* Атрибут hidden всегда прячет элемент, даже если у класса свой display. */
[hidden] { display: none !important; }

/* С маскотом или своей картинкой карточка ближайшей игры встаёт под ними, а не поверх. */
.hero-art.has-picture { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; min-height: 0; }
.hero-art.has-picture .next-card { position: relative; left: auto; bottom: auto; width: min(340px, 100%); z-index: 2; }
