/* =========================================================
   Base Styles and Variables
   ========================================================= */
@font-face {
    font-family: "BadComic";
    src: url("/fonts/BadComic-Regular.ttf") format("truetype");
    font-weight: normal;
    font-style: normal;
}

:root {
    --bg-color: #d9d3de;
    --text-color: #000;
    --container-bg: #cfb6e3;
    --textarea-bg: #cfb6e3;
    --textarea-text: #000;
    --textarea-border: #a85be3;
    --button-bg: #a85be3;
    --button-hover-bg: #7e22ce;
    --button-text: #fff;
    --text-hover-color: #007acc;
    --accent-color: #9333ea;
    --sentence-bg: #cfb6e3;
    --info-color: #9C27B0;
    --header-bg: #5e8deb;
}

html.dark-mode,
body.dark-mode {
    --bg-color: #121212;
    --text-color: #f5f5f5;
    --container-bg: #333;
    --textarea-bg: #444;
    --textarea-text: #fff;
    --textarea-border: #666;
    --button-bg: #444;
    --button-hover-bg: #555;
    --button-text: #eee;
    --text-hover-color: #88c0d0;
    --accent-color: #9333ea;
    --sentence-bg: #333;
    --info-color: #9C27B0;
}

html, body {
    height: auto;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: sans-serif;
    transition: background-color 0.3s, color 0.3s;
    display: flex;
    flex-direction: column;
}

/* Generic utility class for hiding elements */
.hidden {
    display: none; /* No !important - let JS manage classes */
}


/* =========================================================
   Header Styles
   ========================================================= */
#main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background-color: var(--header-bg, #002d89);
    box-sizing: border-box;
    color: var(--text-color);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    flex-wrap: nowrap;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    align-items: center;
    gap: 8px;
}

.app-logo {
    height: 40px;
    width: auto;
}

.app-title {
    margin: 0;
    font-size: 1.8em;
    font-weight: 600;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: nowrap;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Header Authentication Status and Elements - New */
#header-auth-status {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
}

/* Initially hide the user info header when no one is signed in */
#user-info-header {
    display: none; /* Default to hidden */
    align-items: center;
    gap: 10px;
    padding: 0 10px;
    height: 40px;
    box-sizing: border-box;
    flex-shrink: 0;
}

/* Style for the user's displayed name */
#user-identifier {
    white-space: nowrap; /* Prevent "Welcome, user" from wrapping */
    overflow: hidden; /* Hide overflow */
    text-overflow: ellipsis; /* Add ellipsis for overflowed text */
    max-width: 150px; /* Adjust max-width as needed for longer names */
    color: var(--text-color, #333);
    font-size: 0.9em;
}

/* Style for the sign-out button */
#sign-out-button {
    padding: 8px 12px;
    font-size: 0.9em;
}

/* The open auth modal button (e.g., "Sign In / Sign Up") */
#open-auth-modal-button {
    display: inline-block; /* Ensure it's visible by default */
    padding: 8px 12px;
    font-size: 0.9em;
}

#settings-button {
    display: none;
    align-items: center;
    width: 40px;
    padding: 0;
}


    #settings-button svg {
        width: 24px;
        height: 24px;
        stroke: currentColor;
/*        fill: none; */
    }


/* =========================================================
   General Button Styles
   ========================================================= */
button {
    padding: 10px 16px;
    margin-top: 0;
    font-size: 1rem;
    border: none;
    border-radius: 10px;
    background: var(--button-bg);
    color: var(--button-text);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

    button:hover {
        background: var(--button-hover-bg);
        transform: translateY(-1px);
        box-shadow: 0 4px 8px rgba(0,0,0,0.12);
    }

    button:active {
        transform: translateY(0);
        box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    }

    /* Styling for natively disabled buttons (used for visual dimming) */
    button:disabled {
        opacity: 0.5; /* Dims the text/icon inside the button */
        cursor: not-allowed;
        transform: none; /* Override hover transform */
        box-shadow: none; /* Override hover shadow */
        pointer-events: none; /* Prevent click interaction for the inner button */
    }

.main-btn {
    width: 100%;
    height: 100%;
    align-self: stretch;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    overflow: hidden;
}

    .main-btn.active {
        background-color: var(--accent-color);
        color: #fff;
        transform: scale(1.05);
    }

#main-header .main-nav .main-btn,
#main-header #header-auth-status .main-btn {
    width: auto;
    height: 40px;
    align-self: auto;
    -webkit-appearance: auto;
    appearance: auto;
    padding: 0 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    white-space: nowrap;
    flex-shrink: 0;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
    text-decoration: none;
}

