@import url('/lib/fonts.css');

html,
body {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
  display: none;
}

/* ============================================
   M3 DESIGN TOKENS – DARK MODE (Default)
   ============================================ */
:root {
  /* Schriften der Material-Bausteine (Chips, Knöpfe). Ohne diese Angabe suchen sie
     Roboto, die hier nicht geladen wird, und fallen auf eine Serifenschrift zurück. */
  --md-ref-typeface-plain: 'Outfit', 'Segoe UI', sans-serif;
  --md-ref-typeface-brand: 'Fredoka', 'Outfit', sans-serif;

  /* Primary */
  --md-sys-color-primary: #a0c4ff;
  --md-sys-color-on-primary: #003060;
  --md-sys-color-primary-container: #004a87;
  --md-sys-color-on-primary-container: #d1e4ff;

  /* Secondary */
  --md-sys-color-secondary: #bbc7db;
  --md-sys-color-on-secondary: #263141;
  --md-sys-color-secondary-container: #3c4858;
  --md-sys-color-on-secondary-container: #d7e3f7;

  /* Tertiary */
  --md-sys-color-tertiary: #d5bee5;
  --md-sys-color-on-tertiary: #3a2849;
  --md-sys-color-tertiary-container: #523f61;
  --md-sys-color-on-tertiary-container: #f1deff;

  /* Surface & Background */
  --md-sys-color-surface: #111318;
  --md-sys-color-surface-dim: #111318;
  --md-sys-color-surface-bright: #37393e;
  --md-sys-color-on-surface: #e2e2e6;
  --md-sys-color-on-surface-variant: #c3c6cf;
  --md-sys-color-surface-container-lowest: #0c0e13;
  --md-sys-color-surface-container-low: #191c20;
  --md-sys-color-surface-container: #1d2024;
  --md-sys-color-surface-container-high: #282a2f;
  --md-sys-color-surface-container-highest: #32353a;

  /* Outline */
  --md-sys-color-outline: #8d9099;
  --md-sys-color-outline-variant: #43474e;

  /* Error */
  --md-sys-color-error: #ffb4ab;
  --md-sys-color-on-error: #690005;

  /* Inverse */
  --md-sys-color-inverse-surface: #e2e2e6;
  --md-sys-color-inverse-on-surface: #2f3036;
  --md-sys-color-inverse-primary: #005faf;

  /* Mapped Variables (for backward compat) */
  --bg-gradient-start: #0044ff;
  --bg-gradient-end: #020081;
  --profile-bg: rgba(17, 19, 24, 0.75);
  --modal-bg: rgba(17, 19, 24, 0.85);
  --text-color: var(--md-sys-color-on-surface);
  --text-secondary: var(--md-sys-color-on-surface-variant);
  --role-bg: var(--md-sys-color-surface-container);
  --role-border: var(--md-sys-color-outline-variant);
  --button-bg: rgba(147, 197, 253, 0.10);
  --button-border: rgba(147, 197, 253, 0.16);
  --button-hover-bg: rgba(147, 197, 253, 0.18);
  --button-glow: 0 4px 16px rgba(147, 197, 253, 0.20);
  --description-bg: rgba(147, 197, 253, 0.07);
  --card-border: rgba(147, 197, 253, 0.12);
  --card-shadow: 0 2px 6px rgba(0, 0, 0, 0.15), 0 8px 24px rgba(0, 0, 0, 0.2);
  --avatar-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  --footer-link-color: var(--md-sys-color-primary);

  /* M3 Elevation */
  --md-sys-elevation-1: 0 1px 3px 1px rgba(0, 0, 0, .15), 0 1px 2px rgba(0, 0, 0, .3);
  --md-sys-elevation-2: 0 2px 6px 2px rgba(0, 0, 0, .15), 0 1px 2px rgba(0, 0, 0, .3);
  --md-sys-elevation-3: 0 4px 8px 3px rgba(0, 0, 0, .15), 0 1px 3px rgba(0, 0, 0, .3);

  /* M3 Shape */
  --md-sys-shape-corner-none: 0px;
  --md-sys-shape-corner-extra-small: 4px;
  --md-sys-shape-corner-small: 8px;
  --md-sys-shape-corner-medium: 12px;
  --md-sys-shape-corner-large: 16px;
  --md-sys-shape-corner-extra-large: 28px;
  --md-sys-shape-corner-full: 9999px;

  /* M3 Motion */
  --md-sys-motion-easing-standard: cubic-bezier(0.2, 0, 0, 1);
  --md-sys-motion-easing-emphasized: cubic-bezier(0.2, 0, 0, 1);
  --md-sys-motion-duration-short: 200ms;
  --md-sys-motion-duration-medium: 300ms;
  --md-sys-motion-duration-long: 500ms;

  /* M3 Component Tokens */
  --md-filled-tonal-button-container-color: var(--md-sys-color-secondary-container);
  --md-filled-tonal-button-label-text-color: var(--md-sys-color-on-secondary-container);
  --md-icon-button-icon-color: var(--md-sys-color-on-surface-variant);
}

