.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto 0 auto;
}

    .loading-progress circle {
        fill: none;
        stroke: #e0e0e0;
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: #1b6ec2;
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "Loading");
    }

code {
    color: #c02d76;
}

@keyframes piece-flash {
    0%   { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(1.2); }
}

.piece-flash {
    animation: piece-flash 0.5s ease-out forwards;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}
/* Hardware Acceleration for Puzzle Pieces */
.puzzle-piece {
    will-change: transform;
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}
.puzzle-piece-image {
    transform: translateZ(0);
}

/* Drop-shadow só para a peça em drag — barato no idle */
.puzzle-piece.dragging {
    filter: drop-shadow(0px 6px 4px rgba(0,0,0,0.25));
}

/* Safe-area helpers para iOS notch / Android gestures */
.safe-area-fill {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}
.safe-area-top {
    padding-top: env(safe-area-inset-top);
}
.safe-area-bottom {
    padding-bottom: env(safe-area-inset-bottom);
}

/* ==========================================
   TITLE SCREEN
   ========================================== */

.title-screen {
    position: fixed;
    inset: 0;
    background: linear-gradient(160deg, #FDFCF0 0%, #FFF8E1 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 200;
    overflow: hidden;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.title-enter {
    animation: ts-fade-in 0.4s ease-out both;
}

.title-exit {
    animation: ts-fade-out 0.55s ease-in both;
    pointer-events: none;
}

@keyframes ts-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes ts-fade-out {
    from { opacity: 1; transform: scale(1); }
    to   { opacity: 0; transform: scale(1.07); }
}

/* Floating background pieces */
.title-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.float-piece {
    position: absolute;
    color: #5D4037;
    opacity: 0.055;
    animation: fp-float 8s ease-in-out infinite;
}

.fp-0 { top:  2%;  left:  2%;  --rot:  15deg; --dy: -18px; animation-duration: 7s; }
.fp-1 { top:  6%;  right: 4%;  --rot: -25deg; --dy:  15px; animation-duration: 9.5s; animation-delay: 1.3s; }
.fp-2 { top: 32%;  left: -1%;  --rot:  47deg; --dy: -14px; animation-duration: 8s;   animation-delay: 0.7s; }
.fp-3 { top: 50%;  right: 1%;  --rot: -12deg; --dy:  20px; animation-duration: 11s;  animation-delay: 2.1s; }
.fp-4 { bottom: 18%; left: 5%; --rot:  33deg; --dy: -16px; animation-duration: 6.5s; animation-delay: 3s;   }
.fp-5 { bottom: 3%;  right: 7%;--rot: -42deg; --dy:  12px; animation-duration: 8.5s; animation-delay: 1s;   }
.fp-6 { top: 20%;  left: 12%;  --rot:  61deg; --dy: -20px; animation-duration: 10s;  animation-delay: 2.5s; }
.fp-7 { top: 68%;  left: 38%;  --rot: -22deg; --dy:  16px; animation-duration: 7.5s; animation-delay: 0.8s; }

@keyframes fp-float {
    0%,100% { transform: rotate(var(--rot)) translateY(0); }
    50%      { transform: rotate(var(--rot)) translateY(var(--dy)); }
}

/* Content */
.title-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.title-icon {
    opacity: 0;
    transform: translateY(-40px) scale(0.82);
    transition: opacity 0.7s cubic-bezier(0.34, 1.56, 0.64, 1),
                transform 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
    margin-bottom: 1.5rem;
    filter: drop-shadow(0 8px 28px rgba(93, 64, 55, 0.22));
}

.logo-in .title-icon {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.title-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1;
    overflow: hidden;
}

.title-word {
    display: block;
    font-size: 3.75rem;
    font-weight: 900;
    letter-spacing: -3px;
    line-height: 1;
    opacity: 0;
    transform: translateY(32px);
    transition: opacity 0.5s ease-out, transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.title-word-toast  { color: #5D4037; transition-delay: 0.15s; }
.title-word-puzzle { color: #FF7043; transition-delay: 0.28s; }

.logo-in .title-word {
    opacity: 1;
    transform: translateY(0);
}

.title-divider {
    width: 3rem;
    height: 3px;
    border-radius: 9999px;
    background: linear-gradient(90deg, #FF7043, #FFD54F);
    margin: 1rem 0 0.75rem;
    opacity: 0;
    transform: scaleX(0);
    transition: opacity 0.4s ease-out 0.45s, transform 0.4s ease-out 0.45s;
}

.logo-in .title-divider {
    opacity: 1;
    transform: scaleX(1);
}

.title-slogan {
    font-size: 0.875rem;
    font-weight: 700;
    color: #9E9E9E;
    text-align: center;
    max-width: 220px;
    opacity: 0;
    transition: opacity 0.4s ease-out 0.6s;
}

.logo-in .title-slogan {
    opacity: 1;
}

/* CTA */
.title-cta {
    position: absolute;
    bottom: max(3rem, calc(env(safe-area-inset-bottom) + 2rem));
    opacity: 0;
    transition: opacity 0.5s ease-out;
}

.title-cta.cta-in {
    opacity: 1;
}

.tap-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 900;
    letter-spacing: 3px;
    color: #5D4037;
    text-transform: uppercase;
    background: rgba(93, 64, 55, 0.08);
    border: 2px solid rgba(93, 64, 55, 0.18);
    padding: 10px 22px;
    border-radius: 999px;
    animation: tap-pulse 1.8s ease-in-out infinite;
}

.tap-label::before {
    content: '';
    display: block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #FF7043;
    animation: tap-dot 1.8s ease-in-out infinite;
}

@keyframes tap-pulse {
    0%, 100% { opacity: 0.65; transform: scale(1); }
    50%       { opacity: 1;    transform: scale(1.04); }
}

@keyframes tap-dot {
    0%, 100% { transform: scale(0.8); opacity: 0.6; }
    50%       { transform: scale(1.3); opacity: 1; }
}

/* Loading dots */
.loading-dots {
    display: flex;
    gap: 10px;
    align-items: center;
}

.loading-dots span {
    width: 13px;
    height: 13px;
    border-radius: 50%;
    display: block;
    animation: dot-bounce 1.3s ease-in-out infinite;
}

.loading-dots span:nth-child(1) { background: #FF7043; }
.loading-dots span:nth-child(2) { background: #5D4037; animation-delay: 0.18s; }
.loading-dots span:nth-child(3) { background: #FFD54F; animation-delay: 0.36s; }

@keyframes dot-bounce {
    0%, 70%, 100% { transform: scale(0.55); opacity: 0.4; }
    35%            { transform: scale(1.25); opacity: 1;   }
}

/* Version badge */
.title-version {
    position: absolute;
    top: max(1rem, env(safe-area-inset-top));
    right: 1rem;
    font-size: 0.6rem;
    font-weight: 800;
    color: #FF7043;
    background: rgba(255, 112, 67, 0.12);
    padding: 2px 8px;
    border-radius: 999px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* ==========================================
   MENU ENTER ANIMATION
   ========================================== */

.menu-enter {
    animation: menu-fade-in 0.45s ease-out both;
}

@keyframes menu-fade-in {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ==========================================
   GAME PAGE ENTER
   ========================================== */

.game-enter {
    animation: game-fade-in 0.35s ease-out both;
}

@keyframes game-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ==========================================
   COMPLETION MODAL
   ========================================== */

.modal-bounce-in {
    animation: modal-bounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes modal-bounce {
    from { opacity: 0; transform: scale(0.72) translateY(28px); }
    to   { opacity: 1; transform: scale(1)    translateY(0); }
}

/* ==========================================
   CONFETTI
   ========================================== */

.confetti-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 998;
    overflow: hidden;
}

.confetti-piece {
    position: absolute;
    top: -16px;
    width: 8px;
    height: 12px;
    border-radius: 2px;
}

.cf-yellow { background: #FFD54F; }
.cf-orange { background: #FF7043; }
.cf-brown  { background: #5D4037; }
.cf-green  { background: #4CAF50; }
.cf-blue   { background: #4FC3F7; }

.confetti-piece:nth-child(3n)   { width: 6px;  height: 10px; border-radius: 50%; }
.confetti-piece:nth-child(3n+1) { width: 10px; height: 6px; }
.confetti-piece:nth-child(3n+2) { width: 9px;  height: 9px; border-radius: 50%; }

.confetti-piece:nth-child(5n)   { animation-name: cf-fall-1; }
.confetti-piece:nth-child(5n+1) { animation-name: cf-fall-2; }
.confetti-piece:nth-child(5n+2) { animation-name: cf-fall-3; }
.confetti-piece:nth-child(5n+3) { animation-name: cf-fall-4; }
.confetti-piece:nth-child(5n+4) { animation-name: cf-fall-5; }

@keyframes cf-fall-1 {
    from { transform: translateY(0) rotate(0deg)    scaleX(1);   opacity: 1; }
    to   { transform: translateY(110vh) rotate(540deg)  scaleX(0.4); opacity: 0; }
}
@keyframes cf-fall-2 {
    from { transform: translateY(0) rotate(45deg)   scaleX(-1);  opacity: 1; }
    to   { transform: translateY(110vh) rotate(-360deg) scaleX(1);   opacity: 0; }
}
@keyframes cf-fall-3 {
    from { transform: translateY(0) rotate(-30deg)  scaleX(0.7); opacity: 1; }
    to   { transform: translateY(110vh) rotate(720deg)  scaleX(-0.7);opacity: 0; }
}
@keyframes cf-fall-4 {
    from { transform: translateY(0) rotate(90deg);               opacity: 1; }
    to   { transform: translateY(110vh) rotate(-270deg);          opacity: 0.15; }
}
@keyframes cf-fall-5 {
    from { transform: translateY(0) rotate(-60deg)  scaleY(0.8); opacity: 1; }
    to   { transform: translateY(110vh) rotate(480deg)  scaleY(1.2); opacity: 0; }
}

/* ==========================================
   SNAP RING (piece placed)
   ========================================== */

.piece-snap-ring {
    border-radius: 4px;
    animation: snap-ring 0.55s ease-out forwards;
}

@keyframes snap-ring {
    0%   { box-shadow: 0 0 0 0   rgba(76, 175, 80, 0.85); opacity: 1; }
    100% { box-shadow: 0 0 0 18px rgba(76, 175, 80, 0);   opacity: 0; }
}

/* ==========================================
   LEVEL CARD STAGGER
   ========================================== */

.card-enter {
    animation: card-slide-up 0.38s ease-out both;
}

@keyframes card-slide-up {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
}
