/* Gamesira arcade — full-screen game frame (used by the endless games) */
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
body.arcade { background: #000; overscroll-behavior: none; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; position: fixed; inset: 0; width: 100%; }
body.arcade button, body.arcade a, body.arcade .btn { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
body.arcade input, body.arcade textarea { user-select: text; -webkit-user-select: text; font-size: 16px; }   /* >=16px stops iOS from zooming into inputs */

.ar { --accent: var(--lime); position: fixed; inset: 0; overflow: hidden; background: var(--ink); --sat: env(safe-area-inset-top, 0px); --sar: env(safe-area-inset-right, 0px); --sab: env(safe-area-inset-bottom, 0px); --sal: env(safe-area-inset-left, 0px); }
@supports (height: 100dvh) { .ar { height: 100dvh; bottom: auto; } }
.ar__cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

/* ---------- top bar ---------- */
.ar__top { position: absolute; z-index: 45; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: flex-start; padding: calc(14px + var(--sat)) calc(16px + var(--sar)) 14px calc(16px + var(--sal)); pointer-events: none; }
.ar__top > * { pointer-events: auto; }
.ar__home { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; padding: 6px 14px 6px 6px; border-radius: 14px; background: rgba(15, 12, 34, .55); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .12) inset; transition: background .15s, transform .12s; }
.ar__home:hover { background: rgba(15, 12, 34, .8); transform: translateY(-1px); }
.ar__home img { width: 34px; height: 34px; }
.ar__home b { font-family: var(--font-d); font-size: .95rem; font-weight: 400; letter-spacing: .02em; line-height: 1; }
.ar__home b i { font-style: normal; color: var(--lime); }
.ar__tools { display: flex; gap: 8px; }
.ar__tool { width: 44px; height: 44px; border: 0; padding: 0; display: grid; place-items: center; border-radius: 13px; background: rgba(15, 12, 34, .55); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .12) inset; transition: background .15s, transform .12s; }
.ar__tool:hover { background: rgba(15, 12, 34, .85); transform: translateY(-1px); }
.ar__tool svg { width: 20px; height: 20px; fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.ar__tool.is-hidden { display: none; }
@media (pointer: coarse), (max-width: 760px) {
  .ar__top { padding-top: calc(10px + var(--sat)); padding-left: calc(10px + var(--sal)); padding-right: calc(10px + var(--sar)); }
  .ar__home { min-height: 48px; }
  .ar__tool { width: 48px; height: 48px; border-radius: 14px; }
  .ar__tools { gap: 6px; }
}
body.is-touch .ar__home, body.is-touch .ar__tool:hover { transform: none; }
@media (max-height: 460px) and (pointer: coarse) { .ar__tool { width: 44px; height: 44px; } .ar__home { min-height: 44px; } .ar__home img { width: 30px; height: 30px; } }

/* ---------- HUD helpers (games fill #hud) ---------- */
.ar__hud { position: absolute; inset: 0; z-index: 10; pointer-events: none; }
.pill { display: inline-flex; flex-direction: column; justify-content: center; gap: 1px; padding: 8px 16px; border-radius: 14px; background: rgba(15, 12, 34, .6); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .1) inset; line-height: 1; }
.pill small { font-size: .62rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--mute); }
.pill b { font-family: var(--font-d); font-weight: 400; font-size: 1.55rem; letter-spacing: .02em; font-variant-numeric: tabular-nums; }

/* ---------- toast ---------- */
.ar__toast { position: absolute; z-index: 20; left: 50%; top: 22%; max-width: 94vw; transform: translateX(-50%); pointer-events: none; font-family: var(--font-d); font-size: clamp(1.6rem, 4.4vw, 3rem); letter-spacing: .02em; text-align: center; color: var(--sun); text-shadow: 0 4px 0 rgba(0, 0, 0, .45), 0 0 24px rgba(0, 0, 0, .35); opacity: 0; white-space: nowrap; }
.ar__toast.show { animation: artoast 1.1s var(--ease) forwards; }
.ar__toast.bad { color: var(--orange); }
.ar__toast.cool { color: var(--cyan); }
.ar__toast.good { color: var(--lime); }
@keyframes artoast { 0% { opacity: 0; transform: translate(-50%, 18px) scale(.8); } 15% { opacity: 1; transform: translate(-50%, 0) scale(1.08); } 28% { transform: translate(-50%, 0) scale(1); } 75% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -22px) scale(1); } }

