/* arcade.css — AYA-Connect ARCADE: picker, fullscreen host, shared HUD.
   Namespace: .arcade-* (shell) / .arc-* (games). Light + body.dark-theme. */

.arcade-overlay {
  --arc-bg: #f2f4fa;
  --arc-bg-grad: radial-gradient(120% 90% at 50% -10%, #e6ebff 0%, #f2f4fa 55%, #eef0f7 100%);
  --arc-card: #ffffff;
  --arc-fg: #171f36;
  --arc-muted: #6d7690;
  --arc-accent: #5b7cfa;
  --arc-accent2: #8b5cf6;
  --arc-border: rgba(23, 31, 54, 0.09);
  --arc-shadow: 0 12px 32px rgba(23, 31, 54, 0.16);
  --arc-stage: #e9ecf5;
  --arc-btn: rgba(23, 31, 54, 0.06);
  --arc-btn-active: rgba(23, 31, 54, 0.14);

  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  flex-direction: column;
  background: var(--arc-bg-grad);
  color: var(--arc-fg);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  animation: arcade-fadein 0.22s ease-out;
  overscroll-behavior: contain;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

body.dark-theme .arcade-overlay {
  --arc-bg: #0d1220;
  --arc-bg-grad: radial-gradient(120% 90% at 50% -10%, #1b2340 0%, #0d1220 55%, #0a0e1a 100%);
  --arc-card: #182035;
  --arc-fg: #e9edf8;
  --arc-muted: #8d96b0;
  --arc-accent: #6d8bff;
  --arc-accent2: #a07bff;
  --arc-border: rgba(255, 255, 255, 0.09);
  --arc-shadow: 0 12px 36px rgba(0, 0, 0, 0.55);
  --arc-stage: #0a0e1a;
  --arc-btn: rgba(255, 255, 255, 0.08);
  --arc-btn-active: rgba(255, 255, 255, 0.2);
}

.arcade-overlay.arcade-out {
  animation: arcade-fadeout 0.2s ease-in forwards;
}

@keyframes arcade-fadein {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to   { opacity: 1; transform: none; }
}

@keyframes arcade-fadeout {
  from { opacity: 1; }
  to   { opacity: 0; transform: translateY(10px) scale(0.99); }
}

body.arcade-noscroll {
  overflow: hidden !important;
}

/* ---------- shared small bits ---------- */

.arcade-iconbtn {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border: none;
  border-radius: 13px;
  background: var(--arc-btn);
  color: var(--arc-fg);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease;
  touch-action: manipulation;
}

.arcade-iconbtn:active {
  background: var(--arc-btn-active);
  transform: scale(0.92);
}

.arcade-error {
  color: var(--arc-muted);
  font-size: 16px;
  text-align: center;
  padding: 40px 20px;
}

/* ---------- picker ---------- */

.arcade-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(14px + env(safe-area-inset-top, 0px)) calc(16px + env(safe-area-inset-right, 0px)) 10px calc(16px + env(safe-area-inset-left, 0px));
}

.arcade-picker-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0.2px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.arcade-picker-emoji {
  font-size: 26px;
  filter: drop-shadow(0 3px 6px rgba(91, 124, 250, 0.4));
}

.arcade-grid {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
  align-content: start;
  padding: 8px calc(16px + env(safe-area-inset-right, 0px)) calc(24px + env(safe-area-inset-bottom, 0px)) calc(16px + env(safe-area-inset-left, 0px));
}

.arcade-card {
  position: relative;
  border: 1px solid var(--arc-border);
  border-radius: 22px;
  background: var(--arc-card);
  box-shadow: var(--arc-shadow);
  padding: 20px 12px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--arc-fg);
  font-family: inherit;
  transition: transform 0.14s ease, box-shadow 0.14s ease;
  animation: arcade-cardpop 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2) backwards;
  touch-action: manipulation;
  overflow: hidden;
}

.arcade-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 46%;
  background: linear-gradient(180deg, rgba(91, 124, 250, 0.09), transparent);
  pointer-events: none;
}

.arcade-card:active {
  transform: scale(0.94);
  box-shadow: 0 4px 14px rgba(23, 31, 54, 0.12);
}

@keyframes arcade-cardpop {
  from { opacity: 0; transform: translateY(18px) scale(0.92); }
  to   { opacity: 1; transform: none; }
}

.arcade-card-icon {
  font-size: 46px;
  line-height: 1;
  filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.18));
}

.arcade-card-title {
  font-size: 15.5px;
  font-weight: 700;
  text-align: center;
}

.arcade-card-badge {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: #fff;
  background: linear-gradient(135deg, var(--arc-accent), var(--arc-accent2));
  border-radius: 999px;
  padding: 3px 10px;
}

