/* Modern CSS Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #ee2b3b;
    --primary-hover: #d81b24;
    --secondary-color: #f8f9fa;
    --secondary-hover: #e9ecef;
    --tertiary-color: #b3ee2b;
    --accent-color: #f093fb;
    --warning-color: #ff6b6b;
    --success-color: #51cf66;
    --text-dark: #2c3e50;
    --text-light: #6c757d;
    --bg-light: #fcf8f8;
    --bg-white: #ffffff;
    --sakura-pink: #FEEAFA;
    --muted-indigo: #5C6784;
    --pale-red: #F2B4B4;
    --border-color: #e9ecef;
    --shadow-light: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 4px 20px rgba(0, 0, 0, 0.15);
    --border-radius: 15px;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.2s ease;
}

body {
    font-family: 'Lexend', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-light);
    min-height: 100vh;
    color: var(--text-dark);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Navigation Styles */
.navbar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-light);
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    transition: var(--transition);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.nav-logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    text-decoration: none;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 30px;
}

.nav-link {
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 25px;
    transition: var(--transition);
    position: relative;
}

.nav-link:hover,
.nav-link.active {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    transform: translateY(-2px);
}

.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
    gap: 4px;
}

.hamburger span {
    width: 25px;
    height: 3px;
    background: var(--text-dark);
    transition: var(--transition);
    border-radius: 2px;
}

/* Page System */
.page {
    display: none;
    min-height: 100vh;
    padding-top: 90px;
    padding-bottom: 40px;
    animation: fadeIn 0.5s ease-in-out;
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Home Page Styles */
.hero-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
    min-height: calc(100vh - 130px);
}

.hero-content {
    animation: slideInLeft 0.8s ease-out;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.hero-title {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 20px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-description {
    font-size: 1.2rem;
    color: var(--text-light);
    margin-bottom: 40px;
    line-height: 1.8;
}

.hero-buttons {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.hero-image {
    display: flex;
    justify-content: center;
    align-items: center;
    animation: slideInRight 0.8s ease-out;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.floating-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    padding: 40px;
    box-shadow: var(--shadow-medium);
    animation: float 3s ease-in-out infinite;
    text-align: center;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }
}

.japanese-char {
    font-size: 4rem;
    color: var(--primary-color);
    display: block;
    margin-bottom: 10px;
}

.word-text {
    font-size: 1.5rem;
    color: var(--text-dark);
    font-weight: 500;
}

/* Button Styles */
.btn {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: inline-block;
    text-align: center;
    box-shadow: var(--shadow-light);
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-medium);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--accent-color), #f5576c);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #f5576c, var(--accent-color));
}

/* Page Titles */
.page-title {
    font-size: 2.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 15px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-description {
    font-size: 1.1rem;
    color: var(--text-light);
    text-align: center;
    margin-bottom: 40px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Dictation Practice Styles */
.word-display {
    background: var(--bg-white);
    border-radius: var(--border-radius);
    padding: 40px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-light);
    text-align: center;
    min-height: 250px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.word {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 30px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease-in-out;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.word.show {
    opacity: 1;
    transform: translateY(0);
}

.timer {
    font-size: 3rem;
    font-weight: bold;
    color: var(--warning-color);
    background: #fff5f5;
    border-radius: 50%;
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid var(--warning-color);
    transition: var(--transition);
}

.timer.warning {
    color: var(--warning-color);
    border-color: var(--warning-color);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

.controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.hiragana-list {
    background: var(--bg-white);
    border-radius: var(--border-radius);
    padding: 30px;
    box-shadow: var(--shadow-light);
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hiragana-list h3 {
    text-align: center;
    color: var(--text-dark);
    margin-bottom: 25px;
    font-size: 1.5rem;
    font-weight: 600;
}

.word-pair {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #e9ecef;
    font-size: 1.1rem;
    transition: var(--transition);
}

.word-pair:hover {
    background: var(--bg-light);
    margin: 0 -20px;
    padding: 15px 20px;
    border-radius: 8px;
}

.word-pair:last-child {
    border-bottom: none;
}

.english-word {
    font-weight: 600;
    color: var(--text-dark);
}

.sinhala-word {
    color: var(--text-light);
    font-size: 1rem;
}

.japanese-word {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 1.2rem;
}

/* Word List Page Styles */
.word-grid {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.word-card {
    background: var(--bg-white);
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: var(--shadow-light);
    transition: var(--transition);
    border-left: 4px solid var(--primary-color);
}

.word-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-medium);
}

.card-word {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 10px;
}

.card-sinhala {
    font-size: 1.1rem;
    color: var(--text-light);
    margin-bottom: 10px;
}

.card-japanese {
    font-size: 1.4rem;
    color: var(--primary-color);
    font-weight: 700;
}

/* --- New Animations & Effects --- */

/* Button Shine Effect */
.btn-shine {
    position: relative;
    overflow: hidden;
}

.btn-shine::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.3),
            transparent);
    transition: 0.5s;
    pointer-events: none;
    /* Let clicks pass through */
}

.btn-shine:hover::after {
    left: 100%;
    transition: 0.7s ease-in-out;
}

/* Card Lift & Glow Effect */
.card-hover-effect {
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.card-hover-effect:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 15px 30px rgba(238, 43, 59, 0.15);
    /* Reddish glow matching primary */
}

/* Green Card Lift & Glow Effect for Vocabulary */
.card-hover-effect-green {
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.card-hover-effect-green:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 15px 30px rgba(81, 207, 102, 0.25);
    /* Green glow from success color */
}


/* Nav Link Underline Animation */
.nav-link-animated {
    position: relative;
    display: inline-block;
}

.nav-link-animated::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -2px;
    left: 50%;
    background-color: var(--primary-color);
    transition: all 0.3s ease-out;
    transform: translateX(-50%);
}