/* ============================================
   M3 DESIGN TOKENS – LIGHT MODE
   ============================================ */
.light-mode {
  /* Primary */
  --md-sys-color-primary: #005faf;
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-primary-container: #d1e4ff;
  --md-sys-color-on-primary-container: #001d36;

  /* Secondary */
  --md-sys-color-secondary: #535f70;
  --md-sys-color-on-secondary: #ffffff;
  --md-sys-color-secondary-container: #d7e3f7;
  --md-sys-color-on-secondary-container: #101c2b;

  /* Surface */
  --md-sys-color-surface: #f8f9ff;
  --md-sys-color-surface-dim: #d8dae0;
  --md-sys-color-surface-bright: #f8f9ff;
  --md-sys-color-on-surface: #191c20;
  --md-sys-color-on-surface-variant: #43474e;
  --md-sys-color-surface-container-lowest: #ffffff;
  --md-sys-color-surface-container-low: #f2f3f9;
  --md-sys-color-surface-container: #ecedf3;
  --md-sys-color-surface-container-high: #e7e8ee;
  --md-sys-color-surface-container-highest: #e1e2e8;

  /* Outline */
  --md-sys-color-outline: #73777f;
  --md-sys-color-outline-variant: #c3c6cf;

  /* Inverse */
  --md-sys-color-inverse-surface: #2f3036;
  --md-sys-color-inverse-on-surface: #f0f0f6;
  --md-sys-color-inverse-primary: #a0c4ff;

  /* Mapped Variables */
  --bg-gradient-start: #8ab4f8;
  --bg-gradient-end: #d2e3fc;
  --profile-bg: rgba(248, 249, 255, 0.8);
  --modal-bg: rgba(248, 249, 255, 0.9);
  --text-color: var(--md-sys-color-on-surface);
  --text-secondary: var(--md-sys-color-on-surface-variant);
  --role-bg: var(--md-sys-color-surface-container);
  --role-border: var(--md-sys-color-outline-variant);
  --button-bg: var(--md-sys-color-surface-container-low);
  --button-border: var(--md-sys-color-outline-variant);
  --button-hover-bg: var(--md-sys-color-surface-container-high);
  --button-glow: 0 4px 16px rgba(0, 95, 175, 0.08);
  --description-bg: var(--md-sys-color-surface-container-low);
  --card-border: var(--md-sys-color-outline-variant);
  --card-shadow: 0 2px 6px rgba(0, 0, 50, 0.06), 0 8px 24px rgba(0, 0, 50, 0.08);
  --avatar-shadow: 0 4px 16px rgba(0, 0, 50, 0.12);
  --footer-link-color: var(--md-sys-color-primary);

  /* M3 Elevation (lighter for light mode) */
  --md-sys-elevation-1: 0 1px 3px 1px rgba(0, 0, 0, .08), 0 1px 2px rgba(0, 0, 0, .12);
  --md-sys-elevation-2: 0 2px 6px 2px rgba(0, 0, 0, .08), 0 1px 2px rgba(0, 0, 0, .12);
  --md-sys-elevation-3: 0 4px 8px 3px rgba(0, 0, 0, .08), 0 1px 3px rgba(0, 0, 0, .12);
}

/* ============================================
   GLOBAL STYLES
   ============================================ */
body {
  margin: 0;
  font-family: 'Outfit', 'Roboto', 'Segoe UI', sans-serif;
  background: linear-gradient(135deg, var(--bg-gradient-start), var(--bg-gradient-end));
  background-attachment: fixed;
  color: var(--text-color);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px;
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.username,
h1,
h2,
h3,
.account-button {
  font-family: 'Fredoka', 'Outfit', sans-serif;
}

/* ============================================
   M3 ICON STYLING
   ============================================ */
md-icon {
  font-family: 'Material Symbols Outlined';
  font-size: 20px;
  vertical-align: middle;
  color: inherit;
}

.account-button md-icon {
  font-size: 22px;
  opacity: 0.85;
}

/* ============================================
   PROFILE CONTAINER
   ============================================ */
.profile-container {
  max-width: 650px;
  width: 100%;
  background: var(--profile-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--md-sys-shape-corner-extra-large);
  position: relative;
  margin-top: 48px;
  box-shadow: var(--md-sys-elevation-3);
  overflow: visible;
  border: 1px solid var(--card-border);
}

/* ============================================
   BANNER
   ============================================ */
.banner {
  width: 100%;
  height: 180px;
  position: relative;
  border-radius: 27px 27px 0 0;
  overflow: hidden;
}

.banner-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: relative;
  z-index: 2;
  opacity: 0;
  transition: opacity 0.6s var(--md-sys-motion-easing-standard);
}

