#magicCupsPage {
    --magic-teal: #00aaa6;
    --magic-teal-dark: #007f7c;
    --magic-pale: #cceeed;
    --magic-ink: #203548;
    --magic-muted: #647886;
    --magic-line: #c8dde1;
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 0;
    box-sizing: border-box;
    padding: clamp(10px, 1.25vw, 18px);
    overflow: hidden;
    border-radius: var(--ct-radius-panel);
    background: rgba(0, 116, 119, 0.55);
    box-shadow: 0 12px 30px rgba(0, 61, 69, 0.18);
    color: var(--magic-ink);
    font-family: "Albert Sans", Arial, Helvetica, sans-serif;
}

#allaround.magiccups-modern-mode .centre-column { height: 95%; }
#allaround.magiccups-modern-mode .centre-column > .page_title {
    display: flex !important;
    box-sizing: border-box;
    height: 10%;
    padding-inline-start: 0;
}
#allaround.magiccups-modern-mode .shared_body { height: 90%; padding-bottom: 0; }
#magicCupsPage *, #magicCupsPage *::before, #magicCupsPage *::after { box-sizing: border-box; }
#magicCupsPage button { font: inherit; }

.magic-main { display: flex; width: 100%; height: 100%; min-height: 0; flex-direction: column; gap: 1.2vh; }
.magic-summary { display: flex; align-items: center; gap: 24px; padding: clamp(10px,1.5vh,15px) 20px; border: 1px solid rgba(0,128,125,.16); border-radius: var(--ct-radius-card); background: linear-gradient(145deg,var(--ct-surface) 0%,var(--ct-surface-soft) 100%); box-shadow: var(--ct-shadow-card); }
.magic-summary-copy { min-width: 0; flex: 1; }
.magic-eyebrow { margin: 0 0 3px; color: var(--magic-teal-dark); font-size: clamp(.62em,1.7vh,.75em); font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.magic-summary h1 { margin: 0; font-size: clamp(1.4em,4.4vh,1.8em); line-height: 1; }
.magic-summary-copy > p:last-child { margin: .55vh 0 0; color: var(--magic-muted); font-size: clamp(.7em,2.1vh,.86em); }
.magic-progress { min-width: 220px; padding: 10px 13px; border-radius: 14px; background: #eaf8f7; }
.magic-progress > div { display: flex; justify-content: space-between; gap: 18px; color: #486472; font-size: .67em; }
.magic-progress strong { color: var(--magic-teal-dark); }
.magic-progress-track { display: block; height: 8px; margin-top: 7px; overflow: hidden; border: 1px solid #a8d6d4; border-radius: 999px; background: var(--ct-surface); }
.magic-progress-track i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg,#16a6a5,#087f83); transition: width 350ms ease; }

.magic-board { display: flex; position: relative; min-height: 0; flex: 1; flex-direction: column; align-items: center; padding: 1.2vh 1.4vw 1vh; overflow: hidden; border: 1px solid rgba(0,128,125,.16); border-radius: var(--ct-radius-card); background: linear-gradient(145deg,var(--ct-surface) 0%,var(--ct-surface-soft) 100%); box-shadow: 0 12px 28px rgba(0,64,75,.18),0 3px 7px rgba(0,64,75,.1); }
.magic-instruction-bar { display: flex; position: relative; z-index: 5; min-height: 48px; max-width: 92%; align-items: center; gap: 10px; padding: 4px 18px 4px 5px; border: 1px solid rgba(0,128,125,.16); border-radius: 999px; background: rgba(248,246,240,.96); color: #405a6a; box-shadow: 0 5px 18px rgba(25,74,86,.12); font-size: clamp(.72em,2.2vh,.92em); font-weight: 760; }
.magic-instruction-bar button { display: grid; width: var(--ct-audio-prompt-size); min-width: var(--ct-audio-prompt-size); height: var(--ct-audio-prompt-size); flex: 0 0 auto; padding: 0; place-items: center; border: 1px solid rgba(231,51,82,.28); border-radius: 50%; background: #fff3f4; cursor: pointer; }
.magic-instruction-bar button img { width: var(--ct-audio-inline-size); height: var(--ct-audio-inline-size); pointer-events: none; }
.magic-instruction-bar button:disabled { cursor: wait; opacity: .62; }
.magic-instruction-bar button:focus-visible, .magic-target-audio:focus-visible, .magic-target-preview:focus-visible { outline: 4px solid rgba(0,127,124,.32); outline-offset: 3px; }

.magic-stage { display: flex; position: relative; z-index: 1; width: 100%; min-height: 0; flex: 1 1 auto; flex-direction: column; align-items: center; overflow: hidden; backface-visibility: hidden; }
.magic-target-preview { display: block; position: relative; z-index: 4; width: clamp(195px,29vh,270px); height: clamp(195px,29vh,270px); flex: 0 0 auto; margin-top: clamp(8px,1.6vh,16px); padding: clamp(10px,1.2vw,17px); overflow: hidden; border: 1px solid rgba(0,128,125,.16); border-radius: var(--ct-radius-card); background: var(--magic-image-background,var(--ct-surface)); box-shadow: var(--ct-shadow-card); transition: width 360ms ease,height 360ms ease,margin 360ms ease,padding 360ms ease,border-width 360ms ease,opacity 220ms ease,transform 220ms ease,box-shadow 220ms ease; }
.magic-target-preview[hidden] { display: none; }
.magic-target-preview.is-leaving { opacity: 0; transform: scale(.86); }
.magic-stage.is-target-stored .magic-target-preview { width: 0; height: 0; margin: 0; padding: 0; border-width: 0; box-shadow: none; }
.magic-target-preview.is-being-named { border-color: #f2bd43; box-shadow: 0 0 0 7px rgba(246,184,63,.2),0 10px 24px rgba(31,69,80,.2); transform: translateY(-3px) scale(1.025); }
.magic-target-preview.is-ready { border-color: rgba(0,170,166,.7); cursor: pointer; animation: magic-target-ready 1.7s ease-in-out infinite; }
.magic-target-preview > #magicTargetImage { display: block; position: absolute; top: 7%; left: 8%; width: 84%; height: 70%; object-fit: contain; }
.magic-target-label { position: absolute; z-index: 2; right: 10%; bottom: 5%; left: 10%; overflow: hidden; color: var(--ct-ink-strong); font-size: clamp(16px,2.1vh,22px); font-weight: 760; line-height: 1.08; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.magic-target-label.is-wrapping-label,
.magic-hidden-label.is-wrapping-label { display: -webkit-box; overflow: hidden; text-overflow: clip; white-space: normal; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.magic-target-audio { display: grid; position: absolute; z-index: 9; top: 8px; right: 8px; width: var(--ct-audio-primary-size); height: var(--ct-audio-primary-size); padding: 4px; place-items: center; border: 0; border-radius: 50%; background: transparent; cursor: pointer; filter: drop-shadow(0 2px 4px rgba(32,53,72,.16)); transition: opacity 160ms ease,transform 180ms ease; }
.magic-target-audio img { width: calc(var(--ct-audio-primary-size) - 8px); height: calc(var(--ct-audio-primary-size) - 8px); pointer-events: none; }
.magic-target-audio:hover { transform: translateY(-2px) scale(1.04); }
.magic-target-audio:disabled { cursor: default; opacity: .48; }
.magic-practice-word-badge { position: absolute; z-index: 8; top: 7px; left: 7px; width: clamp(26px,3vw,35px); height: clamp(26px,3vw,35px); pointer-events: none; }
.magic-touch-cue { display: grid; position: absolute; z-index: 8; bottom: 8px; left: 8px; width: clamp(44px,6vh,54px); height: clamp(44px,6vh,54px); place-items: center; border: 2px solid rgba(0,127,124,.24); border-radius: 50%; background: rgba(248,246,240,.96); box-shadow: 0 4px 12px rgba(31,69,80,.16); opacity: 0; pointer-events: none; transform: scale(.75); transition: opacity 180ms ease,transform 220ms ease; }
.magic-touch-cue img { display: block; width: 72%; height: 72%; }
.magic-target-preview.is-ready .magic-touch-cue { opacity: 1; transform: scale(1); }

.magic-cup-track { position: relative; width: 980px; max-width: 96%; min-height: 0; flex: 1 1 auto; margin: clamp(4px,.8vh,9px) 0 clamp(8px,1.2vh,13px); backface-visibility: hidden; transform: translateZ(0); }
.magic-cup { position: absolute; top: 0; left: 0; width: 20%; height: auto; padding: 0; border: 0; outline: none; background: transparent; box-shadow: none; cursor: default; transform: translate3d(0,0,0); transition: none; will-change: transform; appearance: none; -webkit-appearance: none; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.magic-cup:focus, .magic-cup:active { outline: none; background: transparent; box-shadow: none; }
.magic-cup:focus-visible .magic-cup-shell { filter: drop-shadow(0 0 8px rgba(0,127,124,.65)); }
.magic-cup.is-choosable { cursor: pointer; }
.magic-cup-inner { position: absolute; inset: 0; filter: drop-shadow(0 13px 10px rgba(32,67,76,.22)); }
.magic-cup-cover { display: block; position: absolute; z-index: 3; inset: 0; transition: transform 310ms cubic-bezier(.2,.75,.25,1); }
.magic-cup-shell { display: block; position: absolute; z-index: 1; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.magic-cup-brand { display: block; position: absolute; z-index: 4; top: 29%; left: 14%; width: 72%; height: auto; pointer-events: none; }
.magic-hidden-card { display: block; position: absolute; z-index: 2; left: 14%; bottom: 2%; width: 72%; height: 76%; padding: 8%; overflow: hidden; border: 1px solid rgba(0,128,125,.16); border-radius: 18px; background: var(--magic-image-background,var(--ct-surface)); box-shadow: 0 8px 18px rgba(31,65,76,.22); opacity: 0; transform: translateY(12px) scale(.88); transition: opacity 190ms ease,transform 300ms ease; }
.magic-hidden-item { display: block; width: 100%; height: 78%; object-fit: contain; }
.magic-hidden-label { display: block; max-width: 100%; overflow: hidden; color: var(--ct-ink-strong); font-size: clamp(12px,1.55vh,16px); font-weight: 760; line-height: 1.1; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.magic-empty-mark { display: block; position: absolute; z-index: 2; left: 35%; bottom: 14%; width: 30%; height: 30%; border: 5px solid rgba(64,102,113,.27); border-radius: 50%; opacity: 0; transform: scale(.65); transition: opacity 180ms ease,transform 250ms ease; }
.magic-empty-mark::after { position: absolute; top: 50%; left: 19%; width: 62%; height: 4px; border-radius: 5px; background: rgba(64,102,113,.27); content: ""; transform: rotate(-18deg); }
.magic-cup.is-lifted .magic-cup-cover { transform: translateY(-84%); }
.magic-cup.is-revealing .magic-hidden-card, .magic-cup.is-empty .magic-empty-mark { opacity: 1; transform: translateY(0) scale(1); }
.magic-cup.is-empty .magic-cup-cover { transform: translateY(-40%); }
.magic-cup.is-settling .magic-cup-inner { animation: magic-cup-settle 360ms ease; }
.magic-cup.is-incorrect .magic-cup-inner { animation: magic-cup-neutral 430ms ease; }

.magic-status { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; border: 0; clip: rect(0 0 0 0); white-space: nowrap; }

.magic-stardust { position: absolute; z-index: 9; inset: -13px; overflow: visible; pointer-events: none; }
.magic-stardust i { position: absolute; color: #f6b83f; font-size: 24px; font-style: normal; opacity: 0; animation: magic-stardust 820ms ease-out both; }
.magic-stardust i:nth-child(1) { top: 3%; left: 8%; }
.magic-stardust i:nth-child(2) { top: 0; right: 8%; color: var(--magic-teal); animation-delay: 70ms; }
.magic-stardust i:nth-child(3) { right: -2%; bottom: 18%; animation-delay: 145ms; }
.magic-stardust i:nth-child(4) { bottom: 2%; left: 12%; color: #e73352; animation-delay: 210ms; }
.magic-stardust i:nth-child(5) { top: 42%; left: -3%; color: var(--magic-teal); animation-delay: 110ms; }

.magic-completion { display: grid; position: absolute; z-index: 80; inset: 0; padding: 20px; place-items: center; background: rgba(26,57,68,.48); opacity: 0; transition: opacity 220ms ease; }
.magic-completion[hidden] { display: none; }
.magic-completion.is-visible { opacity: 1; }
.magic-completion-card { width: 460px; max-width: 90%; padding: 28px; border: 1px solid #d6e7e8; border-radius: var(--ct-radius-panel); background: linear-gradient(145deg,var(--ct-surface) 0%,var(--ct-surface-soft) 100%); box-shadow: 0 22px 60px rgba(19,53,64,.25); text-align: center; transform: translateY(12px); transition: transform 260ms ease; }
.magic-completion.is-visible .magic-completion-card { transform: translateY(0); }
.magic-completion-symbol { display: grid; width: 62px; height: 62px; margin: 0 auto 12px; place-items: center; border-radius: 50%; background: #e8f8f5; color: var(--magic-teal-dark); font-size: 1.5em; font-weight: 900; }
.magic-completion-card > p { margin: 5px 0; color: var(--magic-muted); }
.magic-completion-card > p:first-of-type { color: var(--magic-teal-dark); font-size: .65em; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.magic-completion-card h2 { margin: 5px 0; font-size: 1.65em; }
.magic-completion-card > div { display: flex; justify-content: center; gap: 10px; margin-top: 20px; }
.magic-completion-card button { min-height: 46px; padding: 10px 18px; border-radius: 12px; cursor: pointer; font-weight: 800; }
.magic-completion-primary { border: 1px solid var(--magic-teal-dark); background: var(--magic-teal-dark); color: white; }
.magic-completion-secondary { border: 1px solid #bad1d5; background: var(--ct-surface); color: #355769; }

.magic-flying-target { display: grid; position: fixed; z-index: 999; margin: 0; overflow: hidden; place-items: center; border: 1px solid rgba(0,128,125,.16); background: var(--ct-surface); box-sizing: border-box; pointer-events: none; transform-origin: top left; backface-visibility: hidden; will-change: transform,opacity; }
.magic-flying-target > img { display: block; width: 100%; height: 100%; object-fit: contain; }

@keyframes magic-cup-settle { 0%,100% { transform: translateY(0); } 46% { transform: translateY(7px) scaleY(.97); } 72% { transform: translateY(-3px); } }
@keyframes magic-cup-neutral { 0%,100% { transform: translateX(0); } 30% { transform: translateX(-4px); } 65% { transform: translateX(4px); } }
@keyframes magic-stardust { 0% { opacity: 0; transform: scale(.2) rotate(-20deg); } 38% { opacity: 1; transform: scale(1.2) rotate(4deg); } 100% { opacity: 0; transform: translateY(-9px) scale(.55) rotate(22deg); } }
@keyframes magic-target-ready { 0%,100% { box-shadow: var(--ct-shadow-card); } 50% { box-shadow: 0 0 0 7px rgba(0,170,166,.16),0 12px 26px rgba(31,69,80,.2); } }

@media (max-width: 900px) {
    .magic-summary { gap: 12px; padding-inline: 12px; }
    .magic-progress { min-width: 180px; }
    .magic-cup-track { max-width: 100%; }
    .magic-cup { width: clamp(142px,22vh,205px); height: clamp(158px,24vh,225px); }
}
@media (max-height: 820px) {
    .magic-target-preview { width: clamp(155px,22vh,185px); height: clamp(155px,22vh,185px); margin-top: 6px; padding: 9px; }
    .magic-cup-track { margin-top: 2px; margin-bottom: 9px; }
}
@media (max-width: 620px) {
    .magic-summary-copy > p:last-child { display: none; }
    .magic-progress { min-width: 150px; }
    .magic-instruction-bar { max-width: 100%; }
    .magic-cup { width: clamp(112px,20vh,166px); height: clamp(130px,23vh,188px); }
}
@media (max-height: 690px) {
    .magic-board { padding-top: .7vh; }
    .magic-instruction-bar { min-height: 43px; }
    .magic-target-preview { width: clamp(145px,23vh,180px); height: clamp(145px,23vh,180px); margin-top: 5px; }
    .magic-cup { width: clamp(125px,22vh,175px); height: clamp(140px,24vh,195px); }
}
@media (prefers-reduced-motion: reduce) {
    .magic-target-preview, .magic-cup, .magic-cup-cover, .magic-hidden-card, .magic-hidden-item, .magic-empty-mark,
    .magic-cup-inner, .magic-stardust i, .magic-completion, .magic-completion-card { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
