* {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
  touch-action: manipulation;
}

:root {
  --bg-main: #141313;
  --text-main: #ffffff;
  --text-soft: #a0a0ab;
  --card-bg: #1c1b1b;
  --card-border: rgba(255, 255, 255, 0.15);
  --accent: oklch(69.119% 0.24256 320.571);
  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;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

[data-theme="light"] body {
  color-scheme: light;
}

.validation-toast {
  position: fixed;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #222121;
  border: 1px solid var(--card-border);
  color: var(--text-main);
  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.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;
  }
}

@keyframes shake {

  0%,
  100% {
    transform: translateX(0);
  }

  25%,
  75% {
    transform: translateX(-5px);
  }

  50% {
    transform: translateX(5px);
  }
}

#title.title-error {
  border-bottom: 2px solid oklch(60% 0.15 20) !important;
  animation: shake 0.3s ease-in-out;
}

/* Fonts */
@font-face {
  font-family: "Poppins";
  src: url("../LAMBU-Fonts/Poppins-Medium.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: "Jakarta Sans";
  src: url("../LAMBU-Fonts/PlusJakartaSans-Bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "Jakarta Sans";
  src: url("../LAMBU-Fonts/PlusJakartaSans-Medium.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}

/* Header */
.back-btn-wrapper {
  background-color: var(--bg-main);
  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;
  width: 100%;
  z-index: 100;
  transition: transform 0.3s ease-in-out;
}

.back-btn-wrapper.hide-header {
  transform: translateY(-100%);
}

.back-icon {
  fill: #ffffff;
  transition: transform 0.1s ease-in;
}

.back-icon:active {
  transform: scale(0.9);
}

.title-wrapper {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#title {
  width: 30%;
  font-family: "Poppins";
  font-size: clamp(0.9rem, 8dvw, 1.5rem);
  font-weight: 500;
  padding: 10px 0;
  border: none;
  background: transparent;
  color: var(--text-main);
  outline: none;
  resize: none;
  overflow: hidden;
}

#title::placeholder {
  color: #7a7a85;
}

#title:focus {
  color: var(--text-main);
}

/* Main Layout */
textarea {
  resize: none;
  font-family: "Jakarta Sans", sans-serif;
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: pre-wrap;
  overflow-y: hidden;
  width: 100%;
  min-height: 2.5rem;
}

.main-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  row-gap: 35px;
  column-gap: 20px;
  margin-top: 30px;
  padding-bottom: 2rem;
}

.qa-handler {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding-left: 10px;
  padding-right: 10px;
  padding-bottom: 10px;
}

.question-wrapper {
  display: flex;
  flex-direction: row;
  gap: 5px;
  align-items: flex-start;
}

.question-number,
.question-input {
  font-family: "Jakarta Sans";
  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%;
  border: none;
  outline: none;
  background: transparent;
  text-align: left;
  min-height: calc(1.4em + 1.25rem);
  overflow: hidden;
}

.question-input::placeholder {
  color: #7a7a85;
}

/* Answers */
.answer-wrapper {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.answer-each-wrapper {
  display: flex;
  align-items: center;
  position: relative;
  width: 100%;
}

.answer-input {
  width: 100%;
  padding: 0.625rem 2.8rem 0.625rem 0.625rem;
  min-height: calc(1.4em + 1.375rem);
  font-family: "Jakarta Sans";
  font-size: clamp(0.8rem, 8dvw, 1.28125rem);
  font-weight: 500;
  background-color: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  color: var(--text-main);
  outline: none;
  transition:
    box-shadow 0.2s ease,
    border-color 0.2s ease;
}

.answer-input:focus {
  border-color: var(--accent);
}

.answer-input::placeholder {
  color: #7a7a85;
}

/* 👇 IDENTICAL TWIN – matching MCQ's .choices-input.duplicate-error */
.answer-input.duplicate-error {
  border: 1px solid oklch(65% 0.22 38);
  background-color: oklch(85.381% 0.0752 44.366 / 0.1);
  transition: border-color 0.4s ease, background-color 0.4s ease;
}

.answer-input::placeholder {
  color: rgb(117, 117, 117);
}

.delete-question {
  width: 1.8em;
  height: 1.8em;
  margin-top: 10px;
  margin-right: 0;
  flex-shrink: 0;
  cursor: pointer;
  opacity: 0.8;
  margin-right: 0.1em;
}

.delete-all-btn {
  width: 1.65em;
  height: 1.65em;
  flex-shrink: 0;
  margin-left: 8px;
  cursor: pointer;
  opacity: 0.8;
  margin-right: 10px;
}

.delete-answer {
  position: absolute;
  right: 1px;
  width: 1.75em;
  height: 1.75em;
  padding: 0.1em;
  box-sizing: content-box;
  flex-shrink: 0;
  fill: oklch(67.068% 0.00115 13.548);
  cursor: pointer;
}

.delete-question svg,
.delete-all-btn svg,
.delete-answer svg {
  width: 100%;
  height: 100%;
}

.add-answer {
  padding: 10px 0;
  border-radius: 10px;
  border: 1px dashed rgba(255, 255, 255, 0.25);
  background: var(--card-bg);
  font-family: "Jakarta Sans";
  font-size: clamp(0.8rem, 8dvw, 1.28125rem);
  font-weight: 500;
  color: #e2e2e9;
  cursor: pointer;
  box-shadow: none;
  transition: background-color 0.2s ease-in-out, border-color 0.2s ease;
}

.add-answer:hover {
  background-color: #242323;
  border-color: rgba(255, 255, 255, 0.4);
}

.add-answer:active {
  background-color: #2a2929;
}

/* Final Action */
.final-action {
  padding: 40px 10px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 25px;
}

.quiz-me-btn {
  width: 50%;
  padding: 10px 0;
  border-radius: 10px;
  border: none;
  background-color: oklch(69.119% 0.24256 320.571);
  font-family: "Poppins";
  font-weight: 500;
  font-size: clamp(0.8rem, 8dvw, 1.25rem);
  color: white;
  cursor: pointer;
  transition: transform 0.2s ease-in-out;
}

.quiz-me-btn:active {
  transform: scale(0.9);
}

/* Responsive */
@media (max-width: 868px) {
  #title {
    width: 100%;
  }

  .main-container {
    grid-template-columns: 1fr;
  }

  .quiz-me-btn {
    width: 100%;
  }
}

.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: oklch(0% 0 0 / 0.4);
  justify-content: center;
  align-items: flex-end;
  padding-bottom: 100px;
  z-index: 2000;
}