#main-header .main-nav #themeToggle,
#main-header #header-auth-status #open-auth-modal-button {
    min-width: 90px;
}


.reveal-btn {
    flex: 0 0 auto;
    min-width: 48px;
    padding: 8px 16px;
    font-size: 1rem;
    line-height: 1;
}

    .reveal-btn[aria-pressed="true"] {
        background-color: var(--accent-color);
        color: #fff;
    }

        .reveal-btn[aria-pressed="true"]:hover {
            background-color: var(--accent-color);
            opacity: 0.9;
        }

#fontSizeSelect {
    width: auto !important;
    flex: 0 0 auto;
    min-width: 60px;
    text-align: center;
    padding: 10px 16px;
    border-radius: 10px;
    background-color: var(--button-bg);
    color: var(--button-text) !important;
    border: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    transition: background 0.2s, transform 0.2s;
}

    #fontSizeSelect:hover {
        background: var(--button-hover-bg);
        transform: translateY(-1px);
    }

#speedSelect {
    padding: 10px 16px;
    margin: auto;
    width: auto;
    font-size: 1rem;
    border: none;
    border-radius: 10px;
    background-color: var(--button-bg);
    color: var(--button-text);
    transition: background 0.2s, transform 0.2s;
    display: flex;
}

    #speedSelect:hover {
        background-color: var(--button-hover-bg);
        transform: translateY(-1px);
    }

    #speedSelect:disabled {
        opacity: 0.4;
        cursor: not-allowed;
        transform: none;
    }

#coffee-btn .coffee-short {
    display: none;
}

#coffee-btn .coffee-full {
    display: inline;
}

#loadExamplesBtn .examples-short {
    display: none;
}

#loadExamplesBtn .examples-full {
    display: inline;
}

/* Show short version when buttons might wrap */
@media (max-width: 1400px) {
    #coffee-btn .coffee-full,
    #loadExamplesBtn .examples-full {
        display: none;
    }

    #coffee-btn .coffee-short,
    #loadExamplesBtn .examples-short {
        display: inline;
    }
}

#hideButtonGroup {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 10px;
    background: var(--button-bg);
    color: var(--button-text);
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    cursor: default;
    pointer-events: none;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
}

    /* Re-enable pointer events for children */
    #hideButtonGroup * {
        pointer-events: auto;
    }

    #hideButtonGroup span {
        margin-right: 2px;
    }

    /* Inner buttons */
    #hideButtonGroup button {
        padding: 4px 12px;
        font-size: 1rem;
        border-radius: 6px;
        background: rgba(255, 255, 255, 0.2);
        color: var(--button-text);
        border: 1px solid rgba(255, 255, 255, 0.3);
        min-width: 36px;
        height: auto;
        box-shadow: none;
        transition: background 0.2s, transform 0.1s, border-color 0.2s;
    }

        #hideButtonGroup button:hover {
            background: rgba(255, 255, 255, 0.3);
            transform: translateY(0); /* Override the main button lift */
            box-shadow: none;
        }

        #hideButtonGroup button:active {
            transform: scale(0.95);
        }

        /* Active/selected state */
        #hideButtonGroup button.active {
            background: var(--accent-color);
            color: #fff;
            border-color: var(--accent-color);
            transform: scale(1.05);
        }

            #hideButtonGroup button.active:hover {
                background: var(--accent-color);
                opacity: 0.9;
            }

