/* 尿はね計算機（尿ハネシミュレーター）固有スタイル */

/* 年齢プリセット */
.us-presets{ display:flex; flex-wrap:wrap; gap:8px; margin-top:6px; }
.us-presets button{
  padding:8px 14px; border:1px solid var(--line); border-radius:999px; background:#fff;
  font-size:14px; color:var(--ink); cursor:pointer; line-height:1;
}
.us-presets button:hover{ border-color:var(--accent); }
.us-presets button.is-on{ background:var(--accent); border-color:var(--accent); color:#fff; font-weight:700; }

/* レンジ入力 */
.range-field label{ display:block; margin-bottom:6px; font-weight:700; }
.range-field output{ color:var(--accent); font-weight:700; font-variant-numeric:tabular-nums; }
.range-field input[type="range"]{ width:100%; }
.range-ends{ display:flex; justify-content:space-between; font-size:12px; color:var(--muted); margin-top:2px; }

/* 泡スイッチ */
.us-foam{ margin-top:14px; padding-top:14px; border-top:1px solid var(--line); }
.switch{ display:inline-flex; align-items:center; gap:8px; font-weight:700; cursor:pointer; }
.switch input{ width:18px; height:18px; }

/* ステージ（キャンバス） */
.us-stage{ margin:12px 0 16px; }
.us-stage canvas{
  width:100%; height:auto; display:block; background:#fff;
  border:1px solid var(--line); border-radius:12px;
}

/* スコア：指数／内訳／距離と角度 の3カードを横に並べる */
.us-score{ display:grid; grid-template-columns:1fr; gap:14px; align-items:stretch; }
.us-score .hs-card{ margin:0; display:flex; flex-direction:column; }
.hs-card--main{ justify-content:space-between; }
.hs-label{ font-size:13px; color:var(--muted); }
.hs-value{ font-size:46px; font-weight:800; line-height:1.1; font-variant-numeric:tabular-nums; }
.hs-value small{ font-size:16px; font-weight:600; color:var(--muted); margin-left:4px; }
.hs-judge{ margin-top:4px; font-weight:700; }
.hs-judge.is-ok{ color:#1f8a52; }
.hs-judge.is-warn{ color:#c77a16; }
.hs-judge.is-bad{ color:#c0392b; }
/* 指数カードの下段（便器に収まらなかった滴／総滴） */
.hs-out{ margin-top:14px; padding-top:12px; border-top:1px solid var(--line); display:flex; flex-direction:column; gap:3px; }
.hs-out .hf-v{ font-size:22px; }
/* 内訳・距離と角度カードの中身は「項目：値」の行で積む */
/* .panel > h3 の既定(18px・ネイビー)より強い指定にする */
.us-score .hs-card-t{ font-size:13px; color:var(--muted); font-weight:700; margin:0 0 8px; letter-spacing:0; }
.hs-list{ margin:0; display:flex; flex-direction:column; gap:6px; }
.hs-row{ display:flex; align-items:baseline; justify-content:space-between; gap:10px;
         padding:7px 10px; background:#f7f9fb; border-radius:8px; }
.hs-row dt{ font-size:12px; color:var(--muted); }
.hs-row dd{ margin:0; font-weight:700; font-variant-numeric:tabular-nums; }
.hf-k{ font-size:12px; color:var(--muted); }
.hf-v{ font-weight:700; font-variant-numeric:tabular-nums; }

.us-advice{ margin-top:12px; }
.us-advice p{ margin:0; line-height:1.9; }

@media (max-width:720px){
  .hs-value{ font-size:40px; }
}

/* 狙う場所：7段階スナップの目盛り */
.us-aim input[type="range"]{
  /* datalist の目盛りをブラウザが出さない環境向けに、背景でドットを描く */
  background-image:radial-gradient(circle, var(--line) 2.5px, transparent 2.6px);
  background-size:calc((100% - 16px)/6) 10px;
  background-position:8px bottom;
  background-repeat:repeat-x;
  padding-bottom:10px;
}
.us-aim .range-ends{ margin-top:-2px; }
.us-aim output{ display:inline-block; min-width:9em; }

/* ===== 2カラム（左＝操作バー群／右＝図と結果）。スマホは縦積み ===== */
.us-cols{ display:grid; grid-template-columns:minmax(300px,360px) 1fr; gap:20px; align-items:start; }
.us-col-in .panel{ margin:0; }
.us-col-in .grid{ grid-template-columns:1fr; gap:14px; }   /* 左カラムは1列に積む */
/* 右カラムは「図（左・広い）＋結果カード（右・縦積み）」の2列。アドバイスは下に全幅 */
.us-col-out{
  position:sticky; top:14px;                               /* 図は追従させ、操作中も見え続ける */
  display:grid; grid-template-columns:minmax(0,1.9fr) minmax(250px,1fr); gap:14px; align-items:start;
}
/* 図は左列の上、アドバイスは図のすぐ下。結果カードは右列で2行ぶんを使う */
.us-col-out .us-stage{ grid-column:1; grid-row:1; margin:0; }
.us-col-out .us-advice{ grid-column:1; grid-row:2; margin:0; }
.us-col-out .us-score{ grid-column:2; grid-row:1 / span 2; }

/* 右カラムが狭くなると図が小さくなりすぎるので、図を全幅に戻して結果カードを下に回す */
@media (max-width:1080px){
  .us-col-out{ grid-template-columns:1fr; }
  .us-col-out .us-stage,
  .us-col-out .us-advice,
  .us-col-out .us-score{ grid-column:1; grid-row:auto; }
  .us-score{ grid-template-columns:repeat(auto-fit,minmax(230px,1fr)); }
}

@media (max-width:860px){
  /* 縦積み。図を先頭に固定し、その下でバーを操作しても図が見え続けるようにする。
     .us-col-out を display:contents にして、中の3ブロックを直接並び替える。 */
  .us-cols{ grid-template-columns:1fr; gap:14px; }
  .us-col-out{ display:contents; }
  .us-col-out .us-stage{
    /* 追従ヘッダーと追従h1(.page-head)の下に貼り付ける。top:0 だと h1 の後ろに潜り込む。
       --sticky-h は common.js が「ヘッダー＋h1」の実高さを入れている */
    order:-1; position:sticky; top:calc(var(--sticky-h) + 4px); z-index:3;
    background:#fff; margin:0 -14px; padding:6px 14px 8px;
    box-shadow:0 6px 10px -8px rgba(30,45,65,.35);
  }
  .us-col-in{ order:0; }
  .us-score{ order:1; grid-template-columns:repeat(auto-fit,minmax(230px,1fr)); }
  .us-advice{ order:2; margin:0; }
}

/* 腰を落とす：4段階スナップ（狙う場所と同じ目盛り） */
.us-pose input[type="range"]{
  background-image:radial-gradient(circle, var(--line) 2.5px, transparent 2.6px);
  background-size:calc((100% - 16px)/3) 10px;
  background-position:8px bottom;
  background-repeat:repeat-x;
  padding-bottom:10px;
}
.us-pose .range-ends{ margin-top:-2px; }
/* cmの値だけ幅を固定して桁が増えてもズレないようにする。
   ポーズ名は幅を固定しない（閉じカッコの手前に空白が空いて見えるため） */
.us-pose #oPose{ min-width:2.2em; display:inline-block; text-align:right; }