.banner-img.loaded {
  opacity: 1;
}

/* ============================================
   AVATAR
   ============================================ */
.avatar-container {
  position: absolute;
  top: 110px;
  right: 32px;
  width: 140px;
  height: 140px;
  border-radius: var(--md-sys-shape-corner-full);
  z-index: 10;
  box-shadow: var(--avatar-shadow);
  overflow: hidden;
}

.avatar-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--md-sys-shape-corner-full);
  z-index: 2;
  opacity: 0;
  transition: opacity 0.6s var(--md-sys-motion-easing-standard);
}

.avatar-img.loaded {
  opacity: 1;
}

/* ============================================
   SKELETON SHIMMER
   ============================================ */
.skeleton-shimmer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--button-bg);
  z-index: 1;
}

.skeleton-shimmer::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.5s infinite;
}

.light-mode .skeleton-shimmer::after {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
}

@keyframes shimmer {
  100% {
    transform: translateX(100%);
  }
}

/* ============================================
   PROFILE CONTENT & SPACING
   ============================================ */
.profile-content {
  padding: 32px;
}

.profile-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.username {
  font-size: 34px;
  font-weight: 600;
  margin-bottom: 4px;
  letter-spacing: 0.5px;
  color: var(--text-color);
}

.pronouns {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 32px;
  letter-spacing: 0.2px;
}

/* ============================================
   CATEGORY LABELS (M3 Label Large)
   ============================================ */
.roles-title {
  font-family: 'Outfit', sans-serif;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-secondary);
  font-weight: 600;
  margin-bottom: 12px;
}

.links-title-container {
  margin-top: 32px;
  width: 100%;
}

/* ============================================
   ROLLEN (M3 ASSIST CHIPS)
   ============================================ */
md-assist-chip {
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
}

/* M3 Chip theming */
md-chip-set {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

md-assist-chip {
  --md-assist-chip-container-shape: var(--md-sys-shape-corner-small);
  --md-assist-chip-outline-color: var(--md-sys-color-outline-variant);
  --md-assist-chip-label-text-color: var(--md-sys-color-on-surface);
}

/* ============================================
   ACCOUNT BUTTONS (Social Links)
   ============================================ */
.accounts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
}

.account-button {
  background: var(--button-bg);
  border: 1px solid var(--button-border);
  padding: 14px 16px;
  border-radius: var(--md-sys-shape-corner-medium);
  color: var(--text-color);
  text-decoration: none !important;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  font-weight: 500;
  transition: all var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-standard);
  position: relative;
  overflow: hidden;
}

.account-button:hover {
  background: var(--button-hover-bg);
  transform: translateY(-2px);
  box-shadow: var(--md-sys-elevation-2);
}

.account-button:active {
  transform: translateY(0);
  box-shadow: var(--md-sys-elevation-1);
}

/* M3 Ripple inside account buttons */
.account-button md-ripple {
  --md-ripple-hover-color: var(--md-sys-color-on-surface);
  --md-ripple-pressed-color: var(--md-sys-color-on-surface);
  --md-ripple-hover-opacity: 0.08;
  --md-ripple-pressed-opacity: 0.12;
}

/* Knopf über die ganze Breite, etwa für den Discord-Server */
.account-button-breit {
  grid-column: 1 / -1;
}

/* ============================================
   FOOTER
   ============================================ */
.footer-bubble {
  margin-top: 48px;
  padding: 24px 16px;
  text-align: center;
}

/* Die Links liegen in einer eigenen Blase, damit sie auch über dem hellen Teil des
   Hintergrunds lesbar bleiben */
