/* Patch 20: hControls wrapper border + club header width */
:root{
  --bg0:#0b0c10;
  --panelSoft: rgba(17,24,39,.55);
  --stroke: rgba(37,49,74,.75);
  --text:#e5e7eb;
  --muted:#9ca3af;
  --accent:#7c3aed;
  --accent2:#60a5fa;

  --goodFill: rgba(34,197,94,.40);
  --nearFill: rgba(239,68,68,.38);
  --goodRing: rgba(34,197,94,.35);
  --nearRing: rgba(239,68,68,.35);
  --yellowFill: rgba(234,179,8,.38);
  --yellowRing: rgba(234,179,8,.35);

  --headerH: 56px;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  color:var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  background: var(--bg0);
  background-attachment: fixed;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

button{ cursor:pointer; }
button:disabled{ cursor:not-allowed; opacity:.45; }
.miniBtn,.modeBtn,.iconBtn,.digitSelect,.targetPicker,.wheelItem{ cursor:pointer; }
.miniBtn:disabled,.modeBtn:disabled,.iconBtn:disabled,.digitSelect:disabled{ cursor:not-allowed; opacity:.45; }

body.modalOpen{ overflow:hidden; }

.appHeader{
  position:fixed;
  top:0; left:0; right:0;
  z-index:10;
  display:flex;
  flex-direction:column;
  background: rgba(17,24,39,.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--stroke);
}
.headerTop{
  height:56px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:10px 12px;
}
.headerSub{
  display:none;
  padding:8px 12px;
  border-top: 1px solid rgba(37,49,74,.35);
}
.headerSub.on{ display:block; }
.headerSub.settings{ border-bottom: 1px solid rgba(37,49,74,.35); }
.headerSub.distances{ border-bottom: none; }

.brand{ display:flex; align-items:center; gap:10px; min-width:0; }
.brandLogo{
  width:36px; height:36px;
  border-radius:10px;
  border:1px solid var(--stroke);
  background: rgba(15,23,42,.35);
  object-fit: cover;
}
.brandText{ min-width:0; display:flex; align-items:center; }
.brandName{
  font-weight:900;
  letter-spacing:.2px;
  font-size:18px;
  line-height:1;
}

.headerRight{ display:flex; align-items:center; gap:10px; }
.iconBtn{
  width:34px; height:34px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: rgba(37,49,74,.35);
  color: var(--text);
  font-weight: 900;
  font-size: 16px;
  display:flex; align-items:center; justify-content:center;
  padding:0;
}
.iconBtn:active{ transform: translateY(1px); }
.refreshIcon{
  width:18px; height:18px;
  display:block;
  filter: brightness(0) invert(1);
}

.toggleWrap{ display:flex; align-items:center; gap:8px; user-select:none; }
.toggleLabel{ font-size:12px; color:var(--muted); }

/* Switch */
.switch{ position:relative; display:inline-block; width:44px; height:24px; }
.switch input{ opacity:0; width:0; height:0; }
.switch .slider{
  position:absolute; inset:0;
  background:#243049;
  transition:.2s;
  border-radius:999px;
  border:1px solid var(--stroke);
}
.switch .slider:before{
  content:"";
  position:absolute; height:18px; width:18px; left:3px; top:50%;
  transform: translateY(-50%);
  background:white;
  transition:.2s;
  border-radius:999px;
}
.switch input:checked + .slider{ background: rgba(124,58,237,.85); }
.switch input:checked + .slider:before{ transform: translate(20px, -50%); }

.appMain{
  padding: calc(var(--headerH) + 10px) 10px 16px;
}

/* Panels */
.panel{
  background: rgba(17,24,39,.82);
  border: 1px solid var(--stroke);
  border-radius: 16px;
  padding: 14px;
  backdrop-filter: blur(10px);
  box-shadow: 0 12px 28px rgba(0,0,0,.25);
}
.panelTitle{ font-weight:900; font-size:16px; margin-bottom:2px; }
.panelSub{ color:var(--muted); font-size:12px; margin-bottom:12px; }

.center{
  min-height: calc(100vh - var(--headerH));
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 10px;
}
.formNarrow{ width:min(360px, 100%); }

.field{ display:flex; flex-direction:column; gap:6px; margin:10px 0; }
label{ font-size:12px; color:var(--muted); }
input[type="text"], input[type="password"], input[type="number"], select{
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: rgba(15,23,42,.7);
  color: var(--text);
  padding: 10px 10px;
  outline:none;
  width: 100%;
  min-width: 0;
}
input[type="text"]:focus, input[type="password"]:focus, input[type="number"]:focus, select:focus{
  border-color: rgba(96,165,250,.75);
  box-shadow: 0 0 0 3px rgba(96,165,250,.18);
}

/* Buttons */
.btnRow{ display:flex; gap:10px; align-items:center; justify-content:space-between; margin-top:12px; }
.miniBtn{
  padding: 8px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 900;
  background: rgba(37,49,74,.6);
  border: 1px solid var(--stroke);
  color: var(--text);
}
.miniBtn.primary{ background: rgba(124,58,237,.35); }
.miniBtn.danger{
  background: rgba(239,68,68,.25);
  border-color: rgba(239,68,68,.55);
}
.miniBtn.full{ width:100%; }
.miniBtn:active{ transform: translateY(1px); }

/* Accent borders (matches step buttons) */
.refreshBtn{ 
  border-color: rgba(96,165,250,.55);
  background: rgba(96,165,250,.18);
}
#carryBtn, #filterBtn{
  border-color: rgba(96,165,250,.55);
}
/* Dark purple border around Save */
#saveBtnFixed{
  border-color: rgba(177,101,237,.77);
}

