/* ================================================================
   Tronmedia Mission — Frontend CSS v2.1
================================================================ */

/* ── Popup Overlay ─────────────────────────────────────────── */
/* overlay: fixed toàn màn hình, scroll bằng chính overlay */
.tm-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.65);
    z-index: 99999;
    overflow-y: auto;                  /* scroll chính của trình duyệt thay vì scroll popup */
    -webkit-overflow-scrolling: touch; /* momentum scroll mượt trên iOS */
    overscroll-behavior: contain;      /* không cho cuộn lan ra trang nền */
    padding: 40px 16px;
    /* KHÔNG dùng backdrop-filter: blur — nó bắt vẽ lại hiệu ứng mờ toàn trang
       mỗi frame khi cuộn → giật/lag. Nền tối rgba là đủ để làm nổi popup. */
}

/* Khi popup mở: khoá cuộn trang nền để trình duyệt không phải vẽ lại trang
   phía sau → cuộn trong popup nhẹ và mượt hơn hẳn. */
body.tm-popup-open { overflow: hidden; }

/* popup: width 800px, height auto, không scroll riêng */
.tm-popup {
    background: #e7fcff;
    border-radius: 16px;
    width: 100%;
    max-width: 820px;
    /* height: auto — không set max-height, không overflow-y */
    padding: 0;                /* thanh trên cùng & nội dung tự quản lý padding */
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
    position: relative;
    margin: 0 auto;            /* căn giữa ngang */
    overflow: hidden;          /* bo góc ăn cả thanh trên cùng */
    animation: tmPopupIn .25s cubic-bezier(.34,1.56,.64,1);
}

/* nội dung & loading có padding riêng (popup không còn padding) */
#tm-popup-content { padding: 18px 22px 22px; }
.tm-popup-loading { padding: 48px 22px; }

/* ── Thanh trên cùng (tab + ô nhập mã + nút + đồng hồ + ✕) ── */
.tm-popup-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: #fff;
    border-bottom: 1px solid #eef0f3;
    flex-wrap: nowrap;
}
.tm-topbar-tab {
    display: none;   /* desktop: ẩn theo mockup (chỉ hiện lại trên mobile) */
    align-items: center;
    gap: 8px;
    font-size: .82rem;
    font-weight: 800;
    color: #1e293b;
    letter-spacing: .3px;
    white-space: nowrap;
    flex-shrink: 0;
}
.tm-topbar-tab-ico {
    width: 28px;
    height: 28px;
    border-radius: 9px;
    background: #eef2ff;
    color: #6366f1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.tm-topbar-tab-ico svg { width: 15px; height: 15px; }

.tm-topbar-unlock {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 12px;
    padding: 7px 5px;
    transition: border-color .2s, box-shadow .2s;
}
.tm-topbar-unlock:focus-within {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}
.tm-topbar-unlock-ico {
    width: 16px;
    height: 16px;
    color: #9ca3af;
    flex-shrink: 0;
    display: inline-flex;
}
.tm-topbar-unlock-ico svg { width: 16px; height: 16px; }
.tm-topbar-unlock .tm-code-input {
    flex: 1;
    min-width: 0;
    font-size: 1.2rem;
    color: #1e293b;
    /* Reset CỨNG để CSS của theme WP không thêm viền/đổ bóng/đệm/chiều cao
       (nếu không sẽ xuất hiện hộp viền lồng bên trong ô nhập) */
    border: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
    border-radius: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    height: 40px !important;
    min-height: 0 !important;
    line-height: 40px !important;
    -webkit-appearance: none;
    appearance: none;
}

.tm-topbar-timer {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1px;
    flex-shrink: 0;
    padding-left: 16px;
    border-left: 1px solid #eef0f3;
}
.tm-topbar-timer-label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: .62rem;
    font-weight: 800;
    letter-spacing: .4px;
    color: #f97316;
    white-space: nowrap;
}
.tm-topbar-timer-ico { width: 13px; height: 13px; display: inline-flex; color: #f97316; }
.tm-topbar-timer-ico svg { width: 13px; height: 13px; }

@keyframes tmPopupIn {
    from { opacity:0; transform: scale(.93) translateY(14px); }
    to   { opacity:1; transform: scale(1)   translateY(0); }
}

/* ── Loading trong popup ────────────────────────────────────── */
.tm-popup-loading {
    text-align: center;
    padding: 48px 0;
    color: #6b7280;
}
.tm-popup-loading .tm-heart-pulse,
.tm-heart-pulse {
    font-size: 2.2rem;
    display: inline-block;
    animation: tmBeat .8s infinite;
}
@keyframes tmBeat {
    0%,100% { transform: scale(1); }
    50%      { transform: scale(1.25); }
}

/* ── Notice bar ─────────────────────────────────────────────── */
.tm-popup-notice {
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 8px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 18px;
    font-size: .85rem;
    color: #92400e;
}
.tm-popup-notice-close {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    color: #92400e;
    line-height: 1;
    flex-shrink: 0;
    padding: 0;
}

/* ── Title & Users ──────────────────────────────────────────── */
.tm-popup-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 8px;
    line-height: 1.4;
}
.tm-popup-users {
    font-size: .875rem;
    color: #6b7280;
    margin: 0 0 16px;
}

