:root {
    --bg: #faf7f0;
    --bg2: #f3ede0;
    --bg3: #ede4cc;
    --teal: #1a5c5c;
    --teal2: #246b6b;
    --teal3: #2e8080;
    --teal-lt: #e8f4f4;
    --gold: #b8860b;
    --gold2: #d4a017;
    --gold-lt: #fdf3d0;
    --ink: #1a1208;
    --ink2: #3d3020;
    --muted: #7a6a50;
    --border: rgba(26, 92, 92, 0.15);
    --border2: rgba(26, 92, 92, 0.28);
    --r: 10px;
    --r-lg: 18px;
    --shadow: 0 2px 16px rgba(26, 92, 92, 0.10);
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Karla', sans-serif;
    background: var(--bg);
    color: var(--ink);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ── PATTERN BG ── */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    background-image:
        radial-gradient(circle at 15% 15%, rgba(26, 92, 92, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 85% 80%, rgba(184, 134, 11, 0.06) 0%, transparent 50%);
    pointer-events: none;
}

body>* {
    position: relative;
    z-index: 1;
}

/* ── ORNAMENT SVG ── */
.ornament {
    display: block;
    width: 80px;
    height: 12px;
    margin: 0 auto;
    opacity: 0.35;
}

/* ── NAV ── */
nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2.5rem;
    height: 68px;
    background: rgba(250, 247, 240, 0.88);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.nav-logo-mark {
    width: 38px;
    height: 38px;
    background: var(--teal);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Noto Sans Malayalam', sans-serif;
    font-size: 1.1rem;
    color: #fdf3d0;
    font-weight: 700;
    letter-spacing: -1px;
}

.nav-logo-text {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--teal);
    letter-spacing: 0.02em;
}

.nav-logo-sub {
    font-size: 0.7rem;
    color: var(--muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-top: 1px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.8rem;
}

.nav-links a {
    font-size: 0.875rem;
    color: var(--ink2);
    text-decoration: none;
    font-weight: 400;
    transition: color 0.2s;
    letter-spacing: 0.01em;
}

.nav-links a:hover {
    color: var(--teal);
}

.nav-badge {
    background: var(--gold-lt);
    color: var(--gold);
    border: 1px solid rgba(184, 134, 11, 0.25);
    font-size: 0.72rem;
    font-weight: 500;
    padding: 0.3rem 0.85rem;
    border-radius: 100px;
    letter-spacing: 0.04em;
    font-family: 'Karla', sans-serif;
}

/* ── HERO ── */
.hero {
    text-align: center;
    padding: 5rem 2rem 3.5rem;
    max-width: 800px;
    margin: 0 auto;
}

.hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: 'Karla', sans-serif;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--gold);
    font-weight: 500;
    margin-bottom: 1.2rem;
    animation: rise 0.7s ease both;
}

.hero-eyebrow::before,
.hero-eyebrow::after {
    content: '';
    display: block;
    width: 28px;
    height: 1px;
    background: var(--gold);
    opacity: 0.5;
}

.hero h1 {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(2.8rem, 6vw, 5rem);
    font-weight: 700;
    line-height: 1.05;
    color: var(--teal);
    animation: rise 0.7s ease 0.08s both;
}

.hero h1 em {
    font-style: italic;
    color: var(--gold);
    display: block;
    font-size: 0.85em;
}

.hero-ml {
    font-family: 'Noto Sans Malayalam', sans-serif;
    font-size: clamp(1.4rem, 3vw, 2rem);
    color: var(--teal);
    opacity: 0.55;
    margin-top: 0.3rem;
    font-weight: 400;
    display: block;
    animation: rise 0.7s ease 0.14s both;
}

.hero p {
    font-size: 1.05rem;
    color: var(--muted);
    max-width: 520px;
    margin: 1.4rem auto 0;
    line-height: 1.75;
    animation: rise 0.7s ease 0.2s both;
}

