:root {
    --bg-color: #f6f6f9;
    --surface-color: #ffffff;
    --lampung-gold: #d4af37;
    --lampung-gold-glow: rgba(212, 175, 55, 0.25);
    --lampung-red: #8e1616;
    --primary-color: var(--lampung-gold);
    --text-main: #1c1c1e;
    --text-muted: #8e8e93;
    --border-color: #e5e5ea;
    --nav-height: 68px;
    --app-max-width: 600px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    height: 100%;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
}

button, a, input, textarea, select, label {
    -webkit-tap-highlight-color: transparent;
}

button:focus, a:focus, input:focus, textarea:focus, select:focus,
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
    outline: none;
}

button::-moz-focus-inner {
    border: 0;
}

@font-face {
    font-family: 'AksaraLampung';
    src: url('../fonts/aksara-Lampung-Unila-v2.ttf') format('truetype');
}

.aksaraLampung {
    font-family: 'AksaraLampung', sans-serif !important;
    font-size: 2em;
}

.hide { display: none; }
.show { display: block; }
#petunjukAksara { text-align: center; }
.btn { margin: 0.1rem; font-size: 1rem; }

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: var(--app-max-width);
    margin: 0 auto;
    background-color: var(--bg-color);
    box-shadow: 0 0 30px rgba(0,0,0,0.05);
    position: relative;
}

.app-header {
    background: transparent;
    padding: calc(10px + env(safe-area-inset-top)) 20px 4px;
    display: flex;
    justify-content: center;
    position: relative;
    z-index: 10;
}

.island {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, var(--lampung-red) 0%, #a52a2a 100%);
    padding: 7px 16px 7px 7px;
    border-radius: 999px;
    box-shadow: 0 6px 14px rgba(142, 22, 22, 0.3);
    overflow: hidden;
    max-width: 240px;
    transition: max-width 0.7s cubic-bezier(0.34, 1.56, 0.64, 1), padding 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.island.is-collapsed {
    max-width: 40px;
    padding: 7px;
}

.badge-glyph {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    color: #ffffff;
    line-height: 1;
}

.app-title {
    font-size: 0.85rem;
    font-weight: 700;
    margin: 0;
    color: #ffffff;
    letter-spacing: 0.2px;
    white-space: nowrap;
    opacity: 1;
    transition: opacity 0.4s ease 0.25s;
}

.island.is-collapsed .app-title {
    opacity: 0;
    transition: opacity 0.15s ease;
}

.app-content {
    flex-grow: 1;
    padding: 20px 16px calc(20px + var(--nav-height) + env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.page {
    display: none;
    flex-direction: column;
    gap: 16px;
}

.page.active {
    display: flex;
}

.card-ui {
    background-color: var(--surface-color);
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
    border: 1px solid rgba(255,255,255,0.4);
}

.toggle-group {
    display: flex;
    background-color: var(--bg-color);
    border-radius: 10px;
    padding: 5px;
    gap: 5px;
}

.toggle-input {
    display: none;
}

.toggle-label {
    flex: 1;
    text-align: center;
    padding: 10px 0;
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.toggle-input:checked + .toggle-label {
    background-color: var(--lampung-red);
    color: #ffffff;
    box-shadow: 0 3px 8px rgba(142, 22, 22, 0.25);
}

.input-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.mt-3 { margin-top: 20px; }

.modern-input {
    width: 100%;
    padding: 14px 16px;
    font-size: 1.05rem;
    color: var(--text-main);
    background-color: var(--bg-color);
    border: 1.5px solid transparent;
    border-radius: 10px;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    outline: none;
    font-family: inherit;
}

.modern-input:focus {
    background-color: var(--surface-color);
    border-color: var(--lampung-gold);
    box-shadow: 0 0 0 4px var(--lampung-gold-glow);
    transform: translateY(-1px);
}

.result-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--lampung-gold);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.hasil-transliterasi {
    font-size: 1.15rem;
    color: var(--lampung-red);
    min-height: 80px;
    line-height: 1.5;
    word-wrap: break-word;
    transition: all 0.3s ease;
}

#hasilTerjemah ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

#hasilTerjemah li {
    padding: 8px 0;
    border-bottom: 1px dashed rgba(0,0,0,0.1);
}

#hasilTerjemah li:last-child {
    border-bottom: none;
}

.compose-latin {
    font-size: 0.95rem;
    color: var(--text-muted);
    min-height: 24px;
    word-wrap: break-word;
    margin-bottom: 6px;
}

.compose-preview {
    min-height: 64px;
    word-wrap: break-word;
    color: var(--text-main);
    margin-bottom: 16px;
}

.compose-actions {
    display: flex;
    gap: 8px;
}

.compose-btn {
    flex: 1;
    padding: 12px 0;
    border-radius: 10px;
    border: none;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    font-family: inherit;
    color: #ffffff;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.compose-btn:active {
    transform: scale(0.96);
    opacity: 0.85;
}

.compose-btn-space {
    background-color: var(--lampung-gold);
}

.compose-btn-back {
    background-color: var(--text-muted);
}

.compose-btn-clear {
    background-color: var(--lampung-red);
}

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

.aksara-key {
    background-color: var(--bg-color);
    border: 1.5px solid transparent;
    border-radius: 12px;
    padding: 10px 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s ease;
}

.aksara-key:active {
    transform: scale(0.94);
    background-color: var(--lampung-gold-glow);
    border-color: var(--lampung-gold);
}

.key-glyph {
    font-size: 1.4rem;
    line-height: 1;
    color: var(--lampung-red);
}

.key-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.anak-huruf-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.anak-huruf-key {
    flex: 1;
    min-width: 76px;
    background-color: var(--bg-color);
    border: 1.5px solid transparent;
    border-radius: 10px;
    padding: 10px 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s ease;
}

.anak-huruf-key:active {
    transform: scale(0.94);
    background-color: var(--lampung-gold-glow);
    border-color: var(--lampung-gold);
}

.anak-sound {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--lampung-red);
}