.footer-bubble-content {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 26px;
  max-width: 900px;
  padding: 12px 24px;
  box-sizing: border-box;
  border-radius: 24px;
  background: var(--profile-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
}

.footer-bubble-content a,
.footer-bubble-content span {
  color: var(--footer-link-color);
  text-decoration: none;
  white-space: nowrap;
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  font-family: 'Outfit', sans-serif;
  transition: color var(--md-sys-motion-duration-short) var(--md-sys-motion-easing-standard);
}

.footer-bubble-content a:hover,
.footer-bubble-content span:hover {
  text-decoration: underline;
  opacity: 0.85;
}

/* ============================================
   THEME SWITCHER (now md-icon-button)
   ============================================ */
.theme-switcher {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 1000;
}

.theme-switcher md-icon-button,
.subpage-nav md-icon-button,
#a11y-btn md-icon-button {
  --md-icon-button-container-width: 48px;
  --md-icon-button-container-height: 48px;
  --md-icon-button-icon-size: 24px;
  --md-icon-button-icon-color: var(--text-color);
  background: var(--profile-bg);
  border-radius: 50%;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--button-border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.theme-switcher md-icon-button:hover,
.subpage-nav md-icon-button:hover,
#a11y-btn md-icon-button:hover {
  background: var(--button-hover-bg);
  transform: scale(1.06);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

#a11y-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
}

/* Accessibility Filters */
html.a11y-mode-protanopia {
  filter: url('#filter-protanopia');
}

html.a11y-mode-deuteranopia {
  filter: url('#filter-deuteranopia');
}

html.a11y-mode-tritanopia {
  filter: url('#filter-tritanopia');
}

html.a11y-mode-grayscale {
  filter: grayscale(100%);
}

html.a11y-mode-contrast {
  filter: contrast(130%) saturate(120%);
}

/* ============================================
   MODALS (M3 Dialog Style)
   ============================================ */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-standard),
    visibility var(--md-sys-motion-duration-medium);
  z-index: 2000;
  padding: 24px;
  box-sizing: border-box;
  overscroll-behavior: contain;
}

.modal.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: var(--modal-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  width: 100%;
  max-width: 650px;
  max-height: 85vh;
  border-radius: var(--md-sys-shape-corner-extra-large);
  padding: 32px;
  overflow-y: auto;
  position: relative;
  transform: scale(0.92) translateY(16px);
  transition: transform var(--md-sys-motion-duration-long) var(--md-sys-motion-easing-emphasized);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.24);
  border: 1px solid var(--card-border);
  color: var(--text-color);
  overscroll-behavior: contain;
}

.modal.active .modal-content {
  transform: scale(1) translateY(0);
}

.modal-content::-webkit-scrollbar {
  width: 8px;
}

.modal-content::-webkit-scrollbar-track {
  background: transparent;
  margin: 16px 0;
}

.modal-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--md-sys-shape-corner-full);
}

.modal-content::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

.light-mode .modal-content::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
}

.light-mode .modal-content::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.2);
}

.modal-content h2 {
  margin-top: 0;
  margin-bottom: 16px;
  font-size: 24px;
  font-family: 'Outfit', 'Fredoka', sans-serif;
  font-weight: 500;
  letter-spacing: 0;
}

.modal-content h3 {
  margin-top: 24px;
  font-size: 16px;
  font-family: 'Outfit', 'Fredoka', sans-serif;
  font-weight: 500;
  letter-spacing: 0.1px;
}

.modal-content p,
.modal-content li {
  line-height: 1.7;
  color: var(--text-secondary);
  font-size: 14px;
}

.modal-content a {
  color: var(--footer-link-color);
  text-decoration: underline;
  cursor: pointer;
  transition: opacity var(--md-sys-motion-duration-short);
}

.modal-content a:hover {
  opacity: 0.8;
}

/* M3 styled close button */
.close-modal {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 1;
}

.close-modal md-icon-button {
  --md-icon-button-icon-color: var(--md-sys-color-on-surface-variant);
  --md-icon-button-container-width: 40px;
  --md-icon-button-container-height: 40px;
}

/* ============================================
   M3 DIVIDER
   ============================================ */
md-divider {
  --md-divider-color: var(--md-sys-color-outline-variant);
  margin: 24px 0;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 600px) {
  .avatar-container {
    position: relative;
    top: -70px;
    right: auto;
    margin: 0 auto -50px;
  }

  .profile-info {
    align-items: center;
    text-align: center;
  }

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

  .footer-bubble-content {
    flex-direction: column;
    gap: 14px;
    padding: 16px 28px;
  }
}

/* ============================================
   SUBPAGE NAVIGATION BAR
   ============================================ */
.subpage-nav {
  position: fixed;
  top: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 100;
  pointer-events: none;
}

.subpage-nav>* {
  pointer-events: auto;
}