/* ---------- overlays ---------- */
.ar__ov { position: absolute; inset: 0; z-index: 40; display: none; padding: max(24px, var(--sat)) max(24px, var(--sar)) max(24px, var(--sab)) max(24px, var(--sal)); overflow: auto; scrollbar-width: none; overscroll-behavior: contain; touch-action: pan-y; -webkit-overflow-scrolling: touch; }
.ar__ov::-webkit-scrollbar { display: none; }
.ar__ov.show { display: grid; animation: arfade .25s ease; }
.ar__ov--menu { place-items: center start; padding-left: max(clamp(24px, 6vw, 110px), var(--sal)); background: linear-gradient(90deg, rgba(15, 12, 34, .88) 0%, rgba(15, 12, 34, .55) 45%, rgba(15, 12, 34, 0) 75%); }
.ar__ov--center { place-items: center; background: rgba(15, 12, 34, .6); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
@keyframes arfade { from { opacity: 0; } }
@keyframes arpop { from { opacity: 0; transform: translateY(14px) scale(.96); } }

.menu { width: min(520px, 100%); animation: arpop .4s var(--ease); margin: auto 0; }
.menu__kicker { display: inline-flex; align-items: center; gap: .6em; font-weight: 800; font-size: .78rem; letter-spacing: .16em; text-transform: uppercase; color: var(--accent); }
.menu__kicker::before { content: ""; width: 28px; height: 3px; border-radius: 3px; background: currentColor; }
.menu h1 { font-family: var(--font-d); font-weight: 400; font-size: clamp(2.8rem, 7.5vw, 5.6rem); line-height: .92; margin: .15em 0 .2em; text-transform: uppercase; letter-spacing: .01em; text-shadow: 0 5px 0 rgba(0, 0, 0, .35); }
.menu h1 em { font-style: normal; color: var(--accent); }
.menu p.tag { margin: 0 0 22px; font-size: 1.1rem; font-weight: 600; color: #DCD7FF; max-width: 30em; }
.menu__row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-top: 4px; }
.menu__best { display: inline-flex; flex-direction: column; padding: 8px 16px; border-radius: 14px; background: rgba(255, 255, 255, .07); box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .1) inset; line-height: 1.05; }
.menu__best small { font-size: .62rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--mute); }
.menu__best b { font-family: var(--font-d); font-weight: 400; font-size: 1.4rem; }
.menu__keys { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 26px 0 0; }
.menu__key { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, .06); font-size: .85rem; font-weight: 700; color: #DCD7FF; line-height: 1.25; }
.menu__orient { display: flex; align-items: center; gap: 10px; margin: 14px 0 0; padding: 9px 14px; border-radius: 12px; background: rgba(47, 214, 255, .12); box-shadow: 0 0 0 1.5px rgba(47, 214, 255, .35) inset; font-size: .8rem; font-weight: 700; color: #CDEFFF; line-height: 1.3; }
.menu__orient[hidden], .menu__keys[hidden] { display: none; }
.menu__orient svg { flex: none; width: 22px; height: 22px; fill: none; stroke: var(--cyan); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
kbd { font-family: var(--font-d); font-size: .78rem; padding: .35em .6em; border-radius: 8px; background: #fff; color: var(--ink); box-shadow: 0 3px 0 #9992c2; white-space: nowrap; flex: none; }
.menu__extra { margin: 0 0 20px; }

.card { width: min(560px, 100%); text-align: center; padding: 30px 30px 26px; border-radius: 28px; background: linear-gradient(180deg, #2A2260, #1B1540); box-shadow: 0 0 0 2px rgba(255, 255, 255, .12) inset, 0 30px 80px rgba(0, 0, 0, .55); animation: arpop .35s var(--ease); margin: auto; }
.card h2 { font-family: var(--font-d); font-weight: 400; font-size: clamp(2rem, 5vw, 3.2rem); line-height: 1; margin: 0 0 6px; text-transform: uppercase; text-shadow: 0 4px 0 rgba(0, 0, 0, .35); }
.card .sub { margin: 0 0 14px; color: #CFC9F5; font-weight: 600; }
.card .big { font-family: var(--font-d); font-size: clamp(3.4rem, 9vw, 5.4rem); line-height: 1; color: var(--accent); text-shadow: 0 5px 0 rgba(0, 0, 0, .4); font-variant-numeric: tabular-nums; }
.card .biglab { font-size: .7rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: var(--mute); margin-top: 2px; }
.card .rec { display: inline-block; margin: 8px 0 0; padding: .35em 1em; border-radius: 999px; background: var(--sun); color: var(--ink); font-family: var(--font-d); font-size: .9rem; letter-spacing: .04em; transform: rotate(-3deg); box-shadow: 0 3px 0 #B68A00; animation: arpop .5s .25s both var(--ease); }
.card .stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin: 20px 0 22px; }
.card .stat { padding: 10px 8px; border-radius: 14px; background: rgba(255, 255, 255, .06); line-height: 1.1; }
.card .stat small { display: block; font-size: .62rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--mute); margin-bottom: 4px; }
.card .stat b { font-family: var(--font-d); font-weight: 400; font-size: 1.35rem; }
.card .acts { display: grid; gap: 10px; }
.card .acts .row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.card .note { margin-top: 14px; font-size: .8rem; color: var(--mute); font-weight: 600; }

/* menus never sit under the home pill / tool buttons: reserve the bar height whenever the screen is short or narrow */
@media (max-height: 820px) { .ar__ov--menu { padding-top: calc(70px + var(--sat)); } }
@media (max-width: 760px) {
  .ar__ov--menu { place-items: center; background: rgba(15, 12, 34, .72); padding: calc(74px + var(--sat)) max(18px, var(--sar)) max(18px, var(--sab)) max(18px, var(--sal)); }
  .menu { margin: auto; text-align: center; }
  .menu__kicker { justify-content: center; }
  .menu__row { justify-content: center; }
  .menu p.tag { margin-inline: auto; font-size: 1rem; margin-bottom: 16px; }
  .menu__keys { margin-top: 18px; grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); text-align: left; }
  .menu h1 { font-size: clamp(2.5rem, 13vw, 4.2rem); }
  .ar__home b { display: none; }
  .ar__home { padding: 6px; }
  .ar__toast { font-size: clamp(1.3rem, 6vw, 2rem); white-space: normal; width: 92vw; }
  .card { padding: 22px 18px 20px; border-radius: 24px; }
  .card .stats { grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); }
  .btn { min-height: 48px; }
}
/* landscape phones / short windows */
@media (max-height: 560px) {
  .menu h1 { font-size: 2.6rem; } .menu p.tag { margin-bottom: 12px; font-size: .95rem; }
  .menu__keys { grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 12px; } .menu__key { padding: 6px 8px; font-size: .74rem; gap: 6px; } .menu__key kbd { font-size: .66rem; }
  .card { padding: 16px 18px; } .card .stats { margin: 10px 0 12px; } .card h2 { font-size: 1.8rem; } .card .big { font-size: 2.8rem; } .card .sub { margin-bottom: 8px; }
  .ar__ov { padding-top: max(14px, var(--sat)); padding-bottom: max(14px, var(--sab)); }
  .ar__ov--center { place-items: center; }
  .ar__ov--menu { padding-top: calc(60px + var(--sat)); }
}
@media (max-height: 420px) { .menu__keys { display: none; } .menu__kicker { font-size: .68rem; } .menu h1 { font-size: 2.2rem; } }
@media (prefers-reduced-motion: reduce) { .ar__toast.show { animation-duration: .01s; } .menu, .card { animation: none; } }

/* ---------- phones: rotate overlay + one-time hint (shared/mobile.js) ---------- */
.ar__rotate { position: absolute; inset: 0; z-index: 80; display: none; place-items: center; padding: max(24px, var(--sat)) max(24px, var(--sar)) max(24px, var(--sab)) max(24px, var(--sal)); background: radial-gradient(900px 600px at 50% 30%, #2A2260, #0F0C22 70%); text-align: center; touch-action: none; }
.ar__rotate.show { display: grid; animation: arfade .25s ease; }
.ar__rotate__box { max-width: 380px; }
.ar__rotate__ph { width: 120px; height: 120px; margin: 0 auto 18px; display: grid; place-items: center; }
.ar__rotate__ph i { display: block; width: 58px; height: 104px; border-radius: 14px; background: linear-gradient(160deg, #3A3180, #1B1540); box-shadow: 0 0 0 4px var(--lime) inset, 0 12px 30px rgba(0, 0, 0, .5); position: relative; animation: arrot 2.4s ease-in-out infinite; }
.ar__rotate__ph i::after { content: ""; position: absolute; left: 50%; bottom: 7px; width: 16px; height: 4px; margin-left: -8px; border-radius: 4px; background: rgba(255, 255, 255, .5); }
@keyframes arrot { 0%, 15% { transform: rotate(0); } 55%, 85% { transform: rotate(-90deg); } 100% { transform: rotate(0); } }
.ar__rotate h2 { margin: 0 0 8px; font-family: var(--font-d); font-weight: 400; font-size: 1.9rem; text-transform: uppercase; text-shadow: 0 4px 0 rgba(0, 0, 0, .35); }
.ar__rotate p { margin: 0 0 18px; color: #DCD7FF; font-weight: 600; line-height: 1.45; }
.ar__rotate__skip { border: 0; background: none; padding: 12px 8px; min-height: 44px; color: rgba(154, 148, 199, .8); font-size: .78rem; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
@media (max-height: 460px) { .ar__rotate__ph { display: none; } .ar__rotate h2 { font-size: 1.4rem; } }
.ar__hint { position: absolute; z-index: 30; left: 50%; bottom: calc(18px + var(--sab)); transform: translateX(-50%) translateY(10px); max-width: min(92vw, 520px); padding: .7em 1.2em; border-radius: 999px; text-align: center; font-weight: 800; font-size: .92rem; line-height: 1.3; background: rgba(15, 12, 34, .82); box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .16) inset, 0 10px 30px rgba(0, 0, 0, .4); opacity: 0; pointer-events: none; transition: opacity .35s, transform .35s; }
.ar__hint.show { opacity: 1; transform: translateX(-50%); }