@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(18px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── TOOL TABS ── */
.tool-tabs {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin: 2.5rem auto 0;
    flex-wrap: wrap;
    animation: rise 0.7s ease 0.25s both;
}

.tab-btn {
    background: white;
    border: 1px solid var(--border2);
    color: var(--ink2);
    font-family: 'Karla', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.55rem 1.2rem;
    border-radius: 100px;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn:hover {
    border-color: var(--teal);
    color: var(--teal);
}

.tab-btn.active {
    background: var(--teal);
    color: #fdf3d0;
    border-color: var(--teal);
}

/* ── MAIN TOOL CARD ── */
.tool-section {
    max-width: 960px;
    margin: 2rem auto;
    padding: 0 1.5rem 4rem;
    animation: rise 0.7s ease 0.3s both;
}

.tool-card {
    background: white;
    border: 1px solid var(--border2);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.tool-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.4rem;
    background: var(--teal);
    color: #fdf3d0;
    flex-wrap: wrap;
    gap: 0.7rem;
}

.tool-header-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.tool-header-btns {
    display: flex;
    gap: 0.5rem;
}

.th-btn {
    background: rgba(253, 243, 208, 0.15);
    border: 1px solid rgba(253, 243, 208, 0.3);
    color: #fdf3d0;
    font-family: 'Karla', sans-serif;
    font-size: 0.78rem;
    font-weight: 500;
    padding: 0.35rem 0.85rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.th-btn:hover {
    background: rgba(253, 243, 208, 0.28);
}

.th-btn.active-scheme {
    background: rgba(253, 243, 208, 0.3);
    border-color: rgba(253, 243, 208, 0.6);
}

/* ── EDITOR AREA ── */
.editor-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 280px;
}

.editor-pane {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
}

.editor-pane:last-child {
    border-right: none;
}

.pane-label {
    padding: 0.6rem 1rem;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 500;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.pane-label span {
    color: var(--teal);
    font-weight: 600;
}

.editor-input {
    flex: 1;
    width: 100%;
    border: none;
    outline: none;
    resize: none;
    padding: 1.2rem 1.1rem;
    font-family: 'Karla', sans-serif;
    font-size: 1.05rem;
    color: var(--ink);
    background: white;
    line-height: 1.7;
}

.editor-input::placeholder {
    color: #c4b89a;
}

.editor-output {
    flex: 1;
    padding: 1.2rem 1.1rem;
    font-family: 'Noto Sans Malayalam', sans-serif;
    font-size: 1.2rem;
    line-height: 1.8;
    color: var(--teal);
    background: var(--bg);
    white-space: pre-wrap;
    word-break: break-word;
    min-height: 180px;
    cursor: default;
}

.output-placeholder {
    color: #c4b89a;
    font-family: 'Karla', sans-serif;
    font-size: 0.95rem;
}

.tool-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.1rem;
    border-top: 1px solid var(--border);
    background: var(--bg);
    flex-wrap: wrap;
    gap: 0.5rem;
}

.char-count {
    font-size: 0.78rem;
    color: var(--muted);
}

.action-btns {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.act-btn {
    font-family: 'Karla', sans-serif;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.4rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid var(--border2);
    background: white;
    color: var(--ink2);
}

.act-btn:hover {
    border-color: var(--teal);
    color: var(--teal);
}

.act-btn.primary {
    background: var(--teal);
    color: #fdf3d0;
    border-color: var(--teal);
}

.act-btn.primary:hover {
    background: var(--teal2);
}

.act-btn.gold {
    background: var(--gold-lt);
    color: var(--gold);
    border-color: rgba(184, 134, 11, 0.3);
}

.act-btn.gold:hover {
    background: #f5e8a8;
}

.act-btn.success {
    background: #e8f5e8;
    color: #2a7a2a;
    border-color: rgba(42, 122, 42, 0.3);
}

/* ── VIRTUAL KEYBOARD ── */
.keyboard-section {
    border-top: 1px solid var(--border);
    padding: 1rem 1rem 1.1rem;
    background: var(--bg2);
}

.kb-title {
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 500;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.kb-toggle {
    cursor: pointer;
    color: var(--teal);
    font-size: 0.78rem;
    letter-spacing: normal;
    text-transform: none;
}

.kb-grid {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.kb-row {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.kb-key {
    min-width: 44px;
    height: 44px;
    background: white;
    border: 1px solid var(--border2);
    border-radius: 7px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
    padding: 2px;
    flex-shrink: 0;
}

.kb-key:hover {
    background: var(--teal-lt);
    border-color: var(--teal);
}

.kb-key:active {
    transform: scale(0.93);
    background: var(--teal);
}

.kb-key:active .kb-ml {
    color: #fdf3d0;
}

.kb-key:active .kb-en {
    color: rgba(253, 243, 208, 0.7);
}

.kb-ml {
    font-family: 'Noto Sans Malayalam', sans-serif;
    font-size: 0.95rem;
    color: var(--teal);
    line-height: 1;
}

.kb-en {
    font-size: 0.6rem;
    color: var(--muted);
    margin-top: 2px;
    font-family: 'Karla', sans-serif;
}

.kb-key.wide {
    min-width: 72px;
}

.kb-key.space-key {
    min-width: 160px;
}

.kb-key.action-key {
    background: var(--bg3);
}

.kb-key.action-key .kb-ml {
    font-family: 'Karla', sans-serif;
    font-size: 0.75rem;
    color: var(--muted);
}

/* ── SUGGESTIONS BAR ── */
.suggestions-bar {
    display: flex;
    gap: 6px;
    padding: 0.6rem 1rem;
    border-top: 1px solid var(--border);
    background: var(--bg);
    min-height: 44px;
    flex-wrap: wrap;
    align-items: center;
    overflow-x: auto;
}

.sugg-label {
    font-size: 0.7rem;
    color: var(--muted);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-right: 4px;
}

.sugg-pill {
    background: white;
    border: 1px solid var(--border2);
    color: var(--teal);
    font-family: 'Noto Sans Malayalam', sans-serif;
    font-size: 0.95rem;
    padding: 0.2rem 0.75rem;
    border-radius: 100px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.sugg-pill:hover {
    background: var(--teal);
    color: #fdf3d0;
    border-color: var(--teal);
}

/* ── REFERENCE SECTION ── */
.ref-section {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 1.5rem 4rem;
}

.section-heading {
    font-family: 'Cormorant Garamond', serif;
    font-size: 2rem;
    font-weight: 700;
    color: var(--teal);
    text-align: center;
    margin-bottom: 0.5rem;
}

.section-sub {
    text-align: center;
    color: var(--muted);
    font-size: 0.95rem;
    margin-bottom: 2rem;
}

.ref-tabs {
    display: flex;
    gap: 0.4rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.ref-tab {
    background: white;
    border: 1px solid var(--border2);
    color: var(--ink2);
    font-family: 'Karla', sans-serif;
    font-size: 0.82rem;
    font-weight: 500;
    padding: 0.45rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.ref-tab:hover {
    border-color: var(--teal);
    color: var(--teal);
}

.ref-tab.active {
    background: var(--teal);
    color: #fdf3d0;
    border-color: var(--teal);
}

.ref-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 8px;
}

.ref-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 0.75rem 0.5rem;
    text-align: center;
    transition: all 0.18s;
    cursor: pointer;
}

.ref-card:hover {
    border-color: var(--teal);
    background: var(--teal-lt);
    transform: translateY(-2px);
}

.ref-ml {
    font-family: 'Noto Sans Malayalam', sans-serif;
    font-size: 1.4rem;
    color: var(--teal);
    line-height: 1;
}

.ref-en {
    font-size: 0.72rem;
    color: var(--muted);
    margin-top: 4px;
}

.ref-sound {
    font-size: 0.65rem;
    color: var(--gold);
    margin-top: 2px;
    font-style: italic;
}

/* ── PHRASES SECTION ── */
.phrases-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 10px;
}

.phrase-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 1rem 1.1rem;
    transition: all 0.18s;
    cursor: pointer;
    position: relative;
}

.phrase-card:hover {
    border-color: var(--teal2);
    box-shadow: 0 4px 12px rgba(26, 92, 92, 0.08);
}

.phrase-en {
    font-size: 0.82rem;
    color: var(--muted);
    margin-bottom: 4px;
}

.phrase-ml {
    font-family: 'Noto Sans Malayalam', sans-serif;
    font-size: 1.1rem;
    color: var(--teal);
}

.phrase-manglish {
    font-size: 0.75rem;
    color: var(--gold);
    margin-top: 4px;
    font-style: italic;
}

.phrase-copy-hint {
    position: absolute;
    top: 0.7rem;
    right: 0.8rem;
    font-size: 0.65rem;
    color: var(--border2);
    opacity: 0;
    transition: opacity 0.2s;
}

.phrase-card:hover .phrase-copy-hint {
    opacity: 1;
}

/* ── HOW TO USE ── */
.how-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.how-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 1.5rem 1.25rem;
    text-align: center;
}

.how-num {
    font-family: 'Cormorant Garamond', serif;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--teal);
    opacity: 0.2;
    line-height: 1;
}

.how-title {
    font-weight: 500;
    color: var(--ink2);
    margin: 0.5rem 0 0.3rem;
    font-size: 0.95rem;
}

.how-desc {
    font-size: 0.83rem;
    color: var(--muted);
    line-height: 1.6;
}

/* ── SHARE BAR ── */
.share-bar {
    background: var(--teal);
    color: #fdf3d0;
    padding: 1.2rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    max-width: 960px;
    margin: 0 auto 2rem;
    border-radius: var(--r-lg);
}

.share-bar p {
    font-size: 0.9rem;
    opacity: 0.85;
}

.share-bar strong {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.15rem;
    display: block;
}

.share-btns {
    display: flex;
    gap: 0.6rem;
}

.share-btn {
    background: rgba(253, 243, 208, 0.15);
    border: 1px solid rgba(253, 243, 208, 0.3);
    color: #fdf3d0;
    font-family: 'Karla', sans-serif;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.45rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.share-btn:hover {
    background: rgba(253, 243, 208, 0.28);
}

/* ── FOOTER ── */
footer {
    background: var(--teal);
    color: rgba(253, 243, 208, 0.8);
    padding: 2.5rem 2rem;
    margin-top: 2rem;
}

.footer-inner {
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 2rem;
    flex-wrap: wrap;
}

.footer-brand {
    max-width: 280px;
}

.footer-brand .nav-logo-mark {
    background: rgba(253, 243, 208, 0.2);
}

.footer-brand p {
    font-size: 0.85rem;
    margin-top: 0.75rem;
    line-height: 1.65;
    opacity: 0.75;
}

.footer-col h4 {
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--gold2);
    margin-bottom: 0.9rem;
}

.footer-col a {
    display: block;
    font-size: 0.85rem;
    color: rgba(253, 243, 208, 0.7);
    text-decoration: none;
    margin-bottom: 0.45rem;
    transition: color 0.2s;
}

.footer-col a:hover {
    color: #fdf3d0;
}

.footer-bottom {
    max-width: 960px;
    margin: 1.5rem auto 0;
    padding-top: 1.2rem;
    border-top: 1px solid rgba(253, 243, 208, 0.12);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.footer-bottom p {
    font-size: 0.78rem;
    opacity: 0.55;
}

.footer-ml {
    font-family: 'Noto Sans Malayalam', sans-serif;
    font-size: 0.95rem;
}

/* ── TOAST ── */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(16px);
    background: var(--teal);
    color: #fdf3d0;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.65rem 1.5rem;
    border-radius: 100px;
    z-index: 999;
    opacity: 0;
    transition: all 0.3s;
    pointer-events: none;
    font-family: 'Noto Sans Malayalam', sans-serif;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ── DIVIDER ── */
.divider {
    max-width: 960px;
    margin: 0 auto 2.5rem;
    border: none;
    border-top: 1px solid var(--border);
    padding: 0 1.5rem;
}

/* ── RESPONSIVE ── */
@media (max-width: 640px) {
    .editor-cols {
        grid-template-columns: 1fr;
    }

    .editor-pane {
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    nav {
        padding: 0 1rem;
    }

    .nav-links {
        display: none;
    }

    .tool-section,
    .ref-section {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .kb-key {
        min-width: 36px;
        height: 38px;
    }

    .kb-key.space-key {
        min-width: 120px;
    }

    .share-bar {
        flex-direction: column;
        text-align: center;
    }

    .share-btns {
        justify-content: center;
    }
}

/* ── Advertisement Section ── */
.ad-container {
    width: 100%;
    max-width: 960px;
    margin: 2rem auto;
    padding: 0 1rem;
    display: block;
    text-align: center;
    overflow: hidden;
}

.ad-placeholder {
    width: 100%;
    max-width: 728px;
    height: 90px;
    background-color: var(--surface);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.ad-placeholder small {
    text-transform: none;
    font-size: 0.75rem;
    margin-top: 0.25rem;
    opacity: 0.7;
    letter-spacing: normal;
}

@media (max-width: 768px) {
    .ad-placeholder {
        height: auto;
        padding: 1.5rem;
        text-align: center;
    }
}