/* ── Fonts ──────────────────────────────────────────────── */
.AhomFont    { font-family: Ahom;        font-size: 38px; }
.AhomUnicode { font-family: AhomUnicode; font-size: 25px; }
.Roman       { font-size: 18px; }
.Dehong      { font-size: 25px; }
.Shan, .DaiLue { font-size: 25px; }
.Khamti      { font-size: 28px; font-weight: bold; font-family: Khamti; }

/* ── Page wrapper ────────────────────────────────────────── */
/*
  The card is ALWAYS centered via flexbox.
  Ads are absolutely positioned on left/right — they
  never affect the card's position at all.
*/
.translator-page {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 32px 16px 60px;
    min-height: calc(100vh - 142px);
    box-sizing: border-box;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

/* ── Centered card — identical to original ───────────────── */
.converter-wrapper {
    width: 100%;
    max-width: 420px;
    z-index: 1;
}

.converter-card {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 24px;
    box-shadow: 0 4px 24px rgba(0,0,0,.18);
}

.converter-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-main);
    text-align: center;
    margin-bottom: 20px;
    letter-spacing: -.01em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.converter-title::before,
.converter-title::after {
    content: '';
    width: 22px;
    height: 2px;
    background: var(--accent);
    border-radius: 2px;
    flex-shrink: 0;
}

/* ── Language row ────────────────────────────────────────── */
.converter-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.field { flex: 1; min-width: 0; }

.theme-optionbox {
    width: 100%;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 28px 8px 10px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-main);
    font-family: inherit;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 12 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%238c8c91' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    cursor: pointer;
    transition: border-color 140ms;
}
.theme-optionbox:focus { border-color: var(--accent); }

.swap {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-soft);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    flex-shrink: 0;
    transition: background 140ms, color 140ms, border-color 140ms;
    user-select: none;
}
.swap:hover {
    background: var(--bg-hover);
    color: var(--text-main);
    border-color: var(--accent);
}

/* ── Source textarea ─────────────────────────────────────── */
#sourceText {
    width: 100%;
    min-height: 110px;
    max-height: 240px;
    overflow-y: auto;
    background: var(--bg-soft);
    color: var(--text-main);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;

    resize: none;
    outline: none;
    line-height: 1.6;
    transition: border-color 140ms;
    margin-bottom: 10px;
    box-sizing: border-box;
}
#sourceText:focus { border-color: var(--accent); }
#sourceText::placeholder { color: var(--text-muted); opacity: .6; }

/* ── Output ──────────────────────────────────────────────── */
.output {
    min-height: 110px;
    max-height: 240px;
    overflow-y: auto;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px 8px;
    margin-bottom: 4px;
    line-height: 1.6;
    transition: border-color 140ms;
}

#resultText { color: var(--text-main); word-wrap: break-word; overflow-wrap: anywhere; }

#Roman {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
    font-style: italic;
}

.output-actions {
    display: flex;
    gap: 6px;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

#copyBtn, #audioBtn {
    display: none;
    align-items: center;
    gap: 5px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 5px 11px;
    font-size: 12px;
    color: var(--text-soft);
    cursor: pointer;
    transition: background 140ms, color 140ms;
    height: auto;
    width: auto;
}
#copyBtn:hover, #audioBtn:hover {
    background: var(--bg-hover);
    color: var(--text-main);
}
#copyBtn i, #audioBtn i { font-size: 14px; color: inherit; }

/* ── Translate button ────────────────────────────────────── */
#convertBtn {
    width: 100%;
    margin-top: 14px;
    padding: 12px;
    border: none;
    border-radius: 9px;
    background: var(--accent);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 150ms, transform 100ms;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
#convertBtn:hover  { background: var(--accent-soft); }
#convertBtn:active { transform: scale(.98); }

/* ── Error ───────────────────────────────────────────────── */
#errorMessage {
    display: none;
    margin-top: 10px;
    padding: 10px 14px;
    background: rgba(239,68,68,.1);
    border: 1px solid rgba(239,68,68,.2);
    border-radius: 8px;
    color: #f87171;
    font-size: 13px;
}

/* ═══════════════════════════════════════════════════════════
   Ad sidebars — absolutely positioned, never affect card
═══════════════════════════════════════════════════════════ */
.translator-ad {
    position: absolute;
    top: 32px;
    width: 180px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.translator-ad-left  { left: 16px; }
.translator-ad-right { right: 16px; }

/* Hide ads if viewport isn't wide enough to show them
   without overlapping the card (card=420 + 2×(180+16+gap) ) */
@media (max-width: 900px) {
    .translator-ad { display: none; }
}

.ad-label {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--text-muted);
    opacity: .45;
    text-align: center;
}

.ad-slot {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    min-height: 200px;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ad-house {
    width: 100%;
    padding: 16px 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
}

.ad-house-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(59,130,246,.1);
    border: 1px solid rgba(59,130,246,.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
}

.ad-house-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    line-height: 1.3;
}

.ad-house-sub {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.55;
}

.ad-house-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--accent);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 7px;
    text-decoration: none;
    transition: background 140ms;
    border: none;
    cursor: pointer;
    font-family: inherit;
}
.ad-house-btn:hover { background: var(--accent-soft); color: #fff; }

/* ── Mobile banner ads (shown only when sidebars hidden) ─── */
.ad-mobile {
    display: block;
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    min-height: 90px;
}


@media (max-width: 480px) {
    .translator-page { padding: 16px 12px 40px; }
    .converter-card  { padding: 18px 14px; }
    #sourceText, .output { min-height: 90px; max-height: 180px; }
}