:root {
  /* Main Theme Colors */
  --color-bg-main: #1b214e; /* body bg */
  --color-bg-alt: #232a4d; /* modal bg, alt */
  --color-bg-container: #293165; /* container bg */
  --color-bg-translucent: rgba(14, 14, 22, 0.6);
  --color-bg-footer: rgba(34, 37, 60, 0.75);
  --color-bg-footer-catalyst: rgba(34, 37, 60, 0.45);
  --color-bg-footer-border: #fff;
  --color-bg-drop: #6f55b6;

  /* Violet/Purple Accent */
  --color-accent: #6f55b6;
  --color-accent-hover: #825eff;
  --color-accent-border: #5f559a;
  --color-accent-focus: #9e81fa;

  /* Shape/Gradient Colors */
  --color-shape: #323c6f;
  --color-shape2: #3a5580;
  --color-shape-diamond: #fff;
  --color-shape-diamond-alt: #67564c;

  /* Text/Font */
  --color-text: #eeeeee;
  --color-text-muted: #bbb;
  --color-footer-text: #fff;
  --color-label: #ececec;
  --color-h1: #fff;

  /* Misc UI */
  --color-border: #ccc;
  --color-shadow: rgba(0, 0, 0, 0.08);
  --color-shadow-strong: #2e205999;
  --color-modal-bg: rgba(18, 18, 40, 0.85);
  --color-modal-date: #bbe;
  --color-question-count: rgba(38, 41, 65, 0.86);
  --color-quiz-selector: rgba(41, 49, 101, 0.8);
  --color-input: #9e81fa;

  /* Tag colors */
  --tag-update: #ff4b4b;
  --tag-version: #2fd46c;
  --tag-beta: #ad7aff;
  --tag-alpha: #49baff;
  --tag-class: #8faaff;

  /* Misc */
  --radius: 10px;
  --radius-large: 16px;
  --blur-bg: blur(8px);
}

/* ---- base ---- */
body,
html {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background-color: var(--color-bg-main);
  overflow: hidden;
  display: block;
}

body {
  font-family: Arial, Helvetica, sans-serif;
  color: var(--color-text);
  text-align: left;
  display: flex;
  justify-content: center;
}

.main {
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: relative;
}

.content-wrapper {
  display: flex;
  flex: 1;
  position: relative;
  justify-content: center;
  width: 100%;
  overflow: hidden;
}

.side {
  width: 20vw;
  height: 100%;
  position: relative;
  z-index: 1;
  overflow: hidden;
}

.container {
  width: 60vw;
  max-width: 100vw;
  padding: 20px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  z-index: 2;
  text-align: left;
  position: relative;
  background-color: var(--color-bg-container);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  flex-grow: 1;
  overflow: hidden;
}

/* ---- main page ---- */
#mainPage {
  font-size: 1.14rem;
}

/* Title */
#mainPage > h1 {
  color: var(--color-h1);
  text-align: center;
  font-size: 2.5rem;
  font-weight: 750;
  margin-bottom: 22px;
  letter-spacing: 0.04em;
  line-height: 1.3;
}

/* Labels */
#mainPage label {
  font-size: 1.19em;
  margin-bottom: 5px;
  display: inline-block;
  letter-spacing: 0.02em;
}

/* Lists */
#mainPage ul.exams,
#mainPage ul.chapters {
  font-size: 1.07em;
  margin-bottom: 8px;
}
#mainPage .chapters-col label {
  font-size: 1.07em;
  margin-left: 6px;
}

/* ---- question count select ---- */
#mainPage #questionCount {
  font-size: 1.07em;
  padding: 8px 20px;
  padding-left: 6px;
  border-radius: 8px;
  background: var(--color-question-count);
  color: var(--color-text);
  border: 1.5px solid var(--color-accent-border);
  margin-left: 10px;
  outline: none;
  font-weight: 500;
  transition: border 0.18s;
}
#mainPage #questionCount:focus {
  border-color: var(--color-accent-focus);
}

