:root {
  color-scheme: dark;
  --room-black: #101516;
  --room-raised: #171d1e;
  --room-line: #2b3334;
  --walnut: #4a2c21;
  --walnut-dark: #241712;
  --walnut-light: #7a4b34;
  --felt: #147565;
  --cushion: #0d5c50;
  --ivory: #f1e8d5;
  --muted: #c2cbc8;
  --poolla-white: #fdfdfd;
  --poolla-teal: #06afab;
  --poolla-gold: #e4af4a;
  --brass: #e4af4a;
  --brass-pale: #f2c76d;
  --oxblood: #8d3b32;
  --ball-size: 2.25%;
  --pocket-size: 4.5625%;
  --header-height: 68px;
  font-family: "Manrope", system-ui, sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--room-black);
}

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  color: var(--ivory);
  background:
    radial-gradient(ellipse at 50% 28%, rgba(45, 66, 64, 0.24), transparent 48%),
    linear-gradient(180deg, #121819 0%, var(--room-black) 46%, #0d1112 100%);
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--brass-pale);
  outline-offset: 3px;
}

button,
label,
input[type="color"] {
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
}

.room-header {
  position: relative;
  z-index: 30;
  min-height: var(--header-height);
  padding: 0 clamp(18px, 3vw, 48px);
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto minmax(260px, 1fr);
  align-items: center;
  gap: 24px;
  border-bottom: 1px solid rgba(199, 154, 85, 0.18);
  background: rgba(16, 21, 22, 0.88);
  backdrop-filter: blur(18px);
}

.brand,
.room-presence,
.room-identity {
  display: flex;
  align-items: center;
}

.brand {
  min-width: 0;
  gap: 12px;
}

.brand-mark {
  width: 35px;
  height: 35px;
  flex: 0 0 auto;
  object-fit: contain;
}

.brand-name {
  display: inline-flex;
  align-items: baseline;
  font-family: "Manrope", system-ui, sans-serif;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.055em;
  white-space: nowrap;
}

.brand-pool {
  color: var(--poolla-white);
}

.brand-la {
  color: var(--poolla-teal);
}

.preview-label {
  margin-left: 4px;
  padding-left: 14px;
  border-left: 1px solid var(--room-line);
  color: #b9c3c0;
  font-family: "Barlow Condensed", "Manrope", sans-serif;
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}

.room-identity {
  min-width: 210px;
  height: 36px;
  justify-content: center;
  gap: 8px;
  padding: 0 13px;
  border: 1px solid #313a3b;
  background: #151b1c;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease;
}

.room-identity:hover {
  border-color: rgba(199, 154, 85, 0.62);
  background: #192020;
}

.room-identity svg {
  width: 15px;
  height: 15px;
  margin-left: 5px;
  fill: none;
  stroke: #7e8986;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.room-kicker,
.room-id,
.room-slash {
  font-family: "Barlow Condensed", "Manrope", sans-serif;
  font-size: 11px;
  letter-spacing: 0.04em;
}

.room-kicker {
  color: #b9c3c0;
  text-transform: uppercase;
}

.room-slash { color: var(--brass); }
.room-id { color: var(--ivory); }

.room-presence {
  justify-self: end;
  justify-content: flex-end;
  gap: 12px;
}

.sync-state,
.player-count,
.shared-key {
  color: #c5cecb;
  font-family: "Barlow Condensed", "Manrope", sans-serif;
  font-size: 9px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  white-space: nowrap;
}

.sync-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.sync-state i,
.table-state i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #5dbf8b;
  box-shadow: 0 0 0 4px rgba(93, 191, 139, 0.09);
}

.avatar-stack {
  display: flex;
  padding-left: 8px;
}