/* email and password entry */
.auth-input {
    padding: 10px 16px;
    border: 1px solid var(--textarea-border);
    border-radius: 8px;
    background: var(--textarea-bg);
    color: var(--textarea-text);
    font-size: 0.9rem;
    flex: 1;
    min-width: 0;
}

    .auth-input:focus {
        outline: none;
        border-color: var(--accent-color);
    }

.auth-inline .main-btn {
    flex: 0 0 auto;
    height: auto;
    width: auto;
    white-space: nowrap;
}


@media (max-width: 1200px) {
    .auth-row {
        flex: 1 1 95%;
        max-width: 100%;
        justify-content: space-between;
    }

    .top-controls {
        flex: 1 1 95%;
    }
}

/* =========================================================
   Container & Layout
   ========================================================= */
.container {
    max-width: 1000px;
    margin: 40px auto;
    background: var(--container-bg);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    display: flex;
    gap: 20px;
    align-items: center;
}

.page-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 30vh;
    width: 100%;
    max-width: 50vw;
    margin: 0 auto;
    text-align: center;
}

/* =========================================================
   Text Area Panel & Columns
   ========================================================= */
.text-area-panel {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    width: 95%;
    margin: 20px auto 0;
    padding: 2vh 2vw;
    gap: 2vw;
    box-sizing: border-box;
}

.left-column {
    display: flex;
    flex-direction: column;
    width: 60%;
    min-width: 0;
    box-sizing: border-box;
}

.right-column {
    display: flex;
    flex-direction: column; /* Ensure right column stacks vertically */
    width: 40%;
    min-width: 0;
    box-sizing: border-box;
}

/* to add sentence numbers */
.textarea-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    width: 100%;
}

.line-numbers {
    position: absolute;
    left: 0;
    top: 1px;
    bottom: 1px;
    width: 30px;
    padding: 12px 4px 12px 0;
    background: var(--textarea-bg);
    border-right: 1px solid var(--textarea-border);
    border-left: 1px solid var(--textarea-border);
    border-top: 1px solid var(--textarea-border);
    border-bottom: 1px solid var(--textarea-border);
    border-radius: 6px 0 0 6px;
    color: var(--text-color);
    opacity: 0.6;
    font-size: 1.2rem;
    line-height: 1.5;
    text-align: right;
    overflow: hidden;
    pointer-events: none;
    font-family: inherit;
    user-select: none;
    white-space: pre;
}

textarea {
    width: 100%;
    max-width: 100%;
    min-height: 300px;
    resize: vertical;
    background: var(--textarea-bg);
    color: var(--textarea-text);
    border: 1px solid var(--textarea-border);
    border-radius: 6px;
    padding: 10px;
    font-size: 16px;
}


.textarea-wrapper:focus-within {
    outline: 1px solid var(--accent-color);
    outline-offset: -1px;
    border-radius: 6px;
}

textarea:focus {
    outline: none;
}

#sentenceInput {
    flex: 1;
    width: 100%;
    resize: none;
    font-size: 1.2rem;
    padding: 12px 12px 12px 40px;
    box-sizing: border-box;
    line-height: 1.5;
}

/* =========================================================
   Text Buttons
   ========================================================= */
.text-buttons {
    display: flex;
    gap: 12px;
    width: 100%;
    margin-top: 12px;
    justify-content: flex-start;
    align-items: stretch;
}

    .text-buttons button,
    .text-buttons select {
        font-size: 1rem !important;
        line-height: 1.2;
    }

.select-btn-group {
    display: flex;
    flex: 1 1 50%;
    gap: 12px;
}

    .select-btn-group select {
        flex: 0 0 auto;
    }

    .select-btn-group #loadExamplesBtn {
        flex: 1 1 0;
    }

#clearTextBtn {
    flex: 1 1 50%;
}
/* =========================================================
   Activity Grid & Wrappers
   ========================================================= */
.activity-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2vh 2vw;
    flex: 1;
    align-content: stretch;
    box-sizing: border-box;
}

    .activity-grid button {
        width: 100%;
        height: 100%;
        box-sizing: border-box;
    }

