:root {
    --primary-color: #BC002D;
    /* Japan Red */
    --secondary-color: #2C3E50;
    --accent-color: #FFB7C5;
    /* Sakura Pink */
    --bg-color: #FAFAFA;
    --card-bg: #FFFFFF;
    --text-color: #333333;
    --text-light: #666666;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --font-main: 'Inter', sans-serif;
    --font-jp: 'Noto Sans JP', sans-serif;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(255, 255, 255, 0.2);
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden;
}

h1,
h2 {
    font-family: var(--font-jp);
    font-weight: 800;
    line-height: 1.2;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

h3,
h4,
h5,
h6 {
    font-family: var(--font-jp);
    font-weight: 700;
    line-height: 1.2;
    color: var(--secondary-color);
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

/* Utilities */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.btn {
    display: inline-block;
    padding: 1rem 2.5rem;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    font-size: 1.1rem;
    text-align: center;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 15px rgba(188, 0, 45, 0.3);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(188, 0, 45, 0.4);
    background-color: #a00026;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--secondary-color);
    color: var(--secondary-color);
}

.btn-outline:hover {
    background: var(--secondary-color);
    color: white;
}

/* Header */
header.main-header {
    padding: 0.8rem 0;
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--primary-color);
    font-family: var(--font-jp);
    letter-spacing: -0.5px;
    transition: var(--transition);
}

.logo:hover {
    opacity: 0.8;
}

.nav-links {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-link {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--secondary-color);
    transition: var(--transition);
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: var(--transition);
}

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

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

.header-btn {
    background-color: var(--primary-color);
    color: white !important;
    padding: 0.6rem 1.5rem;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 700;
    transition: var(--transition);
    box-shadow: 0 4px 10px rgba(188, 0, 45, 0.2);
    text-decoration: none;
    display: inline-block;
}

.header-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(188, 0, 45, 0.3);
    background-color: #a00026;
}

.back-btn {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.back-btn:hover {
    transform: translateX(-5px);
}

.fixed-header-offset {
    padding-top: 80px !important;
}

/* Hero Section */
.hero {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: linear-gradient(135deg, #fff5f7 0%, #ffffff 100%);
    position: relative;
    overflow: hidden;
    padding-top: 80px;
}

.hero::before {
    content: '';
    position: absolute;
    top: -10%;
    right: -10%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--accent-color) 0%, transparent 70%);
    opacity: 0.2;
    border-radius: 50%;
    z-index: 0;
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
}

.hero h1 {
    font-size: 4.5rem;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
}

.hero p {
    font-size: 1.25rem;
    color: var(--text-light);
    margin-bottom: 3rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Info Section */
.info-section {
    padding: 6rem 0;
    background: white;
}

.section-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 3rem;
}

.info-card {
    padding: 2rem;
    border-radius: 20px;
    background: var(--bg-color);
    transition: var(--transition);
    border: 1px solid rgba(0, 0, 0, 0.03);
}

.info-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-lg);
    background: white;
}

.info-card h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--secondary-color);
}

.info-card p {
    color: var(--text-light);
}

/* Dashboard / Learn Page */
.dashboard-header {
    padding: 8rem 0 4rem;
    text-align: center;
}

.dashboard-header h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.learning-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    padding-bottom: 4rem;
}

.learn-box {
    background: white;
    border-radius: 24px;
    padding: 2.5rem;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}

.learn-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 6px;
    background: var(--primary-color);
    transform: scaleX(0);
    transform-origin: left;
    transition: var(--transition);
}

.learn-box:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.learn-box.no-hover:hover {
    transform: none;
    box-shadow: var(--shadow-sm);
}

.learn-box:hover::before {
    transform: scaleX(1);
}

.learn-box h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.learn-box p {
    color: var(--text-light);
    font-size: 0.9rem;
}

.icon-placeholder {
    font-size: 3rem;
    margin-bottom: 1.5rem;
    display: block;
}