.anak-name {
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    color: var(--text-muted);
    text-transform: uppercase;
    text-align: center;
}

.about-text {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-main);
}

.about-list {
    padding-left: 20px;
    font-size: 0.95rem;
    line-height: 1.8;
    color: var(--text-main);
}

.about-hero {
    text-align: center;
}

.about-hero-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    margin: 0 auto 12px;
    border-radius: 50%;
    background-color: var(--lampung-gold-glow);
    color: var(--lampung-red);
}

.about-hero-icon svg {
    width: 26px;
    height: 26px;
}

.about-hero-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
}

.about-hero-tagline {
    margin-top: 6px;
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.feature-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.feature-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.feature-icon {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 11px;
    background-color: var(--lampung-gold-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--lampung-red);
}

.feature-icon svg {
    width: 19px;
    height: 19px;
}

.feature-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 2px;
}

.feature-desc {
    font-size: 0.83rem;
    line-height: 1.5;
    color: var(--text-muted);
}

.dev-row {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.dev-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
}

.dev-fullname {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 1px;
}

.dev-role {
    font-size: 0.78rem;
    color: var(--lampung-red);
    font-weight: 600;
    margin-top: 4px;
}

.about-footer-note {
    text-align: center;
    font-size: 0.78rem;
    color: var(--text-muted);
    padding: 4px 0 2px;
}

.privacy-link {
    color: var(--lampung-red);
    text-decoration: none;
    font-weight: 600;
}

.privacy-link:hover {
    text-decoration: underline;
}

.about-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
}

.about-btn {
    padding: 13px 0;
    border-radius: 10px;
    border: none;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.about-btn:active {
    transform: scale(0.97);
    opacity: 0.9;
}

.about-btn-share {
    background-color: var(--bg-color);
    color: var(--lampung-red);
    border: 1.5px solid var(--lampung-gold);
}

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    align-items: flex-end;
    justify-content: center;
    z-index: 50;
}

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

.modal-card {
    background-color: var(--surface-color);
    width: 100%;
    max-width: 600px;
    border-radius: 20px 20px 0 0;
    padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
}

.exit-card {
    text-align: center;
}

.exit-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 14px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f4d976 0%, var(--lampung-gold) 55%, #b8901f 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 22px rgba(142, 22, 22, 0.25);
}

.exit-icon-glyph {
    color: var(--lampung-red);
    line-height: 1;
    transform: translateY(-1px);
}

.exit-text {
    margin-top: 8px;
    margin-bottom: 20px;
}

.exit-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.exit-btn-batal {
    padding: 13px 0;
    border-radius: 10px;
    border: 1.5px solid var(--border-color);
    background-color: var(--bg-color);
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.exit-btn-batal:active {
    transform: scale(0.97);
    background-color: var(--border-color);
}

.exit-btn-keluar {
    display: block;
    padding: 13px 0;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, var(--lampung-red) 0%, #a52a2a 100%);
    color: #ffffff;
    font-weight: 700;
    font-size: 0.9rem;
    font-family: inherit;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.exit-btn-keluar:active {
    transform: scale(0.97);
    opacity: 0.9;
}

.bottom-nav {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: 0;
    width: 100%;
    max-width: var(--app-max-width);
    height: var(--nav-height);
    background-color: var(--surface-color);
    display: flex;
    box-shadow: 0 -4px 15px rgba(0,0,0,0.05);
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 20;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: none;
    border: none;
    font-family: inherit;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
}

.nav-item svg {
    width: 22px;
    height: 22px;
}

.nav-item.active {
    color: var(--lampung-red);
}

@keyframes fadeSlideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-item-1 { animation: fadeSlideUp 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; }
.animate-item-2 { animation: fadeSlideUp 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; animation-delay: 0.15s; opacity: 0; }

@media (min-width: 900px) {
    :root {
        --app-max-width: 900px;
    }

    body {
        background: linear-gradient(180deg, #efeff5 0%, #e6e6ee 100%);
    }

    .app-container {
        min-height: 100vh;
        margin: 0 auto;
        box-shadow: 0 20px 60px rgba(0,0,0,0.08);
        border-left: 1px solid rgba(0,0,0,0.04);
        border-right: 1px solid rgba(0,0,0,0.04);
    }

    .app-header {
        padding-top: 28px;
        justify-content: flex-start;
        padding-left: 32px;
    }

    .app-content {
        padding: 28px 32px calc(28px + var(--nav-height));
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        align-items: start;
        gap: 20px;
    }

    #page-konversi.page.active,
    #page-mengetik.page.active {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
        grid-column: 1 / -1;
    }

    #page-tentang.page.active {
        display: block;
        grid-column: 1 / -1;
        max-width: 640px;
        margin: 0 auto;
    }

    .card-ui {
        padding: 26px;
    }

    .hasil-transliterasi {
        min-height: 220px;
    }

    .aksara-grid {
        grid-template-columns: repeat(5, 1fr);
    }

    .anak-huruf-key {
        min-width: 96px;
    }

    .bottom-nav {
        max-width: var(--app-max-width);
        height: 76px;
    }

    .nav-item {
        font-size: 0.78rem;
    }

    .nav-item svg {
        width: 24px;
        height: 24px;
    }

    .modal-card {
        max-width: 420px;
        border-radius: 20px;
        margin-bottom: 32px;
    }
}