/* ── Benefits ───────────────────────────────────────────────── */
.tm-popup-benefits {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 9px;
}
.tm-benefit-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: .875rem;
    color: #15803d;
    line-height: 1.5;
}
.tm-benefit-icon { flex-shrink: 0; }

/* ── Instruction ────────────────────────────────────────────── */
.tm-popup-instruction {
    font-size: .9rem;
    color: #475569;
    margin: 0 0 16px;
    font-style: italic;
}

/* ── Steps (thẻ số tròn cam + header cam + thân trắng) ──────── */
/* Thẻ bước: nền cam rất nhạt, tiêu đề (số + chữ) trên cùng, nội dung là card trắng */
.tm-popup-step {
    counter-increment: tm-step;
    background: #fff7f0;
    border: 1px solid #ffe6d3;
    border-radius: 14px;
    margin-bottom: 14px;
    padding: 5px;
    box-shadow: 0 1px 2px rgba(0,0,0,.03);
}
/* Tiêu đề bước = huy hiệu số tròn cam (absolute) + chữ đậm chảy bình thường */
.tm-step-label {
    position: relative;
    background: transparent;
    border: none;
    margin: 0 0 12px;
    padding: 3px 0 3px 42px;   /* chừa chỗ huy hiệu số bên trái */
    font-size: .95rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.5;
}
.tm-step-label::before {
    content: counter(tm-step);
    position: absolute;
    left: 0;
    top: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #f97316;
    color: #fff;
    font-size: .92rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(249,115,22,.4);
}
.tm-step-label a {
    color: #2563eb;
    text-decoration: underline;
}
.tm-step-label strong { color: #1d4ed8; }
/* Nội dung trải hết bề ngang thân thẻ */
.tm-popup-step > :not(.tm-step-label) {
    margin-left: 0;
    margin-right: 0;
}
.tm-step-visual {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: .875rem;
    color: #475569;
}
.tm-step-icon { font-size: 1.2rem; flex-shrink: 0; }

/* ── Keyword ────────────────────────────────────────────────── */
.tm-keyword-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f0f9ff;
    border: 2px dashed #38bdf8;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 14px;
}
.tm-keyword {
    font-weight: 700;
    font-size: 1rem;
    color: #0369a1;
    flex: 1;
    word-break: break-all;
}
.tm-copy-btn {
    background: #0ea5e9;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 14px;
    font-size: .8rem;
    cursor: pointer;
    transition: background .2s;
    flex-shrink: 0;
    margin-bottom: 0px !important;
    margin-right: 0px !important;
}
.tm-copy-btn:hover  { background: #0284c7; }
.tm-copy-btn.copied { background: #16a34a; }

/* ── Google mock ────────────────────────────────────────────── */
.tm-google-mock {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
}

/* Logo Google căn giữa */
.tm-google-logo {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -1px;
    margin-bottom: 10px;
    text-align: center;   /* ← căn giữa */
}

.tm-google-search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f9fafb;
    border: 1px solid #d1d5db;
    border-radius: 24px;
    padding: 9px 16px;
    font-size: .9rem;
    color: #374151;
}
.tm-google-search-box svg { width: 16px; height: 16px; flex-shrink: 0; }
.tm-google-keyword-text { word-break: break-all; }
.tm-google-result-img {
    margin-top: 12px;
    border-radius: 8px;
    overflow: hidden;
}
.tm-google-result-img img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
}

