:root {
    --cream: #fff7e8;
    --cream-2: #fff0cf;
    --pink: #ff7ab8;
    --pink-2: #f9a0c8;
    --blue: #6ab6ff;
    --blue-2: #3a91e8;
    --mint: #2ec67c;
    --orange: #f08a2b;
    --ink: #6a3150;
    --muted: #8d6175;
    --line: rgba(161, 93, 122, 0.25);
    --glass: rgba(255, 249, 238, 0.82);
    --glass-strong: rgba(255, 250, 245, 0.95);
    --shadow: 0 24px 60px rgba(110, 52, 82, 0.16);
    --radius-xl: 34px;
    --radius-lg: 24px;
    --radius-md: 18px;
    --font-main: "Segoe UI", "Trebuchet MS", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    position: relative;
    overflow-x: hidden;
    color: var(--ink);
    font-family: var(--font-main);
    background:
        linear-gradient(180deg, rgba(255, 238, 247, 0.68), rgba(248, 244, 255, 0.60)),
        linear-gradient(135deg, #ffd3e6 0%, #cceeff 55%, #fff4d8 100%);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background: url("FONDOPAS.png") center center / cover no-repeat;
    filter: blur(1.5px) saturate(1.1) brightness(1.08);
    opacity: 0.33;
    transform: scale(1.04);
    z-index: -3;
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.12), rgba(255,255,255,0) 28%),
        linear-gradient(180deg, transparent 72%, rgba(255, 212, 230, 0.35) 72%, rgba(255, 212, 230, 0.35) 100%),
        linear-gradient(90deg, rgba(255, 212, 230, 0.12) 0 50%, rgba(255,255,255,0.12) 50% 100%);
    background-size: auto, 100% 28%, 72px 72px;
    pointer-events: none;
    z-index: -2;
}

.loading-screen {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 226, 242, 0.96), rgba(224, 246, 255, 0.96), rgba(255, 244, 214, 0.96));
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

.loader-content {
    text-align: center;
    background: rgba(255, 255, 255, 0.76);
    padding: 38px 56px;
    border-radius: 32px;
    box-shadow: 0 30px 70px rgba(110, 52, 82, 0.15);
    backdrop-filter: blur(12px);
    border: 2px solid rgba(255,255,255,0.9);
    max-width: 500px;
    width: min(92%, 500px);
}

.bouncing-cake {
    font-size: 5.4rem;
    animation: bounce 0.9s infinite alternate cubic-bezier(0.4, 0.05, 0.6, 0.95);
}

.loader-content h2 {
    margin: 8px 0 16px;
    font-size: 1.35rem;
}

@keyframes bounce {
    0% { transform: translateY(0); }
    100% { transform: translateY(-25px) scale(1.05); }
}

.progress-bar {
    width: 100%;
    height: 14px;
    background: #ffe8f3;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.05);
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--pink), var(--blue));
    border-radius: 20px;
}

.start-screen {
    position: fixed;
    inset: 0;
    z-index: 9000;
    display: none;
    opacity: 0;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(ellipse at 18% 18%, rgba(255, 217, 235, 0.82), transparent 38%),
        radial-gradient(ellipse at 82% 82%, rgba(218, 241, 255, 0.82), transparent 38%),
        radial-gradient(ellipse at 65% 8%, rgba(255, 242, 205, 0.78), transparent 26%),
        linear-gradient(135deg, #ffd4e6 0%, #d3ecff 55%, #fff3d4 100%);
    transition: opacity 0.55s ease;
    overflow: hidden;
}

.start-card {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 44px;
    background: rgba(255,255,255,0.90);
    padding: 52px 58px;
    border-radius: 40px;
    box-shadow: 0 40px 80px rgba(110,52,82,0.18), inset 0 0 0 1.5px rgba(255,255,255,0.95);
    backdrop-filter: blur(24px);
    border: 1.5px solid rgba(255,255,255,0.75);
    max-width: 860px;
    width: 92%;
    animation: startCardEntry 0.65s cubic-bezier(0.22, 0.61, 0.36, 1) both;
    animation-play-state: paused;
}

.start-card-content {
    flex: 1;
    min-width: 0;
    text-align: left;
}

@keyframes startCardEntry {
    from { transform: translateY(30px) scale(0.95); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

.start-kicker {
    display: inline-block;
    margin-bottom: 12px;
    padding: 8px 14px;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(255,122,184,0.12), rgba(106,182,255,0.12));
    border: 1px solid rgba(255,122,184,0.2);
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.16em;
    color: #8d4566;
}

.start-img-wrap {
    flex-shrink: 0;
    width: 220px;
}

.start-img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 24px;
    object-fit: cover;
    box-shadow: 0 14px 36px rgba(143,92,255,0.25), 0 0 0 3px rgba(255,255,255,0.9);
    animation: imgBounce 1.9s ease-in-out infinite;
    transform-origin: center bottom;
}

@keyframes imgBounce {
    0%   { transform: translateY(0) scaleX(1) scaleY(1); animation-timing-function: cubic-bezier(0.55, 0.05, 0.67, 0.19); }
    12%  { transform: translateY(0) scaleX(1.09) scaleY(0.86); }
    35%  { transform: translateY(-34px) scaleX(0.91) scaleY(1.12); animation-timing-function: cubic-bezier(0.21, 0.61, 0.35, 1); }
    60%  { transform: translateY(0) scaleX(1.07) scaleY(0.88); animation-timing-function: cubic-bezier(0.55, 0.05, 0.67, 0.19); }
    75%  { transform: translateY(-13px) scaleX(0.97) scaleY(1.04); animation-timing-function: cubic-bezier(0.21, 0.61, 0.35, 1); }
    88%  { transform: translateY(0) scaleX(1.02) scaleY(0.98); }
    100% { transform: translateY(0) scaleX(1) scaleY(1); }
}

.start-title {
    margin: 0 0 10px 0;
    font-size: 2.85rem;
    font-weight: 900;
    letter-spacing: -1.5px;
    line-height: 1.05;
    color: #8f5cff;
    text-shadow: 0 2px 0 rgba(255,255,255,0.42), 0 6px 20px rgba(143,92,255,0.22);
}

.start-subtitle {
    margin: 0 0 24px 0;
    font-size: 1.04rem;
    color: var(--muted);
    font-weight: 600;
    line-height: 1.5;
}

.start-divider {
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, var(--pink), var(--blue));
    border-radius: 3px;
    margin: 0 auto 22px auto;
}

