/* ===== Základ ===== */
:root {
    --red: #b3121c;
    --red-dark: #7a0b12;
    --paper: #f7ecd8;
    --ink: #3a2a1a;
    --gold: #ffd27a;
    --script: "Segoe Script", "Brush Script MT", "Apple Chancery", "URW Chancery L", "Z003", cursive;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

/* Pozadí: fotka zimního okna a stolu (background.jpg) */
html {
    min-height: 100%;
    background-color: #0d1a33;
}

body {
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    user-select: none;
    color: var(--ink);
}

/* Fixní vrstva s obrázkem (funguje i na mobilech, kde background-attachment: fixed selhává) */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -2;
    pointer-events: none;
    background: #0d1a33 url("background.jpg") center center / cover no-repeat;
}

/* Jemné ztmavení okrajů, aby obsah dobře vynikl */
body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(ellipse 70% 80% at 50% 55%, transparent 40%, rgba(5, 10, 25, .35) 100%);
}

a { color: var(--red); }

/* ===== Dekorace ===== */
.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

/* Girlanda a koule jsou už součástí pozadí */
.garland, .bauble { display: none; }

.garland {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 46px;
    pointer-events: none;
    background:
        radial-gradient(circle at 50% 70%, #fff1c9 0 3px, rgba(255, 200, 110, .55) 4px, transparent 13px) 0 0 / 64px 46px repeat-x,
        radial-gradient(circle at 50% 30%, #ffe0a0 0 2px, rgba(255, 170, 80, .45) 3px, transparent 10px) 32px 0 / 64px 46px repeat-x;
    animation: twinkle 2.4s ease-in-out infinite alternate;
}

@keyframes twinkle {
    from { opacity: .65; }
    to   { opacity: 1; }
}

.bauble {
    position: fixed;
    width: 74px;
    height: 74px;
    border-radius: 50%;
    pointer-events: none;
    background: radial-gradient(circle at 34% 30%, #ff9a9a 0, #d01622 32%, #8a0a12 70%, #4a0006 100%);
    box-shadow: 0 10px 25px rgba(0, 0, 0, .5), 0 0 30px rgba(255, 80, 80, .25);
    transform-origin: 50% -120px;
    animation: swing 6s ease-in-out infinite alternate;
}

.bauble::before {          /* čepička */
    content: "";
    position: absolute;
    top: -9px;
    left: 50%;
    width: 18px;
    height: 12px;
    transform: translateX(-50%);
    border-radius: 3px 3px 1px 1px;
    background: linear-gradient(90deg, #8a6a20, #f3d27a, #8a6a20);
}

.bauble::after {           /* provázek */
    content: "";
    position: absolute;
    bottom: 100%;
    left: 50%;
    width: 1px;
    height: 200px;
    margin-bottom: 9px;
    background: rgba(255, 230, 180, .5);
}

.bauble-left  { top: 120px; left: 4%; }
.bauble-right { top: 80px;  right: 5%; width: 62px; height: 62px; animation-delay: -3s; }

@keyframes swing {
    from { transform: rotate(-3deg); }
    to   { transform: rotate(3deg); }
}

/* ===== Rozvržení stránky ===== */
.page {
    position: relative;
    z-index: 1;
    height: 100vh;
    height: 100dvh;
    min-height: 480px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: clamp(46px, 8vh, 72px) 14px clamp(12px, 3vh, 26px);
    gap: clamp(8px, 2vh, 20px);
    text-align: center;
}

.page-form {
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    justify-content: center;
}

/* ===== Visačka ===== */
.tag {
    position: relative;
    flex: 0 0 auto;
    width: min(560px, 100%);
    padding: clamp(22px, 4vh, 36px) clamp(18px, 5vw, 48px) clamp(14px, 2.5vh, 24px);
    border-radius: 26px;
    background:
        radial-gradient(ellipse at 50% 35%, #fffaf0 0%, var(--paper) 55%, #e8d1aa 100%);
    box-shadow:
        0 18px 40px rgba(0, 0, 0, .45),
        0 0 60px rgba(255, 200, 110, .25),
        inset 0 0 30px rgba(160, 110, 50, .25);
}

.tag::before {             /* čárkovaný okraj */
    content: "";
    position: absolute;
    inset: 10px;
    border: 2px dashed rgba(150, 30, 35, .45);
    border-radius: 18px;
    pointer-events: none;
}

.tag-bow {
    position: absolute;
    top: clamp(-46px, -6vw, -34px);
    left: 50%;
    width: clamp(130px, 26vw, 190px);
    aspect-ratio: 200 / 95;
    transform: translateX(-50%);
    filter: drop-shadow(0 4px 4px rgba(0, 0, 0, .35));
    pointer-events: none;
}

.tag-bow svg { width: 100%; height: 100%; display: block; }

.tag-top,
.subtitle-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    color: rgba(160, 30, 35, .75);
}

.tag-top { margin-top: 10px; }

.tag-icon {
    width: clamp(28px, 5vw, 38px);
    height: clamp(28px, 5vw, 38px);
    color: #2a2a2a;
}

.circuit {
    width: clamp(50px, 12vw, 90px);
    height: 16px;
    flex: 0 1 auto;
}

.circuit.flip { transform: scaleX(-1); }

.title {
    margin: 2px 0 4px;
    padding: 0 .3em;           /* rezerva pro zvoneček a od čárkovaného rámečku */
    display: flex;
    justify-content: center;
    align-items: center;
    gap: clamp(10px, 3vw, 24px);
    font-family: var(--script);
    font-weight: bold;
    font-size: clamp(36px, 8vw, 64px);
    line-height: 1.15;
    color: var(--red);
    text-shadow: 0 2px 0 #fff, 0 4px 8px rgba(120, 20, 20, .25);
}

.title-text { position: relative; white-space: nowrap; }

.bell {
    position: absolute;
    left: -.4em;
    top: -.36em;
    width: .72em;
    height: .72em;
    transform: rotate(-20deg);
    transform-origin: 50% 12%;
    animation: bell-ring 7s 2s ease-in-out infinite;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .25));
}

/* zvoneček občas cinkne (krátké zhoupnutí, pak dlouho klid) */
@keyframes bell-ring {
    0%, 84%, 100% { transform: rotate(-20deg); }
    87% { transform: rotate(-4deg); }
    90% { transform: rotate(-34deg); }
    93% { transform: rotate(-10deg); }
    96% { transform: rotate(-26deg); }
}

.tag-flake {
    font-family: "Segoe UI Symbol", sans-serif;
    font-size: .42em;
    color: rgba(170, 30, 35, .8);
    text-shadow: none;
}

.subtitle {
    margin: 0;
    font-size: clamp(15px, 2.6vw, 20px);
    font-weight: 600;
    line-height: 1.35;
    color: var(--ink);
}

/* ===== Dárky ===== */
#giftContainer {
    position: relative;
    flex: 1 1 0;
    min-height: 0;
    width: 100%;
    max-width: 900px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

#giftContainer::before {   /* zlatá záře za dárky */
    content: "";
    position: absolute;
    inset: -5% 5%;
    z-index: -1;
    background: radial-gradient(ellipse at center, rgba(255, 215, 130, .55), rgba(255, 180, 80, .18) 45%, transparent 70%);
    pointer-events: none;
}

.row {
    display: flex;
    justify-content: center;
    align-items: center;
}

.gift {
    width: 90px;
    height: 90px;
    cursor: pointer;
    outline: none;
    filter: drop-shadow(0 8px 6px rgba(0, 0, 0, .4));
    transition: transform .3s ease, filter .3s ease;
}

.gift svg {
    display: block;
    width: 100%;
    height: 100%;
    overflow: visible;
}

.gift-icon {
    color: #2b2b2b;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.gift:hover,
.gift:focus-visible {
    transform: translateY(-6px) scale(1.08);
    filter: drop-shadow(0 12px 10px rgba(0, 0, 0, .45)) drop-shadow(0 0 14px rgba(255, 210, 120, .8));
}

.gift-lid {
    transform-box: fill-box;
    transform-origin: 50% 100%;
}

.opened {
    animation: pop .4s .3s forwards ease-in;
    pointer-events: none;
}

.opened .gift-lid {
    animation: lid-off .45s forwards ease-out;
}

.done {
    opacity: 0;
    cursor: default;
    pointer-events: none;
}

@keyframes lid-off {
    to { transform: translate(15%, -120%) rotate(25deg); opacity: 0; }
}

@keyframes pop {
    0%   { transform: scale(1);   opacity: 1; }
    30%  { transform: scale(1.15); opacity: 1; }
    100% { transform: scale(0);   opacity: 0; }
}

/* ===== Výsledek (jméno) ===== */
.name-box,
.result {
    padding: clamp(18px, 4vw, 30px) clamp(20px, 5vw, 40px);
    width: min(460px, 86vw);
    border-radius: 22px;
    border: 3px solid #d9b25a;
    background: radial-gradient(ellipse at 50% 35%, #fffaf0 0%, var(--paper) 60%, #e8d1aa 100%);
    box-shadow: 0 18px 40px rgba(0, 0, 0, .45), 0 0 40px rgba(255, 210, 120, .45);
    user-select: text;
}

.name-box {
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 999;
    visibility: hidden;
    opacity: 0;
    transform: translate(-50%, -40%) scale(.9);
    transition: opacity .7s ease, transform .7s ease, visibility 0s .7s;
}

.name-box.show {
    visibility: visible;
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    transition: opacity .5s ease, transform .8s cubic-bezier(.2, 1.5, .4, 1);
}

/* stránka "už jsi losoval": okénko se jménem a nad ním otevřený dárek */
.result {
    position: relative;
    margin: auto 0;
    padding-top: clamp(46px, 7vh, 58px);
}

/* stránka může rolovat (malé displeje na šířku) a nad okénkem je místo pro dárek */
.page-result {
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
}

.page-result .tag { margin-bottom: clamp(56px, 9vh, 76px); }

.open-gift {
    position: absolute;
    top: clamp(-78px, -10vh, -62px);
    left: 50%;
    width: clamp(96px, 14vh, 120px);
    height: clamp(96px, 14vh, 120px);
    transform: translateX(-50%);
    overflow: visible;
    filter: drop-shadow(0 8px 6px rgba(0, 0, 0, .35));
    pointer-events: none;
}

.open-gift-lid,
.open-gift-glow {
    transform-box: fill-box;
    transform-origin: 50% 100%;
}

/* víko odletí nahoru a pak se nad krabicí lehce vznáší */
.open-gift-lid {
    animation: lid-open .9s 1s cubic-bezier(.3, 1.5, .5, 1) both,
               lid-float 3s 1.9s ease-in-out infinite alternate;
}

@keyframes lid-open {
    from { transform: none; }
    to   { transform: translate(6%, -42%) rotate(-12deg); }
}

@keyframes lid-float {
    from { transform: translate(6%, -42%) rotate(-12deg); }
    to   { transform: translate(2%, -58%) rotate(-7deg); }
}

/* z otevřené krabice vychází zlaté světlo */
.open-gift-glow {
    transform-origin: 50% 50%;
    animation: glow-in .8s 1.2s ease-out both, glow-pulse 2.4s 2s ease-in-out infinite alternate;
}

@keyframes glow-in {
    from { opacity: 0; transform: scale(.3); }
}

@keyframes glow-pulse {
    from { opacity: 1;  transform: scale(1); }
    to   { opacity: .6; transform: scale(1.12); }
}

.result-meta {
    margin: 12px 0 0;
    font-size: clamp(12px, 2vw, 14px);
}

.result-meta code {
    font-family: "Consolas", "DejaVu Sans Mono", "Courier New", monospace;
    color: #2f7a3a;
}

.name-label {
    display: block;
    font-size: clamp(15px, 2.6vw, 19px);
    font-weight: 600;
    color: var(--ink);
}

.name {
    display: block;
    margin-top: 6px;
    font-family: var(--script);
    font-size: clamp(30px, 7vw, 52px);
    line-height: 1.2;
    color: var(--red);
    text-shadow: 0 2px 0 #fff;
    overflow-wrap: anywhere;
}

/* ===== Tlačítka a patička ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 26px;
    border: 2px solid rgba(255, 215, 160, .45);
    border-radius: 999px;
    background: linear-gradient(180deg, #c4161f, var(--red-dark));
    color: #fff;
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 6px 14px rgba(0, 0, 0, .4), inset 0 1px 0 rgba(255, 255, 255, .25);
    transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
}

.btn:hover,
.btn:focus-visible {
    transform: translateY(-2px);
    filter: brightness(1.12);
    box-shadow: 0 10px 20px rgba(0, 0, 0, .45), 0 0 16px rgba(255, 120, 120, .45);
    outline: none;
}

.btn-icon { width: 18px; height: 18px; }

.footer-line {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(6px, 2vw, 14px);
    color: rgba(255, 210, 160, .65);
}

.tree {
    width: 16px;
    height: 20px;
    color: #2f7a3a;
    filter: drop-shadow(0 0 4px rgba(120, 255, 140, .35));
}

/* ===== Formuláře ===== */
.form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 18px auto 6px;
    max-width: 340px;
}

.form input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #d6c3a0;
    border-radius: 10px;
    background: #fffdf7;
    color: var(--ink);
    font: inherit;
    font-size: 16px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, .08);
}

