/* Shared student entry layout and everyday illustration layers. */
body.play-page {
    margin: 0;
    min-height: 100svh !important;
    background: var(--v2-play-scene);
    color: var(--v2-text-primary);
    font-family: var(--v2-font-body);
    isolation: isolate;
    --wa-font-family-body: var(--v2-font-body);
}

.play-scene {
    position: fixed;
    inset: 64px 0 0;
    overflow: hidden;
    z-index: -1;
    pointer-events: none;
    container-type: size;
}
.play-artwork {
    position: absolute;
    left: 50%;
    bottom: 0;
    width: max(100cqw, 177.87234cqh);
    aspect-ratio: 1672 / 940;
    transform: translateX(-50%);
    perspective: 1000px;
}
.play-scene picture,
.play-scene img { display: block; width: 100%; height: 100%; }
.play-scene img { object-fit: cover; object-position: center bottom; }

header { position: relative; z-index: 2; flex: 0 0 auto; }
.header-top { height: 4px; background: var(--v2-brand-primary); }
.header-btm {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--v2-play-header);
    border-bottom: 1px solid var(--v2-border-default);
}
.header-logo a { display: flex; align-items: center; padding: 6px; border-radius: 6px; }
.header-logo a:focus-visible { outline: 3px solid var(--v2-brand-primary); outline-offset: 2px; }
.header-logo img { display: block; width: min(360px, 78vw); height: auto; }
.header-logo .play-logo-dark { display: none; }

main {
    flex: 1;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    place-items: center;
    padding: clamp(32px, 7vh, 72px) 24px clamp(72px, 15vh, 160px);
}
.play-entry {
    box-sizing: border-box;
    width: min(100%, 440px);
    min-width: 0;
    padding: 38px 36px 30px;
    border: 1px solid var(--v2-play-card-border);
    border-radius: 24px;
    background: var(--v2-play-card);
    box-shadow: var(--v2-shadow-neutral-lg);
}
.play-entry h1 {
    margin: 0;
    font-family: var(--v2-font-display);
    font-size: clamp(2rem, 4vw, 2.5rem);
    font-weight: 700;
    letter-spacing: -0.04em;
    line-height: 1.15;
    text-align: center;
}
.play-entry-intro {
    margin: 12px 0 30px;
    color: var(--v2-text-secondary);
    font-size: 0.9rem;
    line-height: 1.65;
    text-align: center;
}
.play-code-input {
    display: block;
    min-width: 0;
    width: 100%;
    --wa-form-control-height: 54px;
    --wa-form-control-border-color: var(--v2-border-strong);
    --wa-form-control-background-color: var(--v2-play-card);
    --wa-form-control-label-color: var(--v2-text-primary);
    --wa-form-control-hint-color: var(--v2-danger-text);
    --wa-form-control-required-content: '';
}
.play-code-input::part(input) {
    font-size: 1.25rem;
    letter-spacing: 0.22em;
    font-weight: 600;
}
.play-code-input::part(base) { border-color: var(--v2-play-input-border); }
.play-code-input::part(input)::placeholder { -webkit-text-fill-color: var(--v2-text-muted); color: var(--v2-text-muted); }
.play-code-input::part(label) { font-weight: 600; font-size: 0.875rem; }
.play-code-input:focus-within::part(base) { outline: 3px solid var(--v2-brand-primary); outline-offset: 3px; }
.play-code-input[aria-invalid="true"]::part(base) { border-color: var(--v2-danger-text); }
#play-code-error { font-size: 0.8rem; line-height: 1.5; }
.play-submit {
    display: block;
    width: 100%;
    margin-top: 20px;
    --v2-brand-primary: var(--v2-play-action);
    --v2-brand-primary-light: var(--v2-play-action-hover);
    --v2-text-inverse: var(--v2-play-action-text);
    --v2-text-on-brand-light: var(--v2-play-action-text);
    --v2-shadow-brand-md: none;
    --v2-shadow-brand-lg: var(--v2-shadow-neutral-md);
}
.play-submit:focus-within { outline: 3px solid var(--v2-brand-primary); outline-offset: 4px; border-radius: 10px; }
.play-submit::part(base) { min-height: 52px; }
.play-entry-reassurance { margin: 18px 0 0; text-align: center; font-size: 0.75rem; color: var(--v2-text-secondary); line-height: 1.5; }