/* Custom styling for activity button wrappers */
.activity-button-wrapper {
    position: relative; /* CRITICAL for absolute positioning of tooltiptext */
    display: flex; /* For centering the button inside */
    align-items: center;
    justify-content: center;
    height: 100%; /* Take full height of grid cell */
    width: 100%; /* Take full width of grid cell */
}

    .activity-button-wrapper button {
        flex-grow: 1; /* Allow button to grow inside wrapper */
    }

    /* Styling for the locked activity button wrappers (visible) */
    .activity-button-wrapper.locked {
        opacity: 1; /* Wrapper is fully opaque */
        cursor: not-allowed; /* Change cursor on hover over the wrapper */
    }

        /* Style the actual button *inside* the locked wrapper to look disabled */
        .activity-button-wrapper.locked button {
            pointer-events: none; /* Make inner button unclickable */
            opacity: 0.5; /* Apply visual dimming directly to the button */
            transform: none; /* Override any hover transforms */
            box-shadow: none; /* Override any hover box-shadows */
            background: var(--button-bg); /* Ensure background doesn't change on hover */
        }

    /* =========================================================
   Activity Grid Tooltip
   ========================================================= */
    .activity-button-wrapper .tooltiptext { /* Target span inside wrapper */
        visibility: hidden;
        width: 200px;
        background-color: #333;
        color: #fff;
        text-align: center;
        border-radius: 6px;
        padding: 10px;
        position: absolute;
        z-index: 1000; /* Ensure it's on top */
        bottom: 125%; /* Position above the button */
        left: 50%;
        transform: translateX(-50%); /* Center horizontally */
        opacity: 0;
        transition: opacity 0.3s;
        font-size: 14px;
        white-space: normal; /* Allow text to wrap */
        pointer-events: none; /* Tooltip itself shouldn't capture clicks */
    }

        .activity-button-wrapper .tooltiptext::after {
            content: "";
            position: absolute;
            top: 100%;
            left: 50%;
            transform: translateX(-50%); /* Center arrow horizontally */
            border: 6px solid transparent;
            border-top-color: #333;
        }

    /* Show tooltip on hover over the *locked wrapper* */
    .activity-button-wrapper.locked:hover .tooltiptext {
        visibility: visible;
        opacity: 1;
    }

/* =========================================================
   Upgrade Message
   ========================================================= */
#upgrade-message {
    width: 100%; /* Ensure it spans the full width of its parent */
    text-align: center; /* Center the text */
    margin-top: 20px; /* Add some space above it */
    font-size: 1.1em;
    color: var(--accent-color); /* Make it stand out */
    font-weight: bold;
    padding: 10px; /* Some padding for visual comfort */
    background-color: var(--container-bg); /* Give it a background for visibility */
    border-radius: 8px; /* Soften the edges */
    box-shadow: 0 2px 5px rgba(0,0,0,0.1); /* Subtle shadow */
    box-sizing: border-box; /* Include padding in width calculation */
}


/* =========================================================
   Responsive Adjustments
   ========================================================= */
@media (max-width: 768px) {
    .text-area-panel {
        display: flex;
        justify-content: center;
        flex-direction: column;
        align-items: center;
        height: auto;
        width: 95%;
        margin: auto auto;
        overflow: visible;
    }

    body {
        overflow-y: auto;
    }

    .left-column,
    .right-column {
        width: 95%;
        margin-bottom: 1rem;
    }

    textarea {
        width: 100%;
        box-sizing: border-box;
    }
}


@media (max-width: 768px) {

    #main-header {
        flex-wrap: wrap;
        justify-content: center;
    }

    .header-right {
        margin-top: 10px;
        width: 100%;
        justify-content: center;
    }

    .main-nav {
        width: 100%;
        justify-content: center;
        margin-bottom: 10px;
    }

    #header-auth-status {
        width: 100%;
        justify-content: center;
    }

    #main-header .main-nav .main-btn,
    #main-header #header-auth-status .main-btn,
    #settings-button {
        width: auto; /* Allow buttons to size based on content on smaller screens */
        min-width: unset; /* Remove min-width constraint */
    }
}