.arcade-card-badge.arcade-badge-2p {
  background: linear-gradient(135deg, #f0699b, #f59e0b);
}

.arcade-card-best {
  font-size: 12px;
  color: var(--arc-muted);
  font-weight: 600;
}

.arcade-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--arc-muted);
  padding: 60px 20px;
  font-size: 16px;
}

/* ---------- game host ---------- */

.arcade-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) calc(12px + env(safe-area-inset-right, 0px)) 10px calc(12px + env(safe-area-inset-left, 0px));
  border-bottom: 1px solid var(--arc-border);
  background: color-mix(in srgb, var(--arc-card) 72%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.arcade-topbar-title {
  flex: 1;
  font-size: 17px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.arcade-score-slot {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.15;
  min-width: 54px;
}

.arcade-score-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--arc-muted);
}

.arcade-score-val {
  font-size: 19px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(135deg, var(--arc-accent), var(--arc-accent2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--arc-accent);
}

.arcade-stage {
  position: relative;
  flex: 1;
  overflow: hidden;
  background: var(--arc-stage);
  touch-action: none;
}

.arcade-game-host {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  touch-action: none;
}

.arcade-game-host canvas {
  display: block;
  touch-action: none;
}

/* ---------- shared control pads ---------- */

.arcade-padrow {
  display: flex;
  gap: 10px;
  padding: 10px calc(12px + env(safe-area-inset-right, 0px)) calc(12px + env(safe-area-inset-bottom, 0px)) calc(12px + env(safe-area-inset-left, 0px));
  flex: 0 0 auto;
}

.arcade-padbtn {
  flex: 1;
  height: 58px;
  border: 1px solid var(--arc-border);
  border-radius: 17px;
  background: var(--arc-card);
  color: var(--arc-fg);
  font-size: 23px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
  transition: transform 0.08s ease, background 0.08s ease;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

.arcade-padbtn:active,
.arcade-padbtn.arcade-padbtn-held {
  background: var(--arc-btn-active);
  transform: scale(0.93);
}

.arcade-padbtn-wide {
  flex: 1.4;
}

/* ---------- floating hint ---------- */

.arcade-hint {
  position: absolute;
  left: 50%;
  bottom: 18%;
  transform: translateX(-50%);
  background: color-mix(in srgb, var(--arc-card) 85%, transparent);
  color: var(--arc-fg);
  border: 1px solid var(--arc-border);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: var(--arc-shadow);
  animation: arcade-hint 3.5s ease forwards;
}

@keyframes arcade-hint {
  0%   { opacity: 0; transform: translateX(-50%) translateY(8px); }
  12%  { opacity: 1; transform: translateX(-50%); }
  80%  { opacity: 1; }
  100% { opacity: 0; }
}

/* ---------- game-over card ---------- */

.arcade-gameover {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(10, 14, 26, 0.45);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  animation: arcade-fadein 0.25s ease-out;
}

.arcade-go-card {
  width: min(340px, 92%);
  background: var(--arc-card);
  border: 1px solid var(--arc-border);
  border-radius: 26px;
  box-shadow: var(--arc-shadow);
  padding: 26px 22px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  animation: arcade-cardpop 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.25);
}

.arcade-go-emoji {
  font-size: 52px;
  line-height: 1;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.25));
}

.arcade-go-title {
  font-size: 21px;
  font-weight: 800;
  margin-top: 4px;
}

.arcade-go-score {
  font-size: 17px;
  font-weight: 700;
  color: var(--arc-fg);
  font-variant-numeric: tabular-nums;
}

.arcade-go-best {
  font-size: 13.5px;
  color: var(--arc-muted);
  font-weight: 600;
}

.arcade-go-record {
  font-size: 14px;
  font-weight: 800;
  background: linear-gradient(135deg, #f59e0b, #f0699b);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: #f59e0b;
}

.arcade-go-btns {
  display: flex;
  flex-direction: column;
  gap: 9px;
  width: 100%;
  margin-top: 14px;
}

.arcade-gobtn {
  width: 100%;
  height: 46px;
  border: none;
  border-radius: 15px;
  font-size: 15.5px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.12s ease;
  touch-action: manipulation;
}

.arcade-gobtn:active {
  transform: scale(0.96);
}

.arcade-gobtn:disabled {
  opacity: 0.65;
  cursor: default;
}

.arcade-gobtn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--arc-accent), var(--arc-accent2));
  box-shadow: 0 6px 16px rgba(91, 124, 250, 0.4);
}

.arcade-gobtn-secondary {
  color: var(--arc-fg);
  background: var(--arc-btn);
  border: 1px solid var(--arc-border);
}

