:root {
  /* Dark Theme (Catppuccin Mocha) - Default Base */
  --bg-base: #1e1e2e;
  --bg-mantle: #11111b;
  --bg-surface0: #313244;
  --bg-surface1: #45475a;
  --bg-surface2: #585b70;

  --text-dark: #1c1d20;
  --text-main: #cdd6f4;
  --text-muted: #bac2de;
  --text-sub: #a6adc8;

  --accent-mauve: #cba6f7;
  --accent-blue: #89b4fa;
  --accent-pink: #f5c2e7;
  --accent-green: #a6e3a1;
  --accent-teal: #94e2d5;
  --accent-red: #f38ba8;
  --accent-peach: #fab387;

  /* Translucent & Functional Colors */
  --card-bg: rgba(30, 30, 46, 0.7);
  --modal-overlay: rgba(17, 17, 27, 0.8);
  --input-bg: rgba(17, 17, 27, 0.8);
  --input-bg-focus: rgba(24, 24, 37, 0.9);
  --btn-hover-bg: rgba(49, 50, 68, 0.9);
  --hud-btn-bg: rgba(49, 50, 68, 0.6);

  --shadow-strong: rgba(0, 0, 0, 0.8);
  --shadow-medium: rgba(0, 0, 0, 0.6);
  --shadow-light: rgba(0, 0, 0, 0.2);

  --accent-gradient: linear-gradient(135deg, var(--accent-mauve) 0%, var(--accent-blue) 100%);
  --kd-map-icon-filter: none;
}

/* Light Theme Variables (Catppuccin Latte) applied via data attribute */
[data-theme='light'] {
  --bg-base: #eff1f5;
  --bg-mantle: #e6e9ef;
  --bg-surface0: #ccd0da;
  --bg-surface1: #bcc0cc;
  --bg-surface2: #acb0be;

  --text-dark: #e1e8ff;
  --text-main: #4c4f69;
  --text-muted: #5c5f77;
  --text-sub: #6c6f85;

  --accent-mauve: #8839ef;
  --accent-blue: #1e66f5;
  --accent-pink: #ea76cb;
  --accent-green: #40a02b;
  --accent-teal: #179299;
  --accent-red: #d20f39;
  --accent-peach: #fe640b;

  --card-bg: rgba(239, 241, 245, 0.7);
  --modal-overlay: rgba(204, 208, 218, 0.8);
  --input-bg: rgba(204, 208, 218, 0.6);
  --input-bg-focus: rgba(220, 224, 232, 0.9);
  --btn-hover-bg: rgba(204, 208, 218, 0.9);
  --hud-btn-bg: rgba(204, 208, 218, 0.6);

  --shadow-strong: rgba(76, 79, 105, 0.3);
  --shadow-medium: rgba(76, 79, 105, 0.2);
  --shadow-light: rgba(76, 79, 105, 0.1);

  --kd-map-icon-filter: invert(1);
}

/* System-level Light Theme Detection (Only applies if no manual override exists) */
@media (prefers-color-scheme: light) {
  :root:not([data-theme='dark']) {
    --bg-base: #eff1f5;
    --bg-mantle: #e6e9ef;
    --bg-surface0: #ccd0da;
    --bg-surface1: #bcc0cc;
    --bg-surface2: #acb0be;

    --text-main: #4c4f69;
    --text-muted: #5c5f77;
    --text-sub: #6c6f85;

    --accent-mauve: #8839ef;
    --accent-blue: #1e66f5;
    --accent-pink: #ea76cb;
    --accent-green: #40a02b;
    --accent-teal: #179299;
    --accent-red: #d20f39;
    --accent-peach: #fe640b;

    --card-bg: rgba(239, 241, 245, 0.7);
    --modal-overlay: rgba(204, 208, 218, 0.8);
    --input-bg: rgba(204, 208, 218, 0.6);
    --input-bg-focus: rgba(220, 224, 232, 0.9);
    --btn-hover-bg: rgba(204, 208, 218, 0.9);
    --hud-btn-bg: rgba(204, 208, 218, 0.6);

    --shadow-strong: rgba(76, 79, 105, 0.3);
    --shadow-medium: rgba(76, 79, 105, 0.2);
    --shadow-light: rgba(76, 79, 105, 0.1);

    --kd-map-icon-filter: invert(1);
  }
}