.subpage-nav-links {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Auf den Unterseiten sitzt der Umschalter in der Kopfzeile statt fest oben rechts */
.subpage-nav .theme-switcher {
  position: static;
}

/* Name und Profilbild, führt zur Startseite */
.marke {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 0 18px 0 5px;
  box-sizing: border-box;
  border-radius: var(--md-sys-shape-corner-full);
  background: var(--profile-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--button-border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  color: var(--text-color);
  text-decoration: none;
  font-family: 'Fredoka', 'Outfit', sans-serif;
  font-size: 18px;
  font-weight: 600;
  transition: background 0.2s ease, transform 0.2s ease;
}

.marke:hover {
  background: var(--button-hover-bg);
  transform: scale(1.03);
}

.marke:focus-visible {
  outline: 2px solid var(--md-sys-color-primary);
  outline-offset: 2px;
}

.marke img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
}

/* ============================================
   SUBPAGE CONTAINER (rules, text pages)
   ============================================ */
.subpage-container {
  background: var(--profile-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--md-sys-shape-corner-extra-large);
  padding: 40px;
  max-width: 1000px;
  width: 95%;
  margin: 4rem auto 2rem;
  box-shadow: var(--card-shadow);
  box-sizing: border-box;
  border: 1px solid var(--card-border);
  color: var(--text-color);
}

.subpage-container h2 {
  color: var(--text-color);
  margin-top: 0;
  font-family: 'Fredoka', 'Outfit', sans-serif;
  font-size: 28px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 12px;
}

.subpage-container h2 md-icon {
  font-size: 28px;
  --md-icon-size: 28px;
}

.subpage-container h3 {
  color: var(--md-sys-color-primary, #a0c4ff);
  margin-top: 32px;
  font-family: 'Outfit', 'Fredoka', sans-serif;
  font-size: 16px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

.subpage-container p,
.subpage-container li {
  line-height: 1.7;
  color: var(--text-secondary);
  font-size: 15px;
}

.subpage-container ul {
  padding-left: 1.4rem;
}

.subpage-container li {
  margin-bottom: 4px;
}

.subpage-container li::marker {
  content: "\2022\0020";
  color: var(--md-sys-color-primary, #a0c4ff);
}

.subpage-container md-icon {
  font-family: 'Material Symbols Outlined';
  font-size: 20px;
  vertical-align: middle;
  color: var(--md-sys-color-primary, #a0c4ff);
}

/* Verweise im Fließtext der Unterseiten */
.subpage-container p a,
.subpage-container li a {
  color: var(--footer-link-color, #a0c4ff);
}

/* Das Herz am Ende der Kurzfassung */
.subpage-container md-icon.herz {
  font-size: 18px;
  color: #ffb74d;
}

.subpage-container md-divider {
  --md-divider-color: var(--card-border);
  margin: 24px 0;
}

/* ============================================
   RECHTSTEXTE (Impressum / Datenschutz / Haftung)
   Gilt sowohl auf den eigenen Seiten als auch im
   Modal, das legal-modals.js daraus befüllt.
   ============================================ */
.legal-body a {
  color: var(--footer-link-color, #a0c4ff);
  text-decoration: underline;
  transition: opacity var(--md-sys-motion-duration-short);
}

.legal-body a:hover {
  opacity: 0.8;
}

.legal-body h3 {
  color: var(--md-sys-color-primary, #a0c4ff);
  margin-top: 32px;
  font-family: 'Outfit', 'Fredoka', sans-serif;
  font-size: 16px;
  font-weight: 500;
}

.legal-body p,
.legal-body li {
  line-height: 1.7;
  color: var(--text-secondary);
  font-size: 15px;
}

.legal-body ul {
  padding-left: 1.4rem;
}

.legal-body li {
  margin-bottom: 4px;
}

.modal-content .legal-body p,
.modal-content .legal-body li {
  font-size: 14px;
}

/* ============================================
   UNTERSEITEN AUF DEM HANDY
   ============================================ */
@media (max-width: 600px) {
  .subpage-container {
    padding: 24px;
    margin-top: 5rem;
    border-radius: 22px;
  }

  /* Auf schmalen Bildschirmen reicht das Profilbild als Marke */
  .marke span {
    display: none;
  }

  .marke {
    padding: 0 5px;
  }
}

#global-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 999999;
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: all;
  overflow: hidden;
  background: transparent !important;
}

/* Pseudo-elements for the swipe layers (guarantees they render instantly) */
#global-loader::before,
#global-loader::after {
  content: "";
  position: absolute;
  top: 0;
  left: -50vw;
  width: 200vw;
  height: 100%;
  transform: translateX(0) skewX(-15deg);
  will-change: transform;
}

/* Layer 1: Primary Color */
#global-loader::before {
  background-color: var(--md-sys-color-primary, #18baf0);
  z-index: -2;
}

/* Layer 2: Surface Color */
#global-loader::after {
  background-color: var(--md-sys-color-surface, #111318);
  z-index: -1;
}

.loader-logo {
  z-index: 10;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: url('/bilder/Profile.webp') center/cover no-repeat;
  animation: stinger-pulse 1.5s infinite ease-in-out;
  box-shadow: 0 0 30px var(--md-sys-color-primary);
  opacity: 1;
}

@keyframes stinger-pulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 20px var(--md-sys-color-primary);
  }

  50% {
    transform: scale(1.05);
    box-shadow: 0 0 60px var(--md-sys-color-primary);
  }

  100% {
    transform: scale(0.95);
    box-shadow: 0 0 20px var(--md-sys-color-primary);
  }
}

/* STATE: LEAVING (Page loaded, stinger sweeps right) */
#global-loader.hidden {
  pointer-events: none;
  visibility: hidden;
  transition: visibility 0s 1.2s;
  /* wait for swipe to finish */
}

#global-loader.hidden::before {
  transform: translateX(200vw) skewX(-15deg);
  transition: transform 0.8s cubic-bezier(0.77, 0, 0.175, 1) 0.15s;
}

#global-loader.hidden::after {
  transform: translateX(200vw) skewX(-15deg);
  transition: transform 0.8s cubic-bezier(0.77, 0, 0.175, 1) 0s;
}

#global-loader.hidden .loader-logo {
  opacity: 0;
  transition: opacity 0.3s ease;
  /* let the pulse animation continue while fading out so it doesn't snap */
}

