/*
  段2 記録（スコア入力・打った結果・練習の記録・分析の図・目標スコア）の見た目。
  色は styles.css の役割変数（--bg --surface --surface-2 --text --text-muted --heading --green --on-green
  --accent-text --line --danger --danger-bg）だけを使う → ライト/ダークは変数側で切り替わる。
  押せる所は 44px 以上。390px 幅で横スクロールしない（路線図だけは枠の中で横に送る）。
*/

.rs-slot {
  margin: 0 0 14px;
}

.rs {
  min-width: 0;
}

.rs-body,
.rs-form,
.rs-hole,
.sr,
.sr-panel,
.sv,
.sv-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.rs-h {
  margin: 10px 0 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--heading);
}

.rs-body > .rs-h:first-child {
  margin-top: 0;
}

.rs-label {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
}

.rs-note {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-muted);
}

.rs-live {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
}

.rs-live:empty {
  display: none;
}

.rs-live.is-ok {
  color: var(--green);
  font-weight: 700;
}

.rs-live.is-warn {
  color: var(--accent-text);
  font-weight: 700;
}

.rs-live.is-error,
.rs-error {
  color: var(--danger);
  font-weight: 700;
}

.rs-error {
  margin: 0;
  font-size: 13px;
}

.rs-input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 16px; /* 16px 未満だと iPhone が拡大する */
}

.rs-input:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}

/* ---------- ボタン ---------- */

.rs-primary,
.rs-btn,
.rs-link,
.rs-danger,
.rs-opt,
.rs-row,
.rs-level,
.rs-ob,
.rs-step-b,
.rs-stop {
  font-family: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.rs-primary {
  min-height: 48px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: var(--green);
  color: var(--on-green);
  font-size: 15px;
  font-weight: 700;
}

.rs-btn {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.rs-link {
  min-height: 44px;
  padding: 0 4px;
  border: 0;
  background: none;
  color: var(--green);
  font-size: 14px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.rs-danger {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--danger);
  border-radius: 999px;
  background: none;
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
}

.rs-danger.is-armed {
  background: var(--danger);
  color: var(--surface);
}

.rs-primary:disabled,
.rs-btn:disabled,
.rs-danger:disabled {
  opacity: 0.5;
  cursor: default;
}

.rs-primary:focus-visible,
.rs-btn:focus-visible,
.rs-link:focus-visible,
.rs-danger:focus-visible,
.rs-opt:focus-visible,
.rs-row:focus-visible,
.rs-level:focus-visible,
.rs-ob:focus-visible,
.rs-step-b:focus-visible,
.rs-stop:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* 選択ボタンの列 */
.rs-seg {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.rs-opt {
  flex: 1 1 0;
  min-width: 44px;
  min-height: 44px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
}

.rs-opt[aria-pressed="true"],
.rs-opt[aria-selected="true"] {
  border-color: var(--green);
  background: var(--green);
  color: var(--on-green);
}

.rs-clubs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.rs-clubs .rs-opt {
  padding: 0 2px;
  font-size: 14px;
}

.rs-opt:last-child:nth-child(13) {
  grid-column: span 3; /* パター（13個目）は3マス分 */
}

/* ---------- 一覧・開始 ---------- */

.rs-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rs-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 10px;
  align-items: center;
  min-height: 56px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
}

.rs-row-main {
  font-size: 15px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.rs-row-sub {
  grid-column: 1 / -1;
  font-size: 12px;
  color: var(--text-muted);
}

.rs-row-score {
  grid-row: 1;
  grid-column: 2;
  font-size: 22px;
  font-weight: 700;
  color: var(--heading);
  font-variant-numeric: tabular-nums;
}

.rs-row-score small {
  margin-left: 4px;
  font-size: 11px;
  color: var(--text-muted);
}

.rs-more {
  align-self: center;
}

.rs-pending {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-2);
}

.rs-pending p {
  flex: 1 1 180px;
  margin: 0;
  font-size: 13px;
  color: var(--text);
}

.rs-question {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rs-levels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.rs-level {
  min-height: 64px;
  border: 1px solid var(--green);
  border-radius: 14px;
  background: var(--surface);
  color: var(--heading);
  font-size: 18px;
  font-weight: 700;
}

.rs-level:disabled {
  opacity: 0.6;
}

/* ---------- 入力中 ---------- */

.rs-head-t {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--heading);
  overflow-wrap: anywhere;
}

.rs-head-s {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

/* 路線図: ホールの丸を線でつなぐ。枠の中だけ横に送る */
.rs-rail {
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  margin: 0 -4px;
  padding: 4px;
  scrollbar-width: thin;
}

.rs-rail-list {
  display: flex;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rs-rail-list li {
  position: relative;
  flex: 0 0 auto;
  scroll-snap-align: center;
}

.rs-rail-list li + li::before {
  content: "";
  position: absolute;
  top: 22px;
  right: 50%;
  width: 100%;
  height: 3px;
  background: var(--line);
}

.rs-rail-list li:has(.is-done) + li::before {
  background: var(--green);
}

.rs-stop {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 48px;
  min-height: 64px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-muted);
}

.rs-stop-no {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
}

.rs-stop.is-done .rs-stop-no {
  border-color: var(--green);
  color: var(--green);
}

.rs-stop.is-current .rs-stop-no {
  border-color: var(--green);
  background: var(--green);
  color: var(--on-green);
}

.rs-stop-s {
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.rs-hole {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
}

.rs-hole-t {
  margin: 0;
  font-family: var(--font-mincho);
  font-size: 20px;
  font-weight: 600;
  color: var(--heading);
}

.rs-steps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.rs-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  border-radius: 12px;
  background: var(--surface);
}

.rs-step-l {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
}

.rs-step-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.rs-step-b {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--heading);
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
}

.rs-step-v {
  min-width: 2ch;
  font-size: 36px;
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
  color: var(--heading);
  font-variant-numeric: tabular-nums;
}

.rs-dir-row {
  display: flex;
  gap: 6px;
}

.rs-dirs {
  flex: 1;
  flex-wrap: nowrap;
}

.rs-dirs .rs-opt {
  padding: 0 4px;
  font-size: 14px;
}

.rs-ob {
  flex: 0 0 64px;
  min-height: 44px;
  border: 1px solid var(--danger);
  border-radius: 12px;
  background: var(--surface);
  color: var(--danger);
  font-size: 15px;
  font-weight: 700;
}

.rs-ob[aria-pressed="true"] {
  background: var(--danger);
  color: var(--surface);
}

.rs-more-box {
  border-top: 1px solid var(--line);
  padding-top: 4px;
}

.rs-summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  font-size: 14px;
  font-weight: 700;
  color: var(--green);
  cursor: pointer;
}

.rs-more-box[open] > .rs-summary {
  margin-bottom: 6px;
}

.rs-fs {
  min-width: 0;
  margin: 0 0 10px;
  padding: 8px 10px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.rs-fs legend {
  padding: 0 4px;
  font-size: 13px;
  font-weight: 700;
  color: var(--heading);
}

.rs-grid3,
.rs-grid2 {
  display: grid;
  gap: 8px;
}

.rs-grid3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.rs-field {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 4px;
  min-width: 0;
}

.rs-field .rs-label {
  font-size: 12px;
  line-height: 1.3;
}

.rs-field .rs-input {
  padding: 8px 6px;
}

.rs-check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
}

.rs-check input {
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--green);
}