/* ── External link button ───────────────────────────────────── */
.tm-external-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #2563eb;
    color: #fff !important;
    text-decoration: none !important;
    border-radius: 8px;
    padding: 10px 20px;
    font-size: .9rem;
    font-weight: 600;
    transition: background .2s;
    margin-top: 6px;
}
.tm-external-link-btn:hover { background: #1d4ed8; }

/* ── Share buttons ──────────────────────────────────────────── */
.tm-share-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 8px;
}
.tm-share-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 8px;
    padding: 9px 18px;
    font-size: .875rem;
    font-weight: 600;
    text-decoration: none !important;
    transition: opacity .2s;
}
.tm-share-btn:hover { opacity: .85; }
.tm-share-fb   { background: #1877f2; color: #fff !important; }
.tm-share-zalo { background: #0068ff; color: #fff !important; }

/* ── Unlock input / button (trên thanh trên cùng) ───────────── */
.tm-code-input.tm-shake { animation: tmShake .4s; }
.tm-topbar-unlock:has(.tm-shake) {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239,68,68,.12);
}
@keyframes tmShake {
    0%,100% { transform: translateX(0); }
    20%      { transform: translateX(-7px); }
    40%      { transform: translateX(7px); }
    60%      { transform: translateX(-4px); }
    80%      { transform: translateX(4px); }
}
.tm-popup-unlock-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    align-self: stretch;   /* cao bằng ô nhập mã (đẹp, thẳng hàng) */
    margin-bottom: 0 !important;
    margin-right: 0 !important;
    background: linear-gradient(135deg, #ff6a3d, #ef3e2e);
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 0 18px;
    font-size: .85rem;
    font-weight: 800;
    letter-spacing: .2px;
    cursor: pointer;
    white-space: nowrap;
    transition: filter .2s, opacity .2s;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(239,62,46,.3);
}
.tm-popup-unlock-btn .tm-unlock-btn-ico { width: 15px; height: 15px; display: inline-flex; }
.tm-popup-unlock-btn .tm-unlock-btn-ico svg { width: 15px; height: 15px; }
.tm-popup-unlock-btn:disabled          { opacity: .6; cursor: not-allowed; }
.tm-popup-unlock-btn:hover:not(:disabled) { filter: brightness(1.07); }
.tm-code-error {
    color: #ef4444;
    font-size: .85rem;
    margin: 0;
    padding: 8px 22px 0;
    display: none;
}

/* ── Mission wrap ───────────────────────────────────────────── */
.tm-mission-wrap {
    display: flex;
    flex-direction: column;
    counter-reset: tm-step;   /* đánh số bước cho huy hiệu tròn */
}
/* Tiêu đề hướng dẫn luôn trên đầu, thanh hành động luôn xuống đáy
   (footer.php include ở đầu template nhưng được đẩy xuống bằng order) */
.tm-mission-wrap > .tm-guide-head { order: -1; }
.tm-mission-wrap > .tm-action-bar { order: 10; }

/* ── Tiêu đề hướng dẫn (header.php) ─────────────────────────── */
.tm-guide-head {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
    /* Banner nền cam nhạt theo mockup */
    background: linear-gradient(135deg, #fff3e9, #ffe9d8);
    border: 1px solid #ffddc2;
    border-radius: 16px;
    padding: 16px 20px;
    position: relative;
    overflow: hidden;
}
.tm-guide-head-icon {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, #fb7a37, #f5511e);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 14px rgba(245,81,30,.35);
}
.tm-guide-head-icon svg { width: 26px; height: 26px; }
.tm-guide-head-title {
    font-size: 1.18rem;
    font-weight: 800;
    color: #1e293b;
    margin: 0 0 3px;
    letter-spacing: .2px;
    line-height: 1.25;
}
.tm-guide-head-sub {
    font-size: .82rem;
    font-weight: 700;
    color: #ea580c;
    margin: 0;
    line-height: 1.4;
    letter-spacing: .3px;
}
.tm-guide-head-hl { color: #ea580c; }
/* Ngôi sao lấp lánh trang trí góc phải */
.tm-guide-head-deco {
    margin-left: auto;
    flex-shrink: 0;
    display: inline-flex;
    align-items: flex-start;
    gap: 2px;
    color: #fcb98a;
}
.tm-guide-head-deco svg:first-child { width: 22px; height: 22px; }
.tm-guide-head-deco svg:last-child  { width: 14px; height: 14px; margin-top: 10px; }

/* ── Countdown (đồng hồ trên thanh trên cùng) ───────────────── */
.tm-countdown {
    font-size: 1.3rem;
    font-weight: 800;
    color: #ea580c;
    min-width: 56px;
    text-align: right;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    transition: color .3s;
}
.tm-countdown-urgent {
    color: #ef4444 !important;
    animation: tmCountdownBlink .8s infinite;
}
@keyframes tmCountdownBlink {
    0%,100% { opacity: 1; }
    50%      { opacity: .35; }
}

/* ── Timeout Overlay ────────────────────────────────────────── */
.tm-timeout-overlay {
    position: absolute;
    inset: 0;                          /* phủ toàn popup như cũ */
    background: rgba(255,255,255,.96);
    border-radius: 16px;
    z-index: 10;
    display: flex;
    align-items: flex-start;           /* align lên trên */
    justify-content: center;
    padding-top: 100px;                /* ← box thông báo cách top 100px */
}
.tm-timeout-box { text-align: center; max-width: 340px; }
.tm-timeout-icon {
    font-size: 3.2rem;
    margin-bottom: 14px;
    animation: tmTimeoutShake .5s ease;
    display: block;
}
@keyframes tmTimeoutShake {
    0%,100% { transform: rotate(0); }
    25%      { transform: rotate(-15deg); }
    75%      { transform: rotate(15deg); }
}
.tm-timeout-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: #ef4444;
    margin: 0 0 10px;
}
.tm-timeout-msg {
    font-size: .9rem;
    color: #64748b;
    line-height: 1.7;
    margin: 0 0 22px;
}
.tm-timeout-reload-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 13px 30px;
    font-size: .95rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity .2s, transform .1s;
}
.tm-timeout-reload-btn:hover  { opacity: .9; transform: translateY(-1px); }
.tm-timeout-reload-btn:active { transform: translateY(0); }

/* ── Retry button ───────────────────────────────────────────── */
.tm-retry-btn {
    display: block;
    margin: 12px auto 0;
    background: #6366f1;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 9px 24px;
    font-size: .9rem;
    cursor: pointer;
    transition: opacity .2s;
}
.tm-retry-btn:hover { opacity: .85; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 600px) {
    .tm-share-buttons { flex-direction: column; }
    .tm-share-btn     { justify-content: center; }
    /* Lưu ý: KHÔNG set padding cho .tm-popup ở mobile — popup phải giữ padding:0
       để thanh trên cùng nằm sát mép (flush). Tối ưu mobile gom ở cuối file. */
}


/* ── Success message ────────────────────────────────────────── */
.tm-success-msg {
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 8px;
    padding: 12px 16px;
    color: #16a34a;
    font-weight: 600;
    font-size: .95rem;
    text-align: center;
    margin-bottom: 16px;
    animation: tmFadeIn .3s ease;
}
@keyframes tmFadeIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}
/* ── Hình hướng dẫn delay countdown ────────────────────────── */
.tm-img-countdown-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f0f9ff;
    border: 1px dashed #38bdf8;
    border-radius: 8px;
    padding: 10px 14px;
    margin-top: 10px;
    font-size: .875rem;
    color: #0369a1;
}
.tm-img-countdown-icon { font-size: 1.2rem; flex-shrink: 0; }
.tm-img-countdown-text strong { font-size: 1rem; color: #0284c7; }

/* ── Gợi ý trang Google ─────────────────────────────────────── */
.tm-google-page-hint {
    margin-top: 10px;
    background: #fef3c7;
    border: 1px solid #fcd34d;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: .82rem;
    color: #92400e;
}

/* ── Guide image wrap (tim_tu_khoa) ─────────────────────────── */
.tm-guide-img-wrap img {
    max-width: 100%;
    border-radius: 8px;
    margin-top: 8px;
    border: 1px solid #e5e7eb;
}

/* ── Nút close popup (item trong thanh trên cùng) ──────── */
.tm-popup-close-btn {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border: none;
  background: #f3f4f6;
  border-radius: 50%;
  font-size: 15px;
  color: #6b7280;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background .15s, color .15s;
}
.tm-popup-close-btn:hover {
  background: #fee2e2;
  color: #dc2626;
}

/* ── AI Mode mock (type ai_mode) ────────────────────────────── */
.tm-ai-mode-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid #dfe1e5;
    border-radius: 24px;
    padding: 8px 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.tm-ai-mode-plus {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #5f6368;
    font-size: 1.4rem;
    flex-shrink: 0;
}
.tm-ai-mode-spacer { flex: 1; min-width: 0; }
.tm-ai-mode-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}
.tm-ai-mode-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 2px solid #ec4899;
    border-radius: 18px;
    padding: 5px 12px;
    font-size: .82rem;
    font-weight: 600;
    color: #5f6368;
    background: #fff;
    flex-shrink: 0;
    box-shadow: 0 0 0 3px rgba(236,72,153,.15);
}
.tm-ai-mode-btn svg {
    width: 14px;
    height: 14px;
    color: #ec4899;
    flex-shrink: 0;
}
.tm-ai-mode-hint {
    margin-top: 12px;
    background: #fdf2f8;
    border: 1px solid #f9a8d4;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: .82rem;
    color: #9d174d;
}

