/* ShahGol 0.4 — one table, nearby decisions. Load after style.css, v2.css and v3.css. */
body.v4 {
  --stage-height: clamp(500px, calc(100svh - 238px), 620px);
  --table-ink: #10291f;
  --table-border: #a4b98a32;
  min-width: 320px;
  overflow-x: hidden;
  background: radial-gradient(ellipse at 50% 0, #183b2e 0, #091a14 44%, #06110e 100%);
}
.v4 [hidden] { display: none !important; }
@media (max-width:600px) { body.v4.preparing { --stage-height: clamp(340px, calc(100svh - 378px), 440px); } }
.v4 button { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.v4 button:focus-visible, .v4 a:focus-visible, .v4 summary:focus-visible {
  outline: 3px solid #ffe4a5; outline-offset: 4px;
}
.v4 button:disabled { cursor: default; }
.v4 .topbar {
  height: 68px; max-width: 1264px; padding: 0 30px; gap: 20px;
  border-color: #c3d5b617; background: transparent;
}
.v4 .brand { gap: 10px; }
.v4 .brand-mark { width: 34px; height: 34px; }
.v4 .brand-type { font-size: 27px; letter-spacing: -1px; }
.v4 .brand-type small { margin-top: 5px; font-size: 9px; }
.v4 .topbar nav { gap: 24px; margin-inline-start: auto; }
.v4 .nav-button { min-height: 44px; font-size: 13px; color: #afc0ac; }
.v4 .top-actions { gap: 8px; }
.v4 .icon-button { width: 42px; height: 42px; flex: 0 0 42px; padding: 11px; }
.v4 .prototype-tag { font-size: 9px; }
.v4 .table-shell {
  position: relative; width: 100%; max-width: 1264px; margin: 0 auto;
  padding: 12px 30px 20px; display: flex; flex-direction: column; gap: 10px;
}
.v4 .match-hud {
  display: grid; grid-template-columns: minmax(0,1fr) 156px minmax(0,1fr);
  gap: 18px; align-items: center; padding: 10px 22px; min-height: 72px;
  border: 1px solid var(--table-border); border-radius: 13px;
  background: linear-gradient(100deg,#122a20e8,#0c211ae8,#152a20e8);
  box-shadow: inset 0 1px 0 #e9e6bd04;
}
.v4 .match-hud .team-score { gap: 12px; padding: 0; flex-wrap: nowrap; }
.v4 .match-hud .team-score > div:not(.team-emblem) { min-width: 0; }
.v4 .match-hud .team-score strong { font-size: 14px; }
.v4 .match-hud .team-score small { font-size: 10px; color: #a4baa6; }
.v4 .match-hud .team-emblem { width: 34px; height: 37px; flex-shrink: 0; padding: 8px; border-radius: 8px; }
.v4 .match-hud .score, .v4 #yourScore, .v4 #theirScore { font-size: 34px; line-height: 1.15; font-variant-numeric: tabular-nums; font-weight: 600; }
.v4 .match-hud .milie { position: static; min-width: 63px; gap: 4px; padding: 4px 8px; border: 1px solid #c5a66030; background: #a78d4309; }
.v4 .match-hud .milie b { font-size: 15px; }
.v4 .match-hud .milie i { width: 14px; height: 14px; }
.v4 .match-hud .milie small { color: #c5b387; font-size: 9px; }
.v4 .match-hud .round-center { margin: 0; padding-inline: 10px; color: #bdc7ae; line-height: 1.6; }
.v4 #roundLabel { font-size: 11px; }
.v4 #stakeLabel { display: block; font-size: 10px; color: #b9c0a4; }
.v4 #countdown {
  display: inline-flex; align-items: center; justify-content: center; min-width: 54px;
  direction: ltr; font-size: 17px; font-variant-numeric: tabular-nums;
  font-weight: 600; line-height: 1.5; color: #e8d3a0;
}
.v4 #countdown.urgent { color: #ffc2a3; text-shadow: 0 0 18px #e7845055; }
.v4 #countdown.urgent::before { content: ''; width: 5px; height: 5px; margin-right: 6px; border-radius: 50%; background: #f3a47e; animation: v4-clock 1s ease-in-out infinite; }

/* Keep the arena in the page throughout every gesture. No mobile takeover. */
.v4 #arena.arena, .v4 #arena.arena.is-performing {
  position: relative; inset: auto; width: 100%; height: var(--stage-height);
  flex: 0 0 var(--stage-height); margin: 0; overflow: clip; isolation: isolate;
  border: 1px solid #b1bd823b; border-radius: 18px; z-index: 1;
  background: #142b20 url('assets/arena.png') center 35% / cover;
  box-shadow: 0 18px 50px #0005, inset 0 0 90px #03120b33;
}
.v4 .arena-vignette { background: linear-gradient(180deg,#04140c44,transparent 46%,#05160d44),linear-gradient(90deg,#06180f55,transparent 24%,transparent 76%,#06180f55); }
.v4 #arena .arena-top { inset: 16px 20px auto; gap: 12px; z-index: 9; align-items: flex-start; }
.v4 #turnBadge { font-size: 11px; padding: 6px 11px; background: #082519dc; border-color: #9cb78a40; max-width: 42%; line-height: 1.65; }
.v4 #tableTip { font-size: 10px; line-height: 1.7; color: #b7c8a8; padding-block: 6px; text-align: left; text-shadow: 0 1px 5px #04180e; }
.v4 #stageCaption, .v4 #arena.is-performing #stageCaption {
  display: block; position: absolute; inset: 15px 170px auto; z-index: 2;
  margin: 0; text-align: center; font-size: 17px; font-weight: 500; line-height: 1.8;
  color: #efe4c6; text-shadow: 0 2px 18px #071d0d;
}
.v4 #stageCaption h2 { margin: 0; font-size: 21px; line-height: 1.65; }
.v4 #stageCaption p, .v4 #stageCaption small { font-size: 11px; margin: 3px 0 0; color: #b9c8af; }
.v4 #stageCaption .caption-kicker { display: none; }
.v4 #motionCaption, .v4 #arena.is-performing #motionCaption {
  position: absolute; top: 80px; bottom: auto; left: 50%; right: auto;
  transform: translateX(-50%); width: max-content; max-width: calc(100% - 32px);
  z-index: 10; margin: 0; padding: 6px 13px; border-radius: 20px;
  background: #09291ce8; border: 1px solid #d2b87350; color: #efd9a5;
  font-size: 12px; line-height: 1.7; text-align: center; pointer-events: none;
}
.v4 #motionCaption:empty { display: none; }
.v4 #players, .v4 #arena.is-performing #players {
  left: 9%; right: 9%; bottom: 132px; z-index: 2;
  display: flex; align-items: flex-end; justify-content: space-between; direction: ltr;
}
.v4 #players .player, .v4 #arena.is-performing #players .player {
  width: 30%; max-width: 250px; min-width: 0; padding: 0; border: 0;
  border-radius: 80px 80px 12px 12px; color: #f3e8cc; background: none;
  position: relative; transform: none; transition: filter .2s; cursor: pointer;
  filter: drop-shadow(0 12px 12px #0005);
}
.v4 #players .player:nth-child(2) { transform: translateY(-8px); }
.v4 #players .player-portrait { display: block; width: 100%; height: auto; aspect-ratio: 240 / 260; overflow: visible; }
.v4 #players .player-name {
  left: 2%; right: 2%; bottom: calc(100% + 3px); top: auto;
  display: block; padding: 2px 4px; font-size: 15px; line-height: 1.7;
  background: linear-gradient(90deg,transparent,#0827199c,transparent); text-shadow: 0 2px 5px #000;
}
.v4 #players .player-name small { font-size: 10px; color: #c3c6aa; }
.v4 #players .player.selected, .v4 #players .player[aria-pressed="true"] { filter: drop-shadow(0 0 13px #d5b86d40); }
.v4 #players .player:disabled:not(.removed) { opacity: 1; cursor: default; }
.v4 #players .player.removed { opacity: .22; filter: grayscale(1); }
.v4 #players .player.removed .player-name { color: #829786; }
.v4 #arena .felt-table, .v4 #arena.is-performing .felt-table {
  left: -8%; right: -8%; bottom: -85px; height: 278px;
  border-width: 9px; transform: perspective(850px) rotateX(13deg);
  box-shadow: 0 -3px 0 #c2a76f77,0 -8px 0 #29291d,0 -11px 0 #80703e55,0 -16px 30px #0005,inset 0 0 65px #0005;
}
.v4 .table-brand { top: 100px; color: #c7c48b2e; pointer-events: none; }
.v4 .table-line { inset: 14px 20px; }
.v4 #handsLayer, .v4 #arena.is-performing #handsLayer {
  left: 9%; right: 9%; bottom: 112px; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; direction: ltr;
}
.v4 #handsLayer .hand-pair, .v4 #arena.is-performing #handsLayer .hand-pair { width: 30%; max-width: 250px; gap: 5px; }
.v4 #handsLayer .hand-button { width: calc(50% - 2px); min-width: 44px; min-height: 68px; padding: 0; border-radius: 18px; transform: none; transition: filter .18s,transform .18s; }
.v4 #handsLayer .hand-art { aspect-ratio: 120 / 100; overflow: visible; filter: drop-shadow(0 7px 5px #0007); transform-origin: center 88%; }
.v4 #handsLayer .hand-label { opacity: 1; bottom: -9px; font-size: 11px; line-height: 1.5; color: #c3ccb3; pointer-events: none; text-shadow: 0 1px 4px #000; }
.v4 #handsLayer .hand-button.selected, .v4 #handsLayer .hand-button[aria-pressed="true"] { transform: translateY(-6px); }
.v4 #handsLayer .hand-button.selected::before, .v4 #handsLayer .hand-button[aria-pressed="true"]::before { border-color: #f3d38b; background: #efc86112; box-shadow: 0 0 18px #ebc36933; }
.v4 #handsLayer .hand-button.eliminated { opacity: .32; transform: translateY(5px); }
.v4 #handsLayer .hand-button.winning { filter: drop-shadow(0 0 10px #f1d48166); }
.v4 #handsLayer .hand-button:disabled:not(.eliminated) { opacity: 1; }
.v4 .arena.is-inspecting-line .hands-layer::before { display: none; }
.v4 .motion-tag { top: -30px; max-width: 105px; font-size: 10px; padding: 2px 6px; }

/* Coordinates are the menu's top-left corner relative to the arena. The app clamps them. */
.v4 .table-menu {
  position: absolute; left: 12px; top: 128px; z-index: 30;
  width: 284px; max-width: calc(100% - 20px); padding: 10px;
  border: 1px solid #d9bc7888; border-radius: 14px;
  background: linear-gradient(145deg,#173d2cf7,#0a261dfc);
  box-shadow: 0 14px 35px #0008,inset 0 1px 0 #ffe3a515;
  backdrop-filter: blur(12px); direction: rtl; text-align: right;
  animation: v4-menu-in .16s ease-out both;
}
.v4 .context-title { min-height: 30px; display: flex; align-items: center; justify-content: space-between; gap: 8px; color: #f6dfaa; font-size: 12px; font-weight: 600; margin: 0 0 7px; padding-inline: 3px; }
.v4 .context-title button, .v4 .table-menu .menu-close { display: grid; place-items: center; padding: 7px; width: 32px; height: 32px; min-width: 32px; border: 1px solid #abc19520; border-radius: 50%; background: #071b1255; color: #bac8af; }
.v4 .context-title button svg, .v4 .table-menu .menu-close svg { width: 16px; height: 16px; }
.v4 .context-actions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; }
.v4 .context-actions button {
  min-height: 46px; padding: 8px 7px; border-radius: 8px; border: 1px solid #8ba77850;
  color: #e1e8d3; background: #284c32; font-size: 12px; font-weight: 500;
  display: flex; align-items: center; justify-content: center; gap: 6px; line-height: 1.7;
}
.v4 .context-actions button i, .v4 .context-actions button > svg { display: block; width: 17px; height: 17px; flex-shrink: 0; }
.v4 .context-actions .pick-gol { color: #26321d; background: linear-gradient(110deg,#c6a360,#edd39b); border-color: #f0d49c; font-weight: 700; }
.v4 .context-actions .pick-pooch { background: #132f24; color: #d3dcca; }
.v4 .context-actions .inspect-action { background: #284735; color: #f0e6c6; }
.v4 .context-actions .empty-action { background: #18392b; }
.v4 .context-actions button:disabled { opacity: .38; }
.v4 .table-menu > p, .v4 .table-menu > small { display: block; margin: 7px 3px 0; font-size: 10px; line-height: 1.7; color: #b9c8a9; }
.v4 .hint-bubble {
  position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%);
  z-index: 12; width: max-content; max-width: min(590px,calc(100% - 30px));
  display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 8px 14px 8px 10px;
  direction: rtl; text-align: right; color: #e6ddbc; background: #082b1eea;
  border: 1px solid #b9b47b55; border-radius: 12px; box-shadow: 0 5px 24px #0004;
  pointer-events: none;
}
.v4 .hint-speaker { display: block; flex: 0 0 42px; width: 42px; height: 44px; border-radius: 9px; overflow: hidden; background: #2d4630; }
.v4 .hint-speaker svg { width: 50px; height: 55px; margin-left: -4px; }
.v4 #hintText { margin: 0; font-size: 12px; line-height: 1.9; max-width: 53ch; }
.v4 #occlusionVeil { inset: 100px 5% 98px; z-index: 20; border-radius: 13px; background: repeating-linear-gradient(90deg,#092317,#102d1f 14px,#173323 17px,#092317 28px); }
.v4 #occlusionVeil.visible, .v4 #occlusionVeil.is-visible, .v4 #occlusionVeil[aria-hidden="false"] { opacity: 1; visibility: visible; }
.v4 #resultRibbon {
  position: absolute; top: 42%; bottom: auto; left: 50%; right: auto;
  transform: translate(-50%,-50%); z-index: 25; width: max-content;
  min-width: 240px; max-width: calc(100% - 32px); padding: 16px 26px;
  border-radius: 14px; border-color: #dfc38199; background: #0b3023f2;
  box-shadow: 0 14px 50px #0008; animation: v4-result-in .3s ease-out both;
}
.v4 #resultRibbon strong { font-size: 24px; line-height: 1.6; }
.v4 #resultRibbon small { display: block; font-size: 12px; line-height: 1.8; max-width: 46ch; }
.v4 #resultRibbon.loss { border-color: #d7957377; }

.v4 .action-dock {
  display: grid; grid-template-columns: minmax(190px,1fr) max-content max-content 48px;
  align-items: stretch; gap: 8px; padding: 8px; min-height: 66px;
  background: #102b20ed; border: 1px solid #92a87c30; border-radius: 13px;
  box-shadow: 0 8px 25px #0002;
}
.v4 .action-dock button { min-height: 48px; padding: 10px 20px; border-radius: 9px; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 13px; font-weight: 500; line-height: 1.5; background: #1d3b2a; border: 1px solid #a6ba8633; color: #d1ddbf; }
.v4 .action-dock button i, .v4 .action-dock button > svg { display: block; width: 20px; height: 20px; flex-shrink: 0; }
.v4 .action-dock #primaryButton { width: 100%; margin: 0; padding-inline: 18px; font-size: 15px; font-weight: 700; background: linear-gradient(110deg,#b68f50,#eddaa5 52%,#d7b574); border-color: #e6cb8a; color: #21301d; box-shadow: inset 0 1px 0 #fff8,0 3px 18px #d1af4022; }
.v4 .action-dock #cubeButton { border-color: #c6a55e60; color: #ecd19b; background: #b39c4f0c; min-width: 100px; }
.v4 .action-dock #replayButton { min-width: 0; padding: 12px; font-size: 0; }
.v4 .action-dock button:disabled { opacity: .4; filter: saturate(.5); box-shadow: none; }
.v4 #actionDock.examining:has(#primaryButton[hidden]) { grid-template-columns: minmax(0,1fr) minmax(0,1fr) 48px; }
.v4 .setup-bar {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 9px 16px;
  padding: 10px 14px; background: #0d221a; border: 1px solid #78946728; border-radius: 11px;
}
.v4 .setup-bar.collapsed, .v4 .setup-bar.is-collapsed { display: none; }
.v4 .setup-bar > label, .v4 .setup-bar .setup-label { font-size: 11px; color: #a6b99c; }
.v4 .setup-bar .role-switch { min-width: 220px; width: auto; flex: 0 1 240px; border-color: #7f986a33; }
.v4 .setup-bar .role-switch button { min-height: 38px; padding: 6px 12px; font-size: 12px; }
.v4 #catcherSelect, .v4 #defenseStyles .style-options, .v4 #decoyPicker { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; margin: 0; }
.v4 #catcherSelect button, .v4 #defenseStyles button, .v4 #decoyPicker button { min-height: 38px; font-size: 11px; padding: 6px 12px; background: #152f22; border: 1px solid #8ea87735; border-radius: 6px; color: #bbcdb1; flex: 0 1 auto; }
.v4 #catcherSelect button small { display: block; font-size: 9px; font-weight: 400; line-height: 1.6; color: #a9bd9d; margin-top: 1px; }
.v4 #catcherSelect button.selected, .v4 #defenseStyles button.selected, .v4 #decoyPicker button.selected,
.v4 #catcherSelect button[aria-pressed="true"], .v4 #defenseStyles button[aria-pressed="true"], .v4 #decoyPicker button[aria-pressed="true"] { background: #7d70382c; border-color: #ceb3748c; color: #f0d9a3; }
.v4 #styleDescription { font-size: 11px; line-height: 1.8; margin: 4px 0 0; color: #a9bd9d; max-width: 52ch; }
.v4 #decoyPicker > span { font-size: 10px; flex-basis: auto; }
.v4 .setup-bar .style-options { margin: 0; }
.v4 #statusLine { margin: 0; padding: 0 4px; font-size: 11px; line-height: 1.7; color: #a8bc9e; text-align: center; }
.v4 #statusLine:empty { display: none; }
.v4 .game-footer { margin: 0; padding: 3px 4px; min-height: 24px; gap: 5px 14px; font-size: 9px; line-height: 1.5; align-items: center; color: #829d85; }
.v4 .game-footer button { padding: 3px 0; font-size: 10px; line-height: 1.5; color: #aabc9e; }
.v4 #liveStatus, .v4 .sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip-path: inset(50%) !important; white-space: nowrap !important; border: 0 !important; }

.v4 #modal { max-width: 740px; width: calc(100% - 28px); border-color: #c0ac6b55; }
.v4 .modal-frame { padding: 30px; max-height: min(86svh,820px); }
.v4 .modal-frame h2 { font-size: 24px; }
.v4 .modal-frame p, .v4 .modal-frame li { font-size: 13px; }
.v4 #closeModal { width: 42px; height: 42px; left: 12px; top: 12px; z-index: 2; }
.v4 .modal-frame .card-deck, .v4 .modal-frame .cards-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 10px; margin-top: 20px; }
.v4 .modal-frame .game-card { height: auto; min-height: 160px; padding: 13px 8px; }
.v4 .modal-frame .game-card strong { font-size: 13px; }
.v4 .modal-frame .game-card small { font-size: 10px; line-height: 1.8; }
.v4 .modal-frame .card-art { width: 36px; height: 36px; }
.v4 .modal-frame .modal-options button { min-height: 46px; }
.v4 .toast { bottom: 18px; z-index: 90; max-width: calc(100% - 28px); font-size: 12px; }

/* A lift is the same action for both fists; separate SVG wrist geometry stays intact. */
.v4 #arena .hand-button.motion-line .hand-art,
.v4 #arena .hand-button.motion-raise .hand-art {
  animation: v4-line-lift var(--duration,1600ms) cubic-bezier(.24,.04,.18,1) 0ms both;
}
.v4 #arena .hand-button.motion-empty .hand-art { animation: v4-empty-show var(--duration,1700ms) ease-in-out var(--delay,0ms) both; }
.v4 #arena .hand-button.motion-pooch .hand-art { animation: v4-open-palm var(--duration,850ms) ease-out both; }
.v4 #arena .hand-button.motion-catch .hand-art, .v4 #arena .hand-button.winning .hand-art { animation: v4-catch-reveal 700ms cubic-bezier(.15,.7,.3,1) both; }
.v4 #arena.is-shuffling .hand-button:not(.motion-line):not(.motion-raise):not(.motion-empty) .hand-art { animation: v4-transfer var(--duration,1400ms) ease-in-out var(--delay,0ms) 2; }
.v4 #arena.is-performing .player.performer .player-portrait { animation: v4-shoulder var(--duration,1600ms) ease-in-out both; }
.v4 #arena .hand-button.motion-line .hand-gesture, .v4 #arena .hand-button.motion-raise .hand-gesture { animation: none; }
@keyframes v4-menu-in { from { opacity: 0; translate: 0 5px; } to { opacity: 1; translate: 0 0; } }
@keyframes v4-result-in { from { opacity: 0; scale: .94; } to { opacity: 1; scale: 1; } }
@keyframes v4-clock { 50% { opacity: .35; } }
@keyframes v4-line-lift { 0%,100% { transform: translateY(0) scale(1); } 25%,76% { transform: translateY(-58px) scale(1.07); } 86% { transform: translateY(-50px) scale(1.05); } }
@keyframes v4-empty-show { 0%,100% { transform: translateY(0) rotate(0); } 22%,48% { transform: translateY(-36px) rotate(-3deg) scale(1.08); } 64% { transform: translate(9px,-17px) rotate(5deg); } 81% { transform: translate(-7px,-12px) rotate(-3deg); } }
@keyframes v4-open-palm { 0% { transform: scale(.96); } 45% { transform: translateY(-22px) scale(1.13); } 100% { transform: translateY(-8px) scale(1.03); } }
@keyframes v4-catch-reveal { 0% { transform: translateY(0) scale(1); } 38% { transform: translateY(-25px) scale(1.16); } 70% { transform: translateY(-17px) scale(1.09); } 100% { transform: translateY(-18px) scale(1.1); } }
@keyframes v4-transfer { 0%,100% { transform: translate(0,0) rotate(0); } 30% { transform: translate(var(--transfer-x,8px),-12px) rotate(-5deg); } 60% { transform: translate(calc(var(--transfer-x,8px) * -1),-7px) rotate(4deg); } }
@keyframes v4-shoulder { 0%,100% { transform: translateY(0); } 25%,76% { transform: translateY(-3px) rotate(.5deg); } }

@media (hover:hover) {
  .v4 #players .player:hover { filter: drop-shadow(0 0 12px #e0be6130); }
  .v4 #handsLayer .hand-button:hover:not(:disabled) { transform: translateY(-6px); }
  .v4 .context-actions button:hover:not(:disabled), .v4 .action-dock button:hover:not(:disabled) { filter: brightness(1.1); }
}
@media (min-width:1600px) {
  .v4 .table-shell, .v4 .topbar { max-width: 1360px; }
  .v4 #players .player { max-width: 270px; }
  .v4 #handsLayer .hand-pair { max-width: 270px; }
}
@media (max-width:900px) {
  body.v4 { --stage-height: clamp(445px,calc(100svh - 228px),570px); }
  .v4 .topbar { padding-inline: 20px; }
  .v4 .table-shell { padding-inline: 20px; }
  .v4 #players, .v4 #arena.is-performing #players { left: 5%; right: 5%; bottom: 136px; }
  .v4 #handsLayer, .v4 #arena.is-performing #handsLayer { left: 5%; right: 5%; bottom: 113px; }
  .v4 #players .player, .v4 #arena.is-performing #players .player, .v4 #handsLayer .hand-pair, .v4 #arena.is-performing #handsLayer .hand-pair { width: 31%; max-width: 220px; }
  .v4 .match-hud { gap: 10px; padding-inline: 15px; grid-template-columns: minmax(0,1fr) 128px minmax(0,1fr); }
  .v4 .match-hud .team-emblem { display: none; }
  .v4 .match-hud .team-score { gap: 9px; }
  .v4 #stageCaption, .v4 #arena.is-performing #stageCaption { left: 140px; right: 140px; font-size: 15px; }
}
@media (max-width:600px) {
  body.v4 { --stage-height: clamp(396px,calc(100svh - 228px),514px); }
  .v4 .topbar { height: 56px; gap: 9px; padding: 0 14px; }
  .v4 .brand { gap: 7px; }
  .v4 .brand-mark { width: 27px; height: 27px; }
  .v4 .brand-type { font-size: 23px; }
  .v4 .brand-type small, .v4 .prototype-tag { display: none; }
  .v4 .topbar nav { gap: 12px; display: flex; }
  .v4 .nav-button { font-size: 11px; min-height: 44px; padding-inline: 0; }
  .v4 .top-actions { gap: 4px; }
  .v4 .topbar .icon-button { width: 36px; height: 44px; flex-basis: 36px; padding: 10px; border-color: transparent; background: none; }
  .v4 #helpButton { display: grid; }
  .v4 .table-shell { padding: 10px 10px 14px; gap: 8px; }
  .v4 .match-hud { padding: 8px 10px; min-height: 62px; border-radius: 11px; grid-template-columns: minmax(0,1fr) 88px minmax(0,1fr); gap: 5px; }
  .v4 .match-hud .team-score { gap: 3px 7px; display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; position: relative; }
  .v4 .match-hud .team-score.theirs { direction: ltr; }
  .v4 .match-hud .team-score > div:not(.team-emblem) { min-width: 0; }
  .v4 .match-hud .team-score strong { font-size: 11px; white-space: nowrap; }
  .v4 .match-hud .team-score small { font-size: 9px; }
  .v4 .match-hud .team-score .score { grid-column: 2; grid-row: 1 / 3; margin: 0; }
  .v4 .match-hud .score, .v4 #yourScore, .v4 #theirScore { font-size: 28px; }
  .v4 .match-hud .milie { grid-column: 1; padding: 0; border: 0; min-width: 0; gap: 3px; background: none; direction: rtl; justify-self: start; }
  .v4 .match-hud .theirs .milie { justify-self: end; }
  .v4 .match-hud .milie b { font-size: 11px; }
  .v4 .match-hud .milie small { font-size: 8px; display: inline; }
  .v4 .match-hud .milie i { width: 11px; height: 11px; }
  .v4 .match-hud .round-center { padding-inline: 3px; }
  .v4 #roundLabel { font-size: 9px; }
  .v4 #stakeLabel { font-size: 9px; }
  .v4 #countdown { font-size: 16px; line-height: 1.35; }
  .v4 #arena.arena, .v4 #arena.arena.is-performing { border-radius: 13px; }
  .v4 #arena .arena-top { inset: 12px 12px auto; }
  .v4 #turnBadge { font-size: 10px; padding: 4px 8px; max-width: 60%; }
  .v4 #stageCaption, .v4 #arena.is-performing #stageCaption { inset: 52px 12px auto; font-size: 14px; line-height: 1.8; }
  .v4 #stageCaption h2 { font-size: 19px; }
  .v4 #stageCaption p, .v4 #stageCaption small { font-size: 10px; }
  .v4 #motionCaption, .v4 #arena.is-performing #motionCaption { top: 108px; font-size: 11px; padding: 5px 10px; border-radius: 9px; }
  .v4 #players, .v4 #arena.is-performing #players { left: 2%; right: 2%; bottom: 136px; }
  .v4 #players .player, .v4 #arena.is-performing #players .player { width: 32%; max-width: 175px; }
  .v4 #players .player:nth-child(2) { transform: translateY(-4px); }
  .v4 #players .player-name { bottom: calc(100% + 2px); font-size: 12px; line-height: 1.6; }
  .v4 #players .player-name small { font-size: 8px; }
  .v4 #handsLayer, .v4 #arena.is-performing #handsLayer { left: 2%; right: 2%; bottom: 113px; }
  .v4 #handsLayer .hand-pair, .v4 #arena.is-performing #handsLayer .hand-pair { width: 32%; max-width: 175px; gap: 1px; }
  .v4 #handsLayer .hand-button { width: 50%; min-width: 44px; min-height: 48px; border-radius: 12px; }
  .v4 #handsLayer .hand-label { font-size: 9px; bottom: -11px; }
  .v4 #arena .felt-table, .v4 #arena.is-performing .felt-table { height: 253px; bottom: -85px; left: -18%; right: -18%; border-width: 7px; }
  .v4 .table-brand { top: 83px; font-size: 18px; }
  .v4 .table-brand small { display: none; }
  .v4 .table-menu { width: 252px; max-width: calc(100% - 18px); padding: 9px; border-radius: 11px; }
  .v4 .context-title { min-height: 28px; font-size: 11px; margin-bottom: 5px; }
  .v4 .context-title button, .v4 .table-menu .menu-close { width: 32px; height: 32px; }
  .v4 .context-actions { gap: 6px; }
  .v4 .context-actions button { font-size: 11px; min-height: 44px; gap: 5px; padding: 7px 5px; }
  .v4 .context-actions button i, .v4 .context-actions button > svg { width: 15px; height: 15px; }
  .v4 .hint-bubble { bottom: 15px; max-width: calc(100% - 22px); gap: 8px; padding: 7px 10px; min-height: 53px; width: max-content; border-radius: 10px; }
  .v4 .hint-speaker { flex-basis: 35px; width: 35px; height: 39px; }
  .v4 .hint-speaker svg { width: 43px; height: 47px; margin-left: -4px; }
  .v4 #hintText { font-size: 11px; line-height: 1.8; }
  .v4 #occlusionVeil { inset: 145px 3% 95px; padding: 16px; }
  .v4 #occlusionVeil strong { font-size: 18px; }
  .v4 #occlusionVeil p, .v4 #occlusionVeil small { font-size: 11px; }
  .v4 #resultRibbon { top: 43%; min-width: 200px; padding: 13px 17px; }
  .v4 #resultRibbon strong { font-size: 21px; }
  .v4 #resultRibbon small { font-size: 11px; max-width: 31ch; }
  .v4 .action-dock { grid-template-columns: minmax(112px,1fr) max-content max-content 39px; gap: 5px; padding: 6px; min-height: 60px; border-radius: 11px; }
  .v4 #actionDock.examining:has(#primaryButton[hidden]) { grid-template-columns: minmax(0,1fr) minmax(0,1fr) 39px; }
  .v4 .action-dock button { min-height: 46px; font-size: 11px; padding: 8px 10px; gap: 5px; border-radius: 7px; }
  .v4 .action-dock #primaryButton { font-size: 13px; padding-inline: 8px; }
  .v4 .action-dock #cubeButton { min-width: 59px; }
  .v4 .action-dock #cardsButton { min-width: 52px; }
  .v4 .action-dock #replayButton { padding: 9px; }
  .v4 .action-dock button i, .v4 .action-dock button > svg { width: 17px; height: 17px; }
  .v4 .action-dock #primaryButton i { display: none; }
  .v4 .setup-bar { gap: 8px; padding: 9px; justify-content: flex-start; }
  .v4 .setup-bar .role-switch { flex: 1 1 100%; }
  .v4 .setup-bar .role-switch button { min-height: 40px; font-size: 12px; }
  .v4 #catcherSelect, .v4 #defenseStyles { flex: 1 1 100%; }
  .v4 #catcherSelect button, .v4 #defenseStyles button { flex: 1; min-height: 40px; padding-inline: 7px; font-size: 11px; }
  .v4 #styleDescription { font-size: 10px; margin-top: 5px; }
  .v4 #decoyPicker button { min-height: 36px; padding-inline: 7px; font-size: 10px; }
  .v4 #decoyPicker > span { flex-basis: 100%; }
  .v4 .modal-frame { padding: 25px 18px; max-height: 88svh; }
  .v4 .modal-frame h2 { font-size: 22px; }
  .v4 .modal-frame p, .v4 .modal-frame li { font-size: 12px; }
  .v4 .modal-frame .card-deck, .v4 .modal-frame .cards-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
  .v4 .modal-frame .game-card { min-height: 154px; }
  .v4 .modal-frame .team-grid { gap: 7px; }
  .v4 .modal-frame .roster-player { padding: 7px; }
  .v4 .modal-frame .roster-portrait { height: 100px; }
  .v4 .modal-frame .roster-player h3 { font-size: 14px; }
}
@media (max-width:360px) {
  .v4 .topbar { padding-inline: 10px; gap: 6px; }
  .v4 .brand-type { font-size: 21px; }
  .v4 .brand-mark { width: 23px; height: 23px; }
  .v4 .topbar nav { gap: 8px; }
  .v4 .nav-button { font-size: 10px; }
  .v4 .topbar .icon-button { width: 32px; flex-basis: 32px; padding: 8px; }
  .v4 #helpButton { display: none; }
  .v4 .table-shell { padding-inline: 7px; }
  .v4 .action-dock { grid-template-columns: minmax(101px,1fr) max-content max-content 35px; gap: 4px; padding: 5px; }
  .v4 .action-dock button { padding-inline: 7px; }
  .v4 .action-dock #primaryButton { font-size: 12px; }
  .v4 .action-dock #cardsButton i { display: none; }
  .v4 .match-hud { padding-inline: 8px; grid-template-columns: minmax(0,1fr) 80px minmax(0,1fr); }
}
@media (max-height:720px) and (min-width:601px) {
  body.v4 { --stage-height: 420px; }
  .v4 .topbar { height: 56px; }
  .v4 .match-hud { min-height: 60px; padding-block: 7px; }
  .v4 #players .player, .v4 #arena.is-performing #players .player { max-width: 205px; }
  .v4 #players, .v4 #arena.is-performing #players { bottom: 118px; }
  .v4 #players .player-name { bottom: calc(100% - 16px); font-size: 13px; line-height: 1.5; }
  .v4 #players .player-name small { font-size: 9px; line-height: 1.5; }
  .v4 #handsLayer, .v4 #arena.is-performing #handsLayer { bottom: 98px; }
  .v4 #handsLayer .hand-pair { max-width: 205px; }
  .v4 #motionCaption, .v4 #arena.is-performing #motionCaption { top: 62px; }
}
@media (prefers-reduced-motion:reduce) {
  .v4 *, .v4 *::before, .v4 *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .v4 #arena .hand-button.motion-line .hand-art, .v4 #arena .hand-button.motion-raise .hand-art { transform: translateY(-28px); outline: 2px solid #e9cb88; outline-offset: -3px; }
  .v4 #arena .hand-button.motion-empty .hand-art { outline: 2px solid #e9cb88; outline-offset: -3px; }
  .v4 #arena.arena.is-performing { position: relative; inset: auto; height: var(--stage-height); box-shadow: 0 18px 50px #0005; }
}
