/* Optional arcade inside the existing portal shell. */
.arcade-wrap { max-width: 1120px; padding-bottom: 40px; }
.arcade-heading { text-align: center; margin: 18px auto 28px; max-width: 700px; }
.arcade-eyebrow { color: var(--primary-color); font-weight: 800; font-size: .85rem; display: inline-flex; align-items: center; gap: 8px; }
.arcade-heading h1 { font-size: clamp(1.75rem, 4vw, 2.8rem); color: var(--secondary-color); margin: 12px 0; font-weight: 800; }
.arcade-heading p { color: var(--text-muted); line-height: 1.9; }
:is(#waitingPage, #activitiesPage) [hidden] { display: none !important; }
.arcade-review { padding: 20px 24px; display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; background: #fff; border: 1px solid #cfe0d8; border-radius: 12px; margin-bottom: 24px; }
.arcade-review-info { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 220px; }
.arcade-review strong { color: var(--secondary-color); }
.arcade-review p { font-size: .85rem; line-height: 1.8; margin: 5px 0 0; color: var(--text-muted); }
.review-indicator { width: 16px; height: 16px; border-radius: 50%; background: #e7b557; flex-shrink: 0; box-shadow: 0 0 0 6px #e7b55720; animation: review-pulse 1.4s ease-in-out infinite; }
.review-indicator.is-ready { background: #0b4d30; box-shadow: 0 0 0 6px #0b4d3018; animation: none; }
.review-indicator.is-error { background: #b42318; animation: none; }
.arcade-chooser { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 20px; }
.arcade-game-card { text-align: right; padding: 0; border: 1px solid #d9e5df; background: #fff; overflow: hidden; font: inherit; cursor: pointer; display: flex; flex-direction: column; color: var(--secondary-color); box-shadow: 0 5px 18px #13384f08; transition: transform .2s, box-shadow .2s; }
.arcade-game-card:hover { transform: translateY(-4px); box-shadow: 0 12px 26px #13384f12; }
.arcade-game-card:focus-visible, .stamp-cell:focus-visible, .memory-card:focus-visible { outline: 3px solid #00a86b; outline-offset: 3px; }
.arcade-art { height: 148px; display: flex; align-items: center; justify-content: center; gap: 12px; background: #0d3024; color: #d8f3dc; position: relative; }
.stamp-art { background: radial-gradient(ellipse at 30% 10%,#296846,#0d3024); }
.stamp-art > i { font-size: 4rem; transform: rotate(-12deg); }
.art-label { border: 2px solid #9ae6b4; padding: 3px 20px; font-weight: 800; font-size: 1.4rem; transform: rotate(10deg); }
.memory-art { background: linear-gradient(125deg,#12364b,#275c6a); }
.memory-art i { border: 1px solid #ffffff35; background: #ffffff14; width: 56px; height: 68px; display: grid; place-items: center; border-radius: 6px; font-size: 1.5rem; transform: rotate(-8deg); }
.memory-art i:nth-child(2) { transform: translateY(-9px) rotate(6deg); }
.timing-art { background: linear-gradient(125deg,#483b20,#71603c); }
.art-meter { width: 75%; height: 25px; border: 1px solid #ffffff45; background: #ffffff12; border-radius: 6px; position: relative; }
.art-meter span { position: absolute; height: 100%; width: 30%; left: 45%; background: #8ee5ad; }
.art-meter i { position: absolute; height: 45px; width: 6px; background: #fff; left: 57%; top: -11px; box-shadow: 0 0 12px #ffffff70; border-radius: 3px; }
.arcade-card-kind { font-size: .72rem; color: var(--text-muted); margin: 20px 20px 6px; }
.arcade-game-card > strong { font-size: 1.2rem; margin: 0 20px 10px; font-weight: 800; }
.arcade-card-copy { margin: 0 20px 22px; font-size: .85rem; line-height: 1.9; color: var(--text-muted); flex: 1; }
.arcade-card-bottom { padding: 15px 20px; border-top: 1px solid #e8efeb; display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--primary-color); font-weight: 800; font-size: .8rem; }
.arcade-best { font-size: .7rem; color: var(--text-muted); font-weight: 600; }
.arcade-player { background: #fff; border: 1px solid #d9e5df; border-radius: 12px; padding: 24px; scroll-margin-top: 90px; max-width: 800px; margin: auto; }
.arcade-player-top { display: flex; gap: 14px; justify-content: space-between; align-items: center; }
.arcade-player-top h2 { font-size: 1.45rem; color: var(--secondary-color); margin: 6px 0; }
.arcade-player-top .btn { padding: 10px 14px; font-size: .85rem; }
.arcade-hud { display: grid; grid-template-columns: repeat(3,1fr); background: #f3f7f5; margin: 22px 0 14px; border-radius: 8px; padding: 12px; }
.arcade-hud > div { text-align: center; display: flex; flex-direction: column; gap: 4px; }
.arcade-hud > div + div { border-right: 1px solid #dbe7df; }
.arcade-hud span { color: var(--text-muted); font-size: .75rem; }
.arcade-hud strong { color: var(--primary-color); font-size: 1.7rem; font-variant-numeric: tabular-nums; }
.game-instruction { color: var(--text-muted); font-size: .85rem; line-height: 1.8; margin-bottom: 18px; }
.game-board { user-select: none; -webkit-user-select: none; }
.stamp-board { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }
.stamp-cell { min-height: 92px; border: 1px solid #dbe4e0; background: #f4f7f5; color: #587167; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 8px; font: 700 .9rem 'Cairo',sans-serif; cursor: pointer; touch-action: manipulation; }
.stamp-cell i { font-size: 1.3rem; }
.stamp-accepted { border-color: #0b4d30; color: #0b4d30; background: #ddf4e5; }
.stamp-hit { background: #0b4d30; color: #fff; animation: score-pop .2s ease; }
.stamp-wrong { color: #b42318; background: #fff0ef; }
.stamp-cell:disabled { opacity: .85; }
.memory-board { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; }
.memory-card { min-height: 88px; position: relative; display: grid; place-items: center; background: #13384f; color: #fff; border: 1px solid #13384f; font-size: 1.7rem; cursor: pointer; touch-action: manipulation; transition: background .18s; }
.memory-card > i { opacity: 0; }
.memory-cover { position: absolute; font-weight: 800; }
.memory-card.revealed { background: #e8f2ed; color: #13384f; }
.memory-card.revealed > i { opacity: 1; }
.memory-card.revealed .memory-cover { display: none; }
.memory-card.matched { background: #0b4d30; color: #fff; opacity: 1; }
.timing-scene { background: #0d3024; color: #d8f3dc; padding: 34px 24px; border-radius: 8px; text-align: center; }
.timing-label { font-size: .85rem; font-weight: 700; }
.timing-track { height: 46px; margin: 30px 0 12px; background: #ffffff14; border: 1px solid #ffffff25; position: relative; direction: ltr; }
.timing-target { position: absolute; height: 100%; background: #74c69d; }
.timing-cursor { position: absolute; top: -8px; height: 60px; width: 6px; border-radius: 3px; background: #fff; transform: translateX(-50%); box-shadow: 0 0 15px #ffffff60; }
.timing-cursor.timing-success { background: #f7d974; }.timing-cursor.timing-miss { background: #ff8a80; }
.timing-scale { display: flex; justify-content: space-between; font-size: .7rem; opacity: .7; direction: ltr; }
.timing-stop { margin-top: 28px; min-height: 58px; width: 100%; background: #d8f3dc; color: #0b4d30; font-size: 1.15rem; touch-action: manipulation; }
.timing-stop:hover { background: #b7e4c7; }
.timing-level { font-size: .8rem; margin-top: 16px; }
.game-feedback { margin: 16px 0 0; min-height: 28px; text-align: center; font-size: .85rem; font-weight: 700; color: var(--primary-color); }
.game-feedback.is-miss { color: #b42318; }
.arcade-footnote { text-align: center; color: var(--text-muted); font-size: .8rem; line-height: 1.8; margin: 24px auto 0; }
.round-summary { text-align: center; padding: 30px 10px; }.round-summary > i { color: #aa7b25; font-size: 3rem; }.round-summary h3 { margin: 18px 0 10px; color: var(--secondary-color); }.round-summary p { margin-bottom: 20px; }
.score-pop { animation: score-pop .18s ease; }.arcade-hud .time-low { color: #b42318; }
@keyframes score-pop { 50% { transform: scale(1.15); } } @keyframes review-pulse { 50% { opacity: .5; } }
@media (max-width: 760px) {
    .arcade-chooser { grid-template-columns: 1fr; gap: 14px; }
    .arcade-art { height: 110px; }
    .arcade-review { padding: 16px; }
    .arcade-review > button { width: 100%; }
    .arcade-player { padding: 16px; }
    .arcade-player-top h2 { font-size: 1.15rem; }
    .arcade-player-top .btn { padding: 9px 10px; font-size: .75rem; }
    .stamp-cell { min-height: 82px; font-size: .8rem; }
    .memory-card { min-height: 74px; }
    .timing-scene { padding: 24px 16px; }
}
@media (prefers-reduced-motion: reduce) {
    .review-indicator, .score-pop, .stamp-hit { animation: none; }
    .arcade-game-card, .memory-card { transition: none; }
    .arcade-game-card:hover { transform: none; }
}

/* Application controls stay available throughout the arcade. */
body:has(#waitingPage.active) #floatingCartBar { display: none; }
#waitingPage button { touch-action: manipulation; }
#waitingPage, #confirmationPage { scroll-margin-top: 110px; }
.arcade-result-shortcut { display: flex; justify-content: center; width: 100%; margin-top: 20px; }

/* Standalone activities use the portal's common header and footer. */
.activities-page { max-width: 1120px; margin: 32px auto; padding: 0 18px 40px; }
#activitiesPage button { touch-action: manipulation; }
.nav-menu a[aria-current="page"] { color: var(--primary-color); border-bottom-color: var(--primary-color); }
.drawer-links a[aria-current="page"] { background: #edf7f1; color: var(--primary-color); }

.activities-group + .activities-group { margin-top: 34px; }
.activities-group-heading { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 10px; margin-bottom: 18px; }
.activities-group-heading h2 { color: var(--secondary-color); font-size: 1.45rem; margin: 4px 0 0; }
.activities-group-heading p { color: var(--text-muted); font-size: .85rem; line-height: 1.8; }
.reaction-art { background: linear-gradient(135deg,#164b3c,#306947); }
.arithmetic-art { background: linear-gradient(135deg,#263b64,#4b6084); gap: 24px; }
.sequence-art { background: linear-gradient(135deg,#69433d,#986850); gap: 14px; }
.art-equation { font-size: 1.4rem; font-weight: 800; }
.sequence-art > span { width: 46px; height: 46px; display: grid; place-items: center; border: 1px solid #ffffff55; border-radius: 6px; background: #ffffff18; font-size: 1.5rem; font-weight: 800; }
.challenge-progress { color: var(--text-muted); text-align: center; font-size: .85rem; margin: 0 0 16px; }
.reaction-button { width: 100%; min-height: 215px; padding: 25px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 18px; background: #8c3434; color: white; border: 0; font: inherit; cursor: pointer; touch-action: manipulation; }
.reaction-button > i { font-size: 2.4rem; }
.reaction-button > strong { font-size: clamp(1.3rem,4vw,1.8rem); }
.reaction-button.is-ready { background: #14723e; }
.reaction-button.is-result { background: #183e61; }
.reaction-button.is-early { background: #725437; }
.reaction-button:disabled { cursor: default; }
.arithmetic-expression { padding: 24px 10px; background: #edf3f8; color: #183e61; text-align: center; border-radius: 6px; font-size: clamp(1.8rem,6vw,3rem); font-weight: 800; margin-bottom: 16px; }
.arithmetic-choices { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.arithmetic-answer, .sequence-number { min-height: 64px; border: 1px solid #d0e0d8; background: #f2f7f4; color: #0b4d30; font: 800 1.4rem 'Cairo',sans-serif; cursor: pointer; touch-action: manipulation; }
.arithmetic-answer.is-correct, .sequence-number.is-correct { background: #0b4d30; color: white; border-color: #0b4d30; }
.arithmetic-answer.is-wrong, .sequence-number.is-wrong { background: #ffe8e4; color: #a82525; border-color: #e49b90; }
.sequence-next { text-align: center; color: var(--primary-color); font-size: 1.3rem; font-weight: 800; margin-bottom: 18px; }
.sequence-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; }
.sequence-grid.has-four-columns { grid-template-columns: repeat(4,minmax(0,1fr)); }
.sequence-number:disabled { cursor: default; }
@media (max-width: 760px) {
    .activities-group-heading h2 { font-size: 1.25rem; }
    .reaction-button { min-height: 180px; }
    .sequence-grid { gap: 7px; }
    .sequence-number { min-height: 56px; }
}

.reaction-art > i { font-size: 3.6rem; transform: rotate(-8deg); }
.arithmetic-art > i { font-size: 2.4rem; }
