/* «🎉 حفل التتويج» (spec §7.8): a dark violet stage for the projector. The same in light and dark mode:
   every colour here is set explicitly, nothing comes from the page theme. */
html.show-open, html.show-open body { overflow: hidden; }

/* Fixed art colours for the stage: glass controls and the white logo plate.
   Declared once here; they never change with the design or with dark mode. */
.show {
    --show-white: #FFFFFF;
    --show-glass: rgba(255, 255, 255, .12);
    --show-glass-hover: rgba(255, 255, 255, .22);
    --show-glass-line: rgba(255, 255, 255, .22);
    --show-logo-glow: rgba(255, 255, 255, .25);
}

.show {
    position: fixed; inset: 0; z-index: 90; overflow: hidden; color: var(--show-white); outline: none;
    font-family: 'Tajawal', system-ui, sans-serif; text-align: center;
    display: flex; flex-direction: column; background: var(--show-bg);
    --show-night: #0B0712;
    --show-bg: color-mix(in srgb, var(--primary) 22%, var(--show-night));
    --show-soft: color-mix(in srgb, var(--primary) 22%, #FFFFFF);   /* pale text on the dark stage */
    --show-gold: color-mix(in srgb, var(--reward) 45%, #FFFFFF);
    -webkit-user-select: none; user-select: none;
}
.show:fullscreen { width: 100vw; height: 100vh; }
.show-bg {
    position: absolute; inset: 0;
    background:
        radial-gradient(ellipse 80% 55% at 50% 110%, color-mix(in srgb, var(--reward) 26%, transparent), transparent 70%),
        radial-gradient(ellipse 70% 60% at 50% -10%, color-mix(in srgb, var(--primary) 45%, transparent), transparent 70%),
        linear-gradient(160deg, var(--show-night) 0%, color-mix(in srgb, var(--primary) 26%, var(--show-night)) 45%,
            color-mix(in srgb, var(--primary) 36%, var(--show-night)) 70%, var(--show-bg) 100%);
}
/* two moving spotlights */
.show-spot {
    position: absolute; top: -20vh; width: 70vmax; height: 140vh; pointer-events: none; mix-blend-mode: screen;
    background: radial-gradient(ellipse 30% 55% at 50% 20%, rgba(255, 244, 214, .30), rgba(255, 244, 214, .08) 45%, transparent 70%);
    transform-origin: 50% 0; filter: blur(6px);
}
.show-spot--a { left: -15vmax; animation: show-sweep-a 7s ease-in-out infinite alternate; }
.show-spot--b { right: -15vmax; animation: show-sweep-b 8.5s ease-in-out infinite alternate; background: radial-gradient(ellipse 30% 55% at 50% 20%, color-mix(in srgb, var(--show-soft) 32%, transparent), color-mix(in srgb, var(--show-soft) 8%, transparent) 45%, transparent 70%); }
@keyframes show-sweep-a { from { transform: rotate(-28deg); } to { transform: rotate(22deg); } }
@keyframes show-sweep-b { from { transform: rotate(26deg); } to { transform: rotate(-24deg); } }
.show[data-step="first"] .show-spot, .show[data-step="countdown"] .show-spot { animation-duration: 3s; }

.show-confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; }
.show-main {
    position: relative; z-index: 2; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center;
    padding: clamp(12px, 3vh, 48px) 16px 8px; overflow-y: auto; scrollbar-width: none;
}
.show-main::-webkit-scrollbar { display: none; }
.show-scene { width: 100%; max-width: 1400px; margin: auto 0; display: flex; flex-direction: column; align-items: center; gap: clamp(8px, 2vh, 24px); animation: show-fade .6s ease both; }
@keyframes show-fade { from { opacity: 0; } to { opacity: 1; } }

/* intro */
.show-logo { background: transparent; padding: 0; filter: drop-shadow(0 0 18px var(--show-logo-glow)); animation: show-drop .9s cubic-bezier(.2, 1.4, .4, 1) both; }
.show-logo img { display: block; height: clamp(44px, 9vh, 90px); width: auto; }
.show-kicker { font-size: clamp(22px, min(3.6vw, 6vh), 48px); font-weight: 800; color: var(--show-gold); letter-spacing: .02em; animation: show-rise .8s .3s ease both; }
.show-title {
    font-family: 'Aref Ruqaa', 'Tajawal', serif; font-weight: 700; line-height: 1.25;
    font-size: clamp(40px, min(7.5vw, 11vh), 110px); color: #fff;
    text-shadow: 0 0 24px color-mix(in srgb, var(--show-soft) 80%, transparent), 0 0 60px color-mix(in srgb, var(--primary) 45%, transparent);
    animation: show-zoom 1s .5s cubic-bezier(.2, 1.3, .4, 1) both;
}
.show-stage-icon { font-family: 'Tajawal', sans-serif; }
.show-trophy { font-size: clamp(48px, min(10vw, 13vh), 140px); animation: show-float 2.4s 1.2s ease-in-out infinite; filter: drop-shadow(0 0 24px rgba(253, 224, 71, .6)); }

/* countdown: each number zooms in and fades */
.show-count-label { font-size: clamp(24px, 4vw, 52px); font-weight: 900; color: var(--show-soft); }
.show-count-host { height: clamp(160px, 40vh, 420px); display: flex; align-items: center; justify-content: center; }
.show-count {
    display: block; font-weight: 900; line-height: 1; font-size: clamp(140px, 34vh, 380px);
    background: linear-gradient(180deg, #fff 10%, #fde68a 55%, #f59e0b 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
    filter: drop-shadow(0 0 30px rgba(253, 224, 71, .55));
    animation: show-count 1s cubic-bezier(.2, .9, .3, 1) both;
}
@keyframes show-count { 0% { transform: scale(2.6); opacity: 0; } 25% { opacity: 1; } 70% { transform: scale(1); opacity: 1; } 100% { transform: scale(.7); opacity: 0; } }

/* name reveals: word by word, a right-to-left wipe with scale and glow (Arabic letters stay joined inside each word) */
.show-rank { font-size: clamp(28px, min(5vw, 8vh), 64px); font-weight: 900; animation: show-rise .6s ease both; }
.show-medal { display: inline-block; animation: show-spin 1s ease both; }
.show-name {
    font-weight: 900; line-height: 1.2; font-size: clamp(48px, min(9vw, 15vh), 120px); max-width: 100%;
    overflow-wrap: anywhere; padding: 0 8px;
}
.show-word {
    display: inline-block; animation: show-word 1.1s calc(.5s + var(--i, 0) * .35s) cubic-bezier(.2, 1.2, .3, 1) both;
    text-shadow: 0 0 18px rgba(255, 255, 255, .6), 0 0 48px var(--glow, color-mix(in srgb, var(--show-soft) 80%, transparent));
}
@keyframes show-word {
    0% { opacity: 0; transform: scale(2.2); clip-path: inset(0 0 0 100%); filter: blur(6px); }
    60% { opacity: 1; clip-path: inset(0 0 0 0); filter: blur(0); }
    80% { transform: scale(.94); }
    100% { opacity: 1; transform: scale(1); clip-path: inset(-20% -20% -20% -20%); }
}
.show-meta { font-size: clamp(20px, min(3vw, 5vh), 40px); font-weight: 800; color: var(--show-soft); animation: show-rise .7s 1.6s ease both; }
.show-reveal--bronze .show-rank { color: #fdba74; }
.show-reveal--bronze { --glow: rgba(251, 146, 60, .75); }
.show-reveal--silver .show-rank { color: #e5e7eb; }
.show-reveal--silver { --glow: rgba(196, 181, 253, .9); }
.show-reveal--gold { --glow: rgba(253, 224, 71, .95); position: relative; }
.show-reveal--gold .show-rank { color: #fde047; }
.show-reveal--gold .show-word {
    background: linear-gradient(180deg, #fffbe6 0%, #fde68a 45%, #f59e0b 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
    text-shadow: none; filter: drop-shadow(0 0 22px rgba(253, 224, 71, .75));
}
.show-reveal--gold .show-word { animation-delay: calc(1.1s + var(--i, 0) * .35s); }
.show-reveal--gold .show-meta { animation-delay: 2.2s; }
/* first place: the crown drops onto the name, a pulsing halo behind it */
.show-crown { font-size: clamp(56px, min(11vw, 15vh), 150px); line-height: 1; margin-bottom: -.25em; animation: show-crown 1.2s cubic-bezier(.3, 1.5, .5, 1) both; filter: drop-shadow(0 0 26px rgba(253, 224, 71, .9)); }
@keyframes show-crown { 0% { transform: translateY(-80vh) rotate(-25deg); opacity: 0; } 60% { opacity: 1; } 75% { transform: translateY(8%) rotate(6deg); } 100% { transform: translateY(0) rotate(0); opacity: 1; } }
.show-halo {
    position: absolute; z-index: -1; left: 50%; top: 52%; width: min(90vw, 900px); aspect-ratio: 1; translate: -50% -50%;
    background: radial-gradient(circle, rgba(253, 224, 71, .45) 0%, rgba(245, 158, 11, .18) 35%, transparent 65%);
    border-radius: 50%; animation: show-halo 2.2s ease-in-out infinite;
}
@keyframes show-halo { 0%, 100% { transform: scale(.85); opacity: .7; } 50% { transform: scale(1.08); opacity: 1; } }
/* «تتويج المعلمة»: the shape she chose drops in like the crown, glowing in each place's own colour */
.show-reveal--silver .show-shape, .show-reveal--bronze .show-shape { font-size: clamp(48px, min(9vw, 12vh), 124px); margin-bottom: -.12em; filter: drop-shadow(0 0 24px var(--glow)); }
.show-col.has-shape .show-col-medal { filter: drop-shadow(0 0 16px rgba(255, 255, 255, .55)); animation: show-float 2.4s ease-in-out infinite; }
.show-col--r1.has-shape .show-col-medal { filter: drop-shadow(0 0 20px rgba(253, 224, 71, .9)); }
.show-col--r2.has-shape .show-col-medal { animation-delay: .4s; }
.show-col--r3.has-shape .show-col-medal { animation-delay: .8s; }

/* suspense before first place */
.show-suspense-q { font-size: clamp(32px, 6vw, 84px); font-weight: 900; color: var(--show-gold); animation: show-pulse 1s ease-in-out infinite; }
.show-suspense-drum { font-size: clamp(60px, 12vw, 150px); animation: show-shake .25s linear infinite; }
.show[data-step="first"] .show-bg { animation: show-dim 2.2s ease both; }
@keyframes show-dim { 0% { filter: brightness(1); } 60% { filter: brightness(.45); } 100% { filter: brightness(1.15); } }

/* finale: the podium */
.show-finale { gap: clamp(4px, 1.2vh, 16px); }
.show-finale-title { font-family: 'Aref Ruqaa', 'Tajawal', serif; font-size: clamp(28px, min(5vw, 8vh), 84px); font-weight: 700; color: var(--show-gold); line-height: 1.3; text-shadow: 0 0 30px color-mix(in srgb, var(--reward) 50%, transparent); animation: show-zoom .8s ease both; }
.show-podium { display: flex; align-items: flex-end; justify-content: center; gap: clamp(8px, 2vw, 32px); width: 100%; }
.show-col { flex: 1 1 0; max-width: 380px; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; animation: show-rise .8s both; }
.show-col--r1 { animation-delay: .9s; }
.show-col--r2 { animation-delay: .5s; }
.show-col--r3 { animation-delay: .2s; }
.show-col-medal { font-size: clamp(32px, min(5vw, 8vh), 84px); line-height: 1; }
.show-col--r1 .show-col-medal { font-size: clamp(40px, min(7vw, 11vh), 110px); filter: drop-shadow(0 0 20px rgba(253, 224, 71, .9)); animation: show-float 2.4s ease-in-out infinite; }
.show-col-name { font-weight: 900; font-size: clamp(18px, min(3vw, 5vh), 52px); line-height: 1.15; overflow-wrap: anywhere; }
.show-col--r1 .show-col-name { color: #fde047; font-size: clamp(22px, min(3.8vw, 6.5vh), 64px); }
.show-col-time { font-weight: 800; color: var(--show-soft); font-size: clamp(15px, min(2.2vw, 3.6vh), 30px); }
.show-block {
    width: 100%; display: flex; align-items: center; justify-content: center; border-radius: 18px 18px 0 0; line-height: 1;
    font-weight: 900; font-size: clamp(26px, min(5vw, 7vh), 72px); color: rgba(255, 255, 255, .9);
    background: linear-gradient(180deg, rgba(255, 255, 255, .28), rgba(255, 255, 255, .08)); border: 2px solid rgba(255, 255, 255, .25); border-bottom: none;
}
.show-col--r1 .show-block { height: clamp(64px, 18vh, 260px); background: linear-gradient(180deg, #fbbf24, #b45309); border-color: #fde68a; }
.show-col--r2 .show-block { height: clamp(48px, 12vh, 190px); background: linear-gradient(180deg, #d1d5db, #6b7280); border-color: #f3f4f6; }
.show-col--r3 .show-block { height: clamp(36px, 8vh, 140px); background: linear-gradient(180deg, #fb923c, #9a3412); border-color: #fdba74; }
.show-finale-actions { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-top: clamp(4px, 1.5vh, 20px); }
.show-send {
    min-height: 56px; padding: 0 28px; border-radius: 18px; font-size: clamp(18px, 2.2vw, 26px); font-weight: 900; color: #2A1A05;
    background: linear-gradient(90deg, var(--show-gold), var(--reward)); box-shadow: 0 10px 30px -10px color-mix(in srgb, var(--reward) 90%, transparent);
}
.show-send:hover { filter: brightness(1.06); }

/* controls: always reachable, they fade while the mouse rests */
.show-bar { position: relative; z-index: 4; padding: 8px 16px calc(10px + env(safe-area-inset-bottom, 0px)); transition: opacity .4s; }
.show.is-idle .show-bar { opacity: .12; }
.show.is-idle .show-bar:focus-within, .show-bar:hover { opacity: 1; }
.show-controls { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.show-controls button {
    min-height: 48px; padding: 0 16px; border-radius: 14px; font-size: 16px; font-weight: 900; color: var(--show-white);
    background: var(--show-glass); border: 1px solid var(--show-glass-line); backdrop-filter: blur(6px);
}
.show-controls button:hover:not(:disabled) { background: var(--show-glass-hover); }
.show-controls button.is-main { background: var(--primary); color: var(--on-primary); border-color: transparent; }
.show-controls button:disabled { opacity: .35; cursor: default; }
.show button:focus-visible { outline: 3px solid var(--show-gold); outline-offset: 2px; }
.show .show-help { color: var(--show-soft); font-size: 14px; font-weight: 700; margin-top: 4px; }
.show-progress { position: relative; z-index: 4; height: 4px; background: rgba(255, 255, 255, .08); }
.show-progress span { display: block; height: 100%; width: 100%; transform-origin: 100% 50%; background: linear-gradient(90deg, var(--reward), var(--primary)); animation: show-progress var(--dur, 5s) linear both; }
@keyframes show-progress { from { transform: scaleX(0); } to { transform: scaleX(1); } }

@keyframes show-drop { from { transform: translateY(-40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes show-rise { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes show-zoom { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes show-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
@keyframes show-spin { from { transform: rotateY(540deg) scale(.3); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes show-pulse { 0%, 100% { opacity: .65; transform: scale(.97); } 50% { opacity: 1; transform: scale(1.03); } }
@keyframes show-shake { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg); } }

/* a phone (375 px): smaller podium text, controls on two rows */
@media (max-width: 480px) {
    .show-controls button { padding: 0 10px; font-size: 14px; flex: 1 1 28%; }
    .show-podium { gap: 6px; }
    .show-block { border-radius: 12px 12px 0 0; }
}
@media (max-height: 520px) {
    .show-logo img { height: 36px; }
    .show-trophy { display: none; }
}

/* «الحركات» off, «الاحتفال» off or reduced motion: a simple fade only — no spotlights moving, no zoom, no crown drop */
.show--simple .show-spot { animation: none; }
.show--simple .show-spot--a { transform: rotate(-12deg); }
.show--simple .show-spot--b { transform: rotate(12deg); }
.show--simple *, .show--simple .show-word, .show--simple .show-count { animation-name: show-fade !important; animation-duration: .6s !important; animation-iteration-count: 1 !important; animation-delay: 0s !important; }
.show--simple .show-halo, .show--simple .show-suspense-drum { display: none; }
.show--simple .show-progress span { animation-name: show-progress !important; animation-duration: var(--dur, 5s) !important; animation-timing-function: linear !important; }
@media (prefers-reduced-motion: reduce) {
    .show-spot, .show-halo { animation: none !important; }
}

/* «ابدئي الحفل» */
.show-start-btn { color: var(--on-reward); background: var(--reward); box-shadow: var(--btn-shadow); }
.show-btn-wrap { grid-column: 1 / -1; }

/* the student's first-place mini celebration (the «وصلتكِ شهادة» window) */
.cert-new-card.is-champion { border-color: var(--reward); box-shadow: 0 0 0 4px color-mix(in srgb, var(--reward) 25%, transparent), 0 25px 50px -12px rgba(0, 0, 0, .35); position: relative; overflow: hidden; isolation: isolate; }
.cert-new-card.is-champion::before {
    content: ""; position: absolute; inset: -40%; z-index: -1; pointer-events: none;
    background: conic-gradient(from 0deg, rgba(253, 224, 71, .0), rgba(253, 224, 71, .35), rgba(253, 224, 71, 0) 30%, rgba(253, 224, 71, .3) 55%, rgba(253, 224, 71, 0) 70%);
    animation: champ-spin 6s linear infinite;
}
.champ-crown { display: inline-block; animation: show-crown 1.1s cubic-bezier(.3, 1.5, .5, 1) both; filter: drop-shadow(0 0 14px rgba(253, 224, 71, .9)); }
@keyframes champ-spin { to { transform: rotate(1turn); } }
html.no-motion .cert-new-card.is-champion::before, html.no-motion .champ-crown { animation: none; }
@media (prefers-reduced-motion: reduce) { .cert-new-card.is-champion::before, .champ-crown { animation: none; } }

/* «موسيقى الحفل» panel in «الإعدادات» */
.sm-note { padding: 10px 14px; border-radius: var(--r-btn); background: var(--reward-tint); }
.sm-note .help-text { margin: 0; color: var(--on-reward); font-weight: 600; }
.sm-try-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 10.5rem), 1fr)); }
.sm-try {
    min-height: 44px; padding: 6px 12px; border-radius: var(--r-pill); font-size: 14px; font-weight: 600; text-align: start;
    background: var(--surface); color: var(--text); border: 1px solid var(--border);
}
.sm-try i:first-child { color: var(--primary); }
.sm-song { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 12px; border-radius: var(--r-btn); background: var(--surface); border: 1px solid var(--border); }
.sm-song-name { flex: 1 1 12rem; min-width: 0; font-weight: 600; overflow-wrap: anywhere; display: inline-flex; align-items: center; gap: 6px; }
.sm-song-name i { color: var(--primary); }
.sm-song-size { font-size: 13px; color: var(--muted); }
.sm-song-acts { display: flex; gap: 6px; }
.sm-range { accent-color: var(--primary); min-height: 40px; width: 100%; }
#sm-volume-out { font-weight: 600; color: var(--text); }
