:root {
  --bg0: #05070d;
  --bg1: #0f1524;
  --card: rgba(14, 20, 35, 0.88);
  --card-strong: rgba(18, 26, 44, 0.96);
  --line: rgba(113, 145, 216, 0.28);
  --text: #ecf2ff;
  --muted: #9eb0d8;
  --accent: #2df7c4;
  --accent-2: #4f9dff;
  --danger: #ff5f7a;
  --warning: #f4bd5f;
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 10% 10%, #1f2b4a 0%, transparent 35%),
    radial-gradient(circle at 85% -5%, #20204a 0%, transparent 40%),
    linear-gradient(145deg, var(--bg0), var(--bg1));
  min-height: 100vh;
}

body.has-site-background {
  background-color: var(--bg0);
  background-image: radial-gradient(circle at 10% 10%, rgba(31, 43, 74, 0.56) 0%, transparent 40%),
    radial-gradient(circle at 85% -5%, rgba(32, 32, 74, 0.52) 0%, transparent 46%),
    linear-gradient(145deg, rgba(5, 7, 13, 0.88), rgba(10, 16, 30, 0.8)),
    var(--site-bg-image);
  background-repeat: no-repeat, no-repeat, no-repeat, no-repeat;
  background-size: auto, auto, auto, cover;
  background-position: center top, center top, center top, center center;
  background-attachment: fixed;
}

.background-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(80, 111, 190, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(80, 111, 190, 0.12) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: radial-gradient(circle at 50% 15%, black 35%, transparent 85%);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(6, 10, 18, 0.82);
  backdrop-filter: blur(14px);
}

.brand {
  font-family: "Orbitron", sans-serif;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-decoration: none;
  color: #ccedff;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.main-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.94rem;
  padding: 8px 10px;
  border-radius: 8px;
}

.main-nav a:hover {
  color: var(--text);
  background: rgba(80, 110, 180, 0.2);
}

.user-meta {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.page-shell {
  position: relative;
  z-index: 1;
  width: min(1100px, calc(100% - 28px));
  margin: 22px auto 40px;
  display: grid;
  gap: 18px;
}

.hero-panel,
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: inset 0 1px 0 rgba(194, 221, 255, 0.1), 0 18px 30px rgba(1, 6, 17, 0.35);
}

.hero-panel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.hero-panel h1,
.panel h1,
.panel h2,
.panel h3 {
  margin: 0;
  font-family: "Orbitron", sans-serif;
  font-weight: 700;
  line-height: 1.2;
}

.hero-panel p,
.panel p {
  color: var(--muted);
}

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

.flash p {
  margin: 0;
}

.flash + .flash {
  margin-top: -8px;
}

.flash-error {
  border-color: rgba(255, 95, 122, 0.5);
  background: rgba(255, 95, 122, 0.14);
}

.flash-success {
  border-color: rgba(45, 247, 196, 0.5);
  background: rgba(45, 247, 196, 0.14);
}

.auth-shell {
  min-height: calc(100vh - 130px);
  display: grid;
  place-items: center;
}

.auth-card {
  width: min(460px, 100%);
  background: var(--card-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: 0 24px 40px rgba(1, 6, 17, 0.45);
}

.form-stack {
  display: grid;
  gap: 12px;
}

.form-stack.compact {
  gap: 10px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 0.9rem;
  color: var(--muted);
}

input,
select,
textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: rgba(8, 12, 22, 0.75);
  border: 1px solid rgba(113, 145, 216, 0.35);
  border-radius: 12px;
  padding: 11px 12px;
}

select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 40px;
  background-image: linear-gradient(140deg, rgba(45, 247, 196, 0.08), rgba(79, 157, 255, 0.08)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='10' viewBox='0 0 14 10'%3E%3Cpath d='M1 1.5L7 8.5L13 1.5' stroke='%232df7c4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat, no-repeat;
  background-size: auto, 14px 10px;
  background-position: center, right 12px center;
  cursor: pointer;
}

select:hover {
  border-color: rgba(113, 145, 216, 0.55);
}

select option {
  color: var(--text);
  background: #101a30;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent-2);
  box-shadow: 0 0 0 2px rgba(79, 157, 255, 0.25);
}

.btn {
  border: 0;
  border-radius: 12px;
  padding: 10px 16px;
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #062012;
  background: linear-gradient(130deg, var(--accent), #70ffd4);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

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

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-ghost {
  color: var(--text);
  background: rgba(106, 140, 216, 0.2);
  border: 1px solid rgba(113, 145, 216, 0.4);
}

.btn-danger {
  color: #fff;
  background: linear-gradient(130deg, #ff5f7a, #ff7f98);
}

.btn-small {
  padding: 7px 10px;
  font-size: 0.84rem;
}

.muted-inline {
  color: var(--muted);
  font-size: 0.9rem;
}

.muted-inline a {
  color: var(--accent);
}

.profile-discord-status {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.profile-warning {
  margin-top: 8px;
  color: #ffd4dd;
}

.discord-status-line {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
}

.discord-status-line .discord-handle {
  color: #c9d6f3;
  font-weight: 600;
}

.discord-status-line a {
  color: var(--accent);
}

.badge-warning {
  border-color: rgba(244, 189, 95, 0.5);
  background: rgba(244, 189, 95, 0.15);
  color: #ffe2ad;
}

.empty-state {
  color: var(--muted);
  border: 1px dashed rgba(113, 145, 216, 0.35);
  border-radius: 12px;
  padding: 14px;
}

.dashboard-filter-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  align-items: stretch;
}

.dashboard-filter-box {
  background: rgba(11, 17, 30, 0.78);
  border: 1px solid rgba(113, 145, 216, 0.28);
  border-radius: 14px;
  padding: 12px;
  min-height: 106px;
  display: flex;
  justify-content: center;
  align-items: center;
  width: max-content;
  max-width: 100%;
  text-align: center;
}

.dashboard-filter-box label {
  width: auto;
  height: 100%;
  min-width: 230px;
  justify-content: center;
  justify-items: center;
  align-content: center;
  gap: 8px;
  text-align: center;
}

.dashboard-filter-box select {
  width: auto;
  min-width: 220px;
  max-width: 100%;
}

.dashboard-date-range {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.dashboard-date-range input[type="date"] {
  width: 172px;
  max-width: 100%;
}

.filter-actions {
  width: 100%;
  justify-content: center;
  align-items: center;
}

.session-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 14px;
}

.subscription-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.session-card {
  background: rgba(11, 17, 30, 0.78);
  border: 1px solid rgba(113, 145, 216, 0.28);
  border-radius: 14px;
  padding: 14px;
  display: grid;
  gap: 10px;
}

.subscription-card {
  min-height: 240px;
}

.game-banner-preview {
  width: 100%;
  max-height: 140px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid rgba(113, 145, 216, 0.3);
}

.session-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.session-card-top span {
  color: var(--muted);
  font-size: 0.85rem;
}

.session-meta,
.session-notes {
  margin: 0;
  color: #bfd0ef;
}

.slot-info {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  color: var(--muted);
}

.slot-info.large strong {
  font-size: 1.4rem;
}

.slot-info strong {
  font-size: 1.1rem;
  color: #fff;
}

.progress-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(40, 58, 97, 0.5);
  overflow: hidden;
}

.progress-track span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.session-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.session-actions.stack {
  margin-top: 12px;
}

.manage-session-form {
  width: min(460px, 100%);
}

.slot-stepper {
  position: relative;
  display: block;
}

.slot-stepper input[type="number"] {
  padding-right: 54px;
}

.slot-stepper input[type="number"]::-webkit-outer-spin-button,
.slot-stepper input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.slot-stepper input[type="number"] {
  -moz-appearance: textfield;
}

.slot-stepper-buttons {
  position: absolute;
  right: 6px;
  top: 6px;
  bottom: 6px;
  width: 36px;
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 4px;
}

.slot-stepper-btn {
  border: 1px solid rgba(113, 145, 216, 0.45);
  border-radius: 8px;
  background: linear-gradient(145deg, rgba(45, 247, 196, 0.2), rgba(79, 157, 255, 0.22));
  color: #dcf6ff;
  font-size: 0.72rem;
  line-height: 1;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}

.slot-stepper-btn:hover {
  border-color: rgba(45, 247, 196, 0.75);
  background: linear-gradient(145deg, rgba(45, 247, 196, 0.3), rgba(79, 157, 255, 0.34));
}

.slot-stepper-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(79, 157, 255, 0.35);
}

.session-banner {
  width: 100%;
  max-height: 280px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid rgba(113, 145, 216, 0.35);
}

.badge {
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  border: 1px solid rgba(45, 247, 196, 0.45);
  background: rgba(45, 247, 196, 0.15);
  color: #b2ffe6;
}

.badge-full {
  border-color: rgba(255, 95, 122, 0.45);
  background: rgba(255, 95, 122, 0.14);
  color: #ffd4dd;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

th,
td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid rgba(113, 145, 216, 0.22);
}

th {
  color: #c9d6f3;
  font-size: 0.86rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.inline-form {
  display: contents;
}

.inline-form input[type="text"] {
  min-width: 180px;
}

.inline-check {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-width: 0;
  padding: 9px 12px;
  border: 1px solid rgba(113, 145, 216, 0.28);
  border-radius: 12px;
  background: rgba(8, 12, 22, 0.62);
}

.inline-check .check-label {
  min-width: 0;
  color: #d9e7ff;
  overflow-wrap: anywhere;
}

input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  margin: 0;
  border-radius: 6px;
  border: 1px solid rgba(96, 128, 214, 0.75);
  background: linear-gradient(160deg, rgba(16, 24, 44, 0.95), rgba(8, 13, 24, 0.95));
  display: grid;
  place-items: center;
  cursor: pointer;
  flex: 0 0 18px;
  box-shadow: inset 0 0 0 1px rgba(169, 194, 255, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.25);
}

input[type="checkbox"]::before {
  content: "";
  width: 10px;
  height: 10px;
  clip-path: polygon(16% 55%, 0 70%, 38% 100%, 100% 26%, 84% 10%, 37% 71%);
  transform: scale(0);
  transform-origin: center;
  transition: transform 0.16s ease-out;
  background: linear-gradient(160deg, #2df7c4, #4f9dff);
  filter: drop-shadow(0 0 4px rgba(45, 247, 196, 0.45));
}

input[type="checkbox"]:checked {
  border-color: rgba(45, 247, 196, 0.85);
  box-shadow: inset 0 0 0 1px rgba(45, 247, 196, 0.2), 0 0 0 1px rgba(2, 8, 18, 0.4);
}

input[type="checkbox"]:checked::before {
  transform: scale(1);
}

input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 1px rgba(45, 247, 196, 0.2), 0 0 0 2px rgba(79, 157, 255, 0.4);
}

.subscription-card .session-card-top .badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  line-height: 1;
}

.global-background-preview-wrap {
  margin: 10px 0 14px;
  display: grid;
  gap: 8px;
  width: min(560px, 100%);
}

.global-background-preview {
  width: 100%;
  max-height: 210px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid rgba(113, 145, 216, 0.35);
}

.actions-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.stat-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(11, 17, 30, 0.8);
  padding: 16px;
}

.stat-card h2 {
  margin: 0;
  font-size: 1.6rem;
}

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

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.panel.narrow {
  max-width: 740px;
}

@media (max-width: 880px) {
  .site-header {
    flex-wrap: wrap;
  }

  .main-nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .hero-panel {
    flex-direction: column;
    align-items: flex-start;
  }

  .detail-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .dashboard-filter-row {
    display: grid;
    grid-template-columns: 1fr;
    justify-content: initial;
  }

  .dashboard-filter-box {
    width: 100%;
    text-align: left;
    justify-content: flex-start;
  }

  .dashboard-filter-box label {
    width: 100%;
    min-width: 0;
    justify-items: stretch;
    text-align: left;
  }

  .dashboard-filter-box select {
    width: 100%;
    min-width: 0;
  }

  .dashboard-date-range {
    justify-content: stretch;
  }

  .dashboard-date-range input[type="date"] {
    width: 100%;
  }
}