.form input:focus {
    outline: none;
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(179, 18, 28, .2);
}

.form .btn { width: 100%; margin-top: 4px; }

.form-link {
    margin: 10px 0 4px;
    font-size: 15px;
}

.msg {
    margin: 14px auto 0;
    max-width: 340px;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(179, 18, 28, .1);
    border: 1px solid rgba(179, 18, 28, .3);
    color: var(--red-dark);
    font-weight: 600;
}

/* ===== Patička s vtipem ===== */
.credits {
    flex: 0 0 auto;
    margin: 0;
    font-size: clamp(11px, 1.8vw, 13px);
    color: rgba(255, 225, 185, .6);
    text-shadow: 0 1px 2px rgba(0, 0, 0, .6);
}

.credits code {
    font-family: "Consolas", "DejaVu Sans Mono", "Courier New", monospace;
    color: rgba(160, 255, 180, .75);
}

.page-form .credits { margin-top: 10px; }

/* ===== Pára nad hrnkem ===== */
.steam {
    position: fixed;
    z-index: 0;
    width: 1.3em;
    height: 2.4em;
    transform: translate(-50%, -100%);
    pointer-events: none;
}

.steam span {
    position: absolute;
    bottom: -.15em;
    left: 50%;
    width: .55em;
    height: .55em;
    margin-left: -.275em;
    border-radius: 50%;
    background: radial-gradient(closest-side, rgba(255, 255, 255, .7), rgba(255, 255, 255, .25) 55%, transparent);
    filter: blur(.05em);
    opacity: 0;
    animation: steam-rise 5.5s ease-out infinite;
}

