@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;700;900&family=Inter:wght@300;400;500;600&display=swap');

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

body {
    font-family: 'Inter', sans-serif;
    background-color: #00AFCA;
    color: #1a1a2e;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* Subtle ornamental background pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(255, 215, 0, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 50%, rgba(255, 215, 0, 0.08) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* Gold ornamental border along left side */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 8px;
    height: 100%;
    background: linear-gradient(
        to bottom,
        #FFD700 0%, #DAA520 10%, #FFD700 20%, #DAA520 30%,
        #FFD700 40%, #DAA520 50%, #FFD700 60%, #DAA520 70%,
        #FFD700 80%, #DAA520 90%, #FFD700 100%
    );
    z-index: 100;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 60px 40px;
    position: relative;
    z-index: 1;
}

/* ---- Header ---- */
header {
    text-align: center;
    margin-bottom: 50px;
}

header h1 {
    font-family: 'Cinzel', serif;
    font-size: 3rem;
    font-weight: 900;
    color: #FFD700;
    text-shadow: 2px 2px 6px rgba(0, 0, 0, 0.3);
    letter-spacing: 2px;
    margin-bottom: 12px;
}

header p {
    font-size: 1.15rem;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.85);
    letter-spacing: 0.5px;
}

/* ---- Gold divider ---- */
.divider {
    width: 120px;
    height: 3px;
    background: linear-gradient(90deg, transparent, #FFD700, transparent);
    margin: 30px auto;
    border-radius: 2px;
}

/* ---- Flag ---- */
.flag-container {
    text-align: center;
    margin: 40px 0;
}

.flag-container img {
    width: 380px;
    max-width: 80%;
    border-radius: 6px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
    border: 3px solid rgba(255, 215, 0, 0.4);
}

/* ---- Navigation buttons ---- */
.nav-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 50px;
    flex-wrap: wrap;
}

.btn {
    display: inline-block;
    padding: 16px 48px;
    font-family: 'Cinzel', serif;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-decoration: none;
    text-transform: uppercase;
    color: #1a1a2e;
    background: linear-gradient(135deg, #FFD700, #F0C800, #DAA520);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s ease;
}

.btn:hover::before {
    left: 100%;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(255, 215, 0, 0.45);
    background: linear-gradient(135deg, #FFE44D, #FFD700, #F0C800);
}

.btn:active {
    transform: translateY(-1px);
}

/* ---- Alphabet page ---- */
.alphabet-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 14px;
    margin-top: 40px;
}

.letter-card {
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(4px);
    border: 2px solid rgba(255, 215, 0, 0.45);
    border-radius: 10px;
    padding: 18px 10px;
    text-align: center;
    transition: all 0.25s ease;
    cursor: pointer;
    user-select: none;
    outline: none;
    font-family: inherit;
    width: 100%;
}

.letter-card:hover {
    background: rgba(255, 215, 0, 0.18);
    border-color: #FFD700;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.2);
}

.letter-card:active {
    transform: translateY(0);
    background: rgba(255, 215, 0, 0.3);
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.15);
}

.letter-card.playing {
    background: rgba(255, 215, 0, 0.35);
    border-color: #FFD700;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.4);
}

.letter-card .big {
    font-size: 2rem;
    font-weight: 700;
    color: #FFD700;
    display: block;
    line-height: 1.2;
}

.letter-card .small {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.7);
    display: block;
    margin-top: 4px;
}

/* ---- Back link ---- */
.back-link {
    display: inline-block;
    margin-bottom: 30px;
    color: #FFD700;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    letter-spacing: 0.5px;
    transition: opacity 0.2s;
}

.back-link:hover {
    opacity: 0.75;
}

/* ---- Section title ---- */
.section-title {
    font-family: 'Cinzel', serif;
    font-size: 2rem;
    color: #FFD700;
    text-align: center;
    margin-bottom: 10px;
}

.section-subtitle {
    text-align: center;
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.95rem;
    margin-bottom: 10px;
}

/* ---- Footer ---- */
footer {
    text-align: center;
    margin-top: 60px;
    padding: 20px;
    color: rgba(255, 255, 255, 0.45);
    font-size: 0.85rem;
}

/* ---- Responsive ---- */
@media (max-width: 600px) {
    .container {
        padding: 40px 20px;
    }
    header h1 {
        font-size: 2rem;
    }
    .alphabet-grid {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
        gap: 10px;
    }
    .letter-card .big {
        font-size: 1.6rem;
    }
}

/* ---- English pronunciation hint under each letter ---- */
.letter-card .rom {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.85);
    display: block;
    margin-top: 2px;
}

/* ---- Bottom page navigation (Home / next) ---- */
.page-nav {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 40px;
}

.page-nav .btn {
    width: 160px;
    padding-left: 0;
    padding-right: 0;
    text-align: center;
}

.btn-disabled {
    opacity: 0.45;
    pointer-events: none;
}

/* ---- Lesson pages ---- */
.lesson-section {
    margin-top: 36px;
}

.lesson-section h2 {
    font-family: 'Cinzel', serif;
    font-size: 1.3rem;
    color: #FFD700;
    margin-bottom: 12px;
}

.lesson-note,
.lesson-text {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 12px;
}

.lesson-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    overflow: hidden;
}

.lesson-table th {
    text-align: left;
    padding: 10px 14px;
    font-size: 0.8rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #1a1a2e;
    background: #FFD700;
}

.lesson-table td {
    padding: 10px 14px;
    color: rgba(255, 255, 255, 0.9);
    border-top: 1px solid rgba(255, 215, 0, 0.25);
}

.lesson-table td.c0 {
    color: #FFD700;
    font-weight: 600;
}

/* ---- Speaker button in lesson tables ---- */
.speak {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    margin-right: 10px;
    vertical-align: middle;
    color: #FFD700;
    background: rgba(255, 215, 0, 0.12);
    border: 1px solid rgba(255, 215, 0, 0.5);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

.speak:hover {
    background: rgba(255, 215, 0, 0.28);
}

.speak.playing {
    background: rgba(255, 215, 0, 0.45);
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.5);
}

/* ---- Phones ---- */
@media (max-width: 480px) {
    header h1 { font-size: 2rem; }
    .section-title { font-size: 1.5rem; }
    .container { padding: 28px 16px; }
    .alphabet-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
    .nav-buttons .btn { width: 100%; text-align: center; }
    .page-nav { gap: 12px; }
    .page-nav .btn { width: 46%; padding: 14px 0; font-size: 1rem; }
    .lesson-table th, .lesson-table td { padding: 9px 8px; font-size: 0.9rem; }
    .speak { width: 36px; height: 36px; margin-right: 8px; }
}

/* ---- Mobile Chrome fixes ---- */
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

.lesson-section {
    overflow-x: auto;
}

.lesson-table td,
.lesson-table th {
    overflow-wrap: anywhere;
}

.back-link {
    padding: 12px 0;
}
