/* Separate hands for steering and trim, with room for the boat between them. */
.touch-control-setting { display: grid; gap: 12px; text-align: left; }
.touch-control-setting label { display: grid; gap: 6px; }
.touch-control-setting small { font-size: 11px; line-height: 1.5; font-weight: 400; }
.touch-control-setting select { width: 100%; min-height: 44px; border: 1px solid #76a6a1; border-radius: 6px; padding: 9px 12px; font: 600 13px var(--body); color: #174954; background: #fff9e9; cursor: pointer; }
.touch-control-setting select:focus-visible { outline: 2px solid #207b7d; outline-offset: 3px; }
.front-setting-row.touch-control-setting { display: grid; }
.pause-control-setting { padding: 14px 16px; border: 1px solid #76a6a161; border-radius: 12px; color: #174954; background: #eaf5e9; }
.pause-control-setting strong { font-size: 13px; }
.pause-control-setting small { color: #53777a; }
.sail-control-panel { position: absolute; bottom: max(150px, var(--safe-bottom)); z-index: 15; width: 285px; min-height: 116px; padding: 10px 12px; color: #f7e6bd; background: #08374bea; border: 1px solid #b5d8cf99; border-radius: 8px; box-shadow: 0 5px 17px #001b2b66; font: 700 10px var(--body); user-select: none; -webkit-user-select: none; }
.sail-control-panel[hidden] { display: none !important; }
.race-screen .sail-sheet-controls { left: auto; right: max(28px, var(--safe-right)); }
.sail-rudder-controls { left: max(28px, var(--safe-left)); }
.sail-control-panel label { display: flex; align-items: center; justify-content: space-between; gap: 6px; letter-spacing: .5px; }
.sail-control-panel output { color: #d5f5e9; font-variant-numeric: tabular-nums; font-size: 10px; }
.sail-control-panel input { --sail-range-thumb-size: 24px; display: block; width: 100%; height: 44px; margin: 2px 0; padding: 0; appearance: none; -webkit-appearance: none; background: transparent; touch-action: none; cursor: pointer; }
.sail-control-panel input::-webkit-slider-runnable-track { height: 6px; border-radius: 4px; background: #accfc8; }
.sail-control-panel input::-moz-range-track { height: 6px; border-radius: 4px; background: #accfc8; }
.sail-control-panel input::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 24px; height: 24px; margin-top: -9px; border: 2px solid #fff4cf; border-radius: 50%; background: #f1cf84; box-shadow: 0 2px 5px #001b2b80; }
.sail-control-panel input::-moz-range-thumb { width: 20px; height: 20px; border: 2px solid #fff4cf; border-radius: 50%; background: #f1cf84; box-shadow: 0 2px 5px #001b2b80; }
.sail-control-panel input:focus-visible { outline: 2px solid #f1cf84; outline-offset: 2px; border-radius: 4px; }
.sail-control-panel input:disabled { opacity: .5; }
.sail-control-panel p { margin: 7px 0 0; font-size: 9px; line-height: 1.35; font-weight: 500; }
.sail-control-panel .sail-sheet-scale { font-size: 8px; }
.race-screen .sail-control-panel label { color: #f7e6bd; }
.race-screen .sail-control-panel .sail-sheet-scale { color: #c2d9d6; }
.race-screen .sail-control-panel p { color: #e9f5ef; }
.race-screen .sail-control-panel.drag-trimming output { color: #ffe09f; }
.race-screen[data-touch-control-mode='rudder'] .touch-hint { display: none; }

:where(.touch-device) .race-screen .sail-control-panel { width: calc((100% - max(12px, var(--safe-left)) - max(12px, var(--safe-right)) - 12px) / 2); bottom: calc(var(--touch-bottom) + var(--touch-hud-height) + 8px); min-height: 116px; padding: 9px 10px; }
:where(.touch-device) .race-screen .sail-sheet-controls { right: max(12px, var(--safe-right)); left: auto; }
:where(.touch-device) .race-screen .sail-rudder-controls { left: max(12px, var(--safe-left)); }
:where(.touch-device) .sailing-touch-controls .touch-hint { display: block; left: max(12px, var(--safe-left)); bottom: calc(var(--touch-bottom) + var(--touch-hud-height) + 36px); width: calc(50% - 24px); max-width: none; transform: none; font-size: 10px; }
:where(.touch-device) .sailing-touch-controls .touch-sail-engine { right: max(12px, var(--safe-right)); bottom: calc(var(--touch-bottom) + var(--touch-hud-height) + 132px); width: 100px; height: 44px; min-height: 44px; flex-direction: row; gap: 6px; padding: 5px 8px; border-radius: 8px; }
:where(.touch-device) .sailing-touch-controls .touch-sail-engine .icon { width: 20px; height: 20px; }
:where(.touch-device) .sailing-touch-controls .touch-sail-engine small { display: none; }

@media (pointer: coarse), (any-pointer: coarse), (max-width: 900px), (max-width: 1000px) and (max-height: 500px) {
  .race-screen .sail-control-panel { width: calc((100% - max(12px, var(--safe-left)) - max(12px, var(--safe-right)) - 12px) / 2); bottom: calc(var(--touch-bottom) + var(--touch-hud-height) + 8px); min-height: 116px; padding: 9px 10px; }
  .race-screen .sail-sheet-controls { right: max(12px, var(--safe-right)); left: auto; }
  .race-screen .sail-rudder-controls { left: max(12px, var(--safe-left)); }
  .sailing-touch-controls .touch-hint { display: block; left: max(12px, var(--safe-left)); bottom: calc(var(--touch-bottom) + var(--touch-hud-height) + 36px); width: calc(50% - 24px); max-width: none; transform: none; font-size: 10px; }
  .sailing-touch-controls .touch-sail-engine { right: max(12px, var(--safe-right)); bottom: calc(var(--touch-bottom) + var(--touch-hud-height) + 132px); width: 100px; height: 44px; min-height: 44px; flex-direction: row; gap: 6px; padding: 5px 8px; border-radius: 8px; }
  .sailing-touch-controls .touch-sail-engine .icon { width: 20px; height: 20px; }
  .sailing-touch-controls .touch-sail-engine small { display: none; }
  .sail-engine-hint { display: none; }
}
@media (orientation: landscape) and (max-height: 500px) and (max-width: 1000px) {
  .race-screen { --sailing-hand-width: clamp(160px, 26vw, 230px); }
  .race-screen[data-touch-control-mode] .race-bottom-hud { left: calc(max(12px, var(--safe-left)) + var(--sailing-hand-width) + 8px); right: calc(max(12px, var(--safe-right)) + var(--sailing-hand-width) + 8px); grid-template-columns: 64px minmax(0, 1fr); height: 92px; }
  .race-screen[data-touch-control-mode] .race-status { padding-bottom: 19px; }
  .race-screen[data-touch-control-mode] .race-meter-group { position: absolute; left: 79px; right: 13px; bottom: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0; border: 0; border-image: none; box-shadow: none; }
  .race-screen[data-touch-control-mode] .race-meter-group > div { display: flex; align-items: center; gap: 4px; }
  .race-screen[data-touch-control-mode] .race-meter-group > div > span { flex: 0 0 11px; margin: 0; font-size: 0; gap: 0; }
  .race-screen[data-touch-control-mode] .race-meter-group b { font-size: 0; }
  .race-screen[data-touch-control-mode] .race-meter-group .icon { width: 11px; height: 11px; }
  .race-screen[data-touch-control-mode] .race-meter { flex: 1; height: 4px; margin: 0; }
  .race-screen[data-touch-control-mode] .race-speed > strong { font-size: 27px; }
  .race-screen[data-touch-control-mode] .race-status > #hud-sail { font-size: 8px; }
  .race-screen .sail-control-panel { width: var(--sailing-hand-width); bottom: var(--touch-bottom); }
  .race-screen .sailing-touch-controls .touch-hint { width: var(--sailing-hand-width); bottom: calc(var(--touch-bottom) + 40px); }
  .race-screen .sailing-touch-controls .touch-sail-engine { bottom: calc(var(--touch-bottom) + 124px); }
}
