/* =========================================================================
 * تتریس: اودیسه کهکشانی — استایل خودبسنده (وب + اپ)
 * همهٔ کلاس‌ها با پیشوند to- و زیر ریشهٔ #tetris-odyssey-root محدود شده‌اند
 * تا با دیزاین‌سیستم کوییزبی و سایر پنل‌های بازی تداخل نکنند.
 * ========================================================================= */

[data-to-layout] {
    --to-accent: #22d3ee;
    --to-accent-soft: rgba(34, 211, 238, 0.18);
    --to-ink: #e2e8f0;
    --to-muted: #93a4bd;
    --to-line: rgba(148, 163, 184, 0.18);
    /* توکن‌های کارت‌های سایدبار (ستون راست JS و ستون چپ Blade) — روز و شب */
    --to-s-ink: var(--qb-text, #0f172a);
    --to-s-muted: var(--qb-text-muted, #64748b);
    --to-s-line: var(--qb-border-soft, #e2e8f0);
    --to-s-card: var(--qb-surface-muted, #f8fafc);
    --to-s-gold: var(--qb-warning, #b45309);
    --to-s-row: rgba(100, 116, 139, 0.1);
}
html.dark [data-to-layout] {
    --to-s-gold: #fcd34d;
    --to-s-row: rgba(148, 163, 184, 0.09);
}

#tetris-odyssey-root,
.to-root {
    --to-accent: #22d3ee;
    --to-accent-soft: rgba(34, 211, 238, 0.18);
    --to-bg-a: #03101f;
    --to-bg-b: #071a33;
    --to-ink: #e2e8f0;
    --to-muted: #93a4bd;
    --to-line: rgba(148, 163, 184, 0.18);
    --to-panel: rgba(7, 12, 28, 0.86);
    --to-radius: 20px;
    font-family: "Vazirmatn", "Sahel", system-ui, -apple-system, "Segoe UI", sans-serif;
    color: var(--to-ink);
    position: relative;
    isolation: isolate;
}

#tetris-odyssey-root *,
.to-root *,
.to-side * { box-sizing: border-box; }

/* ریسِت دکمه‌ها با :where (ویژگی‌دهی صفر) تا کلاس‌های .to-chip/.to-ico/.to-play/.to-skill بتوانند پس‌زمینه بگیرند */
:where(#tetris-odyssey-root, .to-root, .to-side) button {
    font-family: inherit;
    color: inherit;
    border: 0;
    background: none;
    cursor: pointer;
}
.to-root:focus { outline: none; }
.to-root { display: block; width: 100%; container-type: inline-size; container-name: to-stage; }
.to-root [hidden] { display: none !important; }

.to-shell {
    position: relative;
    display: block;
    padding: 14px;
    border-radius: 28px;
    overflow: hidden;
    background:
        radial-gradient(120% 90% at 90% 0%, rgba(34, 211, 238, 0.14), transparent 55%),
        radial-gradient(110% 90% at 0% 100%, rgba(217, 70, 239, 0.14), transparent 55%),
        linear-gradient(160deg, var(--to-bg-b), var(--to-bg-a) 60%, #020713);
    border: 1px solid rgba(34, 211, 238, 0.28);
    box-shadow: 0 24px 70px -32px rgba(2, 8, 23, 0.95), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    outline: none;
}

.to-stars {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0.85;
    z-index: 0;
}

.to-head {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 2px 4px 12px;
    border-bottom: 1px solid var(--to-line);
}

.to-head-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.to-chip {
    padding: 6px 11px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 800;
    color: #06121f;
    background: linear-gradient(135deg, #67e8f9, #22d3ee 55%, #38bdf8);
    box-shadow: 0 6px 18px -8px rgba(34, 211, 238, 0.9);
    white-space: nowrap;
}

.to-ico {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    font-size: 14px;
    background: rgba(148, 163, 184, 0.1);
    border: 1px solid var(--to-line);
    transition: 0.18s ease;
}
.to-ico:hover { background: rgba(148, 163, 184, 0.2); transform: translateY(-1px); }
.to-ico.is-on {
    background: rgba(34, 211, 238, 0.2);
    border-color: rgba(34, 211, 238, 0.65);
    box-shadow: 0 0 14px -4px var(--to-accent);
}

.to-side { display: flex; flex-direction: column; gap: 10px; min-width: 0; }

.to-card {
    background: linear-gradient(160deg, rgba(17, 27, 51, 0.94), rgba(5, 9, 22, 0.97));
    border: 1px solid var(--to-line);
    border-radius: 16px;
    padding: 10px;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.07),
        0 10px 26px -18px rgba(0, 0, 0, 0.85);
}

.to-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    font-size: 10.5px;
    font-weight: 800;
    color: var(--to-muted);
    margin-bottom: 7px;
    letter-spacing: 0.2px;
}

.to-kbd {
    font-size: 9px;
    padding: 1px 5px;
    border-radius: 5px;
    background: rgba(34, 211, 238, 0.14);
    color: #a5f3fc;
    border: 1px solid rgba(34, 211, 238, 0.25);
    direction: ltr;
}

.to-mini-canvas {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 96 / 70;
    border-radius: 10px;
    background: rgba(2, 6, 18, 0.75);
    border: 1px solid rgba(34, 211, 238, 0.18);
}

.to-next-canvas { aspect-ratio: 96 / 280; }

.to-stat { display: flex; flex-direction: column; gap: 2px; }
.to-stat span { font-size: 9.5px; color: var(--to-muted); font-weight: 700; }
.to-stat strong { font-size: 19px; font-weight: 900; font-variant-numeric: tabular-nums; color: #fff; }

.to-stat-score {
    align-items: center;
    padding: 6px 4px 8px;
    border-radius: 12px;
    background: radial-gradient(90% 140% at 50% 0%, rgba(34, 211, 238, 0.16), transparent 70%);
    border: 1px solid rgba(34, 211, 238, 0.18);
}
.to-stat-score strong {
    font-size: 25px;
    color: #a5f3fc;
    letter-spacing: 0.4px;
    text-shadow: 0 0 14px rgba(34, 211, 238, 0.45), 0 2px 10px rgba(2, 8, 23, 0.8);
}

.to-stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 8px; text-align: center; }
.to-stat-row .to-stat { background: rgba(148, 163, 184, 0.07); border-radius: 10px; padding: 5px 2px; }
.to-stat-row .to-stat strong { font-size: 15px; }
.to-stat-row .to-stat:nth-child(1) strong { color: #6ee7b7; }
.to-stat-row .to-stat:nth-child(2) strong { color: #f9a8d4; }
.to-stat-row .to-stat:nth-child(3) strong { color: #fcd34d; }

.to-timer {
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 9px;
    border-radius: 10px;
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.3);
    font-size: 10.5px;
    font-weight: 800;
    color: #bae6fd;
}
.to-timer[hidden] { display: none !important; }
.to-timer strong { font-variant-numeric: tabular-nums; font-size: 14px; }
.to-timer.is-danger { background: rgba(244, 63, 94, 0.16); border-color: rgba(244, 63, 94, 0.5); color: #fecdd3; animation: to-pulse 1s infinite; }

.to-best {
    margin-top: 7px;
    font-size: 10px;
    color: var(--to-muted);
    text-align: center;
    font-weight: 700;
}
.to-best b { color: #fcd34d; font-variant-numeric: tabular-nums; }


/* ---------------- ستون میانی: باس + زمین بازی ---------------- */
.to-stage { display: flex; flex-direction: column; gap: 10px; min-width: 0; position: relative; z-index: 2; padding-top: 12px; }

.to-boss {
    width: 100%;
    max-width: none;
    display: flex;
    gap: 9px;
    align-items: center;
    padding: 9px 10px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(244, 63, 94, 0.13), rgba(15, 23, 42, 0.9));
    border: 1px solid rgba(244, 63, 94, 0.35);
    box-shadow: 0 8px 26px -18px rgba(244, 63, 94, 0.9);
}
.to-boss[hidden] { display: none !important; }

.to-boss-avatar {
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    font-size: 22px;
    border-radius: 12px;
    background: rgba(244, 63, 94, 0.14);
    border: 1px solid rgba(244, 63, 94, 0.4);
    transition: transform 0.14s ease, filter 0.3s ease;
}
.to-boss-avatar.is-dead { filter: grayscale(1) brightness(0.6); transform: rotate(12deg) scale(0.92); }

.to-boss-info { flex: 1; min-width: 0; }
.to-boss-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.to-boss-top strong { font-size: 11.5px; font-weight: 900; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.to-boss-hp { font-size: 9.5px; font-weight: 800; color: #fda4af; font-variant-numeric: tabular-nums; white-space: nowrap; }

.to-bar { height: 5px; border-radius: 999px; background: rgba(2, 6, 18, 0.8); overflow: hidden; margin-top: 4px; border: 1px solid rgba(148, 163, 184, 0.14); }
.to-bar i { display: block; height: 100%; border-radius: 999px; transition: width 0.25s ease; }
.to-bar-shield i { background: linear-gradient(90deg, #22d3ee, #7dd3fc); box-shadow: 0 0 8px rgba(56, 189, 248, 0.7); }
.to-bar-hp { height: 7px; }
.to-bar-hp i { background: linear-gradient(90deg, #f43f5e, #fb7185, #fbbf24); box-shadow: 0 0 10px rgba(244, 63, 94, 0.6); }

.to-boss-sub { display: flex; justify-content: space-between; gap: 6px; margin-top: 4px; font-size: 9px; color: #a5b4c8; }
.to-boss-sub span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.to-boss-sub b { color: #fcd34d; white-space: nowrap; }

.to-board-frame {
    position: relative;
    width: 100%;
    /* بوم ۱:۲: عرض تا ۴۰۰px، ولی ارتفاع بوم (۲× عرض) هرگز از ارتفاع صفحه (dvh) بیرون نمی‌زند؛
       fallback بدون dvh = ۳۴۸px قبلی */
    max-width: 348px;
    max-width: min(100%, 400px, max(200px, calc((100vh - 120px) / 2 + 19px)));
    max-width: min(100%, 400px, max(200px, calc((100dvh - 120px) / 2 + 19px)));
    margin: 0 auto;
    padding: 8px;
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(8, 13, 30, 0.95), rgba(2, 5, 15, 0.98));
    border: 1.5px solid rgba(34, 211, 238, 0.45);
    box-shadow:
        0 0 34px -12px var(--to-accent),
        0 22px 48px -26px rgba(2, 8, 23, 0.95),
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        inset 0 0 40px rgba(34, 211, 238, 0.06);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.to-board {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 10 / 20;
    border-radius: 12px;
    touch-action: none;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.to-hype {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    pointer-events: none;
    opacity: 0;
    z-index: 6;
    text-align: center;
    padding: 0 10px;
}
.to-hype b {
    font-size: 22px;
    font-weight: 900;
    letter-spacing: 0.5px;
    color: #fff;
    text-shadow: 0 0 22px var(--to-accent), 0 4px 18px rgba(0, 0, 0, 0.8);
}
.to-hype span {
    font-size: 11px;
    font-weight: 800;
    color: #cffafe;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9);
    direction: rtl;
}
.to-hype.is-show { animation: to-hype 1.35s cubic-bezier(0.16, 1, 0.3, 1) forwards; }

@keyframes to-hype {
    0% { opacity: 0; transform: scale(0.7); }
    16% { opacity: 1; transform: scale(1.04); }
    72% { opacity: 1; transform: scale(1) translateY(-6px); }
    100% { opacity: 0; transform: scale(1.06) translateY(-22px); }
}

/* ---------------- اورلی‌ها ---------------- */
.to-overlay {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border-radius: 20px;
    overflow-y: auto;
    background: rgba(3, 7, 20, 0.9);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}
.to-hidden { display: none !important; }

.to-panel {
    width: 100%;
    max-width: 320px;
    margin: auto;
    padding: 14px;
    border-radius: 16px;
    text-align: center;
    background: linear-gradient(165deg, rgba(18, 29, 58, 0.97), rgba(4, 8, 20, 0.99));
    border: 1px solid rgba(34, 211, 238, 0.32);
    box-shadow:
        0 18px 45px -20px rgba(0, 0, 0, 0.92),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.to-panel-sm { max-width: 270px; }
.to-panel h4 { margin: 6px 0 2px; font-size: 17px; font-weight: 900; color: #fff; }
.to-panel-sub { margin: 0 0 10px; font-size: 10.5px; color: var(--to-muted); font-weight: 600; line-height: 1.7; }

.to-hero {
    width: 46px;
    height: 46px;
    margin: 0 auto;
    display: grid;
    place-items: center;
    border-radius: 14px;
    font-size: 23px;
    background: linear-gradient(145deg, rgba(34, 211, 238, 0.24), rgba(217, 70, 239, 0.2));
    border: 1px solid rgba(34, 211, 238, 0.45);
    box-shadow: 0 0 26px -8px var(--to-accent);
}

.to-modes { display: flex; flex-direction: column; gap: 6px; margin-bottom: 9px; }
.to-mode {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    text-align: right;
    padding: 8px 10px;
    border-radius: 11px;
    background: rgba(148, 163, 184, 0.07);
    border: 1px solid rgba(148, 163, 184, 0.18);
    transition: 0.18s ease;
}
.to-mode b { font-size: 11.5px; font-weight: 900; color: #e2e8f0; }
.to-mode span { font-size: 9.5px; color: var(--to-muted); }
.to-mode:hover { background: rgba(148, 163, 184, 0.14); }
.to-mode.is-active {
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.22), rgba(217, 70, 239, 0.14));
    border-color: rgba(34, 211, 238, 0.6);
    box-shadow: inset 0 0 20px -10px var(--to-accent);
}
.to-mode.is-active b { color: #a5f3fc; }

.to-slider-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 10.5px;
    color: var(--to-muted);
    font-weight: 700;
    margin-bottom: 10px;
}
.to-slider-row input { flex: 1; accent-color: #22d3ee; height: 4px; }
.to-slider-row b { color: #a5f3fc; font-size: 12px; min-width: 18px; }

.to-play {
    width: 100%;
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 12.5px;
    font-weight: 900;
    color: #04121c;
    background: linear-gradient(135deg, #67e8f9, #22d3ee 45%, #6366f1);
    box-shadow:
        0 10px 26px -14px rgba(34, 211, 238, 0.95),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
    transition: 0.18s ease;
}
.to-play:hover { transform: translateY(-1px); filter: brightness(1.06); }
.to-play:active { transform: scale(0.98); }
.to-play-sm { font-size: 11.5px; padding: 9px 8px; }
.to-duel { margin-top: 8px; background: linear-gradient(135deg, #fcd34d, #f59e0b); color: #2b1a02; }

.to-hint { margin-top: 8px; font-size: 9.5px; color: var(--to-muted); line-height: 1.7; }

.to-row-btns { display: flex; gap: 6px; margin-top: 8px; }
.to-row-btns > * { flex: 1; }

.to-ghost {
    padding: 9px 10px;
    border-radius: 11px;
    font-size: 11px;
    font-weight: 800;
    color: #cbd5e1;
    background: rgba(148, 163, 184, 0.1);
    border: 1px solid rgba(148, 163, 184, 0.24);
    transition: 0.18s ease;
}
.to-ghost:hover { background: rgba(148, 163, 184, 0.2); }
.to-ghost.to-danger { color: #fda4af; border-color: rgba(244, 63, 94, 0.35); background: rgba(244, 63, 94, 0.12); }

.to-reward {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 9.5px;
    font-weight: 900;
    color: #fde68a;
    background: rgba(251, 191, 36, 0.16);
    border: 1px solid rgba(251, 191, 36, 0.45);
}

.to-upgrades { display: flex; flex-direction: column; gap: 7px; }
.to-upgrade {
    display: grid;
    grid-template-columns: 34px 1fr;
    grid-template-areas: "ico title" "ico desc";
    gap: 1px 8px;
    text-align: right;
    padding: 8px;
    border-radius: 12px;
    background: rgba(148, 163, 184, 0.07);
    border: 1px solid rgba(251, 191, 36, 0.28);
    transition: 0.18s ease;
}
.to-upgrade:hover {
    background: rgba(251, 191, 36, 0.12);
    border-color: rgba(251, 191, 36, 0.7);
    transform: translateY(-2px);
    box-shadow: 0 12px 24px -16px rgba(251, 191, 36, 0.9);
}
.to-upgrade-ico { grid-area: ico; display: grid; place-items: center; font-size: 20px; border-radius: 10px; background: rgba(251, 191, 36, 0.12); border: 1px solid rgba(251, 191, 36, 0.3); }
.to-upgrade b { grid-area: title; font-size: 11px; font-weight: 900; color: #fcd34d; align-self: end; }
.to-upgrade em { grid-area: desc; font-size: 9.5px; font-style: normal; color: #cbd5e1; line-height: 1.6; }

.to-final-score { font-size: 32px; font-weight: 900; color: #a5f3fc; text-shadow: 0 0 20px rgba(34, 211, 238, 0.5); font-variant-numeric: tabular-nums; margin: 2px 0 6px; }
.to-final-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin-bottom: 8px; }
.to-final-grid > div { padding: 5px 2px; border-radius: 9px; background: rgba(148, 163, 184, 0.08); border: 1px solid rgba(148, 163, 184, 0.16); }
.to-final-grid span { display: block; font-size: 9px; color: var(--to-muted); }
.to-final-grid b { font-size: 13px; color: #e2e8f0; font-variant-numeric: tabular-nums; }

.to-sync { min-height: 30px; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; line-height: 1.7; color: #cbd5e1; }
.to-sync.is-ok { color: #6ee7b7; }
.to-sync.is-warn { color: #fda4af; }

/* ---------------- دکمه‌های لمسی ---------------- */
.to-touch {
    width: 100%;
    max-width: none;
    display: none;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
}
.to-touch button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    padding: 8px 0;
    border-radius: 12px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0) 42%),
        linear-gradient(180deg, rgba(30, 41, 59, 0.94), rgba(9, 13, 30, 0.97));
    border: 1px solid rgba(34, 211, 238, 0.28);
    box-shadow: 0 3px 10px -4px rgba(0, 0, 0, 0.6);
    transition: 0.12s ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.to-touch button i { font-style: normal; font-size: 16px; line-height: 1; color: #a5f3fc; }
.to-touch button span { font-size: 8px; font-weight: 800; color: #93a4bd; }
.to-touch button.is-pressed { transform: scale(0.93); background: rgba(34, 211, 238, 0.24); border-color: #22d3ee; }
.to-touch button[data-t="rotate"] i { color: #f9a8d4; }
.to-touch button[data-t="drop"] i { color: #fcd34d; }
.to-touch button[data-t="hold"] i { color: #6ee7b7; }

/* ---------------- مهارت‌ها و ارتقاها ---------------- */
.to-skills { display: flex; flex-direction: column; gap: 6px; }
.to-skill {
    position: relative;
    display: grid;
    grid-template-columns: 26px 1fr auto;
    align-items: center;
    gap: 6px;
    text-align: right;
    padding: 7px 7px 9px;
    border-radius: 11px;
    background: rgba(148, 163, 184, 0.06);
    border: 1px solid rgba(148, 163, 184, 0.16);
    overflow: hidden;
    transition: 0.18s ease;
}
.to-skill-ico { font-size: 16px; text-align: center; }
.to-skill-txt { min-width: 0; }
.to-skill-txt b { display: block; font-size: 10px; font-weight: 900; color: #e2e8f0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.to-skill-txt em { display: block; font-style: normal; font-size: 8.5px; color: var(--to-muted); line-height: 1.5; }
.to-skill-pct { font-size: 9.5px; font-weight: 900; color: #93a4bd; font-variant-numeric: tabular-nums; }
.to-skill-bar { position: absolute; inset-inline: 0; bottom: 0; height: 3px; background: rgba(2, 6, 18, 0.75); }
.to-skill-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #22d3ee, #6366f1); transition: width 0.2s ease; }
.to-skill.is-ready {
    border-color: rgba(251, 191, 36, 0.75);
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.18), rgba(15, 23, 42, 0.92));
    box-shadow:
        0 0 18px -8px rgba(251, 191, 36, 0.9),
        inset 0 1px 0 rgba(255, 255, 255, 0.12);
    cursor: pointer;
    animation: to-skill-ready 2.2s ease-in-out infinite;
}

@keyframes to-skill-ready {
    0%, 100% { box-shadow: 0 0 18px -8px rgba(251, 191, 36, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.12); }
    50% { box-shadow: 0 0 24px -6px rgba(251, 191, 36, 1), inset 0 1px 0 rgba(255, 255, 255, 0.12); }
}
.to-skill.is-ready .to-skill-pct { color: #fcd34d; }
.to-skill.is-ready .to-skill-bar i { background: linear-gradient(90deg, #fbbf24, #f43f5e); }

.to-relics { display: flex; flex-wrap: wrap; gap: 4px; min-height: 24px; }
.to-relic { width: 26px; height: 26px; display: grid; place-items: center; font-size: 13px; border-radius: 8px; background: rgba(251, 191, 36, 0.12); border: 1px solid rgba(251, 191, 36, 0.32); }
.to-empty { font-size: 9.5px; color: var(--to-muted); }

/* ---------------- لیدربرد ---------------- */
.to-lb-card { min-height: 170px; }
.to-refresh { font-size: 12px; color: #a5f3fc; padding: 0 3px; }
.to-lb-tabs { display: flex; gap: 3px; padding: 2px; border-radius: 9px; background: rgba(2, 6, 18, 0.6); margin-bottom: 6px; }
.to-lb-tabs button { flex: 1; padding: 4px 0; border-radius: 7px; font-size: 9px; font-weight: 800; color: var(--to-muted); }
.to-lb-tabs button.is-active { background: rgba(34, 211, 238, 0.2); color: #a5f3fc; box-shadow: inset 0 0 0 1px rgba(34, 211, 238, 0.4); }

.to-lb { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; max-height: 190px; overflow-y: auto; }
.to-lb li {
    display: grid;
    grid-template-columns: 20px 1fr auto;
    align-items: center;
    gap: 5px;
    padding: 4px 5px;
    border-radius: 8px;
    background: rgba(148, 163, 184, 0.05);
    font-size: 9.5px;
}
.to-lb li.is-me { background: rgba(34, 211, 238, 0.13); box-shadow: inset 0 0 0 1px rgba(34, 211, 238, 0.35); }
.to-lb li.to-empty { display: block; text-align: center; padding: 12px 4px; line-height: 1.7; }
.to-lb-rank { font-size: 11px; text-align: center; }
.to-lb-name { min-width: 0; font-weight: 800; color: #e2e8f0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.to-lb-name em { display: block; font-style: normal; font-size: 8px; color: var(--to-muted); font-weight: 600; }
.to-lb-score { font-size: 9.5px; font-weight: 900; color: #fcd34d; font-variant-numeric: tabular-nums; }

/* ---------------- راهنما ---------------- */
.to-help {
    position: absolute;
    inset: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px;
    background: rgba(2, 5, 15, 0.9);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border-radius: 28px;
}
.to-help-box {
    position: relative;
    width: 100%;
    max-width: 560px;
    max-height: 86%;
    overflow-y: auto;
    padding: 16px;
    border-radius: 18px;
    background: linear-gradient(160deg, rgba(15, 23, 42, 0.98), rgba(4, 8, 20, 0.99));
    border: 1px solid rgba(34, 211, 238, 0.35);
}
.to-help-box h4 { margin: 0 0 10px; font-size: 15px; font-weight: 900; color: #a5f3fc; }
.to-help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.to-help-grid > div { padding: 8px; border-radius: 11px; background: rgba(148, 163, 184, 0.06); border: 1px solid rgba(148, 163, 184, 0.14); }
.to-help-grid b { display: block; font-size: 10.5px; color: #e2e8f0; margin-bottom: 2px; }
.to-help-grid span { font-size: 9.5px; color: var(--to-muted); line-height: 1.7; }
.to-close { position: absolute; top: 8px; left: 8px; width: 26px; height: 26px; border-radius: 8px; background: rgba(148, 163, 184, 0.12); font-size: 12px; color: #cbd5e1; }

@keyframes to-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }

/* ---------------- چیدمان سه‌ستونه (مثل منچ) ----------------
 * ظرف: qb-games-3col-layout qb-tetris-3col-layout (games-hall.css)
 *   راست = مهارت‌ها/ارتقاها/لیدربرد (JS) + رکوردها (Blade)، وسط = بازی، چپ = معرفی + دوئل + راهنما
 * ------------------------------------------------------------------- */
.to-slot { display: grid; gap: 16px; min-width: 0; }
.to-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.to-head { padding: 0 0 10px; justify-content: stretch; }
.to-head-actions { width: 100%; }
.to-ico-first { margin-inline-start: auto; }

/* کارت امتیاز/آمار (HUD) در ستون وسط */
.to-hud { padding: 10px 12px; }
.to-hud-top { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 2fr); gap: 8px; align-items: stretch; }
.to-hud-top .to-stat-row { margin-top: 0; }
.to-hud-top .to-stat-score { justify-content: center; }
.to-hud .to-flow { margin-top: 8px; }

/* ردیف بازی: ذخیره | زمین | بعدی (متقارن؛ زمین دقیقاً وسط). زیر ۴۸۰px ظرف: زمین + یک ستون کوچک */
.to-side-col {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}
.to-playrow {
    display: grid;
    grid-template-columns: clamp(120px, 22cqw, 155px) minmax(0, 400px) clamp(120px, 22cqw, 155px);
    gap: 12px;
    justify-content: center;
    align-items: start;
}
.to-mini-card { padding: 8px; border-radius: 14px; min-width: 0; }
.to-mini-card .to-label { font-size: 9.5px; margin-bottom: 5px; display: flex; align-items: center; justify-content: space-between; }
.to-playrow .to-board-frame { margin: 0; justify-self: center; }

/* کارت‌های مینیاتوری مهارت‌ها و ارتقاها در ساید داخل بازی */
.to-skills-card { padding: 8px 8px 9px; border-radius: 15px; }
.to-skills-card .to-label { font-size: 10px; font-weight: 900; color: #facc15; margin-bottom: 6px; }
.to-relics-card .to-label { font-size: 10px; font-weight: 900; color: #cbd5e1; margin-bottom: 6px; }
.to-skills-compact { display: flex; flex-direction: column; gap: 5px; }
.to-skills-compact .to-skill {
    position: relative;
    display: grid;
    grid-template-columns: 20px 1fr auto;
    align-items: center;
    gap: 4px;
    padding: 6px 6px 7px;
    border-radius: 9px;
    background: rgba(148, 163, 184, 0.08);
    border: 1px solid rgba(148, 163, 184, 0.2);
    cursor: pointer;
    overflow: hidden;
    transition: all 0.15s ease;
}
.to-skills-compact .to-skill:hover {
    background: rgba(148, 163, 184, 0.14);
    border-color: rgba(34, 211, 238, 0.4);
}
.to-skills-compact .to-skill-ico { font-size: 14px; text-align: center; }
.to-skills-compact .to-skill-txt {
    display: flex;
    align-items: center;
    gap: 3px;
    min-width: 0;
    overflow: hidden;
}
.to-skills-compact .to-skill-txt b {
    font-size: 10.5px;
    font-weight: 900;
    color: #f1f5f9;
    white-space: nowrap;
}
.to-skills-compact .to-skill-key {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    height: 14px;
    border-radius: 4px;
    font-size: 8px;
    font-weight: 900;
    background: rgba(148, 163, 184, 0.2);
    color: #94a3b8;
    line-height: 1;
}
.to-skills-compact .to-skill-pct {
    font-size: 9px;
    font-weight: 900;
    color: #93a4bd;
    font-variant-numeric: tabular-nums;
}
.to-skills-compact .to-skill.is-ready {
    border-color: #facc15;
    background: linear-gradient(135deg, rgba(250, 204, 21, 0.22), rgba(15, 23, 42, 0.9));
    box-shadow: 0 0 12px -2px rgba(250, 204, 21, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.15);
    animation: to-skill-ready 2s ease-in-out infinite;
}
.to-skills-compact .to-skill.is-ready .to-skill-pct { color: #fef08a; font-weight: 900; }
.to-skills-compact .to-skill-bar { position: absolute; inset-inline: 0; bottom: 0; height: 3px; background: rgba(2, 6, 18, 0.7); }
.to-skills-compact .to-skill-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #22d3ee, #6366f1); transition: width 0.2s ease; }
.to-skills-compact .to-skill.is-ready .to-skill-bar i { background: linear-gradient(90deg, #fbbf24, #f43f5e); }

.to-relics-card { padding: 8px 7px; border-radius: 14px; }
.to-relics-compact { display: flex; flex-wrap: wrap; gap: 4px; min-height: 28px; align-items: center; }
.to-relics-compact .to-relic {
    width: 25px;
    height: 25px;
    display: grid;
    place-items: center;
    font-size: 13px;
    border-radius: 7px;
    background: rgba(251, 191, 36, 0.14);
    border: 1px solid rgba(251, 191, 36, 0.35);
    box-shadow: 0 0 8px -2px rgba(251, 191, 36, 0.4);
}

@container to-stage (max-width: 599px) {
    .to-playrow {
        grid-template-columns: minmax(0, 1fr) 96px;
        grid-template-areas: "board colhold" "board colnext";
        grid-template-rows: auto 1fr;
        justify-content: stretch;
        gap: 8px;
    }
    .to-playrow .to-board-frame { grid-area: board; justify-self: center; }
    .to-side-col-hold { grid-area: colhold; }
    .to-side-col-next { grid-area: colnext; align-self: start; }
    .to-skills-compact .to-skill {
        grid-template-columns: 18px 1fr auto;
        padding: 4px 5px;
    }
    .to-skills-compact .to-skill-txt b { font-size: 8.5px; }
    .to-skills-compact .to-skill-key { display: none; }
}
@container to-stage (max-width: 399px) {
    .to-playrow { grid-template-columns: minmax(0, 1fr) 76px; gap: 6px; }
    .to-mini-card { padding: 4px; border-radius: 9px; }
    .to-mini-card .to-label { font-size: 8.5px; }
    .to-skills-compact .to-skill { grid-template-columns: 1fr auto; padding: 3px 4px; }
    .to-skills-compact .to-skill-ico { display: none; }
}

/* ---------- کارت‌های ستون راست (JS) با توکن‌های روز/شب ---------- */
.to-side .to-card {
    padding: 16px;
    border-radius: var(--qb-radius-card, 20px);
    background: var(--to-s-card);
    border: 1px solid var(--to-s-line);
    box-shadow: none;
    color: var(--to-s-ink);
}
.to-side .to-label { font-size: 12px; font-weight: 900; color: var(--to-s-ink); margin-bottom: 8px; }
.to-side .to-empty { color: var(--to-s-muted); font-size: 10.5px; }
.to-side .to-skill { background: var(--to-s-row); border-color: var(--to-s-line); padding: 9px 10px 11px; }
.to-side .to-skill-txt b { color: var(--to-s-ink); font-size: 11px; }
.to-side .to-skill-txt em { color: var(--to-s-muted); font-size: 9.5px; }
.to-side .to-skill-pct { color: var(--to-s-muted); font-size: 10.5px; }
.to-side .to-skill-bar { background: var(--to-s-line); }
.to-side .to-skill.is-ready { background: linear-gradient(135deg, rgba(251, 191, 36, 0.22), var(--to-s-card)); }
.to-side .to-skill.is-ready .to-skill-pct { color: var(--to-s-gold); }
.to-side .to-lb-card { min-height: 0; }
.to-side .to-refresh { color: var(--to-s-muted); font-size: 14px; }
.to-side .to-lb-tabs { background: var(--to-s-row); }
.to-side .to-lb-tabs button { color: var(--to-s-muted); font-size: 10px; }
.to-side .to-lb-tabs button.is-active { background: #67e8f9; color: #06121f; box-shadow: none; }
.to-side .to-lb { max-height: 320px; }
.to-side .to-lb li { background: var(--to-s-row); font-size: 11px; padding: 6px 8px; }
.to-side .to-lb li.is-me { background: rgba(34, 211, 238, 0.14); box-shadow: inset 0 0 0 1px rgba(34, 211, 238, 0.45); }
.to-side .to-lb-name { color: var(--to-s-ink); }
.to-side .to-lb-name em { color: var(--to-s-muted); font-size: 9px; }
.to-side .to-lb-score { color: var(--to-s-gold); font-size: 11px; }
.to-side .to-relic { width: 30px; height: 30px; font-size: 15px; }

/* ---------- کارت‌های Blade (ستون راست و چپ) ---------- */
.to-intro, .to-lcard, .to-tips {
    min-width: 0;
    padding: 16px;
    border-radius: var(--qb-radius-card, 20px);
    background: var(--to-s-card);
    border: 1px solid var(--to-s-line);
    color: var(--to-s-ink);
}
.to-intro { display: flex; flex-direction: column; gap: 12px; padding: 20px; border-radius: 24px; }
.to-intro-badge { align-self: flex-start; padding: 3px 10px; border-radius: 999px; font-size: 10px; font-weight: 900; letter-spacing: 0.08em; color: var(--to-s-gold); background: rgba(34, 211, 238, 0.12); border: 1px solid rgba(34, 211, 238, 0.4); }
.to-intro h2 { margin: 0; font-size: 20px; font-weight: 900; color: var(--qb-text, #0f172a); }
.to-intro p { margin: 0; font-size: 12px; line-height: 2; color: var(--to-s-muted); }
.to-intro p strong { color: var(--to-s-ink); }
.to-intro-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.to-hchip { padding: 3px 10px; border-radius: 999px; font-size: 10px; font-weight: 800; color: var(--to-s-ink); background: var(--to-s-row); border: 1px solid var(--to-s-line); }
.to-hstats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.to-hstat { padding: 8px 4px; border-radius: 14px; text-align: center; background: var(--to-s-row); border: 1px solid var(--to-s-line); min-width: 0; }
.to-hstat span { display: block; font-size: 9px; color: var(--to-s-muted); }
.to-hstat strong { font-size: 15px; color: var(--to-s-gold); font-variant-numeric: tabular-nums; }
.to-intro-link { display: block; text-align: center; padding: 8px; border-radius: 12px; font-size: 11px; font-weight: 800; text-decoration: none; color: var(--to-s-gold); background: rgba(34, 211, 238, 0.1); border: 1px solid rgba(34, 211, 238, 0.35); }
.to-tips h3 { margin: 0 0 8px; font-size: 13px; font-weight: 900; color: var(--to-s-ink); }
.to-tips ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; font-size: 11px; line-height: 1.9; color: var(--to-s-muted); }
.to-tips b { color: var(--to-s-ink); }
.to-tips kbd { font-family: inherit; direction: ltr; unicode-bidi: isolate; padding: 0 5px; border-radius: 5px; font-size: 10px; background: var(--to-s-row); border: 1px solid var(--to-s-line); color: var(--to-s-ink); }
.to-lcard-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.to-lcard-head h3 { margin: 0; font-size: 13px; font-weight: 900; color: var(--to-s-ink); }
.to-lcard-head span { font-size: 9px; color: var(--to-s-muted); text-align: left; }
.to-records { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.to-records li { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 10px; font-size: 12px; background: var(--to-s-row); }
.to-rank { text-align: center; font-weight: 900; }
.to-rec-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 800; }
.to-rec-name em { display: block; font-style: normal; font-size: 9px; color: var(--to-s-muted); font-weight: 600; }
.to-records b { color: var(--to-s-gold); font-variant-numeric: tabular-nums; }
.to-rec-empty { display: block !important; text-align: center; color: var(--to-s-muted); }
.to-guide-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; font-size: 11px; line-height: 1.9; color: var(--to-s-muted); }
.to-guide-list b { display: block; color: var(--to-s-ink); }

/* ویجت دوئل در ستون باریک سایدبار */
.qb-tetris-3col-layout [data-score-duel] { padding: 16px !important; }
.qb-tetris-3col-layout [data-score-duel] > div:first-child { flex-direction: column !important; align-items: stretch !important; }
.qb-tetris-3col-layout [data-score-duel] [role="tablist"] { width: 100% !important; }

/* راهنما: نزدیک بالای بازی (پوشش کل پوسته بلند است) */
.to-help { align-items: flex-start; }
.to-help-box { margin-top: 56px; }

/* ---------------- ریسپانسیو ---------------- */
@media (hover: none), (max-width: 1023px) {
    .to-touch { display: grid; }
}
@media (max-width: 880px) {
    .to-shell { padding: 11px; border-radius: 22px; }
    .to-help-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
    .to-shell { padding: 9px; border-radius: 18px; }
    .to-head { padding-bottom: 9px; }
    .to-chip { font-size: 9px; padding: 5px 8px; }
    .to-ico { width: 29px; height: 29px; font-size: 12.5px; }
    .to-touch { gap: 5px; }
    .to-touch button { padding: 7px 0; border-radius: 10px; }
    .to-touch button i { font-size: 15px; }
    .to-touch button span { font-size: 7px; }
    .to-panel { padding: 12px; }
    .to-panel h4 { font-size: 15px; }
    .to-mode b { font-size: 10.5px; }
    .to-mode span { font-size: 8.5px; }
    .to-hype b { font-size: 18px; }
    .to-final-score { font-size: 27px; }
    .to-boss-sub { display: none; }
    .to-boss-avatar { width: 36px; height: 36px; font-size: 19px; }
    .to-hud-top { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    .to-hype.is-show { animation-duration: 0.9s; }
    .to-timer.is-danger { animation: none; }
    .to-skill.is-ready { animation: none; }
    .to-play, .to-mode, .to-upgrade, .to-ico { transition: none; }
}

/* ===== v2: نوار جریان (Flow) و صفحهٔ پایان «اوج-پایان» ===== */
.to-flow { margin-top: 8px; padding: 6px 8px; border-radius: 12px; background: rgba(148, 163, 184, 0.07); border: 1px solid rgba(148, 163, 184, 0.14); --to-flow-c: #67e8f9; }
.to-flow-top { display: flex; justify-content: space-between; align-items: center; font-size: 10px; color: var(--to-muted); }
.to-flow-tier { font-size: 10px; font-weight: 800; color: var(--to-flow-c); transition: color 0.3s ease; }
.to-bar-flow { height: 7px; }
.to-bar-flow i { background: linear-gradient(90deg, #38bdf8, var(--to-flow-c)); box-shadow: 0 0 8px var(--to-flow-c); transition: width 0.3s ease, background 0.3s ease; }
.to-flow[data-tier="calm"] { --to-flow-c: #7dd3fc; }
.to-flow[data-tier="flow"] { --to-flow-c: #22d3ee; }
.to-flow[data-tier="surge"] { --to-flow-c: #a78bfa; }
.to-flow[data-tier="peak"] { --to-flow-c: #fbbf24; border-color: rgba(251, 191, 36, 0.5); box-shadow: 0 0 14px -4px rgba(251, 191, 36, 0.6); }
.to-flow[data-tier="peak"] .to-bar-flow i { animation: to-flow-glow 1.6s ease-in-out infinite; }
@keyframes to-flow-glow { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.35); } }

.to-peak { margin: 6px 0 4px; padding: 7px 8px; border-radius: 12px; font-size: 11px; font-weight: 800; line-height: 1.7; color: #fde68a; background: rgba(251, 191, 36, 0.09); border: 1px solid rgba(251, 191, 36, 0.28); }
.to-peak:empty, .to-delta:empty, .to-tip:empty { display: none; }
.to-delta { margin-bottom: 4px; font-size: 11px; font-weight: 700; color: #a7f3d0; }
.to-tip { margin-bottom: 6px; font-size: 10px; line-height: 1.8; color: #94a3b8; }

@media (prefers-reduced-motion: reduce) {
    .to-flow[data-tier="peak"] .to-bar-flow i { animation: none; }
    .to-bar-flow i, .to-flow-tier { transition: none; }
}

/* =========================================================================
 * تم حماسی «قلمرو اژدها» — قرمز گدازه، طلایی و خاکستر
 * (تصویر اختیاری: public/images/games/tetris/dragon-bg.jpg اگر وجود داشته باشد
 *  Blade آن را در متغیر --to-dragon-bg می‌گذارد)
 * ========================================================================= */
[data-to-layout],
#tetris-odyssey-root,
.to-root {
    --to-accent: #f59e0b;
    --to-accent-soft: rgba(245, 158, 11, 0.2);
    --to-bg-a: #12040a;
    --to-bg-b: #2a0a12;
    --to-line: rgba(251, 146, 60, 0.22);
}
.to-shell {
    background:
        radial-gradient(120% 90% at 88% 0%, rgba(239, 68, 68, 0.24), transparent 55%),
        radial-gradient(110% 90% at 0% 100%, rgba(245, 158, 11, 0.18), transparent 58%),
        linear-gradient(160deg, #2a0a12, #12040a 58%, #07020a);
    border-color: rgba(251, 146, 60, 0.42);
    box-shadow: 0 24px 70px -30px rgba(120, 20, 10, 0.75), inset 0 1px 0 rgba(255, 220, 180, 0.08);
}
.to-shell::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image: linear-gradient(180deg, rgba(10, 2, 6, 0.55), rgba(10, 2, 6, 0.9)), var(--to-dragon-bg, none);
    background-size: cover;
    background-position: center top;
    opacity: 0.9;
}
.to-chip {
    color: #1c0a02;
    background: linear-gradient(135deg, #fde68a, #f59e0b 55%, #ef4444);
    box-shadow: 0 6px 18px -8px rgba(245, 158, 11, 0.9);
}
.to-ico.is-on {
    background: rgba(245, 158, 11, 0.2);
    border-color: rgba(251, 146, 60, 0.7);
    box-shadow: 0 0 14px -4px #f59e0b;
}
.to-vol { width: 74px; height: 4px; accent-color: #f59e0b; cursor: pointer; align-self: center; }
.to-board-frame {
    border-color: rgba(251, 146, 60, 0.55);
    box-shadow:
        0 0 38px -12px rgba(249, 115, 22, 0.85),
        0 22px 48px -26px rgba(2, 8, 23, 0.95),
        inset 0 1px 0 rgba(255, 230, 200, 0.1),
        inset 0 0 40px rgba(239, 68, 68, 0.08);
}
.to-stat-score { background: radial-gradient(90% 140% at 50% 0%, rgba(245, 158, 11, 0.2), transparent 70%); border-color: rgba(251, 146, 60, 0.3); }
.to-stat-score strong { color: #fde68a; text-shadow: 0 0 14px rgba(249, 115, 22, 0.55), 0 2px 10px rgba(2, 8, 23, 0.8); }
.to-stat-score.is-pulse { animation: to-score-pulse 0.7s ease-out; }
@keyframes to-score-pulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.8); }
    35% { transform: scale(1.08); box-shadow: 0 0 26px 4px rgba(251, 191, 36, 0.7); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(251, 191, 36, 0); }
}
.to-boss { background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(20, 6, 10, 0.92)); border-color: rgba(251, 146, 60, 0.45); }
.to-panel { border-color: rgba(251, 146, 60, 0.4); background: linear-gradient(165deg, rgba(48, 14, 18, 0.97), rgba(10, 3, 6, 0.99)); }
.to-mode.is-active {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.24), rgba(239, 68, 68, 0.16));
    border-color: rgba(251, 146, 60, 0.7);
}
.to-mode.is-active b { color: #fde68a; }
.to-slider-row input { accent-color: #f59e0b; }
.to-play {
    color: #1c0a02;
    background: linear-gradient(135deg, #fde68a, #f59e0b 50%, #ef4444);
    box-shadow: 0 10px 26px -12px rgba(249, 115, 22, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.to-upgrade:hover { border-color: rgba(251, 146, 60, 0.7); }
.to-side .to-lb-tabs button.is-active { background: #fcd34d; color: #1c0a02; }
.to-side .to-refresh { color: #f59e0b; }
.to-intro-badge { background: rgba(245, 158, 11, 0.14); border-color: rgba(251, 146, 60, 0.5); }
.to-intro-link { background: rgba(245, 158, 11, 0.12); border-color: rgba(251, 146, 60, 0.4); }
@media (prefers-reduced-motion: reduce) {
    .to-stat-score.is-pulse { animation: none; }
}

/* ============================================================================
   داک ابزار، وضعیت و آمار مینیاتوری زیر زمین تتریس (.to-hud-dock)
   ========================================================================== */
.to-hud-dock {
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    gap: 7px;
    background: linear-gradient(160deg, rgba(17, 27, 51, 0.95), rgba(5, 9, 22, 0.98));
    border: 1px solid var(--to-line);
    box-shadow: 0 4px 16px -6px rgba(0, 0, 0, 0.7);
    width: 100%;
}
html.dark .to-hud-dock,
.dark .to-hud-dock {
    background: linear-gradient(160deg, rgba(15, 23, 42, 0.96), rgba(2, 6, 23, 0.98));
}

.to-dock-stats {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    flex-wrap: wrap;
}
.to-dock-stat {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    border-radius: 9px;
    background: rgba(148, 163, 184, 0.08);
    border: 1px solid rgba(148, 163, 184, 0.16);
    font-size: 11px;
}
.to-dock-lbl {
    font-size: 9.5px;
    font-weight: 700;
    color: var(--to-muted);
}
.to-dock-stat strong {
    font-size: 12px;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    color: #f1f5f9;
}
.to-dock-stat-score {
    background: rgba(34, 211, 238, 0.12);
    border-color: rgba(34, 211, 238, 0.35);
}
.to-dock-stat-score strong {
    font-size: 14px;
    color: #67e8f9;
    text-shadow: 0 0 10px rgba(34, 211, 238, 0.5);
}
.to-dock-flow {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    color: #cbd5e1;
}
.to-bar-flow-sm {
    width: 60px;
    height: 5px;
    margin: 0;
    display: inline-block;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.2);
    overflow: hidden;
}
.to-dock-best {
    font-size: 10px;
    color: var(--to-muted);
}
.to-dock-best b {
    color: #fcd34d;
    font-weight: 800;
}
.to-dock-timer[hidden] {
    display: none !important;
}
.to-dock-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    border-top: 1px solid rgba(148, 163, 184, 0.15);
    padding-top: 6px;
}
.to-chip-sm {
    padding: 3.5px 10px;
    font-size: 10px;
    font-weight: 800;
    border-radius: 999px;
    white-space: nowrap;
}
.to-dock-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}
.to-ico-sm {
    width: 27px;
    height: 27px;
    font-size: 12px;
    border-radius: 8px;
    padding: 0;
}
.to-trk {
    max-width: 76px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 9px;
    font-weight: 700;
    color: var(--to-muted, #94a3b8);
}
.to-trk:empty {
    display: none;
}
.to-vol-sm {
    width: 55px;
    height: 3px;
    margin: 0 2px;
}

/* =========================================================================
 * W2 — صحنهٔ اژدها پشت زمین (public/images/games/tetris/bg1.webp)
 * لایهٔ <div.to-scene> را JS به‌عنوان اولین فرزند .to-shell می‌سازد؛ بوم بازی روی آن شفاف است.
 * ========================================================================= */
.to-scene {
    position: absolute;
    inset: 0;
    overflow: clip;
    border-radius: inherit;
    pointer-events: none;
    z-index: 0;
    direction: ltr;
    opacity: 0;
    transition: opacity 0.4s ease;
}
.to-scene.is-on { opacity: 1; }
.to-scene::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(120% 100% at 50% 45%, transparent 55%, rgba(2, 6, 16, 0.5) 100%);
}
.to-scene-layer {
    position: absolute;
    left: var(--sc-l, 0px);
    top: var(--sc-t, 0px);
    width: var(--sc-w, 100%);
    height: var(--sc-h, 100%);
    translate: var(--par-x, 0px) 0;
    transform: translate3d(var(--sh-x, 0px), var(--sh-y, 0px), 0);
    transition: translate 0.25s ease-out;
    scale: 1;
    animation: to-scene-breathe 9s ease-in-out infinite;
    will-change: transform, scale;
    -webkit-mask-image: linear-gradient(to right, transparent, #000 8%, #000 92%, transparent), linear-gradient(to bottom, transparent, #000 8%, #000 92%, transparent);
    mask-image: linear-gradient(to right, transparent, #000 8%, #000 92%, transparent), linear-gradient(to bottom, transparent, #000 8%, #000 92%, transparent);
    -webkit-mask-composite: source-in;
    mask-composite: intersect;
}
@keyframes to-scene-breathe { 0%, 100% { scale: 1; } 50% { scale: 1.012; } }
.to-scene-fallback {
    position: absolute;
    inset: 0;
    background:
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1792 1000' preserveAspectRatio='none'><path d='M1010 120 L1480 40 L1700 260 L1560 360 L1500 600 L1320 640 L1240 470 L1100 380 Z' fill='%23190c0e' stroke='%238a3a1c' stroke-width='8'/><path d='M1190 335 L1330 380 L1215 410 Z' fill='%23ef4444'/><path d='M1380 40 L1450 -30 L1470 60 Z M1500 70 L1590 -10 L1580 100 Z' fill='%232a1210'/></svg>") center / 100% 100% no-repeat,
        radial-gradient(30% 40% at 70% 30%, rgba(251, 146, 60, 0.28), transparent 70%),
        radial-gradient(70% 45% at 55% 95%, rgba(250, 204, 21, 0.28), transparent 70%),
        radial-gradient(120% 90% at 50% 40%, #2a1a14, #0b0708 75%);
}
.to-scene-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    object-fit: fill;
    opacity: 0;
    transition: opacity 0.5s ease;
    user-select: none;
    -webkit-user-drag: none;
}
.to-scene.is-ready .to-scene-img { opacity: 0.96; }
.to-scene-eye, .to-scene-breath {
    position: absolute;
    aspect-ratio: 1;
    transform: translate(-50%, -50%);
    mix-blend-mode: screen;
}
.to-scene-eye { left: 70.4%; top: 29.5%; width: 4.4%; opacity: var(--eye-o, 0.3); }
.to-scene-eye i {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 247, 205, 0.95) 0 14%, rgba(255, 160, 50, 0.75) 32%, rgba(255, 90, 10, 0) 70%);
    animation: to-eye-pulse 2.8s ease-in-out infinite;
}
@keyframes to-eye-pulse { 0%, 100% { transform: scale(0.85); } 50% { transform: scale(1.15); } }
.to-scene-breath {
    left: 67.8%;
    top: 38.1%;
    width: 11%;
    opacity: var(--br-o, 0.1);
    background: radial-gradient(circle, rgba(255, 200, 90, 0.85), rgba(249, 115, 22, 0.45) 40%, rgba(239, 68, 68, 0) 72%);
}
/* بوم شفاف روی صحنه: قاب بازی دیگر پس‌زمینهٔ کدر ندارد (بوم صفحهٔ تیرهٔ نیمه‌شفاف خودش را می‌کشد) */
.to-shell.has-scene .to-board-frame {
    background: linear-gradient(180deg, rgba(8, 13, 30, 0.3), rgba(2, 5, 15, 0.42));
    box-shadow:
        0 0 calc(38px + 34px * var(--to-roar, 0)) -12px rgba(249, 115, 22, calc(0.85 + 0.15 * var(--to-roar, 0))),
        0 22px 48px -26px rgba(2, 8, 23, 0.95),
        inset 0 1px 0 rgba(255, 230, 200, 0.1),
        inset 0 0 40px rgba(239, 68, 68, 0.08);
}
/* ستون‌های کناری شیشه‌ای تا اژدها پشتشان بدرخشد */
.to-shell.has-scene { --side-alpha: 0.4; }
.to-shell.has-scene[data-scene-mode="compact"] { --side-alpha: 0.55; }
.to-shell.has-scene .to-side-col .to-card {
    background: rgba(6, 10, 22, var(--side-alpha));
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}
.to-root[data-q="low"] .to-shell.has-scene { --side-alpha: 0.75; }
.to-root[data-q="low"] .to-shell.has-scene .to-side-col .to-card { -webkit-backdrop-filter: none; backdrop-filter: none; }
.to-root[data-q="low"] .to-scene-layer { animation: none; }
.to-root[data-q="low"] .to-scene-eye, .to-root[data-q="low"] .to-scene-breath { mix-blend-mode: normal; }
.to-root[data-q="low"] .to-scene-eye i { animation: none; }
@media (prefers-reduced-motion: reduce) {
    .to-scene, .to-scene-img { transition: none; }
    .to-scene-layer { animation: none; transition: none; }
    .to-scene-eye i { animation: none; }
}
/* W2: در حالت wide سر اژدها پشت ستون ذخیره/مهارت می‌افتد؛ کارت‌ها شفاف‌تر تا سر و چشم دیده شوند (کنتراست متن با سایه حفظ می‌شود) */
.to-shell.has-scene[data-scene-mode="wide"] { --side-alpha: 0.2; }
.to-shell.has-scene[data-scene-mode="wide"] .to-side-col .to-mini-canvas { background: rgba(2, 6, 18, 0.28); }
.to-shell.has-scene .to-side-col .to-label,
.to-shell.has-scene .to-side-col .to-skill-txt b,
.to-shell.has-scene .to-side-col .to-skill-pct { text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95), 0 0 6px rgba(0, 0, 0, 0.7); }
.to-shell.has-scene[data-scene-mode="wide"] .to-skills-compact .to-skill { background: rgba(6, 10, 22, 0.5); }
.to-shell.has-scene[data-scene-mode="wide"] .to-skills-compact .to-skill.is-ready { background: linear-gradient(135deg, rgba(250, 204, 21, 0.2), rgba(6, 10, 22, 0.55)); }

/* =========================================================================
 * W3 — آمار فشردهٔ کنار زمین (نه روی آن)، بعدی ×۵، داک همیشه تیره
 * کارت آمار زیر «ذخیره» در ستون کناری؛ مرکز زمین بدون هیچ المان ثابت.
 * ========================================================================= */
.to-stats-card { display: flex; flex-direction: column; gap: 4px; padding: 7px 8px 8px; }
.to-st { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; min-width: 0; font-size: 11px; line-height: 1.5; }
.to-st span { font-size: 9.5px; font-weight: 700; color: #cbd5e1; white-space: nowrap; }
.to-st strong, .to-st b { font-size: 12.5px; font-weight: 900; color: #f1f5f9; font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; white-space: nowrap; }
.to-st b { color: #fcd34d; font-size: 11.5px; }
.to-st-score { flex-direction: column; align-items: stretch; gap: 0; padding: 4px 6px 5px; margin-bottom: 2px; border-radius: 10px; text-align: center; background: radial-gradient(90% 140% at 50% 0%, rgba(245, 158, 11, 0.2), transparent 70%); border: 1px solid rgba(251, 146, 60, 0.3); }
.to-st-score strong { font-size: 17px; color: #fde68a; text-shadow: 0 0 12px rgba(249, 115, 22, 0.5), 0 2px 8px rgba(2, 8, 23, 0.8); }
.to-st-score.is-pulse { animation: to-score-pulse 0.7s ease-out; }
.to-shell.has-scene .to-side-col .to-st span,
.to-shell.has-scene .to-side-col .to-st strong,
.to-shell.has-scene .to-side-col .to-st b { text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95), 0 0 6px rgba(0, 0, 0, 0.7); }
.to-shell.has-scene .to-side-col .to-stats-card,
.to-shell.has-scene[data-scene-mode="wide"] .to-stats-card { background: rgba(6, 10, 22, 0.7); }
@media (prefers-reduced-motion: reduce) {
    .to-st-score.is-pulse { animation: none; }
}
@container to-stage (max-width: 599px) {
    .to-stats-card { padding: 5px 6px 6px; gap: 3px; }
    .to-st span { font-size: 8.5px; }
    .to-st strong { font-size: 11px; }
    .to-st b { font-size: 10px; }
    .to-st-score strong { font-size: 14px; }
}
@container to-stage (max-width: 399px) {
    .to-stats-card { padding: 3px 4px 4px; }
    .to-st span { font-size: 7.5px; }
    .to-st strong { font-size: 9.5px; }
    .to-st-score strong { font-size: 12px; }
    .to-st-best { display: none; }
}
/* داک زیر زمین فقط جریان/زمان/کنترل‌ها؛ بدون عدد تکراری */
.to-hud-dock { padding: 7px 12px; }
.to-dock-stats { justify-content: flex-start; gap: 8px; }
.to-dock-stats:empty { display: none; }