.rs-nav {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr);
  gap: 8px;
}

.rs-finish {
  display: flex;
  flex-direction: column;
}

.rs-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

/* ---------- 判定 ---------- */

.rs-headline {
  margin: 0;
  padding: 12px 14px;
  border-left: 4px solid var(--gold);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--heading);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.5;
}

.rs-stats {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.rs-lines {
  margin: 0;
  padding: 0;
  list-style: none;
}

.rs-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 10px;
  align-items: center;
  padding: 8px 2px;
  border-top: 1px solid var(--line);
}

.rs-line-l {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.rs-line-v {
  grid-column: 1;
  font-size: 14px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.rs-line-v small {
  margin-left: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.rs-line .rs-chip {
  grid-column: 2;
  grid-row: 1 / span 2;
}

.rs-line-n {
  grid-column: 1 / -1;
  font-size: 12px;
  color: var(--text-muted);
}

.rs-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 4.5em;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  color: var(--text-muted);
}

.rs-chip.is-ok {
  border-color: var(--green);
  background: var(--green);
  color: var(--on-green);
}

.rs-chip.is-ng {
  border-color: var(--danger);
  background: var(--danger-bg);
  color: var(--danger);
}

.rs-chip.is-lack {
  border-style: dashed;
  color: var(--accent-text);
}

.rs-top {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: top;
}

.rs-top-i {
  position: relative;
  padding: 12px 14px 12px 44px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  counter-increment: top;
}

.rs-top-i::before {
  content: counter(top);
  position: absolute;
  top: 12px;
  left: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--green);
  color: var(--on-green);
  font-size: 13px;
  font-weight: 700;
}

.rs-top-w {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--heading);
}

