:root {
  --bg: #0d0f14;
  --surface: #161b26;
  --surface-hover: #1c2330;
  --cyan: #5ce1ff;
  --blue: #2563eb;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --border: rgba(255, 255, 255, 0.08);
  --radius: 0;
  --max-w: 1100px;
  --pad-x: clamp(1.25rem, 4vw, 7.5rem);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.site-auth-error {
  margin: 0;
  padding: 0.75rem var(--pad-x);
  text-align: center;
  font-size: 0.875rem;
  font-weight: 500;
  color: #fecaca;
  background: rgba(220, 38, 38, 0.15);
  border-bottom: 1px solid rgba(220, 38, 38, 0.35);
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1.5rem;
  height: 80px;
  padding: 0 var(--pad-x);
  background: rgba(13, 15, 20, 0.92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 1.125rem;
  letter-spacing: 0.12em;
}

.brand__logo {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  object-fit: contain;
}

.site-nav {
  display: flex;
  justify-self: center;
  gap: 2.5rem;
}

.site-nav a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  transition: color 0.2s;
}

.site-nav a:hover,
.site-nav a.is-active {
  color: var(--cyan);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.625rem 1.25rem;
  font-size: 0.8125rem;
  font-weight: 600;
  border-radius: var(--radius);
  border: 1px solid rgba(92, 225, 255, 0.45);
  background: rgba(37, 99, 235, 0.15);
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.btn:hover {
  border-color: var(--cyan);
  background: rgba(37, 99, 235, 0.28);
}

.btn--primary {
  border: none;
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  color: #0a1020;
}

.btn--primary:hover {
  filter: brightness(1.05);
}

.btn--logged-in {
  border-color: rgba(92, 225, 255, 0.35);
  background: rgba(22, 27, 38, 0.9);
}

/* Header — logged-in user menu */
.auth-header {
  position: relative;
  flex-shrink: 0;
  justify-self: end;
}

.auth-user-menu {
  position: relative;
}

.auth-user-menu__trigger {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.625rem;
  min-width: 9rem;
  padding: 0.375rem 0.75rem 0.375rem 0.375rem;
  border: 1px solid rgba(92, 225, 255, 0.35);
  border-radius: var(--radius);
  background: rgba(22, 27, 38, 0.92);
  color: var(--text);
  font: inherit;
  text-align: right;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.auth-user-menu__avatar {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid rgba(92, 225, 255, 0.35);
  background: #5865f2;
}

.auth-user-menu__avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.auth-user-menu__avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
  background: linear-gradient(135deg, #5865f2, #4752c4);
}

.auth-user-menu__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.125rem;
  min-width: 0;
}

.auth-user-menu__trigger:hover,
.auth-header--open .auth-user-menu__trigger {
  border-color: var(--cyan);
  background: rgba(37, 99, 235, 0.18);
}

.auth-user-menu__name {
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--text);
}

.auth-user-menu__role {
  max-width: 9rem;
  overflow: hidden;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.25;
  color: var(--cyan);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-user-menu__panel {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  z-index: 120;
  min-width: 12.5rem;
  padding: 0.875rem;
  border: 1px solid rgba(92, 225, 255, 0.22);
  background: var(--surface);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

.auth-user-menu__panel[hidden] {
  display: none;
}

.auth-user-menu__profile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.auth-user-menu__avatar--lg {
  width: 2.75rem;
  height: 2.75rem;
}

.auth-user-menu__avatar-img--lg {
  width: 100%;
  height: 100%;
}

.auth-user-menu__profile-text {
  min-width: 0;
}

.auth-user-menu__profile-name {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.3;
}

.auth-user-menu__profile-role {
  margin: 0.125rem 0 0;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--cyan);
}

.auth-user-menu__dev-note {
  margin: 0.375rem 0 0;
  font-size: 0.6875rem;
  line-height: 1.4;
  color: var(--muted);
}

.auth-user-menu__subs {
  margin-bottom: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.auth-user-menu__subs:last-of-type {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0.75rem;
}

.auth-user-menu__subs-label {
  margin: 0 0 0.5rem;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.auth-user-menu__subs-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.auth-user-menu__subs-list li {
  padding: 0.25rem 0;
  font-size: 0.8125rem;
  color: var(--text);
}

.auth-user-menu__logout {
  width: 100%;
  justify-content: center;
}

/* Dev login modal */
.auth-dev-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.auth-dev-modal[hidden] {
  display: none;
}

.auth-dev-modal-open {
  overflow: hidden;
}

.auth-dev-modal__backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: rgba(0, 0, 0, 0.65);
}

.auth-dev-modal__card {
  position: relative;
  z-index: 1;
  width: min(100%, 460px);
  max-height: min(92vh, 720px);
  overflow-y: auto;
  padding: 1.75rem;
  border: 1px solid rgba(92, 225, 255, 0.2);
  background: var(--surface);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
}

.auth-dev-modal__title {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
}

.auth-dev-modal__intro {
  margin: 0 0 1.25rem;
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.5;
}

.auth-dev-modal__field {
  display: block;
  margin-bottom: 1.25rem;
}

.auth-dev-modal__field-label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
}

.auth-dev-modal__input {
  width: 100%;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

.auth-dev-modal__roles {
  margin: 0 0 1.25rem;
  padding: 0;
  border: none;
}

.auth-dev-modal__subroles {
  margin-top: 0.5rem;
}

#auth-dev-subrole-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 11.5rem;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.auth-dev-modal__role--compact {
  padding: 0.625rem 0.875rem;
}

.auth-dev-modal__roles .auth-dev-modal__field-label {
  margin-bottom: 0.75rem;
}

.auth-dev-modal__hint {
  font-weight: 400;
  color: var(--muted);
}

.auth-dev-modal__role {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  margin-bottom: 0.5rem;
  padding: 0.75rem 0.875rem;
  border: 1px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.auth-dev-modal__role:last-child {
  margin-bottom: 0;
}

.auth-dev-modal__role:hover {
  border-color: rgba(92, 225, 255, 0.25);
  background: rgba(255, 255, 255, 0.02);
}

.auth-dev-modal__role:has(input:checked) {
  border-color: rgba(92, 225, 255, 0.5);
  background: rgba(37, 99, 235, 0.12);
}

.auth-dev-modal__role:has(input:checked) .auth-dev-modal__role-label {
  color: var(--cyan);
}

.auth-dev-modal__radio-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.auth-dev-modal__radio-mark {
  flex-shrink: 0;
  width: 1.125rem;
  height: 1.125rem;
  margin-top: 0.125rem;
  border: 2px solid var(--muted);
  border-radius: 50%;
  background: transparent;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.auth-dev-modal__role:has(input:checked) .auth-dev-modal__radio-mark {
  border-color: var(--cyan);
  background: var(--cyan);
  box-shadow: inset 0 0 0 3px var(--bg);
}

.auth-dev-modal__role:has(input:focus-visible) .auth-dev-modal__radio-mark {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.auth-dev-modal__check-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.auth-dev-modal__check-mark {
  flex-shrink: 0;
  width: 1.125rem;
  height: 1.125rem;
  margin-top: 0.125rem;
  border: 2px solid var(--muted);
  border-radius: 2px;
  background: transparent;
  transition: border-color 0.15s, background 0.15s;
}

.auth-dev-modal__role--check:has(input:checked) .auth-dev-modal__check-mark {
  border-color: var(--cyan);
  background: var(--cyan);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%230a0c10' stroke-width='2' d='M2 6l3 3 5-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 0.75rem;
}

.auth-dev-modal__role--check:has(input:focus-visible) .auth-dev-modal__check-mark {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.auth-dev-modal__role-body {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.auth-dev-modal__role-label {
  font-size: 0.9375rem;
  font-weight: 600;
}

.auth-dev-modal__role-desc {
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.45;
}

.auth-dev-modal__preview-wrap {
  margin-bottom: 1rem;
  padding: 0.875rem;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
}

.auth-dev-modal__preview-label {
  margin: 0 0 0.625rem;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.auth-dev-modal__preview-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.375rem 0.75rem 0.375rem 0.375rem;
  border: 1px solid rgba(92, 225, 255, 0.35);
  background: rgba(22, 27, 38, 0.92);
}

.auth-dev-modal__preview-chip .auth-user-menu__meta {
  align-items: flex-start;
  text-align: left;
}

.auth-dev-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 0.5rem;
  padding-top: 0.25rem;
}

/* Rules page */
/* Regler page styles live in css/rules.css */

/* Footer — Destiny-style: three columns, generous spacing, line + copyright */
.site-footer {
  margin-top: auto;
  padding: 4.5rem var(--pad-x) 3.5rem;
  background: transparent;
  border-top: 1px solid var(--border);
}

.site-footer__inner {
  max-width: var(--max-w);
  margin: 0 auto;
}

.site-footer__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: clamp(2.5rem, 10vw, 7rem);
  padding-bottom: 2.75rem;
}

.site-footer__brand {
  flex: 0 1 22rem;
  min-width: 0;
}

.site-footer__brand .brand {
  font-size: 1.125rem;
}

.site-footer__brand p {
  margin: 1.25rem 0 0;
  max-width: 20rem;
  font-size: 0.875rem;
  line-height: 1.7;
  color: var(--muted);
}

.site-footer__col {
  flex: 0 0 auto;
  min-width: 8rem;
}

.site-footer__col h4 {
  margin: 0 0 1.125rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
}

.site-footer__col ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-footer__col li + li {
  margin-top: 0.875rem;
}

.site-footer__col a {
  font-size: 0.875rem;
  line-height: 1.4;
  color: var(--muted);
}

.site-footer__col a:hover {
  color: var(--cyan);
}

.site-footer__divider {
  height: 1px;
  background: var(--border);
  margin: 0 0 2.25rem;
}

.site-footer__copy {
  text-align: center;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--muted);
}

body {
  display: flex;
  flex-direction: column;
}

@media (max-width: 768px) {
  .site-nav {
    display: none;
  }

  .site-footer {
    padding: 3rem var(--pad-x) 2.5rem;
  }

  .site-footer__top {
    flex-direction: column;
    gap: 2.5rem;
    padding-bottom: 2rem;
  }

  .site-footer__brand {
    flex: none;
    max-width: none;
  }

  .rule-list__item {
    grid-template-columns: 2.5rem 1fr;
  }
}
