:root {
    /* Colors */
    --bg-dark: #0f0c29;
    --bg-gradient: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
    --accent-primary: #00d2ff;
    --accent-secondary: #92fe9d;
    --accent-purple: #8e2de2;
    --text-main: #ffffff;
    --text-dim: #b8b8b8;
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --error-red: #ff416c;
    --success-green: #00b09b;

    /* Spacing & Sizes */
    --padding-sm: 10px;
    --padding-md: 20px;
    --radius-lg: 24px;
    --radius-md: 12px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    overflow-x: hidden;
}

#app {
    width: 100%;
    max-width: 500px;
    height: 100vh;
    position: relative;
    padding: var(--padding-md);
    display: flex;
    flex-direction: column;
}



.back-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    font-size: 1.8rem;
    cursor: pointer;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Typography */
h1 {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(to right, #00d2ff, #92fe9d);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 20px;
}

h2 {
    font-size: 1.5rem;
    color: var(--text-main);
    margin-bottom: 15px;
}

/* Transitions */
.view {
    display: none;
    flex-direction: column;
    height: 100%;
    animation: fadeIn 0.4s ease-out;
}

.view.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Glassmorphism Cards */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: var(--padding-md);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

/* Buttons */
.btn {
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-primary {
    background: linear-gradient(to right, var(--accent-purple), #4a00e0);
    color: white;
    padding: 15px 30px;
    font-size: 1.1rem;
    box-shadow: 0 4px 15px rgba(142, 45, 226, 0.4);
}

.btn-secondary {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 12px 20px;
}

.btn-large {
    width: 100%;
    padding: 20px;
    font-size: 1.3rem;
}

.btn:active {
    transform: scale(0.95);
}

/* Dashboard */
.daily-progress-container {
    margin: 20px 0 40px;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: var(--text-dim);
}

.progress-bar-bg {
    background: rgba(255, 255, 255, 0.1);
    height: 12px;
    border-radius: 6px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(to right, var(--accent-primary), var(--accent-secondary));
    width: 0%;
    transition: width 1s cubic-bezier(0.445, 0.05, 0.55, 0.95);
    box-shadow: 0 0 10px var(--accent-primary);
}

.mini-global-progress {
    flex-grow: 1;
    margin: 0 20px;
}

.mini-global-progress .progress-bar-bg {
    height: 8px;
}

.dashboard-actions {
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex-grow: 1;
}

.secondary-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

/* Settings & Switches */
.settings-container {
    margin: 10px 0;
    padding: 15px;
    background: var(--glass-bg);
    border-radius: var(--radius-md);
    border: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
    color: var(--text-main);
}

.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.2);
    transition: .3s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
}

input:checked+.slider {
    background-color: var(--accent-primary);
}

input:checked+.slider:before {
    transform: translateX(20px);
}

.slider.round {
    border-radius: 24px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Practice View */
.practice-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.image-container {
    width: 200px;
    height: 200px;
    margin: 0 auto 30px;
    border-radius: var(--radius-lg);
    background: var(--glass-bg);
    border: 2px solid var(--glass-border);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

#word-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.task-area {
    text-align: center;
    margin-bottom: 30px;
}

#answer-input {
    width: 100%;
    background: var(--glass-bg);
    border: 2px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 15px;
    color: white;
    font-size: 1.5rem;
    text-align: center;
    font-family: inherit;
    margin-top: 20px;
    transition: border-color 0.3s;
}

#answer-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: rgba(255, 255, 255, 0.15);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
}

.backspace-btn {
    position: absolute;
    right: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--text-dim);
    border-radius: 8px;
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
}

.backspace-btn:hover {
    color: white;
    background: var(--error-red);
}

#answer-input {
    padding-right: 60px;
    /* Make room for the button */
}

.admin-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

/* Admin / Table */
.word-list-container {
    overflow-y: auto;
    flex-grow: 1;
    margin-top: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    color: var(--text-dim);
    padding: 10px;
    font-size: 0.8rem;
    text-transform: uppercase;
}

