@font-face {
  font-family: "B GenJyuu Gothic X";
  src: url("../../assets/fonts/B_GenJyuu_GothicX.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #d7e0e8;
  --bg-accent: #eef4f9;
  --panel: linear-gradient(180deg, rgb(245, 245, 245) 0%, rgb(234, 237, 241) 46%, rgb(222, 222, 222) 100%);
  --panel-border: rgba(107, 126, 142, 0.42);
  --text: #1d2732;
  --muted: #556473;
  --accent: #7fd8ff;
  --accent-strong: #4297cc;
  --practice: #66c9ff;
  --practice-strong: #1f88d8;
  --actual: #ffbf66;
  --actual-strong: #f28b1f;
  --warning: #8f5c09;
  --shadow: 
    0 4px 6px -1px rgba(0, 0, 0, 0.1), 
    0 12px 24px -4px rgba(78, 98, 117, 0.24),
    0 25px 50px -12px rgba(0, 0, 0, 0.15);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  font-family: "B GenJyuu Gothic X", "Segoe UI Variable", "Aptos", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(111, 214, 255, 0.26), transparent 34%),
    radial-gradient(circle at right, rgba(141, 233, 255, 0.2), transparent 20%),
    linear-gradient(160deg, #f5f9fc 0%, var(--bg) 44%, var(--bg-accent) 100%);
  -webkit-user-select: none;
  user-select: none;
}

button:focus,
button:focus-visible {
  outline: none;
  box-shadow: none;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: linear-gradient(rgba(102, 125, 145, 0.08) 1px, transparent 1px), linear-gradient(90deg, rgba(102, 125, 145, 0.08) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.8), transparent 90%);
  pointer-events: none;
}

.viewer-body {
  overflow: hidden;
}

.viewer-body:not(.viewer-debug-enabled) #viewer-debug-panel,
.viewer-body:not(.viewer-debug-enabled) #viewer-launch-debug-panel {
  display: none;
}

.viewer-body::before {
  display: none;
}

.debug-toggle-button {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 10px);
  right: calc(env(safe-area-inset-right, 0px) + 10px);
  width: 40px;
  height: 40px;
  border: none;

  background: none;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1000;


  box-shadow: none;
}



.viewer-fps-overlay {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 10px);
  left: calc(env(safe-area-inset-left, 0px) + 10px);
  z-index: 3;
  pointer-events: none;
}

.viewer-fps-value {
  display: block;
  color: rgba(19, 32, 45, 0.9);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums lining-nums;
  text-shadow: 0 1px 10px rgba(255, 255, 255, 0.85);
}

.viewer-client-code {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 12px);
  transform: translateX(-50%);
  z-index: 2;
  pointer-events: none;
}

.viewer-client-code-card {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 18px;
  background: rgba(18, 30, 42, 0.58);
  box-shadow: 0 12px 28px rgba(8, 18, 28, 0.22);
  backdrop-filter: blur(10px);
}

.viewer-client-code-copy {
  display: grid;
  justify-items: center;
  gap: 2px;
}

.viewer-client-code-label,
.viewer-client-code-value {
  color: rgba(255, 255, 255, 0.98);
  text-shadow:
    1px 0 0 rgba(32, 32, 32, 0.95),
    -1px 0 0 rgba(32, 32, 32, 0.95),
    0 1px 0 rgba(32, 32, 32, 0.95),
    0 -1px 0 rgba(32, 32, 32, 0.95);
}

.viewer-client-code-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.viewer-client-code-value {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  font-variant-numeric: tabular-nums lining-nums;
}

.viewer-room-qr-image {
  width: 72px;
  height: 72px;
  padding: 6px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: inset 0 0 0 1px rgba(23, 36, 49, 0.08);
}

@media (max-width: 720px) {
  .viewer-client-code-card {
    gap: 10px;
    padding: 8px 10px;
  }

  .viewer-client-code-label {
    font-size: 0.62rem;
  }

  .viewer-client-code-value {
    font-size: 1rem;
    letter-spacing: 0.12em;
  }

  .viewer-room-qr-image {
    width: 60px;
    height: 60px;
    padding: 5px;
  }
}

#scene {
  display: block;
  width: 100vw;
  height: 100vh;
}

.hud {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 2;
  width: min(320px, calc(100vw - 20px));
  display: grid;
  gap: 10px;
}

.hud-right {
  left: auto;
  right: 10px;
}