.steam span:nth-child(1) { --sx: .12em;  animation-delay: 0s; }
.steam span:nth-child(2) { --sx: -.15em; animation-delay: -1.1s; }
.steam span:nth-child(3) { --sx: .08em;  animation-delay: -2.2s; }
.steam span:nth-child(4) { --sx: -.1em;  animation-delay: -3.3s; }
.steam span:nth-child(5) { --sx: .16em;  animation-delay: -4.4s; }

@keyframes steam-rise {
    0%   { opacity: 0;   transform: translate(0, 0) scale(.45, .35); }
    15%  { opacity: .9; }
    50%  { opacity: .6; transform: translate(var(--sx), -.9em) scale(.9, 1.1); }
    100% { opacity: 0;   transform: translate(calc(var(--sx) * -1.4), -1.9em) scale(1.5, 1.8); }
}

/* ===== LEDky na routerech ===== */
/* tmavé kolečko přes namalovanou LEDku – když se ukáže, LEDka "zhasne" */
.led {
    position: fixed;
    z-index: 0;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    pointer-events: none;
    background: radial-gradient(circle, rgba(18, 26, 40, .95) 0 38%, rgba(18, 26, 40, .7) 55%, transparent 72%);
    opacity: 0;
}

.led.off { opacity: 1; }