td {
    padding: 15px 10px;
    border-bottom: 1px solid var(--glass-border);
}

.mini-thumb {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
}

/* Modals */
#modal-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    background: var(--bg-dark);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 30px;
    width: 100%;
    max-width: 400px;
}

.modal-hidden {
    display: none !important;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-dim);
}

.form-group input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    padding: 12px;
    border-radius: 8px;
    color: white;
}

.image-preview-area {
    margin: 20px 0;
    text-align: center;
}

#image-preview {
    width: 100%;
    max-height: 200px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 10px;
}

/* Feedback Animations */
@keyframes correct-flash {
    0% {
        background-color: transparent;
    }

    50% {
        background-color: rgba(0, 176, 155, 0.4);
    }

    100% {
        background-color: transparent;
    }
}

@keyframes success-bounce {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

@keyframes star-glow {

    0%,
    100% {
        filter: drop-shadow(0 0 5px var(--accent-secondary));
    }

    50% {
        filter: drop-shadow(0 0 20px var(--accent-secondary));
    }
}

@keyframes success-jump {
    0% {
        transform: scale(1) translateY(0);
    }

    25% {
        transform: scale(1.2) translateY(-20px) rotate(5deg);
    }

    50% {
        transform: scale(1) translateY(0) rotate(-5deg);
    }

    75% {
        transform: scale(1.1) translateY(-10px) rotate(0);
    }

    100% {
        transform: scale(1) translateY(0);
    }
}



.flash-correct {
    animation: correct-flash 0.6s ease-out;
}

.success-image-anim {
    animation: success-jump 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.star-pumping {
    animation: star-glow 1s infinite;
    display: inline-block;
}

.progress-bar-fill {
    position: relative;
    overflow: hidden;
}

.progress-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: shine 2s infinite;
}

@keyframes shine {
    to {
        left: 100%;
    }
}

.feedback-hidden {
    display: none;
}

.feedback-comparison {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: var(--radius-md);
    margin: 20px 0;
    font-size: 1.2rem;
    line-height: 1.8;
}

#user-last-input {
    color: var(--error-red);
    text-decoration: line-through;
}

#correct-spelling {
    color: var(--accent-secondary);
    font-weight: 800;
}

.jumbled-letters {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.jumbled-letters span {
    background: var(--glass-bg);
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 1.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.jumbled-letters span:hover {
    background: var(--glass-border);
    transform: translateY(-3px);
}

.partial-word {
    font-size: 2rem;
    letter-spacing: 5px;
    font-weight: 800;
}

.audio-only-hint {
    font-size: 3rem;
}

.practice-footer {
    display: flex;
    gap: 15px;
    padding-bottom: 20px;
}

.practice-footer .btn-primary {
    flex-grow: 1;
}

#audio-btn {
    font-size: 1.5rem;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
}

.hidden {
    display: none !important;
}

/* Utilities */
/* Replaced by more prominent .back-btn above */

.feedback-area {
    margin-top: 20px;
    padding: 15px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
}

.stats-list {
    list-style: none;
    margin-top: 15px;
}

.stats-list li {
    padding: 10px;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
}

.version-tag {
    position: fixed;
    bottom: 5px;
    left: 10px;
    font-size: 0.7rem;
    color: var(--text-dim);
    opacity: 0.5;
    z-index: 9999;
    pointer-events: none;
    font-family: 'Outfit', sans-serif;
}

.jumbled-display-box {
    width: 100%;
    background: var(--glass-bg);
    border: 2px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 15px;
    color: white;
    font-size: 2rem;
    text-align: center;
    font-family: inherit;
    min-height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    letter-spacing: 2px;
}

.version-tag {
    position: fixed;
    bottom: 5px;
    right: 10px;
    font-size: 0.7rem;
    opacity: 0.4;
    color: var(--text-dim);
    cursor: pointer;
    z-index: 1000;
}

.version-tag:hover {
    opacity: 1;
    color: var(--accent-primary);
}