:root {
  --bg: #121110;
  --bg-elev: #1b1a18;
  --bg-card: #201e1c;
  --line: #2f2c29;
  --text: #ece7e1;
  --muted: #9a938b;
  --accent: #d9a35b;
  --accent-ink: #1a1408;
  --admin: #c96f4f;
  --danger: #e0705a;
  --ok: #7fb685;
  --radius: 14px;
  --font: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
code { font-size: 0.9em; padding: 1px 6px; border-radius: 6px; background: var(--bg-elev); border: 1px solid var(--line); }
h1, h2, h3 { margin: 0; line-height: 1.2; font-weight: 600; }
h1 { font-size: 28px; }
h2 { font-size: 20px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.muted { color: var(--muted); margin: 6px 0 0; }

/* Кнопки и метки */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 38px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent;
  font: 500 14px var(--font); text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #e6b26b; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--muted); }
.btn-block { width: 100%; height: 46px; font-size: 15px; }
.badge {
  display: inline-block; margin-left: 8px; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 500; color: var(--muted); border: 1px solid var(--line); vertical-align: middle;
}
.badge-admin { color: var(--admin); border-color: color-mix(in srgb, var(--admin) 45%, transparent); }

/* Шапка */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 28px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .02em; text-decoration: none; }
.brand-mark {
  width: 22px; height: 22px; border-radius: 6px;
  background: conic-gradient(from 210deg, var(--accent), var(--admin), var(--accent));
}
.brand-lg { font-size: 22px; }
.brand-lg .brand-mark { width: 28px; height: 28px; border-radius: 8px; }
.topnav { display: flex; align-items: center; gap: 10px; }
.topnav form { margin: 0; }
.who { color: var(--muted); margin-right: 6px; }

/* Сообщения */
.messages { max-width: 1240px; margin: 16px auto 0; padding: 0 28px; }
.msg { padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-elev); margin-bottom: 8px; }
.msg-warning, .msg-error { border-color: color-mix(in srgb, var(--danger) 50%, transparent); color: #f2b4a6; }
.msg-success { border-color: color-mix(in srgb, var(--ok) 50%, transparent); }

/* Каталог */
.page { max-width: 1240px; margin: 0 auto; padding: 32px 28px 64px; }
.section + .section { margin-top: 56px; padding-top: 40px; border-top: 1px dashed var(--line); }
.section-head { margin-bottom: 22px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 20px; }
.card {
  display: flex; flex-direction: column; overflow: hidden; text-decoration: none;
  background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius);
  transition: transform .18s, border-color .18s;
}
.card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.card-hidden { opacity: .6; }
.card-cover {
  aspect-ratio: 16 / 10; display: grid; place-items: center; overflow: hidden;
  background: radial-gradient(120% 120% at 20% 0%, #2c2722, #171513);
}
.card-cover img { width: 100%; height: 100%; object-fit: cover; user-select: none; }
.card-initial { font-size: 54px; font-weight: 700; color: color-mix(in srgb, var(--accent) 70%, transparent); }
.card-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.card-body h3 { font-size: 17px; }
.card-body p { margin: 0; color: var(--muted); font-size: 14px; }
.card-body .badge { margin-left: 0; }
.empty { padding: 36px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }

/* Вход */
.page-login {
  background:
    radial-gradient(60% 50% at 50% 0%, rgba(217, 163, 91, .12), transparent 70%),
    var(--bg);
}
.page-login .messages { max-width: 420px; padding: 0 16px; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card {
  width: 100%; max-width: 400px; padding: 32px 28px;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .45);
  display: flex; flex-direction: column; gap: 16px;
}
.login-card .muted { margin: -6px 0 4px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.field input {
  height: 46px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); font: 15px var(--font); outline: none;
}
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(217, 163, 91, .18); }
.notice { margin: 4px 0 0; font-size: 12px; color: var(--muted); }

/* Страница проекта */
.page-project { overflow: hidden; }
.project-page { height: calc(100vh - 63px); display: flex; flex-direction: column; }
.project-bar { display: flex; align-items: center; gap: 16px; padding: 10px 28px; border-bottom: 1px solid var(--line); }
.project-bar h1 { font-size: 18px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-bar .badge { margin-left: 0; }
.back { color: var(--muted); text-decoration: none; white-space: nowrap; }
.back:hover { color: var(--text); }
.stage { position: relative; flex: 1; min-height: 0; background: #000; }
.stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.stage-gallery { background: var(--bg); overflow: auto; }
.gallery { max-width: 1100px; margin: 0 auto; padding: 28px; display: flex; flex-direction: column; gap: 20px; }
.gallery-text { margin: 0; color: var(--muted); }
.gallery img, .gallery video, .gallery model-viewer {
  width: 100%; border-radius: var(--radius); background: #000; user-select: none;
}
.gallery model-viewer { height: 70vh; background: radial-gradient(#2a2622, #121110); }
.stage:fullscreen { background: #000; }

/* Водяной знак: поверх всего, клики проходят сквозь него */
.watermark { position: fixed; inset: 0; z-index: 50; pointer-events: none; background-repeat: repeat; }
.watermark-stage { position: absolute; z-index: 5; }

@media (max-width: 640px) {
  .topbar { padding: 10px 16px; }
  .who { display: none; }
  .page { padding: 24px 16px 48px; }
  .messages { padding: 0 16px; }
  .project-bar { padding: 10px 16px; gap: 10px; }
  .project-bar #fullscreen { display: none; }
  .project-page { height: calc(100vh - 59px); }
  h1 { font-size: 24px; }
}