.delete-all-wrapper {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: oklch(0% 0 0 / 0.4);
  justify-content: center;
  align-items: center;
  z-index: 2001;
}

.delete-all-wrapper.show {
  display: flex;
}

.modal-overlay.show {
  display: flex;
}

.confirm-delete-all,
.confirmation-delete {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 25px;
  width: calc(100% - 40px);
  max-width: 450px;
  display: flex;
  flex-direction: column;
  gap: 30px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}

.delete-all-dialogue,
.cnfrm-dialgue {
  text-align: center;
  font-family: "Poppins";
  font-weight: 500;
  font-size: clamp(0.6rem, 8dvw, 1rem);
  color: #e2e2e9;
}

.btn-delete-all-wrapper,
.bt-cfrm-wrapper {
  display: flex;
  justify-content: center;
  gap: 20px;
}

.delete-all,
.btn-cfrm {
  padding: 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;
}

.delete-all:active,
.btn-cfrm:active {
  transform: scale(0.9);
}

.delete-all-button,
.btn-dlt {
  background: oklch(66.161% 0.22493 25.863);
  border: 1px solid oklch(66.161% 0.22493 25.863);
  color: white;
}

.cancel-all,
.btn-cncl {
  background: inherit;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #a0a0ab;
}

/* Error States */
.shake-error {
  animation: shake 0.3s ease-in-out;
}

.answer-input.input-empty-error,
.question-input.input-empty-error {
  border-color: oklch(60% 0.15 20) !important;
}

/* 🗑️ Old duplicate-error rule has been removed – only the new translucent one remains */

/* Arrow to bottom */
.arrow-to-bottom-wrapper {
  position: fixed;
  bottom: 35px;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.1s ease, visibility 0.1s;
  z-index: 500;
  width: 45px;
  height: 45px;
  background-color: #222121;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 50%;
  border: 1px solid var(--card-border);
  box-shadow: 0px 4px 14px rgba(0, 0, 0, 0.5);
}

.arrow-to-bottom-wrapper:active {
  transform: translateX(-50%) scale(0.9);
}

.arrow-to-bottom-wrapper svg {
  fill: oklch(69.119% 0.24256 320.571);
  width: 30px;
  height: 30px;
}

/* Title error text */
.title-field-group {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  width: 100%;
  position: relative;
  gap: 10px;
}

.title-error-text {
  color: oklch(60% 0.15 20);
  font-family: "Poppins", sans-serif;
  font-size: 0.75rem;
  font-weight: 500;
  position: absolute;
  bottom: -22px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  height: auto;
  opacity: 0;
  transition: opacity 0.2s ease;
  text-align: center;
  pointer-events: none;
  z-index: 10;
}

.title-error-text.visible {
  opacity: 1;
}

.hide-header .title-error-text {
  opacity: 0 !important;
  visibility: hidden;
  transition: opacity 0.1s ease;
}

/* ── Light Mode Component Overrides ── */
[data-theme="light"] #title {
  color: var(--text-main);
}

[data-theme="light"] #title::placeholder {
  color: var(--text-soft);
}

[data-theme="light"] .answer-input,
[data-theme="light"] .item-input {
  background-color: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--text-main);
}

[data-theme="light"] .answer-input::placeholder,
[data-theme="light"] .item-input::placeholder {
  color: var(--text-soft);
}

[data-theme="light"] .add-answer,
[data-theme="light"] .btn-add-item {
  background-color: var(--card-bg);
  border: 1px dashed rgba(0, 0, 0, 0.2);
  color: var(--text-main);
}

[data-theme="light"] .confirmation-delete,
[data-theme="light"] .confirm-delete-all {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  box-shadow: 0px 10px 30px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .cnfrm-dialgue,
[data-theme="light"] .delete-all-dialogue {
  color: var(--text-main);
}

[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;
}

[data-theme="light"] .back-icon:hover {
  fill: #111215;
}