:root { --game: #a3e635; }
.rc-stage { margin-top: 6px; padding: 0 3px; }
.bj-shell {
  max-width: 720px;
  margin: auto;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 0 32px #a3e63512;
}
.bj-shell h1 { margin: 0; font-size: clamp(1.5rem, 6vw, 2rem); }
.bj-sub { margin: 1px 0 7px; color: var(--text-dim); font-size: .8rem; }
.bj-controls, .bj-hud { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; }
.bj-controls { margin-bottom: 7px; }
.bj-controls label { color: var(--text-dim); font-size: .8rem; }
.bj-controls select, .bj-controls button {
  min-height: 40px;
  padding: 5px 8px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid #4c4c55;
  border-radius: 8px;
}
.bj-controls select { font-size: 16px; }
#reset-chips[hidden] { display: none; }
#reset-chips { font-size: .75rem; text-decoration: underline; background: transparent; }
.bj-hud { justify-content: space-between; margin-bottom: 6px; font-size: .83rem; font-weight: 700; }
#mode-label { color: var(--game); }
.bj-board {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}
.bj-dealer, .bj-hand {
  min-width: 0;
  padding: 5px 7px;
  background: #202027;
  border: 1px solid #42424b;
  border-radius: 12px;
}
.bj-dealer { min-height: 109px; }
.bj-hand-head { margin-bottom: 3px; font-size: .82rem; font-weight: 800; }
.bj-fan { display: flex; min-height: 77px; padding-right: 4px; overflow: hidden; }
.bj-card {
  position: relative;
  flex: 0 1 54px;
  min-width: 0;
  max-width: 54px;
  height: 73px;
  margin-right: -14px;
  color: #202027;
  background: #fafaf8;
  border: 1px solid #c4c4c1;
  border-radius: 7px;
  box-shadow: 1px 2px 4px #0006;
  font-family: Georgia, serif;
  animation: bj-arrive .2s ease-out both;
  animation-delay: calc(var(--i) * 100ms);
}
.bj-card.still { animation: none; }
.bj-card.red { color: #a61b30; }
.bj-card .corner { position: absolute; top: 3px; left: 4px; font-size: 13px; font-weight: 800; }
.bj-card .corner.lower { top: auto; left: auto; bottom: 3px; right: 4px; transform: rotate(180deg); }
.bj-card .center { display: grid; place-items: center; height: 100%; font-size: 27px; }
.bj-card.back { color: var(--game); background: var(--surface-2);
  border: 2px solid var(--game); }
.bj-back-mark { display: grid; place-items: center; height: 100%; font-size: 30px;
  background: repeating-linear-gradient(45deg, transparent 0 6px, #a3e63522 6px 8px); }
#message {
  min-height: 2.5em;
  margin: 5px 0;
  color: #d9f99d;
  font-size: .8rem;
  font-weight: 700;
}
.bj-hands { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; }
.bj-hands:has(> :only-child) { grid-template-columns: 1fr; }
.bj-hand { min-height: 114px; }
.bj-hand.active { outline: 2px solid var(--game); outline-offset: -2px; }
.bj-hands:not(:has(.bj-hand)) { min-height: 114px; }
.bj-result { min-height: 1.2em; color: #d9f99d; font-size: .77rem; font-weight: 800; }
.bj-bet { margin: 5px 0; color: var(--text-dim); font-size: .82rem; }
.bj-actions { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 5px; }
#play-actions { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.bj-actions[hidden] { display: none; }
.bj-action {
  min-width: 0;
  min-height: 48px;
  padding: 4px;
  color: var(--text);
  background: #303037;
  border: 1px solid #5b5b64;
  border-radius: 9px;
  font-size: .9rem;
  font-weight: 800;
  touch-action: manipulation;
}
.bj-action.primary { color: #1d2512; background: var(--game); border-color: var(--game); }
.bj-action.off { opacity: .42; }
.bj-board :focus-visible, .bj-controls :focus-visible {
  outline: 3px solid #fef08a;
  outline-offset: 1px;
}
.bj-action.pulse { animation: bj-pulse .65s ease-in-out 2; }
@keyframes bj-arrive { from { opacity: 0; transform: translateY(-13px); }
  to { opacity: 1; transform: translateY(0); } }
@keyframes bj-pulse { 50% { box-shadow: 0 0 0 5px #fef08a; } }
@media (min-width: 600px) {
  .bj-shell { padding: 16px 20px; }
  .bj-card { flex-basis: 70px; max-width: 70px; height: 96px; margin-right: -17px; }
  .bj-card .corner { font-size: 17px; }
  .bj-card .center { font-size: 39px; }
  .bj-fan { min-height: 100px; }
  .bj-dealer { min-height: 135px; }
  .bj-hand { min-height: 138px; }
  .bj-actions { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .bj-hands:not(:has(.bj-hand)) { min-height: 138px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition: none !important; }
}
#rfbLaunch { left: max(14px, env(safe-area-inset-left)) !important;
  right: auto !important; bottom: max(8px, env(safe-area-inset-bottom)) !important; }