/* --- Fonts --- */
@font-face {
  font-family: 'KennyInputXboxSeries';
  src:
    url('fonts/kenney_input_xbox_series.otf') format('opentype'),
    url('fonts/kenney_input_xbox_series.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'KennyInputPlaystationSeries';
  src:
    url('fonts/kenney_input_playstation_series.otf') format('opentype'),
    url('fonts/kenney_input_playstation_series.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

.kb-map-icon {
  height: 24px;
}

.kb-map-icon,
.mapping-grids img {
  filter: var(--kd-map-icon-filter);
}

/* --- Global Scrollbar --- */
::-webkit-scrollbar {
  width: 10px;
}
::-webkit-scrollbar-track {
  background: var(--shadow-light);
}
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--accent-mauve), var(--accent-blue));
  border-radius: 5px;
}
::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--accent-blue), var(--accent-mauve));
}

::selection {
  background-color: var(--accent-mauve);
  color: var(--bg-base);
}

/* --- Global Layout & Animated Retro Background --- */
body {
  margin: 0;
  /* Animated Retro Gradient */
  background: linear-gradient(
    -45deg,
    var(--bg-base),
    var(--bg-mantle),
    var(--bg-surface0),
    var(--bg-mantle)
  );
  background-color: var(--bg-base);
  background-size: 400% 400%;
  animation: gradientShift 15s ease infinite;
  user-select: none;
  -webkit-user-select: none;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  color: var(--text-main);
  font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  overflow: hidden;
  transition:
    background-color 1s ease,
    background-image 2s ease,
    color 0.5s ease;
}

img {
  user-drag: none;
  -webkit-user-drag: none;
  user-select: none;
  -moz-user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
}

@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* Re-enable selection for inputs, textareas, and specific info fields */
input,
textarea,
.raw-debug,
#apiAuthOriginText {
  user-select: text;
  -webkit-user-select: text;
  cursor: text;
}

textarea {
  resize: vertical;
}

/* --- Video Stream --- */
#streamView {
  display: none;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  background: #000;
  width: 100vw;
  height: 100vh;
}

#serverHost:disabled {
  display: none !important;
}

/* --- Modals Base & Overlay Animations --- */
#modalOverlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: var(--modal-overlay);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 900;
  opacity: 0;
}

.overlay-enter {
  display: block !important;
  animation: fadeIn 0.3s ease forwards;
}

.overlay-exit {
  animation: fadeOut 0.3s ease forwards;
}

.modal-base::after,
#welcomeScreen::after,
#login::after,
#debugPanel::after,
#disconnectToast::after,
#clientIdHud::after {
  background: var(--accent-gradient);
  content: '';
}

.modal-base,
#welcomeScreen,
#login,
#debugPanel,
#disconnectToast,
#clientIdHud {
  backdrop-filter: blur(12px);
  background: var(--card-bg);
  box-shadow: 0 25px 60px var(--shadow-strong);
}

.modal-base {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 24px;
  flex-direction: column;
  gap: 16px;
  opacity: 0;
  max-height: 95vh;
  overflow-y: auto;
  box-sizing: border-box;
}

.modal-base.alert {
  border: 2px solid var(--accent-mauve);
  z-index: 9999;
  width: 400px;
  max-width: 95vw;
  text-align: center;
  box-shadow:
    0 25px 60px var(--shadow-strong),
    0 0 30px var(--shadow-light);
}

.modal-base.auth {
  border: 2px solid var(--accent-red);
  z-index: 2000;
  width: 460px;
  max-width: 95vw;
  box-shadow:
    0 25px 60px var(--shadow-strong),
    0 0 30px var(--shadow-light);
}

