:root { color-scheme: dark; }
* { box-sizing: border-box; }
html, body {
    margin: 0;
    min-height: 100%;
    font-family: "Segoe UI", Helvetica, Arial, sans-serif;
    background: #171717;
    color: #f5f5f5;
}
button, input, select, option, textarea, label, code {
    font: inherit;
    color: #f5f5f5;
}
button {
    border: 1px solid #737373 !important;
    background: #404040 !important;
    color: #ffffff !important;
    border-radius: 10px;
    padding: 0.45rem 0.8rem;
    cursor: pointer;
    font-weight: 600;
}
button:hover:not(:disabled) {
    background: #525252;
    color: #ffffff;
}
button:disabled {
    opacity: 0.55;
    cursor: default;
    color: #e5e5e5;
}
button.ok {
    border-color: #34d399 !important;
    background: #065f46 !important;
    color: #ecfdf5 !important;
}
button.ok:hover:not(:disabled) {
    background: #047857 !important;
    color: #ffffff !important;
}
button.gold {
    border-color: #fbbf24 !important;
    background: #92400e !important;
    color: #fffbeb !important;
}
button.gold:hover:not(:disabled) {
    background: #b45309 !important;
    color: #ffffff !important;
}
button.tiny {
    padding: 0.15rem 0.45rem;
    font-size: 0.75rem;
    font-weight: 600;
}
input, select, textarea {
    background: #262626;
    border: 1px solid #737373;
    border-radius: 8px;
    padding: 0.45rem 0.7rem;
    color: #f5f5f5;
}
input::placeholder {
    color: #a3a3a3;
    opacity: 1;
}
select option {
    background: #262626;
    color: #f5f5f5;
}
.wrap { max-width: 72rem; margin: 0 auto; padding: 1.5rem; display: grid; gap: 1rem; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.top h1 { position: relative; margin: 0; font-size: 1.6rem; color: #ffffff; line-height: 0; }
.top .logo { display: block; height: 3.75rem; width: auto; }
.muted { color: #d4d4d4; opacity: 1; font-size: .9rem; }
.strong { font-weight: 600; color: #ffffff; }
.banner { border: 1px solid rgba(16,185,129,.4); background: rgba(16,185,129,.1); border-radius: 10px; padding: 0.9rem 1rem; color: #ecfdf5; }
.banner.final-shots { border-color: rgba(251,191,36,.45); background: rgba(120,53,15,.35); color: #fef3c7; }
.final-tips { display: grid; gap: .65rem; margin-top: .75rem; }
@media (min-width: 900px) { .final-tips { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.final-tip {
    background: #171717;
    border: 1px solid #737373;
    border-radius: 8px;
    padding: .65rem;
    color: #f5f5f5;
}
.final-tip.aud { border-color: #38bdf8; }
.final-tip.tone { border-color: #e879f9; }
.final-tip.genre { border-color: #34d399; }
.final-tip.fic { border-color: #fbbf24; }
.final-tip.theme { border-color: #fb7185; }
.tip-body.open { max-height: none; overflow: visible; color: #e5e5e5; font-size: 12px; line-height: 1.35; }
.tip-body.open ul { margin: .2rem 0 0; padding-left: 1.1rem; }
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 40;
    background: rgba(0, 0, 0, .65);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 1.25rem;
    overflow: auto;
}
.modal {
    width: min(40rem, 100%);
    margin: 1rem auto;
    background: #262626;
    border: 1px solid #737373;
    border-radius: 14px;
    padding: 1rem 1.1rem 1.2rem;
    color: #f5f5f5;
    box-shadow: 0 20px 50px rgba(0, 0, 0, .45);
}
.modal h2 { margin: 0; color: #fff; font-size: 1.25rem; }
.about-body { margin-top: .85rem; display: grid; gap: .75rem; max-height: min(70vh, 36rem); overflow: auto; padding-right: .25rem; }
.about-body h3 { margin: 0; color: #fff; font-size: 1rem; }
.about-body p, .about-body li, .about-body dd { color: #e5e5e5; line-height: 1.45; margin: 0; }
.about-body ul { margin: 0; padding-left: 1.2rem; display: grid; gap: .35rem; }
.about-actions { margin: 0; display: grid; gap: .55rem; }
.about-actions > div {
    border: 1px solid #525252;
    border-radius: 8px;
    padding: .55rem .65rem;
    background: #1f1f1f;
}
.about-actions dt { font-weight: 700; color: #fde68a; margin: 0 0 .2rem; }
.about-actions dd { margin: 0; font-size: .92rem; }
.bar {
    min-height: 44px;
    border: 1px solid #525252;
    background: #262626;
    border-radius: 10px;
    padding: 0.6rem 0.8rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    color: #f5f5f5;
}
.bar.warn { border-color: rgba(245,158,11,.55); background: #422006; color: #fde68a; }
.bar.pick { border-color: rgba(14,165,233,.55); background: #0c4a6e; color: #e0f2fe; }
.bar.err { border-color: rgba(239,68,68,.55); background: #7f1d1d; color: #fecaca; }
.bar.pulse-bar, .pulse { animation: pulse 1.4s ease; }
.grid { display: grid; gap: 1rem; }
@media (min-width: 960px) { .grid { grid-template-columns: 1fr 2fr; } }
.wrap.wide { max-width: none; padding: 1rem 1.25rem; gap: .75rem; }
@media (min-width: 960px) { .wrap.wide .grid { grid-template-columns: 28rem minmax(0, 1fr); } }
.board-grid { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(min(34rem, 100%), 34rem)); justify-content: start; }
.card { background: #262626; border: 1px solid #525252; border-radius: 16px; padding: 1rem; display: grid; gap: .75rem; align-content: start; color: #f5f5f5; }
.card h2, .card h3 { color: #ffffff; margin: 0; }
.stack, .row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.stack { flex-direction: column; align-items: stretch; }
.spread { justify-content: space-between; }
.host-box { border: 1px dashed #a3a3a3; border-radius: 12px; padding: .75rem; display: grid; gap: .4rem; color: #f5f5f5; }
.host-player-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; }
.host-player-row { display: flex; align-items: center; gap: .55rem; cursor: pointer; color: #f5f5f5; }
.host-player-row input { width: 1rem; height: 1rem; accent-color: #38bdf8; }
.timer-setting { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.timer-setting select:disabled { opacity: .5; cursor: not-allowed; }
.timer-settings { display: grid; gap: .5rem; }
.host-player-row.disabled { opacity: .5; cursor: not-allowed; }
.host-players-hint { font-size: 0.85rem; font-weight: 400; display: inline; }
.lobby-title { align-items: center; gap: .5rem; }
.lobby-title h2 { margin: 0; }
.abandon-confirm { margin: .5rem 0 0; }
.room-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.room-join {
    width: 100%;
    text-align: left;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .15rem;
    background: #171717;
    border-color: #737373;
}
.room-join-name { font-weight: 600; color: #fafafa; }
.room-join:hover:not(:disabled) { border-color: #38bdf8; }
.urls { margin: 0; padding-left: 1rem; color: #f5f5f5; }
.roster-list { list-style: none; padding-left: 0; display: grid; gap: .4rem; }
.roster-row { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.urls code { color: #fda4af; background: #171717; padding: 0.1rem 0.35rem; border-radius: 4px; }
.qr { width: 160px; height: 160px; background: #fff; border-radius: 8px; }
.hand { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-start; }
.hand-card {
    text-align: left;
    min-width: 9rem;
    background: #3f3f46;
    border-color: #a1a1aa;
    color: #fafafa;
}
.hand-card.art {
    min-width: 0;
    width: 8rem;
    padding: 0;
    background: transparent !important;
    border: none !important;
    display: grid;
    gap: .25rem;
    text-align: center;
}
.hand-card.art .tiny { padding: 0 .2rem; }
.hand-card.art:hover:not(:disabled) .card-face { transform: translateY(-4px); filter: drop-shadow(0 6px 10px rgba(0,0,0,.55)) brightness(1.08); }
.hand-card.art.aud:hover:not(:disabled) .card-face { filter: drop-shadow(0 0 8px rgba(56,189,248,.6)) brightness(1.08); }
.hand-card.art.tone:hover:not(:disabled) .card-face { filter: drop-shadow(0 0 8px rgba(232,121,249,.6)) brightness(1.08); }
.hand-card.art.genre:hover:not(:disabled) .card-face { filter: drop-shadow(0 0 8px rgba(52,211,153,.6)) brightness(1.08); }
.hand-card.art.fic:hover:not(:disabled) .card-face { filter: drop-shadow(0 0 8px rgba(251,191,36,.6)) brightness(1.08); }
.hand-card.art.theme:hover:not(:disabled) .card-face { filter: drop-shadow(0 0 8px rgba(251,113,133,.6)) brightness(1.08); }
.hand-card.art.action:hover:not(:disabled) .card-face { filter: drop-shadow(0 0 8px rgba(226,232,240,.6)) brightness(1.08); }
.hand.discarding .hand-card:hover:not(:disabled) { outline: 2px solid #f87171; outline-offset: 2px; }
.hand.discarding .hand-card.art:hover:not(:disabled) { outline: none; }
.hand.discarding .hand-card.art:hover:not(:disabled) .card-face { filter: drop-shadow(0 0 8px rgba(248,113,113,.8)) brightness(.85); }
.card-face {
    position: relative;
    width: 100%;
    aspect-ratio: 256 / 288;
    container-type: inline-size;
    transition: transform .15s ease, filter .15s ease;
}
.card-face img { display: block; width: 100%; height: 100%; user-select: none; }
.card-face-name {
    position: absolute;
    left: 9%;
    right: 9%;
    bottom: 7%;
    min-height: 12%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-weight: 700;
    font-size: 9.5cqw;
    line-height: 1.1;
    letter-spacing: .02em;
    text-align: center;
    text-shadow: 0 1px 2px rgba(0,0,0,.95), 0 0 6px rgba(0,0,0,.85);
    pointer-events: none;
}
.card-face-name > span {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    overflow: hidden;
    overflow-wrap: break-word;
    max-width: 100%;
}
.board { position: relative; border: 1px solid #525252; border-radius: 10px; padding: .75rem; display: grid; gap: .6rem; background: #1f1f1f; color: #f5f5f5; }
.board.active { border-color: #fbbf24; box-shadow: 0 0 0 2px rgba(251,191,36,.35); }
.board.complete { border-color: #10b981; box-shadow: 0 0 0 2px rgba(16,185,129,.35); }
.board.finished { border-color: #fbbf24; box-shadow: 0 0 0 2px rgba(251,191,36,.35); animation: breathe 3.5s ease-in-out infinite; }
.board.selected { outline: 2px solid rgba(14,165,233,.6); }
.slots { display: grid; gap: .5rem; grid-template-columns: repeat(5, minmax(0, 6rem)); }
.slots .tip-wrap { display: block; min-width: 0; }
.slot {
    --type-color: #737373;
    --type-rgb: 115,115,115;
    position: relative;
    aspect-ratio: 256 / 288;
    border: 1px solid var(--type-color);
    background: #171717;
    border-radius: 9px;
    color: #f5f5f5;
    container-type: inline-size;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .3rem;
    padding: 8%;
    text-align: center;
    overflow: hidden;
}
.slot.aud { --type-color: #38bdf8; --type-rgb: 56,189,248; }
.slot.tone { --type-color: #e879f9; --type-rgb: 232,121,249; }
.slot.genre { --type-color: #34d399; --type-rgb: 52,211,153; }
.slot.fic { --type-color: #fbbf24; --type-rgb: 251,191,36; }
.slot.theme { --type-color: #fb7185; --type-rgb: 251,113,133; }
.slot.art { border: none; background: transparent; padding: 0; overflow: visible; }
.slot.text { background: linear-gradient(180deg, rgba(var(--type-rgb),.28), rgba(var(--type-rgb),.08) 60%, #171717); box-shadow: inset 0 0 0 1px rgba(var(--type-rgb),.35); }
.slot.empty { border: 1px dashed rgba(var(--type-rgb),.55); background: rgba(var(--type-rgb),.05); }
.slot-type { font-size: 10cqw; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--type-color); }
.slot.empty .slot-type { opacity: .7; }
.slot-name {
    font-size: 12cqw;
    font-weight: 700;
    line-height: 1.15;
    overflow-wrap: break-word;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    overflow: hidden;
    max-width: 100%;
}
.slot.flash { animation: slot-glow 1.4s ease; }
.chip { font-size: 11px; padding: 0.15rem .45rem; border-radius: 999px; background: #525252; color: #f5f5f5; }
.chip.gold { background: #92400e; color: #fef3c7; }
.chip.sky { background: #075985; color: #e0f2fe; }
.chip.go { background: #065f46; color: #d1fae5; }
.chip.flash { background: #6d28d9; color: #ede9fe; font-weight: 700; animation: flash-chip 1.2s ease-in-out infinite; }
.chip.flash.pending { background: transparent; color: #c4b5fd; border: 1px solid #7c3aed; font-weight: 600; animation: none; }
@keyframes flash-chip { 50% { box-shadow: 0 0 0 3px rgba(167,139,250,.5); } }
.chip.clock { position: relative; display: inline-flex; gap: .3rem; background: #1e3a8a; color: #dbeafe; font-variant-numeric: tabular-nums; font-weight: 700; }
.chip.clock .clock-prefix { font-weight: 600; opacity: .85; }
.chip.clock.low { background: #b91c1c; color: #fee2e2; animation: clock-low 1s ease-in-out infinite; }
.chip.clock.low.fx-bump { animation: chip-bump .6s cubic-bezier(.2,.8,.3,1.5); }
.clock-bonus { position: absolute; left: 100%; top: -.2rem; margin-left: .25rem; color: #86efac; font-weight: 800; white-space: nowrap; pointer-events: none; animation: clock-bonus 1.2s ease-out forwards; }
@keyframes clock-low { 50% { box-shadow: 0 0 0 3px rgba(248,113,113,.45); } }
@keyframes clock-bonus { 0% { opacity: 0; transform: translateY(4px); } 20% { opacity: 1; } 100% { opacity: 0; transform: translateY(-10px); } }
.go { color: #6ee7b7; }
.prot { font-size: 11px; padding: .2rem .5rem; border-radius: 999px; background: #3730a3; color: #e0e7ff; width: max-content; }
.tip-wrap { position: relative; display: inline-block; }
.tip {
    display: none;
    position: absolute;
    z-index: 20;
    left: 0;
    top: calc(100% + 8px);
    min-width: 16rem;
    max-width: 22rem;
    background: #171717;
    border: 1px solid #737373;
    border-radius: 8px;
    padding: .65rem;
    box-shadow: 0 12px 30px rgba(0,0,0,.45);
    pointer-events: none;
    color: #f5f5f5;
}
.tip-wrap:hover .tip, .tip-wrap:focus-within .tip { display: block; }
.tip-wrap:hover, .tip-wrap:focus-within { z-index: 30; }
.tip.tip-up { top: auto; bottom: calc(100% + 8px); }
.tip.tip-left { left: auto; right: 0; }
.tip-label { font-size: 12px; font-weight: 600; margin-bottom: .3rem; color: #ffffff; }
.tip-body { font-size: 12px; line-height: 1.35; max-height: 18rem; overflow: auto; color: #e5e5e5; }
.tip-body ul { margin: .2rem 0 0; padding-left: 1.1rem; }
hr { border: 0; border-top: 1px solid #525252; }
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(251,191,36,.45); }
    100% { box-shadow: 0 0 0 8px rgba(251,191,36,0); }
}

/* ---------- Animations: core feel ---------- */
.top h1::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(110deg, transparent 35%, rgba(255,255,255,.6) 50%, transparent 65%) no-repeat;
    background-size: 250% 100%;
    background-position: 150% 0;
    -webkit-mask: url(../img/Pitch_and_Peril_Logo.webp) center / contain no-repeat;
    mask: url(../img/Pitch_and_Peril_Logo.webp) center / contain no-repeat;
    animation: logo-shine 1.6s ease .4s both;
}
@keyframes logo-shine {
    from { background-position: 150% 0; }
    to { background-position: -50% 0; }
}

.hand > .tip-wrap { animation: deal-in .45s cubic-bezier(.2,.8,.3,1.15) var(--deal-delay, 0ms) backwards; }
@keyframes deal-in {
    from { opacity: 0; transform: translateY(18px) rotate(-4deg) scale(.92); }
    to { opacity: 1; transform: none; }
}
.hand.discarding .hand-card { animation: wiggle .45s ease; }
@keyframes wiggle {
    0%, 100% { transform: none; }
    20% { transform: rotate(-3deg); }
    40% { transform: rotate(3deg); }
    60% { transform: rotate(-2deg); }
    80% { transform: rotate(1deg); }
}

.slots > .tip-wrap:has(> .slot:not(.empty)) { animation: drop-in .42s cubic-bezier(.2,.8,.3,1.2) backwards; }
@keyframes drop-in {
    from { opacity: 0; transform: translateY(-10px) scale(1.15) rotate(-3deg); }
    to { opacity: 1; transform: none; }
}
@keyframes slot-glow {
    0% { box-shadow: 0 0 0 0 rgba(var(--type-rgb),.7), 0 0 18px 4px rgba(var(--type-rgb),.55); }
    100% { box-shadow: 0 0 0 10px rgba(var(--type-rgb),0), 0 0 0 0 rgba(var(--type-rgb),0); }
}

.board.fx-turn { animation: turn-glow 1.2s ease; }
@keyframes turn-glow {
    0% { box-shadow: 0 0 0 2px rgba(251,191,36,.35); }
    35% { box-shadow: 0 0 0 4px rgba(251,191,36,.6), 0 0 26px 6px rgba(251,191,36,.35); }
    100% { box-shadow: 0 0 0 2px rgba(251,191,36,.35); }
}
@keyframes breathe {
    0%, 100% { box-shadow: 0 0 0 2px rgba(251,191,36,.35); }
    50% { box-shadow: 0 0 0 2px rgba(251,191,36,.35), 0 0 16px 2px rgba(251,191,36,.22); }
}
.bar.fx-pop { animation: bar-pop .5s ease; }
@keyframes bar-pop {
    0% { transform: scale(1); }
    40% { transform: scale(1.015); box-shadow: 0 0 0 3px rgba(110,231,183,.35); }
    100% { transform: scale(1); }
}
button.fx-nudge { animation: nudge .7s ease .25s; }
@keyframes nudge {
    0%, 100% { transform: none; }
    30% { transform: translateY(-3px) scale(1.06); }
    60% { transform: translateY(0) scale(.98); }
}
.chip.fx-pop { animation: chip-pop .6s cubic-bezier(.2,.8,.3,1.4); }
@keyframes chip-pop {
    0% { transform: scale(.4); opacity: 0; }
    60% { transform: scale(1.25); opacity: 1; }
    100% { transform: scale(1); }
}

/* Overlay layer for board effects; never affects layout. */
.fx-layer {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    overflow: hidden;
    pointer-events: none;
    z-index: 6;
}
.fx-shine {
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg, transparent 30%, rgba(253,230,138,.5) 48%, rgba(255,255,255,.65) 50%, rgba(253,230,138,.5) 52%, transparent 70%) no-repeat;
    background-size: 250% 100%;
    animation: shine-sweep 1.3s ease both;
}
@keyframes shine-sweep {
    from { background-position: 150% 0; }
    to { background-position: -50% 0; }
}

.roster-list > li, .host-player-list > li { animation: pop-in .35s cubic-bezier(.2,.8,.3,1.3) both; }
@keyframes pop-in {
    from { opacity: 0; transform: translateX(-8px) scale(.96); }
    to { opacity: 1; transform: none; }
}

.final-tips { perspective: 900px; }
.final-tip { animation: flip-in .55s ease both; backface-visibility: hidden; }
.final-tip:nth-child(2) { animation-delay: .12s; }
.final-tip:nth-child(3) { animation-delay: .24s; }
.final-tip:nth-child(4) { animation-delay: .36s; }
.final-tip:nth-child(5) { animation-delay: .48s; }
@keyframes flip-in {
    from { opacity: 0; transform: rotateY(-90deg); }
    to { opacity: 1; transform: none; }
}

/* ---------- Animations: action effects ---------- */
.board.fx-glow { animation: action-glow 1.2s ease; }
@keyframes action-glow {
    0%, 100% { box-shadow: none; }
    35% { box-shadow: 0 0 0 3px rgba(167,139,250,.65), 0 0 24px 6px rgba(167,139,250,.35); }
}
.board.fx-ricochet { animation: ricochet 1.5s ease; }
@keyframes ricochet {
    0%, 30% { box-shadow: none; }
    55% { box-shadow: 0 0 0 3px rgba(129,140,248,.8), 0 0 28px 8px rgba(129,140,248,.4); }
    100% { box-shadow: none; }
}
.board.fx-shake { animation: shake .6s ease; }
@keyframes shake {
    0%, 100% { transform: none; }
    15% { transform: translateX(-6px) rotate(-.4deg); }
    30% { transform: translateX(5px) rotate(.4deg); }
    45% { transform: translateX(-4px); }
    60% { transform: translateX(3px); }
    75% { transform: translateX(-2px); }
}
.board.fx-flip { animation: board-flip .75s ease; }
@keyframes board-flip {
    0% { transform: perspective(1200px) rotateY(0); }
    50% { transform: perspective(1200px) rotateY(90deg); filter: brightness(1.4); }
    100% { transform: perspective(1200px) rotateY(0); }
}
.board.fx-skip .slots { animation: desaturate 1.4s ease; }
@keyframes desaturate {
    0%, 100% { filter: none; opacity: 1; }
    25%, 70% { filter: grayscale(1) brightness(.6); opacity: .75; }
}

.chip.fx-bump { animation: chip-bump .6s cubic-bezier(.2,.8,.3,1.5); }
@keyframes chip-bump {
    0%, 100% { transform: scale(1); }
    40% { transform: scale(1.35); background: #6d28d9; }
}
.chip.fx-shrink { animation: chip-shrink .6s ease; }
@keyframes chip-shrink {
    0%, 100% { transform: scale(1); }
    40% { transform: scale(.7); background: #991b1b; }
}

.dir-arrow { display: inline-block; font-weight: 700; color: #fde68a; }
.dir-arrow.fx-spin { animation: dir-spin .85s cubic-bezier(.3,.7,.3,1.2); }
@keyframes dir-spin {
    from { transform: rotate(0) scale(1.4); }
    to { transform: rotate(360deg) scale(1); }
}

.slot.fx-flip { animation: slot-flip .75s ease; }
@keyframes slot-flip {
    0% { transform: perspective(600px) rotateY(180deg); opacity: .3; }
    100% { transform: perspective(600px) rotateY(0); opacity: 1; }
}
.slot.fx-shimmer::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 9px;
    pointer-events: none;
    background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,.7) 50%, transparent 70%) no-repeat;
    background-size: 250% 100%;
    animation: shine-sweep 1s ease both;
}
.slot.fx-wipe { animation: wipe-out 1s ease; }
.slot.fx-wipe::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(180deg, transparent, rgba(var(--type-rgb),.85) 45%, rgba(255,255,255,.7) 50%, rgba(var(--type-rgb),.85) 55%, transparent) no-repeat;
    background-size: 100% 250%;
    animation: wipe-sweep .9s ease both;
}
@keyframes wipe-out {
    0% { box-shadow: 0 0 16px 4px rgba(var(--type-rgb),.6); }
    100% { box-shadow: none; }
}
@keyframes wipe-sweep {
    from { background-position: 0 150%; opacity: 1; }
    to { background-position: 0 -50%; opacity: .2; }
}

.fx-stamp, .fx-shield, .fx-float {
    position: absolute;
    left: 50%;
    top: 50%;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
    white-space: nowrap;
}
.fx-stamp {
    padding: .3rem .9rem;
    border: 3px solid #f87171;
    border-radius: 8px;
    color: #fecaca;
    background: rgba(127,29,29,.55);
    font-size: 1.4rem;
    animation: stamp 1.4s ease both;
}
.fx-stamp.flash { border-color: #a78bfa; color: #ede9fe; background: rgba(76,29,149,.6); }
@keyframes stamp {
    0% { opacity: 0; transform: translate(-50%, -50%) rotate(-12deg) scale(2.2); }
    20% { opacity: 1; transform: translate(-50%, -50%) rotate(-12deg) scale(1); }
    75% { opacity: 1; transform: translate(-50%, -50%) rotate(-12deg) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -50%) rotate(-12deg) scale(1); }
}
.fx-float {
    color: #fde68a;
    font-size: 2rem;
    text-shadow: 0 2px 8px rgba(0,0,0,.8);
    animation: float-up 1.3s ease both;
}
@keyframes float-up {
    0% { opacity: 0; transform: translate(-50%, -10%) scale(.6); }
    25% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); }
    100% { opacity: 0; transform: translate(-50%, -160%) scale(1); }
}
.fx-shield {
    display: grid;
    place-items: center;
    width: 9rem;
    height: 9rem;
    border-radius: 50%;
    color: #e0e7ff;
    font-size: .9rem;
    background: radial-gradient(circle, rgba(99,102,241,.15) 40%, rgba(99,102,241,.55) 62%, rgba(165,180,252,.9) 66%, transparent 70%);
    animation: shield-burst 1.3s ease both;
}
.fx-shield.reflect {
    background: radial-gradient(circle, rgba(14,165,233,.15) 40%, rgba(14,165,233,.55) 62%, rgba(186,230,253,.9) 66%, transparent 70%);
    color: #e0f2fe;
}
@keyframes shield-burst {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(.3); }
    25% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
    60% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(1.6); }
}
.fx-ghost {
    position: absolute;
    left: 30%;
    top: 20%;
    width: 4.5rem;
    aspect-ratio: 256 / 288;
    border-radius: 8px;
    border: 1px solid rgba(248,113,113,.7);
    background: linear-gradient(160deg, rgba(248,113,113,.45), rgba(63,63,70,.6));
    animation: ghost-fall 1s ease-in both;
}
.fx-ghost.second { left: 55%; animation-name: ghost-fall-alt; animation-delay: .12s; }
@keyframes ghost-fall {
    0% { opacity: 0; transform: translateY(-20%) rotate(0); }
    20% { opacity: .9; }
    100% { opacity: 0; transform: translateY(140%) rotate(24deg); }
}
@keyframes ghost-fall-alt {
    0% { opacity: 0; transform: translateY(-20%) rotate(0); }
    20% { opacity: .9; }
    100% { opacity: 0; transform: translateY(140%) rotate(-28deg); }
}

/* In-game Motion toggle; Windows "Animation effects: off" also reports reduced motion, so the OS setting is not used. */
html.no-motion *, html.no-motion *::before, html.no-motion *::after {
    animation: none !important;
    transition: none !important;
}
html.no-motion .fx-layer, html.no-motion .slot::after { display: none; }
#blazor-error-ui { display: none; position: fixed; bottom: 0; left: 0; right: 0; padding: .75rem 1rem; background: #7f1d1d; color: #fee2e2; }
#blazor-error-ui.show, .blazor-error-boundary { display: block; }
.loading-progress { position: absolute; display: none; }
