/* ============================================================
   สนามประลองลุงเอ — arena-view.css (สไตล์ของ mountArenaView ใช้ทั้งหน้าแรกและ arena.html)
   ทุกอย่างอยู่ใต้ .av (ไม่ชนกับ style.css / arena.css)
   ============================================================ */
.av {
  --av-bg: #0b0b0f; --av-card: #15151c; --av-card2: #1b1b24; --av-border: #2a2a35; --av-border2: #3a3a48;
  --av-text: #f2f2f5; --av-muted: #9a9aa8; --av-accent: #e8456b; --av-gold: #f5c542;
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; min-width: 0; color: var(--av-text);
  font-family: 'Prompt', 'Noto Sans Thai', system-ui, sans-serif;
}
.av [hidden] { display: none !important; }
.av-main { display: grid; gap: 8px; min-width: 0; }
.av-stage {
  position: relative; width: 100%; aspect-ratio: 3 / 2; background: #101218; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--av-border); touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.av-compact .av-stage { aspect-ratio: 16 / 9; max-height: 360px; }
.av-canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; image-rendering: pixelated; cursor: grab; touch-action: none; }
.av-canvas.is-drag { cursor: grabbing; }

/* มินิแมพ (มุมซ้ายบน แบบ MOBA) + ปุ่มกล้อง */
.av-mini { position: absolute; left: 6px; top: 6px; width: 160px; z-index: 5; display: grid; gap: 4px; pointer-events: none; }
.av-minimap {
  display: block; width: 100%; height: auto; border-radius: 6px; background: rgba(11, 11, 15, .55); opacity: .92;
  border: 1px solid rgba(255, 255, 255, .25); box-shadow: 0 2px 10px rgba(0, 0, 0, .45); cursor: crosshair; pointer-events: auto; touch-action: none;
}
.av-camctl { display: flex; flex-wrap: wrap; gap: 4px; pointer-events: auto; }
.av-cb {
  min-height: 26px; padding: 1px 8px; border-radius: 6px; border: 1px solid var(--av-border2); background: rgba(11, 11, 15, .78); color: var(--av-text);
  font: inherit; font-size: 11px; line-height: 1.2; cursor: pointer; white-space: nowrap;
}
.av-cb:hover { border-color: var(--av-gold); }
.av-cb.is-on { border-color: var(--av-gold); color: var(--av-gold); }
.av-cb-self.is-on { background: var(--av-accent); border-color: var(--av-accent); color: #fff; animation: av-pulse 1.2s infinite; }
@keyframes av-pulse { 50% { box-shadow: 0 0 0 4px rgba(232, 69, 107, .35); } }
.av-cb-zoom { display: inline-flex; gap: 3px; }
.av-cb-zoom .av-cb { min-width: 28px; font-size: 14px; font-weight: 700; padding: 0 6px; }
@media (max-width: 600px) {
  .av-mini { width: 110px; }
  .av-cb { font-size: 10.5px; min-height: 24px; padding: 1px 6px; }
}

/* แชทขวาของจอ (เดสก์ท็อป — สูงเท่าจอ) / ใต้สนาม (มือถือ พับได้) */
@media (min-width: 760px) {
  .av-has-chat { grid-template-columns: minmax(0, 1fr) 250px; align-items: stretch; }
  .av-has-chat .av-main { grid-row: 1; grid-column: 1; }
  .av-has-chat .av-chat { grid-row: 1; grid-column: 2; }
  .av-compact.av-has-chat { grid-template-columns: minmax(0, 1fr) 220px; }
}
@media (max-width: 759.98px) {
  .av-has-chat .av-chat { order: 2; }
}
.av-chat {
  display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--av-card); border: 1px solid var(--av-border);
  border-radius: 10px; overflow: hidden; position: relative;
}
@media (min-width: 760px) {
  /* สูงเท่าสนาม: กล่องแชทไม่ขยายหน้า (รายการเลื่อนในตัวเอง) */
  .av-has-chat .av-chat { height: 0; min-height: 100%; }
}
.av-chat-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 6px 8px; border-bottom: 1px solid var(--av-border); }
.av-chat-toggle { background: none; border: 0; color: var(--av-text); font: inherit; font-size: 13px; padding: 2px 0; cursor: pointer; }
.av-chat-toggle .av-chat-n { color: var(--av-muted); font-size: 11.5px; }
.av-chat-clear { background: none; border: 1px solid var(--av-border2); color: var(--av-muted); border-radius: 6px; font: inherit; font-size: 11.5px; padding: 1px 8px; cursor: pointer; }
.av-chat-clear:hover { color: var(--av-text); }
.av-chat-list { list-style: none; margin: 0; padding: 6px 8px; flex: 1 1 auto; min-height: 0; overflow-y: auto; display: grid; align-content: start; gap: 3px; font-size: 12.5px; line-height: 1.45; overscroll-behavior: contain; }
@media (max-width: 759.98px) { .av-chat-list { height: 180px; flex: none; } }
.av-chat-list li { overflow-wrap: anywhere; }
.av-chat-list li.is-me .av-chat-name { color: var(--av-gold); }
.av-chat-t { color: #6c6c7a; font-size: 10.5px; font-variant-numeric: tabular-nums; }
.av-chat-name { font-weight: 600; }
.av-chat-sep { color: var(--av-muted); }
.av-chat-empty { color: var(--av-muted); }
.av-epi {
  display: inline-block; font-size: .86em; font-weight: 700; color: #ffd666; background: rgba(245, 197, 66, .14);
  border: 1px solid rgba(245, 197, 66, .55); border-radius: 5px; padding: 0 5px; line-height: 1.35; white-space: nowrap; vertical-align: 1px;
}
.av-chat-form { display: flex; gap: 6px; padding: 6px; border-top: 1px solid var(--av-border); }
.av-chat-in { flex: 1; min-width: 0; background: var(--av-bg); color: var(--av-text); border: 1px solid var(--av-border2); border-radius: 7px; padding: 6px 8px; font: inherit; font-size: 16px; }
@media (min-width: 760px) { .av-chat-in { font-size: 13px; } }
.av-chat-in:disabled { opacity: .55; }
.av-chat-send { background: var(--av-accent); color: #fff; border: 0; border-radius: 7px; padding: 0 12px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.av-chat-send:disabled { opacity: .45; cursor: not-allowed; }
.av-chat-hint { margin: 0; padding: 0 8px 6px; font-size: 11.5px; color: var(--av-muted); }
.av-chat-hint.is-err { color: #ff8a8a; }
.av-chat.is-collapsed .av-chat-list, .av-chat.is-collapsed .av-chat-form, .av-chat.is-collapsed .av-chat-hint { display: none; }
@media (min-width: 760px) { .av-chat-toggle { pointer-events: none; } }

/* สถานะบนจอ */
.av-livepill {
  position: absolute; left: 8px; bottom: 8px; display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 700;
  letter-spacing: .6px; padding: 1px 7px; border-radius: 999px; background: rgba(11, 11, 15, .72); border: 1px solid var(--av-border2); color: var(--av-muted);
  pointer-events: none;
}
.av-livepill .av-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--av-muted); }
.av-livepill.is-on { color: #fff; border-color: var(--av-accent); }
.av-livepill.is-on .av-dot { background: var(--av-accent); animation: av-blink 1s infinite; }
@keyframes av-blink { 50% { opacity: .25; } }
.av-play .av-livepill { display: none; }
.av-killfeed {
  position: absolute; right: 6px; top: 6px; margin: 0; padding: 0; list-style: none; display: grid; gap: 3px; max-width: min(62%, 330px); pointer-events: none;
}
.av-killfeed li {
  background: rgba(11, 11, 15, .78); border-left: 3px solid var(--av-accent); border-radius: 4px; padding: 1px 7px; font-size: 11px; line-height: 1.45;
  animation: av-in .2s ease-out; overflow-wrap: anywhere;
}
.av-killfeed li.is-drop { border-left-color: #ff9a4a; color: #ffd8b0; }
.av-killfeed li.is-dog { border-left-color: #b07a43; color: #f0dcc0; }
.av-killfeed li.is-misc { border-left-color: #00e0ff; color: #bff4ff; }
.av-compact .av-killfeed { max-width: min(58%, 300px); }
.av-compact .av-killfeed li { font-size: 10.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.av-compact .av-killfeed li:nth-child(n+3) { display: none; }
@media (max-width: 520px) { .av-compact .av-killfeed li:nth-child(n+2) { display: none; } .av-compact .av-killfeed li { font-size: 10px; -webkit-line-clamp: 1; } }
@keyframes av-in { from { opacity: 0; transform: translateX(10px); } }
.av-play .av-killfeed { top: 44px; }
.av-ov { position: absolute; inset: 0; display: grid; place-items: center; padding: 10px; background: rgba(11, 11, 15, .35); pointer-events: none; }
.av-ov-solid { background: rgba(11, 11, 15, .85); }
.av-ov-card {
  text-align: center; background: rgba(21, 21, 28, .92); border: 1px solid var(--av-border2); border-radius: 12px; padding: 12px 16px; max-width: 380px; width: 100%;
  pointer-events: auto;
}
.av-ov-small { width: auto; font-size: 13px; color: var(--av-muted); display: inline-flex; align-items: center; gap: 8px; }
.av-ov-big { font-size: clamp(18px, 5vw, 26px); font-weight: 700; margin: 0 0 4px; }
.av-ov-huge { font-size: clamp(30px, 9vw, 52px); font-weight: 800; color: #ff6f8e; margin: 0; line-height: 1.1; text-shadow: 0 4px 20px rgba(232, 69, 107, .45); }
.av-ov-kicker { color: var(--av-muted); font-size: 12.5px; margin: 0; }
.av-ov-note { font-size: 13px; margin: 6px 0 0; }
.av-ov-note b { color: var(--av-gold); }
.av-ov-sub { font-size: 12px; color: var(--av-muted); margin: 6px 0 0; }
.av-ov-actions, .av-dialog-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }
.av-ov-btn { min-height: 40px; padding: 6px 14px; border-radius: 8px; border: 1px solid var(--av-border2); background: var(--av-card2); color: var(--av-text); font: inherit; font-size: 14px; cursor: pointer; }
.av-ov-primary { background: var(--av-accent); border-color: var(--av-accent); color: #fff; font-weight: 600; }
.av-ov-dead { background: rgba(11, 11, 15, .55); z-index: 6; }
.av-spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--av-border2); border-top-color: var(--av-accent); animation: av-rot .8s linear infinite; }
@keyframes av-rot { to { transform: rotate(360deg); } }

/* HUD (play) */
.av-hud { position: absolute; left: 174px; right: 6px; top: 6px; display: flex; justify-content: space-between; align-items: flex-start; gap: 6px; pointer-events: none; z-index: 3; }
@media (max-width: 600px) { .av-hud { left: 122px; } .av-hud-me { min-width: 0 !important; } }
.av-hud-veh { margin-top: 3px; font-size: 11.5px; font-weight: 700; border-radius: 5px; padding: 1px 6px; background: rgba(92, 242, 200, .16); color: #5cf2c8; white-space: nowrap; }
.av-hud-veh.is-buffalo { background: rgba(255, 178, 122, .2); color: #ffb27a; animation: av-blink 1s infinite; }
.av-hud-veh.is-moto { background: rgba(255, 122, 26, .2); color: #ffb27a; }
.av-hud-me { background: rgba(11, 11, 15, .74); border: 1px solid var(--av-border2); border-radius: 8px; padding: 4px 7px; min-width: 140px; max-width: 58%; }
.av-hud-name { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.av-hearts { color: #ff6f8e; letter-spacing: 1px; }
.av-hp { position: relative; height: 11px; border-radius: 6px; background: #2b1a20; overflow: hidden; margin: 3px 0; }
.av-hp-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #4cd28a, #8ee6b0); transition: width .15s; }
.av-hp-fill.is-low { background: linear-gradient(90deg, #e8456b, #ff8a8a); }
.av-hp-t { position: absolute; inset: 0; font-size: 9px; line-height: 11px; text-align: center; color: #0b0b0f; font-weight: 700; }
.av-hud-sub { font-size: 10.5px; color: var(--av-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.av-hud-r { display: grid; gap: 3px; justify-items: end; }
.av-hud-r span { font-size: 11px; background: rgba(11, 11, 15, .74); border: 1px solid var(--av-border2); border-radius: 999px; padding: 0 8px; white-space: nowrap; }

/* ปุ่มแบบ MOBA (มือถือ / จอสัมผัส) */
.av-touch { display: none; position: absolute; inset: 0; z-index: 4; pointer-events: none; }
@media (pointer: coarse) {
  /* แผนที่ชิดบน (ใต้แถบ HUD) + พื้นที่ปุ่มใต้แผนที่ ~250px — ทั้งหมดอยู่ในจอเดียว */
  .av-play .av-stage { aspect-ratio: auto; height: min(calc((100vw - 34px) * 0.6667 + 300px), calc(100svh - 60px), 760px); min-height: 470px; touch-action: none; }
  .av-play .av-touch.is-on { display: block; }
}
.av-joyzone { position: absolute; left: 0; top: 150px; bottom: 0; width: 50%; pointer-events: auto; touch-action: none; }
.av-joy-hint { position: absolute; left: 16px; bottom: calc(env(safe-area-inset-bottom) + 100px); font-size: 11px; color: rgba(255, 255, 255, .45); pointer-events: none; }
.av-joyzone.is-active .av-joy-hint { display: none; }
.av-joy { position: absolute; width: 108px; height: 108px; margin: -54px 0 0 -54px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 255, 255, .08) 0 55%, rgba(255, 255, 255, .04) 56%); border: 2px solid rgba(255, 255, 255, .22); pointer-events: none; }
.av-joy-knob { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%; background: rgba(232, 69, 107, .85); box-shadow: 0 4px 12px rgba(0, 0, 0, .45); }
.av-touch { padding-bottom: calc(env(safe-area-inset-bottom) + 28px); box-sizing: border-box; touch-action: none; overscroll-behavior: contain; }
.av-cluster { position: absolute; right: max(16px, calc(env(safe-area-inset-right) + 16px)); bottom: calc(env(safe-area-inset-bottom) + 96px); width: 188px; height: 188px; pointer-events: none; }
.av-btn {
  --cd: 0; position: absolute; width: 58px; height: 58px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .28); color: #fff; font: inherit;
  font-size: 11px; font-weight: 700; line-height: 1.15; display: grid; place-items: center; pointer-events: auto; touch-action: none; overflow: hidden;
  background: rgba(30, 30, 40, .82); box-shadow: 0 4px 14px rgba(0, 0, 0, .45); -webkit-tap-highlight-color: transparent;
}
.av-btn::before {   /* วงคูลดาวน์ */
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(rgba(0, 0, 0, .68) calc(var(--cd) * 360deg), transparent 0);
}
.av-btn .av-b-l { position: relative; z-index: 1; text-align: center; }
.av-btn .av-b-cd { position: absolute; z-index: 2; inset: 0; display: grid; place-items: center; font-size: 18px; font-weight: 800; color: #fff; text-shadow: 0 1px 3px #000; }
.av-btn.is-cd .av-b-l { opacity: .35; }
.av-btn.is-down { transform: scale(.92); filter: brightness(1.2); }
.av-b-atk { right: 0; bottom: 0; width: 76px; height: 76px; font-size: 16px; background: rgba(232, 69, 107, .92); border-color: rgba(255, 255, 255, .4); }
.av-b-slap { right: 84px; bottom: 6px; background: rgba(214, 150, 40, .9); }
.av-b-shield { right: 66px; bottom: 72px; background: rgba(206, 120, 140, .9); }
.av-b-bid { right: 8px; bottom: 98px; background: rgba(138, 92, 214, .9); }
.av-b-pick { right: 132px; bottom: 74px; width: 50px; height: 50px; background: rgba(59, 127, 209, .9); }

/* แถบปุ่ม (คอม) */
.av-actionbar { display: none; flex-wrap: wrap; gap: 6px; align-items: center; }
.av-actionbar.is-on { display: flex; }
@media (pointer: coarse) { .av-actionbar.is-on { display: flex; } .av-actionbar .av-ab[data-act] { display: none; } }
.av-ab {
  --cd: 0; position: relative; overflow: hidden; display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 4px 10px; border-radius: 8px;
  border: 1px solid var(--av-border2); background: var(--av-card2); color: var(--av-text); font: inherit; font-size: 12.5px; cursor: pointer;
}
.av-ab::before { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(0, 0, 0, .55) calc(var(--cd) * 100%), transparent 0); pointer-events: none; }
.av-ab > * { position: relative; }
.av-ab kbd { font: inherit; font-size: 11px; font-weight: 700; min-width: 22px; text-align: center; padding: 0 5px; border-radius: 5px; background: var(--av-bg); border: 1px solid var(--av-border2); color: var(--av-gold); }
.av-ab-cd { font-style: normal; font-weight: 800; color: #ff8a8a; min-width: 0; }
.av-ab.is-down { filter: brightness(1.3); }
.av-ab-sp { flex: 1; }
.av-ab-ai[aria-pressed="true"] { border-color: var(--av-gold); color: var(--av-gold); }

/* dialog ตั้งค่าปุ่ม */
.av-dialog { border: 1px solid #3a3a48; border-radius: 12px; background: #15151c; color: #f2f2f5; padding: 0; width: min(420px, calc(100vw - 24px)); font-family: 'Prompt', system-ui, sans-serif; }
.av-dialog::backdrop { background: rgba(0, 0, 0, .6); }
.av-dialog-body { padding: 16px; display: grid; gap: 10px; }
.av-dialog-h { font-size: 16px; margin: 0; }
.av-dialog-p { font-size: 12.5px; color: #9a9aa8; margin: 0; }
.av-keys { display: grid; gap: 6px; }
.av-key-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 14px; }
.av-key { min-width: 92px; min-height: 36px; border-radius: 8px; border: 1px solid #3a3a48; background: #0b0b0f; color: #f5c542; font: inherit; font-weight: 700; cursor: pointer; }
.av-key.is-wait { border-color: #e8456b; color: #fff; animation: av-blink 1s infinite; }
.av-dialog .av-ov-btn { min-height: 38px; padding: 6px 14px; border-radius: 8px; border: 1px solid #3a3a48; background: #1b1b24; color: #f2f2f5; font: inherit; cursor: pointer; }
.av-dialog .av-ov-primary { background: #e8456b; border-color: #e8456b; color: #fff; }
.av-stage { scroll-margin-top: 64px; }
@media (max-width: 520px) {
  .av-play .av-killfeed { max-width: 62%; }
  .av-play .av-killfeed li { font-size: 10px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .av-play .av-killfeed li:nth-child(n+3) { display: none; }
}
/* มือถือ (แมพใหญ่): ฟีดอยู่ใต้ HUD ฝั่งขวา ไม่ทับกล่องเลือด/มินิแมพ */
@media (max-width: 600px) {
  .av-play .av-killfeed { top: 122px; max-width: 58%; }
  .av-compact .av-killfeed { top: auto; bottom: 6px; max-width: 64%; }
}

/* ───────── มือถือ: เต็มจอแนวนอน (.is-fullscreen — ใช้ได้ทั้ง Fullscreen API จริงและแบบจำลอง) ───────── */
html.av-fs-lock, html.av-fs-lock body { overflow: hidden !important; overscroll-behavior: none; }
.av-fsbar { display: none; position: absolute; z-index: 7; top: max(8px, env(safe-area-inset-top)); right: max(8px, env(safe-area-inset-right)); gap: 6px; }
.av-fs-exit { background: rgba(232, 69, 107, .9); border-color: #e8456b; color: #fff; font-weight: 700; }
.av-cb-fs { background: var(--av-accent); border-color: var(--av-accent); color: #fff; font-weight: 700; }
.av.is-fullscreen {
  position: fixed; inset: 0; z-index: 2147483000; display: block; background: #000; margin: 0; padding: 0; width: 100vw; height: 100vh; height: 100dvh;
}
.av.is-fullscreen .av-main { height: 100%; display: block; }
.av.is-fullscreen .av-stage { height: 100% !important; min-height: 0 !important; max-height: none !important; aspect-ratio: auto !important; border-radius: 0; border: 0; touch-action: none; }
.av.is-fullscreen .av-actionbar { display: none !important; }
.av.is-fullscreen .av-fsbar { display: flex; }
.av.is-fullscreen .av-cb-fs { display: none; }
.av.is-fullscreen .av-mini { left: max(8px, env(safe-area-inset-left)); top: max(8px, env(safe-area-inset-top)); width: 150px; }
.av.is-fullscreen .av-hud { left: auto; right: max(8px, env(safe-area-inset-right)); top: calc(max(8px, env(safe-area-inset-top)) + 36px); flex-direction: column; align-items: flex-end; width: auto; max-width: 42%; }
.av.is-fullscreen .av-hud-me { max-width: 100%; }
.av.is-fullscreen .av-hud-r { grid-auto-flow: column; }
.av.is-fullscreen .av-killfeed { top: max(8px, env(safe-area-inset-top)); left: 50%; right: auto; transform: translateX(-50%); max-width: 36%; }
.av.is-fullscreen .av-killfeed li:nth-child(n+3) { display: none; }
.av.is-fullscreen .av-livepill { display: none; }
.av.is-fullscreen .av-touch.is-on { display: block; }
.av.is-fullscreen .av-joyzone { top: 38%; width: 45%; left: max(0px, env(safe-area-inset-left)); }
.av.is-fullscreen .av-joy-hint { left: calc(env(safe-area-inset-left) + 24px); bottom: calc(env(safe-area-inset-bottom) + 24px); }
.av.is-fullscreen .av-cluster { right: calc(env(safe-area-inset-right) + 24px); bottom: calc(env(safe-area-inset-bottom) + 24px); width: 210px; height: 200px; }
/* ปุ่มโค้งแบบ RoV: ตีใหญ่ ≥ 64 px มุมขวาล่าง สกิล ≥ 52 px เรียงโค้งรอบ */
.av.is-fullscreen .av-b-atk { width: 80px; height: 80px; right: 0; bottom: 0; }
.av.is-fullscreen .av-b-slap { width: 58px; height: 58px; right: 96px; bottom: 4px; }
.av.is-fullscreen .av-b-shield { width: 58px; height: 58px; right: 78px; bottom: 76px; }
.av.is-fullscreen .av-b-bid { width: 58px; height: 58px; right: 8px; bottom: 100px; }
.av.is-fullscreen .av-b-pick { width: 52px; height: 52px; right: 150px; bottom: 86px; }
.av.is-fullscreen .av-chat {
  display: none; position: absolute; z-index: 8; right: max(8px, env(safe-area-inset-right)); top: calc(max(8px, env(safe-area-inset-top)) + 40px);
  width: min(300px, 46vw); height: min(62vh, 320px); min-height: 0 !important; background: rgba(21, 21, 28, .92);
}
.av.is-fullscreen.is-chat-open .av-chat { display: flex; }
.av.is-fullscreen.is-chat-open .av-hud { display: none; }
.av.is-fullscreen .av-chat-list { height: auto; flex: 1 1 auto; }
/* แผ่นเลือกวิธีเล่น + จอหมุนโทรศัพท์ */
.av-sheet { position: absolute; inset: auto 0 0 0; z-index: 9; display: grid; place-items: end center; padding: 12px 16px calc(env(safe-area-inset-bottom) + 16px); background: linear-gradient(transparent, rgba(0, 0, 0, .6)); }
.av-sheet-card { width: 100%; max-width: 380px; display: grid; gap: 8px; background: rgba(21, 21, 28, .96); border: 1px solid var(--av-border2); border-radius: 14px; padding: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); }
.av-sheet-h { margin: 0; font-weight: 700; font-size: 15px; text-align: center; }
.av-sheet .av-ov-btn { min-height: 46px; font-size: 15px; }
.av-rotate { position: fixed; inset: 0; z-index: 2147483001; display: grid; place-items: center; padding: 24px; background: rgba(5, 6, 10, .82); text-align: center; color: #f2f2f5; }
.av-rotate-card { display: grid; gap: 12px; justify-items: center; max-width: 320px; font-size: 16px; font-weight: 600; }
.av-rotate-ico { font-size: 56px; line-height: 1; }
.av-rotate-ico span { display: inline-block; animation: av-rot-phone 1.8s ease-in-out infinite; }
@keyframes av-rot-phone { 0%, 20% { transform: rotate(0); } 50%, 80% { transform: rotate(-90deg); } 100% { transform: rotate(0); } }
.av-rotate .av-ov-btn { min-height: 40px; padding: 6px 16px; border-radius: 8px; border: 1px solid #3a3a48; background: #1b1b24; color: #f2f2f5; font: inherit; font-size: 14px; }

/* ───────── จอ "พร้อมหรือยัง?" / "วิธีเล่น" (ซ้อนเต็มจอเหนือสนาม) ───────── */
.av-ready {
  position: fixed; inset: 0; z-index: 2147483002; display: grid; place-items: center; overflow-y: auto; overscroll-behavior: contain;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  background: rgba(5, 6, 10, .78); backdrop-filter: blur(3px); color: #f2f2f5; font-family: 'Prompt', 'Noto Sans Thai', system-ui, sans-serif;
}
.av-ready-card { width: min(560px, 100%); display: grid; gap: 12px; background: #15151c; border: 1px solid #3a3a48; border-radius: 16px; padding: 16px 18px; box-shadow: 0 20px 60px rgba(0, 0, 0, .6); }
.av-rd-kicker { margin: 0; color: #9a9aa8; font-size: 12.5px; }
.av-rd-title { margin: -6px 0 0; font-size: clamp(22px, 5vw, 30px); font-weight: 800; color: #ff6f8e; }
.av-rd-top { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 12px; align-items: center; }
.av-rd-preview { border-radius: 10px; overflow: hidden; border: 1px solid #2a2a35; width: 200px; height: 150px; }
.av-rd-canvas { display: block; width: 200px; height: 150px; image-rendering: pixelated; }
.av-rd-name { margin: 0 0 6px; font-weight: 700; font-size: 15px; overflow-wrap: anywhere; }
.av-rd-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 0; }
.av-rd-stats div { background: #0b0b0f; border: 1px solid #2a2a35; border-radius: 8px; padding: 4px 6px; text-align: center; }
.av-rd-stats dt { font-size: 10.5px; color: #9a9aa8; }
.av-rd-stats dd { margin: 0; font-weight: 800; color: #f5c542; font-size: 15px; }
.av-rd-sub { margin: 6px 0 0; font-size: 12.5px; color: #c8c8d4; }
.av-rd-ctl { background: #0f1015; border: 1px solid #2a2a35; border-radius: 12px; padding: 10px; }
.av-rd-keys { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; justify-content: center; }
.av-rd-wasd { display: grid; grid-template-columns: repeat(3, 42px); gap: 4px; justify-items: center; align-items: center; }
.av-rd-wasd > :nth-child(1) { grid-column: 2; grid-row: 1; }
.av-rd-wasd > :nth-child(3) { grid-column: 1; grid-row: 2; }
.av-rd-wasd > :nth-child(4) { grid-column: 2; grid-row: 2; }
.av-rd-wasd > :nth-child(5) { grid-column: 3; grid-row: 2; }
.av-rd-wasd > span { display: none; }
.av-rd-wasd em { grid-column: 1 / -1; font-style: normal; font-size: 11.5px; color: #9a9aa8; }
.av-rd-acts { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 6px; flex: 1; min-width: 220px; }
.av-try { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 4px 8px; border-radius: 8px; border: 1px solid #3a3a48; background: #1b1b24; color: #f2f2f5; font: inherit; font-size: 12.5px; cursor: pointer; }
.av-try kbd { font: inherit; font-weight: 800; font-size: 12px; min-width: 26px; text-align: center; padding: 1px 6px; border-radius: 6px; background: #0b0b0f; border: 1px solid #3a3a48; color: #f5c542; }
.av-rd-wasd .av-try { width: 42px; height: 38px; justify-content: center; padding: 0; }
.av-try:hover, .av-try.is-down { border-color: #f5c542; filter: brightness(1.25); }
.av-rd-hint { margin: 8px 0 0; font-size: 11.5px; color: #9a9aa8; text-align: center; }
.av-rd-link { background: none; border: 0; color: #f5c542; font: inherit; text-decoration: underline; cursor: pointer; padding: 0; }
.av-rd-pad { position: relative; height: 210px; }
.av-rd-joy { position: absolute; left: 16px; bottom: 16px; width: 108px; height: 108px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .25); background: radial-gradient(circle, rgba(255, 255, 255, .08) 0 55%, rgba(255, 255, 255, .03) 56%); color: #c8c8d4; font: inherit; }
.av-rd-joy small { position: absolute; left: 50%; top: calc(100% + 4px); transform: translateX(-50%); white-space: nowrap; font-size: 10.5px; }
.av-rd-knob { position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%; background: rgba(232, 69, 107, .85); }
.av-rd-cluster { position: absolute; right: 16px; bottom: 16px; width: 188px; height: 188px; }
.av-rd-cluster .av-btn { pointer-events: auto; }
.av-rd-tips { margin: 0; padding-left: 18px; display: grid; gap: 3px; font-size: 13.5px; }
.av-rd-tips li::marker { color: #e8456b; }
.av-rd-fs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.av-rd-opt { min-height: 44px; border-radius: 10px; border: 1px solid #3a3a48; background: #1b1b24; color: #f2f2f5; font: inherit; font-size: 13px; padding: 4px 8px; }
.av-rd-opt.is-on { border-color: #f5c542; color: #f5c542; background: rgba(245, 197, 66, .1); font-weight: 700; }
.av-rd-skip { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: #9a9aa8; }
.av-rd-skip input { width: 18px; height: 18px; accent-color: #e8456b; }
.av-rd-actions { display: grid; grid-template-columns: 1fr 2fr; gap: 8px; }
.av-rd-actions .av-ov-btn { min-height: 50px; padding: 6px 14px; border-radius: 10px; border: 1px solid #3a3a48; background: #1b1b24; color: #f2f2f5; font: inherit; font-size: 15px; cursor: pointer; }
.av-rd-actions .av-ov-primary { background: #e8456b; border-color: #e8456b; color: #fff; font-weight: 800; font-size: 17px; }
.av-rd-actions .av-ov-btn:only-child { grid-column: 1 / -1; }
@media (max-width: 520px) {
  .av-ready-card { padding: 12px; gap: 10px; }
  .av-rd-top { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .av-rd-stats { width: 100%; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .av-ready { place-items: start center; }
  .av-ready-card { width: min(820px, 100%); grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .av-rd-kicker, .av-rd-title, .av-rd-top { grid-column: 1; }
  .av-rd-ctl { grid-column: 2; grid-row: 1 / span 4; }
  .av-rd-top { grid-template-columns: 160px minmax(0, 1fr); }
  .av-rd-preview, .av-rd-canvas { width: 160px; height: 120px; }
  .av-rd-tips, .av-rd-fs, .av-rd-skip, .av-rd-actions { grid-column: 1 / -1; }
}