/* ===== Nástup stránky ===== */
/* horní panel a patička se zjeví zároveň hned na začátku, dárky / okénko se jménem až po nich */
.tag {
    animation: tag-in .6s ease-out backwards;
}

@keyframes tag-in {
    from { opacity: 0; transform: translateY(-12px); }
}

/* dárky se po jednom "vysypou" (pořadí --i nastavuje index.php; po dokončení
   dostane kontejner třídu .entered, aby se animace při změně velikosti neopakovala) */
#giftContainer:not(.entered) .gift > svg {
    animation: gift-in .6s cubic-bezier(.3, 1.5, .5, 1) backwards;
    animation-delay: calc(.5s + var(--i, 0) * 70ms);
}

@keyframes gift-in {
    from { opacity: 0; transform: translateY(-50px) scale(.3) rotate(-14deg); }
}

.footer-line,
.credits { animation: fade-up .6s backwards; }
/* přihlášení a zapomenuté heslo: bez nástupních animací */
.page-form .tag,
.page-form .credits,
.page-form .footer-line { animation: none; }
.result {
    animation: fade-up .8s .6s backwards,
               result-glow 2.4s 2s ease-in-out infinite alternate;
}

/* zlatá záře kolem okénka jemně pulzuje */
@keyframes result-glow {
    from { box-shadow: 0 18px 40px rgba(0, 0, 0, .45), 0 0 30px rgba(255, 210, 120, .35); }
    to   { box-shadow: 0 18px 40px rgba(0, 0, 0, .45), 0 0 60px rgba(255, 210, 120, .75); }
}

