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

:root {
  --bg-main: #141313;
  --text-main: #ffffff;
  --text-soft: #a0a0ab;
  --btn-primary: oklch(63.245% 0.20931 289.719);
  --font-body: "Lexend Deca", sans-serif;
  --font-heading: "Poppins", sans-serif;
  --card-bg: #1c1b1b;
  --card-border: rgba(255, 255, 255, 0.15);
  color-scheme: dark;
}

[data-theme="light"] {
  --bg-main: #f4f5f8;
  --text-main: #111215;
  --text-soft: #5e606a;
  --card-bg: #ffffff;
  --card-border: rgba(0, 0, 0, 0.12);
  color-scheme: light;
}

html,
body {
  min-height: 100vh;
  min-height: 100dvh;
  background-color: var(--bg-main);
  color: var(--text-main);
  color-scheme: dark;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

[data-theme="light"] html,
[data-theme="light"] body {
  color-scheme: light;
}

/* ── Validation Toast ── */
.validation-toast {
  position: fixed;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #222121;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  padding: 12px 24px;
  border-radius: 12px;
  width: max-content;
  max-width: 90%;
  text-align: center;
  font-family: "Poppins";
  font-size: 0.9rem;
  z-index: 9999;
  box-shadow:
    0 10px 25px -5px rgba(0, 0, 0, 0.5),
    0 4px 10px -3px rgba(0, 0, 0, 0.3);
  transition: top 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.validation-toast.error-toast {
  color: oklch(60% 0.15 20);
}

.validation-toast.show {
  top: 20px;
}

.validation-toast.show.title-mode {
  animation: title-toast-entrance 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes title-toast-entrance {
  from {
    opacity: 0;
    top: -50px;
  }

  to {
    opacity: 1;
    top: 90px;
  }
}

#title.title-error {
  border-bottom: 2px solid oklch(60% 0.15 20) !important;
  /* Use the same shake you have for question blocks */
  animation: shake 0.3s ease-in-out;
}

@font-face {
  font-family: "Poppins";
  src: url("../LAMBU-Fonts/Poppins-Medium.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: "Lexend Deca";
  src: url("../LAMBU-Fonts/LexendDeca-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Lexend Deca";
  src: url("../LAMBU-Fonts/LexendDeca-Medium.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: "Lexend Deca";
  src: url("../LAMBU-Fonts/LexendDeca-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}

@font-face {
  font-family: "Lexend Deca";
  src: url("../LAMBU-Fonts/LexendDeca-Bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

.back-btn-wrapper {
  display: flex;
  flex-direction: row;
  gap: 30px;
  align-items: center;
  margin: 0 10px 0 0;
  padding-top: 15px;
  padding-left: 10px;
  padding-bottom: 10px;
  position: sticky;
  top: 0;
  background-color: var(--bg-main);
  width: 100%;

  z-index: 100;
  transition: transform 0.3s ease-in-out;
}

.back-btn-wrapper.hide-header {
  transform: translateY(-100%);
  /* Slides it exactly 100% of its own height upwards */
}

.back-icon {
  fill: #8e8e93;
  color: #8e8e93;
  transition: transform 0.1s ease-in, fill 0.15s ease, color 0.15s ease;
}

.back-icon:hover {
  fill: #d1d1d6;
  color: #d1d1d6;
}

.back-icon:active {
  transform: scale(0.9);
}

.title-wrapper {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#title {
  width: 30%;
  resize: none;
  font-family: "Poppins";
  font-size: clamp(0.9rem, 8dvw, 1.5rem);
  font-weight: 500;
  padding: 10px 0 10px 0;
  /*top right bottom left*/
  border: none;
  background-color: transparent;

  color: var(--text-main);
  outline: none;
  overflow: hidden;
}

#title::placeholder {
  color: var(--text-soft);
}

#title:focus {
  color: var(--text-main);
}

textarea {
  resize: none;
  font-family: "Lexend Deca", sans-serif;
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: pre-wrap;
  overflow-y: hidden;
  transition: none;
}

/* This hides the individual delete buttons while keeping the 'Delete All' visible */
.question-choices-handler .delete,
.question-choices-handler .icon-delete {
  display: none !important;
}

.delete-all-btn {
  margin-right: 10px;
}

.delete {
  color: oklch(66.504% 0.20458 24.602);
  /* This is the reddish color */
  cursor: pointer;
  border: none;
  background: none;
}

.main-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  row-gap: 20px;
  /* Reduced gap */
  column-gap: 20px;
  margin-top: 20px;
  align-items: start;
  min-height: auto;

  padding-bottom: 25px;
}

.question-choices-handler {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding-bottom: 10px;
  padding-left: 10px;
  padding-right: 10px;
  /* ── PERFORMANCE: Skip layout/paint/composite for off-screen blocks ── */
  /* Browser treats each block as independent — only visible ones cost RAM.  */
  /* contain-intrinsic-size reserves ~220px per block so scroll stays stable */
  content-visibility: auto;
  contain-intrinsic-size: auto 220px;
}

.question-wrapper {
  display: flex;
  align-items: flex-start;
  flex-direction: row;
  gap: 5px;
  margin-bottom: 5px;
  width: 100%;
  position: relative;
}

.question-number {
  font-family: "Lexend Deca";
  font-size: clamp(0.9rem, 8dvw, 1.34375rem);
  font-weight: 700;
  color: var(--text-main);
  padding: 10px 0;
  line-height: 1.4;
}

.question-input {
  width: 100%;
  font-family: "Lexend Deca";
  font-size: clamp(0.9rem, 8dvw, 1.34375rem);
  font-weight: 700;
  border: none;
  outline: none;
  background-color: transparent;
  color: var(--text-main);
  text-align: left;
  padding: 10px 0;
  overflow: hidden;
  min-height: calc(1.4em + 20px);
  line-height: 1.4;
}

.question-input::placeholder {
  color: #7a7a85;
}

.choices-wrapper {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

.choices-section {
  display: flex;
  flex-direction: row;
  align-items: center;
  width: 100%;
  position: relative;
}

/* This locks the circle if the box is empty OR only contains spaces */
.choices-section:has(.choices-input:placeholder-shown) .svg-empty-circle,
.choices-section:has(.choices-input:invalid) .svg-empty-circle {
  pointer-events: none;
  opacity: 0.5;
  cursor: not-allowed;
}

/* 2. When the textarea has TEXT (placeholder is NOT showing) */
.choices-section:has(.choices-input:not(:placeholder-shown)) .svg-empty-circle {
  opacity: 1;
  pointer-events: auto;
  /* Enables clicking */
  cursor: pointer;
}

.svg-empty-circle {
  width: 30px;
  height: 30px;
  position: absolute;
  left: 5px;
  /* Smoothly fade between disabled and enabled states */
  transition: transform 0.1s ease, opacity 0.3s ease;
}

.svg-empty-circle:active {
  transform: scale(0.9);
}

.hidden {
  display: none;
}

.check,
.circle {
  transition:
    opacity 0.2s ease-in-out,
    transform 0.2s ease-in-out;
}

/* Add a shake animation for empty choices */
@keyframes shake {
  0% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-5px);
  }

  50% {
    transform: translateX(5px);
  }

  75% {
    transform: translateX(-5px);
  }

  100% {
    transform: translateX(0);
  }
}

.shake-error {
  animation: shake 0.3s ease-in-out;
  border-color: oklch(60% 0.15 20) !important;
  /* Reddish border */
}

.check {
  cursor: pointer;
  z-index: 10;
  transition: transform 0.2s ease;
}

.delete-question {
  width: 25px;
  /* ADD THIS */
  height: 25px;
  /* ADD THIS */
  pointer-events: auto;
  z-index: 10;
  flex-shrink: 0;
  display: none;
  position: absolute;
  right: 0;
  top: 12px;
  cursor: pointer;
  opacity: 0.9;
}

.has-multiple .delete-question {
  display: block;
}

.has-multiple .question-input {
  padding-right: 40px;
}

.check:active {
  transform: scale(0.9);
}

.choices-input {
  width: 100%;
  padding: 10px 10px 10px 37px;
  min-height: calc(1.4em + 22px);
  line-height: 1.4;
  font-family: "Lexend Deca";
  font-size: clamp(0.8rem, 8dvw, 1.28125rem);
  font-weight: 500;
  background-color: var(--card-bg);
  border-radius: 10px;
  outline: none;
  border: 1px solid var(--card-border);
  color: var(--text-main);
  transition: box-shadow 0.3s ease-in-out, border-color 0.2s ease, background-color 0.2s ease;
}

.choices-input::placeholder {
  color: var(--text-soft);
}

.choices-input:focus {
  border-color: var(--btn-primary);
}

.circle path,
.svg-empty-circle path {
  fill: #8a8a9a;
}

/* If the section contains a check SVG that is NOT hidden, target the input */
.choices-section:has(.check:not(.hidden)) .choices-input {
  border: 1px solid #54b548;
  /* Matching your checkmark green */
}

.btn-quiz-wrapper {
  padding: 20px 10px 40px;
  /* Normal padding for the bottom of the page */
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 25px;
}

.add-question-choices {
  transition: transform 0.1s ease-in-out;
  cursor: pointer;
}

.add-question-choices:active {
  transform: scale(0.9);
}

.btn-quiz {
  width: 50%;
  pointer-events: auto;
  padding: 10px 0 10px;
  margin-top: 0;
  font-family: "Poppins";
  font-weight: 500;
  font-size: clamp(0.8rem, 8dvw, 1.25rem);
  border-radius: 10px;
  border: none;
  background-color: oklch(63.245% 0.20931 289.719);
  color: oklch(97.184% 0.01483 294.309);
  cursor: pointer;
  transition: transform 0.2s ease-in-out;
}

.btn-quiz:active {
  transform: scale(0.9);
}

.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  justify-content: center;
  /* Changed to flex-end to push the question delete pop-up to the bottom */
  align-items: flex-end;

  /* Gap from the bottom of the screen */
  z-index: 1000;
}

.delete-all-wrapper {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  justify-content: center;
  align-items: center;
  /* Keeps 'Delete All' centered */
  z-index: 9999;
}

/* 2. Show the overlay */
.modal-overlay.show {
  display: flex;
}

/* 3. Your Modal */
.confirmation-delete {
  background-color: #1c1b1b;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  padding: 25px;
  width: calc(100% - 40px);
  max-width: 450px;
  display: flex;
  margin-bottom: 150px;
  /* Keep as flex */
  flex-direction: column;
  gap: 30px;
  box-shadow: 0px 10px 30px rgba(0, 0, 0, 0.6);
  z-index: 1001;
}

.confirmation-delete.show {
  display: flex;
  opacity: 1;
  scale: 1;
}

.bt-cfrm-wrapper,
.btn-delete-all-wrapper {
  width: 100%;
  display: flex;
  justify-content: center;
  gap: 20px;
}

.cnfrm-dialgue,
.delete-all-dialogue {
  text-align: center;
  font-family: "Poppins";
  font-weight: 500;
  font-size: clamp(0.6rem, 8dvw, 1rem);
  color: #e2e2e9;
}

.btn-cfrm,
.delete-all {
  padding: 13px 20px 13px 20px;
  font-family: "Poppins";
  font-size: clamp(0.6rem, 8dvw, 1.2rem);
  font-weight: 500;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.2s ease;
  flex: 1;
  /* This makes both buttons exactly the same width */
}

.btn-cfrm:active,
.delete-all:active {
  transform: scale(0.9);
}

.btn-dlt,
.delete-all-button {
  background-color: oklch(66.161% 0.22493 25.863);
  border: 1px solid oklch(66.161% 0.22493 25.863);
  color: oklab(100% 0 -0.00011);
  width: 100%;
}

.btn-cncl,
.cancel-all {
  background-color: inherit;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #a0a0ab;
  width: 100%;
}

.confirm-delete-all {
  width: 45%;
  display: flex;
  align-items: center;
  flex-direction: column;
  padding: 25px;
  width: calc(100% - 40px);
  max-width: 450px;
  background-color: #1c1b1b;
  border: 1px solid rgba(255, 255, 255, 0.15);
  gap: 30px;
  box-shadow: 0px 10px 30px rgba(0, 0, 0, 0.6);
  z-index: 1001;
  border-radius: 10px;
}

@media (max-width: 868px) {
  #title {
    width: 100%;
  }

  .main-container {
    grid-template-columns: 1fr;
  }

  .btn-quiz {
    width: 100%;
  }

  .confirmation-delete {
    width: 90%;
  }

  .quiz-content-wrapper {
    width: 90%;
    /* Expands to look great on your phone! */
    padding: 15px;
    /* Slightly tighter padding for mobile */
  }
}

/* ── Empty textarea pastel highlight ── */
.input-empty-error {
  border-color: oklch(80% 0.1 20);
  transition: border-color 0.4s ease;
}



.circle-glow {
  animation: circle-glow-pulse 1s ease-in-out infinite;
}

.choices-input.duplicate-error {
  border: 1px solid oklch(65% 0.22 38);
  background-color: oklch(85.381% 0.0752 44.366 / 0.1);
  /* Translucent red */
  transition: border-color 0.4s ease, background-color 0.4s ease;
}

.arrow-to-bottom-wrapper {
  position: fixed;
  bottom: 60px;
  /* Anchored to bottom for stable calculation */
  left: 50%;
  transform: translateX(-50%);

  /* Precision: Hidden by default */
  opacity: 0;
  visibility: hidden;
  pointer-events: none;

  /* Smoothness */
  transition: opacity 0.1s ease, visibility 0.1s;
  z-index: 500;

  /* Your existing design styles */
  width: 45px;
  height: 45px;
  background-color: #222121;
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 50%;
  box-shadow: 0px 4px 14px rgba(0, 0, 0, 0.5);

}



.arrow-to-bottom-wrapper:active {
  transform: translateX(-50%) scale(0.9);
  /* Keep centering while clicking */
}

.arrow-to-bottom-wrapper svg {
  fill: #6200ee;
  width: 30px;
  height: 30px;
}

.arrow-to-bottom-wrapper svg {
  fill: var(--btn-primary);
  /* Uses your purple/blue theme color */
  width: 30px;
  height: 30px;
}

.arrow-to-bottom-wrapper.visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.title-field-group {
  display: flex;
  flex-direction: row;
  /* Change to row to put button beside input */
  align-items: center;
  justify-content: center;
  width: 100%;
  position: relative;
  gap: 10px;
}

.hide-header .title-error-text {
  opacity: 0 !important;
  visibility: hidden;
  transition: opacity 0.1s ease;
}

.title-error-text {
  color: oklch(60% 0.15 20);
  font-family: "Poppins", sans-serif;
  font-size: 0.75rem;
  font-weight: 500;

  /* POSITIONING FIX: */
  position: absolute;
  bottom: -22px;
  /* Pulls it safely below the input line */
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  /* Prevents text from wrapping into a 'strip' */

  height: auto;
  opacity: 0;
  transition: opacity 0.2s ease;
  text-align: center;
  pointer-events: none;
  z-index: 10;
}

.title-error-text.visible {
  opacity: 1;
}

.empty-choice-error {
  border: 1.2px solid oklch(67.184% 0.14356 18.472);
  animation: shake 0.3s ease-in-out;
  transition: border-color 0.4s ease;
}


/* ── Empty Block Highlight ── */
.empty-block-error {
  background-color: #ffffff;
  border-radius: 12px;
  box-shadow: 0px 0px 20px rgba(136, 136, 136, 0.06);
  animation: shake 0.3s ease-in-out;
  transition: background-color 0.4s ease;
}

.circle-glow {
  animation: circle-glow-pulse 1s ease-in-out infinite !important;
  border-radius: 50%;
}

/* ── Circle SVG glow pulse when no answer selected ── */
@keyframes circle-glow-pulse {

  0%,
  100% {
    filter: drop-shadow(0 0 0px oklch(60% 0.15 20));
    transform: scale(1);
  }

  50% {
    filter: drop-shadow(0 0 8px oklch(60% 0.15 20));
    transform: scale(1.1);
  }
}

/* ── Light Mode Component Overrides ── */
[data-theme="light"] .confirmation-delete {
  background-color: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.12);
  box-shadow: 0px 10px 30px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .cnfrm-dialgue,
[data-theme="light"] .delete-all-dialogue {
  color: #111215;
}

[data-theme="light"] .btn-cfrm.cancel {
  background-color: #e5e7eb;
  color: #111215;
}

[data-theme="light"] .validation-toast {
  background-color: #ffffff;
  border-color: rgba(0, 0, 0, 0.12);
  color: #111215;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .arrow-to-bottom-wrapper {
  background-color: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.12);
  box-shadow: 0px 4px 14px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .back-icon {
  fill: #5e606a;
  color: #5e606a;
}

[data-theme="light"] .back-icon:hover {
  fill: #111215;
  color: #111215;
}