.nav-link-animated:hover {
    color: var(--primary-color);
}

.nav-link-animated:hover::after {
    width: 80%;
}

/* Animated Gradient Text */
.text-gradient-animated {
    background-size: 200% auto;
    animation: gradientMove 4s linear infinite;
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
}

@keyframes gradientMove {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* Subtle Floating Animation for Images/Decor */
.animate-float-slow {
    animation: float 6s ease-in-out infinite;
}

/* Staggered Animations */
.animate-fade-up {
    animation: fadeUp 0.8s ease-out forwards;
    opacity: 0;
    transform: translateY(20px);
}

@keyframes fadeUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.delay-100 {
    animation-delay: 0.1s;
}

.delay-200 {
    animation-delay: 0.2s;
}

.delay-300 {
    animation-delay: 0.3s;
}

/* --- Splash Screen Styles (Shoji Doors) --- */
#splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    /* Allows clicks to pass through after animation */
}

.splash-door {
    position: absolute;
    top: 0;
    width: 50%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color), #ff6b6b);
    transition: transform 1.2s cubic-bezier(0.77, 0, 0.175, 1);
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.splash-door::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    right: -50%;
    bottom: -50%;
    background-image: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.1) 10%, transparent 10.1%);
    background-size: 40px 40px;
    opacity: 0.3;
    animation: patternMove 30s linear infinite;
    transform: rotate(15deg);
}

@keyframes patternMove {
    0% {
        background-position: 0 0;
    }

    100% {
        background-position: 100px 100px;
    }
}

.door-left {
    left: 0;
    transform-origin: left;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
}

.door-right {
    right: 0;
    transform-origin: right;
    border-left: 1px solid rgba(255, 255, 255, 0.2);
}

.splash-content {
    position: relative;
    z-index: 20;
    color: white;
    text-align: center;
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.splash-logo-container {
    background: white;
    padding: 20px;
    border-radius: 50%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    margin-bottom: 20px;
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    margin-right: auto;
    animation: pulse 2s infinite;
}

.splash-logo {
    width: 80px;
    height: 80px;
}

/* Floating Characters Decoration */
.floating-char {
    position: absolute;
    color: rgba(255, 255, 255, 0.3);
    font-weight: 900;
    user-select: none;
    text-shadow: 0 0 25px rgba(255, 255, 255, 0.6);
    animation: float-char 6s infinite ease-in-out;
}

@keyframes float-char {
    0% {
        transform: translate(0, 0) rotate(-10deg) scale(0.9);
    }

    50% {
        transform: translate(20px, -30px) rotate(10deg) scale(1.1);
    }

    100% {
        transform: translate(0, 0) rotate(-10deg) scale(0.9);
    }
}

/* Triggered State */
.splash-content.fade-out {
    opacity: 0;
    transform: scale(0.8);
}

.door-left.open {
    transform: translateX(-102%);
    /* Move slightly more to ensure no gap line */
}

.door-right.open {
    transform: translateX(102%);
}

#splash-screen.complete {
    display: none;
}

/* Mobile Responsive Design */
@media (max-width: 768px) {
    .hamburger {
        display: flex;
    }

    .nav-menu {
        position: fixed;
        left: -100%;
        top: 70px;
        flex-direction: column;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        width: 100%;
        text-align: center;
        transition: var(--transition);
        box-shadow: var(--shadow-light);
        padding: 20px 0;
        gap: 10px;
    }

    .nav-menu.active {
        left: 0;
    }

    .hero-container {
        grid-template-columns: 1fr;
        gap: 40px;
        text-align: center;
    }

    .hero-title {
        font-size: 2.2rem;
    }

    .hero-buttons {
        justify-content: center;
    }

    .page-title {
        font-size: 2rem;
    }

    .word {
        font-size: 2rem;
    }

    .timer {
        font-size: 2.5rem;
        width: 90px;
        height: 90px;
    }

    .controls {
        flex-direction: column;
        align-items: center;
    }

    .word-pair {
        flex-direction: column;
        text-align: center;
        gap: 8px;
    }

    .word-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 1.8rem;
    }

    .hero-description {
        font-size: 1rem;
    }

    .word {
        font-size: 1.8rem;
    }

    .timer {
        font-size: 2rem;
        width: 80px;
        height: 80px;
    }

    .btn {
        font-size: 1rem;
        padding: 12px 24px;
    }

    .japanese-char {
        font-size: 3rem;
    }

    .word-text {
        font-size: 1.2rem;
    }
}