/* Auth Pages */
.form-input {
    width: 100%;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: var(--font-main);
    font-size: 1rem;
    transition: var(--transition);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(188, 0, 45, 0.1);
}

.social-btn {
    width: 100%;
    padding: 0.8rem;
    margin-bottom: 1rem;
    border: 1px solid #eee;
    background: white;
    border-radius: 8px;
    font-weight: 600;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: var(--transition);
    color: #333;
}

.social-btn:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.social-btn.facebook {
    background: #1877F2;
    color: white;
    border-color: #1877F2;
}

.social-btn.facebook:hover {
    background: #166fe5;
}

.social-btn.apple {
    background: #000;
    color: white;
    border-color: #000;
}

.social-btn.apple:hover {
    background: #333;
}

/* Pricing Cards */
.pricing-card {
    background: white;
    padding: 2.5rem;
    border-radius: 24px;
    text-align: center;
    border: 2px solid transparent;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.pricing-card.featured {
    border-color: var(--primary-color);
    box-shadow: 0 10px 30px rgba(188, 0, 45, 0.1);
    transform: scale(1.05);
    z-index: 2;
}

.pricing-card:hover {
    transform: translateY(-5px);
}

.pricing-card.featured:hover {
    transform: scale(1.05) translateY(-5px);
}

.price-tag {
    font-size: 3rem;
    font-weight: 800;
    color: var(--secondary-color);
    margin: 1.5rem 0;
}

.price-tag span {
    font-size: 1rem;
    color: var(--text-light);
    font-weight: 400;
}

/* Alphabet Section */
.alphabet-section {
    padding: 4rem 0;
    background: white;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.alphabet-container {
    display: none;
    /* Hidden by default, toggled via JS */
    opacity: 0;
    transition: opacity 0.5s ease;
}

.alphabet-container.active {
    display: block;
    opacity: 1;
}

.kana-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 1rem;
    margin-top: 2rem;
}

.kana-card {
    background: var(--bg-color);
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    min-height: 90px;
}

.kana-card:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.1);
}

.kana-char {
    font-size: 2.2rem;
    font-weight: 700;
    font-family: var(--font-jp);
    display: flex;
    justify-content: center;
    align-items: baseline;
    margin-bottom: 0.25rem;
    white-space: nowrap;
}

.kana-romaji {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.7;
}

/* Flashcard Styles */
.flashcard-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    margin-top: 2rem;
}

.flashcard {
    width: 300px;
    height: 400px;
    perspective: 1000px;
    cursor: pointer;
}

.flashcard-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s;
    transform-style: preserve-3d;
    box-shadow: var(--shadow-lg);
    border-radius: 20px;
}

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

.flashcard-front,
.flashcard-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-radius: 20px;
    background: white;
    border: 2px solid var(--primary-color);
}

.flashcard-back {
    background: var(--primary-color);
    color: white;
    transform: rotateY(180deg);
}

.flashcard-controls {
    display: flex;
    gap: 1rem;
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: white;
    width: 90%;
    max-width: 1000px;
    max-height: 85vh;
    border-radius: 30px;
    position: relative;
    padding: 3rem 1rem;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: scale(0.9);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.close-modal {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    font-size: 2rem;
    background: #f1f5f9;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    color: var(--text-light);
    z-index: 10;
}

.close-modal:hover {
    background: var(--primary-color);
    color: white;
    transform: rotate(90deg);
}

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

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

.animate-fade-in {
    animation: fadeIn 0.8s ease forwards;
}

/* Custom Scrollbar */
.modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    header.main-header .container nav {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-links {
        gap: 1rem;
        flex-wrap: wrap;
        justify-content: center;
    }

    .hero h1 {
        font-size: 2.8rem;
    }

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

    .container {
        padding: 0 1.2rem;
    }

    /* Adjust fixed header offset for taller mobile header */
    .fixed-header-offset {
        padding-top: 140px !important;
    }
}