.modal-base.api {
  border: 2px solid var(--accent-mauve);
  z-index: 1500;
  width: 540px;
  max-width: 95vw;
}

.modal-base.settings {
  border: 2px solid var(--accent-mauve);
  z-index: 1500;
  width: 420px;
  max-width: 95vw;
}

.modal-enter {
  display: flex !important;
  animation: modalEntrance 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.modal-exit {
  animation: modalExit 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@keyframes modalEntrance {
  from {
    opacity: 0;
    transform: translate(-50%, -45%) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes modalExit {
  from {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  to {
    opacity: 0;
    transform: translate(-50%, -55%) scale(0.95);
  }
}

/* --- Welcome Screen --- */
#welcomeScreen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 20;
  position: absolute;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 40px 30px;
  border-radius: 16px;
  border: 1px solid var(--shadow-light);
  box-shadow:
    0 15px 35px var(--shadow-medium),
    0 0 20px var(--shadow-light);
  width: 100%;
  max-width: 560px;
  max-height: 95vh;
  overflow-y: auto;
  box-sizing: border-box;
  animation: panelFadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  text-align: center;
}

.welcome-logo {
  width: 100%;
  max-width: 150px;
  height: auto;
  filter: drop-shadow(0 0 15px var(--shadow-light));
  animation: floatLogo 3s ease-in-out infinite;
  margin-bottom: 5px;
}

@keyframes floatLogo {
  0% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
  100% {
    transform: translateY(0px);
  }
}

#welcomeScreen h2 {
  margin: 0;
  background: linear-gradient(90deg, var(--accent-mauve), var(--accent-pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-size: 1.8rem;
  font-weight: 900;
  letter-spacing: 1px;
}

.playtime-tracker {
  font-size: 12px;
  color: var(--accent-green);
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: -12px;
  margin-bottom: 8px;
  text-shadow: 0 0 8px var(--shadow-light);
}

#welcomeScreen p {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
  margin: 0 0 15px 0;
}

#btnStartApp {
  width: 100%;
  font-size: 16px;
  padding: 16px;
  text-transform: uppercase;
  font-weight: 900;
  letter-spacing: 2px;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent-green), var(--accent-teal));
  color: #11111b; /* Key contrast element, kept dark */
  border-radius: 12px;
  transition: transform 0.2s;
  animation: pulseBtn 2s infinite;
}

#btnStartApp:hover {
  transform: scale(1.05);
}

#btnStartApp:active {
  transform: scale(0.95);
}

@keyframes pulseBtn {
  0% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent-green) 70%, transparent);
  }
  70% {
    box-shadow: 0 0 0 15px color-mix(in srgb, var(--accent-green) 0%, transparent);
  }
  100% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent-green) 0%, transparent);
  }
}

/* --- Login Panel --- */
#login {
  display: none;
  flex-direction: column;
  gap: 14px;
  z-index: 10;
  position: absolute;
  /* Glassmorphism with Neon glow */
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 28px;
  border-radius: 16px;
  border: 1px solid var(--shadow-light);
  box-shadow:
    0 15px 35px var(--shadow-medium),
    0 0 20px var(--shadow-light);
  width: 100%;
  max-width: 420px;
  max-height: 95vh;
  overflow-y: auto;
  box-sizing: border-box;
  /* Entrance and idle floating animation */
  animation: panelFadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes panelFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

#login h2 {
  text-align: center;
  background: linear-gradient(90deg, var(--accent-mauve), var(--accent-pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 0 0 8px 0;
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: 1px;
  text-shadow: 0px 4px 10px var(--shadow-light);
}

/* --- Inputs --- */
input[type='text'],
input[type='password'],
input[type='number'],
textarea,
select {
  padding: 12px;
  font-size: 14px;
  border-radius: 8px;
  border: 1px solid var(--bg-surface1);
  background: var(--input-bg);
  color: var(--text-main);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  outline: none;
  width: 100%;
  box-sizing: border-box;
}

input[type='text']:focus,
input[type='password']:focus,
input[type='number']:focus,
textarea:focus,
select:focus {
  border-color: var(--accent-mauve);
  background: var(--input-bg-focus);
  box-shadow:
    0 0 0 3px var(--shadow-light),
    inset 0 2px 4px var(--shadow-medium);
  transform: translateY(-1px);
}

/* Hide default browser arrows for numeric inputs */
input[type='number']::-webkit-inner-spin-button,
input[type='number']::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type='number'] {
  -moz-appearance: textfield;
}

