:root {
    --tg-theme-bg-color: #0f172a;
    --tg-theme-secondary-bg-color: #1e293b;
    --tg-theme-text-color: #f8fafc;
    --tg-theme-hint-color: #94a3b8;
    --tg-theme-link-color: #38bdf8;
    --tg-theme-button-color: #3b82f6;
    --tg-theme-button-text-color: #ffffff;
    --tg-border-color: rgba(255, 255, 255, 0.08);
}

/* Telegram theme variable mapping */
body {
    background-color: var(--tg-theme-bg-color, #0f172a);
    color: var(--tg-theme-text-color, #f8fafc);
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

.bg-tg-bg {
    background-color: var(--tg-theme-bg-color, #0f172a);
}

.bg-tg-secondary {
    background-color: var(--tg-theme-secondary-bg-color, #1e293b);
}

.text-tg-text {
    color: var(--tg-theme-text-color, #f8fafc);
}

.text-tg-hint {
    color: var(--tg-theme-hint-color, #94a3b8);
}

.text-tg-link {
    color: var(--tg-theme-link-color, #38bdf8);
}

.bg-tg-button {
    background-color: var(--tg-theme-button-color, #3b82f6);
}

.text-tg-button-text {
    color: var(--tg-theme-button-text-color, #ffffff);
}

.border-tg-border {
    border-color: var(--tg-border-color, rgba(255, 255, 255, 0.08));
}

.font-korean {
    font-family: 'Noto Sans KR', sans-serif;
}

/* 3D Flip Flashcard */
.perspective-1000 {
    perspective: 1000px;
}

.transform-style-3d {
    transform-style: preserve-3d;
}

.backface-hidden {
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.rotate-y-180 {
    transform: rotateY(180deg);
}

.flashcard-flipped {
    transform: rotateY(180deg);
}

/* Hide scrollbar */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}
.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Active card click effect */
.interactive-card {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.interactive-card:active {
    transform: scale(0.98);
}

/* Ripple & pulse keyframes */
@keyframes pulse-subtle {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.animate-pulse-subtle {
    animation: pulse-subtle 2s infinite ease-in-out;
}

/* Animations for Memorization Exercise */
@keyframes card-shuffle {
    0% {
        opacity: 0;
        transform: translateY(16px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.animate-shuffle {
    animation: card-shuffle 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes correct-disappear {
    0% {
        opacity: 1;
        transform: scale(1);
        max-height: 120px;
        margin-bottom: 0.75rem;
    }
    50% {
        opacity: 0.3;
        transform: scale(0.92) translateX(30px);
        background-color: rgba(16, 185, 129, 0.15);
    }
    100% {
        opacity: 0;
        transform: scale(0.85) translateX(60px);
        max-height: 0;
        margin-bottom: 0;
        padding-top: 0;
        padding-bottom: 0;
        border-width: 0;
        overflow: hidden;
    }
}

.animate-disappear {
    animation: correct-disappear 0.55s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes shake-wrong {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

.animate-wrong {
    animation: shake-wrong 0.45s ease-in-out;
}

/* Glassmorphic glowing card */
.glass-card {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.glass-card:focus-within {
    border-color: rgba(59, 130, 246, 0.7);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.25);
    background: rgba(30, 41, 59, 0.95);
    transform: translateY(-1px);
}

/* Stepper styling */
.stepper-step {
    transition: all 0.3s ease;
}
.stepper-step.active {
    background: #3b82f6;
    color: #ffffff;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}
.stepper-step.completed {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
    border-color: rgba(16, 185, 129, 0.4);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fadeIn {
    animation: fadeIn 0.25s ease-out forwards;
}

/* Audio Waveform Equalizer Animation */
@keyframes wave-bounce {
    0%, 100% { height: 6px; }
    50% { height: 26px; }
}

.waveform-bar {
    transition: height 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.audio-waveform.is-playing {
    opacity: 1 !important;
}

.audio-waveform.is-playing .waveform-bar:nth-child(1) { animation: wave-bounce 1.1s infinite ease-in-out; }
.audio-waveform.is-playing .waveform-bar:nth-child(2) { animation: wave-bounce 0.8s infinite ease-in-out 0.1s; }
.audio-waveform.is-playing .waveform-bar:nth-child(3) { animation: wave-bounce 1.3s infinite ease-in-out 0.25s; }
.audio-waveform.is-playing .waveform-bar:nth-child(4) { animation: wave-bounce 0.7s infinite ease-in-out 0.15s; }
.audio-waveform.is-playing .waveform-bar:nth-child(5) { animation: wave-bounce 1.0s infinite ease-in-out 0.3s; }
.audio-waveform.is-playing .waveform-bar:nth-child(6) { animation: wave-bounce 1.2s infinite ease-in-out 0.05s; }
.audio-waveform.is-playing .waveform-bar:nth-child(7) { animation: wave-bounce 0.9s infinite ease-in-out 0.2s; }
.audio-waveform.is-playing .waveform-bar:nth-child(8) { animation: wave-bounce 1.4s infinite ease-in-out 0.35s; }
.audio-waveform.is-playing .waveform-bar:nth-child(9) { animation: wave-bounce 0.75s infinite ease-in-out 0.12s; }
.audio-waveform.is-playing .waveform-bar:nth-child(10) { animation: wave-bounce 1.15s infinite ease-in-out 0.28s; }
.audio-waveform.is-playing .waveform-bar:nth-child(11) { animation: wave-bounce 0.85s infinite ease-in-out 0.18s; }
.audio-waveform.is-playing .waveform-bar:nth-child(12) { animation: wave-bounce 1.25s infinite ease-in-out 0.4s; }
.audio-waveform.is-playing .waveform-bar:nth-child(13) { animation: wave-bounce 1.0s infinite ease-in-out 0.22s; }
.audio-waveform.is-playing .waveform-bar:nth-child(14) { animation: wave-bounce 0.7s infinite ease-in-out 0.14s; }

/* Custom Sleek Range Slider */
input[type=range].audio-slider {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    cursor: pointer;
}

input[type=range].audio-slider::-webkit-slider-runnable-track {
    height: 6px;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.12);
    transition: background 0.2s ease;
}

input[type=range].audio-slider:hover::-webkit-slider-runnable-track {
    background: rgba(255, 255, 255, 0.18);
}

input[type=range].audio-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #c084fc;
    margin-top: -5px;
    box-shadow: 0 0 12px rgba(192, 132, 252, 0.75);
    border: 2px solid #ffffff;
    transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.15s ease;
}

input[type=range].audio-slider:hover::-webkit-slider-thumb {
    transform: scale(1.25);
    box-shadow: 0 0 16px rgba(192, 132, 252, 0.95);
}

input[type=range].audio-slider:disabled::-webkit-slider-thumb {
    background: #64748b;
    border-color: #475569;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

input[type=range].audio-slider:disabled::-webkit-slider-runnable-track {
    background: rgba(255, 255, 255, 0.05);
    cursor: not-allowed;
}

/* Subtle glow pulse */
.pulse-glow-purple {
    box-shadow: 0 0 25px rgba(168, 85, 247, 0.35);
}



