/* ==================================================================== *
 * ショップ（vasallohockey.myshopify.com）に見た目を揃える（2026-10-21 採用カンプ：白・黒・薄いグレー）
 * 白い背景・#101112 の文字と主ボタン・画像の背景 #F3F4F4・細いグレーの線・小さな角丸・影はほぼ無し。
 * 英字の見出しは Oswald、日本語は Noto Sans JP。選択中は「黒い枠＋チェック」、次へ進むボタンは黒地＋白文字＋矢印。
 * styles.css・workspace.css の後に読み、色（ライム）と書体をここで上書きする。
 * ==================================================================== */

:root {
  --ink: #101112;
  --paper: #ffffff;
  --panel: #ffffff;
  --muted: #6b7072;
  --line: #dfe3e5;
  --soft: #f3f4f4;
  --accent: #101112;
  --ws-frame-bg: #f3f4f4;
  --ws-line: #dfe3e5;
  --ws-soft: #f3f4f4;
  --ws-focus: #101112;
  --font-en: Oswald, "Noto Sans JP", sans-serif;
  --header-h: 72px;
}

body {
  background: #fff;
  color: var(--ink);
  font-family: "Noto Sans JP", "Hiragino Sans", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.skip-link { background: var(--ink); color: #fff; }

/* ---------- ヘッダー（ショップと同じ：白地・左に黒い四角のロゴ・下に細い線） ---------- */

.site-header {
  position: relative;
  z-index: 20;
  height: var(--header-h);
  padding: 0 clamp(16px, 5vw, 108px);
  display: flex;
  align-items: stretch;
  justify-content: flex-start;
  gap: clamp(14px, 2vw, 28px);
  background: #fff;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
}

.site-header .brand {
  flex: none;
  display: grid;
  place-items: center;
  padding: 0 16px;
  background: var(--ink);
  font-size: 0;
}

.site-header .brand img { display: block; width: auto; height: 46px; }
.site-header .brand:focus-visible { outline-offset: -4px; outline-color: #fff; }

.site-title {
  margin: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-width: 0;
}

.site-title .en {
  font-family: var(--font-en);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: .06em;
  line-height: 1.1;
  white-space: nowrap;
}

.site-title .ja { color: var(--muted); font-size: 11px; font-weight: 500; white-space: nowrap; }

/* 題は最初（アイテム選び）へのリンク */
a.site-title { color: var(--ink); text-decoration: none; }
a.site-title:hover .en { text-decoration: underline; text-underline-offset: 4px; }

.header-history { margin-left: auto; align-self: center; }

.header-history .history-button {
  min-height: 40px;
  padding: 6px 10px;
  border-radius: 3px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
}

.header-history .history-button:hover:not(:disabled) { background: var(--soft); }
.header-history .history-button:disabled { color: #b4b9bb; }
.header-history .history-button:focus-visible { outline: 2px solid var(--ink); }

/* 元に戻す／やり直すは、作業画面と結果一覧で使う（アンケート中は出さない） */
body[data-view="start"] .header-history { visibility: hidden; }

/* ---------- 共通の部品 ---------- */

main { padding-top: 0; }

.sim-label {
  margin: 0 0 10px;
  font-family: var(--font-en);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .14em;
  color: var(--muted);
}

/* 次へ進むボタン（黒地＋白文字＋矢印） */
.btn-main,
.btn-sub {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 12px 26px;
  border: 1px solid var(--ink);
  border-radius: 3px;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .02em;
  cursor: pointer;
  transition: background .14s ease, color .14s ease;
}

.btn-main { background: var(--ink); color: #fff; }
.btn-main:hover:not(:disabled) { background: #2b2e30; }
.btn-sub { background: #fff; color: var(--ink); }
.btn-sub:hover:not(:disabled) { background: var(--soft); }
.btn-main:disabled { cursor: not-allowed; opacity: .45; }
.btn-small { min-height: 40px; padding: 8px 16px; font-size: 13px; }

/* 既存のボタンもショップの見た目に */
.btn { border-radius: 3px; font-weight: 700; }
.btn.primary { background: var(--ink); color: #fff; }
.btn.primary:hover:not(:disabled) { background: #2b2e30; }
.btn.ghost:hover:not(:disabled) { background: var(--soft); }

/* 選択中の印（右上の黒い丸にチェック） */
.pick-check {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 26px;
  height: 26px;
  display: none;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}

.pick-check::before { content: "✓"; }

.ws-notice,
.ws-contrast {
  border-left: 3px solid var(--ink);
  background: var(--soft);
  color: var(--ink);
}

/* ==================================================================== *
 * アンケート（アイテム → 本体色 → チーム情報）
 * ==================================================================== */

.sv { max-width: 1120px; margin: 0 auto; padding: 40px 0 72px; }

.sv-head { text-align: center; }
.sv-head .sim-label { margin-bottom: 18px; }

.sv-steps {
  margin: 0 auto 36px;
  padding: 0;
  display: flex;
  justify-content: center;
  list-style: none;
  max-width: 560px;
}

.sv-steps li {
  position: relative;
  flex: 1 1 0;
  display: grid;
  justify-items: center;
  gap: 8px;
  color: #9a9fa1;
  font-size: 13px;
  font-weight: 500;
}

/* 丸と丸のあいだの線 */
.sv-steps li + li::before {
  content: "";
  position: absolute;
  top: 15px;
  right: calc(50% + 22px);
  left: calc(-50% + 22px);
  height: 1px;
  background: var(--line);
}

.sv-steps li.is-done + li::before,
.sv-steps li.is-done + li.is-current::before { background: var(--ink); }

.sv-step {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 0 6px 4px;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.sv-step:disabled { cursor: default; }
/* 済んだステップは押して戻れる。タッチでも分かるよう、名前にいつも下線 */
.sv-step:not(:disabled) .sv-step-label { text-decoration: underline; text-underline-offset: 3px; }
.sv-step:not(:disabled):hover .sv-step-mark { background: var(--soft); }

.sv-step-mark {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  font-family: var(--font-en);
  font-size: 14px;
  font-weight: 600;
}

.sv-steps li.is-current { color: var(--ink); font-weight: 700; }
.sv-steps li.is-current .sv-step-mark { border-color: var(--ink); background: var(--ink); color: #fff; }
.sv-steps li.is-done { color: var(--ink); }
.sv-steps li.is-done .sv-step-mark { border-color: var(--ink); color: var(--ink); }

.sv-panel[hidden] { display: none; }

.sv-title {
  margin: 0;
  text-align: center;
  font-size: clamp(22px, 2.6vw, 30px);
  font-weight: 700;
  letter-spacing: .02em;
  line-height: 1.4;
}

.sv-title:focus { outline: none; }

.sv-lead { margin: 10px 0 0; text-align: center; color: var(--muted); font-size: 14px; line-height: 1.7; }

/* 次へ・戻る */
.sv-nav {
  margin-top: 36px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sv-nav .btn-main { min-width: 260px; }

/* STEP 1：アイテムのカード（PC は 1 段、スマホは 2 列） */
.item-cards {
  margin-top: 30px;
  display: grid;
  grid-template-columns: repeat(var(--item-count, 6), minmax(0, 1fr));
  gap: 14px;
}

.item-card {
  position: relative;
  display: grid;
  gap: 10px;
  padding: 0 0 12px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  text-align: center;
  cursor: pointer;
  transition: border-color .14s ease;
}

.item-card:hover { border-color: #9a9fa1; }

.item-card-media {
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--soft);
}

.item-card-media img { display: block; width: 100%; height: 100%; padding: 5%; object-fit: contain; mix-blend-mode: multiply; }
.item-card-media.is-error img { visibility: hidden; }
.item-card-media.is-error { display: grid; place-items: center; }
.item-card-media.is-error::after { content: "画像を読み込めませんでした"; color: var(--muted); font-size: 11px; }
.item-card-name { padding: 0 8px; font-size: 14px; font-weight: 700; line-height: 1.4; }

.item-card[aria-checked="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.item-card[aria-checked="true"] .pick-check { display: grid; }
.item-card:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

/* STEP 2：本体色（左に無地の見本、右に色名つきの色） */
.sv-color {
  margin-top: 28px;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: clamp(20px, 4vw, 56px);
  align-items: start;
}

.sv-preview { margin: 0; }

.sv-preview-frame {
  position: relative;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--soft);
}

.sv-preview-frame img.sv-shirt { display: block; width: 100%; height: 100%; object-fit: contain; }
.sv-preview-frame .sv-zone-host { position: relative; display: block; width: 100%; height: 100%; }
.sv-preview-frame .sv-zone-host > svg { display: block; width: 100%; height: 100%; }
.sv-preview-frame.is-error::after { content: "画像を読み込めませんでした"; position: absolute; color: var(--muted); font-size: 13px; }

/* 部位の商品の写真は背景が白なので、枠も白に */
body[data-product-kind="zones"] .sv-preview-frame { background: #fff; box-shadow: inset 0 0 0 1px var(--line); }

.sv-color-panel { display: grid; gap: 14px; align-content: start; padding-top: 6px; }

.sv-picked {
  margin: 0;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.sv-picked strong { margin-left: 10px; color: var(--ink); font-size: 16px; font-weight: 700; }

.sv-label { margin: 0; font-size: 14px; font-weight: 700; }
.sv-label strong { margin-left: 8px; font-weight: 700; }
.sv-count { margin-left: 6px; color: var(--muted); font-size: 12px; font-weight: 500; }

/* 色名つきの色見本 */
.named-swatches {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
}

.named-swatch {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 10px 4px 8px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.named-swatch:hover { border-color: #9a9fa1; }

.named-swatch-dot {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(16, 17, 18, .22);
}

.named-swatch-label { font-size: 12px; font-weight: 500; line-height: 1.3; text-align: center; overflow-wrap: anywhere; }

.named-swatch[aria-checked="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.named-swatch[aria-checked="true"] .named-swatch-label { font-weight: 700; }

.named-swatch[aria-checked="true"]::after {
  content: "✓";
  position: absolute;
  top: 5px;
  right: 5px;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
}

.named-swatch:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* STEP 3：チーム情報 */
.sv-team {
  margin-top: 28px;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: clamp(20px, 4vw, 48px);
  align-items: start;
}

.sv-fields { display: grid; gap: 18px; }
.sv-field { display: grid; gap: 8px; }

.sv-field input,
.sv-year-field input {
  width: 100%;
  min-height: 52px;
  padding: 10px 14px;
  border: 1px solid #c9ced0;
  border-radius: 3px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 17px;
  font-weight: 700;
}

.sv-field input::placeholder { color: #a3a8aa; font-size: 14px; font-weight: 400; }

.sv-field input:focus,
.sv-year-field input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }

.sv-year { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

.sv-check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.sv-check input { width: 20px; height: 20px; margin: 0; accent-color: var(--ink); }
.sv-year-field { flex: 0 1 160px; }
.sv-year-field[hidden] { display: none; }
.sv-year-field input:disabled { background: var(--soft); color: #a3a8aa; }

.sv-note { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.7; }

/* ロゴ（アンケート・条件の編集パネル） */
.sv-logo { gap: 8px; }
.sv-logo .logo-field-label { color: var(--ink); font-size: 14px; font-weight: 700; }
.sv-logo .logo-choose { min-height: 46px; border-color: var(--ink); border-radius: 3px; font-weight: 700; }
.sv-logo .logo-choose:hover { background: var(--soft); }
.sv-logo .logo-preview { border-radius: 3px; }
.sv-logo .logo-clear { border-radius: 3px; }
.sv-sample-logo { display: block; max-width: 96px; max-height: 64px; object-fit: contain; margin-bottom: 6px; }
.sv-sample-logo[hidden] { display: none; }

/* 文字の表示例（デザインではない、ただの文字の確認） */
.sv-sample { margin: 0; padding: 18px; border: 1px solid var(--line); border-radius: 3px; background: #fff; }
.sv-sample figcaption { margin-bottom: 10px; color: var(--muted); font-size: 12px; font-weight: 700; }

.sv-sample-box {
  min-height: 150px;
  padding: 20px 12px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 6px;
  background: var(--soft);
  text-align: center;
}

.sv-sample-team {
  font-family: var(--font-en);
  font-size: clamp(26px, 3vw, 38px);
  font-weight: 700;
  letter-spacing: .04em;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.sv-sample-sport { font-family: var(--font-en); font-size: 15px; font-weight: 600; letter-spacing: .2em; }
.sv-sample-year { font-family: var(--font-en); font-size: 14px; font-weight: 500; letter-spacing: .08em; }
.sv-sample-sport[hidden], .sv-sample-year[hidden] { display: none; }
.sv-sample-note { margin: 10px 0 0; color: var(--muted); font-size: 12px; }

.sv-zones-note {
  margin: 28px auto 0;
  max-width: 640px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  background: var(--soft);
  font-size: 14px;
  line-height: 1.8;
  text-align: center;
}

/* 文字の商品だけ・部位の商品だけの要素 */
body[data-product-kind="zones"] [data-text-only] { display: none !important; }
body:not([data-product-kind="zones"]) [data-zones-only] { display: none !important; }

/* ==================================================================== *
 * 全デザインの結果一覧
 * ==================================================================== */

.rs { padding: 36px 0 120px; }

.rs-head { text-align: center; }
.rs-back { margin-bottom: 4px; }
.rs-back .btn-sub { min-height: 36px; padding: 4px 14px; border-color: var(--line); font-size: 13px; text-decoration: none; }
.rs-back .btn-sub:hover { border-color: var(--ink); }

.rs-title {
  margin: 0;
  font-size: clamp(24px, 3vw, 36px);
  font-weight: 700;
  letter-spacing: .02em;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.rs-title:focus { outline: none; }
#rsTeam { font-family: var(--font-en); font-weight: 700; letter-spacing: .04em; }
.rs-lead { margin: 8px 0 0; color: var(--muted); font-size: 14px; }

/* 条件（アイテム・本体色・チーム情報・プリント配色） */
.rs-conditions {
  margin: 28px 0 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

body[data-product-kind="zones"] .rs-conditions { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.rs-cond {
  min-width: 0;
  padding: 14px 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  column-gap: 10px;
  row-gap: 4px;
  align-items: center;
}

.rs-cond + .rs-cond { border-left: 1px solid var(--line); }
.rs-cond-label { grid-column: 1; color: var(--muted); font-size: 12px; font-weight: 500; }

.rs-cond-value {
  grid-column: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.rs-cond-value .color-dot { flex: none; width: 16px; height: 16px; margin: 0; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(16, 17, 18, .25); border: 0; }
.rs-cond-value .color-dot + .color-dot { margin-left: -10px; box-shadow: 0 0 0 2px #fff, inset 0 0 0 1px rgba(16, 17, 18, .25); }

.rs-change {
  grid-column: 2;
  grid-row: 1 / span 2;
  min-height: 36px;
  padding: 4px 14px;
  border: 1px solid var(--ink);
  border-radius: 3px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.rs-change:hover { background: var(--soft); }

.rs-notice { margin: 16px 0 0; }

.rs-toolbar {
  margin-top: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.rs-count { margin: 0; font-family: var(--font-en), "Noto Sans JP", sans-serif; font-size: 15px; font-weight: 600; letter-spacing: .02em; }
.rs-tools { display: flex; gap: 8px; }
.rs-hint { margin: 8px 0 0; color: var(--muted); font-size: 13px; }

/* 白黒の切り替え（服全体／プリントを拡大・正面／側面） */
.seg-mono { display: inline-flex; border: 1px solid var(--ink); border-radius: 3px; overflow: hidden; }
.seg-mono:empty { display: none; }

.seg-mono button {
  min-height: 38px;
  min-width: 72px;
  padding: 0 14px;
  border: 0;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.seg-mono button + button { border-left: 1px solid var(--ink); }
.seg-mono button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.seg-mono button:focus-visible { outline: 2px solid var(--ink); outline-offset: -4px; box-shadow: inset 0 0 0 3px #fff; }

/* 一覧のカード（PC 4 列・中くらい 3 列・スマホ 2 列） */
.rs-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 28px 18px;
}

.rs-card { min-width: 0; display: grid; gap: 10px; align-content: start; }

.rs-preview {
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 3px;
  background: none;
  cursor: pointer;
}

.rs-stage {
  position: relative;
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--soft);
  border-radius: 2px;
}

.rs-grid[data-kind="zones"] .rs-stage { background: #fff; box-shadow: inset 0 0 0 1px var(--line); }

.rs-stage .mockup-stack {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  transition: transform .28s ease;
  transform-origin: 50% var(--print-origin-y, 41%);
}

.rs-grid.is-print-zoom .rs-stage .mockup-stack { transform: scale(2.15); }

@media (prefers-reduced-motion: reduce) {
  .rs-stage .mockup-stack { transition: none; }
}

.rs-preview:hover { border-color: #9a9fa1; }
.rs-preview:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

.rs-status {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  padding: 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
  pointer-events: none;
}

.rs-card.is-ready .rs-status { display: none; }
.rs-card.is-error .rs-stage { background: #fff; box-shadow: inset 0 0 0 1px var(--line); }
.rs-card.is-error .shirt-image { opacity: .25; }
.rs-card.is-error .rs-status { color: var(--ink); font-weight: 700; }

.rs-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }

.rs-name {
  min-width: 0;
  font-family: var(--font-en), "Noto Sans JP", sans-serif;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: .04em;
}

.rs-sub { color: var(--muted); font-family: "Noto Sans JP", sans-serif; font-size: 12px; font-weight: 500; letter-spacing: 0; }

.rs-keep {
  flex: none;
  min-height: 36px;
  padding: 4px 12px;
  border: 1px solid var(--ink);
  border-radius: 3px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.rs-keep:hover:not(:disabled) { background: var(--soft); }
.rs-keep.is-kept { background: var(--ink); color: #fff; }
.rs-keep:disabled { cursor: not-allowed; opacity: .45; }

.rs-end {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
}

.rs-end p { margin: 0; }

/* 比較に残した組み合わせ（あるときだけ画面の下に） */
.rs-compare-bar {
  position: fixed;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 18;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 10px 10px 20px;
  border: 1px solid var(--ink);
  border-radius: 3px;
  background: #fff;
  box-shadow: 0 6px 20px rgba(16, 17, 18, .12);
  white-space: nowrap;
}

.rs-compare-bar[hidden] { display: none; }
.rs-compare-bar p { margin: 0; font-size: 13px; font-weight: 700; }
#rsCompareCount { font-family: var(--font-en); font-size: 16px; }

/* ==================================================================== *
 * 条件の編集パネル（PC は右から、スマホは下から）
 * ==================================================================== */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(16, 17, 18, .42);
}

.sheet-backdrop[hidden] { display: none; }

.sheet {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(460px, 100%);
  display: flex;
  flex-direction: column;
  background: #fff;
  box-shadow: -8px 0 24px rgba(16, 17, 18, .12);
}

.sheet-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
}

.sheet-head h2 { margin: 0; font-size: 17px; font-weight: 700; }

.sheet-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 20px 28px;
}

.sheet-sec { padding: 20px 0; display: grid; gap: 12px; }
.sheet-sec h3 { margin: 0; font-size: 15px; font-weight: 700; }
.sheet-sec h3 strong { margin-left: 8px; font-weight: 700; }
.sheet-sec[hidden] { display: none; }
/* 見出しはパネルの題（「アイテムを変更」など）と重なるので、読み上げ用に残して見た目は隠す。本体色だけは今の色名を見せる */
.sheet-sec:not([data-sheet-sec="body"]) > h3 {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.sheet .item-cards.is-compact { margin-top: 0; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.sheet .item-card { gap: 6px; padding-bottom: 8px; }
.sheet .item-card-name { font-size: 12px; }
.sheet .item-card .pick-check { top: 6px; right: 6px; width: 22px; height: 22px; font-size: 12px; }
.sheet .named-swatches { grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 6px; }
.sheet .named-swatch-dot { width: 32px; height: 32px; }
.sheet-reco { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.sheet-reco .link-button { font-size: 13px; }
.sheet .sv-label { margin-top: 6px; }

/* 印刷色・部位の色の丸（作業画面と同じ見た目） */
.sheet .print-color-grid { display: flex; flex-wrap: wrap; gap: 8px 10px; margin: 0; }

.sheet .print-color-grid .color-button {
  position: relative;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
}

.sheet .color-button .color-label { display: none; }
.sheet .color-button .swatch { width: 38px; height: 38px; border: 1px solid rgba(0, 0, 0, .3); border-radius: 50%; }
.sheet .color-button:hover .swatch { box-shadow: 0 0 0 2px #fff, 0 0 0 3px #9a9fa1; }
.sheet .color-button[aria-checked="true"] { background: transparent; box-shadow: none; border: 0; }
.sheet .color-button[aria-checked="true"] .swatch { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--ink); }

.sheet .color-button[aria-checked="true"]::after {
  content: "✓";
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

.sheet .color-role { display: grid; gap: 10px; margin: 0 0 16px; }
.sheet .color-role-note { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.sheet .ws-label-count { margin-left: 6px; color: var(--muted); font-size: 12px; font-weight: 500; }
.sheet .ws-label-value { margin-left: 6px; }

/* ==================================================================== *
 * 作業画面（詳細の編集）：ライムを黒と薄いグレーに置き換える
 * ==================================================================== */

body[data-view="edit"] main { width: 100%; max-width: none; padding: 0; }

.ws-back { height: var(--ws-back-h); display: flex; align-items: flex-end; padding: 0 clamp(16px, 2vw, 24px); }

/* PC は「一覧に戻る」の下を画面の高さに収める */
@media (min-width: 900px) {
  :root { --ws-back-h: 48px; }
  .ws-layout { height: calc(100dvh - var(--header-h) - var(--ws-back-h)); }
  body.is-test-mode .ws-layout { height: calc(100dvh - var(--header-h) - var(--ws-back-h) - 38px); }
}

@media (min-width: 900px) and (max-height: 640px) {
  .ws-layout, body.is-test-mode .ws-layout { height: auto; }
}
.ws-back .btn-sub { min-height: 36px; padding: 4px 14px; border-color: var(--line); font-size: 13px; }
.ws-back .btn-sub:hover { border-color: var(--ink); }

.ws-stage-title { font-weight: 700; }
.seg button { border-radius: 3px; }
.seg button:focus-visible { outline: 2px solid var(--ink); }

.target-box {
  border: 2px dashed var(--ink);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .85), inset 0 0 0 1px rgba(255, 255, 255, .85);
}

.ws-tab { border-radius: 3px; font-weight: 700; }
.ws-tab[aria-selected="true"] { box-shadow: none; }
.ws-tab:focus-visible { outline: 2px solid var(--ink); }

.ws-panel input[type="text"],
.ws-panel select { border-color: #c9ced0; border-radius: 3px; }

.ws-panel input[type="text"]:focus,
.ws-panel select:focus,
.product-select:focus-within { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }

.ws .color-button[aria-checked="true"] .swatch { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--ink); }
.ws .color-button:focus-visible { outline: 2px solid var(--ink); }


.btn.ws-cta { background: var(--ink); color: #fff; border-radius: 3px; font-weight: 700; }
.btn.ws-cta:hover:not(:disabled) { background: #2b2e30; color: #fff; }
.btn.ws-cta:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.ws-keep-button { border-radius: 3px; }

.link-button:hover { color: #4a4e50; }
.ws-mobile-notice { color: var(--ink); }

.compare-modal mark { background: var(--ink); color: #fff; }
.compare-table tr.is-diff th, .compare-table tr.is-diff td { background: var(--soft); }
.candidate-letter { border-radius: 2px; }

.modal { border: 0; border-radius: 4px; }
.modal-body { background: var(--soft); }
.modal-note { color: var(--muted); }
.modal-backdrop { background: rgba(16, 17, 18, .55); }

.view-head h1, .intro h1 { font-weight: 700; letter-spacing: 0; }
.eyebrow { font-family: var(--font-en); letter-spacing: .14em; }

.summary-card, .contact-card { border-radius: 3px; }
.notice { border-radius: 3px; }

/* ==================================================================== *
 * 中くらいの画面（〜1199px）・タブレット（〜899px）
 * ==================================================================== */

@media (max-width: 1199px) {
  .rs-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .item-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .rs-conditions,
  body[data-product-kind="zones"] .rs-conditions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rs-cond:nth-child(2n + 1) { border-left: 0; }
  .rs-cond:nth-child(n + 3) { border-top: 1px solid var(--line); }
  body[data-product-kind="zones"] .rs-cond[data-cond="print"] { grid-column: 1 / -1; border-left: 0; }
}

@media (max-width: 899px) {
  :root { --header-h: 56px; }

  .site-header { padding: 0 12px 0 0; gap: 12px; }
  .site-header .brand { padding: 0 12px; }
  .site-header .brand img { height: 34px; }
  .site-title .en { font-size: 14px; }
  .site-title .ja { font-size: 10px; }
  .header-history .history-button { padding: 6px 8px; font-size: 12px; }
  /* スマホでは、元に戻す／やり直すは作業画面だけ */
  body:not([data-view="edit"]) .header-history { display: none; }

  main { width: min(100% - 32px, 1480px); }

  .sv { padding: 24px 0 calc(110px + env(safe-area-inset-bottom)); }
  .sv-head .sim-label { margin-bottom: 14px; }
  .sv-steps { margin-bottom: 24px; }
  .sv-steps li { font-size: 12px; }
  .sv-title { font-size: 21px; }
  .sv-lead { font-size: 13px; }

  .item-cards { margin-top: 20px; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .item-card-name { font-size: 13px; }

  .sv-color, .sv-team { margin-top: 18px; grid-template-columns: 1fr; gap: 18px; }
  /* 見本は画面の 3 分の 1 ほどにして、色の選択が最初の画面に入るようにする */
  .sv-preview-frame { aspect-ratio: auto; height: min(100vw - 32px, 34vh); }
  .sv-color-panel { gap: 10px; padding-top: 0; }
  .sv-picked { padding-bottom: 10px; }
  .named-swatches { grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 6px; }
  .named-swatch-dot { width: 34px; height: 34px; }

  /* 次へ・戻る（画面の下に固定。入力の邪魔にならないよう、キーボードが出たらしまう） */
  .sv-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 15;
    margin: 0;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: #fff;
    border-top: 1px solid var(--line);
  }

  .sv-nav { gap: 8px; }
  .sv-nav .btn-main { flex: 1 1 auto; min-width: 0; min-height: 50px; padding: 10px 12px; gap: 8px; font-size: 14px; white-space: nowrap; }
  .sv-nav .btn-sub { flex: none; min-height: 50px; padding: 10px 10px; gap: 6px; font-size: 12px; white-space: nowrap; }
  .sv-nav > span:empty { display: none; }
  body.is-keyboard .sv-nav { position: static; margin-top: 24px; padding-inline: 0; border-top: 0; }

  .sv-sample-box { min-height: 110px; }

  .rs { padding: 22px 0 calc(96px + env(safe-area-inset-bottom)); }
  .rs-title { font-size: 22px; }
  .rs-lead { font-size: 13px; }
  .rs-conditions { margin-top: 18px; }
  .rs-cond { padding: 10px 12px; }
  .rs-cond-value { font-size: 13px; }
  .rs-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 12px; }
  .rs-name { font-size: 14px; }
  .rs-card-foot { flex-wrap: wrap; }
  .rs-keep { min-height: 34px; padding: 4px 10px; font-size: 12px; }

  .rs-compare-bar {
    left: 0;
    right: 0;
    bottom: 0;
    transform: none;
    justify-content: space-between;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    border: 0;
    border-top: 1px solid var(--line);
    border-radius: 0;
    box-shadow: 0 -6px 16px rgba(16, 17, 18, .08);
  }

  /* 条件の編集はスマホでは下からのシート */
  .sheet {
    top: auto;
    left: 0;
    width: 100%;
    max-height: 86dvh;
    border-radius: 10px 10px 0 0;
    box-shadow: 0 -8px 24px rgba(16, 17, 18, .16);
  }

  .sheet-head { padding: 12px 16px; }
  .sheet-body { padding: 0 16px calc(24px + env(safe-area-inset-bottom)); }

  :root { --ws-back-h: 44px; }
  .ws-back { padding: 0 16px; }
  /* 中身が短いタブ（ロゴなど）でも、ヘッダーと「一覧に戻る」を上へ送って見本を画面の上端に固定できる高さにする */
  .ws-panel { background: #fff; min-height: calc(100dvh - var(--edit-sticky-h, 300px)); }
}

@media (max-width: 599px) {
  /* 条件は 2 列に詰め、「変更」は値の右上の小さなボタンに */
  .rs-cond { padding: 8px 8px 9px; column-gap: 6px; row-gap: 2px; }
  .rs-cond:nth-child(2n + 1) { padding-left: 0; }
  .rs-cond-label { font-size: 11px; }
  .rs-cond-value { grid-column: 1 / -1; font-size: 12px; line-height: 1.45; }
  .rs-change { grid-row: 1; min-height: 28px; padding: 2px 10px; font-size: 12px; }
  .rs-title { font-size: 20px; }
  .rs-head .sim-label { display: none; }
  /* 部位の商品は条件が 3 つ。部位の配色は横幅いっぱいに */
  body[data-product-kind="zones"] .rs-cond[data-cond="print"] { grid-column: 1 / -1; padding-left: 0; }
  .rs-toolbar { margin-top: 16px; }
  .rs-tools { width: 100%; }
  .rs-tools .seg-mono { flex: 1 1 auto; }
  .rs-tools .seg-mono button { flex: 1 1 0; }
}

@media (max-width: 380px) {
  .site-title .ja { display: none; }
  .sv-nav .btn-sub { padding: 10px 8px; font-size: 11px; }
  .sv-nav .btn-main { padding: 10px 8px; font-size: 13px; }
  .rs-grid { gap: 18px 10px; }
  .rs-keep { padding: 4px 8px; }
}