/* STATE: ENTERING PREP (Stinger teleports to left, ready to sweep in) */
#global-loader.stinger-prep {
  visibility: visible;
  pointer-events: all;
  opacity: 1;
}

#global-loader.stinger-prep::before,
#global-loader.stinger-prep::after {
  transform: translateX(-200vw) skewX(-15deg);
  transition: none;
}

#global-loader.stinger-prep .loader-logo {
  opacity: 0;
  transition: none;
  animation: none;
}

/* STATE: ENTERING (Stinger sweeps in from left to cover screen) */
#global-loader.stinger-enter {
  visibility: visible;
  pointer-events: all;
  opacity: 1;
}

#global-loader.stinger-enter::before {
  transform: translateX(0) skewX(-15deg);
  transition: transform 0.7s cubic-bezier(0.77, 0, 0.175, 1) 0s;
}

#global-loader.stinger-enter::after {
  transform: translateX(0) skewX(-15deg);
  transition: transform 0.7s cubic-bezier(0.77, 0, 0.175, 1) 0.15s;
}

#global-loader.stinger-enter .loader-logo {
  opacity: 1;
  transition: opacity 0.4s ease 0.4s;
  animation: stinger-pulse 1.5s infinite ease-in-out 0.4s;
}


/* ============================================
   RULE CARDS (Discord AGB)
   ============================================ */
.rules-grid {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-top: 32px;
  margin-bottom: 48px;
}

.rule-card {
  background: var(--md-sys-color-surface-container);
  border-radius: var(--md-sys-shape-corner-large);
  padding: 24px;
  box-shadow: var(--md-sys-elevation-1);
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: transform var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-standard),
    box-shadow var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-standard);
  position: relative;
  overflow: hidden;
  animation: fade-in-up 0.6s var(--md-sys-motion-easing-emphasized) backwards;
}

.rule-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--md-sys-elevation-3);
  background: var(--md-sys-color-surface-container-high);
}

.rule-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--md-sys-color-primary);
  opacity: 0.8;
  border-radius: 4px 0 0 4px;
}

.rule-card h3 {
  margin-top: 0;
  margin-bottom: 16px;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-color);
}

.rule-rationale {
  margin-top: 0;
  margin-bottom: 12px;
  color: var(--text-color);
  opacity: 0.9;
  padding-left: 4px;
}

.rule-explanation {
  opacity: 0.8;
  font-size: 0.95em;
  display: inline-block;
  margin-top: 4px;
}

