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

/* Color variables */
:root {
    --deep-violet: 33 14 46;
    --amethyst-purple: 108 62 148;
    --soft-lavender: 216 180 254;
    --soft-pastel-purple: #e9d5ff;
    --input-text: #3b0764;
    --input-text-focused: #a855f7;
}

@property --glow-color-1 {
    syntax: '<color>';
    initial-value: #1e0b29;
    inherits: false;
}

@property --glow-color-2 {
    syntax: '<color>';
    initial-value: #5c134f;
    inherits: false;
}

.default-bg-fallback {
    /* Set up the gradient using the dynamic variables */
    background-image: linear-gradient(135deg, var(--glow-color-1) 0%, #3b114d 50%, var(--glow-color-2) 100%) !important;

    /* Safely use regular fullscreen layout definitions without breaking */
    background-size: cover !important;
    background-attachment: fixed !important;
    background-blend-mode: normal !important;

    /* Animate the colors instead of the background framework positions */
    animation: romanticColorPulse 8s ease-in-out infinite alternate !important;
}

/* Smooth shifting color properties */
@keyframes romanticColorPulse {
    0% {
        --glow-color-1: #1e0b29;
        --glow-color-2: #5c134f;
    }

    50% {
        --glow-color-1: #3b0764;
        --glow-color-2: #9d174d;
    }

    100% {
        --glow-color-1: #4c1d95;
        --glow-color-2: #701a75;
    }
}

body {
    width: 100vw;
    min-height: 100vh;

    background-color: rgb(var(--deep-violet) / 0.65);

    font-family: Arial, Helvetica, sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

#bg-fade-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;

    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;

    opacity: 1;

    transition: opacity 0.4s ease-in-out;
}

.screen-view {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
}

/* Paragraph Layout Formatting */
.intro-paragraph,
.celebration-paragraph {
    font-size: 1.05rem;
    line-height: 1.6;
    color: #f3e8ff;
    background: rgba(0, 0, 0, 0.3);
    /* Soft matching dark tint background */
    padding: 1.25rem;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    text-align: left;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.cutesy-title {
    font-size: 2.2rem;
    color: #ffffff;
    font-weight: 700;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.primary-action-btn {
    background: #7e22ce !important;
    /* Velvet purple color matching check answer button */
    color: #ffffff !important;
    font-weight: 700;
    box-shadow: 0 6px 15px rgba(126, 34, 206, 0.35);
}

/* Ambient glass container */
main {
    width: 100%;
    max-width: 520px;
    background: rgb(22 11 31 / 0.6);
    backdrop-filter: blur(3px);

    border-radius: 30px;
    border: 2.5px solid rgb(var(--soft-lavender) / 0.35);
    box-shadow: 0 15px 35px rgb(147 51 234 / 0.25), 0 5px 15px rgb(0 0 0 / 0.3);
    padding: 2.5rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    text-align: center;
}

section {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* ------
Typography
------ */
#question {
    font-size: 1.5rem;
    color: #ffffff;
    font-weight: 700;
    line-height: 1.4;
    text-shadow: 0 2px 8px rgb(0 0 0 / 0.8);
    margin-bottom: 0.5rem;
}

label[for="answer"] {
    font-size: 0.95rem;
    color: var(--soft-pastel-purple);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 0.75rem;
}

#answer-check {
    font-size: 1.1rem;
    color: #f3e8ff;
    font-weight: 600;
}

#answer-overview {
    font-size: 1.05rem;
    color: #ffffff;
    line-height: 1.5;
    background: rgb(0 0 0 / 0.25);
    border-radius: 12px;
    padding: 0.5rem 1rem;
}

/* ------
Textbox input
------ */
#answer {
    width: 100%;
    padding: 1rem 1.25rem;
    font-size: 1.1rem;
    text-align: center;
    color: var(--input-text);
    background: rgb(255 255 255 / 0.95);
    border: 3px solid #d8b4fe;
    border-radius: 20px;
    outline: none;
    box-shadow: inset 0 2px 4px rgb(0 0 0 / 0.1);
    transition: all 0.3s ease;
    margin-bottom: 1rem;
}

#answer:focus {
    border-color: var(--input-text-focused);
    box-shadow: 0 0 15px rgb(168 85 247 / 0.5);
    transform: scale(1.01);
}

/* Success State */
.input-correct {
    border-color: #10b981 !important;
    /* Mint Green */
    box-shadow: 0 0 15px rgb(16 185 129 / 0.4) !important;
}