.options-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--input-bg);
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--shadow-light);
  flex-wrap: wrap;
  gap: 10px;
  box-shadow: inset 0 2px 4px var(--shadow-light);
}

label.checkbox-container {
  color: var(--text-muted);
  font-size: 13px;
  display: flex;
  flex-direction: row !important;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  transition: color 0.2s;
}

label.checkbox-container:hover {
  color: var(--text-main);
}

/* --- Buttons --- */
button,
.github-link-btn,
.config-btn {
  text-decoration: none;
  border-radius: 8px;
  font-size: 15px;
  text-align: center;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
}

button {
  padding: 14px;
  border: none;
  background: linear-gradient(135deg, var(--accent-mauve), var(--accent-blue));
  color: var(--bg-base);
  margin-top: 6px;
  box-shadow: 0 4px 10px var(--shadow-light);
}

button:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 16px var(--shadow-medium);
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-mauve));
}

button:active {
  transform: translateY(1px) scale(0.98);
  box-shadow: 0 2px 5px var(--shadow-light);
}

button:disabled {
  background: var(--bg-surface1);
  color: var(--text-sub);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.section-hidden {
  display: none !important;
}

.github-link-btn {
  background: var(--input-bg);
  color: var(--text-muted);
  font-size: 13px;
  padding: 10px;
  margin-top: 10px;
  border: 1px dashed var(--bg-surface2);
}

.github-link-btn:hover {
  background: var(--shadow-light);
  color: var(--accent-mauve);
  border-color: var(--accent-mauve);
  transform: translateY(-2px);
}

.config-btn {
  background: var(--bg-surface0);
  color: var(--accent-mauve);
  font-size: 12px;
  padding: 8px 12px;
  border: 1px solid var(--accent-mauve);
  width: 100%;
}

.config-btn:hover {
  background: var(--accent-mauve);
  color: var(--bg-base);
}

/* --- HUD Overlays --- */
#debugPanel {
  position: absolute;
  top: 15px;
  left: 15px;
  backdrop-filter: blur(10px);
  border: 1px solid var(--shadow-light);
  padding: 18px;
  border-radius: 12px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 13px;
  color: var(--text-main);
  pointer-events: none;
  min-width: 290px;
  z-index: 100;
  transition:
    opacity 0.4s ease,
    transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 10px 30px var(--shadow-medium);
}
#debugPanel.hidden {
  opacity: 0;
  transform: translateY(-15px) scale(0.95);
}

.hud-buttons {
  position: absolute;
  top: 15px;
  right: 15px;
  z-index: 101;
  display: flex;
  gap: 10px;
  transition: opacity 0.3s ease;
}

body.is-playing:not(.gamepad-only-mode) .hud-buttons {
  opacity: 0.15;
}

body.is-playing:not(.gamepad-only-mode) .hud-buttons:hover {
  opacity: 1;
}

.hud-btn {
  padding: 10px 14px;
  font-size: 13px;
  background: var(--hud-btn-bg);
  backdrop-filter: blur(5px);
  color: var(--text-main);
  border: 1px solid var(--bg-surface2);
  border-radius: 8px;
  cursor: pointer;
}
.hud-btn:hover {
  background: var(--shadow-light);
  border-color: var(--accent-mauve);
  color: var(--accent-mauve);
}

