/* ========================================================
   Kamus Besar Bahasa Makassar (KBBM) - Stylesheet
   Corak Tradisional Bugis-Makassar (Crimson & Royal Gold)
   ======================================================== */

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

:root {
    --primary: #8b1e1e;
    --primary-hover: #731818;
    --primary-light: #fbeeed;
    --primary-gradient: linear-gradient(135deg, #8b1e1e 0%, #a82727 50%, #681414 100%);
    --gold: #d4af37;
    --gold-light: #fef8e7;
    --gold-hover: #b89726;
    --gold-gradient: linear-gradient(135deg, #f59e0b 0%, #d4af37 100%);
    
    --bg-page: #f8fafc;
    --bg-surface: #ffffff;
    --bg-surface-alt: #f1f5f9;
    --border: #e2e8f0;
    --border-hover: #cbd5e1;
    
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --text-primary: #8b1e1e;
    --text-gold: #b45309;

    --badge-nomina: #0284c7;
    --badge-verba: #16a34a;
    --badge-adjektiva: #ea580c;
    --badge-adverbia: #8b5cf6;
    --badge-pronomina: #db2777;
    --badge-numeralia: #0d9488;
    --badge-partikel: #4f46e5;
    --badge-alusu: #d97706;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.03);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

[data-theme="dark"] {
    --bg-page: #0b0f19;
    --bg-surface: #131b2e;
    --bg-surface-alt: #1a243d;
    --border: #24304f;
    --border-hover: #33436d;

    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --text-light: #64748b;
    --text-primary: #f87171;
    --text-gold: #fcd34d;

    --primary-light: rgba(139, 30, 30, 0.25);
    --gold-light: rgba(212, 175, 55, 0.15);

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-page);
    color: var(--text-main);
    line-height: 1.6;
    transition: background-color 0.2s ease, color 0.2s ease;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.15s ease;
}

a:hover {
    color: var(--primary-hover);
}

.lontara-font {
    font-family: 'Noto Sans Buginese', 'Aksara Lontara', 'Cinzel', serif;
    letter-spacing: 0.05em;
}

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

/* Top App Header / Navbar */
.navbar {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.navbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.brand-icon {
    width: 44px;
    height: 44px;
    background: var(--primary-gradient);
    color: #fff;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.25rem;
    box-shadow: 0 4px 10px rgba(139, 30, 30, 0.3);
    border: 2px solid var(--gold);
}

.brand-text h1 {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.brand-text h1 span.badge-kbbm {
    font-size: 0.65rem;
    background: var(--gold-gradient);
    color: #fff;
    padding: 2px 7px;
    border-radius: 12px;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.brand-text p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 20px;
    list-style: none;
}

.nav-links a {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--primary);
    background: var(--primary-light);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.theme-toggle-btn {
    background: var(--bg-surface-alt);
    border: 1px solid var(--border);
    color: var(--text-main);
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all 0.15s ease;
}

.theme-toggle-btn:hover {
    background: var(--border);
}

.mobile-menu-btn {
    display: none;
    background: var(--bg-surface-alt);
    border: 1px solid var(--border);
    color: var(--text-main);
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    transition: all 0.15s ease;
    line-height: 1;
}

.mobile-menu-btn:hover {
    background: var(--border);
    color: var(--primary);
}

.mobile-menu-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* Hero Section */
.hero {
    background: linear-gradient(180deg, var(--bg-surface) 0%, var(--bg-page) 100%);
    padding: 50px 0 40px;
    text-align: center;
    border-bottom: 1px solid var(--border);
    position: relative;
    z-index: 30; /* Elevates hero so dropdown floats cleanly over main-content */
    overflow: visible; /* CRITICAL: Allows autocomplete-dropdown to extend below hero */
}

/* Watermark container that isolates the giant decorative script from causing horizontal scroll */
.hero-bg-watermark {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.hero-bg-watermark span {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 14rem;
    font-family: 'Noto Sans Buginese', serif;
    color: var(--text-main);
    opacity: 0.025;
    pointer-events: none;
    white-space: nowrap;
}

.hero-container {
    position: relative;
    z-index: 1;
}

.hero-tagline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--gold-light);
    color: var(--text-gold);
    border: 1px solid rgba(212, 175, 55, 0.3);
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 16px;
}

.hero h2 {
    font-size: 2.4rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 12px;
    letter-spacing: -0.02em;
}

.hero h2 span.gradient-text {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero p.hero-desc {
    font-size: 1.05rem;
    color: var(--text-muted);
    max-width: 680px;
    margin: 0 auto 30px;
}

/* Search Box Container */
.search-wrapper {
    max-width: 760px;
    margin: 0 auto;
    position: relative;
    z-index: 50;
}

.search-tabs {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.search-tab-btn {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
}

.search-tab-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.search-tab-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 2px 6px rgba(139, 30, 30, 0.25);
}

.search-bar {
    display: flex;
    align-items: center;
    background: var(--bg-surface);
    border: 2px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 6px 10px 6px 20px;
    box-shadow: var(--shadow-lg);
    transition: all 0.2s ease;
    position: relative;
}

.search-bar:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(139, 30, 30, 0.12), var(--shadow-xl);
}

.search-bar input {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    font-size: 1.15rem;
    color: var(--text-main);
    background: transparent;
    padding: 8px 4px;
}

.search-bar input::placeholder {
    color: var(--text-light);
}

.search-bar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.keyboard-btn {
    background: var(--bg-surface-alt);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 8px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s ease;
    flex-shrink: 0;
    white-space: nowrap;
}

.keyboard-btn:hover {
    color: var(--primary);
    background: var(--primary-light);
    border-color: var(--primary);
}

.search-submit-btn {
    background: var(--primary-gradient);
    color: #fff;
    border: none;
    padding: 10px 22px;
    border-radius: var(--radius-xl);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.15s ease;
    box-shadow: 0 4px 10px rgba(139, 30, 30, 0.25);
    flex-shrink: 0;
    white-space: nowrap;
}

.search-submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(139, 30, 30, 0.35);
}

/* Autocomplete Dropdown */
.autocomplete-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
    max-height: 380px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    text-align: left;
    -webkit-overflow-scrolling: touch;
}

.autocomplete-dropdown.show {
    display: block;
}

.autocomplete-item {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background-color 0.15s ease;
    text-decoration: none;
    color: inherit;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.selected {
    background: var(--bg-surface-alt);
}

.autocomplete-word {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.autocomplete-word strong {
    font-size: 1.05rem;
    color: var(--text-main);
}

.autocomplete-word span.lontara {
    font-size: 1.25rem;
    color: var(--gold-hover);
}

.autocomplete-def {
    font-size: 0.85rem;
    color: var(--text-muted);
    max-width: 320px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Alphabet Filter Strip */
.alphabet-strip {
    margin-top: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
}

.alphabet-strip a {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.15s ease;
}

.alphabet-strip a:hover,
.alphabet-strip a.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* Main Content Area */
.main-content {
    flex: 1;
    padding: 40px 0 60px;
    position: relative;
    z-index: 1;
}

/* Grid Layouts */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

/* Section Header */
.section-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 24px;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title span.icon {
    color: var(--primary);
}

.section-more-link {
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Cards */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border-hover);
}

/* Word of the Day Card */
.word-of-day-card {
    background: linear-gradient(135deg, var(--bg-surface) 0%, var(--bg-surface-alt) 100%);
    border: 2px solid rgba(212, 175, 55, 0.3);
    position: relative;
    overflow: hidden;
}

.word-of-day-card::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 140px;
    height: 140px;
    background: radial-gradient(circle, rgba(212, 175, 55, 0.15) 0%, transparent 70%);
    pointer-events: none;
}

.wod-badge {
    display: inline-block;
    background: var(--gold-gradient);
    color: #fff;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    margin-bottom: 16px;
}

.wod-header {
    display: flex;
    align-items: baseline;
    gap: 16px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.wod-word {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--primary);
    text-decoration: none;
}

.wod-word:hover {
    color: var(--primary-hover);
}

.wod-lontara {
    font-size: 2.4rem;
    color: var(--gold-hover);
}

.wod-ipa {
    font-size: 1rem;
    color: var(--text-light);
    font-style: italic;
}

.wod-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
}

.wod-definition {
    font-size: 1.05rem;
    color: var(--text-main);
    margin-bottom: 16px;
}

.wod-example {
    background: var(--bg-surface);
    border-left: 4px solid var(--gold);
    padding: 12px 16px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 0.95rem;
}

.wod-example p.makassar {
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 4px;
}

.wod-example p.translation {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Category Card */
.category-card {
    display: flex;
    flex-direction: column;
    padding: 20px;
    text-decoration: none;
    color: inherit;
    border-radius: var(--radius-lg);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}

.category-card:hover {
    transform: translateY(-3px);
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.category-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    margin-bottom: 14px;
}

.category-card h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text-main);
}