.hud-bottom-left {
  top: auto;
  bottom: 10px;
}

.hud-bottom-right {
  top: auto;
  left: auto;
  right: 10px;
  bottom: 10px;
}

.hud-left-center {
  top: 40%;
  left: 10px;
  bottom: auto;
  transform: translateY(-50%);
  width: min(340px, calc(100vw - 20px));
}

.hud-right-center {
  top: 50%;
  left: auto;
  right: 10px;
  bottom: auto;
  transform: translateY(-50%);
  width: min(240px, calc(100vw - 20px));
}

.controller-body {
  height: 100dvh;
  overflow: hidden;
  padding: 0;
  overscroll-behavior: none;
  touch-action: manipulation;
}

.golf-club-body {
  background: #000;
}

.golf-club-body::before {
  display: none;
}

.controller-shell {
  position: relative;
  width: 100%;
  height: 100dvh;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  overflow: hidden;
}

.pairing-gate {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100vw;
  min-height: 100vh;
  min-height: 100dvh;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    calc(env(safe-area-inset-top, 0px) + 20px)
    max(16px, env(safe-area-inset-right, 0px))
    calc(env(safe-area-inset-bottom, 0px) + 20px)
    max(16px, env(safe-area-inset-left, 0px));
  overflow: auto;
}

.pairing-gate-backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(circle at top, rgba(119, 210, 255, 0.28), transparent 32%),
    linear-gradient(180deg, rgba(6, 17, 28, 0.84), rgba(8, 18, 28, 0.92));
  backdrop-filter: blur(10px);
}

.pairing-gate-panel {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  padding: 18px;
}

.pairing-gate-heading {
  margin-bottom: 0;
}

.pairing-gate-title {
  font-size: clamp(2rem, 9vw, 3rem);
}

.pairing-gate-copy {
  color: var(--muted);
  line-height: 1.45;
}

.pairing-gate-status {
  justify-self: start;
}

.pairing-gate-actions {
  display: grid;
}

.pairing-gate-button {
  min-height: 56px;
  font-size: 0.95rem;
}

.controller-playfield {
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.controller-corner-actions {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 10px);
  left: 12px;
  right: 12px;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}

.panel {
  position: relative;
  padding: 10px 12px;
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  background: var(--panel);

  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel::after {
  content: "";
  position: absolute;
  inset: 1px 1px auto 1px;
  height: 44%;
  border-radius: 15px 15px 26px 26px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.76), rgba(255, 255, 255, 0.1));
  opacity: 0.9;
  pointer-events: none;
}

.panel > * {
  position: relative;
  z-index: 1;
}

.panel-title,
.panel-status,
.panel-debug,
.panel-static,
.hero-panel,
.status-panel {
  max-width: 100%;
}

.panel-debug,
.panel-static {
  min-width: 0;
}

.panel-heading {
  display: grid;
  gap: 4px;
  margin-bottom: 8px;
}

.panel-status-text {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.68rem;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.25rem);
  line-height: 0.95;
}

p {
  margin: 0;
}

.body-copy {
  margin-top: 14px;
  color: var(--muted);
  line-height: 1.5;
}

.controls-panel {
  display: grid;
  gap: 12px;
  padding: 12px;
  width: min(100%, 360px);
}

.pairing-field-grid {
  display: grid;
  gap: 8px;
}

.pairing-field {
  display: grid;
  gap: 6px;
}

.pairing-code-input {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  text-align: center;
  font-size: 1rem;
  font-weight: 700;
}

.controller-dock {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 0 12px calc(env(safe-area-inset-bottom, 0px) + 8px);
}

.aim-joystick {
  position: relative;
  flex: 1;
  min-height: 0;
  touch-action: none;
  user-select: none;
}

.aim-joystick::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 52%;
  width: min(52vw, 260px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  background: radial-gradient(circle, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.01) 72%, transparent 72%);
  pointer-events: none;
}

.aim-joystick.is-disabled {
  opacity: 0.42;
}

.aim-joystick-visual {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  transform: translate(var(--joystick-x, 0px), var(--joystick-y, 0px));
  transition: opacity 120ms ease;
  pointer-events: none;
}

.aim-joystick.is-active .aim-joystick-visual {
  opacity: 1;
}