/* ── ChatGPT mock (type chatgpt) ────────────────────────────── */
.tm-chatgpt-mock {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.tm-chatgpt-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}
.tm-chatgpt-logo {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}
.tm-chatgpt-name {
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
}
.tm-chatgpt-input {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f4f4f4;
    border: 1px solid #e5e7eb;
    border-radius: 24px;
    padding: 12px 16px;
}
.tm-chatgpt-input-placeholder {
    flex: 1;
    color: #9ca3af;
    font-size: .9rem;
}
.tm-chatgpt-send {
    width: 28px;
    height: 28px;
    background: #000;
    color: #fff;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 700;
    flex-shrink: 0;
}

/* ── Grok mock (type grok) ──────────────────────────────────── */
.tm-grok-mock {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.tm-grok-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}
.tm-grok-logo {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}
.tm-grok-name {
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
    letter-spacing: -.01em;
}
.tm-grok-input {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f4f4f4;
    border: 1px solid #e5e7eb;
    border-radius: 24px;
    padding: 12px 16px;
}
.tm-grok-input-placeholder {
    flex: 1;
    color: #9ca3af;
    font-size: .9rem;
}
.tm-grok-send {
    width: 28px;
    height: 28px;
    background: #000;
    color: #fff;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 700;
    flex-shrink: 0;
}

