:root {
  color-scheme: dark;
  --bg: #080913;
  --card: rgba(255, 255, 255, 0.09);
  --card-strong: rgba(255, 255, 255, 0.14);
  --line: rgba(255, 255, 255, 0.16);
  --text: #f8fbff;
  --muted: #a8b0cc;
  --primary: #7c3aed;
  --primary-2: #22d3ee;
  --danger: #fb7185;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 10%, rgba(34, 211, 238, .42), transparent 30%),
    radial-gradient(circle at 85% 15%, rgba(124, 58, 237, .45), transparent 30%),
    radial-gradient(circle at 70% 85%, rgba(244, 63, 94, .28), transparent 32%),
    linear-gradient(135deg, #060714, #151336 55%, #090a18);
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 36px 0;
}

.hero {
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary-2);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .18em;
  text-transform: uppercase;
}

h1, h2, p { margin: 0; }
h1 { font-size: clamp(40px, 7vw, 76px); letter-spacing: -.06em; }
.hero p:not(.eyebrow) { margin-top: 12px; color: var(--muted); font-size: 17px; }

.grid {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 22px;
}

.card {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: linear-gradient(145deg, var(--card-strong), var(--card));
  box-shadow: 0 28px 80px rgba(0,0,0,.42), inset 0 1px 0 rgba(255,255,255,.12);
  backdrop-filter: blur(20px);
  padding: 24px;
}

.controls, label {
  display: grid;
  gap: 10px;
}

.controls {
  gap: 18px;
}

textarea, input, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--text);
  background: rgba(5, 7, 18, .72);
  outline: none;
  padding: 13px 14px;
  font: inherit;
}

textarea { resize: vertical; min-height: 220px; }

.cookie-form {
  display: grid;
  gap: 12px;
  margin: 18px 0;
}

.cookie-form textarea {
  min-height: 150px;
}

button, .admin-link, .download-link {
  border: 0;
  border-radius: 999px;
  color: white;
  background: linear-gradient(135deg, var(--primary), #ec4899);
  padding: 13px 18px;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  justify-content: center;
  align-items: center;
}

button:disabled {
  cursor: not-allowed;
  opacity: .55;
}

.hint, .status {
  color: var(--muted);
  line-height: 1.7;
}

.hidden {
  display: none !important;
}

.status {
  margin: 18px 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(0,0,0,.24);
  white-space: pre-wrap;
}

.result-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.preview {
  display: grid;
  gap: 14px;
  min-height: 360px;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 22px;
  background: rgba(0,0,0,.22);
  overflow: hidden;
  padding: 16px;
}

.preview img, .preview video {
  max-width: 100%;
  max-height: 70vh;
  border-radius: 18px;
}

.inline-form {
  display: flex;
  gap: 12px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0;
}

pre {
  white-space: pre-wrap;
  overflow: auto;
  max-height: 520px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(0,0,0,.35);
}

@media (max-width: 880px) {
  .grid { grid-template-columns: 1fr; }
  .inline-form { flex-direction: column; }
}

.admin-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}

.admin-layout.is-login {
  grid-template-columns: 1fr;
  place-items: center;
  padding: 24px;
}

.admin-layout.is-login .sidebar,
.admin-layout.is-login .admin-header,
.admin-layout.is-login #adminPanel {
  display: none !important;
}

.admin-layout.is-login .admin-main {
  width: min(520px, 100%);
  padding: 0;
}

.admin-layout.is-login .login-card {
  display: grid;
  gap: 22px;
  margin: 0;
  padding: 30px;
}

.admin-layout.is-login .login-form {
  width: 100%;
  flex-direction: column;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px;
  border-right: 1px solid var(--line);
  background: rgba(5, 7, 18, .68);
  backdrop-filter: blur(24px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 34px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), #ec4899);
  font-weight: 900;
  box-shadow: 0 16px 38px rgba(124, 58, 237, .35);
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  margin-top: 3px;
  color: var(--muted);
}

.nav {
  display: grid;
  gap: 8px;
}

.nav a,
.side-link {
  color: var(--muted);
  text-decoration: none;
  padding: 12px 14px;
  border-radius: 14px;
  display: block;
}

.nav a.active,
.nav a:hover,
.side-link:hover {
  color: var(--text);
  background: rgba(255, 255, 255, .09);
}

.side-link {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 24px;
  border: 1px solid var(--line);
  text-align: center;
}

.admin-main {
  padding: 30px;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.admin-header h1 {
  font-size: clamp(34px, 4vw, 54px);
}

.badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 14px;
  color: var(--muted);
  background: rgba(255, 255, 255, .08);
}

.badge.ok {
  color: #86efac;
  border-color: rgba(134, 239, 172, .35);
  background: rgba(34, 197, 94, .12);
}

.login-card,
.admin-card {
  border: 1px solid var(--line);
  border-radius: 26px;
  background:
    linear-gradient(145deg, rgba(255,255,255,.13), rgba(255,255,255,.06)),
    rgba(5, 7, 18, .42);
  box-shadow: 0 28px 70px rgba(0,0,0,.35);
  backdrop-filter: blur(22px);
}

.login-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  padding: 22px;
  margin-bottom: 22px;
}

.login-card p {
  margin-top: 8px;
  color: var(--muted);
}

.login-form {
  display: flex;
  gap: 10px;
  width: min(520px, 100%);
}

.login-form input {
  min-width: 0;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, .9fr);
  gap: 20px;
}

.admin-card {
  padding: 22px;
}

.admin-card.wide {
  grid-column: span 2;
}

.card-head,
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.toolbar {
  justify-content: flex-start;
  margin: 16px 0;
  flex-wrap: wrap;
}

.info-panel,
.link-box {
  min-height: 86px;
  white-space: pre-wrap;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(0, 0, 0, .24);
  color: var(--muted);
  padding: 15px;
  line-height: 1.65;
}

.link-box {
  min-height: auto;
  margin: 16px 0;
}

.link-box a {
  color: #67e8f9;
  word-break: break-all;
}

@media (max-width: 980px) {
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
  }

  .side-link {
    position: static;
    margin-top: 18px;
  }

  .login-card,
  .login-form,
  .admin-header {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-grid {
    grid-template-columns: 1fr;
  }

  .admin-card.wide {
    grid-column: auto;
  }
}