.start-themes-label {
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #b09ac8;
    margin-bottom: 12px;
}

.start-themes {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-bottom: 32px;
}

.start-pill {
    background: linear-gradient(135deg, rgba(143,92,255,0.09), rgba(255,122,184,0.09));
    border: 1.5px solid rgba(143,92,255,0.22);
    border-radius: 999px;
    padding: 7px 16px;
    font-size: 0.83rem;
    font-weight: 700;
    color: #6e39cc;
}

.start-play-btn {
    display: inline-block;
    background: linear-gradient(135deg, #8f5cff 0%, #ff7ab8 100%);
    color: #ffffff;
    border: none;
    border-radius: 18px;
    padding: 18px 66px;
    font-family: var(--font-main);
    font-size: 1.2rem;
    font-weight: 900;
    letter-spacing: 1.5px;
    cursor: pointer;
    box-shadow: 0 12px 28px rgba(143,92,255,0.38);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    animation: startPlayPulse 2.2s ease-in-out infinite;
    margin-bottom: 18px;
}

@keyframes startPlayPulse {
    0%, 100% { box-shadow: 0 12px 28px rgba(143,92,255,0.38); transform: scale(1); }
    50% { box-shadow: 0 20px 40px rgba(143,92,255,0.58); transform: scale(1.028); }
}

.start-tip {
    margin: 0;
    font-size: 0.78rem;
    color: #b09ac8;
    font-weight: 500;
}

.start-deco {
    position: absolute;
    pointer-events: none;
    user-select: none;
    z-index: 1;
    opacity: 0.65;
    animation: startDecoFloat 5s ease-in-out infinite alternate;
}

.start-deco--1 { top: 6%; left: 4%; font-size: 3.6rem; animation-delay: 0s; }
.start-deco--2 { top: 9%; right: 5%; font-size: 2.8rem; animation-delay: 0.9s; }
.start-deco--3 { bottom: 9%; left: 6%; font-size: 3.2rem; animation-delay: 1.7s; }
.start-deco--4 { bottom: 6%; right: 4%; font-size: 2.8rem; animation-delay: 0.5s; }
.start-deco--5 { top: 48%; left: 1.5%; font-size: 2.2rem; animation-delay: 1.3s; }
.start-deco--6 { top: 40%; right: 1.5%; font-size: 2.2rem; animation-delay: 0.7s; }

@keyframes startDecoFloat {
    0% { transform: translateY(0) rotate(-10deg) scale(1); }
    100% { transform: translateY(-22px) rotate(10deg) scale(1.07); }
}

.game-shell {
    width: min(96vw, 1720px);
    margin: 14px auto 22px;
    display: grid;
    gap: 14px;
}

.game-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 20px;
    border-radius: var(--radius-xl);
    background: linear-gradient(180deg, rgba(255,248,236,0.88), rgba(255,244,225,0.74));
    border: 2px solid rgba(220, 155, 184, 0.42);
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
}

.game-top__title h1 {
    margin: 0;
    font-size: clamp(2rem, 2.8vw, 3rem);
    font-weight: 900;
    letter-spacing: -1px;
    color: #7c3152;
}

.game-top__title p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 0.96rem;
    font-weight: 600;
}

.status-pill {
    background: linear-gradient(135deg, var(--pink), var(--blue));
    color: white;
    padding: 10px 20px;
    border-radius: 999px;
    font-weight: 900;
    box-shadow: 0 10px 24px rgba(143,92,255,0.25);
    text-transform: uppercase;
    font-size: 0.82rem;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.hud-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255, 250, 244, 0.75);
    border: 2px solid rgba(255, 122, 184, 0.25);
    backdrop-filter: blur(12px);
    box-shadow: 0 12px 28px rgba(110, 52, 82, 0.10);
}

.hud-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(255,255,255,0.85);
    border: 1px solid rgba(218, 193, 203, 0.72);
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--muted);
}

.hud-chip b { color: #7c3152; }

.hud-chip--time b { color: #256fbd; }

.game-layout {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr) 310px;
    gap: 14px;
    align-items: start;
}

.panel {
    background: rgba(255, 250, 244, 0.84);
    border: 2px solid rgba(255, 122, 184, 0.25);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
    padding: 16px;
}

.panel-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.panel-title h2, .panel-title h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 900;
    letter-spacing: 0.04em;
}

.panel-title--small h3 {
    font-size: 0.98rem;
}

.badge {
    font-size: 0.75rem;
    font-weight: 900;
    color: white;
    background: linear-gradient(135deg, var(--pink), var(--blue));
    padding: 5px 11px;
    border-radius: 999px;
    white-space: nowrap;
}

.order-box {
    background: linear-gradient(180deg, rgba(255,255,255,0.92), rgba(255,252,246,0.92));
    border: 1px solid rgba(255, 181, 208, 0.7);
    border-radius: 22px;
    padding: 14px;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.65);
}

.order-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 10px 0 10px;
}

.order-chip {
    background: #fff7fc;
    border: 1px solid rgba(255, 181, 208, 0.6);
    border-radius: 14px;
    padding: 9px;
    text-align: center;
    font-size: 0.84rem;
    min-height: 60px;
}

.order-chip strong {
    display: block;
    margin-top: 3px;
    color: #7c3152;
    font-size: 0.93rem;
}

