/* ── Quantoshi Web App — custom styles ─────────────────────────────────────── */

/* Force light rendering — prevents browser dark-mode (and Dark Reader etc.)
   from inverting or recoloring charts and UI. Plotly SVG backgrounds are
   already explicitly white; this stops extensions overriding them. */
:root {
    color-scheme: only light;
    --btc-orange: #f7931a;
    --nav-dark: #2c3e50;
    --nav-darker: #1a252f;
    --nav-lighter: #34495e;
}

/* Light theme base */
body {
    font-size: 13px;
    background-color: #f0f2f5 !important;
    color: #212529 !important;
}

/* ── #1: Navbar gradient ──────────────────────────────────────────────────── */
.navbar {
    background: linear-gradient(135deg, var(--nav-darker) 0%, var(--nav-dark) 50%, var(--nav-lighter) 100%) !important;
    overflow: visible !important;
    z-index: 1040;
    position: relative;
    border-radius: 10px;
}

/* Tab bar */
.nav-tabs {
    background-color: var(--nav-dark) !important;
    border-bottom: none !important;
    padding: 4px 8px 0;
    border-radius: 10px;
    margin-top: 4px;
}
.nav-tabs .nav-link {
    color: rgba(255,255,255,0.75) !important;
    border: none !important;
    border-radius: 4px 4px 0 0;
    padding: 4px 10px;
    font-size: 13px;
    transition: color 0.2s, background-color 0.2s;
}
.nav-tabs .nav-link:hover {
    color: #fff !important;
    background-color: rgba(255,255,255,0.15) !important;
}

/* ── #2: Active tab orange accent ─────────────────────────────────────────── */
.nav-tabs .nav-link.active {
    color: var(--nav-dark) !important;
    background-color: #f0f2f5 !important;
    font-weight: 600;
    border-top: 3px solid var(--btc-orange) !important;
}

/* Export row */
.export-row {
    background-color: var(--nav-dark) !important;
    border-top: none !important;
    padding: 6px 12px !important;
}
.export-row .btn { color: #fff !important; border-color: rgba(255,255,255,0.4) !important; }

/* ── #3: Card elevation on hover ──────────────────────────────────────────── */
.ctrl-card {
    border: 1px solid #dee2e6 !important;
    background: #f8f9fa !important;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
    border-radius: 8px !important;
}
.ctrl-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-color: #c8ccd0 !important;
}
.ctrl-card .card-body { padding: 8px !important; }

/* ── #4: Bitcoin-orange accent for primary actions ────────────────────────── */
.btn-share-accent {
    background-color: var(--btc-orange) !important;
    border-color: var(--btc-orange) !important;
    color: #fff !important;
    font-weight: 600;
    transition: filter 0.15s;
}
.btn-share-accent:hover {
    filter: brightness(1.1);
    color: #fff !important;
}
.btn-generate-accent {
    background-color: var(--btc-orange) !important;
    border-color: var(--btc-orange) !important;
    color: #fff !important;
}
.btn-generate-accent:hover {
    filter: brightness(1.1);
    color: #fff !important;
}