/* ---- start button ---- */
#mainPage button {
  font-size: 1.11em;
  padding: 13px 34px;
  border-radius: 8px;
  background: linear-gradient(
    90deg,
    var(--color-accent) 60%,
    var(--color-accent-hover) 100%
  );
  color: #fff;
  border: none;
  font-weight: bold;
  margin-top: 16px;
  cursor: pointer;
  transition: background 0.18s, transform 0.1s;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}
#mainPage button:hover {
  background: var(--color-accent-hover);
  transform: translateY(-2px) scale(1.035);
}

/* inputs */
#mainPage input[type="checkbox"],
#mainPage input[type="radio"] {
  width: 1.1em;
  height: 1.1em;
  margin-right: 8px;
  vertical-align: middle;
}

/* ---- native title select ---- */
.quiz-title-select {
  font-size: inherit;
  font-weight: inherit;
  color: var(--color-h1, #fff);
  background: var(--color-quiz-selector) !important;
  border: 2px solid var(--color-bg-drop, #6f55b6);
  outline: none;
  min-width: 7rem;
  max-width: 9rem;
  height: 3rem;
  border-radius: 24px;
  appearance: auto;
  text-align-last: center;
  vertical-align: middle;
  box-shadow: none;
}
.quiz-title-select option {
  color: var(--color-h1, #fff);
  background: var(--color-bg-container, #293165);
}
.quiz-title-select option:hover,
.quiz-title-select option:checked {
  background: var(--color-accent);
  color: #fff;
}
.quiz-title-select:focus {
  border: 2.5px solid var(--color-accent-focus);
}

/* keeping the label and pill inline */
.quiz-title-row {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 12px;
  margin-bottom: 22px;
  margin-top: 27px;
  font-weight: 700;
  font-size: 2.5rem;
}
.quiz-title-label {
  font-size: 2.5rem;
  font-weight: 750;
  color: var(--color-h1, #fff);
  letter-spacing: 0.04em;
  text-align: center;
  line-height: 1.1;
  top: 2px;
}

/* ---- star dropdown wrapper ---- */
.star-dropdown-wrap {
  position: relative;
  display: inline-block;
  width: 9rem;
  height: 3rem;
  top: 2px; /* centering */
}

/* SVG overlay + arrow inside the pill */
.star-dropdown-wrap svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}
.star-dropdown-wrap .dropdown-arrow {
  pointer-events: none;
  position: absolute;
  top: 50%;
  right: 4px;
  width: 16px;
  height: 16px;
  transform: translateY(-50%) rotate(0deg);
  transition: transform 0.3s cubic-bezier(0.57, 0.21, 0.69, 1.25);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}
.star-dropdown-wrap .dropdown-arrow::before {
  content: "";
  display: block;
  width: 100%;
  height: 100%;
  background: url('data:image/svg+xml;utf8,<svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><polyline points="4,6 8,10 12,6"/></svg>')
    no-repeat center/contain;
}

/* hide the native select when using custom-select */
.star-dropdown-wrap.custom-select > select {
  display: none !important;
}

/* trigger custom dropdown */
.star-dropdown-wrap.custom-select .custom-select-trigger {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  background: var(--color-quiz-selector);
  border: 2px solid var(--color-bg-drop);
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 1rem;
  cursor: pointer;
  user-select: none;
  font-size: inherit;
  font-weight: inherit;
  color: var(--color-h1);
  transition: border-color 0.2s;
}
.star-dropdown-wrap.custom-select.open .custom-select-trigger,
.star-dropdown-wrap.custom-select .custom-select-trigger:focus {
  outline: none;
  border-color: var(--color-accent-focus);
}
.star-dropdown-wrap.custom-select .trigger-text {
  margin-right: 0.5em;
}
.star-dropdown-wrap.custom-select.open .dropdown-arrow {
  transform: translateY(-50%) rotate(180deg);
}

/* options panel */
.star-dropdown-wrap.custom-select .custom-options {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--color-quiz-selector);
  border: 2px solid var(--color-accent-focus);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  z-index: 1000;

  max-height: 0;
  opacity: 0;
  overflow-y: hidden;
  transition: max-height 0.35s ease-out, opacity 0.25s ease-out;
}
.star-dropdown-wrap.custom-select.open .custom-options {
  max-height: 380px;
  opacity: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--color-accent-focus) transparent;
}

/* each option */
.star-dropdown-wrap.custom-select .custom-option {
  color: var(--color-h1);
  cursor: pointer;
  font-weight: 500;
}
.star-dropdown-wrap.custom-select .custom-option:hover,
.star-dropdown-wrap.custom-select .custom-option.selected {
  background: var(--color-accent);
  color: #fff;
}
.custom-options .custom-option.disabled {
  color: var(--color-text-muted) !important;
  pointer-events: none;
  cursor: default;
  font-weight: bold;
}

/* ---- select-wrap arrow for question count ---- */
.select-wrap {
  position: relative;
  display: inline-block;
  width: auto;
}
.select-wrap select {
  font-size: 1.07em;
  padding: 8px 38px 8px 15px; /* space for arrow */
  border-radius: 8px;
  background: var(--color-question-count);
  color: var(--color-text);
  border: 1.5px solid var(--color-accent-border);
  margin-left: 10px;
  outline: none;
  font-weight: 500;
  transition: border 0.18s;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}
.select-wrap select:focus {
  border-color: var(--color-accent-focus);
}
.dropdown-arrow {
  pointer-events: none;
  position: absolute;
  top: 40%;
  right: 0px;
  width: 16px;
  height: 16px;
  transform: translateY(-50%) rotate(0deg);
  transition: transform 0.3s cubic-bezier(0.57, 0.21, 0.69, 1.25);
  display: flex;
  align-items: center;
  justify-content: center;
}
.dropdown-arrow::before {
  content: "";
  display: block;
  width: 100%;
  height: 100%;
  background: url('data:image/svg+xml;utf8,<svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><polyline points="4,6 8,10 12,6"/></svg>')
    no-repeat center/contain;
}
.select-wrap select:focus + .dropdown-arrow {
  transform: translateY(-50%) rotate(180deg);
}

/* misc */
input[type="checkbox"] {
  accent-color: var(--color-input);
}
input[type="radio"] {
  accent-color: var(--color-input);
}

.muted,
.muted * {
  opacity: 0.85;
  pointer-events: none;
  filter: grayscale(0.5) blur(0.3px);
  user-select: none;
  cursor: not-allowed;
}

/* ---- stats panel ---- */
.quiz-stats-panel {
  position: absolute;
  top: 130px;
  right: 24px;
  min-width: 400px;
  max-width: 580px;
  max-height: 390px;
  background: rgba(40, 50, 90, 0.2);
  backdrop-filter: blur(1px);
  -webkit-backdrop-filter: blur(1px);
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(60, 0, 80, 0.18);
  padding: 16px 10px 10px 18px;
  color: var(--color-text);
  font-size: 1em;
  z-index: 4;
  margin-left: 20px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--color-accent) transparent;
}
.container {
  position: relative;
}
.quiz-stats-table-wrap {
  overflow-x: auto;
  margin-top: 0.2em;
  border-radius: 8px;
}
.quiz-stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1.02em;
  color: #eee;
}
.quiz-stats-table th,
.quiz-stats-table td {
  padding: 5px 10px;
  color: var(--color-text);
}
.quiz-stats-table td:nth-child(2),
.quiz-stats-table td:nth-child(3),
.quiz-stats-table td:nth-child(4),
.quiz-stats-table th:nth-child(2),
.quiz-stats-table th:nth-child(3),
.quiz-stats-table th:nth-child(4) {
  text-align: center;
}
.quiz-stats-table th {
  color: var(--color-accent-focus, #9e81fa);
  font-weight: 700;
  font-size: 1.01em;
  border-bottom: 2px solid var(--color-accent-border, #5f559a);
  background: none;
}
.quiz-stats-table tr:nth-child(even) {
  background: rgba(100, 100, 130, 0.11);
}
.quiz-clear-btn,
.quiz-remove-btn {
  transition: color 0.15s;
}
.quiz-clear-btn:hover,
.quiz-remove-btn:hover {
  color: #ff4444;
}
.quiz-clear-btn {
  margin: 0 !important;
  padding: 0;
}
.quiz-remove-btn {
  margin: 0 !important;
  padding: 0 !important;
}

/* ---- tooltips ---- */
.custom-tooltip-wrapper {
  position: relative;
  display: inline-block;
}
.custom-tooltip-text {
  visibility: hidden;
  opacity: 0;
  width: max-content;
  max-width: 250px;
  background: #2b2738;
  color: #fff;
  font-size: 0.7em;
  padding: 8px 12px;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  position: absolute;
  left: 50%;
  top: -200%;
  transform: translateX(-50%);
  z-index: 1000;
  transition: opacity 0.1s;
  pointer-events: none;
  margin-top: 8px;
}
.custom-tooltip-wrapper:hover .custom-tooltip-text,
.custom-tooltip-wrapper:focus-within .custom-tooltip-text {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transition-delay: 0s;
}

/* Alert Customization */
.swal2-container { z-index: 4000 !important; }

.swal2-popup.quiz-swal {
  background: var(--color-bg-alt) !important;
  color: var(--color-text) !important;
  border: 2px solid var(--color-accent-border) !important;
  border-radius: 16px;
  box-shadow: 0 8px 32px 0 rgba(0,0,0,.25);
  backdrop-filter: blur(6px);
}
.swal2-popup.quiz-swal .swal2-title { 
  color: var(--color-h1) !important; 
  letter-spacing: .02em;
}

.swal2-popup.quiz-swal .swal2-icon.swal2-warning {
  border-color: var(--color-accent-focus) !important;
  color: var(--color-accent-focus) !important; /* the ! color */
}

.swal2-popup.quiz-swal .swal2-actions { gap: 8px; }
.quiz-swal-confirm {
  background: var(--color-accent) !important;
  color: #fff;
  border: 0;
  border-radius: 14px;
  padding: .65em 1.4em;
  box-shadow: 0 3px 10px rgba(0,0,0,.18);
}
.quiz-swal-confirm:hover { transform: translateY(-1px); }
.quiz-swal-cancel {
  background: transparent;
  color: var(--color-text) !important;
  border: 2px solid var(--color-accent-border) !important;
  border-radius: 14px;
  padding: .65em 1.4em;
}


/* ---- thin scrollbars ---- */
html,
body {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

/* ---- splash ---- */
@media screen and (min-width: 1770px) {
  #splashText {
    position: absolute;
    top: 7%;
    right: 17.5%;
    font-size: 1.1em;
    font-weight: 900;
    color: var(--color-splash-text);
    text-shadow: 2px 2px 0 #4d4400, 0 2px 8px #0008;
    transform: rotate(15deg) scale(1.12);
    user-select: none;
    pointer-events: none;
    z-index: 9999;
    font-family: "Comic Sans MS", "Comic Sans", cursive, sans-serif;
    transition: opacity 0.5s;
    animation: splash-grow 10s infinite ease-in-out;
  }
  @keyframes splash-grow {
    0% {
      transform: rotate(10deg) scale(1.08);
    }
    45% {
      transform: rotate(10deg) scale(1.19);
    }
    55% {
      transform: rotate(10deg) scale(1.19);
    }
    100% {
      transform: rotate(10deg) scale(1.08);
    }
  }
}

/* fades when muted */
/* usually on modal popups */
#splashText.muted {
  opacity: 0.25;
  filter: blur(1.3px);
  transition: opacity 0.4s, filter 0.4s;
  pointer-events: none;
}