.result-meta { animation: fade-up .6s 2.6s backwards; }

@keyframes fade-up {
    from { opacity: 0; transform: translateY(16px); }
}

/* ===== Odhalení jména ===== */
/* ztmavení pozadí za okénkem */
.reveal-overlay {
    position: fixed;
    inset: 0;
    z-index: 998;
    overflow: hidden;
    pointer-events: none;
    visibility: hidden;
    opacity: 0;
    background: rgba(5, 10, 25, .45);
    transition: opacity .6s ease, visibility 0s .6s;
}

.reveal-overlay.show {
    visibility: visible;
    opacity: 1;
    transition: opacity .6s ease;
}

.name-box.show .name-label { animation: fade-up .5s .2s backwards; }

/* písmena jména naskakují postupně (zpoždění nastavuje revealName v gift-effects.js) */
.name .word { display: inline-block; white-space: nowrap; }

.name .ch {
    display: inline-block;
    animation: ch-in .55s cubic-bezier(.3, 1.6, .5, 1) backwards;
}

@keyframes ch-in {
    from { opacity: 0; transform: translateY(.45em) scale(.2) rotate(-12deg); filter: blur(4px); }
    60%  { text-shadow: 0 2px 0 #fff, 0 0 18px rgba(255, 200, 90, .95); }
}

/* jiskřičky kolem okénka */
.sparkle {
    position: absolute;
    z-index: 1;
    font-size: var(--s, 18px);
    line-height: 1;
    color: #ffd76a;
    text-shadow: 0 0 8px rgba(255, 210, 100, .9);
    pointer-events: none;
    transform: translate(-50%, -50%) scale(0);
    animation: sparkle 1.8s ease-in-out infinite;
}

@keyframes sparkle {
    0%, 100% { transform: translate(-50%, -50%) scale(0) rotate(0); opacity: 0; }
    50%      { transform: translate(-50%, -50%) scale(1) rotate(90deg); opacity: 1; }
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* ===== Menší obrazovky ===== */
@media (max-width: 700px) {
    .page { padding-top: clamp(40px, 7vh, 60px); }
    .tag-bow { top: -30px; }
    .footer-line .circuit { display: none; }
}

@media (max-width: 420px) {
    .subtitle-row .circuit { display: none; }
}

@media (max-height: 560px) and (orientation: landscape) {
    .tag-top { display: none; }
}

/* ===== Vypínač animací ===== */
.motion-toggle {
    position: fixed;
    right: 12px;
    bottom: 12px;
    z-index: 1000;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid rgba(255, 230, 190, .35);
    border-radius: 50%;
    background: rgba(10, 20, 40, .45);
    color: rgba(255, 255, 255, .85);
    font-family: "Segoe UI Symbol", sans-serif;
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
    opacity: .55;
    transition: opacity .2s ease, background .2s ease;
}

.motion-toggle:hover,
.motion-toggle:focus-visible {
    opacity: 1;
    background: rgba(10, 20, 40, .7);
    outline: 2px solid rgba(255, 215, 130, .7);
    outline-offset: 2px;
}

/* ve vypnutém stavu je vločka přeškrtnutá */
.no-motion .motion-toggle::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 6px;
    right: 6px;
    height: 2px;
    background: #ff6b6b;
    transform: rotate(-45deg);
}

/* ===== Vypnuté animace (tlačítkem) ===== */
.no-motion *, .no-motion *::before, .no-motion *::after {
    animation-duration: .01ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    transition-delay: 0s !important;
}

.no-motion .steam,
.no-motion .led { display: none; }

/* ===== Vtípky (easter eggy) ===== */
/* neviditelné klikací plochy na hrnku, notebooku a routeru v pozadí (scene.js) */
.scene-spot {
    position: fixed;
    z-index: 2;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

/* hrnek: s každým klikem víc páry, po pátém kafe dojde */
.steam {
    transform: translate(-50%, -100%) scale(var(--puff, 1));
    transform-origin: 50% 100%;
    transition: transform .5s cubic-bezier(.3, 1.6, .5, 1), opacity 1.5s ease;
}

.steam.empty { opacity: 0; }

/* router: "restart" – vše zhasne, pak divoce bliká */
#leds.down .led { opacity: 1; }

#leds.party .led {
    animation: led-party .28s steps(1) infinite;
    animation-delay: var(--d, 0s);
}

@keyframes led-party {
    0%  { opacity: 0; }
    50% { opacity: 1; }
}

/* bublina s hláškou */
.fun-bubble {
    position: fixed;
    z-index: 1002;
    max-width: min(320px, calc(100vw - 16px));
    padding: 8px 14px;
    border: 1px solid rgba(255, 215, 140, .55);
    border-radius: 14px;
    background: rgba(18, 26, 44, .92);
    box-shadow: 0 8px 20px rgba(0, 0, 0, .45);
    color: #fff6e6;
    font-size: 14px;
    line-height: 1.35;
    text-align: center;
    pointer-events: none;
    opacity: 0;
    transform: translateY(6px) scale(.95);
    transition: opacity .25s ease, transform .3s cubic-bezier(.3, 1.6, .5, 1);
}

.fun-bubble.show {
    opacity: 1;
    transform: none;
}

.fun-bubble::after {
    content: "";
    position: absolute;
    left: clamp(14px, var(--arrow, 50%), calc(100% - 14px));
    bottom: -6px;
    width: 10px;
    height: 10px;
    margin-left: -5px;
    border: solid rgba(255, 215, 140, .55);
    border-width: 0 1px 1px 0;
    background: inherit;
    transform: rotate(45deg);
}

.fun-bubble.below::after {
    top: -6px;
    bottom: auto;
    transform: rotate(-135deg);
}

/* vánoční modrá obrazovka (klik na notebook) */
.fun-bsod {
    position: fixed;
    inset: 0;
    z-index: 1003;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: #0a5fb4;
    color: #fff;
    font-family: "Segoe UI", system-ui, sans-serif;
    cursor: pointer;
    animation: bsod-in .25s ease-out;
    transition: opacity .4s ease;
}

.fun-bsod.hide { opacity: 0; }

@keyframes bsod-in {
    from { opacity: 0; }
}

.fun-bsod-inner {
    max-width: 640px;
    font-size: clamp(16px, 2.6vw, 22px);
    line-height: 1.45;
}

.fun-bsod-face {
    font-size: clamp(70px, 14vw, 130px);
    line-height: 1;
    margin-bottom: .25em;
}

.fun-bsod-code {
    margin-top: 1.6em;
    font-size: .7em;
    opacity: .85;
}

/* changelog po kliknutí na verzi v patičce */
.credits { position: relative; }

.credits-version {
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    cursor: pointer;
}

.credits-version:hover code,
.credits-version:focus-visible code {
    color: #c8ffd2;
    text-decoration: underline dotted;
}

.credits-version:focus-visible {
    outline: 2px solid rgba(255, 215, 130, .7);
    outline-offset: 2px;
    border-radius: 4px;
}

.changelog {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    z-index: 5;
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: min(430px, 92vw);
    padding: 14px 16px;
    border: 2px solid #d9b25a;
    border-radius: 14px;
    background: var(--paper);
    box-shadow: 0 12px 28px rgba(0, 0, 0, .5);
    color: var(--ink);
    font-size: 13px;
    line-height: 1.35;
    text-align: left;
    text-shadow: none;
    transform: translateX(-50%);
    transform-origin: 50% 100%;
    animation: changelog-in .35s cubic-bezier(.2, 1.3, .4, 1);
}

/* vyroste z verze v patičce – translateX(-50%) musí zůstat, jinak by uskočil do strany */
@keyframes changelog-in {
    from { opacity: 0; transform: translateX(-50%) translateY(8px) scale(.92); }
}

.changelog[hidden] { display: none; }

.changelog strong {
    margin-bottom: 4px;
    color: var(--red-dark);
    font-size: 14px;
}