.play-footer { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 24px; }
.version-text { font-size: 0.7rem; color: var(--v2-play-footer-text); background: var(--v2-play-footer-surface); padding: 4px 9px; border-radius: 20px; }
.play-motion-toggle {
    --v2-text-muted: var(--v2-play-footer-text);
    --v2-brand-primary: var(--v2-play-footer-text);
    --wa-color-neutral-on-quiet: var(--v2-play-footer-text);
    --wa-color-neutral-fill-quiet: var(--v2-play-footer-surface);
    --wa-color-neutral-fill-normal: var(--v2-play-footer-surface);
    --wa-color-text-normal: var(--v2-play-footer-text);
    --wa-color-text-quiet: var(--v2-play-footer-text);
    color: var(--v2-play-footer-text);
    background: transparent;
    border-radius: 24px;
    width: 44px;
    flex: 0 0 auto;
    overflow: hidden;
    transition: width 280ms cubic-bezier(0.22, 1, 0.36, 1);
    --wa-form-control-height-small: 44px;
}
.play-motion-toggle:focus-within { outline: 3px solid var(--v2-brand-accent); outline-offset: 3px; }
.play-motion-toggle::part(base) { width: 100%; min-height: 44px; gap: 0; padding: 0; border: 0; border-radius: 24px; background: transparent; }
.play-motion-toggle::part(label) { display: flex; justify-content: center; width: 100%; padding: 0; }
.play-motion-content { box-sizing: border-box; display: flex; align-items: center; width: calc(100% - 8px); min-width: 36px; height: 36px; padding: 0 9px; border-radius: 20px; background: var(--v2-play-footer-surface); }
.play-motion-icon { display: block; width: 18px; height: 18px; flex: 0 0 18px; }
#play-motion-label { max-width: 0; opacity: 0; overflow: hidden; white-space: nowrap; font-size: 0.75rem; line-height: 1.4; transition: max-width 280ms ease, margin-left 280ms ease, opacity 180ms ease; }
.play-motion-toggle[data-feedback="true"] { width: 184px; }
.play-motion-toggle[data-feedback="true"] #play-motion-label { max-width: 140px; margin-left: 8px; opacity: 1; }
.play-motion-toggle[hidden], .play-motion-resume { display: none; }
.play-motion-toggle[data-paused="true"] .play-motion-pause { display: none; }
.play-motion-toggle[data-paused="true"] .play-motion-resume { display: block; }

/* All layers share the illustration's coordinates, including its responsive crop. */
.play-scene .play-piece { position: absolute; display: block; height: auto; object-fit: contain; animation-play-state: paused; }
.play-scene .play-piece--atom {
    left: 11%; top: 24%; width: 11.5%;
    animation: learning-atom 8s ease-in-out infinite;
    transform-origin: 50% 55%;
}
.play-piece--bulb {
    left: 77.4%; top: 29%; width: 13.4%;
    animation: learning-bulb 10s ease-in-out infinite;
    transform-origin: 50% 94%;
}
.play-piece--bulb::before {
    content: ''; position: absolute; inset: 18% 13% 10%; border-radius: 50%;
    background: radial-gradient(ellipse, color-mix(in srgb, var(--v2-play-glow) 38%, transparent), transparent 70%);
    transform: scale(1.5); opacity: 0;
    animation: learning-glow 10s ease-in-out infinite;
    animation-play-state: paused;
}
.play-piece--bulb img { position: relative; }
.play-scene .play-piece--page {
    left: 49%; top: 72%; width: 43%;
    transform-origin: 0% 86%;
    animation: learning-page 12s ease-in-out infinite;
    filter: drop-shadow(0 3px 3px color-mix(in srgb, var(--v2-play-page-shadow) 16%, transparent));
}
.play-scene .play-piece { animation-play-state: paused; }
body[data-motion-ready="true"]:not([data-motion-paused="true"]) .play-piece,
body[data-motion-ready="true"]:not([data-motion-paused="true"]) .play-piece--bulb::before { animation-play-state: running; }
@keyframes learning-atom {
    0%, 100% { transform: translateY(0) rotate(-10deg); }
    50% { transform: translateY(clamp(-18px, -1.5vw, -5px)) rotate(14deg) scale(1.04); }
}
@keyframes learning-bulb {
    0%, 28%, 60%, 100% { transform: rotate(0); }
    36% { transform: rotate(-8deg); }
    46% { transform: rotate(7deg); }
    53% { transform: rotate(-3deg); }
}
@keyframes learning-glow { 0%, 25%, 65%, 100% { opacity: 0; } 40%, 50% { opacity: 1; } }
@keyframes learning-page {
    0%, 18%, 72%, 100% { transform: rotateX(0) rotateY(0) rotateZ(0); }
    38%, 46% { transform: rotateX(24deg) rotateY(-18deg) rotateZ(-4deg) translateY(-8px); }
}

@media (prefers-color-scheme: dark) {
    .header-logo .play-logo-light { display: none; }
    .header-logo .play-logo-dark { display: block; }
    .play-scene .play-piece--page { filter: brightness(0.83) saturate(0.6); }
}
@media (max-width: 900px) {
    main { padding: 32px 20px 200px; align-items: start; }
    .play-entry { padding: 30px 24px 26px; border-radius: 20px; }
    .play-entry-intro { margin-bottom: 24px; }
    .play-scene { bottom: 54px; }
    .play-artwork { width: 100%; }
    .play-scene img { object-fit: contain; object-position: center bottom; }
    .play-footer { padding: 10px 16px; }
}
@media (max-height: 620px) {
    main { padding-top: 24px; padding-bottom: 40px; }
    .play-entry { padding-top: 24px; padding-bottom: 24px; }
}
@media (prefers-reduced-motion: reduce) {
    .play-piece, .play-piece--bulb::before { animation: none !important; }
    .play-motion-toggle { display: none; }
    .play-submit::part(base) { transition: none; transform: none; }
}