.aim-joystick-base,
.aim-joystick-knob {
  position: absolute;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.aim-joystick-base {
  width: 132px;
  height: 132px;
  border: 1px solid rgba(114, 133, 149, 0.28);
  background: linear-gradient(180deg, rgba(244, 247, 250, 0.66), rgba(218, 223, 230, 0.5));
  backdrop-filter: blur(8px);
  box-shadow: 0 18px 44px rgba(76, 97, 115, 0.18);
}

.aim-joystick-knob {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, rgba(154, 211, 255, 0.92), rgba(98, 179, 235, 0.92));
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.32);
}

.status-pill {
  justify-self: start;
  padding: 4px 10px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(222, 227, 233, 0.88));
  border: 1px solid rgba(109, 127, 142, 0.22);
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.control-row {
  display: grid;
  gap: 8px;
}

.control-row-top {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.club-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.control-row-triple {
  grid-template-columns: 52px minmax(0, 1fr) 52px;
  align-items: center;
}

.compact-row {
  min-height: 52px;
}

.control-label {
  display: grid;
  place-items: center;
  min-height: 44px;
  border: 1px solid rgba(111, 129, 145, 0.22);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(249, 251, 253, 0.8), rgba(224, 228, 234, 0.8));
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.action-button {
  appearance: none;
  border: none;
  border-radius: 12px;
  padding: 12px;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, opacity 140ms ease;
  white-space: nowrap;
  min-height: 48px;
}

.mode-button {
  pointer-events: auto;
  width: clamp(84px, 24vw, 108px);
  min-height: 0;
  aspect-ratio: 1;
  padding: 10px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 2px;
  text-align: center;
  line-height: 1.1;
  font-size: 0.82rem;
  border-radius: 18px;
}

.practice-mode-button {
  background: linear-gradient(145deg, var(--practice), var(--practice-strong));
  color: #06233a;
  box-shadow: 0 14px 30px rgba(31, 136, 216, 0.34);
}

.actual-mode-button {
  background: linear-gradient(145deg, var(--actual), var(--actual-strong));
  color: #3b1d00;
  box-shadow: 0 14px 30px rgba(242, 139, 31, 0.3);
}

.club-button {
  aspect-ratio: 1;
  min-height: 112px;
  font-size: 2rem;
  line-height: 1;
}

.dock-actions-row .action-button {
  min-height: 56px;
}

.action-button:hover,
.action-button:focus-visible {
  transform: translateY(-1px);
}

.action-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #032015;
  box-shadow: 0 12px 34px rgba(30, 213, 155, 0.28);
}

.secondary {
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.96), rgba(221, 226, 232, 0.96));
  color: var(--text);
  border: 1px solid rgba(101, 123, 140, 0.26);
  box-shadow: 0 10px 24px rgba(82, 101, 119, 0.14);
}

.orientation-copy {
  margin: 0;
  padding: 0 2px;
  color: var(--warning);
  font-size: 0.62rem;
  line-height: 1.2;
  text-align: center;
  letter-spacing: 0.03em;
  font-variant-numeric: tabular-nums lining-nums;
}

@media (max-width: 420px) {
  .controller-corner-actions {
    left: 10px;
    right: 10px;
  }

  .controller-dock {
    padding-inline: 10px;
  }

  .controls-panel {
    width: 100%;
  }

  .club-button {
    min-height: 96px;
    font-size: 1.7rem;
  }

  .mode-button {
    width: clamp(78px, 25vw, 96px);
    font-size: 0.74rem;
  }
}

.debug-grid {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px 10px;
  align-items: start;
}