/* ── YouTube mock (type youtube) ────────────────────────────── */
.tm-youtube-mock {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.tm-youtube-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 14px;
}
.tm-youtube-logo {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}
.tm-youtube-logo svg {
    width: 32px;
    height: 24px;
}
.tm-youtube-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f0f0f;
    letter-spacing: -.02em;
}
.tm-youtube-search {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f1f1f1;
    border: 1px solid #e5e7eb;
    border-radius: 24px;
    padding: 10px 16px;
}
.tm-youtube-search-placeholder {
    flex: 1;
    color: #9ca3af;
    font-size: .9rem;
}
.tm-youtube-search-icon {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}
.tm-youtube-search-icon svg {
    width: 18px;
    height: 18px;
}

/* ── Facebook mock (type facebook) ──────────────────────────── */
.tm-facebook-mock {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.tm-facebook-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
}
.tm-facebook-logo {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}
.tm-facebook-logo svg {
    width: 28px;
    height: 28px;
}
.tm-facebook-name {
    font-size: 1.15rem;
    font-weight: 800;
    color: #1877f2;
    letter-spacing: -.03em;
}
.tm-facebook-search {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f0f2f5;
    border: 1px solid #e5e7eb;
    border-radius: 50px;
    padding: 10px 16px;
}
.tm-facebook-search-icon {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}
.tm-facebook-search-icon svg {
    width: 16px;
    height: 16px;
}
.tm-facebook-search-placeholder {
    flex: 1;
    color: #65676b;
    font-size: .9rem;
}

