/* --- AIO Video - Online / Offline: the pop-up, the saved-copy strip, the offline page and Signal Keeper. Author: MD OMAR FARUK | www.faruk.bd | Copyright (c) 2026 --- */
/* the plugin's own colours, from the site's theme when it has them (the offline pages carry no theme) */
:root { --aioo-card: var(--card, #ffffff); --aioo-ink: var(--ink, #10141c); --aioo-muted: var(--muted, #606a7d); --aioo-line: var(--line, #e5e8ef); --aioo-bg: var(--bg, #ffffff);
  --aioo-ok: #18a957; --aioo-bad: #e5484d; --aioo-shadow: 0 12px 32px rgba(16, 20, 28, .18); --aioo-brand: var(--aioo-accent, var(--brand, #2f6fed)); }
html[data-mode="dark"] { --aioo-card: var(--card, #161b24); --aioo-ink: var(--ink, #e9edf5); --aioo-muted: var(--muted, #94a0b6); --aioo-line: var(--line, #232b38); --aioo-bg: var(--bg, #0f1218); --aioo-shadow: 0 12px 32px rgba(0, 0, 0, .5); }
.aioo-pop, .aioo-back { position: fixed; z-index: 10050; left: 50%; top: 14px; width: min(460px, calc(100% - 24px)); display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 14px 14px 16px; background: var(--aioo-card); color: var(--aioo-ink); border: 1px solid var(--aioo-line); border-radius: 16px; box-shadow: var(--aioo-shadow);
  transform: translate(-50%, -24px); opacity: 0; transition: transform .35s cubic-bezier(.2,.9,.3,1.2), opacity .25s; overflow: hidden; }
.aioo-pop::before, .aioo-back::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: #f08c00; }
.aioo-pop.is-on::before, .aioo-back::before { background: var(--aioo-ok); }
.aioo-pop.show, .aioo-back.show { transform: translate(-50%, 0); opacity: 1; }
.aioo-pop[hidden], .aioo-back[hidden] { display: none; }
.aioo-pop-ico { flex: none; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: #fff4e0; color: #e8590c; }
.aioo-pop.is-on .aioo-pop-ico { background: rgba(24,169,87,.14); color: var(--aioo-ok); }
.aioo-pop-ico svg, .aioo-ico svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 3.4; stroke-linecap: round; }
.aioo-pop-ico circle, .aioo-ico circle { fill: currentColor; stroke: none; }
.aioo-pop-ico .a1, .aioo-pop-ico .a2, .aioo-pop-ico .a3, .aioo-ico .a1, .aioo-ico .a2, .aioo-ico .a3 { animation: aioo-fade 1.8s ease-in-out infinite; }
.aioo-pop-ico .a2, .aioo-ico .a2 { animation-delay: .2s; } .aioo-pop-ico .a3, .aioo-ico .a3 { animation-delay: .4s; }
.aioo-pop-ico .x, .aioo-ico .x { stroke-dasharray: 46; stroke-dashoffset: 46; animation: aioo-draw .6s .2s ease-out forwards; }
.aioo-pop.is-on .a1, .aioo-pop.is-on .a2, .aioo-pop.is-on .a3 { animation: aioo-light .5s ease-out both; opacity: .2; }
.aioo-pop.is-on .a2 { animation-delay: .15s; } .aioo-pop.is-on .a3 { animation-delay: .3s; }
@keyframes aioo-fade { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }
@keyframes aioo-draw { to { stroke-dashoffset: 0; } }
@keyframes aioo-light { to { opacity: 1; } }
.aioo-pop-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; padding-top: 2px; }
.aioo-pop-body b { font-size: 16px; }
.aioo-pop-body > span { color: var(--aioo-muted); font-size: 14px; line-height: 1.4; }
.aioo-pop-game { align-self: flex-start; display: inline-flex; align-items: center; gap: 7px; margin-top: 8px; padding: 7px 14px 7px 10px; border-radius: 999px; background: var(--aioo-brand); color: #fff !important; font-weight: 600; font-size: 14px; }
.aioo-pop-game:hover { background: var(--aioo-brand); }
.aioo-pop-game svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.aioo-pop-x { flex: none; width: 30px; height: 30px; border: 0; border-radius: 50%; background: transparent; color: var(--aioo-muted); font-size: 22px; line-height: 1; cursor: pointer; }
.aioo-pop-x:hover { background: rgba(127,127,127,.14); }
html[data-mode="dark"] .aioo-pop-ico { background: #3b2a12; color: #ffa94d; }

/* the saved-copy strip and the queue pill */
/* AIO Video's header is fixed over the top of the page: the strip is a pill of its own at the bottom, where nothing covers it */
.aioo-strip { position: fixed; z-index: 10030; left: 16px; bottom: 16px; max-width: calc(100% - 32px); display: flex; align-items: center; gap: 8px; padding: 8px 14px 8px 12px; border-radius: 999px;
  background: #fff4e0; color: #8a4b00; font: 600 13px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; border: 1px solid #ffd8a8; box-shadow: var(--aioo-shadow); }
@media (max-width: 640px) { .aioo-strip { left: 50%; transform: translateX(-50%); width: max-content; bottom: calc(68px + env(safe-area-inset-bottom)); border-radius: 14px; } }
.aioo-strip svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
html[data-mode="dark"] .aioo-strip { background: #3b2a12; color: #ffc078; border-color: #5a3d16; }
.aioo-q { position: fixed; z-index: 10040; left: 16px; bottom: 16px; display: inline-flex; align-items: center; gap: 7px; padding: 7px 14px 7px 10px; border-radius: 999px;
  border: 1px solid var(--aioo-line); background: var(--aioo-card); color: var(--aioo-ink); font: 600 13px system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; box-shadow: var(--aioo-shadow); cursor: pointer; }
.aioo-q[hidden] { display: none; }
.aioo-q svg { width: 18px; height: 18px; fill: none; stroke: var(--aioo-brand); stroke-width: 2; stroke-linecap: round; animation: aioo-spin 2.4s linear infinite; }
@keyframes aioo-spin { to { transform: rotate(360deg); } }

@media (max-width: 640px) {
  .aioo-pop, .aioo-back { top: auto; bottom: 0; left: 0; width: 100%; border-radius: 20px 20px 0 0; border-bottom: 0; padding-bottom: calc(16px + env(safe-area-inset-bottom)); transform: translateY(100%); }
  .aioo-pop.show, .aioo-back.show { transform: translateY(0); }
  .aioo-pop::before, .aioo-back::before { left: 0; right: 0; bottom: auto; width: auto; height: 4px; }
  .aioo-q { bottom: calc(70px + env(safe-area-inset-bottom)); left: 12px; }
}

/* the offline page and the game page */
.aioo-off { max-width: 820px; margin: 0 auto; padding: 28px 16px 40px; }
.aioo-off-head { text-align: center; margin-bottom: 20px; }
.aioo-off-head h1 { margin: 10px 0 6px; font-size: 26px; }
.aioo-off-head p { margin: 0 auto 6px; max-width: 520px; }
.aioo-ico { width: 76px; height: 76px; margin: 0 auto; border-radius: 22px; display: grid; place-items: center; background: #fff4e0; color: #e8590c; }
.aioo-ico svg { width: 46px; height: 46px; }
html[data-mode="dark"] .aioo-ico { background: #3b2a12; color: #ffa94d; }
.aioo-miss { color: #b35c00; font-weight: 600; }
.aioo-acts { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.aioo-back { align-items: center; flex-wrap: wrap; }
.aioo-back-ico { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: rgba(24,169,87,.14); color: var(--aioo-ok); }
.aioo-back-ico svg { width: 20px; height: 20px; }
.aioo-back b { flex: 1; min-width: 160px; font-size: 15px; }
.aioo-back-acts { display: flex; gap: 6px; }
.aioo-off.full { max-width: 1000px; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; padding: 12px 12px 16px; }
.aioo-off-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.aioo-off-brand { text-decoration: none; display: inline-flex; align-items: center; gap: 8px; color: var(--aioo-ink) !important; font-size: 18px; }
.aioo-off-brand img { border-radius: 8px; }
body.aioo-gamebody { background: var(--aioo-bg); }

.aioo-game { --g-bg: #e9effa; --g-bg2: #ffffff; --g-ring: rgba(40, 70, 130, .38); --g-ink: #1b2540; --g-dish: var(--aioo-brand); --g-msg: #1877f2; --g-like: #e8467c; --g-bar: #2fb36d; --g-noise: #e5484d; --g-hub: #3a5bd9;
  background: var(--aioo-card); border: 1px solid var(--aioo-line); border-radius: 18px; overflow: hidden; box-shadow: var(--aioo-shadow); display: flex; flex-direction: column; user-select: none; -webkit-user-select: none; }
html[data-mode="dark"] .aioo-game { --g-bg: #0a0f1f; --g-bg2: #1a2446; --g-ring: rgba(150, 180, 255, .34); --g-ink: #dfe6ff; --g-msg: #4c9aff; --g-like: #ff6b9a; --g-bar: #3ddc84; --g-noise: #ff5a5f; --g-hub: #5b7cfa; }
.aioo-hud { display: flex; align-items: center; gap: 6px 18px; flex-wrap: wrap; padding: 10px 14px; border-bottom: 1px solid var(--aioo-line); }
.aioo-stat { display: flex; flex-direction: column; line-height: 1.1; min-width: 46px; }
.aioo-stat span { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--aioo-muted); font-weight: 700; }
.aioo-stat b { font-size: 20px; font-variant-numeric: tabular-nums; }
.aioo-bars { display: inline-flex; align-items: flex-end; gap: 3px; height: 22px; padding-top: 2px; }
.aioo-bars i { width: 6px; border-radius: 2px; background: var(--aioo-line); }
.aioo-bars i:nth-child(1) { height: 7px; } .aioo-bars i:nth-child(2) { height: 11px; } .aioo-bars i:nth-child(3) { height: 15px; } .aioo-bars i:nth-child(4) { height: 19px; }
.aioo-bars i.on { background: var(--aioo-ok); } .aioo-bars i.half { background: linear-gradient(to top, var(--aioo-ok) 50%, var(--aioo-line) 50%); }
.aioo-bars.low i.on, .aioo-bars.low i.half { background: var(--aioo-bad); }
.aioo-hbtn { margin-left: auto; display: flex; gap: 6px; }
.aioo-hbtn button { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--aioo-line); background: var(--aioo-card); color: var(--aioo-ink); display: grid; place-items: center; cursor: pointer; }
.aioo-hbtn button:hover, .aioo-hbtn button:focus-visible { background: rgba(127,127,127,.14); outline: 2px solid var(--aioo-brand); outline-offset: 1px; }
.aioo-hbtn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.aioo-hbtn [data-g="sound"] .on, .aioo-hbtn [data-g="sound"].on .off { display: none; }
.aioo-hbtn [data-g="sound"].on .on { display: inline; }
.aioo-prog { height: 4px; background: var(--aioo-line); }
.aioo-prog i { display: block; height: 100%; width: 0; background: var(--aioo-brand); transition: width .25s; }
.aioo-stage { position: relative; aspect-ratio: 16 / 10; max-height: 72vh; min-height: 300px; touch-action: none; }
.aioo-stage canvas { position: absolute; inset: 0; display: block; outline: none; cursor: crosshair; }
.aioo-stage canvas:focus-visible { box-shadow: inset 0 0 0 3px var(--aioo-brand); }
.aioo-off.full .aioo-game { flex: 1; }
.aioo-off.full .aioo-stage { flex: 1; aspect-ratio: auto; max-height: none; }
.aioo-over { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; background: rgba(10, 15, 31, .28); }
.aioo-over[hidden] { display: none; }
.aioo-over-card { max-width: 380px; text-align: center; background: var(--aioo-card); color: var(--aioo-ink); border-radius: 16px; padding: 20px 22px; box-shadow: var(--aioo-shadow); animation: aioo-pop .35s cubic-bezier(.2,.9,.3,1.3); }
.aioo-over-card h2 { margin: 0 0 6px; font-size: 22px; }
.aioo-over-card p { margin: 0 0 14px; color: var(--aioo-muted); line-height: 1.45; }
.aioo-over-card .btn { min-width: 150px; height: 42px; font-size: 16px; }
.aioo-over-card small { display: block; margin-top: 10px; }
@keyframes aioo-pop { from { transform: scale(.9); opacity: 0; } }
@media (max-width: 640px) {
  .aioo-off { padding-top: 16px; }
  .aioo-stage { aspect-ratio: 3 / 4; max-height: 64vh; }
  .aioo-hud { gap: 4px 12px; padding: 8px 10px; }
  .aioo-stat b { font-size: 17px; }
  .aioo-off.full .aioo-stage { min-height: 360px; }
}
@media (prefers-reduced-motion: reduce) {
  .aioo-pop, .aioo-back { transition: opacity .2s; }
  .aioo-pop *, .aioo-ico *, .aioo-q svg, .aioo-over-card { animation: none !important; }
  .aioo-pop-ico .x, .aioo-ico .x { stroke-dashoffset: 0; }
  .aioo-pop.is-on .a1, .aioo-pop.is-on .a2, .aioo-pop.is-on .a3 { opacity: 1; }
}

/* AIO Video: where the pop-up sits (the owner's choice), wide screens only - phones keep the bottom sheet */
@media (min-width: 641px) {
  .aioo-pop.pos-bottom { top: auto; bottom: 18px; transform: translate(-50%, 24px); }
  .aioo-pop.pos-bottom.show { transform: translate(-50%, 0); }
  .aioo-pop.pos-top-right { left: auto; right: 18px; transform: translate(0, -24px); }
  .aioo-pop.pos-top-right.show { transform: translate(0, 0); }
  .aioo-pop.pos-bottom-left { top: auto; bottom: 18px; left: 18px; transform: translate(0, 24px); }
  .aioo-pop.pos-bottom-left.show { transform: translate(0, 0); }
}
/* buttons of the offline pages (no theme there) */
.aioo-off .btn, .aioo-back .btn, .aioo-over .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 40px; padding: 0 18px; border-radius: 999px; border: 0;
  background: var(--aioo-brand); color: #fff; font: 600 14px system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; cursor: pointer; text-decoration: none; }
.aioo-off .btn.ghost, .aioo-back .btn.ghost { background: transparent; color: var(--aioo-ink); border: 1px solid var(--aioo-line); }
.aioo-off .btn svg { width: 18px; height: 18px; fill: currentColor; }
.aioo-off .muted { color: var(--aioo-muted); }
.aioo-off .small { font-size: 13px; }
body.aioo-page { margin: 0; min-height: 100vh; background: var(--aioo-bg); color: var(--aioo-ink); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Bengali", sans-serif; }
/* the game opens only while offline: online, a card says so instead */
.aioo-gate { display: none; max-width: 520px; margin: 18px auto; padding: 20px 22px; text-align: center; background: var(--aioo-card); border: 1px solid var(--aioo-line); border-radius: 16px; }
.aioo-gate h2 { margin: 6px 0; font-size: 20px; }
.aioo-gate p { margin: 0 0 14px; color: var(--aioo-muted); }
.aioo-gated .aioo-gate { display: block; }
.aioo-gated .aioo-game { display: none; }
/* below AIO Video's fixed header (56px), not over the search box */
@media (min-width: 641px) { .aioo-pop.pos-top, .aioo-pop.pos-top-right { top: 68px; } }
.aioo-off-top .btn { flex: none; white-space: nowrap; }
.aioo-off-brand { min-width: 0; } .aioo-off-brand b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