.avatar {
  width: 30px;
  height: 30px;
  margin-left: -8px;
  display: grid;
  place-items: center;
  border: 2px solid var(--room-black);
  border-radius: 50%;
  color: #f8f3e9;
  background: #5f526e;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.avatar-current { background: #a2683f; }
.avatar-blue { background: #386d82; }
.avatar-red { background: #7e4440; }

.icon-button {
  width: 36px;
  height: 36px;
  padding: 8px;
  display: grid;
  place-items: center;
  border: 1px solid #303839;
  border-radius: 0;
  color: #9da7a4;
  background: transparent;
  cursor: pointer;
  transition: color 150ms ease, border-color 150ms ease, background 150ms ease;
}

.icon-button:hover {
  color: var(--ivory);
  border-color: #596261;
  background: rgba(255, 255, 255, 0.03);
}

.icon-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.table-room {
  width: min(100%, 1560px);
  min-height: calc(100dvh - var(--header-height));
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.control-rail {
  position: relative;
  z-index: 20;
  min-height: 72px;
  margin: 0 clamp(12px, 2vw, 34px);
  padding: 10px 0;
  display: flex;
  align-items: center;
  gap: 17px;
  border-bottom: 1px solid var(--room-line);
}

.control-cluster {
  display: flex;
  align-items: center;
  gap: 10px;
}

.control-caption {
  color: #bdc7c4;
  font-family: "Barlow Condensed", "Manrope", sans-serif;
  font-size: 8px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
}

.segmented-control {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid #30393a;
  background: #141a1b;
}

.segment {
  min-height: 38px;
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 0;
  border-right: 1px solid #2b3334;
  color: #939d99;
  background: transparent;
  font-family: "Barlow Condensed", "Arial Narrow", sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.055em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.segment:last-child { border-right: 0; }

.segment svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.35;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.segment:hover {
  color: var(--ivory);
  background: rgba(255, 255, 255, 0.03);
}

.segment.is-active {
  color: #191715;
  background: var(--brass);
  box-shadow: inset 0 0 0 1px rgba(255, 243, 214, 0.16);
}

.compact .segment {
  min-width: 42px;
  padding-inline: 10px;
  font-size: 14px;
}

.camera-cluster {
  gap: 7px;
}

.camera-select-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.camera-select {
  height: 38px;
  padding: 0 24px 0 9px;
  border: 1px solid #30393a;
  border-radius: 0;
  color: #a7b0ad;
  background: #141a1b;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.045em;
  text-transform: uppercase;
  transition: opacity 140ms ease, border-color 140ms ease;
}


.camera-select:focus-visible {
  outline: 2px solid var(--brass-pale);
  outline-offset: 3px;
}

.table-style-wrap {
  position: relative;
  flex: 0 0 auto;
}

.table-style-button {
  height: 42px;
  min-width: 154px;
  padding: 0 10px 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid #30393a;
  color: var(--ivory);
  background: #141a1b;
  cursor: pointer;
}

.table-style-button > span {
  display: grid;
  gap: 3px;
  text-align: left;
}

.table-style-button small {
  color: #737e7a;
  font-family: "Barlow Condensed", "Manrope", sans-serif;
  font-size: 7px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.table-style-button strong {
  max-width: 124px;
  overflow: hidden;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.045em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.table-style-button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: var(--brass);
  stroke-width: 1.5;
  transition: transform 150ms ease;
}

.table-style-button[aria-expanded="true"] {
  border-color: rgba(199, 154, 85, 0.75);
}

.table-style-button[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.table-style-popover {
  position: absolute;
  left: 0;
  top: calc(100% + 9px);
  z-index: 90;
  width: 300px;
  padding: 18px;
  border: 1px solid #4b514e;
  background: rgba(20, 26, 27, 0.98);
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(16px);
}

.style-popover-heading {
  margin-bottom: 16px;
  padding-bottom: 12px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 1px solid #303838;
}

.style-popover-heading strong {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 16px;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.style-popover-heading small {
  color: var(--brass);
  font-family: "Barlow Condensed", "Manrope", sans-serif;
  font-size: 7px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.style-option {
  display: grid;
  gap: 10px;
}

.style-option + .style-option {
  margin-top: 18px;
}

.table-style-popover .control-caption {
  display: block;
}

.rail-divider {
  align-self: stretch;
  width: 1px;
  margin-block: 7px;
  background: #2a3233;
}

.rail-spacer { flex: 1; }

.felt-options {
  display: flex;
  align-items: center;
  gap: 7px;
}

.felt-swatch,
.custom-felt {
  position: relative;
  width: 25px;
  height: 25px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid #47504f;
  border-radius: 50%;
  background: var(--swatch);
  cursor: pointer;
}

.felt-swatch::after {
  content: "";
  position: absolute;
  inset: -4px;
  border: 1px solid transparent;
  border-radius: 50%;
  transition: border-color 140ms ease;
}

.felt-swatch.is-active::after {
  border-color: var(--brass-pale);
}

.custom-felt {
  overflow: hidden;
  color: #78817f;
  background: #171e1f;
  font-size: 16px;
}

.custom-felt input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.shared-key {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.shared-key span {
  width: 13px;
  height: 1px;
  background: var(--brass);
}

.guide-toggle {
  min-width: 178px;
  height: 42px;
  padding: 0 8px 0 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-left: 1px solid #31393a;
  cursor: pointer;
}

.guide-copy {
  display: grid;
  line-height: 1.1;
}

.guide-copy strong {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.guide-copy small {
  margin-top: 4px;
  color: #bdc7c4;
  font-family: "Barlow Condensed", "Manrope", sans-serif;
  font-size: 7px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.guide-toggle input,
.small-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle-track {
  position: relative;
  width: 38px;
  height: 21px;
  flex: 0 0 auto;
  border: 1px solid #53605d;
  border-radius: 20px;
  background: #202727;
  transition: background 150ms ease, border-color 150ms ease;
}

.toggle-track i {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #87908e;
  transition: transform 170ms ease, background 170ms ease;
}

.guide-toggle input:checked + .toggle-track {
  border-color: var(--brass);
  background: rgba(199, 154, 85, 0.22);
}

.guide-toggle input:checked + .toggle-track i {
  background: var(--brass-pale);
  transform: translateX(17px);
}

.guide-toggle input:focus-visible + .toggle-track {
  outline: 2px solid var(--brass-pale);
  outline-offset: 3px;
}

.table-stage {
  min-width: 0;
  padding: 12px clamp(14px, 2.2vw, 34px) 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.table-meta {
  width: min(100%, 1240px);
  margin: 0 auto 8px;
  padding-right: 112px;
  display: flex;
  align-items: center;
  gap: 16px;
  color: #b8c2bf;
  font-family: "Barlow Condensed", "Manrope", sans-serif;
  font-size: 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.table-meta span + span::before {
  content: "/";
  margin-right: 16px;
  color: #45504e;
}

.table-meta .table-state {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #d1d8d5;
}

.table-meta .table-state::before { display: none; }

.table-and-shot-controls {
  width: min(100%, 1240px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 94px;
  align-items: center;
  gap: 18px;
}

.table-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 1.86 / 1;
  overflow: hidden;
  border: 1px solid #343d3d;
  border-radius: clamp(7px, 0.8vw, 12px);
  background:
    radial-gradient(ellipse at 50% 45%, rgba(37, 56, 53, 0.18), transparent 58%),
    #090d0e;
  box-shadow:
    0 38px 70px rgba(0, 0, 0, 0.55),
    0 10px 18px rgba(0, 0, 0, 0.34);
  touch-action: none;
  cursor: crosshair;
}

.table-viewport.mode-place {
  cursor: grab;
}

.table-viewport.mode-place:active {
  cursor: grabbing;
}

body.pov-camera .table-viewport.is-dragging-ball,
body.pov-camera .table-viewport.is-dragging-ball .three-canvas {
  cursor: none;
}

.table-viewport.mode-remove {
  cursor: not-allowed;
}

.table-viewport.is-moving {
  cursor: default;
}

.three-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: auto;
}

.pov-pointer-locked .three-canvas {
  cursor: none;
}
.ball {
  position: absolute;
  left: calc(var(--ball-x) * 1%);
  top: calc(var(--ball-y) * 1%);
  width: var(--ball-size);
  aspect-ratio: 1;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: #17191a;
  background: var(--ball-color);
  box-shadow:
    0 calc(var(--ball-shadow, 4px) * 0.8) var(--ball-shadow, 4px) rgba(2, 15, 12, 0.55),
    inset -3px -4px 6px rgba(0,0,0,0.28),
    inset 2px 2px 5px rgba(255,255,255,0.28);
  transform: translate(-50%, -50%) rotate(var(--ball-rotation, 0rad));
  cursor: inherit;
  user-select: none;
  touch-action: none;
  transition: filter 100ms ease, opacity 180ms ease, box-shadow 100ms ease;
}

.ball::before {
  content: "";
  position: absolute;
  left: 18%;
  top: 11%;
  width: 30%;
  height: 22%;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(255,255,255,0.88), rgba(255,255,255,0.17) 55%, transparent 72%);
  transform: rotate(-28deg);
  filter: blur(0.2px);
}

.ball:hover {
  filter: brightness(1.07);
}

.ball:focus-visible {
  z-index: 20;
  outline: 2px solid #fff4cb;
  outline-offset: 3px;
}

.ball.striped {
  background:
    linear-gradient(to bottom, #efe8d9 0 22%, var(--ball-color) 23% 76%, #f3ecdc 77% 100%);
}

.ball.cue-ball {
  background:
    radial-gradient(circle at 32% 26%, rgba(255,255,255,0.98) 0 8%, transparent 19%),
    radial-gradient(circle at 45% 42%, #fffdf4 0 42%, #e2dbc9 76%, #b8af9c 100%);
}

.ball.cue-ball::after {
  content: "";
  position: absolute;
  width: 13%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #b6473f;
  box-shadow: 0 0 0 1px rgba(90, 29, 24, 0.35);
  transform: translate(88%, -68%);
}

.ball-number {
  position: relative;
  z-index: 2;
  width: 44%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #151718;
  background: #f5efe2;
  font-family: "Arial", sans-serif;
  font-size: clamp(5px, 0.7vw, 10px);
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 0 0 0.5px rgba(25,25,25,0.22);
}

.ball.is-dragging {
  z-index: 25;
  filter: brightness(1.12);
  box-shadow:
    0 10px 12px rgba(2, 15, 12, 0.42),
    inset -3px -4px 6px rgba(0,0,0,0.24),
    inset 2px 2px 5px rgba(255,255,255,0.38);
}

.ball.is-falling {
  z-index: 16;
  opacity: 0;
  filter: brightness(0.22);
  transform: translate(-50%, -50%) rotate(var(--ball-rotation, 0rad)) scale(0.26);
  transition:
    transform 360ms cubic-bezier(.3,.05,.7,.24),
    opacity 320ms ease-in,
    filter 320ms ease-in;
}

.local-shooter-badge {
  position: absolute;
  top: 2.5%;
  left: 50%;
  z-index: 14;
  padding: 5px 12px 6px;
  border: 1px solid rgba(242, 199, 109, 0.58);
  color: #f6ead2;
  background: rgba(8, 17, 17, 0.82);
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.32);
  font-family: "Barlow Condensed", "Manrope", sans-serif;
  font-size: clamp(10px, 0.68vw, 12px);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transform: translateX(-50%);
  pointer-events: none;
  white-space: nowrap;
}

.local-shooter-badge[hidden] {
  display: none;
}

.surface-hint {
  position: absolute;
  left: 50%;
  bottom: 5.5%;
  z-index: 12;
  padding: 7px 12px;
  border: 1px solid rgba(242, 199, 109, 0.62);
  color: #fff8e8;
  background: rgba(8, 17, 17, 0.9);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.34);
  font-family: "Barlow Condensed", "Manrope", sans-serif;
  font-size: clamp(10px, 0.72vw, 12px);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transform: translateX(-50%);
  pointer-events: none;
  white-space: nowrap;
  transition: opacity 180ms ease;
}

.table-viewport:hover .surface-hint { opacity: 0.9; }

body.pov-camera .surface-hint {
  border-color: var(--brass-pale);
  color: #151919;
  background: #f2c76d;
  box-shadow: 0 7px 24px rgba(0, 0, 0, 0.46);
  font-size: clamp(11px, 0.8vw, 13px);
}

body.pov-pointer-locked .surface-hint { opacity: 1; }

.shot-console {
  align-self: stretch;
  min-height: 100%;
  padding-block: clamp(4px, 1vw, 12px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 22px;
}

.spin-module,
.swing-module {
  padding-left: 12px;
  border-left: 1px solid #30393a;
}

.module-heading {
  margin-bottom: 10px;
  display: grid;
  gap: 2px;
}

.module-heading span {
  color: #d0d7d4;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.module-heading small {
  color: #c4ccca;
  font-family: "Barlow Condensed", "Manrope", sans-serif;
  font-size: 9px;
}

.spin-ball {
  position: relative;
  width: 66px;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid #c9c1b0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 28%, #fffdf5 0 8%, transparent 22%),
    radial-gradient(circle at 45% 40%, #f4efe2, #d1c9b7 72%, #9a9181 100%);
  box-shadow: 0 6px 12px rgba(0,0,0,0.28), inset -5px -7px 10px rgba(50,45,36,0.12);
  cursor: crosshair;
  touch-action: none;
}

.spin-axis {
  position: absolute;
  background: rgba(46, 56, 55, 0.2);
  pointer-events: none;
}

.spin-axis-x { left: 12%; right: 12%; top: 50%; height: 1px; }
.spin-axis-y { top: 12%; bottom: 12%; left: 50%; width: 1px; }

.spin-dot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 9px;
  height: 9px;
  border: 2px solid #f1c77e;
  border-radius: 50%;
  background: #6c322f;
  box-shadow: 0 1px 3px rgba(0,0,0,0.36);
  transform: translate(-50%, -50%);
}

.spin-labels {
  width: 66px;
  margin-top: 6px;
  display: flex;
  justify-content: space-between;
  color: #626c69;
  font-family: "Barlow Condensed", "Manrope", sans-serif;
  font-size: 6px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.spin-help {
  display: block;
  width: 76px;
  margin-top: 8px;
  color: #d5dcda;
  font-family: "Barlow Condensed", "Manrope", sans-serif;
  font-size: 8px;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  text-transform: uppercase;
}

.spin-help kbd {
  display: inline-grid;
  min-width: 18px;
  height: 18px;
  margin-right: 3px;
  place-items: center;
  border: 1px solid var(--brass-pale);
  border-radius: 3px;
  color: #151919;
  background: var(--brass-pale);
  font: 700 11px/1 "Barlow Condensed", sans-serif;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.34);
}

body.pov-tip-adjusting .spin-help {
  color: #fff8e8;
}

.swing-module {
  min-height: 140px;
}

.swing-gesture {
  position: relative;
  width: 67px;
  height: 82px;
  border-top: 1px solid #394241;
  border-bottom: 1px solid #394241;
}

.swing-path {
  position: absolute;
  left: 31px;
  top: 8px;
  bottom: 8px;
  width: 1px;
  background: linear-gradient(to bottom, #495351, var(--brass), #495351);
}

.swing-path::before,
.swing-path::after {
  content: "";
  position: absolute;
  left: 50%;
  width: 6px;
  height: 6px;
  border-left: 1px solid var(--brass-pale);
  border-top: 1px solid var(--brass-pale);
}

.swing-path::before {
  top: -1px;
  transform: translateX(-50%) rotate(45deg);
}

.swing-path::after {
  bottom: -1px;
  transform: translateX(-50%) rotate(225deg);
}

.swing-mouse {
  position: absolute;
  left: 23px;
  top: 29px;
  z-index: 2;
  width: 17px;
  height: 25px;
  border: 1px solid #9ca6a2;
  border-radius: 9px 9px 7px 7px;
  background: #151b1c;
  transition: transform 100ms linear, border-color 140ms ease;
}

.swing-mouse i {
  position: absolute;
  left: 50%;
  top: 4px;
  width: 1px;
  height: 6px;
  background: var(--brass);
  transform: translateX(-50%);
}

.swing-module.is-tracking .swing-mouse {
  border-color: var(--brass-pale);
  animation: swing-ready 700ms ease-in-out infinite alternate;
}

.swing-module.is-armed .swing-mouse {
  animation-duration: 320ms;
}

@keyframes swing-ready {
  from { transform: translateY(-12px); }
  to { transform: translateY(12px); }
}

.swing-help {
  display: block;
  width: 67px;
  margin-top: 7px;
  color: #d5dcda;
  font-family: "Barlow Condensed", "Manrope", sans-serif;
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.035em;
  line-height: 1.4;
  text-align: center;
  text-transform: uppercase;
}

.prototype-stamp {
  width: min(100%, 1240px);
  margin: 8px auto 0;
  padding-right: 112px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 7px;
  color: #9da8a4;
  font-family: "Barlow Condensed", "Manrope", sans-serif;
  font-size: 7px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.prototype-stamp i {
  width: 16px;
  height: 1px;
  background: #816642;
}

.return-rail {
  min-height: 94px;
  margin: 0 clamp(12px, 2vw, 34px);
  padding: 11px 0 13px;
  display: grid;
  grid-template-columns: minmax(190px, 0.7fr) minmax(220px, 1.25fr) auto;
  align-items: center;
  gap: 22px;
  border-top: 1px solid var(--room-line);
}

.return-heading {
  display: flex;
  align-items: center;
  gap: 12px;
}

.return-heading > div {
  display: grid;
  gap: 3px;
}

.return-heading strong {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.return-heading small {
  max-width: 240px;
  color: #697471;
  font-size: 8px;
  line-height: 1.35;
}

.return-icon {
  position: relative;
  width: 31px;
  height: 31px;
  flex: 0 0 auto;
  border: 1px solid #3b4544;
}

.return-icon::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 7px;
  width: 9px;
  height: 9px;
  border: 1px solid var(--brass);
  border-radius: 50%;
}

.return-icon::after {
  content: "";
  position: absolute;
  right: 6px;
  bottom: 7px;
  width: 10px;
  height: 6px;
  border-right: 1px solid #8f9996;
  border-bottom: 1px solid #8f9996;
}

.ball-trough {
  position: relative;
  min-width: 220px;
  min-height: 47px;
  padding: 7px 15px;
  display: flex;
  align-items: center;
  gap: 7px;
  overflow-x: auto;
  border: 1px solid #2e2824;
  border-radius: 3px 3px 18px 18px;
  background:
    linear-gradient(to bottom, rgba(255,255,255,0.035), transparent 25%),
    linear-gradient(180deg, #251a15, #120f0d);
  box-shadow: inset 0 7px 10px rgba(0,0,0,0.52), 0 1px rgba(255,255,255,0.035);
  scrollbar-width: thin;
}

.ball-trough::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 4px;
  height: 1px;
  background: rgba(199, 154, 85, 0.13);
  pointer-events: none;
}

.trough-empty {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  color: #5e5d57;
  font-family: "Barlow Condensed", "Manrope", sans-serif;
  font-size: 7px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.trough-empty span {
  width: 14px;
  height: 14px;
  border: 1px dashed #484944;
  border-radius: 50%;
}

.ball.tray-ball {
  position: relative;
  left: auto;
  top: auto;
  width: 29px;
  min-width: 29px;
  flex: 0 0 29px;
  --ball-shadow: 3px;
  transform: none;
  cursor: pointer;
}

.ball.tray-ball .ball-number { font-size: 7px; }

.rack-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.rack-segments .segment {
  min-width: 40px;
  height: 40px;
  padding-inline: 9px;
  display: grid;
  grid-template-columns: auto auto;
  gap: 3px;
}

.rack-segments .segment strong {
  font-family: "Barlow Condensed", "Manrope", sans-serif;
  font-size: 11px;
}

.rack-segments .segment span {
  color: inherit;
  font-size: 8px;
}

.rack-button,
.reset-button,
.primary-button {
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 0;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.065em;
  text-transform: uppercase;
  cursor: pointer;
}

.rack-button {
  padding: 0 14px;
  border: 1px solid rgba(199, 154, 85, 0.62);
  color: var(--brass-pale);
  background: rgba(199, 154, 85, 0.08);
}

.rack-button:hover { background: rgba(199, 154, 85, 0.15); }

.rack-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.35;
}

.reset-button {
  padding: 0 13px;
  border: 1px solid #3a4141;
  color: #8d9693;
  background: transparent;
}

.reset-button:hover {
  color: #d7d1c4;
  border-color: #626a68;
}

.rotate-notice {
  display: none;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  padding: 24px;
  display: grid;
  place-items: center;
  background: rgba(7, 10, 10, 0.78);
  backdrop-filter: blur(12px);
}

.entry-card {
  width: min(100%, 760px);
  min-height: 430px;
  display: grid;
  grid-template-columns: minmax(245px, 0.8fr) minmax(330px, 1.2fr);
  overflow: hidden;
  border: 1px solid #4a4d47;
  background: #171c1d;
  box-shadow: 0 34px 90px rgba(0,0,0,0.6);
}

.entry-visual {
  position: relative;
  overflow: hidden;
  padding: 30px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background:
    radial-gradient(circle at 64% 32%, rgba(63, 158, 137, 0.32), transparent 25%),
    linear-gradient(145deg, #244b43 0%, #12392f 42%, #11221f 100%);
}

.entry-visual::before {
  content: "";
  position: absolute;
  inset: -20% -65% 42% 14%;
  border: 18px solid rgba(78, 46, 32, 0.95);
  border-radius: 8px;
  background: var(--felt);
  box-shadow: 0 30px 50px rgba(0,0,0,0.4), inset 0 0 0 7px var(--cushion);
  transform: rotate(-22deg);
}

.entry-visual::after {
  content: "";
  position: absolute;
  left: 38%;
  top: 20%;
  width: 18px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #f0e7d4;
  box-shadow: 23px 11px #d1aa31, 46px 22px #7f302f, 23px 33px #2c63a0;
}

.entry-brand-mark {
  position: absolute;
  left: 28px;
  top: 28px;
  z-index: 2;
  width: 84px;
  height: 84px;
  object-fit: contain;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.35));
}

.entry-wordmark {
  position: relative;
  z-index: 2;
  display: inline-flex;
  font-family: "Manrope", system-ui, sans-serif;
  font-size: 31px;
  font-weight: 750;
  line-height: 1;
  letter-spacing: -0.06em;
}

.entry-form {
  padding: clamp(32px, 5vw, 58px);
  align-self: center;
}

.entry-kicker {
  display: block;
  margin-bottom: 12px;
  color: var(--brass);
  font-family: "Barlow Condensed", "Manrope", sans-serif;
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.entry-form h1,
.settings-header h2 {
  margin: 0;
  font-family: "Barlow Condensed", sans-serif;
  font-size: clamp(34px, 4vw, 48px);
  font-weight: 600;
  line-height: 0.95;
  letter-spacing: -0.015em;
  text-transform: uppercase;
}

.entry-form p {
  margin: 17px 0 24px;
  color: #9ba4a1;
  font-size: 12px;
  line-height: 1.65;
}

.entry-form label,
.settings-card form > label {
  display: block;
  margin-bottom: 8px;
  color: #b8c0bd;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.room-input-wrap {
  height: 45px;
  display: flex;
  align-items: center;
  border: 1px solid #46504e;
  background: #111718;
}

.room-input-wrap:focus-within { border-color: var(--brass); }

.room-input-wrap span {
  padding-left: 12px;
  color: #636e6b;
  font-family: "Barlow Condensed", "Manrope", sans-serif;
  font-size: 10px;
}

.room-input-wrap input,
.text-input {
  min-width: 0;
  color: var(--ivory);
  border: 0;
  background: transparent;
  outline: 0;
  font-family: "Barlow Condensed", "Manrope", sans-serif;
  font-size: 11px;
}

.room-input-wrap input {
  flex: 1;
  height: 100%;
  padding: 0 12px 0 0;
}

.text-input {
  width: 100%;
  height: 45px;
  padding: 0 12px;
  border: 1px solid #46504e;
  background: #111718;
}

.text-input:focus { border-color: var(--brass); }

.primary-button {
  width: 100%;
  height: 45px;
  margin-top: 14px;
  padding: 0 16px;
  justify-content: space-between;
  border: 1px solid var(--brass);
  color: #171512;
  background: var(--brass);
}

.primary-button:hover { background: var(--brass-pale); }
.primary-button span { font-size: 17px; }

.settings-card {
  width: min(100%, 490px);
  padding: 32px;
  border: 1px solid #454d4c;
  background: #171c1d;
  box-shadow: 0 34px 90px rgba(0,0,0,0.6);
}

.settings-header {
  margin-bottom: 29px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.settings-header .entry-kicker { margin-bottom: 8px; }
.settings-header h2 { font-size: 31px; }

.close-button {
  font-family: "Manrope", sans-serif;
  font-size: 21px;
  font-weight: 300;
}

.field-note {
  margin: -2px 0 10px;
  color: #b8c2bf;
  font-size: 10px;
}

.license-notice {
  margin: 18px 0 0;
  padding-top: 14px;
  border-top: 1px solid #2f3737;
  color: #aeb8b5;
  font-size: 9px;
  line-height: 1.6;
}

.license-notice a {
  color: #c7a46c;
  text-underline-offset: 2px;
}

.settings-row {
  min-height: 62px;
  margin-top: 14px;
  padding: 12px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid #2f3737;
}

.settings-row > div { display: grid; gap: 4px; }
.settings-row strong { font-size: 11px; font-weight: 600; }
.settings-row small { color: #737d7a; font-size: 8px; }

.small-switch {
  position: relative;
  width: 34px;
  height: 19px;
}

.small-switch span {
  position: absolute;
  inset: 0;
  border: 1px solid #505b58;
  border-radius: 20px;
  background: #202727;
}

.small-switch span::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #7d8784;
  transition: transform 150ms ease, background 150ms ease;
}

.small-switch input:checked + span { border-color: var(--brass); }
.small-switch input:checked + span::after { background: var(--brass-pale); transform: translateX(15px); }

.confirm-popover {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 120;
  width: min(calc(100% - 32px), 350px);
  padding: 25px;
  border: 1px solid #6d5143;
  background: #1c1a19;
  box-shadow: 0 24px 70px rgba(0,0,0,0.7);
  transform: translate(-50%, -50%);
}

.confirm-popover::before {
  content: "";
  position: fixed;
  inset: -100vh -100vw;
  z-index: -1;
  background: rgba(5,7,7,0.7);
  backdrop-filter: blur(5px);
}

.confirm-popover > strong {
  display: block;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 25px;
  font-weight: 600;
  text-transform: uppercase;
}

.confirm-popover p { margin: 9px 0 20px; color: #8f9895; font-size: 10px; }
.confirm-popover > div { display: flex; justify-content: flex-end; gap: 8px; }
.confirm-popover button { height: 36px; padding: 0 13px; border: 1px solid #4a5150; background: transparent; font-size: 10px; cursor: pointer; }
.confirm-popover button:last-child { border-color: var(--oxblood); background: var(--oxblood); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 150;
  min-width: 260px;
  max-width: calc(100% - 32px);
  padding: 12px 16px;
  border-left: 2px solid var(--brass);
  color: #e9e2d3;
  background: rgba(20, 26, 26, 0.94);
  box-shadow: 0 12px 30px rgba(0,0,0,0.4);
  font-size: 10px;
  text-align: center;
  transform: translateX(-50%);
  backdrop-filter: blur(8px);
}

.table-state.is-moving i {
  background: var(--brass);
  box-shadow: 0 0 0 4px rgba(199, 154, 85, 0.1);
}

body.livestream-mode {
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 48%, rgba(42, 60, 58, 0.24), transparent 52%),
    #090d0e;
}

.livestream-mode .room-header,
.livestream-mode .control-rail,
.livestream-mode .table-meta,
.livestream-mode .shot-console,
.livestream-mode .prototype-stamp,
.livestream-mode .return-rail,
.livestream-mode .rotate-notice,
.livestream-mode .modal-backdrop,
.livestream-mode .confirm-popover,
.livestream-mode .toast,
.livestream-mode .surface-hint,
.livestream-mode .local-shooter-badge {
  display: none !important;
}

.livestream-mode .app-shell,
.livestream-mode .table-room {
  width: 100vw;
  min-height: 100vh;
  min-height: 100dvh;
}

.livestream-mode .table-room {
  display: block;
}

.livestream-mode .table-stage {
  width: 100vw;
  min-height: 100vh;
  min-height: 100dvh;
  padding: clamp(10px, 2.2vmin, 30px);
  display: grid;
  place-items: center;
}

.livestream-mode .table-and-shot-controls {
  width: min(96vw, 184vh);
  width: min(96vw, 184dvh);
  display: block;
  margin: 0;
}

.livestream-mode .table-viewport {
  width: 100%;
}

.livestream-mode,
.livestream-mode .table-viewport {
  cursor: none;
}

.livestream-mode .three-canvas {
  pointer-events: none;
}

@media (max-width: 1180px) {
  .room-header {
    grid-template-columns: 1fr auto 1fr;
  }

  .preview-label,
  .shared-key,
  .player-count,
  .control-caption {
    display: none;
  }

  .control-rail { gap: 10px; }
  .control-cluster { gap: 6px; }
  .rail-divider { margin-inline: 2px; }
  .segment { padding-inline: 10px; }
  .guide-toggle { min-width: 154px; }
  .return-rail { grid-template-columns: 150px 1fr auto; gap: 14px; }
  .return-heading small { display: none; }
}

@media (max-width: 900px) {
  :root { --header-height: 58px; }

  .room-header {
    padding-inline: 14px;
    grid-template-columns: auto 1fr auto;
    gap: 12px;
  }

  .brand-name { display: none; }
  .brand-mark { width: 25px; height: 25px; }
  .room-identity { min-width: 0; justify-self: center; }
  .sync-state { display: none; }
  .avatar-stack .avatar:not(.avatar-current) { display: none; }

  .control-rail {
    min-height: 62px;
    overflow-x: auto;
    justify-content: flex-start;
    scrollbar-width: none;
  }

  .control-rail::-webkit-scrollbar { display: none; }
  .rail-spacer { display: none; }
  .guide-toggle { margin-left: auto; }
  .table-style-popover {
    position: fixed;
    left: 50%;
    top: 70px;
    transform: translateX(-50%);
  }

  .table-stage { padding-inline: 12px; }
  .table-and-shot-controls { grid-template-columns: minmax(0,1fr) 76px; gap: 9px; }
  .table-meta { padding-right: 84px; }
  .prototype-stamp { padding-right: 84px; }
  .spin-module, .swing-module { padding-left: 8px; }
  .spin-ball, .spin-labels { width: 55px; }

  .return-rail {
    grid-template-columns: 1fr auto;
    grid-template-areas: "trough rack";
  }

  .return-heading { display: none; }
  .ball-trough { grid-area: trough; }
  .rack-controls { grid-area: rack; }
  .rack-controls > .control-caption { display: none; }
}

@media (max-width: 680px) {
  .room-header { grid-template-columns: auto 1fr auto; }
  .room-presence { gap: 5px; }
  .room-identity { width: 100%; height: 34px; }
  .room-kicker, .room-slash { display: none; }
  .room-id { max-width: 120px; overflow: hidden; text-overflow: ellipsis; }

  .table-room { display: block; }
  .control-rail { margin-inline: 10px; }
  .tool-cluster .segment svg { display: none; }
  .rail-divider { display: none; }
  .table-style-button { min-width: 128px; }
  .table-style-button strong { max-width: 98px; }
  .guide-toggle { min-width: 128px; padding-left: 8px; }
  .guide-copy small { display: none; }

  .table-stage { min-height: calc(100dvh - 220px); padding: 11px 7px 8px; }
  .table-meta { padding-right: 0; margin-bottom: 6px; }
  .table-meta span:nth-child(2) { display: none; }
  .table-meta .table-state { margin-left: auto; }
  .table-and-shot-controls { grid-template-columns: 1fr; }
  .table-viewport { border-radius: 8px; }
  .shot-console {
    padding: 0 8px;
    flex-direction: row;
    justify-content: flex-end;
    gap: 16px;
  }
  .spin-module, .swing-module { display: flex; align-items: center; gap: 8px; border-left: 0; }
  .module-heading { margin: 0; }
  .spin-ball { width: 47px; }
  .spin-labels, .spin-help { display: none; }
  .swing-module { min-height: 0; }
  .swing-gesture { width: 76px; height: 34px; border-top: 0; border-bottom: 0; border-left: 1px solid #394241; border-right: 1px solid #394241; }
  .swing-path { left: 8px; right: 8px; top: 50%; bottom: auto; width: auto; height: 1px; }
  .swing-path::before { left: 0; top: 50%; transform: translate(-50%, -50%) rotate(-45deg); }
  .swing-path::after { left: auto; right: 0; bottom: auto; top: 50%; transform: translate(50%, -50%) rotate(135deg); }
  .swing-mouse { left: 29px; top: 5px; transform: rotate(90deg); }
  .swing-module.is-tracking .swing-mouse { animation: none; border-color: var(--brass-pale); }
  .swing-help { display: none; }
  .prototype-stamp { padding-right: 0; margin-top: 5px; }

  .return-rail {
    min-height: 120px;
    margin-inline: 10px;
    grid-template-columns: 1fr;
    grid-template-areas: "rack" "trough";
    gap: 8px;
  }
  .rack-controls { justify-content: space-between; }
  .rack-button { flex: 1; }
  .ball-trough { min-height: 42px; }

  .entry-card { grid-template-columns: 1fr; min-height: auto; }
  .entry-visual { display: none; }
  .entry-form { padding: 34px 27px; }
  .entry-form h1 { font-size: 38px; }
  .settings-card { padding: 25px; }
}

@media (orientation: landscape) and (max-width: 900px) and (max-height: 500px) {
  :root { --header-height: 46px; }

  .room-header {
    min-height: 46px;
  }

  .brand-mark {
    width: 22px;
    height: 22px;
  }

  .room-identity,
  .icon-button {
    height: 32px;
  }

  .avatar {
    width: 27px;
    height: 27px;
  }

  .control-rail {
    min-height: 48px;
    padding-block: 5px;
  }

  .segment {
    min-height: 34px;
  }

  .guide-toggle {
    height: 34px;
  }

  .table-stage {
    min-height: 0;
    padding-block: 5px;
    justify-content: flex-start;
  }

  .table-meta,
  .prototype-stamp {
    display: none;
  }

  .table-and-shot-controls {
    width: min(100%, 620px);
  }


  .surface-hint {
    display: none;
  }

  .shot-console {
    gap: 8px;
  }

  .spin-ball,
  .spin-labels {
    width: 48px;
  }

  .swing-module {
    min-height: 112px;
  }

  .swing-gesture {
    height: 62px;
  }
}

@media (orientation: portrait) and (max-width: 560px) {
  .rotate-notice {
    position: fixed;
    right: 12px;
    bottom: 12px;
    z-index: 40;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid #4b514f;
    color: #a9b0ae;
    background: rgba(15,20,21,0.9);
    font-family: "Barlow Condensed", "Manrope", sans-serif;
    font-size: 7px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
  }

  .rotate-phone {
    width: 9px;
    height: 14px;
    border: 1px solid var(--brass);
    border-radius: 1px;
    transform: rotate(90deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}
