:root {
  color-scheme: dark;
  --bg: #050816;
  --bg-deep: #02040d;
  --panel: rgba(9, 15, 35, 0.82);
  --panel-strong: rgba(14, 23, 49, 0.92);
  --panel-alt: rgba(11, 20, 43, 0.74);
  --text: #eaf6ff;
  --muted: #8ca6c7;
  --line: rgba(70, 104, 170, 0.45);
  --line-strong: rgba(103, 165, 255, 0.62);
  --accent: #1ce4ff;
  --accent-strong: #7ef9ff;
  --accent-secondary: #ff4fd8;
  --danger: #ff5f87;
  --success: #45f0b6;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.45);
  --glow: 0 0 0 1px rgba(28, 228, 255, 0.1), 0 0 30px rgba(28, 228, 255, 0.12);
  --font-sans: "Segoe UI", "Inter", "Aptos", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Cascadia Code", "Consolas", "SFMono-Regular", monospace;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg-deep);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top, rgba(28, 228, 255, 0.18), transparent 28%),
    radial-gradient(circle at 80% 20%, rgba(255, 79, 216, 0.16), transparent 25%),
    linear-gradient(180deg, #081120 0%, var(--bg) 45%, var(--bg-deep) 100%);
  color: var(--text);
  font-family: var(--font-sans);
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    linear-gradient(rgba(255, 255, 255, 0.015), rgba(255, 255, 255, 0.015)),
    repeating-linear-gradient(
      180deg,
      transparent 0,
      transparent 3px,
      rgba(0, 0, 0, 0.08) 4px
    );
  mix-blend-mode: soft-light;
  pointer-events: none;
  opacity: 0.5;
}

.page-glow,
.page-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.page-glow {
  filter: blur(24px);
  opacity: 0.75;
}

.page-glow-cyan {
  background: radial-gradient(circle at 10% 10%, rgba(28, 228, 255, 0.18), transparent 30%);
}

.page-glow-magenta {
  background: radial-gradient(circle at 90% 18%, rgba(255, 79, 216, 0.14), transparent 24%);
}

.page-grid {
  background-image:
    linear-gradient(rgba(110, 160, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(110, 160, 255, 0.06) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.45), transparent 85%);
  opacity: 0.4;
}

.shell {
  width: min(100%, 960px);
  margin: 0 auto;
  padding: 40px 20px 56px;
  position: relative;
  z-index: 1;
}

.panel {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 28%),
    var(--panel);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(126, 249, 255, 0.42), rgba(255, 79, 216, 0.12), rgba(126, 249, 255, 0.06));
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.panel-wide {
  min-height: 60vh;
}

.panel-header {
  margin-bottom: 24px;
}

.panel-header-inline {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

h1 {
  margin: 0 0 8px;
  font-size: clamp(2rem, 5vw, 3.25rem);
  line-height: 0.92;
  letter-spacing: -0.04em;
  font-weight: 800;
  text-wrap: balance;
  text-shadow: 0 0 24px rgba(28, 228, 255, 0.08);
}

.muted {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
}

.stack {
  display: grid;
  gap: 18px;
}

.field {
  display: grid;
  gap: 8px;
  font-weight: 600;
  color: #d5e7ff;
}

input,
textarea,
button {
  font: inherit;
}

input,
textarea {
  width: 100%;
  padding: 15px 17px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(3, 10, 24, 0.82);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

input::placeholder,
textarea::placeholder {
  color: #7087a8;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--line-strong);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 0 0 3px rgba(28, 228, 255, 0.12),
    0 0 28px rgba(28, 228, 255, 0.08);
  transform: translateY(-1px);
}

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

button {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  padding: 14px 20px;
  font-weight: 700;
  letter-spacing: 0.01em;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease, opacity 140ms ease;
}

button:hover {
  transform: translateY(-1px);
}

button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(28, 228, 255, 0.18);
}

.primary-button,
.copy-button {
  background: linear-gradient(135deg, var(--accent), #1da7ff 52%, var(--accent-secondary));
  color: #04101f;
  box-shadow: 0 10px 30px rgba(28, 228, 255, 0.22);
}

.secondary-button {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  border: 1px solid var(--line);
}

.danger-button {
  background: linear-gradient(135deg, #ff5f87, #ff7b67);
  color: white;
  box-shadow: 0 12px 30px rgba(255, 95, 135, 0.18);
}

.admin-action-row {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 4px;
}

.ghost-button {
  background: rgba(255, 95, 135, 0.1);
  color: #ffd6df;
  border: 1px solid rgba(255, 95, 135, 0.35);
  box-shadow: 0 10px 24px rgba(255, 95, 135, 0.08);
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.meta-item {
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(22, 34, 68, 0.9), rgba(8, 15, 32, 0.78));
  box-shadow: var(--glow);
}

.meta-label {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 6px;
}

.snippet-card {
  display: grid;
  gap: 16px;
}

.snippet-content {
  margin: 0;
  min-height: 300px;
  padding: 20px;
  border-radius: 20px;
  border: 1px solid rgba(87, 145, 255, 0.3);
  background:
    linear-gradient(180deg, rgba(14, 24, 52, 0.95), rgba(4, 10, 24, 0.98)),
    rgba(4, 10, 24, 0.96);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: clamp(1rem, 2.5vw, 1.15rem);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 0 0 1px rgba(28, 228, 255, 0.06),
    0 0 32px rgba(28, 228, 255, 0.08);
}

.copy-feedback {
  margin: 0;
  color: var(--accent-strong);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.82rem;
}

.empty-state {
  padding: 24px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(13, 21, 45, 0.9), rgba(6, 11, 24, 0.82));
  border: 1px dashed rgba(126, 249, 255, 0.28);
  color: var(--muted);
  font-size: 1.1rem;
}

.flash-stack {
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
}

.flash {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.flash-error {
  background: rgba(87, 16, 38, 0.78);
  border-color: rgba(255, 95, 135, 0.38);
}

.flash-success {
  background: rgba(6, 56, 45, 0.82);
  border-color: rgba(69, 240, 182, 0.34);
}

strong {
  color: #f5fbff;
}

::selection {
  background: rgba(28, 228, 255, 0.28);
  color: #ffffff;
}

@media (max-width: 720px) {
  .shell {
    padding: 18px 12px 28px;
  }

  .panel {
    padding: 18px;
    border-radius: 20px;
  }

  .panel-header-inline {
    flex-direction: column;
  }

  button {
    width: 100%;
  }

  .admin-action-row {
    width: 100%;
  }
}