/* --- Debug Info Text --- */
.debug-section {
  margin-bottom: 12px;
  border-bottom: 1px dashed var(--bg-surface1);
  padding-bottom: 8px;
}
.debug-header {
  color: var(--accent-mauve);
  font-weight: bold;
  margin-bottom: 8px;
  display: block;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.5px;
}
.debug-row {
  margin-bottom: 5px;
  display: flex;
  justify-content: space-between;
}
.debug-val {
  font-weight: bold;
  color: var(--accent-green);
  text-align: right;
  text-shadow: 0 0 5px var(--shadow-light);
}
.debug-err {
  color: var(--accent-red);
  text-shadow: 0 0 5px var(--shadow-light);
}
.debug-warn {
  color: var(--accent-peach);
  text-shadow: 0 0 5px var(--shadow-light);
}

#dbgInput {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
}

#clientIdHud {
  position: absolute;
  top: 15px;
  left: 50%;
  transform: translateX(-50%);
  backdrop-filter: blur(8px);
  color: var(--accent-mauve);
  padding: 8px 20px;
  border-radius: 24px;
  font-weight: bold;
  border: 1px solid var(--shadow-light);
  box-shadow: 0 4px 15px var(--shadow-medium);
  z-index: 50;
  transition:
    opacity 0.4s ease,
    transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

#clientIdHud.hidden {
  opacity: 0;
  transform: translate(-50%, -15px) scale(0.95);
  pointer-events: none;
}

/* --- Notification Toast --- */
#disconnectToast {
  position: absolute;
  top: 25px;
  left: 50%;
  transform: translate(-50%, -30px);
  background: var(--accent-red);
  backdrop-filter: blur(5px);
  color: #11111b; /* Enforced contrast */
  padding: 14px 28px;
  border-radius: 10px;
  font-weight: bold;
  border: 2px solid var(--shadow-strong);
  box-shadow: 0 10px 30px var(--shadow-medium);
  z-index: 2000;
  opacity: 0;
  transition:
    opacity 0.4s ease,
    transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

#disconnectToast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* --- Gamepad Only Mode --- */
.gamepad-only-msg {
  display: none;
  position: absolute;
  top: 20%;
  color: var(--accent-mauve);
  font-size: 28px;
  font-weight: 800;
  text-align: center;
  width: 100%;
  text-shadow: 0px 5px 20px var(--shadow-light);
  z-index: 5;
  letter-spacing: 1px;
}

body.gamepad-only-mode.is-playing {
  /* Stop the background animation to avoid distractions */
  animation: none;
  background-position: 0%;
  background-image:
    radial-gradient(circle at 20% 20%, var(--shadow-light) 0%, transparent 40%),
    radial-gradient(circle at 80% 80%, var(--shadow-light) 0%, transparent 40%);
}

body.gamepad-only-mode.is-playing #streamView {
  display: none !important;
}
body.gamepad-only-mode.is-playing .gamepad-only-msg {
  display: block;
  /* 6 seconds total duration: fade in, wait, fade out and hide */
  animation: msgEntranceAndExit 6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

body.gamepad-only-mode.is-playing #debugPanel {
  position: static;
  margin: 0 auto;
  transform: scale(1.15);
  pointer-events: auto;
}

body.gamepad-only-mode.is-playing #debugPanel.hidden {
  opacity: 0;
  transform: scale(1.15) translateY(-15px);
  pointer-events: none;
}

body.gamepad-only-mode.is-playing #btnToggleDebug {
  display: none;
}

/* Keyframes for entering, staying, and gracefully exiting */
@keyframes msgEntranceAndExit {
  0% {
    opacity: 0;
    transform: translateY(15px) scale(0.95);
    visibility: visible;
  }
  10% {
    opacity: 1;
    transform: translateY(0) scale(1);
    visibility: visible;
  }
  80% {
    opacity: 1;
    transform: translateY(0) scale(1);
    visibility: visible;
  }
  100% {
    opacity: 0;
    transform: translateY(-15px) scale(0.98);
    visibility: hidden;
  }
}

/* --- Custom Checkboxes --- */

