* {
    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.457% 0.17951 35.188);
    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;
}

/* 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;
}

textarea {
    resize: none;
}

/* 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-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-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    row-gap: 40px;
    column-gap: 20px;
    margin-top: 35px;
    padding-bottom: 3.5rem;

}

.qa-section {
    display: flex;
    flex-direction: column;
    padding-left: 10px;
    padding-right: 10px;
    width: 100%;
}

.question-wrapper {
    width: 100%;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 5px;
}

.question-num,
.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 {
    border: none;
    outline: none;
    background-color: transparent;
}

.question-input::placeholder {
    color: #7a7a85;
}

.question-input,
.answer-input {
    width: 100%;
    overflow: hidden;
}

.answer-wrapper {
    display: flex;
    flex-direction: row;
    width: 100%;
}

.answer-input {
    width: 100%;
    padding: 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: border-color 0.2s ease, box-shadow 0.2s ease;
}

.answer-input::placeholder {
    color: #7a7a85;
}

.answer-input:focus {
    border-color: var(--accent);
}



.delete-all-btn {
    width: 1.65em;
    height: 1.65em;
    flex-shrink: 0;
    margin-left: 8px;
    cursor: pointer;
    opacity: 0.8;
    margin-right: 10px;
}


.add-question {
    width: 35px;
    height: 35px;
    cursor: pointer;
}


.icon-delete-question {
    width: 25px;
    height: 25px;
    margin-right: 0;
    margin-top: 11px;
    flex-shrink: 0;
    cursor: pointer;
    opacity: 0.8;
    margin-right: 0.1em;
}

.final-action-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding-left: 10px;
    padding-right: 10px;
    align-items: center;
    gap: 25px;
    padding-bottom: 20px;
}

.btn-quiz {
    width: 50%;
    padding: 10px 0;
    border-radius: 10px;
    border: none;
    background-color: oklch(69.457% 0.17951 35.188);
    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;
}

/* Make SVGs scale properly */
.delete-all-btn svg {
    width: 100%;
    height: 100%;
}

.arrow-to-bottom-wrapper {
    position: fixed;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);

    /* Hidden by default – show it later if you want via .visible */
    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;
    border: 1px solid var(--card-border);
    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);
}

.arrow-to-bottom-wrapper svg {
    fill: oklch(69.457% 0.17951 35.188);
    /* Identification accent colour */
    width: 30px;
    height: 30px;
}

.arrow-to-bottom-wrapper.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}


/* ── Hide on scroll animation ── */
.back-btn-wrapper {
    transition: transform 0.3s ease-in-out;
}

.back-btn-wrapper.hide-header {
    transform: translateY(calc(-100% - 30px));
}

/* ── Title error styling ── */
#title.title-error {
    border-bottom: 2px solid oklch(60% 0.15 20) !important;
    animation: shake 0.3s ease-in-out;
}

.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;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.title-error-text.visible {
    opacity: 1;
}

/* ── Delete All modal ── */
.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: flex-end;

    z-index: 9999;
}

.confirm-delete-all {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 25px;
    width: calc(100% - 40px);
    margin-bottom: 150px;
    max-width: 450px;
    display: flex;
    flex-direction: column;
    gap: 30px;
    box-shadow: 0px 10px 30px rgba(0, 0, 0, 0.6);
}

.delete-all-dialogue {
    text-align: center;
    font-family: "Poppins";
    font-weight: 500;
    font-size: clamp(0.6rem, 8dvw, 1rem);
    color: #e2e2e9;
}

.btn-delete-all-wrapper {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.delete-all {
    padding: 13px 20px;
    font-family: "Poppins";
    font-size: clamp(0.6rem, 8dvw, 1.2rem);
    font-weight: 500;
    border-radius: 10px;
    cursor: pointer;
    flex: 1;
    transition: transform 0.2s;
}

.delete-all:active {
    transform: scale(0.9);
}

.cancel-all {
    background: inherit;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #a0a0ab;
}

.delete-all-button {
    background: oklch(66.161% 0.22493 25.863);
    border: 1px solid oklch(66.161% 0.22493 25.863);
    color: white;
}

/* ── Validation toast ── */
.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);
    transition: top 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.validation-toast.show {
    top: 20px;
}

/* ── Per‑question delete icon visibility ── */
.qa-section .icon-delete-question {
    display: none;
}

.qa-section.has-multiple .icon-delete-question {
    display: block;
}

/* Responsive */
@media (max-width: 868px) {

    #title,
    .btn-quiz {
        width: 100%;
    }

    .main-container {
        grid-template-columns: 1fr;
    }
}

/* ── 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 {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--text-main);
}

[data-theme="light"] .answer-input::placeholder {
    color: var(--text-soft);
}

[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;
}