/* =========================================================
   EduLabs – Trò chơi "Ong tìm mật" (engine-ong-tim-mat.js)
   Mọi lớp có tiền tố otm- (không dùng tên lớp chung như .pick/.show/.no đứng riêng
   ở phạm vi toàn trang – trạng thái chỉ dùng kèm .otm-card).
   Sân chơi cố định 1280 × 720, phóng to/thu nhỏ đồng đều theo khung chứa.
   ========================================================= */
.ge-stage .otm-host, .gp-host.otm-host { position: absolute; inset: 0; }
.ge-stage.otm-host { position: relative; inset: auto; }
.otm-host img { max-width: none; }
.otm-host { overflow: hidden; background: #8fd3f5; font-family: "Be Vietnam Pro", "Segoe UI", system-ui, sans-serif; user-select: none; -webkit-user-select: none; }
.otm-host * { box-sizing: border-box; }
.otm-backdrop { position: absolute; inset: 0; background-size: cover; background-position: center; }
.otm-layer { position: absolute; left: 0; top: 0; width: 1280px; height: 720px; transform-origin: 0 0; overflow: hidden; }
.otm-bg { position: absolute; inset: 0; background-size: 100% 100%; }

/* ---------- vườn hoa ---------- */
.otm-flower { position: absolute; transform-origin: 50% 100%; animation: otm-sway 3.4s ease-in-out infinite alternate; }
.otm-flower.f1 { animation-duration: 3.9s; animation-delay: -1.2s; }
.otm-flower.f2 { animation-duration: 3.1s; animation-delay: -.6s; }
.otm-flower.f3 { animation-duration: 4.2s; animation-delay: -2s; }
.otm-flower img { display: block; width: 100%; height: 100%; transform-origin: 50% 100%; }
.otm-flower.bounce img { animation: otm-fbounce .6s ease-out; }
@keyframes otm-sway { from { transform: rotate(-1.6deg); } to { transform: rotate(1.6deg); } }
@keyframes otm-fbounce { 0% { transform: scale(1, 1); } 30% { transform: scale(1.04, .95); } 60% { transform: scale(.98, 1.03); } 100% { transform: scale(1, 1); } }

/* ---------- tổ ong (treo trên cành cây của nền) ---------- */
.otm-hive { position: absolute; transform-origin: 49.6% 15%; animation: otm-hsway 4.6s ease-in-out infinite alternate; }
.otm-hive img { display: block; width: 100%; height: auto; transition: opacity .5s; }
.otm-hive .h1 { position: absolute; left: 0; top: 0; opacity: 0; }
.otm-hive.open .h1 { opacity: 1; } .otm-hive.open .h0 { opacity: 0; }
.otm-hglow { position: absolute; left: 50%; top: 62%; width: 150px; height: 150px; margin: -75px 0 0 -75px; border-radius: 50%; background: radial-gradient(circle, rgba(255,236,140,.75), rgba(255,220,90,0) 68%); opacity: 0; pointer-events: none; transition: opacity .5s; }
.otm-hive.open .otm-hglow { opacity: 1; animation: otm-glow 1.6s ease-in-out infinite alternate; }
@keyframes otm-hsway { from { transform: rotate(-1deg); } to { transform: rotate(1deg); } }
@keyframes otm-glow { from { transform: scale(.85); } to { transform: scale(1.12); } }

/* ---------- hũ mật ---------- */
.otm-jar { position: absolute; transform-origin: 50% 100%; }
.otm-jar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity .45s; }
.otm-jar img.on { opacity: 1; }
.otm-jshadow { position: absolute; left: 6%; right: 6%; bottom: -7px; height: 16px; border-radius: 50%; background: radial-gradient(ellipse, rgba(40,70,10,.38), rgba(40,70,10,0) 70%); }
.otm-jar.wob { animation: otm-wob .55s ease-out; }
@keyframes otm-wob { 0% { transform: scale(1, 1); } 35% { transform: scale(1.07, .93); } 65% { transform: scale(.97, 1.04); } 100% { transform: scale(1, 1); } }