/* ════════════════════════════════════════════════════════════
   THANH 4 HÀNH ĐỘNG (footer.php) — đáy popup
════════════════════════════════════════════════════════════ */
/* Thanh hành động: 3 mục inline (icon + 1 dòng chữ), căn giữa — theo mockup */
.tm-action-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 10px 30px;
    margin-top: 8px;
    padding-top: 14px;
    border-top: 1px solid #eef0f3;
}
.tm-action-item {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    background: none;
    border: none;
    padding: 4px 6px;
    cursor: pointer;
    font: inherit;
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
    box-shadow: none !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    color: #475569;
    transition: color .15s, transform .1s;
}
.tm-action-item:hover { color: #1e293b; }
.tm-action-static { cursor: default; }
.tm-action-static:hover { color: #475569; }
.tm-action-ico {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.tm-action-ico svg { width: 15px; height: 15px; }
.tm-action-ico-green { background: #dcfce7; color: #16a34a; }
.tm-action-ico-blue  { background: #dbeafe; color: #2563eb; }
.tm-action-ico-red   { background: #fee2e2; color: #dc2626; }
.tm-action-txt {
    font-size: .9rem;
    font-weight: 600;
    color: inherit;
    white-space: nowrap;
}

/* ════════════════════════════════════════════════════════════
   SUB-OVERLAY chung (video + báo lỗi)
════════════════════════════════════════════════════════════ */
.tm-sub-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.72);
    z-index: 100000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overscroll-behavior: contain;
}
.tm-sub-box {
    position: relative;
    background: #fff;
    border-radius: 16px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,.4);
    animation: tmPopupIn .25s cubic-bezier(.34,1.56,.64,1);
}
.tm-sub-close {
    position: absolute;
    top: -14px;
    right: -14px;
    width: 34px;
    height: 34px;
    border: none;
    background: #fff;
    color: #334155;
    border-radius: 50%;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,.25);
    z-index: 2;
    transition: background .15s, color .15s;
}
.tm-sub-close:hover { background: #fee2e2; color: #dc2626; }

/* ── Popup video ── */
.tm-video-box { max-width: 760px; }
.tm-video-frame {
    position: relative;
    width: 100%;
    padding-top: 56.25%;   /* 16:9 */
    border-radius: 16px;
    overflow: hidden;
    background: #000;
}
.tm-video-frame iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* ── Popup báo lỗi ── */
.tm-report-box {
    max-width: 440px;
    padding: 24px 22px 22px;
}
.tm-report-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: #dc2626;
    margin: 0 0 6px;
}
.tm-report-desc {
    font-size: .86rem;
    color: #64748b;
    margin: 0 0 16px;
    line-height: 1.5;
}
.tm-report-opts {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
}
.tm-report-opt {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f8fafc;
    border: 1.5px solid #eef0f3;
    border-radius: 10px;
    padding: 10px 13px;
    font-size: .88rem;
    color: #334155;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.tm-report-opt:hover { border-color: #fca5a5; }
.tm-report-opt input { accent-color: #dc2626; width: 16px; height: 16px; flex-shrink: 0; }
.tm-report-opt:has(input:checked) { border-color: #ef4444; background: #fef2f2; }
.tm-report-note {
    width: 100%;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    padding: 10px 12px;
    font: inherit;
    font-size: .88rem;
    resize: vertical;
    outline: none;
    box-sizing: border-box;
    margin-bottom: 12px;
}
.tm-report-note:focus { border-color: #6366f1; }
.tm-report-result { font-size: .85rem; margin: 0 0 12px; font-weight: 600; }
.tm-report-send {
    width: 100%;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 12px;
    font-size: .92rem;
    font-weight: 700;
    cursor: pointer;
    transition: filter .2s, opacity .2s;
}
.tm-report-send:hover:not(:disabled) { filter: brightness(1.06); }
.tm-report-send:disabled { opacity: .6; cursor: not-allowed; }

/* ════════════════════════════════════════════════════════════
   RESPONSIVE — thanh trên cùng & hành động xếp dọc trên mobile
════════════════════════════════════════════════════════════ */
@media (max-width: 680px) {
    .tm-popup-topbar {
        flex-wrap: wrap;
        gap: 9px;
    }
    /* Hàng 1: tab (giãn lấp đầy) + đồng hồ (gọn) + ✕ */
    .tm-topbar-tab { display: inline-flex; order: 1; flex: 1 1 auto; min-width: 0; }
    /* Đồng hồ gọn: ẩn nhãn "THỜI GIAN CÒN LẠI", chỉ còn số → đủ chỗ cho ✕ trên cùng hàng */
    .tm-topbar-timer { order: 2; flex-direction: row; align-items: center; gap: 5px; padding-left: 0; border-left: none; }
    .tm-topbar-timer-label { display: none; }
    .tm-countdown { font-size: 1.05rem; min-width: 0; }
    .tm-popup-close-btn { order: 3; }
    /* Ngắt dòng cứng: buộc ô nhập + nút xuống hàng 2 (dùng pseudo làm flex item rộng 100%) */
    .tm-popup-topbar::after { content: ""; flex-basis: 100%; height: 0; order: 4; }
    /* Hàng 2: ô nhập mã + nút NẰM CÙNG 1 HÀNG (mã chỉ 5-6 ký tự) */
    .tm-topbar-unlock { order: 5; flex: 1 1 0; padding: 4px 8px; }   /* basis 0 → không đẩy nút rớt hàng */
    .tm-popup-unlock-btn { order: 6; flex: 0 0 auto; }
    /* Ô nhập thấp lại còn ~30px */
    .tm-topbar-unlock .tm-code-input { height: 30px !important; line-height: 30px !important; }

    /* Giữ 2 cột cho thanh hành động (gọn chiều cao, không xếp 1 cột) */
    .tm-action-bar { grid-template-columns: 1fr 1fr; }
}

/* ════════════════════════════════════════════════════════════
   GOOGLE MOCK CHUẨN (logo màu + ô search) — theo mockup
   Dùng cho bước 1-2 các nhiệm vụ Google (ai_mode, tim_tu_khoa,
   click_2_trang, click_map, click_bao, default)
════════════════════════════════════════════════════════════ */
.tm-gg {
    background: #fff;
    border: 1px solid #e8eaed;
    border-radius: 14px;
    padding: 20px 18px;
    box-shadow: 0 2px 10px rgba(0,0,0,.06);
}

/* Logo Google màu */
.tm-gg-logo {
    font-family: Arial, "Helvetica Neue", sans-serif;
    font-weight: 500;
    letter-spacing: -1px;
    line-height: 1;
    display: inline-block;
}

/* ── Trang chủ Google (bước 1) ── */
.tm-gg-home { text-align: center; }
.tm-gg-home .tm-gg-logo { font-size: 2.3rem; margin-bottom: 16px; }

.tm-gg-search {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 480px;
    margin: 0 auto;
    background: #fff;
    border: 1px solid #dfe1e5;
    border-radius: 999px;
    padding: 11px 18px;
    box-shadow: 0 1px 6px rgba(32,33,36,.1);
}
.tm-gg-search-lens {
    display: inline-flex;
    flex-shrink: 0;
    color: #9aa0a6;
}
.tm-gg-search-lens svg { width: 18px; height: 18px; }
.tm-gg-search-text {
    flex: 1;
    text-align: left;
    color: #3c4043;
    font-size: .95rem;
    word-break: break-word;
    font-weight: 600;
}
.tm-gg-search-text.is-empty { color: #9aa0a6; font-weight: 400; }
.tm-gg-search-icons {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}
.tm-gg-search-icons svg { width: 20px; height: 20px; display: block; }
.tm-gg-search-icons .tm-gg-x { cursor: default; }
.tm-gg-search-icons .tm-gg-x svg { width: 16px; height: 16px; stroke: #70757a; }

/* Nút "Chế độ AI" nằm trong ô search (bên phải) — highlight + con trỏ tay */
.tm-gg-ai-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    border: 1.5px solid #4285f4;
    border-radius: 999px;
    padding: 4px 11px 4px 8px;
    margin-left: 2px;
    color: #1a73e8;
    font-weight: 600;
    font-size: .82rem;
    white-space: nowrap;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(66,133,244,.14);
    position: relative;
}
.tm-gg-ai-pill svg { width: 17px !important; height: 17px !important; color: #4285f4; flex-shrink: 0; }
.tm-gg-ai-pill::after {
    content: "👆";
    position: absolute;
    right: -4px;
    bottom: -15px;
    font-size: 1rem;
    transform: rotate(-12deg);
}

/* Hàng nút: Chế độ AI / Tìm trên Google */
.tm-gg-btns {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 18px;
    flex-wrap: wrap;
}
.tm-gg-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid #dadce0;
    border-radius: 10px;
    padding: 9px 18px;
    font-size: .88rem;
    color: #3c4043;
    background: #f8f9fa;
}
.tm-gg-btn-ai {
    background: #fff;
    border: 1.5px solid #4285f4;
    color: #1a73e8;
    font-weight: 600;
    box-shadow: 0 0 0 3px rgba(66,133,244,.14);
    position: relative;
}
.tm-gg-btn-ai svg { width: 16px; height: 16px; color: #4285f4; }
/* con trỏ tay nhấn vào nút AI */
.tm-gg-btn-ai::after {
    content: "👆";
    position: absolute;
    right: -10px;
    bottom: -14px;
    font-size: 1.1rem;
    transform: rotate(-15deg);
}

/* ── Chế độ AI Google (bước 2) ── */
.tm-gg-ai .tm-gg-ai-top {
    display: flex;
    align-items: center;
    gap: 20px;
    border-bottom: 1px solid #ebebeb;
    margin-bottom: 14px;
    overflow-x: auto;
}
.tm-gg-ai-top .tm-gg-logo { font-size: 1.35rem; flex-shrink: 0; }
.tm-gg-tabs { display: flex; gap: 18px; }
.tm-gg-tab {
    font-size: .85rem;
    color: #5f6368;
    white-space: nowrap;
    padding: 4px 0 10px;
    border-bottom: 3px solid transparent;
}
.tm-gg-tab.active {
    color: #1a73e8;
    font-weight: 600;
    border-bottom-color: #1a73e8;
}
.tm-gg-ai .tm-gg-search { max-width: none; }

/* ════════════════════════════════════════════════════════════
   TỐI ƯU MOBILE — giảm chiều cao để ít phải cuộn nhất có thể
   nhưng vẫn xem đủ nội dung. Đặt CUỐI FILE để thắng cascade.
════════════════════════════════════════════════════════════ */
@media (max-width: 600px) {

    /* Bớt khoảng trắng quanh popup → popup bắt đầu cao hơn, đỡ cuộn */
    .tm-popup-overlay { padding: 12px 8px; }
    .tm-popup         { max-width: 100%; }
    #tm-popup-content { padding: 12px 12px 16px; }

    /* Thanh trên cùng gọn lại */
    .tm-popup-topbar { padding: 9px 10px; }
    .tm-topbar-tab   { font-size: .74rem; }

    /* Tiêu đề hướng dẫn gọn */
    .tm-guide-head        { gap: 9px; margin-bottom: 12px; }
    .tm-guide-head-icon   { width: 30px; height: 30px; border-radius: 8px; }
    .tm-guide-head-icon svg { width: 17px; height: 17px; }
    .tm-guide-head-title  { font-size: 1rem; margin: 0 0 3px; }
    .tm-guide-head-sub    { font-size: .8rem; line-height: 1.4; }

    /* Thẻ bước: nhỏ padding/margin, huy hiệu số nhỏ lại */
    .tm-popup-step {
        margin-bottom: 10px;
        padding-bottom: 12px;
        border-radius: 10px;
    }
    .tm-step-label {
        padding: 10px 12px 10px 46px;
        font-size: .85rem;
        margin-bottom: 10px;
        line-height: 1.45;
    }
    .tm-step-label::before {
        width: 24px; height: 24px;
        left: 11px; top: 9px;
        font-size: .8rem;
    }
    .tm-popup-step > :not(.tm-step-label) {
        margin-left: 2px;
        margin-right: 2px;
    }

    /* Từ khoá + nút copy */
    .tm-keyword-wrap { padding: 8px 10px; margin-bottom: 10px; gap: 8px; }
    .tm-keyword      { font-size: .9rem; }
    .tm-copy-btn     { padding: 5px 11px; font-size: .75rem; }

    /* Mock Google gọn */
    .tm-gg                       { padding: 14px 12px; }
    .tm-gg-home .tm-gg-logo      { font-size: 1.8rem; margin-bottom: 12px; }
    .tm-gg-ai-top .tm-gg-logo    { font-size: 1.15rem; }
    .tm-gg-search                { padding: 8px 12px; gap: 8px; }
    .tm-gg-search-text           { font-size: .85rem; }
    .tm-gg-btns                  { margin-top: 12px; gap: 8px; }
    .tm-gg-btn                   { padding: 7px 12px; font-size: .8rem; }
    .tm-gg-tabs                  { gap: 14px; }
    .tm-gg-tab                   { font-size: .78rem; padding-bottom: 8px; }

    /* Khối gợi ý / step-visual gọn */
    .tm-google-page-hint { padding: 7px 10px; font-size: .78rem; margin-top: 8px; }
    .tm-step-visual      { padding: 8px 10px; font-size: .8rem; }
    .tm-ai-mode-hint     { padding: 7px 10px; font-size: .78rem; margin-top: 10px; }

    /* ẢNH — giới hạn chiều cao để 1 ảnh không chiếm cả màn hình.
       Giữ tỉ lệ, căn giữa; ảnh cao sẽ co lại còn ~60% chiều cao màn hình. */
    .tm-google-result-img img,
    .tm-guide-img-wrap img,
    .tm-google-result-img,
    .tm-guide-img-wrap {
        margin-top: 2px;
    }
    .tm-popup-step img {
        width: auto !important;
        height: auto !important;
        max-width: 100% !important;
        max-height: 60vh !important;
        margin-left: auto !important;
        margin-right: auto !important;
        display: block !important;
    }

    /* Thanh hành động gọn (vẫn 2 cột) */
    .tm-action-bar       { gap: 8px; padding-top: 12px; }
    .tm-action-item      { padding: 8px 9px; gap: 8px; border-radius: 10px; }
    .tm-action-ico       { width: 30px; height: 30px; }
    .tm-action-ico svg   { width: 15px; height: 15px; }
    .tm-action-txt       { font-size: .72rem; line-height: 1.25; }
    .tm-action-txt strong { font-size: .76rem; }
}

/* Điện thoại nhỏ (≤380px) — siết thêm chút nữa */
@media (max-width: 380px) {
    .tm-topbar-tab        { font-size: .68rem; }
    .tm-popup-unlock-btn  { font-size: .78rem; padding: 0 12px; }
    .tm-guide-head-title  { font-size: .92rem; }
    .tm-popup-step img    { max-height: 56vh !important; }
}

/* ════════════════════════════════════════════════════════════
   MOBILE — GIẢM FONT-SIZE TOÀN BỘ ~20% (gọn hơn nữa)
   Đặt cuối file để thắng cascade. Chỉ ảnh hưởng trong popup,
   KHÔNG đụng font của theme (không động tới html/body root).
════════════════════════════════════════════════════════════ */
@media (max-width: 600px) {
    /* Thanh trên cùng */
    .tm-topbar-tab                       { font-size: .66rem; }
    .tm-topbar-unlock .tm-code-input     { font-size: .95rem; }
    .tm-popup-unlock-btn                 { font-size: .68rem; }
    .tm-countdown                        { font-size: .82rem; }

    /* Tiêu đề hướng dẫn */
    .tm-guide-head-title                 { font-size: .95rem; }
    .tm-guide-head-sub                   { font-size: .72rem; }

    /* Thẻ bước */
    .tm-step-label                       { font-size: .74rem; }
    .tm-step-label::before               { font-size: .72rem; }

    /* Từ khoá + copy */
    .tm-keyword                          { font-size: .8rem; }
    .tm-copy-btn                         { font-size: .66rem; }

    /* Mock Google */
    .tm-gg-home .tm-gg-logo              { font-size: 1.85rem; }
    .tm-gg-ai-top .tm-gg-logo            { font-size: 1.1rem; }
    .tm-gg-search-text                   { font-size: .76rem; }
    .tm-gg-btn                           { font-size: .7rem; }
    .tm-gg-tab                           { font-size: .68rem; }

    /* Khối gợi ý / step-visual */
    .tm-google-page-hint                 { font-size: .66rem; }
    .tm-step-visual                      { font-size: .72rem; }
    .tm-step-icon                        { font-size: .95rem; }
    .tm-ai-mode-hint                     { font-size: .66rem; }

    /* Thanh hành động */
    .tm-action-txt                       { font-size: .62rem; }
    .tm-action-txt strong                { font-size: .66rem; }

    /* Popup báo lỗi */
    .tm-report-title                     { font-size: .92rem; }
    .tm-report-desc                      { font-size: .7rem; }
    .tm-report-opt                       { font-size: .72rem; }
    .tm-report-note                      { font-size: .72rem; }
    .tm-report-send                      { font-size: .76rem; }
}
@media (max-width: 380px) {
    .tm-guide-head-title { font-size: .88rem; }
}

/* ════════════════════════════════════════════════════════════
   MOBILE — ẩn nút trang trí trên các mockup cho gọn
   (Giữ nút "Chế độ AI" vì là thao tác chính của ai_mode)
════════════════════════════════════════════════════════════ */
@media (max-width: 600px) {
    /* Mockup Google (mode search): ẩn nút phụ "Tìm trên Google" / "Xem nhanh" + cả hàng */
    .tm-gg-btns { display: none; }

    /* Nút "Chế độ AI" trong ô search: chỉ hiện icon kính lúp + ngôi sao (ẩn chữ) */
    .tm-gg-ai-pill-text { display: none; }
    .tm-gg-ai-pill      { padding: 4px 7px; }

    /* Mockup ChatGPT / Grok: ẩn nút gửi (↑) trang trí */
    .tm-chatgpt-send,
    .tm-grok-send { display: none; }
}
