:root {
  color-scheme: dark;
  --bg: #0b0c12;
  --panel: #141620;
  --panel2: #191b28;
  --line: #2b2d3c;
  --text: #f5f5fa;
  --muted: #a3a5b8;
  --red: #ed3048;
  --purple: #9a65f5;
  --green: #75e0b1;
  --radius: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: radial-gradient(ellipse at 50% -20%, #2c1323 0, transparent 45%), var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.55;
}

.topbar {
  height: 76px;
  background: linear-gradient(90deg, #c71f38, var(--red) 45%, #c51e39);
  border-bottom: 1px solid #ff6575;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(24px, calc((100vw - 1240px) / 2));
  gap: 24px;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 8px 30px #0005;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  text-decoration: none;
  font-size: 20px;
  font-weight: 850;
  letter-spacing: -0.5px;
}
.brand b { color: #ffe1e5; }
.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #fff;
  color: #cf233d;
  font-weight: 950;
  box-shadow: 0 4px 14px #6b0c1d66;
}

nav {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
nav a, .nav-button {
  color: #fff;
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  opacity: 0.92;
}
nav a:hover, nav a:focus { opacity: 1; text-decoration: underline; }
.nav-muted {
  color: #ffd0d6;
  font-size: 13px;
  font-weight: 600;
  opacity: 0.55;
  cursor: default;
}
.inline { display: inline; margin: 0; }
.nav-button {
  border: 0;
  background: transparent;
  cursor: pointer;
  font: inherit;
}

.container {
  width: min(1240px, calc(100% - 40px));
  margin: 0 auto;
  min-height: calc(100vh - 140px);
}

.hero {
  position: relative;
  overflow: hidden;
  margin: 34px 0 56px;
  padding: 54px 52px;
  border: 1px solid #4b283c;
  border-radius: 26px;
  background: linear-gradient(120deg, #1b1523, #171827 55%, #20162d);
  box-shadow: 0 20px 60px #0002;
}
.hero-glow {
  position: absolute;
  width: 300px;
  height: 300px;
  right: 5%;
  top: -130px;
  border-radius: 50%;
  background: #8f45f5;
  filter: blur(100px);
  opacity: 0.18;
  pointer-events: none;
}
.eyebrow {
  display: block;
  color: #c6a2ff;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 1.7px;
  text-transform: uppercase;
}
.hero h1 {
  position: relative;
  margin: 10px 0 12px;
  font-size: clamp(2rem, 4vw, 3rem);
  letter-spacing: -1px;
  line-height: 1.1;
}
.hero p {
  position: relative;
  max-width: 620px;
  color: var(--muted);
  margin: 0 0 28px;
  font-size: 1.05rem;
}
.hero-stats {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}
.hero-stats > div {
  min-width: 120px;
  padding: 14px 18px;
  border-radius: 16px;
  background: #ffffff0d;
  border: 1px solid #ffffff14;
}
.hero-stats strong {
  display: block;
  font-size: 1.55rem;
  letter-spacing: -0.5px;
}
.hero-stats span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.section { margin-bottom: 56px; }
.section-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}
.section-title h2, .admin-title h1 {
  margin: 6px 0 0;
  letter-spacing: -0.5px;
}
.pill {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 999px;
  background: #9a65f522;
  color: #d6baff;
  border: 1px solid #9a65f544;
  font-size: 12px;
  font-weight: 800;
}

.item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}
.item-card {
  background: linear-gradient(180deg, var(--panel2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 12px 30px #0003;
  transition: transform 0.18s ease, border-color 0.18s ease;
}
.item-card:hover {
  transform: translateY(-2px);
  border-color: #4a3a6a;
}
.item-heading {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 16px;
}
.item-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  object-fit: contain;
  background: #0f1018;
  border: 1px solid var(--line);
  image-rendering: pixelated;
}
.item-icon.placeholder {
  display: grid;
  place-items: center;
  color: var(--purple);
  font-size: 18px;
}
.item-heading h3 {
  margin: 4px 0 0;
  font-size: 1.15rem;
  letter-spacing: -0.3px;
}
.prices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}
.prices > div {
  background: #0d0e16;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
}
.prices span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 4px;
}
.prices strong {
  display: block;
  font-size: 1.05rem;
  letter-spacing: -0.3px;
}
.prices small {
  display: block;
  margin-top: 4px;
  color: #8f93a8;
  font-size: 11px;
}

.chart-card { margin-top: 6px; }
.chart-controls {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.chart-btn {
  border: 1px solid var(--line);
  background: #10121a;
  color: var(--muted);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.15s ease;
}
.chart-btn:hover { color: #fff; border-color: #5a4a7a; }
.chart-btn.active {
  background: #9a65f533;
  border-color: #9a65f5;
  color: #e8d6ff;
}
.chart-wrap {
  height: 120px;
  border-radius: 12px;
  background: #0a0b12;
  border: 1px solid var(--line);
  overflow: hidden;
}
.price-chart {
  width: 100%;
  height: 100%;
  display: block;
}
.chart-range {
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
}

.tips-list {
  display: grid;
  gap: 14px;
}
.tip-box {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 18px 20px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
}
.tip-box .bulb { font-size: 22px; line-height: 1; }
.tip-box strong { display: block; margin-bottom: 4px; }
.tip-box p { margin: 0; color: var(--muted); }

.notice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.notice {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px 20px;
}
.notice.event { border-color: #4a3568; }
.notice h3 { margin: 8px 0 8px; }
.notice p { margin: 0; color: var(--muted); }
.notice small { display: block; margin-top: 10px; color: #c6a2ff; font-weight: 700; }

.empty-state {
  text-align: center;
  padding: 48px 24px;
  border: 1px dashed var(--line);
  border-radius: 22px;
  background: #12131c;
}
.empty-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: #9a65f522;
  color: var(--purple);
  font-size: 22px;
}
.empty-state h3 { margin: 0 0 8px; }
.empty-state p { color: var(--muted); max-width: 420px; margin: 0 auto 18px; }

.button, button.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 12px;
  border: 0;
  background: linear-gradient(135deg, var(--red), #b91d36);
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 8px 20px #ed304833;
}
.button:hover { filter: brightness(1.06); }
.button.secondary {
  background: #23263a;
  box-shadow: none;
  border: 1px solid var(--line);
}
.button.danger {
  background: linear-gradient(135deg, #8b1e2d, #5c121c);
  box-shadow: none;
}
.button.small { padding: 7px 12px; font-size: 12px; border-radius: 10px; }
.button.full { width: 100%; }

.muted { color: var(--muted); }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
  background: #0d0e16;
  border: 1px solid var(--line);
  padding: 1px 6px;
  border-radius: 6px;
}

footer {
  text-align: center;
  color: var(--muted);
  padding: 28px 16px 40px;
  font-size: 13px;
}
footer span { opacity: 0.5; }

/* Auth */
.auth-card {
  max-width: 420px;
  margin: 48px auto;
  padding: 32px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 20px 50px #0004;
}
.auth-card h1 { margin: 8px 0 8px; }
.auth-card form { display: grid; gap: 14px; margin-top: 18px; }
label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: #d7d9e8;
}
input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #0d0e16;
  color: var(--text);
  border-radius: 12px;
  padding: 11px 13px;
  font: inherit;
}
textarea { min-height: 120px; resize: vertical; }
input:focus, textarea:focus {
  outline: 2px solid #9a65f566;
  border-color: #9a65f5;
}
.alert {
  margin: 12px 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: #3a1520;
  border: 1px solid #7a2a3a;
  color: #ffc2cc;
  font-size: 14px;
}
.alert.ok {
  background: #123528;
  border-color: #1f6b4a;
  color: #a8f0cf;
}

/* Admin */
.admin-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 24px 0 20px;
}
.admin-nav a {
  padding: 8px 14px;
  border-radius: 999px;
  background: #181a27;
  border: 1px solid var(--line);
  color: #dddff0;
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
}
.admin-nav a:hover {
  border-color: #9a65f5;
  color: #fff;
}
.admin-welcome { margin-bottom: 20px; }
.admin-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.admin-tiles a {
  display: block;
  padding: 20px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
  transition: 0.15s ease;
}
.admin-tiles a:hover { border-color: #9a65f5; transform: translateY(-2px); }
.admin-tiles strong {
  display: block;
  font-size: 1.6rem;
  margin-bottom: 4px;
}
.admin-tiles span { color: var(--muted); font-size: 13px; font-weight: 700; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px 22px;
  margin-bottom: 20px;
}
.panel h2 { margin: 0 0 12px; font-size: 1.15rem; }
.panel ul { margin: 0; padding-left: 18px; color: var(--muted); }
.panel li { margin-bottom: 6px; }

.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
th, td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.6px; }
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.actions form { margin: 0; }

.form-panel form { display: grid; gap: 14px; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}
.checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}
.checkbox input { width: auto; }
.preview-box {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-radius: 14px;
  background: #0d0e16;
  border: 1px dashed var(--line);
}
.preview-box img {
  max-width: 96px;
  max-height: 96px;
  image-rendering: pixelated;
  border-radius: 8px;
}

@media (max-width: 820px) {
  .topbar {
    height: auto;
    padding: 14px 16px;
    flex-direction: column;
    align-items: flex-start;
  }
  nav { gap: 12px; }
  .hero { padding: 32px 22px; }
  .container { width: calc(100% - 28px); }
  .prices { grid-template-columns: 1fr; }
}