.arcade-gobtn-ghost {
  color: var(--arc-muted);
  background: transparent;
}

/* ---------- Ну, погоди! corner labels ---------- */

.arc-np-zones {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.arc-np-zone {
  position: absolute;
  width: 50%;
  height: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.arc-np-flash {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(91, 124, 250, 0.35), transparent 70%);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.arc-np-zone.arc-np-zone-hit .arc-np-flash {
  opacity: 1;
  transition: none;
}

/* ---------- small screens ---------- */

@media (max-width: 380px) {
  .arcade-grid { grid-template-columns: repeat(2, 1fr); gap: 11px; }
  .arcade-card-icon { font-size: 40px; }
  .arcade-padbtn { height: 52px; font-size: 21px; }
}

@media (max-height: 620px) {
  .arcade-padbtn { height: 46px; }
  .arcade-go-card { padding: 18px 18px 14px; }
  .arcade-go-emoji { font-size: 40px; }
}

/* ===== Рейтинг друзей (лидерборд аркад) ===== */
.arc-lb-ov{ position:fixed; inset:0; z-index:100200; background:rgba(0,0,0,.55); display:flex; align-items:flex-end; }
.arc-lb-sheet{ width:100%; max-height:82vh; background:var(--panel,#fff); border-radius:22px 22px 0 0; display:flex; flex-direction:column; overflow:hidden; animation:arcLbUp .26s cubic-bezier(.22,1,.36,1); padding-bottom:env(safe-area-inset-bottom,0px); }
@keyframes arcLbUp{ from{ transform:translateY(100%) } to{ transform:none } }
.arc-lb-head{ display:flex; align-items:center; justify-content:space-between; padding:16px 18px; font-size:18px; font-weight:800; color:var(--text,#111); border-bottom:1px solid var(--border,#eef1f3); flex:none; }
.arc-lb-close{ border:none; background:transparent; font-size:22px; line-height:1; color:var(--text-secondary,#8894a0); cursor:pointer; }
.arc-lb-list{ overflow-y:auto; padding:8px 12px 20px; }
/* Vkladki po igram (gorizontalnyj skroll) */
.arc-lb-tabs{ display:flex; gap:7px; overflow-x:auto; padding:10px 14px 4px; flex:none; scrollbar-width:none; -webkit-overflow-scrolling:touch; }
.arc-lb-tabs::-webkit-scrollbar{ display:none; }
.arc-lb-tab{ flex:0 0 auto; border:none; border-radius:999px; padding:8px 14px; font-size:13px; font-weight:600; cursor:pointer;
  background:var(--soft,#eef2f6); color:var(--text-secondary,#5a6b78); white-space:nowrap; -webkit-tap-highlight-color:transparent; }
.arc-lb-tab.on{ background:linear-gradient(135deg,#0e7e89,#005f6d); color:#fff; }
/* Yavnaya nizhnyaya knopka «Закрыть» */
.arc-lb-bottom-close{ display:block; width:calc(100% - 28px); margin:6px 14px 12px; padding:14px; border-radius:16px;
  background:var(--soft,#eef2f6); color:var(--text,#111); font-size:16px; font-weight:700; border:none; cursor:pointer; flex:none; }
body.dark-theme .arc-lb-tab{ background:#232e36; color:#aab6c2; }
body.dark-theme .arc-lb-bottom-close{ background:#232e36; color:#e8edee; }
.arc-lb-row{ display:flex; align-items:center; gap:12px; padding:11px 10px; border-radius:14px; }
.arc-lb-row.me{ background:rgba(14,126,137,.10); }
.arc-lb-rank{ width:34px; text-align:center; font-size:18px; font-weight:800; color:var(--text-secondary,#8894a0); flex:none; }
.arc-lb-av{ width:40px; height:40px; border-radius:50%; object-fit:cover; flex:none; }
.arc-lb-av-l{ display:flex; align-items:center; justify-content:center; background:linear-gradient(135deg,#0e7e89,#005f6d); color:#fff; font-weight:700; }
.arc-lb-name{ flex:1; min-width:0; font-size:15px; font-weight:600; color:var(--text,#111); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.arc-lb-val{ font-size:16px; font-weight:800; color:var(--brand,#0e7e89); flex:none; }
.arc-lb-empty{ padding:36px 20px; text-align:center; color:var(--text-secondary,#8894a0); line-height:1.5; }
body.dark-theme .arc-lb-sheet{ background:#151d24; }
body.dark-theme .arc-lb-head{ color:#eef4f5; border-bottom-color:#232e36; }
body.dark-theme .arc-lb-name{ color:#e8edee; }
body.dark-theme .arc-lb-row.me{ background:rgba(63,182,199,.14); }