.subpage-container .rule-card h3 md-icon {
  background: rgba(160, 196, 255, 0.15);
  color: var(--md-sys-color-primary, #a0c4ff);
  padding: 10px;
  border-radius: 12px;
  font-size: 24px;
}

.rule-card ul {
  margin: 0;
  padding-left: 20px;
  color: var(--text-color);
  line-height: 1.6;
  opacity: 0.9;
}

.rule-card li {
  margin-bottom: 8px;
}

.rule-card li:last-child {
  margin-bottom: 0;
}


@keyframes fade-in-up {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================
   REDUCED MOTION (Accessibility)
   ============================================ */
@media (prefers-reduced-motion: reduce) {

  /* Disable rule card stagger animation */
  .rule-card {
    animation: none;
    opacity: 1;
    transform: none;
  }

  .rule-card:hover {
    transform: none;
  }

  /* Disable skeleton shimmer */
  .skeleton-shimmer::after {
    animation: none;
  }

  /* Disable loader pulse */
  .loader-logo {
    animation: none;
  }

  /* Disable stinger transitions */
  #global-loader::before,
  #global-loader::after {
    transition: none;
  }

  #global-loader.hidden::before,
  #global-loader.hidden::after {
    transition: none;
  }

  #global-loader.stinger-enter::before,
  #global-loader.stinger-enter::after {
    transition: none;
  }

  #global-loader.hidden .loader-logo,
  #global-loader.stinger-prep .loader-logo,
  #global-loader.stinger-enter .loader-logo {
    transition: none;
    animation: none;
  }

  /* Disable banner/avatar fade-in transition */
  .banner-img,
  .avatar-img {
    transition: none;
    opacity: 1;
  }

  /* Disable modal scale transition */
  .modal-content {
    transition: none;
    transform: scale(1) translateY(0);
  }

  /* Disable button hover lift */
  .account-button:hover {
    transform: none;
  }

  /* Galerie ohne Anheben */
  .galerie-bild:hover {
    transform: none;
  }
}

/* ============================================
   EXPLICIT REDUCED MOTION (Toggle)
   ============================================ */
.a11y-reduced-motion .rule-card,
.a11y-reduced-motion .skeleton-shimmer::after,
.a11y-reduced-motion .loader-logo,
.a11y-reduced-motion #global-loader::before,
.a11y-reduced-motion #global-loader::after,
.a11y-reduced-motion #global-loader.hidden::before,
.a11y-reduced-motion #global-loader.hidden::after,
.a11y-reduced-motion #global-loader.stinger-enter::before,
.a11y-reduced-motion #global-loader.stinger-enter::after,
.a11y-reduced-motion #global-loader.hidden .loader-logo,
.a11y-reduced-motion #global-loader.stinger-prep .loader-logo,
.a11y-reduced-motion #global-loader.stinger-enter .loader-logo,
.a11y-reduced-motion .banner-img,
.a11y-reduced-motion .avatar-img,
.a11y-reduced-motion .modal-content,
.a11y-reduced-motion .account-button:hover,
.a11y-reduced-motion .galerie-bild:hover,
.a11y-reduced-motion * {
  animation-duration: 0.001ms !important;
  transition-duration: 0.001ms !important;
}

/* ============================================
   SIMPLE MODE (High Contrast / Text Focus)
   ============================================ */
html.a11y-simple-mode.light-mode {
  --md-sys-color-background: #ffffff;
  --md-sys-color-surface: #ffffff;
  --md-sys-color-surface-container: #ffffff;
  --md-sys-color-surface-container-high: #f0f0f0;
  --md-sys-color-primary: #000000;
  --text-color: #000000;
  --text-secondary: #222222;
  --card-bg: #ffffff;
  --card-border: #000000;
}

html.a11y-simple-mode:not(.light-mode) {
  --md-sys-color-background: #000000;
  --md-sys-color-surface: #000000;
  --md-sys-color-surface-container: #000000;
  --md-sys-color-surface-container-high: #111111;
  --md-sys-color-primary: #ffffff;
  --text-color: #ffffff;
  --text-secondary: #dddddd;
  --card-bg: #000000;
  --card-border: #ffffff;
}

html.a11y-simple-mode body {
  background: var(--md-sys-color-background) !important;
  color: var(--text-color) !important;
}

html.a11y-simple-mode .subpage-container,
html.a11y-simple-mode .rule-card,
html.a11y-simple-mode .account-button,
html.a11y-simple-mode .modal-content,
html.a11y-simple-mode .marke,
html.a11y-simple-mode .galerie-bild,
html.a11y-simple-mode .galerie-dialog {
  background: var(--md-sys-color-surface) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  box-shadow: none !important;
  border: 2px solid var(--card-border) !important;
}

html.a11y-simple-mode .rule-card::before {
  background: var(--md-sys-color-primary) !important;
}

html.a11y-simple-mode .background-animation {
  display: none !important;
}

/* ============================================
   GALERIE (Startseite)
   ============================================ */
.galerie {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  width: 100%;
}