.category-card p {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.5;
    flex: 1;
}

.category-footer {
    margin-top: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-gold);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-nomina { background: #e0f2fe; color: #0369a1; }
.badge-verba { background: #dcfce7; color: #15803d; }
.badge-adjektiva { background: #ffedd5; color: #c2410c; }
.badge-adverbia { background: #f3e8ff; color: #7e22ce; }
.badge-pronomina { background: #fce7f3; color: #be185d; }
.badge-numeralia { background: #ccfbf1; color: #0f766e; }
.badge-partikel { background: #e0e7ff; color: #3730a3; }
.badge-alusu { background: #fef3c7; color: #b45309; }
.badge-biasa { background: #f1f5f9; color: #475569; }

/* Word Detail Page */
.detail-header {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 36px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-sm);
    position: relative;
}

.detail-lontara-large {
    font-size: 4rem;
    line-height: 1.1;
    color: var(--primary);
    margin-bottom: 12px;
    font-weight: 600;
}

.detail-title-group {
    display: flex;
    align-items: baseline;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.detail-word-title {
    font-size: 2.8rem;
    font-weight: 800;
    color: var(--text-main);
}

.detail-ipa {
    font-size: 1.25rem;
    color: var(--text-muted);
    font-family: monospace;
}

.audio-play-btn {
    background: var(--primary-light);
    border: 1px solid rgba(139, 30, 30, 0.2);
    color: var(--primary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.15s ease;
}

.audio-play-btn:hover {
    background: var(--primary);
    color: #fff;
    transform: scale(1.05);
}

.detail-meta-pills {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.detail-definition-box {
    font-size: 1.25rem;
    line-height: 1.7;
    color: var(--text-main);
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.detail-secondary-def {
    margin-top: 10px;
    font-size: 1.05rem;
    color: var(--text-muted);
}

/* Sections inside detail */
.detail-section {
    margin-top: 32px;
}

.detail-section-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Examples list */
.example-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    margin-bottom: 12px;
    transition: all 0.15s ease;
}

.example-card:hover {
    border-color: var(--primary);
}

.example-makassar {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 4px;
}

.example-lontara {
    font-size: 1.35rem;
    color: var(--gold-hover);
    margin-bottom: 6px;
}

.example-translation {
    font-size: 0.95rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Affixes Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border);
}

.data-table th,
.data-table td {
    padding: 14px 18px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    background: var(--bg-surface-alt);
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover td {
    background: var(--bg-surface-alt);
}

/* Cultural Note Box */
.cultural-box {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.1) 0%, rgba(139, 30, 30, 0.05) 100%);
    border: 1px solid rgba(212, 175, 55, 0.35);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-top: 24px;
}

.cultural-box h4 {
    font-size: 1.1rem;
    color: var(--text-gold);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cultural-box p {
    font-size: 0.95rem;
    line-height: 1.65;
    color: var(--text-main);
}

/* Virtual Lontara Keyboard Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.show {
    display: flex;
}

.keyboard-modal {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 820px;
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-close-btn {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

.modal-body {
    padding: 24px;
}

.keyboard-display-box {
    margin-bottom: 20px;
}

.keyboard-output {
    width: 100%;
    font-size: 2rem;
    padding: 14px 18px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-surface-alt);
    color: var(--primary);
    font-family: 'Noto Sans Buginese', serif;
    min-height: 70px;
    outline: none;
}

.keyboard-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.key-btn {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 4px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.12s ease;
}

.key-btn:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    transform: translateY(-2px);
}

.key-btn span.char {
    font-size: 1.45rem;
    line-height: 1.2;
}

.key-btn span.sub {
    font-size: 0.65rem;
    opacity: 0.7;
    margin-top: 2px;
}

.key-btn.key-vowel {
    background: var(--gold-light);
    border-color: rgba(212, 175, 55, 0.4);
    color: var(--text-gold);
}

.modal-footer-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: var(--bg-surface-alt);
    border-top: 1px solid var(--border);
}

/* Button variants */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.15s ease;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary-gradient);
    color: #fff;
    box-shadow: 0 2px 6px rgba(139, 30, 30, 0.25);
}

.btn-primary:hover {
    color: #fff;
    box-shadow: 0 4px 12px rgba(139, 30, 30, 0.35);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text-main);
}

.btn-secondary:hover {
    background: var(--bg-surface-alt);
    border-color: var(--border-hover);
}

.btn-gold {
    background: var(--gold-gradient);
    color: #fff;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 40px;
}

.page-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text-main);
    font-weight: 600;
    text-decoration: none;
    transition: all 0.15s ease;
}

.page-btn:hover,
.page-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* Footer */
.footer {
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    padding: 50px 0 30px;
    margin-top: auto;
}

.footer-inner {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

.footer-brand h4 {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 12px;
}

.footer-brand p {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 16px;
}

.footer-col h5 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.footer-col ul {
    list-style: none;
}

.footer-col ul li {
    margin-bottom: 10px;
}

.footer-col ul a {
    font-size: 0.88rem;
    color: var(--text-muted);
    transition: color 0.15s ease;
}

.footer-col ul a:hover {
    color: var(--primary);
}

.footer-bottom {
    border-top: 1px solid var(--border);
    padding-top: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-light);
    flex-wrap: wrap;
    gap: 12px;
}

/* Responsive adjustments */
@media (max-width: 900px) {
    .grid-4, .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
    .footer-inner {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 680px) {
    /* Mobile Navbar & Navigation Menu */
    .mobile-menu-btn {
        display: flex;
    }

    .navbar-inner {
        position: relative;
    }

    .nav-actions {
        gap: 8px;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--bg-surface);
        border-bottom: 2px solid var(--border);
        box-shadow: 0 16px 32px rgba(0, 0, 0, 0.18);
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 8px 12px 14px;
        z-index: 999;
        max-height: calc(100vh - 80px);
        overflow-y: auto;
    }

    .nav-links.open {
        display: flex;
        animation: mobileNavSlideDown 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    }

    .nav-links li {
        width: 100%;
    }

    .nav-links a {
        display: flex;
        align-items: center;
        padding: 12px 16px;
        font-size: 0.95rem;
        font-weight: 600;
        border-radius: var(--radius-md);
        color: var(--text-main);
        border-bottom: 1px solid var(--border);
    }

    .nav-links li:last-child a {
        border-bottom: none;
    }

    .nav-links a:hover,
    .nav-links a.active {
        background: var(--primary-light);
        color: var(--primary);
    }

    /* Search Bar & Buttons on Mobile */
    .search-bar {
        padding: 5px 6px 5px 14px;
    }

    .search-bar input {
        font-size: 0.95rem;
        padding: 6px 2px;
    }

    .search-bar-actions {
        gap: 6px;
    }

    .keyboard-btn {
        padding: 7px 10px;
        font-size: 0.82rem;
        gap: 5px;
    }

    .search-submit-btn {
        padding: 8px 16px;
        font-size: 0.88rem;
    }

    /* Autocomplete dropdown on mobile */
    .autocomplete-dropdown {
        max-height: 52vh;
        border-radius: var(--radius-md);
        box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
    }

    .autocomplete-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        padding: 10px 14px;
    }

    .autocomplete-def {
        max-width: 100%;
        font-size: 0.82rem;
    }

    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }

    .footer-inner {
        grid-template-columns: 1fr;
    }

    .hero h2 {
        font-size: 1.8rem;
    }

    .detail-word-title {
        font-size: 2rem;
    }

    .detail-lontara-large {
        font-size: 3rem;
    }

    .keyboard-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

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

@media (max-width: 480px) {
    .brand-icon {
        width: 38px;
        height: 38px;
        font-size: 1.15rem;
    }

    .brand-text h1 {
        font-size: 1.05rem;
    }

    .brand-text p {
        font-size: 0.7rem;
        max-width: 170px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .search-bar {
        padding: 4px 5px 4px 12px;
    }

    .search-bar input {
        font-size: 0.9rem;
    }

    .keyboard-btn {
        padding: 6px 9px;
        font-size: 0.8rem;
        gap: 4px;
    }

    .search-submit-btn {
        padding: 7px 13px;
        font-size: 0.85rem;
    }
}

@media (max-width: 380px) {
    .keyboard-btn .keyboard-btn-text {
        display: none;
    }

    .keyboard-btn {
        padding: 6px 10px;
    }

    .search-submit-btn {
        padding: 7px 11px;
    }
}