.debug-label {
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.debug-value {
  font-family: inherit;
  font-size: 0.76rem;
  color: var(--text);
  text-align: right;
  line-height: 1.35;
}

.debug-value-wide {
  white-space: normal;
  word-break: break-word;
}

.launch-debug-controls {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.launch-debug-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.launch-debug-field {
  display: grid;
  gap: 6px;
}

.launch-debug-input {
  width: 100%;
  appearance: none;
  border: 1px solid rgba(109, 128, 144, 0.3);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
  font-size: 0.74rem;
}

.launch-debug-input[aria-invalid="true"] {
  border-color: rgba(255, 210, 125, 0.9);
}

.launch-debug-input:focus-visible {
  outline: 2px solid rgba(154, 211, 255, 0.35);
  outline-offset: 2px;
}

.launch-debug-actions {
  display: flex;
  justify-content: flex-end;
}

.launch-debug-button {
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.74rem;
}

.panel-club {
  width: min(276px, calc(100vw - 20px));
}

.club-panel-shell {
  position: relative;
  width: min(276px, calc(100vw - 20px));
  overflow: visible;
}

.club-panel-left {
  min-width: 0;
  display: grid;
}

.club-panel-heading {
  margin-bottom: 0;
}

.panel-club-main {
  position: relative;
  z-index: 2;
}

.club-detail-grid {
  width: 100%;
}

.club-panel-toggle {
  position: absolute;
  top: 12px;
  right: -18px;
  bottom: 12px;
  
  border: 0;
  border-radius: 0 16px 16px 0;
  background: linear-gradient(180deg, rgba(76, 171, 255, 0.96), rgba(39, 112, 194, 0.98));
  color: rgba(241, 248, 255, 0.98);
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  z-index: 1;
  box-shadow: 0 14px 30px rgba(32, 86, 143, 0.28);
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.club-panel-toggle:hover,
.club-panel-toggle:focus-visible {
  transform: translateX(2px);
  box-shadow: 0 18px 34px rgba(32, 86, 143, 0.34);
}

.club-panel-toggle:focus-visible {
  outline: 2px solid rgba(208, 235, 255, 0.95);
  outline-offset: 2px;
}

.club-panel-details {

  border-radius: 0px 16px 16px 0px;
  position: absolute;
  top: 10px;
  left: calc(100% - 20px);
  width: min(222px, calc(100vw - 58px));
  min-width: 180px;
  min-height: calc(100% - 20px);
  padding-left: 45px;
  color: rgba(247, 251, 255, 0.98);
  background: rgba(23, 36, 49, 0.5);
  border-color: rgba(23, 36, 49, 0.5);
  backdrop-filter: none;
  box-shadow: none;
  visibility: hidden;
  transform: translateX(-100%);
  pointer-events: none;
  transition: transform 220ms ease, visibility 0s linear 220ms;
}

.club-panel-details::after {
  background: linear-gradient(180deg, rgba(190, 225, 255, 0.24), rgba(255, 255, 255, 0.02));
}

.club-panel-details .debug-label {
  color: rgba(220, 236, 250, 0.86);
}

.club-panel-details .debug-value {
  color: rgba(255, 255, 255, 0.98);
}

.club-panel-shell.is-expanded .club-panel-details {
  visibility: visible;
  transform: translateX(0);
  pointer-events: auto;
  transition-delay: 0s;
}

.club-panel-shell.is-expanded .club-panel-toggle {
  background: linear-gradient(180deg, rgba(85, 182, 255, 0.98), rgba(35, 101, 179, 0.98));
}

.panel-swing-preview {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.panel-swing-preview::after {
  display: none;
}

.panel-swing-preview .debug-label,
.panel-swing-preview .debug-value,
.panel-swing-preview .swing-preview-scale-label {
  color: rgba(255, 255, 255, 0.98);
  font-size: 0.9rem;
  text-shadow:
    1px 0 0 rgba(56, 56, 56, 0.9),
    -1px 0 0 rgba(56, 56, 56, 0.9),
    0 1px 0 rgba(56, 56, 56, 0.9),
    0 -1px 0 rgba(56, 56, 56, 0.9);
}

.swing-preview-layout {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}

.swing-preview-figure {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  --swing-preview-bar-height: 214px;
  --swing-preview-bar-width: 46px;
  --swing-preview-target-offset: calc(var(--swing-preview-bar-height) * 0.8 - 15px);
  min-height: calc(var(--swing-preview-bar-height) + 28px);
}

.swing-preview-meter-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.swing-preview-speed-row {
  position: relative;
  display: flex;
  align-items: stretch;
  width: var(--swing-preview-bar-width);
}

.swing-preview-horizontal-bar {
  position: relative;
  width: 90px;
  height: 16px;
  border: 2px solid rgba(0, 0, 0, 0.86);
  border-radius: 999px;
  background: #f851fe;
}

.swing-preview-horizontal-pangya-zone {
  position: absolute;
  top: 0px;
  bottom: 0px;
  left: 50%;
  width: 4px;
  transform: translateX(-50%);

  background: rgba(255, 255, 255, 0.98);
}

.swing-preview-horizontal-marker {
  position: absolute;
  top: -8px;
  left: 50%;
  width: 2px;
  height: 24px;
  transform: translateX(-50%);
  background: rgba(0, 255, 0, 1);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.86);
}

.swing-preview-horizontal-marker::before {
  content: '';
  position: absolute;
  left: 50%;
  top: -8px;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 8px solid #ff4b4b;
}

.swing-preview-horizontal-marker[hidden] {
  display: none;
}

.swing-preview-bar {
  position: relative;
  width: var(--swing-preview-bar-width);
  min-height: var(--swing-preview-bar-height);
  border: 2px solid rgba(0, 0, 0, 0.86);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

@keyframes flash-fill {
  0% { background: rgba(255, 255, 255, 0.92); box-shadow: 0 0 0 transparent; }
  50% { background: #ff4b4b; box-shadow: 0 0 12px #ff4b4b; }
  100% { background: rgba(255, 255, 255, 0.92); box-shadow: 0 0 0 transparent; }
}

.swing-preview-fill.is-flashing {
  animation: flash-fill 350ms ease-out forwards;
}

.swing-preview-fill {
  position: absolute;
  inset: auto 0 0 0;
  height: 0;
  background: rgba(255, 255, 255, 0.92);
  transition: height 220ms ease-out;
}

.swing-preview-target-line {
  position: absolute;
  left: -1px;
  right: -1px;
  height: 2px;
  bottom: 80%;
  background: rgba(0, 0, 0, 0.86);
  z-index: 1;
}

.swing-preview-scale-labels {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 2px 0;
}

.swing-preview-scale-label {
  color: rgba(61, 79, 95, 0.82);
}

.swing-preview-target-anchor {
  display: grid;
  gap: 2px;
  margin-bottom: var(--swing-preview-target-offset);
  min-width: 74px;
}

.swing-preview-target-speed {
  text-align: right;
}

.swing-preview-head-speed-anchor {
  --swing-preview-capture-percent: 0%;
  position: absolute;
  top: 0;
  left: calc(100% + 10px);
  min-width: 84px;
  min-height: var(--swing-preview-bar-height);
}

.swing-preview-head-speed {
  position: absolute;
  left: 0;
  bottom: clamp(4%, var(--swing-preview-capture-percent), 96%);
  transform: translateY(50%);
  white-space: nowrap;
}

.swing-preview-detail-shell {
  position: fixed;
  top: 50%;

  border-radius: 16px 0px 0px 16px;
  right:-10px;
  width: min(222px, calc(100vw - 58px));
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  gap: 0;
  overflow: visible;
  transform: translate(100%, -50%);
  transition: transform 220ms ease;
}

.swing-preview-details {
  position: relative;
  width: 100%;
  min-width: 180px;
  padding-right: 2.5rem;
  color: rgba(247, 251, 255, 0.98);
  background: rgba(23, 36, 49, 0.5);
  border-color: rgba(23, 36, 49, 0.5);
  backdrop-filter: none;
  box-shadow: none;
}

.swing-preview-details::after {
  background: linear-gradient(180deg, rgba(190, 225, 255, 0.24), rgba(255, 255, 255, 0.02));
}

.swing-preview-details .debug-label {
  color: rgba(220, 236, 250, 0.86);
  font-size: 0.9rem;
}

.swing-preview-details .debug-value {
  color: rgba(255, 255, 255, 0.98);
  font-size: 0.9rem;
}

.swing-preview-detail-toggle {
  position: fixed;
  top: 50%;
      right: -17px;
    padding-right: 30px;
  width: 34px;
  height: 34px;
  transform: translateY(-50%);
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(76, 171, 255, 0.96), rgba(39, 112, 194, 0.98));
  color: rgba(241, 248, 255, 0.98);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  z-index: 3;
  box-shadow: 0 14px 30px rgba(32, 86, 143, 0.28);
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.swing-preview-detail-toggle:hover,
.swing-preview-detail-toggle:focus-visible {
  transform: translate(-2px, -50%);
  box-shadow: 0 18px 34px rgba(32, 86, 143, 0.34);
}

.swing-preview-detail-toggle:focus-visible {
  outline: 2px solid rgba(208, 235, 255, 0.95);
  outline-offset: 2px;
}

.swing-preview-detail-shell.is-collapsed {
  transform: translate(100%, -50%);
}

.swing-preview-detail-shell.is-expanded .swing-preview-details {
  pointer-events: auto;
}

.swing-preview-detail-shell.is-expanded {
  transform: translate(0, -50%);
}

.swing-preview-detail-shell.is-collapsed .swing-preview-details {
  pointer-events: none;
}

.swing-preview-detail-shell.is-expanded .swing-preview-detail-toggle {
  background: linear-gradient(180deg, rgba(85, 182, 255, 0.98), rgba(35, 101, 179, 0.98));
}

.swing-preview-meta-grid {
  width: 100%;
}

.swing-preview-meta-grid .debug-label,
.swing-preview-meta-grid .debug-value {
  min-width: 0;
  overflow-wrap: anywhere;
}

.swing-preview-launch-message {
  margin-bottom: 2px;
}

.club-button-row {
  --club-button-columns: 7;
  display: grid;
  grid-template-columns: repeat(var(--club-button-columns), minmax(0, 1fr));
  margin-top: 4px;
  margin-bottom: 12px;
  border: 1px solid rgba(109, 127, 143, 0.22);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.32);
  overflow: hidden;
}

.club-direct-button {
  width: 100%;
  min-width: 0;
  min-height: 0;
  padding: 9px 4px;
  border-radius: 0;
  border-right: 1px solid rgba(109, 127, 143, 0.16);
  border-bottom: 1px solid rgba(109, 127, 143, 0.16);
  font-size: 0.8rem;
  line-height: 1;
}

.club-button-row .club-direct-button:nth-child(7n) {
  border-right: none;
}

.club-button-row .club-direct-button:nth-last-child(-n + 7) {
  border-bottom: none;
}

.club-direct-button.is-active {
  border-color: rgba(66, 151, 204, 0.65);
  background: linear-gradient(135deg, rgba(196, 235, 255, 0.95), rgba(124, 203, 242, 0.88));
  color: var(--text);
}

.club-selector-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 2px;
  margin-bottom: 2px;
}

.club-selector-button {
  border-radius: 10px;
  min-width: 42px;
  padding: 10px 0;
  font-size: 0.74rem;
}

.club-selector-value {
  min-width: 0;
  flex: 1 1 auto;
  text-align: center;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

@media (max-width: 720px) {
  .launch-debug-field-grid {
    grid-template-columns: 1fr;
  }

  .hud {
    top: 8px;
    left: 8px;
    width: min(320px, calc(100vw - 16px));
  }

  .hud-right {
    left: auto;
    right: 8px;
    top: 8px;
  }

  .hud-bottom-left {
    left: 8px;
    bottom: 8px;
    width: min(360px, calc(100vw - 16px));
  }

  .hud-bottom-right {
    right: 8px;
    bottom: 8px;
    width: min(260px, calc((100vw - 24px) / 2));
  }

  .hud-left-center {
    top: auto;
    left: 8px;
    bottom: 120px;
    transform: none;
    width: min(320px, calc(100vw - 16px));
  }

  .hud-right-center {
    top: auto;
    right: 8px;
    bottom: 120px;
    transform: none;
    width: min(240px, calc(100vw - 16px));
  }

  .panel {
    padding: 9px 10px;
  }

  .swing-preview-layout {
    gap: 10px;
    min-width: 0;
  }

  .swing-preview-figure,
  .swing-preview-bar {
    min-height: 180px;
  }

  .swing-preview-figure {
    --swing-preview-bar-height: 180px;
  }

  .swing-preview-bar {
    width: 40px;
  }

  .panel-club {
    width: 100%;
  }

  .club-panel-shell {
    width: min(276px, calc(100vw - 16px));
  }

  .club-panel-toggle {
    right: -14px;
    width: 28px;
  }

  .club-panel-details {
    left: 0;
    right: auto;
    top: calc(100% + 10px);
    width: min(276px, calc(100vw - 16px));
    min-height: 0;
    transform: translateY(-12px);
  }

  .club-panel-shell.is-expanded .club-panel-details {
    transform: translateY(0);
  }

  .swing-preview-target-anchor {
    min-width: 74px;
  }

  .swing-preview-figure {
    --swing-preview-bar-width: 40px;
  }

  .swing-preview-details {
    width: min(240px, calc(100vw - 16px));
    
  }

  .swing-preview-detail-toggle {
    top: auto;
    right: 8px;
    bottom: 120px;
    width: 34px;
    height: 34px;
    transform: none;
    border-radius: 999px;
  }

  .swing-preview-detail-toggle:hover,
  .swing-preview-detail-toggle:focus-visible {
    transform: translateX(-2px);
  }

  .swing-preview-head-speed-anchor {
    min-width: 72px;
  }



  .panel-swing-preview {
      width: 300px;
  }

  h1 {
    font-size: 2.3rem;
  }
}