/**
 * So'z tarjimasi — bosiladigan so'zlar va tarjima oynasi.
 * Reading matni va Listening transkriptida ishlatiladi.
 */

/* Bosiladigan so'z: odatiy holatda matndan farq qilmaydi, faqat
   sichqoncha tekkanda yoki bosilganda ajralib turadi. */
.tr-w {
    cursor: pointer;
    border-radius: 3px;
    padding: 0 1px;
    transition: background 0.12s ease, box-shadow 0.12s ease;
}

.tr-w:hover {
    background: rgba(37, 99, 235, 0.14);
}

.tr-w-on {
    background: rgba(37, 99, 235, 0.22);
    box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.55);
}

/* Barmoq bilan ishlatishda hover chalg'itmasin */
@media (hover: none) {
    .tr-w:hover { background: none; }
}

/* Matn ustida "bosib ko'ring" ishorasi */
.tr-host { cursor: default; }

/* ---------------- Tarjima oynasi ---------------- */
.tr-pop {
    position: absolute;
    z-index: 9999;
    display: none;
    width: 268px;
    max-width: calc(100vw - 20px);
    background: var(--bg-surface, #0f172a);
    border: 1px solid var(--border-strong, rgba(255, 255, 255, 0.16));
    border-radius: 14px;
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.45);
    font-family: var(--font-main, inherit);
    overflow: hidden;
}

.tr-pop.open { display: block; }

.tr-pop-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
}

.tr-pop-head b {
    font-size: 14.5px;
    font-weight: 700;
    color: var(--text-primary, #f1f5f9);
    word-break: break-word;
}

.tr-pop-x {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    line-height: 1;
    font-size: 18px;
    background: none;
    border: 0;
    color: var(--text-muted, #94a3b8);
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.15s ease, color 0.15s ease;
}

.tr-pop-x:hover {
    color: var(--text-primary, #f1f5f9);
    background: rgba(255, 255, 255, 0.1);
}

.tr-pop-body { padding: 11px 12px 13px; }

.tr-pop-pos {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted, #94a3b8);
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
    border-radius: 5px;
    padding: 1px 7px;
    margin-bottom: 7px;
}

.tr-pop-tr {
    font-size: 17px;
    font-weight: 700;
    color: var(--accent-emerald-text, #6ee7b7);
    line-height: 1.35;
    word-break: break-word;
}

.tr-pop-note {
    margin-top: 7px;
    font-size: 12.5px;
    color: var(--text-secondary, #cbd5e1);
    line-height: 1.5;
}

.tr-pop-ex {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
    font-size: 12px;
    font-style: italic;
    color: var(--text-muted, #94a3b8);
    line-height: 1.5;
}

.tr-pop-muted {
    font-size: 13px;
    color: var(--text-muted, #94a3b8);
}

.tr-pop-cta {
    display: block;
    margin-top: 11px;
    text-align: center;
    background: var(--accent-blue, #2563eb);
    color: #fff;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    padding: 9px 12px;
    border-radius: 9px;
}

.tr-pop-cta:hover { background: #1d4ed8; }


/* ---------------------------------------------------------------
   Sensorli ekran: oynadagi tugmalar barmoqqa mos bo'lsin.
   24px "yopish" tugmasiga va past CTA'ga aniq tegish qiyin edi.
   --------------------------------------------------------------- */
@media (pointer: coarse) {
    .tr-pop {
        width: 292px;
    }
    .tr-pop-x {
        width: 40px;
        height: 40px;
        margin: -8px -6px -8px 0;
        font-size: 22px;
    }
    .tr-pop-cta {
        min-height: 46px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 14px;
    }
}