#answer-check.text-correct {
    color: #10b981 !important;
}

/* Error State */
.input-incorrect {
    border-color: #ef4444 !important;
    /* Rose Red */
    box-shadow: 0 0 15px rgb(239 68 68 / 0.4) !important;
    animation: cutesyShake 0.4s ease-in-out;
}

#answer-check.text-incorrect {
    color: #ef4444 !important;
}

@keyframes cutesyShake {

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

    20%,
    60% {
        transform: translateX(-8px);
    }

    40%,
    80% {
        transform: translateX(8px);
    }
}

/* ------
Button styles
------ */
button {
    font-family: inherit;
    font-size: 1.05rem;
    font-weight: 700;
    padding: 0.9rem 1.75rem;
    border-radius: 20px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

#check-answer {
    width: 100%;
    background: #7e22ce;
    color: #ffffff;
    box-shadow: 0 6px 15px rgb(126 34 206 / 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

#check-answer::before {
    content: "❤️";
}

#check-answer::after {
    content: "❤️";
}

#check-answer:hover {
    background: #9333ea;
    transform: translateY(-2px);
}

/* Navigation row */
section:has(#next-btn) {
    flex-direction: row;
    gap: 1rem;
}

#next-btn,
#prev-btn {
    flex: 1;
    background: rgb(var(--soft-lavender) / 0.3);
    color: #ffffff;
    border: 1px solid rgb(255 255 255 / 0.2);
}

#next-btn:hover,
#prev-btn:hover {
    background: rgb(var(--soft-lavender) / 0.45);
    transform: translateY(-2px);
}

/* Horizontal placement for victory screen buttons */
.end-actions-row {
    width: 100%;
    display: flex;
    flex-direction: row;
    gap: 1rem;
}

/* Ensure buttons split the row 50/50 */
.end-actions-row button {
    flex: 1;
}

/* Specific styling for the secondary play again loop button */
.secondary-reset-btn {
    background: rgba(216, 180, 254, 0.2) !important;
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

.secondary-reset-btn:hover {
    background: rgba(216, 180, 254, 0.35) !important;
    transform: translateY(-2px);
}

/* ------
Hint elements
------ */
#hint-btn {
    background: transparent;
    color: var(--soft-pastel-purple);
    border: 2px dashed #c084fc;
    padding: 0.5rem 1.2rem;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

#hint-btn:hover {
    background: rgb(255 255 255 / 0.1);
    color: #ffffff;
}

#hint-text {
    max-height: 200px;
    opacity: 1;
    padding: 0.5rem 1rem;
    margin-top: 0.5rem;
    font-size: 1rem;
    color: #fff0f3;
    background: rgb(0 0 0 / 0.35);
    border-radius: 15px;
    border: 1px solid rgb(255 255 255 / 0.1);

    /* prevent overflow */
    width: 100%;
    word-break: break-word;
    overflow-wrap: anywhere;
    white-space: normal;

    /* Smooth layout accordion collapse rules */
    overflow: auto;
    transition: max-height 0.4s ease-in-out, opacity 0.3s ease-in-out, padding 0.4s ease-in-out;
}

/* Completely collapsed state when hidden */
#hint-text.hidden {
    display: block !important;
    /* Override standard display:none to let height animate */
    max-height: 0 !important;
    opacity: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    margin-top: 0 !important;
    pointer-events: none;
    border: none !important;
}

#hint-text a {
    color: #f3e8ff;
    text-decoration: underline;
    font-weight: 600;
}

#hint-text a:hover {
    color: #ffffff;
}

/* ------
Reset Button
------ */
#reset-btn {
    background: transparent;
    color: rgb(255 255 255 / 0.4);
    font-size: 0.85rem;
    padding: 0.25rem 1rem;
    font-weight: 500;
}

#reset-btn:hover {
    color: #f43f5e;
}

/* ------
Utility
------ */
.hidden {
    display: none !important;
}

button:active {
    transform: translateY(1px) !important;
}

/* ------
Celebration effects
------ */
.celebration-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    /* Layers floating hearts above the entire card template */
    z-index: 999;
    /* Insulates mouse clicks */
    pointer-events: none;
}

/* Individual particle template formatting */
.heart-particle {
    position: absolute;
    top: 60%;
    left: 50%;
    transform: translate3d(-50%, -50%, 0);
    pointer-events: none;
    will-change: transform, opacity;
}