/* =========================================================
   Page Specific Styles (Jumble / Timer activities)
   ========================================================= */
.jumble-wrapper {
    display: inline-block;
    width: fit-content;
    min-width: 30vw;
    max-width: 90vw;
    box-sizing: border-box;
    margin: 0 auto;
    padding: 0;
}

    .jumble-wrapper #randomised-container p,
    .jumble-wrapper .sentence-row {
        width: 100%;
        box-sizing: border-box;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        min-width: 0;
    }

    .jumble-wrapper .sentence-text {
        flex: 1 1 auto;
        min-width: 0;
        overflow-wrap: break-word;
        word-break: break-word;
        box-sizing: border-box;
    }

    .jumble-wrapper .reveal-btn {
        flex: 0 0 auto;
        min-width: 48px;
        max-width: 120px;
        box-sizing: border-box;
    }

    .jumble-wrapper .text-buttons {
        display: flex;
        width: 100%;
        box-sizing: border-box;
        gap: 8px;
        justify-content: space-between;
    }

        .jumble-wrapper .text-buttons > * {
            flex: 1 1 0;
            max-width: 100%;
            min-width: 0;
            box-sizing: border-box;
        }

/* ===== RANDOMISED CONTAINER ===== */
#randomised-container {
    width: 100%;
}

    #randomised-container p {
        display: flex;
        align-items: center;
        justify-content: center;
        margin: 5px 0;
        padding: 8px 12px;
        background: var(--container-bg);
        border-radius: 10px;
        box-shadow: 0 2px 5px rgba(0,0,0,0.1);
        text-align: left;
    }

.page-container {
    padding: 0 0 300px 0;
}

    .page-container .text-buttons {
        display: flex;
        gap: 8px;
        width: 100%;
        margin-top: 12px;
        justify-content: stretch;
        align-items: stretch;
        box-sizing: border-box;
    }

    .page-container .select-btn-group {
        display: flex;
        flex: 1;
        gap: 8px;
        width: 100%;
        box-sizing: border-box;
    }

        .page-container .select-btn-group > * {
            flex: 1 1 0;
            min-width: 0;
        }

/* ===== TIMER & SENTENCE CONTAINERS ===== */
#timer-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    margin: 2rem auto;
    max-width: 600px;
    padding: 1rem;
    text-align: center;
    border-radius: 10px;
}

#sentence-container {
    position: relative;
    width: 100%;
    height: 40vh;
    margin: 0 auto;
    overflow: hidden;
    background: var(--container-bg);
    border: 2px solid var(--textarea-border);
    border-radius: 10px;
}

#moving-container {
    position: relative;
    width: 100%;
    height: 40vh;
    margin: 0 auto;
    overflow: hidden;
    background: var(--container-bg);
    border: 2px solid var(--textarea-border);
    border-radius: 10px;
}

#timer {
    position: relative;
    display: inline-block;
    width: auto;
    height: auto;
    background: none;
    color: inherit;
    font-size: 18px;
    margin-bottom: 10px;
}

#countdown {
    font-size: 1rem;
    font-weight: bold;
    color: var(--accent-color, #007acc);
    margin-bottom: 1rem;
}

#display {
    font-size: 28px;
    min-height: 44px;
    margin-bottom: 8px;
}

/* ===== SENTENCES & TEXT ===== */
.sentence-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding: 10px 12px;
    gap: 12px;
}

.sentence-text {
    flex: 1 1 auto;
    word-break: break-word;
    line-height: 1.5;
}

.sentence-line span {
    font-family: "Courier New", monospace;
    letter-spacing: 0.05em;
}

.full-sentence {
    font-size: 2rem;
    text-align: center;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    color: var(--text-color);
    line-height: 1.2;
    margin: 0;
    padding: 0;
}