/* Removes the default ugly look from the browser and creates our own box */
label.checkbox-container input[type='checkbox'] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  background-color: var(--bg-mantle);
  border: 2px solid var(--bg-surface1);
  border-radius: 4px;
  cursor: pointer;
  display: grid; /* Grid is perfect for centralizing the checkmark after */
  place-content: center;
  margin: 0; /* Zerates the margins for the label flexbox perfectly align with text */
  transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Hover effect (passing mouse) glowing in purple */
label.checkbox-container input[type='checkbox']:hover {
  border-color: var(--accent-mauve);
  background-color: var(--bg-surface0);
  box-shadow: 0 0 0 3px var(--shadow-light);
}

/* When it's marked, the bottom turns totally purple */
label.checkbox-container input[type='checkbox']:checked {
  background-color: var(--accent-mauve);
  border-color: var(--accent-mauve);
  box-shadow: 0 0 10px var(--shadow-light);
}

/* Drawing invisible "Tique" (✓) with edges and rotation */
label.checkbox-container input[type='checkbox']::before {
  content: '';
  width: 5px;
  height: 9px;
  border: solid var(--bg-base); /* Dark background color to contrast with purple */
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg) scale(0); /* It is scale 0 (invisible) by default */
  transition: transform 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
  margin-bottom: 2px; /* Optical adjustment for tic look very centralized */
}

/* When marked, tick "grows" and appears */
label.checkbox-container input[type='checkbox']:checked::before {
  transform: rotate(45deg) scale(1);
}

/* --- Custom Range Slider --- */

/* Remove the default appearance of all browsers */
input[type='range'] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  background: transparent; /* Necessary not to get white background in Chrome */
  outline: none;
  margin: 10px 0;
}

/* 1. Styling the track in Chrome/Safari/Edge */
input[type='range']::-webkit-slider-runnable-track {
  width: 100%;
  height: 8px;
  background: var(--bg-surface0);
  border-radius: 4px;
  border: 1px solid var(--bg-surface1);
  transition: background 0.2s;
}

/* Hover on the trail */
input[type='range']:hover::-webkit-slider-runnable-track {
  background: var(--bg-surface1);
}

/* 2. Styling the little button (Thumb) in Chrome/Safari/Edge */
input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  height: 20px;
  width: 20px;
  border-radius: 50%;
  background: var(--accent-mauve);
  cursor: pointer;
  /* Calculation to centralize the ball on the track: (HeightTrail / 2) - (HeightThumb / 2) */
  margin-top: -7px;
  box-shadow: 0 0 10px var(--shadow-light);
  border: 2px solid var(--bg-base);
  transition:
    transform 0.15s cubic-bezier(0.25, 0.8, 0.25, 1),
    box-shadow 0.2s;
}

/* Effect when passing the mouse on the ball */
input[type='range']::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 15px color-mix(in srgb, var(--accent-mauve) 80%, transparent);
}

/* Effect on clicking/driving the ball */
input[type='range']:active::-webkit-slider-thumb {
  transform: scale(0.9);
  background: var(--accent-pink);
}

/* --------------------------------------------------- */
/* 3. Styling the Track in Firefox                     */
/* --------------------------------------------------- */
input[type='range']::-moz-range-track {
  width: 100%;
  height: 8px;
  background: var(--bg-surface0);
  border-radius: 4px;
  border: 1px solid var(--bg-surface1);
  transition: background 0.2s;
}

input[type='range']:hover::-moz-range-track {
  background: var(--bg-surface1);
}

/* 4. Styling the thumb button in Firefox */
input[type='range']::-moz-range-thumb {
  height: 16px;
  width: 16px;
  border-radius: 50%;
  background: var(--accent-mauve);
  cursor: pointer;
  box-shadow: 0 0 10px var(--shadow-light);
  border: 2px solid var(--bg-base);
  transition:
    transform 0.15s cubic-bezier(0.25, 0.8, 0.25, 1),
    box-shadow 0.2s;
}

input[type='range']::-moz-range-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 15px color-mix(in srgb, var(--accent-mauve) 80%, transparent);
}

input[type='range']:active::-moz-range-thumb {
  transform: scale(0.9);
  background: var(--accent-pink);
}
