/* Code Arena (v1.0.0) */
.ar-body-page { --ar-aura: #ffc94d; --ar-aura-rgb: 255, 201, 77; }
.ar-intro { padding-top: 34px; padding-bottom: 10px; }
.ar-kicker { display: inline-flex; align-items: center; gap: 8px; padding: 7px 13px; border-radius: 999px; border: 1px solid rgba(255, 201, 77, .35); background: rgba(255, 201, 77, .08); color: #ffd36b; font: 800 11px/1 Inter, system-ui, sans-serif; letter-spacing: .18em; }
.ar-intro h1 { margin: 16px 0 8px; font-size: clamp(34px, 6vw, 64px); line-height: 1.05; letter-spacing: -.02em; background: linear-gradient(100deg, #fff 20%, #ffd36b 55%, #38d9ff 90%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ar-intro p { margin: 0; max-width: 680px; color: #c7c3cc; font-size: 16px; line-height: 1.8; }
.ar-score { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.ar-score span { display: inline-flex; align-items: baseline; gap: 8px; padding: 10px 15px; border-radius: 14px; border: 1px solid rgba(255, 255, 255, .08); background: rgba(255, 255, 255, .03); color: #a9a5b3; font-size: 13px; }
.ar-score b { color: #fff; font: 800 22px/1 Inter, system-ui, sans-serif; }

.ar-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; padding-top: 18px; padding-bottom: 60px; align-items: start; }

/* ---------- stage ---------- */
.ar-stage { --ar-power: 0; position: relative; height: 660px; border-radius: 26px; overflow: hidden; border: 1px solid rgba(var(--ar-aura-rgb), .28); background: #06070c; box-shadow: 0 30px 80px rgba(0, 0, 0, .5); isolation: isolate; contain: layout paint; }
/* power glow and darkening run on opacity only (cheap, on the graphics card) */
.ar-glow { position: absolute; inset: 0; z-index: 8; pointer-events: none; border-radius: inherit; box-shadow: inset 0 0 0 1px rgb(var(--ar-aura-rgb)), inset 0 0 60px rgba(var(--ar-aura-rgb), .35); opacity: 0; will-change: opacity; }
.ar-dim { position: absolute; inset: 0; z-index: 0; background: #020205; opacity: 0; pointer-events: none; will-change: opacity; }
.ar-world { position: absolute; inset: 0; will-change: transform; }
.ar-sky { position: absolute; inset: 0; background: radial-gradient(ellipse 70% 60% at 30% 40%, rgba(var(--ar-aura-rgb), .1), transparent 70%), radial-gradient(ellipse 60% 70% at 85% 20%, rgba(56, 217, 255, .1), transparent 70%), linear-gradient(180deg, #0b0d18, #06070c 70%); }
.ar-sky::after { content: none; }
.ar-floor { position: absolute; left: -20%; right: -20%; bottom: 0; height: 34%; overflow: hidden; transform: perspective(380px) rotateX(62deg); transform-origin: bottom; mask-image: linear-gradient(transparent, #000 60%); -webkit-mask-image: linear-gradient(transparent, #000 60%); opacity: .6; }
.ar-floor::before { content: ""; position: absolute; left: 0; right: 0; top: -34px; bottom: 0; background: linear-gradient(transparent 0 96%, rgba(var(--ar-aura-rgb), .25) 96%) 0 0 / 100% 34px, linear-gradient(90deg, transparent 0 97%, rgba(var(--ar-aura-rgb), .2) 97%) 0 0 / 60px 100%; animation: arFloor 3s linear infinite; will-change: transform; }
@keyframes arFloor { to { transform: translate3d(0, 34px, 0); } }
.ar-fx-back, .ar-fx-front { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.ar-fx-back { z-index: 1; } .ar-fx-front { z-index: 4; }
.ar-hero-wrap { position: absolute; z-index: 2; inset-inline-start: 1%; bottom: 62px; width: 47%; height: calc(94% - 62px); will-change: transform; }
.ar-hero-wrap svg { width: 100%; height: 100%; overflow: visible; }
.ar-cup { stroke: rgba(var(--ar-aura-rgb), .7); stroke-width: 2; }
.ar-sweat { transition: opacity .3s; }
.ar-flash { position: absolute; inset: 0; z-index: 5; pointer-events: none; background: radial-gradient(circle at 28% 35%, rgba(255, 255, 255, .95), rgba(var(--ar-aura-rgb), .55) 40%, transparent 75%); opacity: 0; visibility: hidden; will-change: opacity; }
[dir=rtl] .ar-flash { background: radial-gradient(circle at 72% 35%, rgba(255, 255, 255, .95), rgba(var(--ar-aura-rgb), .55) 40%, transparent 75%); }

/* ---------- holo screen ---------- */
.ar-holo { position: absolute; z-index: 3; inset-inline-end: 3%; top: 5%; bottom: 80px; width: 49%; display: flex; flex-direction: column; gap: 10px; padding: 18px 18px 16px; border-radius: 18px; background: linear-gradient(160deg, rgba(20, 24, 40, .95), rgba(8, 10, 18, .97)); border: 1px solid rgba(var(--ar-aura-rgb), calc(.3 + var(--ar-power) * .5)); box-shadow: 0 0 0 1px rgba(255, 255, 255, .03) inset, 0 0 calc(10px + var(--ar-power) * 40px) rgba(var(--ar-aura-rgb), calc(.08 + var(--ar-power) * .3)); transform: perspective(1400px) rotateY(-7deg); transform-origin: right center; }
[dir=rtl] .ar-holo { transform: perspective(1400px) rotateY(7deg); transform-origin: left center; }
.ar-holo::before { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; background: repeating-linear-gradient(0deg, rgba(255, 255, 255, .025) 0 1px, transparent 1px 3px); }
.ar-stage.is-booting .ar-holo { animation: arBoot .6s steps(6) both; }
@keyframes arBoot { 0% { opacity: 0; filter: brightness(3); } 30% { opacity: .6; } 45% { opacity: .1; } 100% { opacity: 1; filter: none; } }
.ar-holo-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ar-pill { font: 700 11px/1 Inter, system-ui, sans-serif; padding: 6px 9px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .14); color: #d6d3dd; }
.ar-pill.is-urgent { color: #ff8a8a; border-color: rgba(255, 107, 105, .5); background: rgba(255, 107, 105, .08); }
.ar-pill.is-high { color: #ffc56b; border-color: rgba(243, 182, 75, .45); }
.ar-pill.is-done { color: #55e8aa; border-color: rgba(85, 232, 170, .45); background: rgba(85, 232, 170, .07); }
.ar-pill.is-active { color: #ffd36b; border-color: rgba(255, 211, 107, .45); }
.ar-pill.is-planned { color: #a9a5b3; }
.ar-phase { margin-inline-start: auto; font: 800 11px/1 Inter, system-ui, sans-serif; letter-spacing: .12em; text-transform: uppercase; color: rgb(var(--ar-aura-rgb)); text-shadow: 0 0 12px rgba(var(--ar-aura-rgb), .8); }
.ar-holo h2 { margin: 2px 0 0; font-size: 21px; line-height: 1.35; color: #fff; }
.ar-meta { margin: 0; font-size: 12px; color: rgb(var(--ar-aura-rgb)); }
.ar-meta[hidden] { display: none; }
.ar-desc { margin: 0; font-size: 13px; line-height: 1.7; color: #b9b5c4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ar-code { flex: 1; min-height: 0; display: flex; flex-direction: column; border-radius: 12px; border: 1px solid rgba(255, 255, 255, .08); background: rgba(3, 4, 9, .85); overflow: hidden; }
.ar-code-bar { display: flex; align-items: center; gap: 6px; padding: 8px 11px; border-bottom: 1px solid rgba(255, 255, 255, .06); direction: ltr; }
.ar-code-bar i { width: 9px; height: 9px; border-radius: 50%; background: #ff6b69; } .ar-code-bar i:nth-child(2) { background: #ffd36b; } .ar-code-bar i:nth-child(3) { background: #55e8aa; }
.ar-code-bar span { margin-left: 8px; font: 500 11px/1 "JetBrains Mono", ui-monospace, monospace; color: #8b879a; }
.ar-code-body { flex: 1; min-height: 0; overflow: hidden; padding: 10px 12px; text-align: left; }
.ar-code-body pre { margin: 0; font: 12.5px/1.65 "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace; color: #dcd9e6; white-space: pre-wrap; word-break: break-word; }
.ar-code-body code { font: inherit; }
.ar-code-body i { font-style: normal; }
.ar-code-body .k { color: #ff79c6; } .ar-code-body .s { color: #a6e22e; } .ar-code-body .c { color: #6c7590; font-style: italic; } .ar-code-body .n { color: #ffb86b; } .ar-code-body .y { color: #7fdcff; } .ar-code-body .f { color: #ffd36b; }
.ar-caret { display: inline-block; width: 8px; height: 15px; margin-left: 1px; vertical-align: -3px; background: rgb(var(--ar-aura-rgb)); box-shadow: 0 0 10px rgb(var(--ar-aura-rgb)); animation: arCaret .9s steps(1) infinite; }
@keyframes arCaret { 50% { opacity: 0; } }
.ar-progress { display: flex; align-items: center; gap: 10px; }
.ar-progress-track { flex: 1; height: 10px; border-radius: 999px; background: rgba(255, 255, 255, .06); overflow: hidden; }
.ar-progress-track i { display: block; height: 100%; width: 100%; transform: scaleX(0); transform-origin: left center; will-change: transform; border-radius: inherit; background: linear-gradient(90deg, rgba(var(--ar-aura-rgb), .6), rgb(var(--ar-aura-rgb)), #fff); box-shadow: 0 0 14px rgba(var(--ar-aura-rgb), .9); }
[dir=rtl] .ar-progress-track { transform: scaleX(-1); }
.ar-progress b { min-width: 46px; text-align: end; font: 800 16px/1 Inter, system-ui, sans-serif; color: #fff; }
.ar-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0; }
.ar-stats div { padding: 8px 10px; border-radius: 10px; background: rgba(255, 255, 255, .03); border: 1px solid rgba(255, 255, 255, .06); }
.ar-stats dt { font-size: 10px; color: #8b879a; letter-spacing: .06em; }
.ar-stats dd { margin: 3px 0 0; font: 800 17px/1 Inter, system-ui, sans-serif; color: #fff; }
.ar-stage[data-phase=climax] .ar-stats div:first-child dd, .ar-stage[data-phase=victory] .ar-stats div:first-child dd { color: rgb(var(--ar-aura-rgb)); text-shadow: 0 0 12px rgba(var(--ar-aura-rgb), .9); }



/* ---------- stamp & result ---------- */
.ar-stamp { position: absolute; z-index: 6; left: 50%; top: 40%; transform: translate(-50%, -50%) rotate(-7deg) scale(2.2); padding: 12px 26px; border: 4px solid currentColor; border-radius: 14px; font: 900 clamp(22px, 4vw, 44px)/1 Inter, "IBM Plex Sans Arabic", system-ui, sans-serif; letter-spacing: .04em; text-transform: uppercase; color: #fff; opacity: 0; pointer-events: none; white-space: nowrap; text-shadow: 0 0 18px currentColor; background: rgba(5, 6, 10, .55); }
.ar-stamp.is-on { animation: arStamp 1.9s cubic-bezier(.2, 1.4, .4, 1) both; }
.ar-stamp.is-brief { color: #7fdcff; }
.ar-stamp.is-win { color: rgb(var(--ar-aura-rgb)); top: 18%; }
.ar-stamp.is-win.is-on { animation: arStampWin 5s cubic-bezier(.2, 1.4, .4, 1) both; }
.ar-stamp.is-hold { color: #ffd36b; top: 18%; }
.ar-stamp.is-hold.is-on, .ar-stamp.is-next.is-on { animation: arStampWin 4.5s cubic-bezier(.2, 1.4, .4, 1) both; }
.ar-stamp.is-next { color: #a9a5b3; top: 18%; }
@keyframes arStamp { 0% { opacity: 0; transform: translate(-50%, -50%) rotate(-7deg) scale(2.2); } 14% { opacity: 1; transform: translate(-50%, -50%) rotate(-7deg) scale(1); } 75% { opacity: 1; transform: translate(-50%, -50%) rotate(-7deg) scale(1); } 100% { opacity: 0; transform: translate(-50%, -60%) rotate(-7deg) scale(.95); } }
@keyframes arStampWin { 0% { opacity: 0; transform: translate(-50%, -50%) rotate(-7deg) scale(2.6); } 10% { opacity: 1; transform: translate(-50%, -50%) rotate(-7deg) scale(1); } 88% { opacity: 1; transform: translate(-50%, -50%) rotate(-7deg) scale(1); } 100% { opacity: 0; transform: translate(-50%, -50%) rotate(-7deg) scale(1); } }
.ar-result { position: absolute; z-index: 6; inset-inline-end: 3%; bottom: 80px; width: 49%; padding: 14px 16px; border-radius: 16px; background: linear-gradient(135deg, rgba(var(--ar-aura-rgb), .22), transparent 60%), #0b0d16; border: 1px solid rgba(var(--ar-aura-rgb), .6); box-shadow: 0 0 40px rgba(var(--ar-aura-rgb), .25); opacity: 0; transform: translateY(16px); transition: opacity .5s .5s, transform .5s .5s; pointer-events: none; }
.ar-result.is-on { opacity: 1; transform: none; }
.ar-result > b { display: block; font-size: 12px; letter-spacing: .1em; color: rgb(var(--ar-aura-rgb)); margin-bottom: 8px; }
.ar-result dl { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 0; }
.ar-result dt { font-size: 10px; color: #a9a5b3; }
.ar-result dd { margin: 4px 0 0; font: 800 16px/1.1 Inter, system-ui, sans-serif; color: #fff; white-space: nowrap; }
.ar-result dd[data-ar-r-date] { font-size: 13px; }

/* ---------- controls ---------- */
.ar-controls { position: absolute; z-index: 7; left: 0; right: 0; bottom: 16px; display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; padding: 0 12px; }
.ar-btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 15px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .14); background: rgba(10, 12, 20, .78); color: #e6e3ec; font: 600 13px/1 inherit; cursor: pointer; transition: border-color .2s, color .2s, transform .2s; }
.ar-btn:hover { border-color: rgb(var(--ar-aura-rgb)); color: #fff; transform: translateY(-1px); }
.ar-btn:focus-visible { outline: 2px solid rgb(var(--ar-aura-rgb)); outline-offset: 2px; }
.ar-btn[aria-pressed=true][data-ar-sound] { color: rgb(var(--ar-aura-rgb)); border-color: rgba(var(--ar-aura-rgb), .6); }
.ar-btn--icon { width: 40px; justify-content: center; padding: 10px 0; }
.ar-btn[hidden] { display: none; }

/* ---------- battle list ---------- */
.ar-list { position: sticky; top: 90px; padding: 16px; border-radius: 22px; border: 1px solid rgba(255, 255, 255, .08); background: rgba(13, 15, 23, .75); max-height: calc(100vh - 110px); overflow: auto; }
.ar-list h2 { margin: 0 0 12px; font-size: 15px; color: #fff; }
.ar-list ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ar-pick { width: 100%; display: flex; align-items: center; gap: 11px; padding: 11px 12px; border-radius: 14px; border: 1px solid rgba(255, 255, 255, .07); background: rgba(255, 255, 255, .02); color: inherit; text-align: start; cursor: pointer; font: inherit; transition: border-color .2s, background .2s, transform .2s; }
.ar-pick:hover { border-color: rgba(var(--ar-aura-rgb), .5); transform: translateX(2px); }
[dir=rtl] .ar-pick:hover { transform: translateX(-2px); }
.ar-pick:focus-visible { outline: 2px solid rgb(var(--ar-aura-rgb)); outline-offset: 2px; }
.ar-pick.is-current { border-color: rgb(var(--ar-aura-rgb)); background: rgba(var(--ar-aura-rgb), .1); box-shadow: 0 0 22px rgba(var(--ar-aura-rgb), .2); }
.ar-pick-ico { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: rgba(255, 255, 255, .05); color: #a9a5b3; }
.ar-pick.is-done .ar-pick-ico { color: #ffd36b; background: rgba(255, 211, 107, .1); }
.ar-pick.is-active .ar-pick-ico { color: #7fdcff; background: rgba(56, 217, 255, .1); }
.ar-pick-txt { min-width: 0; display: grid; gap: 3px; }
.ar-pick-txt b { font-size: 13px; color: #fff; line-height: 1.4; }
.ar-pick-txt small { font-size: 11px; color: #8b879a; }
.ar-empty { padding: 70px 0 110px; text-align: center; color: #b9b5c4; }
.ar-empty i { font-size: 42px; color: #ffd36b; filter: drop-shadow(0 0 16px rgba(255, 211, 107, .6)); }
.ar-empty h2 { color: #fff; margin: 16px 0 6px; }

/* ---------- smaller screens ---------- */
@media (max-width: 1100px) {
    .ar-wrap { grid-template-columns: 1fr; }
    .ar-list { position: static; max-height: none; }
    .ar-list ol { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
}
@media (max-width: 860px) {
    .ar-stage { height: auto; }
    .ar-world { position: relative; display: flex; flex-direction: column; padding-bottom: 70px; }
    .ar-sky { position: absolute; }
    .ar-hero-wrap { position: relative; inset: auto; width: 100%; height: 330px; margin-top: 8px; }
    .ar-holo { position: relative; inset: auto; width: auto; height: 470px; margin: -18px 12px 0; transform: none !important; }
    .ar-result { inset-inline: 12px; width: auto; bottom: 84px; }
    .ar-result dl { grid-template-columns: repeat(2, 1fr); }
    .ar-stamp { top: 26% !important; font-size: 22px; padding: 9px 16px; border-width: 3px; }
    .ar-controls { bottom: 14px; }
    .ar-btn span { display: none; }
    .ar-btn { width: 44px; height: 44px; justify-content: center; padding: 0; }
    .ar-holo h2 { font-size: 18px; }
    .ar-code-body pre { font-size: 11.5px; }
}
@media (prefers-reduced-motion: reduce) {
    .ar-floor::before, .ar-caret { animation: none; }
    .ar-stamp.is-on, .ar-stamp.is-win.is-on, .ar-stamp.is-hold.is-on, .ar-stamp.is-next.is-on { animation: none; opacity: 1; transform: translate(-50%, -50%) rotate(-7deg); }
}
/* motion switched off in the admin: a tidy still picture */
.ar-stage.is-still .ar-floor::before, .ar-stage.is-still .ar-caret { animation: none; }
.ar-stage.is-still .ar-stamp.is-on { animation: none; opacity: 1; transform: translate(-50%, -50%) rotate(-7deg); }

.ar-steam { animation: arSteam 3.2s ease-in-out infinite; transform-box: fill-box; transform-origin: bottom; }
.ar-steam-2 { animation-delay: -1.6s; }
@keyframes arSteam { 0% { opacity: 0; transform: translateY(6px) scaleY(.7); } 40% { opacity: .3; } 100% { opacity: 0; transform: translateY(-10px) scaleY(1.15); } }
.ar-stage.is-still .ar-steam { animation: none; }
@media (prefers-reduced-motion: reduce) { .ar-steam { animation: none; } }