.galerie-bild {
  display: block;
  aspect-ratio: 1;
  border-radius: var(--md-sys-shape-corner-medium);
  background: var(--button-bg);
  border: 1px solid var(--button-border);
  overflow: hidden;
  transition: transform var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-standard),
    box-shadow var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-standard),
    background var(--md-sys-motion-duration-medium);
}

.galerie-bild:hover {
  background: var(--button-hover-bg);
  transform: translateY(-2px);
  box-shadow: var(--md-sys-elevation-2);
}

.galerie-bild:focus-visible {
  outline: 2px solid var(--md-sys-color-primary);
  outline-offset: 2px;
}

.galerie-bild img {
  display: block;
  width: 100%;
  height: 100%;
  padding: 6px;
  box-sizing: border-box;
  object-fit: contain;
}

/* Fotos füllen die Kachel, Renderbilder mit durchsichtigem Grund bleiben ganz sichtbar */
.galerie-bild.foto img {
  padding: 0;
  object-fit: cover;
}

/* Großansicht (js/galerie.js) */
.galerie-dialog {
  max-width: min(92vw, 900px);
  max-height: 92vh;
  padding: 20px 64px 16px;
  box-sizing: border-box;
  border: 1px solid var(--card-border);
  border-radius: var(--md-sys-shape-corner-extra-large);
  background: var(--modal-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  color: var(--text-color);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.galerie-dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
}

.galerie-dialog figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.galerie-dialog img {
  display: block;
  max-width: 100%;
  max-height: 74vh;
  object-fit: contain;
}

.galerie-dialog figcaption {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-secondary);
  text-align: center;
}

.galerie-knopf {
  position: absolute;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--button-border);
  background: var(--profile-bg);
  color: var(--text-color);
  font-family: 'Material Symbols Outlined';
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease;
}

.galerie-knopf:hover {
  background: var(--button-hover-bg);
}

.galerie-knopf:focus-visible {
  outline: 2px solid var(--md-sys-color-primary);
  outline-offset: 2px;
}

.galerie-schliessen {
  top: 10px;
  right: 10px;
}

.galerie-zurueck,
.galerie-weiter {
  top: 50%;
  transform: translateY(-50%);
}

.galerie-zurueck {
  left: 10px;
}

.galerie-weiter {
  right: 10px;
}

@media (max-width: 600px) {
  .galerie {
    grid-template-columns: repeat(2, 1fr);
  }

  .galerie-dialog {
    padding: 64px 12px 12px;
  }

  .galerie-zurueck,
  .galerie-weiter {
    top: 10px;
    transform: none;
  }

  .galerie-zurueck {
    left: 10px;
  }

  .galerie-weiter {
    left: 62px;
    right: auto;
  }
}

/* ============================================
   KNÖPFE AUF UNTERSEITEN
   ============================================ */
/* Einzelner Knopf im Fließtext, etwa „Zur Startseite“ */
.account-button.einzeln {
  display: inline-flex;
}

/* ============================================
   FEHLERSEITE (404)
   ============================================ */
.subpage-container.schmal {
  max-width: 760px;
}

.fehlerseite {
  display: flex;
  align-items: center;
  gap: 32px;
}

.fehlerseite img {
  flex: none;
  width: 190px;
  height: auto;
}

/* Mit .subpage-container davor, sonst gewinnt die allgemeine Regel für Absätze */
.subpage-container .fehlercode {
  margin: 0 0 4px;
  font-family: 'Fredoka', 'Outfit', sans-serif;
  font-size: 64px;
  font-weight: 600;
  line-height: 1;
  color: var(--text-color);
}

/* ============================================
   DISCORD-REGELN: ÜBERSICHT UND HINWEIS
   ============================================ */
.regeln-auswahl {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 28px;
  align-items: center;
}

.regeln-auswahl img {
  width: 100%;
  height: auto;
}

.regeln-auswahl .accounts {
  grid-template-columns: 1fr;
}

.subpage-container .rule-card.hinweis-karte {
  margin: 24px 0 32px;
  background: rgba(160, 196, 255, 0.05);
  border: 1px solid rgba(160, 196, 255, 0.3);
}

.hinweis-karte h3 {
  margin-bottom: 8px;
}

.hinweis-karte .rule-rationale:last-child {
  margin-bottom: 0;
}

@media (max-width: 600px) {
  .fehlerseite {
    flex-direction: column;
    text-align: center;
  }

  .fehlerseite img {
    width: 140px;
  }

  .regeln-auswahl {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .regeln-auswahl img {
    width: 140px;
  }

  .regeln-auswahl .accounts {
    width: 100%;
  }
}

/* ============================================
   IMAGE SELECTION PREVENTION
   ============================================ */
img,
md-icon {
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}