.order-preview {
    background: linear-gradient(180deg, #fff8d9, #ffe9ba);
    border: 1px dashed #f0c16a;
    border-radius: 14px;
    padding: 10px;
    color: #8d5e18;
    font-size: 0.88rem;
    text-align: center;
    line-height: 1.35;
}

.mini-notes {
    margin-top: 14px;
}

.small {
    font-size: 0.9rem;
    color: var(--muted);
    line-height: 1.45;
    margin: 0;
}

.stage-panel {
    min-width: 0;
    display: grid;
    gap: 14px;
}

.sign-board {
    width: min(100%, 560px);
    margin: 0 auto;
    position: relative;
    padding: 18px 28px 22px;
    border-radius: 34px 34px 44px 44px;
    background: linear-gradient(180deg, #fff7e6 0%, #fff2cc 100%);
    border: 4px solid #7db5e7;
    box-shadow: 0 18px 40px rgba(110,52,82,0.15), inset 0 0 0 6px rgba(255,255,255,0.75);
    text-align: center;
}

.sign-board::before,
.sign-board::after {
    content: "";
    position: absolute;
    top: -18px;
    width: 6px;
    height: 22px;
    background: #7db5e7;
    border-radius: 3px;
}

.sign-board::before { left: 28%; }
.sign-board::after { right: 28%; }

.sign-board__line {
    font-weight: 900;
    color: #7c3152;
    letter-spacing: 0.08em;
    font-size: clamp(1.5rem, 2vw, 2rem);
}

.sign-board__line--big {
    margin-top: 4px;
    font-size: clamp(2.1rem, 3.2vw, 3rem);
}

.stage-card {
    position: relative;
    min-height: 470px;
    border-radius: var(--radius-xl);
    background: linear-gradient(180deg, rgba(255,247,231,0.84), rgba(255,239,210,0.74));
    border: 2px solid rgba(125, 181, 231, 0.62);
    box-shadow: var(--shadow);
    overflow: hidden;
    padding: 18px;
}

.stage-glow {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 50% 22%, rgba(255, 255, 255, 0.54), transparent 22%),
        radial-gradient(circle at 50% 70%, rgba(255, 255, 255, 0.18), transparent 26%);
    pointer-events: none;
}

.stage-top-decor {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    font-size: 1.35rem;
    opacity: 0.85;
    z-index: 1;
}

.cake-stage {
    position: relative;
    min-height: 420px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 28px;
    background:
        radial-gradient(circle at 50% 10%, rgba(255,255,255,0.7), transparent 34%),
        linear-gradient(180deg, rgba(255,255,255,0.15), rgba(255,255,255,0.05));
    border: 2px solid rgba(255,255,255,0.45);
}

.stage-backdrop {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(255,247,229,0.65), rgba(255,247,229,0.20)),
        radial-gradient(circle at 50% 36%, rgba(255, 232, 196, 0.35), transparent 33%);
}

.stage-floor {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 112px;
    background: linear-gradient(180deg, transparent, rgba(255, 180, 213, 0.10));
}

.plate {
    width: 360px;
    height: 190px;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 28%, #ffffff, #d8ebff);
    position: relative;
    display: grid;
    place-items: center;
    box-shadow: inset 0 -8px 15px rgba(0,0,0,0.08), 0 20px 40px rgba(84, 105, 156, 0.15);
    z-index: 2;
}

.cake {
    width: 240px;
    height: 210px;
    position: relative;
    filter: drop-shadow(0 12px 18px rgba(90,52,112,0.2));
    transform: translateY(-20px);
}

.cake .layer {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    transition: all 0.25s ease;
}

.layer.base {
    bottom: 15px;
    width: 210px;
    height: 110px;
    background: linear-gradient(180deg, #fce0aa, #db9f67);
    box-shadow: inset 0 -12px 0 rgba(0,0,0,0.08);
    border-radius: 22px 22px 28px 28px;
}

.layer.frost {
    top: 35px;
    width: 220px;
    height: 75px;
    box-shadow: inset 0 -10px 0 rgba(255,255,255,0.2);
}

.layer.top {
    top: 22px;
    width: 228px;
    height: 26px;
}

.layer.fill {
    top: 85px;
    width: 185px;
    height: 18px;
}

.shape-circle { border-radius: 50% 50% 30px 30px; }
.shape-square { border-radius: 14px 14px 24px 24px; }
.shape-heart {
    border-radius: 15px;
    clip-path: polygon(50% 95%, 92% 55%, 86% 18%, 60% 4%, 50% 18%, 40% 4%, 14% 18%, 8% 55%);
}
.shape-star {
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 92%, 50% 72%, 21% 92%, 32% 57%, 2% 35%, 39% 35%);
}
.shape-flower {
    clip-path: polygon(50% 0%, 65% 15%, 85% 15%, 85% 35%, 100% 50%, 85% 65%, 85% 85%, 65% 85%, 50% 100%, 35% 85%, 15% 85%, 15% 65%, 0% 50%, 15% 35%, 15% 15%, 35% 15%);
}
.shape-cloud {
    clip-path: polygon(25% 45%, 55% 25%, 85% 40%, 95% 70%, 75% 90%, 25% 90%, 5% 70%);
    border-radius: 40px;
}
.shape-moon {
    clip-path: polygon(40% 0%, 90% 10%, 100% 40%, 85% 80%, 40% 100%, 10% 75%, 15% 30%);
    border-radius: 50%;
}
.shape-circle::before, .shape-square::before, .shape-heart::before {
    content: "";
    position: absolute;
    left: 50%;
    top: -12px;
    width: 80%;
    height: 22px;
    transform: translateX(-50%);
    border-radius: 50%;
    background: inherit;
    filter: brightness(1.08);
}