.rs-top-loss {
  margin-left: 8px;
  font-size: 13px;
  color: var(--danger);
}

.rs-top-step {
  margin: 4px 0 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-text);
}

.rs-top-fact {
  margin: 4px 0 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
}

.rs-top-a {
  margin: 6px 0 0;
  padding-left: 1.2em;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
}

/* ---------- 打った結果（ターゲットナビの下） ---------- */

.tn-rec {
  min-width: 0;
}

.sr-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sr-panel,
.sr-list {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.sr-cond,
.sr-where {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
}

.sr-where {
  font-weight: 700;
}

.sr-map {
  display: block;
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
  cursor: crosshair;
  touch-action: manipulation;
}

.sr-rough {
  fill: var(--tn-rough, #d9eacd);
}

.sr-green {
  fill: var(--tn-green, #a9dca0);
  stroke: var(--tn-green-edge, #5aa653);
  stroke-width: 2;
}

.sr-cup {
  fill: #1a2742;
}

.sr-pole {
  stroke: #1a2742;
  stroke-width: 2;
}

.sr-cloth {
  fill: #b3261e;
}

.sr-aim {
  fill: none;
  stroke: #1a2742;
  stroke-width: 3.5;
  stroke-linecap: round;
}

.sr-ball {
  fill: #ffffff;
  stroke: #1a2742;
  stroke-width: 2.5;
}

.sr-t {
  fill: #2d5a2a;
  font-size: 14px;
  font-weight: 700;
}

/* ---------- 散らばり図・推移（records-charts.js） ---------- */

.sv-tabs .rs-opt {
  flex: 0 0 auto;
  min-width: 52px;
}

.rc-scatter,
.rc-trend {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 auto;
}

.rc-scatter {
  max-width: 280px;
}

.rc-frame {
  fill: var(--surface-2);
  stroke: var(--line);
}

.rc-grid {
  stroke: var(--line);
  stroke-width: 1;
}

.rc-axis {
  stroke: var(--text-muted);
  stroke-width: 1;
  stroke-dasharray: 3 3;
  opacity: 0.6;
}

.rc-dot {
  fill: var(--text-muted);
  fill-opacity: 0.55;
  stroke: var(--surface);
  stroke-width: 1.5;
}

.rc-dot-on {
  fill: var(--green);
  fill-opacity: 0.9;
}

.rc-aim {
  fill: var(--gold);
  stroke: var(--heading);
  stroke-width: 1.5;
}

.rc-lbl {
  fill: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
}

.rc-lbl-s {
  font-size: 10px;
  font-weight: 400;
}

.rc-line {
  fill: none;
  stroke: var(--green);
  stroke-width: 2.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.rc-pt {
  fill: var(--surface);
  stroke: var(--green);
  stroke-width: 2.5;
}

.rc-val {
  fill: var(--heading);
  font-size: 12px;
  font-weight: 700;
}

.rc-target {
  stroke: var(--gold);
  stroke-width: 2;
  stroke-dasharray: 6 4;
}

.rc-target-t {
  fill: var(--accent-text);
}

.sv-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 14px;
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
}

.sv-key::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 4px;
  border-radius: 50%;
  background: var(--text-muted);
  opacity: 0.6;
  vertical-align: -1px;
}

.sv-key-on::before {
  background: var(--green);
  opacity: 1;
}

.sv-key-aim::before {
  background: var(--gold);
  opacity: 1;
}

.sv-stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.sv-stats .stat dd {
  font-size: 18px;
}

.sv-h {
  margin: 4px 0 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--heading);
}

.sv-recent {
  margin: 0;
  padding: 0;
  list-style: none;
}

.sv-recent li {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--text);
}

.sv-r-d {
  flex: 0 0 3em;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.sv-r-o {
  flex: 1;
  min-width: 0;
}

/* ---------- 練習 ---------- */

.pr-add {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.pr-add .rs-input {
  flex: 1;
}

.pr-self {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pr-self .check-row {
  flex: 1;
  min-width: 0;
}

.pr-archive {
  flex: 0 0 auto;
  min-width: 44px;
  min-height: 44px;
  border: 0;
  background: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
}

/* ---------- 分析 ---------- */

.an-sub {
  margin: 12px 0 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
}

/* 開発用プレビュー（dev/records-preview.html）だけで使う */
.rp-body {
  background: var(--bg);
}
