/* Glassy Seasons — bảng màu theo lễ (ghi đè biến màu của theme) + trang trí */

/* Màu chủ đạo: dựa trên hue của từng lễ (đặt ở <head> qua html.gnse-<lễ>{--gh1,--gh2,--gh3,--gc}) */
html.gnse-on[data-theme="dark"] {
    --accent: oklch(78% calc(.14 * var(--gc, 1)) var(--gh1));
    --accent-hover: oklch(84% calc(.13 * var(--gc, 1)) var(--gh1));
    --accent-subtle: oklch(78% calc(.14 * var(--gc, 1)) var(--gh1) / .16);
    --accent-fg: oklch(18% .05 var(--gh1));
    --accent-2: oklch(80% calc(.12 * var(--gc, 1)) var(--gh2));
    --accent-3: oklch(76% calc(.16 * var(--gc, 1)) var(--gh3));
}
html.gnse-on[data-theme="light"] {
    --accent: oklch(52% calc(.22 * var(--gc, 1)) var(--gh1));
    --accent-hover: oklch(46% calc(.23 * var(--gc, 1)) var(--gh1));
    --accent-subtle: oklch(52% calc(.22 * var(--gc, 1)) var(--gh1) / .12);
    --accent-fg: oklch(99% .01 var(--gh1));
    --accent-2: oklch(58% calc(.14 * var(--gc, 1)) var(--gh2));
    --accent-3: oklch(60% calc(.2 * var(--gc, 1)) var(--gh3));
    --orb-1: oklch(78% calc(.15 * var(--gc, 1)) var(--gh1) / .6);
    --orb-2: oklch(86% calc(.10 * var(--gc, 1)) var(--gh2) / .6);
    --orb-3: oklch(84% calc(.12 * var(--gc, 1)) var(--gh3) / .5);
}

/* Lớp hạt (canvas) — nằm dưới header (100) và các dock (89/90), không bắt chuột */
.gnse-canvas { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 30; pointer-events: none; }

/* Dây trang trí treo trên đỉnh trang */
.gnse-garland { position: fixed; top: 0; left: 0; right: 0; height: 64px; z-index: 101; pointer-events: none; overflow: hidden; }
html.gnse-fx-off .gnse-garland, html.gnse-fx-off .gnse-canvas { display: none; }
.gnse-lights { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.gnse-lights path { fill: none; stroke: rgba(30, 30, 30, .55); stroke-width: 1.6; }
.gnse-lights .b { animation: gnse-twinkle 2.4s ease-in-out infinite; filter: drop-shadow(0 0 5px currentColor); }
@keyframes gnse-twinkle { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

.gnse-hang { position: absolute; top: -2px; transform-origin: 50% 0; animation: gnse-swing 4.2s ease-in-out infinite; }
.gnse-hang::before { content: ''; display: block; width: 1.5px; margin: 0 auto; background: rgba(160, 160, 160, .75); height: var(--len, 12px); }
.gnse-hang span { display: block; line-height: 1; text-align: center; font-size: var(--fs, 24px); margin-top: -2px; filter: drop-shadow(0 3px 5px rgba(0, 0, 0, .3)); }
@keyframes gnse-swing { 0%, 100% { transform: rotate(-5deg); } 50% { transform: rotate(5deg); } }

/* Lời chúc */
.gnse-toast {
    position: fixed; bottom: 62px; left: 50%; z-index: 98; transform: translate(-50%, 12px); opacity: 0;
    display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 18px; width: max-content; max-width: min(560px, calc(100vw - 32px));
    border-radius: 100px; font-family: var(--font-ui, system-ui, sans-serif); font-size: .9375rem; line-height: 1.4; color: var(--fg-1, #fff);
    background: var(--glass-bg-strong, rgba(30, 28, 50, .72));
    -webkit-backdrop-filter: blur(22px) saturate(160%); backdrop-filter: blur(22px) saturate(160%);
    border: 1px solid var(--glass-border, rgba(255, 255, 255, .16)); box-shadow: var(--glass-shadow, 0 8px 32px rgba(0, 0, 0, .35)), inset 0 1px 0 var(--glass-highlight, rgba(255, 255, 255, .2));
    transition: opacity .35s ease, transform .35s ease;
}
.gnse-toast.is-in { opacity: 1; transform: translate(-50%, 0); }
.gnse-toast__e { font-size: 1.25rem; }
.gnse-toast__t { flex: 1 1 auto; min-width: 0; }
.gnse-toast button { appearance: none; border: 0; cursor: pointer; font: inherit; font-size: .8125rem; font-weight: 700; padding: 7px 12px; border-radius: 100px; color: var(--fg-1, #fff); background: rgba(255, 255, 255, .12); white-space: nowrap; }
[data-theme="light"] .gnse-toast button { background: rgba(80, 60, 150, .1); }
.gnse-toast button:hover { background: rgba(255, 255, 255, .22); }
.gnse-toast .gnse-x { width: 30px; height: 30px; padding: 0; font-size: 1rem; }

/* Nút bật/tắt hiệu ứng — giữa đáy trang (hai góc đã có dock đọc truyện) */
.gnse-toggle {
    position: fixed; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 88;
    width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; font-size: 15px; line-height: 1;
    color: var(--fg-1, #fff); background: var(--glass-bg-strong, rgba(30, 28, 50, .6)); border: 1px solid var(--glass-border, rgba(255, 255, 255, .16));
    -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); opacity: .55; transition: opacity .2s ease;
}
.gnse-toggle:hover, .gnse-toggle:focus-visible { opacity: 1; }
html.gnse-fx-off .gnse-toggle { filter: grayscale(1); opacity: .4; }
.gnse-toggle:focus-visible, .gnse-toast button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (max-width: 640px) {
    .gnse-toast { top: 78px; bottom: auto; transform: translate(-50%, -12px); border-radius: 22px; }
    .gnse-garland { height: 54px; }
}
@media (prefers-reduced-motion: reduce) {
    .gnse-hang, .gnse-lights .b { animation: none; }
    .gnse-toast { transition: none; }
}