/* ---------- ong, vệt bay, hiệu ứng ---------- */
.otm-fx { position: absolute; inset: 0; pointer-events: none; }
.otm-sp { position: absolute; pointer-events: none; will-change: transform, opacity; }
.otm-sp.drop { z-index: 2; }
.otm-bee { position: absolute; left: 0; top: 0; transform-origin: 50% 50%; pointer-events: none; will-change: transform; z-index: 3; }
.otm-bee img { display: block; width: 100%; height: 100%; }

/* ---------- thanh thông tin phía trên ---------- */
.otm-hud { position: absolute; left: 10px; right: 12px; top: 8px; height: 60px; display: flex; align-items: center; gap: 9px; z-index: 5; }
.otm-logo { height: 96px; width: auto; margin: 42px 2px 0 0; flex: none; pointer-events: none; }
.otm-pill { height: 46px; flex: none; display: inline-flex; align-items: center; white-space: nowrap; border-style: solid; border-width: 0 23px 0 56px; border-image-slice: 0 20% 0 50% fill; border-image-repeat: stretch; padding: 7px 20px 0 8px; }
.otm-pill b { font-size: 18px; font-weight: 800; color: #6a3805; letter-spacing: .1px; }
.otm-pill.pop b { animation: otm-pop .5s ease-out; display: inline-block; }
.otm-time.warn b { color: #d9480f; animation: otm-pulse .5s ease-in-out infinite alternate; display: inline-block; }
.otm-pill[hidden], .otm-chip[hidden] { display: none; }
.otm-chip { height: 40px; flex: none; display: inline-flex; align-items: center; gap: 4px; padding: 0 12px; border-radius: 99px; background: linear-gradient(#fff9e6, #fdebb8); border: 3px solid #f2b52b; box-shadow: 0 3px 0 #c98410; white-space: nowrap; }
.otm-team b { font-size: 16px; color: #6a3805; } .otm-team span { font-size: 16px; font-weight: 700; color: #8a5a1a; }
.otm-heart { width: 22px; height: 22px; fill: #ef476f; stroke: #fff; stroke-width: 1.5; }
.otm-heart.off { fill: #e4cfa6; }
.otm-gap { flex: 1; min-width: 0; }
.otm-btn { flex: none; width: 57px; height: 50px; padding: 0; border: 0; background: none; cursor: pointer; transition: transform .15s; }
.otm-btn img { display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.otm-btn:hover { transform: scale(1.07); } .otm-btn:active { transform: scale(.95); }
.otm-host:not(.otm-inplayer) .otm-btn { visibility: hidden; }
.otm-hud.tight { gap: 6px; }
.otm-hud.tight .otm-logo { height: 80px; margin-top: 24px; }
.otm-hud.tight .otm-pill b { font-size: 15px; } .otm-hud.tight .otm-pill { padding: 6px 14px 0 6px; }
.otm-hud.tight .otm-pill { border-width: 0 20px 0 50px; height: 41px; }
@keyframes otm-pop { 0% { transform: scale(1); } 40% { transform: scale(1.35); color: #2f9e44; } 100% { transform: scale(1); } }
@keyframes otm-pulse { from { transform: scale(1); } to { transform: scale(1.12); } }

/* ---------- câu hỏi ---------- */
.otm-q { position: absolute; left: 50px; top: 432px; width: 1180px; height: 92px; z-index: 4; border-style: solid; border-width: 0 140px 0 131px; border-image-slice: 0 16% 0 15% fill; transition: opacity .4s; }
.otm-q.tall { left: 40px; width: 908px; top: 334px; height: 190px; border-width: 0 158px 0 158px; border-image-slice: 0 17% 0 17% fill; }
.otm-qt { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px 10px; text-align: center; font-size: 32px; font-weight: 800; line-height: 1.16; color: #5a3000; padding: 16px 18px 18px; overflow: hidden; }
.otm-q.tall .otm-qt { padding: 32px 14px 28px; flex-direction: column; flex-wrap: nowrap; gap: 4px; }
.otm-qt.ph { color: #b08a55; font-weight: 600; }
.otm-img { max-height: 110px; max-width: 280px; border-radius: 10px; vertical-align: middle; object-fit: contain; }
.otm-q.tall .otm-img { max-height: 96px; }
.otm-frac { display: inline-flex; flex-direction: column; vertical-align: middle; text-align: center; line-height: 1; margin: 0 2px; font-size: .82em; }
.otm-frac > span:first-child { border-bottom: 2px solid currentColor; padding: 0 3px 1px; }
.otm-frac > span:last-child { padding: 1px 3px 0; }
.otm-ov { text-decoration: overline; }

/* ---------- thẻ đáp án (giữ nguyên huy hiệu chữ cái và giọt mật, chỉ kéo dài đoạn viền thẳng ở giữa) ---------- */
.otm-cards { position: absolute; inset: 0; z-index: 4; pointer-events: none; transition: opacity .4s; }
.otm-card { position: absolute; pointer-events: auto; padding: 0; margin: 0; background: none; cursor: default; font: inherit; color: #4a2800;
  border-style: solid; border-width: 0 62px 0 59px; border-image-slice: 0 38% 0 36% fill; border-image-repeat: stretch; transition: transform .16s, opacity .3s, filter .3s; }
.otm-ct { position: absolute; inset: 20px 20px 12px 22px; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 2px 8px; text-align: center; font-size: 28px; font-weight: 800; line-height: 1.1; overflow: hidden; }
.otm-card.ph .otm-ct { color: #b8996a; }
.otm-play .otm-card { cursor: pointer; }
.otm-play .otm-card:not(.no):hover { transform: translateY(-3px) scale(1.015); }
.otm-play .otm-card[data-l="a"]:not(.no):hover { border-image-source: url("../games/ong-tim-mat/card-a-hi.webp") !important; }
.otm-play .otm-card[data-l="b"]:not(.no):hover { border-image-source: url("../games/ong-tim-mat/card-b-hi.webp") !important; }
.otm-play .otm-card[data-l="c"]:not(.no):hover { border-image-source: url("../games/ong-tim-mat/card-c-hi.webp") !important; }
.otm-play .otm-card[data-l="d"]:not(.no):hover { border-image-source: url("../games/ong-tim-mat/card-d-hi.webp") !important; }
.otm-card.picked { transform: scale(.98); }
.otm-card.ok { filter: drop-shadow(0 0 10px rgba(110,220,80,.85)); }
.otm-card.ok .otm-ct { color: #1f6b12; }
.otm-card.glow { animation: otm-okglow .9s ease-out 2; }
.otm-card.no .otm-ct { color: #a8261c; }
.otm-card.dim { filter: saturate(.45) brightness(.93); }
.otm-card.dim .otm-ct { color: #8a7350; }
.otm-card.shake { animation: otm-shake .42s ease-in-out; }
.otm-card .otm-img { max-height: 62px; max-width: 120px; }
@keyframes otm-shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-7px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }
@keyframes otm-okglow { 0% { transform: scale(1); } 40% { transform: scale(1.03); } 100% { transform: scale(1); } }
/* thẻ cao khi phương án có hình ảnh */
.otm-card.t { border: 0; }
.otm-tbg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.otm-card.t .otm-ct { inset: 24% 8% 9% 8%; font-size: 24px; }
.otm-card.t .otm-img { max-height: 92px; max-width: 200px; }
.otm-badge { position: absolute; right: -8px; top: -10px; width: 54px; opacity: 0; transform: scale(.4); transition: opacity .25s, transform .3s cubic-bezier(.3,1.6,.5,1); pointer-events: none; }
.otm-badge.on { opacity: 1; transform: scale(1); }
.otm-card.t.no { filter: drop-shadow(0 0 8px rgba(230,60,50,.8)); }

/* ---------- lời nhắn ngắn ---------- */
.otm-fb { position: absolute; left: 50%; top: 380px; z-index: 6; transform: translate(-50%, 8px); padding: 6px 22px 7px; border-radius: 99px; background: linear-gradient(#fffdf2, #fff1c6); border: 3px solid #f2b52b; box-shadow: 0 4px 0 #c98410; font-size: 21px; font-weight: 800; color: #6a3805; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; }
.otm-fb.on { opacity: 1; transform: translate(-50%, 0); }
.otm-fb.ok { color: #23801a; border-color: #8fd14f; box-shadow: 0 4px 0 #4f9a1e; }
.otm-fb.no { color: #b4441e; }
.otm-fb { display: flex; align-items: center; gap: 6px; } .otm-fb .otm-img { max-height: 34px; max-width: 60px; border-radius: 6px; }

/* ---------- tải ảnh ---------- */
.otm-loading { position: absolute; inset: 0; z-index: 9; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; background: rgba(255,248,220,.82); font-size: 22px; font-weight: 800; color: #8a5200; }
.otm-loading img { width: 120px; animation: otm-pulse .7s ease-in-out infinite alternate; }

/* ---------- tạm dừng / kết thúc ---------- */
.otm-paused *, .otm-paused *::before, .otm-paused *::after { animation-play-state: paused !important; }
.otm-ending .otm-q, .otm-ending .otm-cards, .otm-ending .otm-fb, .otm-over .otm-q, .otm-over .otm-cards, .otm-over .otm-fb { opacity: 0; pointer-events: none; }
.otm-over .otm-bee, .otm-over 
/* ---------- màn tổng kết ---------- */
.otm-sum { position: absolute; inset: 0; z-index: 8; opacity: 0; transition: opacity .6s ease; }
.otm-sum.in { opacity: 1; }
.otm-sbg { position: absolute; inset: 0; background-size: 100% 100%; }
.otm-sscene img { position: absolute; display: block; height: auto; }
.otm-shive { transform-origin: 49.6% 15%; animation: otm-hsway 4.6s ease-in-out infinite alternate; }
.otm-sbee { animation: otm-bob 1.6s ease-in-out infinite alternate; }
.otm-sbee.p-cheer { animation: otm-hop .9s ease-in-out infinite alternate; }
@keyframes otm-bob { from { transform: translateY(-5px); } to { transform: translateY(5px); } }
@keyframes otm-hop { from { transform: translateY(2px) rotate(-2deg); } to { transform: translateY(-12px) rotate(2deg); } }
.otm-conf { position: absolute; left: 0; top: 0; width: 1280px; height: 720px; pointer-events: none; z-index: 3; }
.otm-board { position: absolute; left: 31px; top: 112px; width: 720px; height: 546px; z-index: 2; display: flex; flex-direction: column; align-items: center; padding: 6px 30px 0; }
/* bảng dựng bằng CSS (kết quả chưa xuất sắc – vẽ đúng hũ mật và biểu cảm ong) */
.otm-board.css { top: 104px; height: 560px; border-radius: 40px; background: linear-gradient(#fffaf0, #fff0c9); border: 11px solid #f7b928; box-shadow: inset 0 0 0 4px #ffe58a, 0 8px 0 #c98410, 0 14px 30px rgba(80,50,0,.28); }
.otm-board.css::before { content: ""; position: absolute; left: 30px; right: 30px; top: -11px; height: 26px; background: radial-gradient(circle at 10% 0, #f7b928 13px, transparent 14px) 0 0 / 90px 26px repeat-x; pointer-events: none; }
.otm-stitle { position: absolute; left: 174px; top: -90px; width: 410px; height: 107px; overflow: visible; pointer-events: none; }
.otm-board.css .otm-stitle { top: -84px; left: 156px; }
.otm-stitle .rb { fill: #f7b928; stroke: #c98410; stroke-width: 4; }
.otm-stitle text { font-family: "Be Vietnam Pro", "Segoe UI", system-ui, sans-serif; font-size: 36px; font-weight: 900; letter-spacing: .5px; }
.otm-stitle .ex { fill: #8a4400; stroke: #8a4400; stroke-width: 7; stroke-linejoin: round; }
.otm-stitle .fg { fill: #fff6c8; stroke: #a0560a; stroke-width: 6; stroke-linejoin: round; paint-order: stroke; }
.otm-stars { display: flex; gap: 14px; align-items: flex-end; height: 76px; margin-top: 4px; }
.otm-stars img { width: 66px; filter: grayscale(1) opacity(.35); }
.otm-stars img:nth-child(2) { width: 80px; }
.otm-stars img.on { filter: none; animation: otm-star .55s cubic-bezier(.3,1.6,.5,1) both; animation-delay: var(--d); }
@keyframes otm-star { from { transform: scale(0) rotate(-40deg); } to { transform: scale(1) rotate(0); } }
.otm-smsg { margin: 6px 0 10px; font-size: 22px; font-weight: 800; color: #6a3805; text-align: center; line-height: 1.2; min-height: 27px; }
.otm-tiles { display: grid; grid-template-columns: repeat(3, 190px); gap: 12px; }
.otm-tile { height: 120px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; border-radius: 18px; background: rgba(255,255,255,.78); border: 3px solid #f4c04a; box-shadow: 0 3px 0 rgba(201,132,16,.35); }
.otm-tile img { height: 44px; width: auto; }
.otm-tile b { font-size: 29px; font-weight: 900; color: #6a3805; line-height: 1.05; }
.otm-tile span { font-size: 15px; font-weight: 700; color: #8a5a1a; }
.otm-tile.ok b { color: #2b8a1e; } .otm-tile.no b { color: #c0392b; }
.otm-tile.hn img { height: 50px; } .otm-tile.rw img { height: 54px; }
.otm-tile b:empty { display: none; }
.otm-tile.rw b:empty ~ span { margin-top: 6px; }
.otm-rank { list-style: none; display: flex; gap: 10px; margin: 10px 0 0; padding: 0; }
.otm-rank li { display: flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 99px; background: #fff7dc; border: 2px solid #f4c04a; font-size: 15px; color: #6a3805; }
.otm-rank li.top { background: #fff0a8; border-color: #f2a400; }
.otm-rank em { font-style: normal; font-weight: 800; }
.otm-sact { position: absolute; left: 0; right: 0; bottom: 52px; display: flex; justify-content: center; gap: 10px; }
.otm-board.css .otm-sact { bottom: 34px; }
.otm-bdeco { position: absolute; bottom: 10px; width: 104px; pointer-events: none; }
.otm-bdeco.l { left: 6px; transform: rotate(-8deg); } .otm-bdeco.r { right: 6px; transform: scaleX(-1) rotate(-8deg); }
.otm-sbtn { height: 50px; padding: 0 18px; border-radius: 99px; border: 3px solid #fff3b0; background: linear-gradient(#ffd84d, #f5a300); box-shadow: 0 5px 0 #c26d00; color: #6b3300; font: inherit; font-size: 19px; font-weight: 800; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: transform .12s; white-space: nowrap; }
.otm-sbtn:hover { transform: translateY(-2px); } .otm-sbtn:active { transform: translateY(2px); box-shadow: 0 2px 0 #c26d00; }
.otm-sbtn.cta { background: linear-gradient(#9be15d, #3fa21f); border-color: #e3ffc7; box-shadow: 0 5px 0 #2c7413; color: #fff; text-shadow: 0 1px 1px rgba(0,60,0,.4); }
.otm-sbtn.exit img { width: 30px; height: 30px; object-fit: contain; margin-left: -8px; }
.otm-sum.garden .otm-board.css { animation: otm-boardin .5s cubic-bezier(.3,1.4,.5,1) both; }
@keyframes otm-boardin { from { transform: scale(.9); } to { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) {
  .otm-flower, .otm-hive, .otm-shive, .otm-sbee { animation: none !important; }
}