/* Subheader controls */
.hControlsWrap{
  width:100%;
}
.hControls{
  display:flex;
  gap:7px;
  align-items:center;
  width:100%;
  min-width:0;
}
.headerSub.distances .hControls{
  margin: 0;
  padding: 0;
}
.hControls.two .miniBtn{ flex:1; }

/* Fixed widths in header controls */
.modeBtn{
  width:64px;
  min-width:64px;
  max-width:64px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-size:12px;
  padding: 10px 10px;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  font-weight:900;
  background: rgba(96,165,250,.18);
  color: var(--text);
  white-space:nowrap;
  flex: 0 0 64px;
}
.modeBtn.on{ background: rgba(124,58,237,.35); }

.targetPicker{
  flex: 1 1 auto;
  min-width: 0;
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid rgba(96,165,250,.35);
  background: rgba(15,23,42,.65);
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.targetPicker.active,
.targetPicker:focus-visible{
  border-color: rgba(124,58,237,.72);
  box-shadow: 0 0 0 3px rgba(124,58,237,.16);
  background: rgba(17,24,39,.82);
}
.targetCompactValue{
  display:block;
  font-size: 15px;
  font-weight: 900;
  color: var(--text);
  white-space: nowrap;
}
.targetSuffix{
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .3px;
  white-space: nowrap;
}

.pickerOverlay{
  position:fixed;
  inset:0;
  z-index:40;
  display:none;
}
.pickerOverlay.open{ display:block; }
.pickerScrim{
  position:absolute;
  inset:0;
  border:0;
  padding:0;
  margin:0;
  background: rgba(2,6,23,.52);
}
.pickerSheet{
  position:absolute;
  left:8px;
  right:8px;
  bottom: max(8px, env(safe-area-inset-bottom));
  border-radius: 24px;
  border: 1px solid rgba(37,49,74,.8);
  background: rgba(17,24,39,.96);
  box-shadow: 0 20px 48px rgba(0,0,0,.38);
  padding: 12px;
}
.pickerHead{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom: 12px;
}
.pickerTitleWrap{ min-width:0; }
.pickerTitle{
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: .25px;
  text-transform: uppercase;
}
.pickerValue{
  font-size: 28px;
  font-weight: 900;
  color: var(--text);
  line-height: 1.1;
}
.wheelGroup{
  --wheelH: 44px;
  position:relative;
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap:8px;
}
.wheelFocusBand{
  position:absolute;
  left:0;
  right:0;
  top: calc(22px + (var(--wheelH) * 2));
  height: var(--wheelH);
  border-radius: 14px;
  background: rgba(124,58,237,.14);
  border: 1px solid rgba(124,58,237,.45);
  pointer-events:none;
}
.wheelCol{ min-width:0; }
.wheelLabel{
  text-align:center;
  font-size:11px;
  font-weight:800;
  color: var(--muted);
  margin-bottom: 8px;
}
.wheelColumn{
  position:relative;
  height: calc(var(--wheelH) * 5);
  overflow-y:auto;
  overflow-x:hidden;
  scroll-snap-type:y mandatory;
  scrollbar-width:none;
  touch-action: pan-y pinch-zoom;
  cursor: grab;
  overscroll-behavior: contain;
  border-radius: 18px;
  border: 1px solid rgba(37,49,74,.7);
  background: rgba(11,12,16,.94);
}
.wheelColumn.dragging{ cursor: grabbing; }
.wheelColumn::-webkit-scrollbar{ display:none; }
.wheelItem,
.wheelSpacer{
  height: var(--wheelH);
  display:flex;
  align-items:center;
  justify-content:center;
  scroll-snap-align:center;
}
.wheelItem{
  width:100%;
  border:0;
  padding:0;
  background: transparent;
  color: var(--muted);
  font-size: 30px;
  font-weight: 900;
  transition: color .12s ease, transform .12s ease;
  user-select:none;
  scroll-snap-stop: always;
}
.wheelItem.active{
  color: var(--text);
  transform: scale(1.05);
}

@media (max-width: 420px){
  .pickerSheet{ left:0; right:0; bottom:0; border-radius: 24px 24px 0 0; }
}



/* Distances table */
/* Split distances header into its own sticky wrapper */
.distHeadWrap{
  position: sticky;
  top: calc(var(--headerH));
  z-index: 6;
  background: var(--bg0);
  box-shadow: 0 10px 18px rgba(0,0,0,.25);
}
.distHeadTable{ margin-bottom: -4px; }
.distBodyTable{ margin-top: -4px; }

.tableWrap{ width:100%; margin-top:0; }
.distances .tableWrap{ margin-top:-6px; }
.distTable{
  width:100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 4px;
}
.distTable thead th{
  font-size:14px;
  color: var(--muted);
  font-weight:800;
  text-align:center;
  padding: 4px 2px;
}
.distTable thead th:first-child{
  text-align:left;
  padding-left:6px;
  width:55px;
  min-width:55px;
  max-width:55px;
}
.distTable tbody td{
  background: var(--panelSoft);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  text-align:center;
  padding: 6px 3px;
  vertical-align:middle;
}
.distTable tbody td.cell{ transition: background-color .10s linear, background .10s linear; }
.distTable tbody td.club{
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  text-align:left;
  font-weight:900;
  letter-spacing: .3px;
  padding-left: 8px;
  font-size: 15px;
  width:55px;
  min-width:55px;
  max-width:55px;
  white-space:nowrap;
}

.metricCarry{ font-size: 10px; font-weight:900; color: var(--muted); line-height:1.05; }
.metricTotal{ font-weight:900; font-size: 14px; line-height:1.05; color: var(--text); margin-top: 2px; }
body.carryMode .metricCarry{ font-size: 14px !important; color: var(--text) !important; }
body.carryMode .metricTotal{ font-size: 10px !important; color: var(--muted) !important; margin-top: 2px !important; }

.distTable tbody td.cell.hitGreen{
  background: var(--goodFill) !important;
  box-shadow: 0 0 0 999px var(--goodFill) inset, 0 0 0 1px var(--goodRing) inset;
}
.distTable tbody td.cell.hitAmber{
  background: var(--nearFill) !important;
  box-shadow: 0 0 0 999px var(--nearFill) inset, 0 0 0 1px var(--nearRing) inset;
}

.distTable tbody td.cell.hitYellow{
  background: var(--yellowFill) !important;
  box-shadow: 0 0 0 999px var(--yellowFill) inset, 0 0 0 1px var(--yellowRing) inset;
}

/* No-select */
.noSelect, .noSelect *{
  -webkit-user-select:none !important;
  user-select:none !important;
  -webkit-touch-callout:none !important;
}

/* Settings */
.settings{ width:100%; overflow-x:hidden; }
.settings .clubBlock{
  background: var(--panelSoft);
  border: 1px solid var(--stroke);
  border-radius: 16px;
  padding: 10px;
  margin-bottom: 10px;
}
.settings .clubHead{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom: 8px;
}
.settings .clubSelect{
  font-weight:900;
  padding:8px 28px 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(37,49,74,.55);
  background-color: rgba(15,23,42,.55);
  color: var(--text);
  height: 34px;
  font-size: 12px;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='%23ffffff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px 14px;
}
.settings .clubActions{ display:flex; gap:8px; }
.settings .clubActions .miniBtn{ height: 34px; display:inline-flex; align-items:center; }

.settings input[type="number"], .settings select{ font-size:16px; padding:8px 8px; border-radius: 12px; }
.settings .grid{
  display:grid;
  grid-template-columns: 70px minmax(0,1fr) minmax(0,1fr);
  gap: 6px;
  align-items:center;
}
.settings .grid .hdr{ font-size: 11px; color: var(--muted); font-weight: 800; }
.settings .grid .swingLbl{ font-size: 12px; color: var(--text); font-weight: 900; }

/* Status pill: border-only */
.statusPill{
  margin-top: 8px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: rgba(17,24,39,.55);
  text-align: left;
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
}
.statusPill.success{ border-color: rgba(34,197,94,.65); }
.statusPill.error{ border-color: rgba(239,68,68,.75); }

a, button, input, select { -webkit-tap-highlight-color: transparent; }