/* ── Splash quote modal ───────────────────────────────────────────────────── */
.splash-modal .modal-content {
    border-radius: 16px;
    border: none;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    background: linear-gradient(160deg, #fff 0%, #f8f6f0 100%);
}
.splash-modal .modal-body {
    border-radius: 16px;
}

/* ── #6: Smooth tab content fade-in ───────────────────────────────────────── */
.tab-content > .tab-pane {
    animation: fadeInTab 0.2s ease-in;
}
@keyframes fadeInTab {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ── #7: Price ticker pulse + green/red flash on update ───────────────────── */
.price-pulse {
    animation: pricePulse 0.6s ease-out;
}
@keyframes pricePulse {
    0%   { text-shadow: 0 0 8px rgba(247,147,26,0.8); }
    100% { text-shadow: none; }
}
.price-flash-green {
    animation: priceFlashGreen 1.2s ease-out !important;
}
.price-flash-red {
    animation: priceFlashRed 1.2s ease-out !important;
}
@keyframes priceFlashGreen {
    0%   { text-shadow: 0 0 12px rgba(0,200,80,0.9); color: #4cff88; }
    40%  { text-shadow: 0 0 6px rgba(0,200,80,0.4); }
    100% { text-shadow: none; color: rgba(255,255,255,0.9); }
}
@keyframes priceFlashRed {
    0%   { text-shadow: 0 0 12px rgba(255,60,60,0.9); color: #ff6b6b; }
    40%  { text-shadow: 0 0 6px rgba(255,60,60,0.4); }
    100% { text-shadow: none; color: rgba(255,255,255,0.9); }
}

/* ── #8: Better typography hierarchy — section headers ────────────────────── */
.form-label { font-size: 11px; color: #555; margin-bottom: 2px !important; }
.ctrl-section-header {
    font-size: 12px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
    padding-bottom: 2px;
    border-bottom: 1px solid #e0e0e0;
}

/* ── #9: Export row polish ─────────────────────────────────────────────────── */
.export-row-polished {
    background: #ebeef1;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 6px 10px;
    margin-top: 4px;
}
.export-row-polished .btn {
    background-color: var(--nav-dark) !important;
    border-color: var(--nav-dark) !important;
    color: #fff !important;
    font-weight: 500;
}
.export-row-polished .btn:hover {
    filter: brightness(1.15);
}

/* Compact sliders */
.rc-slider { margin-top: 4px; }

/* Compact checklists */
.form-check-label { font-size: 12px; }

/* Graph container — no excess padding, rounded corners */
.js-plotly-plot { width: 100%; border-radius: 8px; overflow: hidden; }

/* ── #10: Controls column scrollbar — navy themed ─────────────────────────── */
.controls-col {
    padding-right: 6px !important;
    scrollbar-width: thin;
    scrollbar-color: var(--nav-dark) #f0f2f5;
}
.controls-col::-webkit-scrollbar { width: 6px; }
.controls-col::-webkit-scrollbar-track { background: #f0f2f5; }
.controls-col::-webkit-scrollbar-thumb { background: var(--nav-dark); border-radius: 3px; }
.controls-col::-webkit-scrollbar-thumb:hover { background: var(--nav-lighter); }

/* Export row (legacy — overridden by polished variant) */
.export-row { border-top: 1px solid #dee2e6; padding-top: 4px; }

/* DataTable tweaks — already styled inline but reinforce */
.dash-table-container .dash-spreadsheet-container { font-size: 12px; }

/* FAQ links — slightly muted vs default bright blue */
.accordion a { color: #1a6fa8 !important; }
.accordion a:hover { color: #154e78 !important; }

/* ── #11: Loading skeleton shimmer ────────────────────────────────────────── */
.chart-loading-skeleton {
    background: linear-gradient(90deg, #e8eaed 25%, #f0f2f5 50%, #e8eaed 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
    min-height: 400px;
}
@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── Mobile nav drawer — auto-collapse row 2 after 3s ─────────────────── */
.mobile-nav-drawer {
    overflow: hidden;
    max-height: 40px;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    opacity: 1;
}
.mobile-nav-drawer.collapsed {
    max-height: 0;
    opacity: 0;
}
.mobile-nav-toggle {
    transition: opacity 0.3s ease;
}
.mobile-nav-toggle-hidden {
    opacity: 0;
    pointer-events: none;
}
.mobile-nav-toggle.visible {
    opacity: 1;
    pointer-events: auto;
}

/* ── Desktop nav drawer — auto-collapse after 4s ─────────────────────── */
.desktop-nav-drawer {
    overflow: hidden;
    max-height: 50px;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    opacity: 1;
    position: relative;
    z-index: 1050;
}
.desktop-nav-drawer.collapsed {
    max-height: 0;
    opacity: 0;
    pointer-events: none;
}
.desktop-nav-toggle {
    transition: opacity 0.3s ease;
}
.desktop-nav-toggle-hidden {
    opacity: 0;
    pointer-events: none;
}
.desktop-nav-toggle.visible {
    opacity: 1;
    pointer-events: auto;
}

/* ── #12: Logo glow + pulsing orange accents ─────────────────────────── */
.logo-glow {
    filter: drop-shadow(0 0 6px rgba(247,147,26,0.5));
    transition: filter 0.4s ease;
}
.logo-glow:hover {
    filter: drop-shadow(0 0 12px rgba(247,147,26,0.8))
            drop-shadow(0 0 24px rgba(247,147,26,0.3));
}

/* Gentle breathing pulse on the active tab's orange accent */
.nav-tabs .nav-link.active {
    animation: accentBreath 3s ease-in-out infinite;
}
@keyframes accentBreath {
    0%, 100% { border-top-color: var(--btc-orange); }
    50%      { border-top-color: #fbb034; }
}

/* ── Streak reward: orange Q in Quantoshi after 7-day streak ─────────── */
.brand-q {
    transition: color 0.6s ease, text-shadow 0.6s ease;
}
/* Orange color (applied first during ceremony) */
.brand-q.streak-orange,
.brand-q.streak-unlocked {
    color: var(--btc-orange) !important;
    text-shadow: none;
    position: relative;
}
/* Hat (applied after color during ceremony) */
.brand-q.streak-hat::before,
.brand-q.streak-unlocked::before {
    content: "";
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%) rotate(12deg);
    width: 20px;
    height: 17px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 18'%3E%3Cpolygon points='10,0 3,12 17,12' fill='%233a2d7c' stroke='%23fff' stroke-width='0.7'/%3E%3Crect x='1' y='11' width='18' height='3' rx='1' fill='%232d2266' stroke='%23fff' stroke-width='0.5'/%3E%3Ctext x='9' y='8' font-size='4' fill='%23ffd700' text-anchor='middle'%3E%E2%98%85%3C/text%3E%3C/svg%3E") no-repeat center/contain;
    pointer-events: none;
    animation: hatAppear 0.4s ease-out;
}
@keyframes hatAppear {
    0%   { opacity: 0; transform: translateX(-50%) rotate(12deg) scale(0.3); }
    60%  { transform: translateX(-50%) rotate(16deg) scale(1.15); }
    100% { opacity: 1; transform: translateX(-50%) rotate(12deg) scale(1); }
}

/* ── Streak reward: gold reflection on "Quantoshi" text ──────────────── */
.brand-uantoshi.streak-shimmer {
    background: linear-gradient(
        90deg,
        #fff 0%, #fff 35%,
        #ffd700 42%, #f7931a 50%, #ffd700 58%,
        #fff 65%, #fff 100%
    );
    background-size: 250% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: goldShimmer 20s ease-in-out infinite;
}
@keyframes goldShimmer {
    0%   { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

/* ── Knighting ceremony: Orange Q streak unlock ──────────────────────── */
.knight-overlay {
    position: fixed;
    inset: 0;
    z-index: 11000;
    background: rgba(0, 0, 0, 0);
    animation: knightDim 1.2s ease-out forwards;
    pointer-events: none;
}
@keyframes knightDim {
    to { background: rgba(0, 0, 0, 0.6); }
}
.knight-fade-out {
    animation: knightFadeOut 1s ease-in forwards !important;
}
@keyframes knightFadeOut {
    to { opacity: 0; }
}

.knight-staff {
    position: fixed;
    width: 40px;
    top: -320px;
    animation: staffDescend 1.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    z-index: 11001;
    filter: drop-shadow(0 0 12px rgba(247, 147, 26, 0.6));
}
.knight-staff svg {
    width: 40px;
    height: 300px;
}
@keyframes staffDescend {
    0%   { top: -320px; }
    100% { top: 30px; }
}
.knight-staff-retract {
    animation: staffRetract 1s cubic-bezier(0.55, 0, 1, 0.45) forwards !important;
}
@keyframes staffRetract {
    to { top: -320px; }
}

.knight-flash {
    animation: knightQFlash 2s ease-out !important;
    color: var(--btc-orange) !important;
}
@keyframes knightQFlash {
    0%   { text-shadow: 0 0 30px #ffd700, 0 0 60px #f7931a, 0 0 90px #ffd700; }
    50%  { text-shadow: 0 0 20px #ffd700, 0 0 40px #f7931a; }
    100% { text-shadow: 0 0 8px rgba(247, 147, 26, 0.4); }
}

.knight-ring {
    position: fixed;
    width: 0;
    height: 0;
    border: 2px solid #ffd700;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: knightRing 1.5s ease-out forwards;
    pointer-events: none;
}
@keyframes knightRing {
    0%   { width: 0; height: 0; opacity: 1; border-width: 3px; }
    100% { width: 300px; height: 300px; opacity: 0; border-width: 1px; }
}

.knight-particle {
    position: fixed;
    font-size: 16px;
    color: #ffd700;
    pointer-events: none;
    animation: knightBurst 1.5s ease-out forwards;
    z-index: 11002;
}
@keyframes knightBurst {
    0%   { transform: translate(0, 0) scale(1); opacity: 1; }
    100% { transform: translate(var(--dx), var(--dy)) scale(0.3); opacity: 0; }
}

.knight-text {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #ffd700;
    font-family: "Palatino Linotype", Palatino, "Book Antiqua", serif;
    font-size: 28px;
    font-weight: bold;
    text-align: center;
    line-height: 1.5;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.5), 0 2px 8px rgba(0,0,0,0.5);
    letter-spacing: 1px;
    animation: knightTextIn 1s ease-out;
    z-index: 11003;
}
@keyframes knightTextIn {
    0%   { opacity: 0; transform: translate(-50%, -40%) scale(0.8); }
    100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.knight-confetti {
    position: fixed;
    top: -20px;
    font-size: 14px;
    color: #ffd700;
    pointer-events: none;
    animation: knightFall linear forwards;
    opacity: 0.8;
    z-index: 11002;
}
@keyframes knightFall {
    0%   { top: -20px; opacity: 0.9; transform: rotate(0deg); }
    100% { top: 110vh; opacity: 0.2; transform: rotate(360deg); }
}

@media (max-width: 767px) {
    .knight-text {
        font-size: 20px;
    }
    .knight-ring {
        display: none;
    }
}

/* ── #10: Parallax depth — navbar responds to mouse ──────────────────── */
.navbar-parallax {
    transition: transform 0.15s ease-out;
    will-change: transform;
}

/* ── Mobile navbar touch targets — min 44px per Apple HIG ─────────────── */
.nav-touch-target {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ── Block Drop: new-block celebration animation ─────────────────────────── */

/* Screen shake */
.block-shake {
    animation: blockShake 0.4s ease-in-out;
}
@keyframes blockShake {
    0%, 100% { transform: translate(0, 0); }
    10%      { transform: translate(-3px, 2px); }
    20%      { transform: translate(4px, -2px); }
    30%      { transform: translate(-4px, -1px); }
    40%      { transform: translate(3px, 3px); }
    50%      { transform: translate(-2px, -3px); }
    60%      { transform: translate(3px, 1px); }
    70%      { transform: translate(-3px, 2px); }
    80%      { transform: translate(2px, -1px); }
    90%      { transform: translate(-1px, 2px); }
}

/* Full-screen click/tap overlay */
.blockdrop-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 9999;
    pointer-events: auto;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* The falling block — jagged rock with SVG polygon mask */
.blockdrop-cube {
    position: absolute;
    left: 50%;
    width: 170px;
    height: 150px;
    margin-left: -85px;
    background:
        /* Mineral veins */
        radial-gradient(ellipse at 25% 15%, rgba(180,160,120,0.25) 0%, transparent 40%),
        radial-gradient(ellipse at 75% 85%, rgba(0,0,0,0.2) 0%, transparent 35%),
        radial-gradient(circle at 60% 40%, rgba(120,100,70,0.15) 0%, transparent 30%),
        radial-gradient(circle at 10% 70%, rgba(0,0,0,0.12) 0%, transparent 25%),
        radial-gradient(circle at 90% 20%, rgba(200,180,140,0.1) 0%, transparent 20%),
        /* Base stone */
        linear-gradient(170deg, #7a6a4f 0%, #665535 20%, #55472a 45%, #483c22 65%, #3a3018 85%, #2e2510 100%);
    /* Jagged polygon shape — irregular rock silhouette */
    clip-path: polygon(
        12% 2%, 28% 0%, 45% 4%, 60% 1%, 78% 3%, 92% 8%,
        98% 22%, 100% 40%, 97% 58%, 99% 75%, 95% 88%, 88% 97%,
        72% 100%, 55% 96%, 38% 100%, 22% 97%, 8% 92%,
        2% 78%, 0% 60%, 3% 42%, 1% 25%, 5% 12%
    );
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7),
                0 3px 10px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    overflow: hidden;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
/* Rough surface: layered grain + chisel marks */
.blockdrop-cube::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image:
        /* Grain */
        repeating-linear-gradient(52deg,
            transparent, transparent 6px,
            rgba(0,0,0,0.06) 6px, rgba(0,0,0,0.06) 7px),
        repeating-linear-gradient(-38deg,
            transparent, transparent 10px,
            rgba(255,255,255,0.04) 10px, rgba(255,255,255,0.04) 11px),
        /* Pitting */
        radial-gradient(circle 2px at 20% 30%, rgba(0,0,0,0.12) 0%, transparent 100%),
        radial-gradient(circle 3px at 65% 55%, rgba(0,0,0,0.1) 0%, transparent 100%),
        radial-gradient(circle 2px at 40% 80%, rgba(0,0,0,0.08) 0%, transparent 100%),
        radial-gradient(circle 1px at 80% 20%, rgba(0,0,0,0.1) 0%, transparent 100%);
    pointer-events: none;
}
/* Highlight edge — top-left light source */
.blockdrop-cube::after {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.08) 0%, transparent 40%,
                transparent 70%, rgba(0,0,0,0.15) 100%);
    pointer-events: none;
}
.blockdrop-label {
    color: #f7931a;
    font-size: 18px;
    font-weight: 700;
    font-family: monospace;
    text-shadow: 0 1px 4px rgba(0,0,0,0.6), 0 0 12px rgba(247,147,26,0.3);
    z-index: 1;
}
.blockdrop-sublabel {
    color: rgba(255,220,160,0.8);
    font-size: 11px;
    font-family: monospace;
    margin-top: 3px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
    z-index: 1;
}

/* Fall animation — heavy drop with acceleration */
.blockdrop-fall {
    top: -180px;
    animation: blockFall 1.1s cubic-bezier(0.55, 0, 1, 0.45) forwards;
}
@keyframes blockFall {
    0%   { top: -180px; opacity: 0; }
    10%  { opacity: 1; }
    100% { top: calc(75vh - 70px); opacity: 1; }
}
.blockdrop-landed {
    top: calc(75vh - 70px);
}

/* Landing bounce — heavy impact squash */
.blockdrop-bounce {
    animation: blockBounce 0.5s ease-out;
}
@keyframes blockBounce {
    0%   { transform: scaleY(0.75) scaleX(1.2); }
    25%  { transform: scaleY(1.1) scaleX(0.92); }
    50%  { transform: scaleY(0.93) scaleX(1.05); }
    75%  { transform: scaleY(1.03) scaleX(0.98); }
    100% { transform: scaleY(1) scaleX(1); }
}

/* Tap hit micro-shake */
.blockdrop-hit {
    animation: blockHit 0.15s ease-out;
}
@keyframes blockHit {
    0%   { transform: rotate(0deg); }
    25%  { transform: rotate(-3deg) scale(0.96); }
    50%  { transform: rotate(2deg); }
    100% { transform: rotate(0deg) scale(1); }
}

/* Progressive crack overlays */
.blockdrop-crack {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    opacity: 0;
    pointer-events: none;
}
/* Crack lines as pseudo-borders / gradients */
.blockdrop-crack-1 {
    background: linear-gradient(135deg,
        transparent 40%, rgba(0,0,0,0.3) 40%, rgba(0,0,0,0.3) 41%, transparent 41%);
}
.blockdrop-crack-2 {
    background: linear-gradient(45deg,
        transparent 30%, rgba(0,0,0,0.3) 30%, rgba(0,0,0,0.3) 31%, transparent 31%),
        linear-gradient(160deg,
        transparent 55%, rgba(0,0,0,0.25) 55%, rgba(0,0,0,0.25) 56%, transparent 56%);
}
.blockdrop-crack-3 {
    background: linear-gradient(100deg,
        transparent 20%, rgba(0,0,0,0.3) 20%, rgba(0,0,0,0.3) 21%, transparent 21%),
        linear-gradient(70deg,
        transparent 60%, rgba(0,0,0,0.25) 60%, rgba(0,0,0,0.25) 61%, transparent 61%);
}
.blockdrop-crack-4 {
    background: linear-gradient(30deg,
        transparent 45%, rgba(0,0,0,0.35) 45%, rgba(0,0,0,0.35) 46%, transparent 46%),
        linear-gradient(150deg,
        transparent 35%, rgba(0,0,0,0.3) 35%, rgba(0,0,0,0.3) 36%, transparent 36%);
}
/* Show cracks progressively based on data-cracks attribute */
[data-cracks="1"] .blockdrop-crack-1 { opacity: 1; }
[data-cracks="2"] .blockdrop-crack-1,
[data-cracks="2"] .blockdrop-crack-2 { opacity: 1; }
[data-cracks="3"] .blockdrop-crack-1,
[data-cracks="3"] .blockdrop-crack-2,
[data-cracks="3"] .blockdrop-crack-3 { opacity: 1; }
[data-cracks="4"] .blockdrop-crack-1,
[data-cracks="4"] .blockdrop-crack-2,
[data-cracks="4"] .blockdrop-crack-3,
[data-cracks="4"] .blockdrop-crack-4 { opacity: 1; }

/* Block fragments on shatter */
.blockdrop-fragment {
    position: fixed;
    width: 44px;
    height: 38px;
    background: linear-gradient(145deg, #7a6a4f 0%, #3a3018 100%);
    clip-path: polygon(10% 0%, 85% 5%, 100% 35%, 90% 100%, 15% 95%, 0% 50%);
    margin-left: -22px;
    margin-top: -19px;
    animation: fragScatter 0.8s cubic-bezier(0.25, 1, 0.5, 1) forwards;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
@keyframes fragScatter {
    0%   { transform: translate(0, 0) rotate(0deg); opacity: 1; }
    100% { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); opacity: 0; }
}

/* Transaction elements that fly away */
.blockdrop-tx {
    position: fixed;
    font-size: 9px;
    font-family: monospace;
    font-weight: 700;
    color: var(--btc-orange);
    background: rgba(247,147,26,0.12);
    padding: 2px 6px;
    border-radius: 8px;
    border: 1px solid rgba(247,147,26,0.3);
    margin-left: -12px;
    margin-top: -8px;
    white-space: nowrap;
    pointer-events: none;
    animation: txScatter 1.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes txScatter {
    0%   { transform: translate(0, 0) scale(1); opacity: 1; }
    60%  { opacity: 0.8; }
    100% { transform: translate(var(--dx), var(--dy)) scale(0.5); opacity: 0; }
}

/* ── Magic Internet Money Wizard ──────────────────────────────────────── */
.wizard-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 10000;
    pointer-events: none;
    overflow: hidden;
}
.wizard-sprite {
    position: absolute;
    transition: none;
    white-space: nowrap;
    filter: drop-shadow(0 0 14px rgba(247,147,26,0.5))
            drop-shadow(0 2px 6px rgba(0,0,0,0.3));
}
.wizard-sprite.wizard-flip {
    transform: scaleX(-1);
}
.wizard-svg {
    width: 110px;
    height: 160px;
    animation: wizardBob 0.6s ease-in-out infinite alternate;
}
@keyframes wizardBob {
    0%   { transform: rotate(-3deg); }
    100% { transform: rotate(3deg); }
}

/* Sparkle trail */
.wizard-sparkle {
    position: absolute;
    font-size: 16px;
    pointer-events: none;
    animation: sparkleFloat 1.4s ease-out forwards;
    opacity: 1;
}
@keyframes sparkleFloat {
    0%   { transform: translate(0, 0) scale(1); opacity: 1; }
    100% { transform: translate(var(--drift), 60px) scale(0.3); opacity: 0; }
}

/* Reason toast — floats below wizard path */
.wizard-toast {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(247,147,26,0.9);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    font-family: monospace;
    padding: 6px 18px;
    border-radius: 20px;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    animation: toastFade 4s ease-out forwards;
    pointer-events: none;
}
@keyframes toastFade {
    0%   { opacity: 0; transform: translateX(-50%) translateY(10px); }
    15%  { opacity: 1; transform: translateX(-50%) translateY(0); }
    75%  { opacity: 1; }
    100% { opacity: 0; }
}

/* ── Mobile: block drop sizing ────────────────────────────────────────── */
@media (max-width: 767px) {
    .blockdrop-cube {
        width: 130px;
        height: 115px;
        margin-left: -65px;
    }
    .blockdrop-label { font-size: 15px; }
    .blockdrop-sublabel { font-size: 10px; }
    .blockdrop-fragment { width: 34px; height: 30px; }
}

/* ── Mobile: stack controls below chart ─────────────────────────────────── */
@media (max-width: 767px) {
    .controls-col {
        order: 2;
        max-height: none !important;
        width: 100% !important;
    }
    .tab-content .row.g-0 {
        flex-direction: column;
    }
    .tab-content .row.g-0 > .col-9,
    .tab-content .row.g-0 > .col-3 {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100%;
    }
    /* Constrain both the dcc.Graph wrapper and the inner Plotly div.
       Without this the wrapper stays at 78vh while the plot is only 55vw,
       leaving a large blank gap that makes controls appear unreachable. */
    [id$="-graph"] {
        height: 55vw !important;
        min-height: 280px !important;
    }
    .js-plotly-plot {
        height: 55vw !important;
        min-height: 280px !important;
    }
}

/* ── Site footer: block height + halving countdown ────────────────────────── */
.site-footer {
    opacity: 0.7;
    transition: opacity 0.3s;
}
.site-footer:hover {
    opacity: 1;
}

/* ── Ambient toast (birthday, night owl) ──────────────────────────────────── */
.ambient-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(44, 62, 80, 0.92);
    color: #fff;
    padding: 10px 22px;
    border-radius: 20px;
    font-size: 13px;
    font-family: "Palatino Linotype", Palatino, serif;
    letter-spacing: 0.3px;
    z-index: 9999;
    pointer-events: none;
    animation: ambientToastIn 0.5s ease-out, ambientToastOut 0.5s ease-in 5.5s forwards;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    max-width: 90vw;
    text-align: center;
}
@keyframes ambientToastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(20px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
@keyframes ambientToastOut {
    from { opacity: 1; }
    to   { opacity: 0; }
}