.frosting-vanilla { background: linear-gradient(180deg,#fffbe3,#f5e6a3); }
.frosting-chocolate { background: linear-gradient(180deg,#9c6a46,#664024); }
.frosting-strawberry { background: linear-gradient(180deg,#ffbad5,#f57da5); }
.frosting-mint { background: linear-gradient(180deg,#d2ffe7,#7adca9); }
.frosting-caramel { background: linear-gradient(180deg,#ffdca3,#e6ab5e); }
.frosting-raspberry { background: linear-gradient(180deg,#ffb8cc,#e6557f); }
.frosting-lemon { background: linear-gradient(180deg,#fffbbf,#ebd05b); }
.frosting-blueberry { background: linear-gradient(180deg,#d6e0ff,#7fa2ff); }
.frosting-cookie { background: linear-gradient(180deg,#fcf1df,#ccb293); }
.frosting-dulce { background: linear-gradient(180deg,#f2d1ab,#c48c52); }

.filling-vanilla { background: #fffae8; }
.filling-chocolate { background: #52341e; }
.filling-strawberry { background: #ffadc9; }
.filling-mint { background: #bef2d5; }
.filling-caramel { background: #f2cb8f; }
.filling-raspberry { background: #eb7196; }
.filling-lemon { background: #fff1a8; }
.filling-blueberry { background: #9ebdff; }
.filling-cookie { background: #dec9b1; }
.filling-dulce { background: #cf9b65; }

.top-sprinkles {
    background: repeating-linear-gradient(45deg, #ff7ab8 0 6px, #ffd752 6px 12px, #6be0ff 12px 18px);
}
.top-cherry {
    background: radial-gradient(circle at 45% 35%, #ff94ad, #bd1134 70%);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    margin: 0 auto;
    transform: translateY(-5px);
}
.top-star {
    background: #ffd043;
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 92%, 50% 72%, 21% 92%, 32% 57%, 2% 35%, 39% 35%);
    width: 42px;
    height: 42px;
    margin: 0 auto;
}
.top-macarons {
    background: linear-gradient(90deg, #ffd6ec, #ff9ece);
    border-radius: 8px;
    height: 18px;
    width: 60px;
    margin: 5px auto;
}
.top-berries {
    background: #8f9eff;
    border-radius: 50%;
    box-shadow: 10px 0 0 #aa8fff, -10px 0 0 #7fa6ff;
    width: 16px;
    height: 16px;
    margin: 5px auto;
}
.top-flowers {
    background: #fffff0;
    border: 2px solid #ff7ab8;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    margin: 0 auto;
}
.top-donuts {
    background: #f0cbab;
    border: 4px solid #a8764e;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    margin: 0 auto;
}
.top-oreo {
    background: #3b3129;
    border-radius: 6px;
    height: 26px;
    width: 50px;
    margin: 0 auto;
    border: 2px dashed #ffffff;
}
.top-candies {
    background: linear-gradient(45deg, #ff9494, #99f3ff);
    border-radius: 10px;
    width: 45px;
    height: 20px;
    margin: 0 auto;
}

.decor-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 3;
}

.sprinkle-shower {
    position: absolute;
    inset: 0;
    opacity: 0.7;
    background:
        radial-gradient(circle at 20% 40%, #ff7ab8 0 3px, transparent 4px),
        radial-gradient(circle at 75% 30%, #ffd752 0 3px, transparent 4px),
        radial-gradient(circle at 50% 60%, #6be0ff 0 3px, transparent 4px);
}

.stage-label {
    position: absolute;
    bottom: 14px;
    z-index: 3;
    background: rgba(255, 255, 255, 0.92);
    padding: 7px 16px;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 700;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    border: 1px solid rgba(255, 181, 208, 0.6);
}

.tools-dock {
    display: grid;
    gap: 12px;
}

.glass-card {
    background: rgba(255,255,255,0.72);
    border: 1px solid rgba(255,255,255,0.82);
    border-radius: 22px;
    padding: 14px;
}

.tool-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    gap: 10px;
}

.tool-head h4 {
    margin: 0;
    font-size: 0.98rem;
    color: #7c3152;
}

.choice-row, .choice-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.choice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.choice {
    background: #ffffff;
    border: 1px solid #eadeff;
    border-radius: 12px;
    padding: 10px 8px;
    font: inherit;
    font-size: 0.86rem;
    font-weight: 800;
    color: var(--muted);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s, color 0.2s, background 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 46px;
}

.choice:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(143,92,255,0.12);
    border-color: var(--pink);
    color: #7c3152;
}

.choice.selected {
    background: linear-gradient(135deg, var(--pink), var(--blue));
    color: white;
    border-color: transparent;
    box-shadow: 0 8px 18px rgba(143,92,255,0.25);
}

.choice-row--wrap .choice {
    min-width: 110px;
}

.action-row {
    display: flex;
    gap: 10px;
    margin-top: 2px;
    padding: 12px 14px;
    border-radius: 26px;
    background: rgba(255, 250, 244, 0.80);
    border: 2px solid rgba(255, 122, 184, 0.20);
    box-shadow: 0 16px 34px rgba(110,52,82,0.10);
}

.action-btn {
    flex: 1;
    border: none;
    cursor: pointer;
    border-radius: 16px;
    padding: 14px;
    font: inherit;
    font-weight: 900;
    letter-spacing: 0.04em;
    transition: transform 0.2s, box-shadow 0.2s, filter 0.2s;
    min-width: 0;
}

.primary {
    background: linear-gradient(135deg, var(--mint), #45d891);
    color: white;
    box-shadow: 0 10px 22px rgba(46,198,124,0.24);
}

.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 26px rgba(46,198,124,0.32);
}

.secondary {
    background: linear-gradient(180deg, #fffdf9, #fff6ef);
    color: var(--ink);
    border: 2px solid rgba(255, 171, 195, 0.55);
}

.secondary:hover {
    transform: translateY(-2px);
    border-color: var(--pink);
    box-shadow: 0 12px 24px rgba(110,52,82,0.10);
}

.status-strip {
    text-align: center;
    padding: 12px 16px;
    border-radius: 18px;
    background: rgba(255, 250, 244, 0.82);
    border: 1px solid rgba(255, 181, 208, 0.75);
    color: #7c3152;
    font-weight: 700;
    box-shadow: 0 10px 22px rgba(110,52,82,0.08);
}

.info-grid {
    display: grid;
    gap: 10px;
}

.info-item {
    background: linear-gradient(180deg, rgba(255,255,255,0.95), rgba(255,250,245,0.92));
    border: 1px solid rgba(255, 181, 208, 0.6);
    border-radius: 16px;
    padding: 12px;
    font-size: 0.85rem;
}

.info-item strong {
    display: block;
    margin-bottom: 5px;
    color: #7c3152;
}

.meter {
    height: 8px;
    border-radius: 10px;
    background: #eee5fa;
    overflow: hidden;
}

.meter > div {
    height: 100%;
    background: linear-gradient(90deg, var(--pink), var(--blue));
    transition: width 0.3s;
    width: 0%;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(28, 12, 43, 0.65);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.modal {
    width: min(92%, 600px);
    background: white;
    border-radius: 24px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.3);
    overflow: hidden;
    animation: scaleUp 0.25s ease-out;
}

@keyframes scaleUp {
    from { transform: scale(0.92); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-head {
    background: linear-gradient(135deg, var(--pink), var(--blue));
    color: white;
    padding: 20px;
    text-align: center;
}

.modal-head h2 {
    margin: 0 0 4px 0;
    font-size: 1.35rem;
}

.modal-body {
    padding: 25px;
    text-align: center;
}

.question {
    font-size: 1.15rem;
    font-weight: 800;
    margin-bottom: 20px;
    color: var(--ink);
    line-height: 1.4;
}

.answers {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.answer {
    background: #faf7ff;
    border: 2px solid #e1d2f7;
    border-radius: 12px;
    padding: 12px 16px;
    font: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--muted);
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.answer:hover {
    border-color: var(--pink);
    background: #ffffff;
    color: #8f5cff;
    transform: translateX(3px);
}

.hidden { display: none !important; }

@media (max-width: 1400px) {
    .game-layout {
        grid-template-columns: 1fr;
    }
    .stage-card {
        min-height: 430px;
    }
    .panel {
        order: 2;
    }
    .stage-panel {
        order: 1;
    }
}

@media (max-width: 760px) {
    .game-shell {
        width: min(96vw, 100%);
        margin: 10px auto 18px;
    }

    .game-top {
        flex-direction: column;
        align-items: flex-start;
    }

    .hud-strip {
        border-radius: 24px;
    }

    .order-grid, .choice-grid {
        grid-template-columns: 1fr;
    }

    .plate {
        width: 300px;
        height: 165px;
    }

    .cake {
        width: 210px;
        height: 190px;
    }

    .action-row {
        flex-direction: column;
    }

    .start-card {
        flex-direction: column;
        text-align: center;
        padding: 36px 26px;
        gap: 28px;
    }

    .start-card-content {
        text-align: center;
        order: 2;
    }

    .start-img-wrap {
        width: 155px;
        order: 1;
    }

    .start-title {
        font-size: 2rem;
    }

    .start-play-btn {
        padding: 16px 44px;
        font-size: 1.05rem;
    }

    .start-deco--5,
    .start-deco--6 {
        display: none;
    }
}
.intro-overlay {
    position: fixed;
    inset: 0;
    z-index: 9500;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(34, 18, 50, 0.22);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .35s ease;
}

    .intro-overlay.show {
        opacity: 1;
        pointer-events: auto;
    }

.intro-backdrop {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 20% 20%, rgba(255,255,255,0.18), transparent 25%), radial-gradient(circle at 80% 80%, rgba(255,255,255,0.12), transparent 28%), rgba(0,0,0,0.18);
}

.intro-scene {
    position: relative;
    z-index: 1;
    width: min(1100px, 92vw);
    min-height: 70vh;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 28px;
    padding: 30px;
}

.intro-character {
    width: min(320px, 32vw);
    max-width: 340px;
    height: auto;
    filter: drop-shadow(0 16px 30px rgba(0,0,0,.22));
    animation: introFloat 2.2s ease-in-out infinite;
    align-self: center;
}

@keyframes introFloat {
    0%, 100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.speech-wrap {
    width: min(720px, 100%);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.speech-name {
    display: inline-block;
    margin-left: 18px;
    margin-bottom: 8px;
    padding: 8px 16px;
    border-radius: 999px;
    background: rgba(255,255,255,0.92);
    color: #6f2c58;
    font-weight: 900;
    letter-spacing: .2px;
    box-shadow: 0 8px 20px rgba(0,0,0,.12);
}

.speech-box {
    width: 100%;
    position: relative;
    background: rgba(255, 248, 252, 0.95);
    border: 4px solid #7f4ba6;
    border-radius: 30px;
    padding: 28px 30px;
    box-shadow: 0 20px 50px rgba(0,0,0,.18);
}

    .speech-box::before {
        content: "";
        position: absolute;
        left: 54px;
        top: -18px;
        width: 28px;
        height: 28px;
        background: rgba(255, 248, 252, 0.95);
        border-left: 4px solid #7f4ba6;
        border-top: 4px solid #7f4ba6;
        transform: rotate(45deg);
    }

.speech-text {
    margin: 0;
    min-height: 120px;
    color: #3c234f;
    font-size: 1.3rem;
    line-height: 1.6;
    font-weight: 700;
    white-space: pre-wrap;
}

.speech-continue {
    margin-top: 18px;
    font-size: 0.95rem;
    font-weight: 800;
    color: #a15a86;
    text-align: right;
    animation: blink 1.1s infinite;
}

@keyframes blink {
    0%, 100% {
        opacity: 1;
    }

    50% {
        opacity: .35;
    }
}

@media (max-width: 900px) {
    .intro-scene {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 18px;
    }

    .intro-character {
        width: min(260px, 55vw);
    }

    .speech-text {
        font-size: 1.05rem;
        min-height: 100px;
    }
}

/* ════════════════════════════════════════════════════
   SISTEMA DE EXÁMENES PENDIENTES
   ════════════════════════════════════════════════════ */

/* ── Notificación toast ─────────────────────────────── */
.exam-notif-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 8500;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    max-width: 340px;
    width: calc(100% - 40px);
}

.exam-notif {
    background: linear-gradient(135deg, #1a0033 0%, #380070 100%);
    border: 2px solid #aa44ff;
    border-radius: 16px;
    padding: 14px 16px;
    color: #fff;
    box-shadow: 0 8px 28px rgba(120, 0, 220, 0.45),
                inset 0 1px 0 rgba(255,255,255,0.12);
    pointer-events: all;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: notifSlideIn 0.38s cubic-bezier(0.22, 0.61, 0.36, 1) both;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.exam-notif:hover {
    border-color: #cc88ff;
    transform: translateX(-4px);
}

.exam-notif.hiding {
    opacity: 0;
    transform: translateX(40px);
    pointer-events: none;
}

@keyframes notifSlideIn {
    from { transform: translateX(110%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}

.notif-icon {
    font-size: 2rem;
    flex-shrink: 0;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.4));
}

.notif-body {
    flex: 1;
    min-width: 0;
}

.notif-body strong {
    display: block;
    font-size: 0.9rem;
    font-weight: 800;
    color: #ffdd44;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notif-body span {
    font-size: 0.78rem;
    opacity: 0.82;
    line-height: 1.4;
}

.notif-cta {
    font-size: 0.72rem;
    background: rgba(255,255,255,0.15);
    border-radius: 6px;
    padding: 3px 8px;
    margin-top: 5px;
    display: inline-block;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.notif-close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: rgba(255,255,255,0.45);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 2px 4px;
    line-height: 1;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}
.notif-close:hover {
    color: #fff;
    background: rgba(255,255,255,0.12);
}

/* ── Panel de exámenes pendientes ───────────────────── */
.pending-exams-card {
    margin-top: 14px;
    border-top: 2px dashed rgba(200, 34, 0, 0.2);
    padding-top: 14px;
}

.exam-count-badge {
    background: #aaaaaa !important;
    color: #fff !important;
    min-width: 22px;
    text-align: center;
    transition: background 0.3s, transform 0.2s;
}

.exam-count-badge.has-exams {
    background: #cc2200 !important;
    animation: badgePulse 1.3s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% { transform: scale(1);    box-shadow: 0 0 0 0 rgba(200,34,0,0.5); }
    50%       { transform: scale(1.18); box-shadow: 0 0 0 7px rgba(200,34,0,0); }
}

.pending-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
    max-height: 220px;
    overflow-y: auto;
    padding-right: 2px;
}

.no-exams-msg {
    text-align: center;
    padding: 12px 0;
    opacity: 0.55;
}

.pending-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(200, 34, 0, 0.06);
    border: 1.5px solid rgba(200, 34, 0, 0.2);
    border-radius: 10px;
    padding: 8px 10px;
    animation: pendingItemIn 0.3s ease both;
}

@keyframes pendingItemIn {
    from { opacity: 0; transform: translateX(-10px); }
    to   { opacity: 1; transform: translateX(0); }
}

.pending-item-icon { font-size: 1.2rem; flex-shrink: 0; }

.pending-item-name {
    flex: 1;
    font-size: 0.78rem;
    font-weight: 700;
    color: #3a1800;
    line-height: 1.3;
    min-width: 0;
}

.pending-item-btn {
    flex-shrink: 0;
    background: #cc2200;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 5px 11px;
    font-size: 0.76rem;
    font-weight: 800;
    cursor: pointer;
    letter-spacing: 0.03em;
    transition: background 0.15s, transform 0.1s;
}
.pending-item-btn:hover {
    background: #aa1500;
    transform: scale(1.06);
}

/* ── Overlay del Profesor ───────────────────────────── */
.professor-overlay {
    position: fixed;
    inset: 0;
    z-index: 9500;
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    padding: 32px 40px;
    transition: opacity 0.3s ease;
    opacity: 0;
}

.professor-overlay.hidden {
    display: none;
}

.professor-overlay.show {
    opacity: 1;
    pointer-events: all;
}

.professor-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 20, 0.62);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.professor-scene {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: flex-end;
    gap: 20px;
    max-width: 680px;
}

.professor-character {
    width: 148px;
    height: auto;
    object-fit: contain;
    flex-shrink: 0;
    filter: drop-shadow(0 10px 24px rgba(0,0,0,0.55));
    animation: profEntry 0.45s cubic-bezier(0.22, 0.61, 0.36, 1) both;
    transform-origin: bottom center;
}

@keyframes profEntry {
    from { transform: translateY(50px) scale(0.88); opacity: 0; }
    to   { transform: translateY(0)    scale(1);    opacity: 1; }
}

.professor-speech {
    background: #fffdf8;
    border-radius: 20px 20px 20px 4px;
    padding: 20px 22px 18px;
    box-shadow: 0 14px 44px rgba(0,0,0,0.32),
                inset 0 0 0 1.5px rgba(255,220,100,0.35);
    animation: profEntry 0.45s 0.08s cubic-bezier(0.22, 0.61, 0.36, 1) both;
    border: 2px solid #ffcc44;
}

.professor-name {
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #9933cc;
    margin-bottom: 9px;
}

.professor-text {
    font-size: 0.97rem;
    color: #1a0a00;
    line-height: 1.6;
    margin: 0 0 16px 0;
    max-width: 420px;
}

.professor-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}


/* ════════════════════════════════════════════════════
   MENÚ DE PAUSA & ENGRANAJE
   ════════════════════════════════════════════════════ */

/* Botón engranaje en el header */
.pause-gear-btn {
    background: rgba(255,255,255,0.12);
    border: 2px solid rgba(255,255,255,0.28);
    color: #fff;
    font-size: 1.5rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.18s, transform 0.35s, border-color 0.18s;
    flex-shrink: 0;
    line-height: 1;
    padding: 0;
    margin-left: 10px;
}

.pause-gear-btn:hover {
    background: rgba(255,255,255,0.22);
    border-color: rgba(255,255,255,0.55);
    transform: rotate(60deg);
}

.pause-gear-btn.spinning {
    animation: gearSpin 0.45s ease both;
}

@keyframes gearSpin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(180deg); }
}

/* Fondo oscuro de la pausa */
.pause-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9000;
    background: rgba(10, 5, 30, 0.72);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.28s ease;
    pointer-events: none;
}

.pause-backdrop.hidden {
    display: none;
}

.pause-backdrop.show {
    opacity: 1;
    pointer-events: all;
}

/* Panel central */
.pause-panel {
    background: #fff8f0;
    border-radius: 28px;
    padding: 36px 40px 32px;
    width: min(460px, 92vw);
    box-shadow: 0 24px 70px rgba(0,0,0,0.4),
                inset 0 0 0 2px rgba(255,200,100,0.35);
    animation: pausePanelIn 0.32s cubic-bezier(0.22, 0.61, 0.36, 1) both;
    border: 2px solid #f0c070;
}

@keyframes pausePanelIn {
    from { transform: scale(0.88) translateY(24px); opacity: 0; }
    to   { transform: scale(1)    translateY(0);    opacity: 1; }
}

/* Cabecera del panel */
.pause-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 26px;
}

.pause-gear-icon {
    font-size: 2rem;
    animation: gearIdle 4s linear infinite;
    display: inline-block;
}

@keyframes gearIdle {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.pause-title {
    font-size: 1.8rem;
    font-weight: 900;
    letter-spacing: 0.1em;
    color: #3a1800;
    margin: 0;
}

/* Botones principales */
.pause-main-btns {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.pause-btn {
    width: 100%;
    padding: 14px 20px;
    border-radius: 14px;
    border: none;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    cursor: pointer;
    text-align: left;
    transition: transform 0.14s ease, box-shadow 0.14s ease, filter 0.14s ease;
}

.pause-btn:hover {
    transform: translateX(5px);
    filter: brightness(1.06);
}

.pause-btn:active {
    transform: scale(0.97);
}

.pause-btn--resume {
    background: linear-gradient(135deg, #33bb55, #228833);
    color: #fff;
    box-shadow: 0 6px 18px rgba(34,136,51,0.35);
    font-size: 1.1rem;
}

.pause-btn--tab {
    background: #fff;
    color: #3a1800;
    border: 2px solid #e8d0b0;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
}

.pause-btn--tab.active {
    background: linear-gradient(135deg, #f0a830, #d07010);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 6px 18px rgba(200,100,0,0.3);
}

/* Área de contenido dinámico */
.pause-content {
    background: rgba(255,255,255,0.75);
    border: 1.5px solid #e8d0b0;
    border-radius: 16px;
    padding: 0;
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.35s ease, padding 0.25s ease;
}

.pause-content.open {
    max-height: 400px;
    padding: 18px 20px;
}

.pause-content h3 {
    font-size: 0.9rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: #c07020;
    margin: 0 0 10px 0;
}

.pause-content p,
.pause-content li {
    font-size: 0.88rem;
    color: #3a1800;
    line-height: 1.65;
    margin: 0 0 6px 0;
}

.pause-content ul {
    margin: 0;
    padding-left: 18px;
}

.pause-content .shortcut-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 0;
    border-bottom: 1px solid rgba(0,0,0,0.06);
}

.pause-content .shortcut-row:last-child { border-bottom: none; }

.pause-content .shortcut-key {
    background: #3a1800;
    color: #ffd080;
    border-radius: 7px;
    padding: 3px 10px;
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.06em;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 80px;
    text-align: center;
}

.pause-content .shortcut-desc {
    font-size: 0.84rem;
    color: #3a1800;
}

/* ════════════════════════════════════════════════════
   CRÉDITOS EN PANTALLA DE INICIO
   ════════════════════════════════════════════════════ */

.start-credits {
    position: absolute;
    bottom: 18px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 0.74rem;
    color: rgba(60, 20, 80, 0.55);
    letter-spacing: 0.04em;
    pointer-events: none;
    user-select: none;
}

.start-credits strong {
    color: rgba(60, 20, 80, 0.78);
    font-weight: 800;
}

/* Asegurar que #startScreen tenga position relative para el footer absoluto */
.start-screen {
    position: fixed !important;
}


/* ════════════════════════════════════════════════════
   PANTALLA DE RESULTADOS FINALES
   ════════════════════════════════════════════════════ */

.results-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9200;
    background: rgba(10, 4, 28, 0.80);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.35s ease;
    pointer-events: none;
}
.results-backdrop.hidden { display: none; }
.results-backdrop.show   { opacity: 1; pointer-events: all; }

.results-panel {
    background: #fff8f0;
    border-radius: 32px;
    padding: 44px 52px 40px;
    width: min(520px, 92vw);
    text-align: center;
    box-shadow: 0 28px 80px rgba(0,0,0,0.45),
                inset 0 0 0 2px rgba(255,200,100,0.4);
    border: 2px solid #f0c070;
    animation: resultsPanelIn 0.42s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

@keyframes resultsPanelIn {
    from { transform: scale(0.85) translateY(28px); opacity: 0; }
    to   { transform: scale(1)    translateY(0);    opacity: 1; }
}

.results-emoji {
    font-size: 5rem;
    display: block;
    margin-bottom: 8px;
    animation: resultsEmojiPop 0.55s 0.15s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

@keyframes resultsEmojiPop {
    from { transform: scale(0) rotate(-20deg); }
    to   { transform: scale(1) rotate(0deg); }
}

.results-title {
    font-size: 1.65rem;
    font-weight: 900;
    color: #3a1800;
    margin: 0 0 18px 0;
    letter-spacing: 0.04em;
}

/* Grade badge */
.results-grade-wrap {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 22px;
}

.results-grade {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    font-weight: 900;
    color: #fff;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    margin-bottom: 6px;
    animation: gradeSpinIn 0.5s 0.3s cubic-bezier(0.22,0.61,0.36,1) both;
}

@keyframes gradeSpinIn {
    from { transform: rotateY(90deg) scale(0.5); }
    to   { transform: rotateY(0deg)  scale(1); }
}

.results-grade.grade-s { background: linear-gradient(135deg, #ff9f00, #ff5500); }
.results-grade.grade-a { background: linear-gradient(135deg, #33cc66, #118833); }
.results-grade.grade-b { background: linear-gradient(135deg, #3399ff, #1155cc); }
.results-grade.grade-c { background: linear-gradient(135deg, #aa44cc, #662288); }
.results-grade.grade-f { background: linear-gradient(135deg, #cc2200, #881100); }

.results-grade-label {
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #7a4010;
}

/* Stats grid */
.results-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 26px;
}

.results-stat {
    background: rgba(255,255,255,0.75);
    border: 1.5px solid #e8d0b0;
    border-radius: 14px;
    padding: 12px 8px;
    animation: statFadeIn 0.3s ease both;
}

.results-stat:nth-child(1) { animation-delay: 0.35s; }
.results-stat:nth-child(2) { animation-delay: 0.42s; }
.results-stat:nth-child(3) { animation-delay: 0.49s; }
.results-stat:nth-child(4) { animation-delay: 0.56s; }
.results-stat:nth-child(5) { animation-delay: 0.63s; }
.results-stat:nth-child(6) { animation-delay: 0.70s; }

@keyframes statFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.results-stat-value {
    font-size: 1.5rem;
    font-weight: 900;
    color: #3a1800;
    display: block;
    line-height: 1.1;
}

.results-stat-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: #a07050;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: 3px;
    display: block;
}

/* Play again button */
.results-play-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #f0a830, #d07010);
    color: #fff;
    border: none;
    border-radius: 16px;
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: 900;
    letter-spacing: 0.05em;
    cursor: pointer;
    box-shadow: 0 8px 22px rgba(200,100,0,0.35);
    transition: transform 0.15s, box-shadow 0.15s;
    animation: statFadeIn 0.3s 0.75s ease both;
}

.results-play-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 30px rgba(200,100,0,0.45);
}

.results-play-btn:active { transform: scale(0.97); }

/* ════════════════════════════════════════════════════
   URGENCIA DE TIEMPO
   ════════════════════════════════════════════════════ */

.hud-chip--time.urgent {
    background: #cc2200 !important;
    color: #fff !important;
    border-color: #ff4422 !important;
    animation: timeUrgentPulse 0.65s ease-in-out infinite;
}

@keyframes timeUrgentPulse {
    0%, 100% { transform: scale(1);    box-shadow: 0 0 0 0   rgba(200,34,0,0.6); }
    50%       { transform: scale(1.09); box-shadow: 0 0 0 8px rgba(200,34,0,0);   }
}

/* Shake en el stage al entregar mal */
@keyframes shakeCake {
    0%, 100% { transform: translateX(0); }
    20%       { transform: translateX(-8px); }
    40%       { transform: translateX(8px); }
    60%       { transform: translateX(-5px); }
    80%       { transform: translateX(5px); }
}

.cake--shake { animation: shakeCake 0.45s ease both; }


/* ════════════════════════════════════════════════════
   SELECTOR DE DIFICULTAD & CÓMO SE JUEGA
   ════════════════════════════════════════════════════ */

/* Fila de botones en inicio */
.start-action-row {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.start-how-btn {
    flex-shrink: 0;
    background: rgba(255,255,255,0.7);
    border: 2px solid rgba(143,92,255,0.35);
    border-radius: 14px;
    padding: 14px 22px;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 800;
    color: #6633bb;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.12s;
    white-space: nowrap;
}
.start-how-btn:hover {
    background: rgba(255,255,255,0.95);
    border-color: rgba(143,92,255,0.7);
    transform: translateY(-2px);
}

/* Shared backdrop (diff picker + how to play) */
.diff-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9600;
    background: rgba(10,4,28,0.82);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}
.diff-backdrop.hidden { display: none; }
.diff-backdrop.show   { opacity: 1; pointer-events: all; }

/* Panel container */
.diff-panel {
    background: #fff8f0;
    border-radius: 28px;
    padding: 36px 40px 30px;
    width: min(920px, 96vw);
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 28px 80px rgba(0,0,0,0.45),
                inset 0 0 0 2px rgba(255,200,100,0.35);
    border: 2px solid #f0c070;
    animation: diffPanelIn 0.35s cubic-bezier(0.22,0.61,0.36,1) both;
}

@keyframes diffPanelIn {
    from { transform: scale(0.9) translateY(20px); opacity: 0; }
    to   { transform: scale(1)   translateY(0);    opacity: 1; }
}

.diff-title {
    font-size: 1.7rem;
    font-weight: 900;
    color: #3a1800;
    text-align: center;
    margin: 0 0 6px 0;
    letter-spacing: 0.04em;
}

.diff-subtitle {
    text-align: center;
    color: #a07050;
    font-size: 0.9rem;
    margin: 0 0 26px 0;
}

/* Three difficulty cards */
.diff-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 22px;
}

.diff-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    background: #fff;
    border: 2.5px solid #e8d0b0;
    border-radius: 20px;
    padding: 22px 16px 20px;
    cursor: pointer;
    font-family: inherit;
    text-align: center;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.diff-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 36px rgba(0,0,0,0.15);
    border-color: #f0c070;
}

.diff-card--featured {
    border-color: #ffaa00;
    background: linear-gradient(160deg, #fffef0 0%, #fff8e0 100%);
    box-shadow: 0 8px 24px rgba(255,160,0,0.2);
}
.diff-card--featured:hover { border-color: #ff8800; }

.diff-card--hard {
    border-color: #ffaaaa;
    background: linear-gradient(160deg, #fff8f8 0%, #ffe8e8 100%);
}
.diff-card--hard:hover { border-color: #ff4444; box-shadow: 0 16px 36px rgba(200,0,0,0.15); }

.diff-card-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(90deg, #ffaa00, #ff7700);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 900;
    letter-spacing: 0.1em;
    padding: 3px 12px;
    border-radius: 999px;
    white-space: nowrap;
    box-shadow: 0 3px 8px rgba(255,120,0,0.4);
}

.diff-card-emoji {
    font-size: 2.4rem;
    line-height: 1;
}

.diff-card-name {
    font-size: 1.1rem;
    font-weight: 900;
    color: #3a1800;
    letter-spacing: 0.03em;
}

.diff-card-sub {
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: #a07050;
    margin-bottom: 8px;
}

.diff-card-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
    text-align: left;
    width: 100%;
}

.diff-card-list li {
    font-size: 0.78rem;
    color: #5a3010;
    background: rgba(255,220,150,0.2);
    border-radius: 8px;
    padding: 5px 10px;
    font-weight: 600;
}

/* Back button */
.diff-back-btn {
    display: block;
    margin: 0 auto;
    background: none;
    border: 2px solid #d0b090;
    border-radius: 12px;
    padding: 10px 28px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    color: #7a4010;
    cursor: pointer;
    transition: background 0.15s, transform 0.12s;
}
.diff-back-btn:hover { background: rgba(200,140,80,0.12); transform: translateX(-3px); }

/* How to play panel */
.htp-panel { width: min(660px, 96vw); }

.htp-body {
    font-size: 0.9rem;
    color: #3a1800;
    line-height: 1.65;
}
.htp-body p { margin: 0 0 10px 0; }

.htp-section {
    font-size: 0.88rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #c07020;
    margin: 18px 0 10px 0;
}

/* Difficulty comparison table */
.htp-diff-table {
    border-radius: 12px;
    overflow: hidden;
    border: 1.5px solid #e8d0b0;
    margin-bottom: 14px;
}

.htp-diff-row {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr 1fr;
    gap: 0;
}

.htp-diff-row span {
    padding: 9px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #3a1800;
    border-bottom: 1px solid #f0d8b0;
    border-right: 1px solid #f0d8b0;
}
.htp-diff-row span:last-child { border-right: none; }
.htp-diff-row:last-child span { border-bottom: none; }

.htp-diff-head span {
    font-weight: 900;
    font-size: 0.82rem;
    background: #f8e8c0;
    color: #7a4010;
}

.htp-diff-row:nth-child(even) span { background: rgba(255,240,210,0.4); }

/* ════════════════════════════════════════════════════
   CRONÓMETRO DE EXAMEN (modo difícil)
   ════════════════════════════════════════════════════ */

.exam-timer-wrap {
    background: linear-gradient(90deg, #1a0033, #380070);
    border-radius: 12px 12px 0 0;
    padding: 10px 20px;
    margin: -20px -20px 16px -20px;
}

.exam-timer-wrap.hidden { display: none; }

.exam-timer-label {
    font-size: 0.82rem;
    font-weight: 800;
    color: #ffcc44;
    margin-bottom: 7px;
    letter-spacing: 0.04em;
}

.exam-timer-track {
    height: 8px;
    background: rgba(255,255,255,0.15);
    border-radius: 999px;
    overflow: hidden;
}

.exam-timer-bar {
    height: 100%;
    width: 100%;
    background: #33cc66;
    border-radius: 999px;
    transition: width 0.9s linear, background 0.5s ease;
}

/* Responsive: stack diff cards on small screens */
@media (max-width: 640px) {
    .diff-cards { grid-template-columns: 1fr; }
    .start-action-row { flex-direction: column; align-items: stretch; }
    .start-how-btn { text-align: center; }
}
