/* CTRL ALT AI: Arcade, the shared frame for the minigame demos.
   Uses the core tokens when present (--font-display, --font-body, --radius), with fallbacks.
   The arcade keeps its own theme palettes (set by arcade.js as --a-* variables). */
.arcade {
	--a-bg: #4B1FA8; --a-bg2: #6A3BD6; --a-fg: #fff; --a-accent: #FFC22E; --a-accent-ink: #1C1433;
	--a-c1: #FF3D7F; --a-c2: #4B1FA8; --a-c3: #FFC22E; --a-c4: #16B989;
	--a-c1-ink: #fff; --a-c2-ink: #fff; --a-c3-ink: #1C1433; --a-c4-ink: #fff;
	--a-font-display: var(--font-display, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
	--a-font-body: var(--font-body, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
	--a-radius: max(var(--radius, 20px), 18px);
	--a-ink: #1C1433;
	position: relative; isolation: isolate;
	border-radius: var(--a-radius); background: var(--a-bg); color: var(--a-fg);
	font-family: var(--a-font-body); line-height: 1.5;
	box-shadow: 0 30px 60px -30px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.12);
	overflow: hidden; text-align: start;
}
.arcade *, .arcade *::before, .arcade *::after { box-sizing: border-box; }
/* Shield the game from site-wide heading and paragraph styles */
.arcade h2 { margin: 0; font-family: var(--a-font-display); font-weight: 800; line-height: 1.15; letter-spacing: normal; text-transform: none; background: none; -webkit-text-fill-color: currentColor; }
.arcade p { letter-spacing: normal; }
.arcade [hidden] { display: none !important; }
.arcade-noscript { margin: 0; padding: 60px 20px; text-align: center; }

/* Arcade buttons (own class so the site .btn styles never leak in) */
.arcade .a-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 6px; max-width: 100%;
	min-height: 48px; padding: 8px 22px; border: 2px solid var(--a-ink); border-radius: 999px;
	background: #fff; color: var(--a-ink); font: 700 1rem/1.2 var(--a-font-body); text-align: center; text-decoration: none;
	cursor: pointer; transition: transform .12s, box-shadow .15s, background-color .15s; -webkit-tap-highlight-color: transparent; overflow-wrap: anywhere;
}
.arcade .a-btn:hover { transform: translateY(-1px); }
.arcade .a-btn:active { transform: translateY(1px); }
.arcade .a-btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.arcade .a-btn:focus-visible, .arcade button:focus-visible, .arcade summary:focus-visible { outline: 3px solid var(--a-accent); outline-offset: 3px; }
.arcade-reward .a-btn:focus-visible, .arcade-editor .a-btn:focus-visible, .arcade-reward button:focus-visible, .arcade-editor button:focus-visible, .arcade-reward summary:focus-visible, .arcade-editor summary:focus-visible { outline-color: #4B1FA8; }

/* Toolbar */
.arcade-bar { position: relative; z-index: 3; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px 14px; background: rgba(0,0,0,.18); border-bottom: 1px solid rgba(255,255,255,.12); }
.arcade[data-theme="blush"] .arcade-bar { background: rgba(255,255,255,.55); border-bottom-color: rgba(59,21,48,.12); }
.arcade-themes { display: flex; flex-wrap: wrap; gap: 6px; }
.arcade-sw { width: 30px; height: 30px; padding: 0; border: 3px solid var(--ring); border-radius: 50%; cursor: pointer; box-shadow: 0 0 0 2px rgba(255,255,255,.55); transition: transform .12s, box-shadow .12s; }
.arcade-sw:hover { transform: scale(1.1); }
.arcade-sw.on { box-shadow: 0 0 0 3px var(--a-accent), 0 0 0 5px rgba(0,0,0,.35); transform: scale(1.08); }
.arcade-theme-name { min-width: 0; font-weight: 700; font-size: .9rem; opacity: .9; overflow-wrap: anywhere; }
.arcade-tools { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.arcade-tool { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 4px 12px; border: 1.5px solid rgba(255,255,255,.35); border-radius: 999px; background: rgba(255,255,255,.1); color: inherit; font: 700 .86rem/1.2 var(--a-font-body); cursor: pointer; }
.arcade-tool:hover { background: rgba(255,255,255,.22); }
.arcade[data-theme="blush"] .arcade-tool { border-color: rgba(59,21,48,.25); background: rgba(255,255,255,.6); }
.arcade-tool-ic { font-size: 1rem; line-height: 1; }
.arcade-tool.is-off .arcade-tool-ic { opacity: .45; text-decoration: line-through; }
@media (max-width: 720px) {
	.arcade-tool-text, .arcade-theme-name { display: none; }
	.arcade-tool { width: 40px; height: 40px; padding: 0; justify-content: center; }
	.arcade-sw { width: 28px; height: 28px; }
	.arcade-bar { padding: 10px; gap: 8px 10px; }
}
@media (max-width: 400px) {
	.arcade-tools { margin-left: 0; }
	.arcade-sw { width: 26px; height: 26px; }
	.arcade-tool { width: 38px; height: 38px; }
}

.arcade-custom { position: relative; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 10px; margin: 0; padding: 7px 12px; background: var(--a-accent); color: var(--a-accent-ink); font-weight: 700; font-size: .86rem; text-align: center; }
.arcade-custom button { min-height: 30px; padding: 3px 12px; border: 1.5px solid currentColor; border-radius: 999px; background: transparent; color: inherit; font: 700 .8rem/1.2 var(--a-font-body); cursor: pointer; }
.arcade-warn { position: relative; z-index: 2; margin: 0; padding: 7px 12px; background: #FFE3EC; color: #A3123F; font-weight: 600; font-size: .86rem; text-align: center; }

/* Stage + demo ribbon */
.arcade-play { position: relative; }
.arcade-stage {
	position: relative; z-index: 1; min-height: 560px; padding: 28px 20px 32px;
	background: radial-gradient(circle at 50% 30%, var(--a-bg2), var(--a-bg) 66%);
	display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.arcade-stage::before { content: ""; position: absolute; inset: 0; z-index: -1; opacity: .18; pointer-events: none;
	background-image: radial-gradient(circle at 12% 18%, var(--a-c1) 0 6px, transparent 7px), radial-gradient(circle at 88% 24%, var(--a-c3) 0 5px, transparent 6px), radial-gradient(circle at 80% 86%, var(--a-c4) 0 7px, transparent 8px), radial-gradient(circle at 16% 80%, var(--a-accent) 0 5px, transparent 6px); }
.arcade-ribbon { position: absolute; top: 14px; right: -38px; z-index: 2; width: 150px; padding: 4px 0; transform: rotate(45deg); background: #FFF6DA; color: #5A4300; border-block: 1px solid #F0D47A; font: 800 .72rem/1.3 var(--a-font-body); text-align: center; text-transform: uppercase; letter-spacing: .08em; pointer-events: none; box-shadow: 0 2px 6px rgba(0,0,0,.2); }
.arcade-error { margin: 0; padding: 40px 16px; font-weight: 600; text-align: center; }
.arcade-demo { margin: 0; padding: 8px 14px; background: #FFF6DA; color: #5A4300; border-top: 1px solid #F0D47A; font-size: .82rem; font-weight: 600; line-height: 1.45; text-align: center; }
@media (max-width: 640px) {
	.arcade-stage { min-height: 500px; padding: 22px 12px 24px; }
	.arcade-ribbon { top: 10px; right: -44px; font-size: .66rem; }
}

/* Reward + share dialog */
.arcade-reward { position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; padding: 16px; background: rgba(12,6,30,.6); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.arcade-reward-card { width: min(100%, 440px); max-height: 100%; overflow: auto; padding: 26px 22px 20px; border-radius: 24px; background: #fff; color: var(--a-ink); text-align: center; box-shadow: 8px 8px 0 var(--a-accent); animation: ar-pop .38s cubic-bezier(.2,1.4,.4,1); }
@keyframes ar-pop { from { transform: scale(.82); opacity: 0; } to { transform: none; opacity: 1; } }
.ar-kicker { margin: 0; color: #5E5675; font-weight: 700; font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; }
.ar-title { margin: 6px 0; font-family: var(--a-font-display); font-weight: 800; font-size: clamp(1.6rem, 6vw, 2.4rem); line-height: 1.15; color: #C21A52; overflow-wrap: anywhere; }
.is-lose .ar-title { color: #463D5E; }
.ar-sub { margin: 0 0 12px; color: #463D5E; overflow-wrap: anywhere; }
.ar-note { margin: 0 0 12px; font-size: .86rem; color: #5E5675; }
.ar-demo { margin: 0 0 12px; padding: 6px 10px; border-radius: 10px; background: #F4F0FF; color: #3B2C66; font-size: .8rem; font-weight: 600; }
.ar-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 10px; }
.arcade .ar-btn1 { background: var(--a-accent); border-color: var(--a-ink); color: var(--a-accent-ink); box-shadow: 0 4px 0 var(--a-ink); }
.arcade .ar-btn2 { border-color: #DDD4F3; background: #fff; color: var(--a-ink); }
.arcade[data-theme="noir"] .ar-btn1 { box-shadow: 0 5px 0 #000, 0 0 0 2px rgba(246,235,208,.4); }

.ar-next { margin: 16px -4px 0; padding: 14px 8px 2px; border-top: 2px dashed #DDD4F3; }
.ar-next-h { margin: 0 0 8px; font-weight: 800; font-size: .95rem; color: var(--a-ink); }
.ar-next-main { display: inline-flex; align-items: center; justify-content: center; max-width: 100%; min-height: 40px; padding: 6px 16px; border: 0; border-radius: 999px; background: #4B1FA8; color: #fff; font: 700 .9rem/1.3 var(--a-font-body); cursor: pointer; }
.ar-next-main:hover { background: #2E0F78; }
.ar-legal { margin: 10px 0 0; text-align: start; }
.ar-legal summary { display: block; padding: 8px 10px; border-radius: 10px; background: #F7F5FC; color: #4B1FA8; font-weight: 700; font-size: .88rem; cursor: pointer; list-style: none; }
.ar-legal summary::-webkit-details-marker { display: none; }
.ar-legal summary::after { content: " +"; }
.ar-legal[open] summary::after { content: " −"; }
.ar-legal p { margin: 8px 2px 0; font-size: .84rem; line-height: 1.55; color: #463D5E; }

.ar-share { position: relative; width: min(100%, 400px); padding: 22px 20px 18px; }
.ar-share-title { margin: 0 40px 4px; font-family: var(--a-font-display); font-weight: 800; font-size: 1.45rem; line-height: 1.2; color: var(--a-ink); }
.ar-x { position: absolute; top: 8px; right: 10px; width: 40px; height: 40px; border: 0; border-radius: 50%; background: #F1ECFF; color: #4B1FA8; font-size: 1.4rem; line-height: 1; cursor: pointer; }
.ar-qr { width: min(240px, 70%); margin: 6px auto 8px; padding: 6px; border-radius: 14px; border: 2px solid var(--a-ink); background: #fff; }
.ar-qr svg { display: block; width: 100%; height: auto; }
.ar-link { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 6px; }
.ar-link input { flex: 1 1 180px; min-width: 0; padding: 9px 10px; border: 1.5px solid #DDD4F3; border-radius: 10px; font: .82rem ui-monospace, Menlo, Consolas, monospace; color: #463D5E; background: #FBFAFF; }
.ar-link button { flex: 1 0 auto; min-height: 40px; padding: 4px 14px; border: 0; border-radius: 10px; background: #F1ECFF; color: #4B1FA8; font: 700 .85rem/1.2 var(--a-font-body); cursor: pointer; }
.arcade.is-full .ar-share { max-height: 92vh; }

/* Customize panel */
.arcade-editor { position: absolute; top: 0; right: 0; bottom: 0; z-index: 7; display: flex; flex-direction: column; width: min(100%, 460px); overflow: auto; padding: 18px 18px 0; background: #fff; color: var(--a-ink); box-shadow: -18px 0 40px -20px rgba(0,0,0,.5); animation: ae-in .22s ease-out; overscroll-behavior: contain; }
@keyframes ae-in { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.ae-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ae-title { margin: 0; font-family: var(--a-font-display); font-weight: 800; font-size: 1.4rem; line-height: 1.2; }
.ae-close { flex: none; width: 40px; height: 40px; border: 0; border-radius: 50%; background: #F1ECFF; color: var(--a-ink); font-size: 1.4rem; line-height: 1; cursor: pointer; }
.ae-hint { margin: 4px 0 14px; color: #5E5675; font-size: .88rem; line-height: 1.5; }
.ae-form { display: grid; gap: 14px; }
.ae-field { display: grid; gap: 4px; }
.ae-label { margin: 0; padding: 0; font-weight: 700; font-size: .92rem; }
.ae-form input:not([type=checkbox]), .ae-form select, .ae-bulk textarea { width: 100%; min-width: 0; min-height: 42px; padding: 8px 10px; border: 2px solid #DDD4F3; border-radius: 10px; font: .95rem/1.4 var(--a-font-body); color: var(--a-ink); background: #fff; }
.ae-form input:focus, .ae-form select:focus, .ae-bulk textarea:focus { outline: none; border-color: #4B1FA8; box-shadow: 0 0 0 3px rgba(75,31,168,.2); }
.ae-list { min-width: 0; margin: 0; padding: 0; border: 0; }
.ae-rows { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.ae-row { position: relative; display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 44px 10px 10px; border: 2px solid #EEE9FA; border-radius: 12px; }
.ae-cell { display: grid; gap: 2px; flex: 1 1 110px; min-width: 0; }
.ae-cell.ae-wide { flex-basis: 100%; }
.ae-cell.ae-number { flex: 0 1 84px; }
.ae-cell.ae-checkbox { flex: 0 0 auto; align-content: end; justify-items: center; }
.ae-cell.ae-checkbox input { width: 22px; height: 22px; margin: 9px 0; accent-color: #4B1FA8; }
.ae-cap { font-size: .76rem; font-weight: 600; line-height: 1.3; color: #5E5675; overflow-wrap: anywhere; }
.ae-del { position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; border: 0; border-radius: 50%; background: #FFE3EC; color: #A3123F; font-size: 1.1rem; line-height: 1; cursor: pointer; }
.ae-del:disabled { opacity: .35; cursor: not-allowed; }
.ae-add { justify-self: start; max-width: 100%; margin-top: 8px; padding: 7px 14px; border: 2px dashed #4B1FA8; border-radius: 999px; background: #fff; color: #4B1FA8; font: 700 .86rem/1.3 var(--a-font-body); cursor: pointer; }
.ae-err { margin: 12px 0 0; padding: 10px 12px; border-radius: 10px; background: #FFE3EC; color: #A3123F; font-weight: 600; font-size: .9rem; }
.ae-presets { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 12px; }
.ae-presets-h { font-weight: 800; font-size: .86rem; }
.ae-preset { min-height: 36px; padding: 5px 12px; border: 2px solid var(--a-ink); border-radius: 999px; background: #fff; color: var(--a-ink); font: 700 .84rem/1.25 var(--a-font-body); cursor: pointer; }
.ae-preset:hover { background: #FFF1C2; }
.ae-bulk { margin: 0 0 12px; padding: 10px 12px; border: 2px dashed #DDD4F3; border-radius: 14px; }
.ae-bulk summary { cursor: pointer; font-weight: 800; font-size: .92rem; }
.ae-bulk-hint { margin: 8px 0; color: #5E5675; font-size: .84rem; line-height: 1.5; }
.ae-bulk .a-btn { margin-top: 8px; }
.ae-actions { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; gap: 8px; margin: auto -18px 0; padding: 14px 18px; background: #fff; border-top: 1px solid #EEE9FA; }
.ae-form + .ae-err { margin-bottom: 4px; }
.ae-actions .a-btn { flex: 1 1 auto; min-height: 46px; padding: 8px 14px; }

/* Full screen (native, or the CSS fallback on browsers without the Fullscreen API) */
.arcade.is-full { position: fixed; inset: 0; z-index: 2000; border-radius: 0; display: flex; flex-direction: column; overflow: auto; }
.arcade.is-full .arcade-play { flex: 1; display: flex; flex-direction: column; }
.arcade.is-full .arcade-stage { flex: 1; }
body.arcade-lock { overflow: hidden; }
.arcade-confetti { position: absolute; inset: 0; z-index: 8; width: 100%; height: 100%; pointer-events: none; }

/* CJK: no letter-spacing or forced capitals */
.arcade:is(:lang(zh), :lang(ja), :lang(ko)) :is(.ar-kicker, .arcade-ribbon) { letter-spacing: 0; text-transform: none; }
.arcade:is(:lang(zh), :lang(ja), :lang(ko)) { line-height: 1.6; }

@media (prefers-reduced-motion: reduce) {
	.arcade-reward-card, .arcade-editor { animation: none; }
	.arcade-sw, .arcade .a-btn { transition: none; }
}

/* Game card art (cai_game_art), shared with the games list */
.cai-art { display: block; width: 100%; height: auto; }