.sentence-label {
    text-align: center;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--text-color);
    opacity: 0.8;
    line-height: 1.2;
    margin: 0;
    padding: 0;
}


/* ===== MOVING WORDS ===== */
.pair {
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translate(-50%, 0);
    display: inline-flex;
    gap: 0.6rem;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    white-space: nowrap;
    pointer-events: none;
    will-change: transform, opacity;
    opacity: 0;
}

.moving-word {
    display: inline-block;
    padding: 0 0.12rem;
}

#progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 4px;
    width: 100%;
    background: var(--accent-color);
    transform-origin: left center;
    transform: scaleX(0);
    transition: transform 0.3s linear;
    border-radius: 2px;
}

/* Info popup icon */
.info-wrapper {
    position: relative;
    display: inline;
    margin-left: 5px;
}

.info-icon {
    display: inline-block;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: var(--button-bg);
    color: white;
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
    cursor: help;
    transition: background 0.3s;
    font-family: Arial, sans-serif;
    flex-shrink: 0;
    vertical-align: middle;
}

    .info-icon:hover {
        background: var(--button-hover-bg);
    }

.info-popup {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 8px;
    padding: 12px 16px;
    background: var(--textarea-bg);
    color: var(--textarea-text);
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.4;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    pointer-events: none;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    font-family: Arial, sans-serif; /* Normal font for popup text */
}

    .info-popup::after {
        content: '';
        position: absolute;
        top: 100%;
        left: 50%;
        transform: translateX(-50%);
        border: 6px solid transparent;
        border-top-color: #333;
    }

.info-wrapper:hover .info-popup {
    opacity: 1;
    visibility: visible;
}


/* =========================================================
   Auth Modal & Forms
   ========================================================= */
.auth-modal {
    position: fixed;
    inset: 0;
    /*    display: flex;*/
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.7);
    z-index: 2001;
    padding: 20px;
    max-height: 100vh;
}

    .auth-modal:not(.hidden) {
        display: flex;
    }

.auth-card {
    background: var(--container-bg, #fff);
    color: var(--text-color, #222);
    width: 100%;
    max-width: 500px;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    position: relative;
    box-sizing: border-box;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

.modal-close-button {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: #333;
    padding: 6px;
    z-index: 10;
    color: #555;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

    .auth-form h2 {
        text-align: center;
        margin: 0 0 0.5rem 0;
        font-size: 1.25rem;
    }

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

    .input-group label {
        font-size: 0.9rem;
        font-weight: 500;
        color: inherit;
    }

    .input-group input {
        padding: 12px;
        border: 1px solid var(--textarea-border, #ddd);
        border-radius: 8px;
        background: var(--textarea-bg, #fff);
        color: var(--textarea-text, #111);
        font-size: 1rem;
        transition: border-color .15s ease;
    }

        .input-group input:focus {
            outline: none;
            border-color: var(--accent-color, #3b82f6);
        }

/* buttons */
.auth-btn,
.google-btn {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    margin-top: 0.5rem;
    border-radius: 8px;
    cursor: pointer;
}

.google-btn {
    background: #fff;
    color: #444;
    border: 1px solid #ddd;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* divider */
.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 1rem 0;
    color: inherit;
    opacity: 0.6;
}

    .divider::before,
    .divider::after {
        content: '';
        flex: 1;
        border-bottom: 1px solid var(--textarea-border, #e6e6e6);
    }

    .divider span {
        padding: 0 1rem;
        font-size: 0.9rem;
    }

/* error */
.error-message {
    color: #dc2626;
    font-size: 0.9rem;
    text-align: center;
    margin-top: 0.5rem;
    min-height: 1.2rem;
}

/* dark-mode tweaks if you use them */
body.dark-mode .google-btn {
    background: #333;
    color: #fff;
    border-color: #555;
}

/* small-screen adjustments */
@media (max-width:420px) {
    .auth-card {
        padding: 18px;
        border-radius: 10px;
        max-width: 420px;
    }

    .modal-close-button {
        top: 8px;
        right: 8px;
    }
}
