* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Fallback colors for browsers without OKLCH support */
  --primary-color: #007bff;
  --primary-color-dark: #014389;
  --primary-color-light: #69bff7;
  --secondary-color: #6c757d;
  --success-color: #28a745;
  --danger-color: #dc3545;
  --danger-color-dark: #b8303b;
  --light-gray: #f8f9fadc;
  --medium-gray: #959798;
  --medium-gray-dark: #5a5c5d;
  --dark-gray: #343a40;
  --blueish-gray: #4a5568;
  --black: #000000;
  --spacing-unit: 0.5rem;

  --badge-primary: var(--primary-color);
  --badge-secondary: #5a9dd8;
  --badge-tertiary: #b8d9f2;
  --badge-stop: #0b0b0b;
  --badge-danger: #8B0000;
  --badge-warning: #d16a3a;
  --badge-caution: #d9a65c;
  --badge-notice: #f0de8f;
  --badge-ready: #5ba35b;
}

/* OKLCH colors for modern browsers */
@supports (color: oklch(0 0 0)) {
  :root {
    /* Chroma (vibrancy) control - adjust this single value to change saturation globally */
    --chroma: 0.15;
    --chroma-gray: 0.02;  /* For grays only */
    --chroma-none: 0;     /* For pure black */

    /* Primary colors - blue */
    --primary-color: oklch(55% var(--chroma) 250);
    --primary-color-dark: oklch(35% var(--chroma) 250);
    --primary-color-light: oklch(75% var(--chroma) 250);

    /* Secondary and grays */
    --secondary-color: oklch(55% var(--chroma-gray) 255);
    --light-gray: oklch(98% 0.01 255 / 0.86);
    --medium-gray: oklch(65% 0.01 255);
    --medium-gray-dark: oklch(45% 0.01 255);
    --dark-gray: oklch(30% var(--chroma-gray) 255);
    --blueish-gray: oklch(40% var(--chroma-gray) 250);
    --black: oklch(0% var(--chroma-none) 0);

    /* Success and danger */
    --success-color: oklch(60% var(--chroma) 145);
    --danger-color: oklch(55% var(--chroma) 25);
    --danger-color-dark: oklch(45% var(--chroma) 25);

    /* Badge colors */
    --badge-secondary: color-mix(in oklch, var(--primary-color) 70%, white 20%);
    --badge-tertiary: color-mix(in oklch, var(--primary-color) 70%, white 70%);

    /* Rank badge colors - cycle progress indicators */
    --badge-stop: oklch(20% var(--chroma-gray) 0);
    --badge-danger: oklch(40% var(--chroma) 25);
    --badge-warning: oklch(55% var(--chroma) 35);
    --badge-caution: oklch(70% var(--chroma) 70);
    --badge-notice: oklch(85% var(--chroma) 95);
    --badge-ready: oklch(65% var(--chroma) 145);
  }
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.6;
  background: linear-gradient(to bottom, var(--blueish-gray) 0px, var(--dark-gray) 600px);
  background-repeat: no-repeat;
  background-color: var(--dark-gray); /* Fallback for content beyond 600px */
  color: var(--light-gray);
  font-size: 16px;
  min-height: 100vh; /* Ensure body fills viewport */
}

footer {
  text-align: center;
  padding: 1rem;
  font-size: 0.8rem;
  color: var(--medium-gray);
}

pre {
  font-weight: 900;
}

dl {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 1rem;
}

dt {
  font-weight: 900;
}

dd {
  margin-left: 1rem;
}

@keyframes ready-gradient {
  0% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0% 50%;
  }
}

/* Modal Styles */
.modal-open {
  overflow: hidden;
}

/* Generic Modal System */
.modal-dialog {
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  max-height: 90vh;
  overflow-y: auto;
  width: 100%;
  max-width: 32rem;
  margin: auto; /* Center in viewport */
  position: fixed;
  inset: 0;
  z-index: 1001;
  padding: 0;
  border: none;
  transform: scale(0.95);
  opacity: 0;
  animation: modalFadeIn 0.15s ease-out forwards;
}

.modal-dialog::backdrop {
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  position: fixed;
  inset: 0;
  z-index: 1000;
}

.modal-dialog:not([open]) {
  display: none;
}

@keyframes modalFadeIn {
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.modal-header {
  background-color: var(--light-gray);
  border-bottom: 1px solid var(--medium-gray);
  padding: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-body {
  background-color: white;
  color: var(--dark-gray);
  padding: 1.5rem;
}

.modal-options {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding-top: 1rem;
}

/* Modal component variations */
.modal-options {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal-text {
  margin-bottom: 1.5rem;
}

/* Error list styling */
.errors {
  margin-bottom: 1rem;
  color: var(--danger-color);
  list-style: disc;
  padding-left: 1.5rem;
}

.errors li {
  margin-bottom: 0.25rem;
}
