/* 紳士服オーダーシミュレータの画面。仕立て屋の店内のような、落ち着いた暗色と金の差し色。
   スマホは「舞台（3D）を全面に敷き、操作パネルを下に重ねる」。PC は右に操作パネルを置く。 */
:root {
  --gold: #c9a45c; --gold-soft: rgba(201, 164, 92, .35);
  --ink: #ece8de; --mist: #9aa3b2; --panel-bg: rgba(14, 17, 25, .88);
  --serif: 'Hiragino Mincho ProN', 'Yu Mincho', 'Noto Serif JP', serif;
}
html, body { background: #0b0e15; }
/* 背景は明るい灰色の写真スタジオ。濃い色の服の形と生地が見えやすい */
#app { display: block; overflow: hidden; background: radial-gradient(ellipse at 50% 40%, #d6d0c6 0%, #b3ada3 45%, #7d7871 100%); }
#stage { position: absolute; inset: 0; touch-action: none; padding: 0; background: radial-gradient(ellipse at 50% 40%, #d6d0c6 0%, #b3ada3 45%, #7d7871 100%); }
#ui { position: absolute; inset: 0; pointer-events: none; }
#ui > * { pointer-events: auto; }
/* 文言は単語の途中で改行しない */
#ui, #ui * { word-break: keep-all; overflow-wrap: anywhere; line-break: strict; }

/* ---- タイトル ---- */
.title { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding: 6dvh 20px 0; text-align: center; pointer-events: none; }
.title > * { pointer-events: auto; }
.title h1 { margin: 0; font-family: var(--serif); font-weight: 600; font-size: clamp(26px, 6.2vw, 44px); letter-spacing: .12em; color: #1c1f28; }
.title .sub { margin: 8px 0 0; color: #6d5422; letter-spacing: .3em; font-size: 12px; }
.title .btns { position: absolute; bottom: 4dvh; left: 50%; transform: translateX(-50%); margin-top: 0; display: flex; flex-direction: column; gap: 10px; width: min(300px, 80vw); }

/* ---- ボタン ---- */
.btn { border: 1px solid var(--gold-soft); background: linear-gradient(#222a3b, #151a27); color: var(--ink); padding: 12px 16px; border-radius: 10px; font-size: 15px; letter-spacing: .06em; box-shadow: 0 6px 16px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .06); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(#d6b56d, #a98642); color: #1a1408; border-color: #e6c987; font-weight: 700; }
.btn.small { padding: 7px 12px; font-size: 13px; border-radius: 8px; }
.btn[disabled] { opacity: .4; }

/* ---- 上の帯（戻る・手順名・次へ） ---- */
.top { position: absolute; left: 0; right: 0; top: 0; display: flex; align-items: center; gap: 8px; padding: max(8px, env(safe-area-inset-top, 0px)) 10px 8px; background: rgba(12, 15, 22, .86); }
.compact .top { padding-top: 6px; }
.top .step { flex: 1; min-width: 0; text-align: center; }
.top .step b { display: block; font-family: var(--serif); font-size: 16px; letter-spacing: .12em; font-weight: 600; }
.top .dots { display: flex; justify-content: center; gap: 5px; margin-top: 4px; }
.top .dots i { width: 18px; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, .18); }
.top .dots i.on { background: var(--gold); }
.top .dots i.done { background: rgba(201, 164, 92, .55); }

/* ---- 見る位置（下のパネルの上に浮かぶ） ---- */
.views { position: absolute; right: 8px; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.viewrow { flex-direction: column; }
.chip { border: 1px solid rgba(255, 255, 255, .18); background: rgba(14, 17, 25, .72); color: var(--ink); border-radius: 999px; padding: 5px 11px; font-size: 12px; backdrop-filter: blur(6px); }
.chip.on { border-color: var(--gold); color: var(--gold); }
.viewrow { display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; max-width: 78vw; }

/* ---- 操作パネル ---- */
.panel { position: absolute; left: 0; right: 0; bottom: 0; max-height: 38%; display: flex; flex-direction: column; background: var(--panel-bg); backdrop-filter: blur(10px); border-top: 1px solid var(--gold-soft); border-radius: 14px 14px 0 0; box-shadow: 0 -10px 30px rgba(0, 0, 0, .45); }
.panel.folded { max-height: 34px; }
.panel .grab { flex: none; display: flex; align-items: center; justify-content: center; height: 24px; cursor: pointer; color: var(--mist); }
.panel .grab i { width: 38px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .28); }
/* タブは折り返して全部見せる（横に流すと、右端のタブが画面の外に隠れて気づけない） */
.tabs { flex: none; display: flex; flex-wrap: wrap; gap: 2px 4px; padding: 0 8px 6px; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; border: 1px solid transparent; background: transparent; color: var(--mist); padding: 4px 9px; font-size: 13px; letter-spacing: .04em; border-bottom: 2px solid transparent; border-radius: 0; }
.tab.on { color: var(--gold); border-bottom-color: var(--gold); }
.body { flex: 1; min-height: 0; overflow-y: auto; padding: 2px 12px 12px; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
.group { margin: 4px 0 10px; }
.group h3 { margin: 0 0 6px; font-size: 12px; font-weight: 500; color: var(--mist); letter-spacing: .12em; }
.opts { display: flex; flex-wrap: wrap; gap: 6px; }
.opt { border: 1px solid rgba(255, 255, 255, .16); background: rgba(255, 255, 255, .04); color: var(--ink); padding: 7px 11px; border-radius: 8px; font-size: 13px; line-height: 1.25; text-align: left; }
.opt.on { border-color: var(--gold); background: rgba(201, 164, 92, .16); box-shadow: 0 0 0 1px var(--gold) inset; }
.opt .p { color: var(--gold); font-size: 11px; margin-left: 4px; }
.note { margin: 6px 0 0; font-size: 12px; color: var(--mist); min-height: 1.3em; line-height: 1.45; }
.row2 { display: flex; gap: 8px; align-items: center; }

/* 糸・釦の色の見本つきの選択肢 */
.opt.sw { display: inline-flex; align-items: center; gap: 6px; }
.dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .45); flex: none; }
.dot.same { background: repeating-linear-gradient(45deg, #777 0 3px, #444 3px 6px); }
/* 上着の内側の絵の説明 */
.insidecap { position: absolute; left: 10px; margin: 0; font-size: 12px; color: #2a2d36; letter-spacing: .06em; background: rgba(255, 255, 255, .55); padding: 3px 9px; border-radius: 999px; pointer-events: none; }
.insidehead { margin: 16px 0 6px; font-family: var(--serif); font-size: 15px; letter-spacing: .12em; color: var(--gold); font-weight: 600; }
.fabrics.small { grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); }
/* 生地の見本 */
.fabrics { display: grid; grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); gap: 8px; }
.fab { border: 1px solid rgba(255, 255, 255, .14); background: rgba(255, 255, 255, .03); border-radius: 8px; padding: 4px; text-align: center; color: var(--ink); }
.fab img, .fab .sw { display: block; width: 100%; aspect-ratio: 1; border-radius: 5px; object-fit: cover; background: #222; }
.fab span { display: block; font-size: 10.5px; margin-top: 4px; line-height: 1.25; color: var(--mist); }
.fab.on { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.fab.on span { color: var(--gold); }
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.fabinfo { margin: 8px 0 0; font-size: 12.5px; line-height: 1.55; color: var(--ink); }
.fabinfo small { color: var(--mist); display: block; }

/* 採寸 */
.sizegrid { display: flex; gap: 6px; flex-wrap: wrap; }
.sizebox { margin-top: 4px; font-size: 13px; line-height: 1.7; }
.sizebox b { color: var(--gold); font-size: 20px; font-family: var(--serif); margin-right: 8px; }
.namerow { display: flex; gap: 6px; align-items: stretch; }
.namerow .input { flex: 1; min-width: 0; }
.namebtn { flex: none; white-space: nowrap; text-align: center; }
.namebtn:disabled { opacity: .4; }
.input { width: 100%; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .2); border-radius: 8px; padding: 8px 10px; color: var(--ink); font-size: 14px; user-select: text; -webkit-user-select: text; }

/* ---- 結果 ---- */
.result { position: absolute; inset: 0; overflow-y: auto; background: rgba(8, 10, 16, .94); padding: max(12px, env(safe-area-inset-top, 0px)) 14px 30px; touch-action: pan-y; }
.result .inner { max-width: 520px; margin: 0 auto; }
.result h2 { font-family: var(--serif); font-weight: 600; letter-spacing: .14em; text-align: center; margin: 4px 0 10px; font-size: 20px; }
.result img.ordercard { width: 100%; border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, .6); display: block; }
.result .acts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.result .acts .wide { grid-column: 1 / -1; }
.spec { margin-top: 6px; border-top: 1px solid var(--gold-soft); }
.spec h4 { margin: 14px 0 6px; font-family: var(--serif); font-size: 15px; letter-spacing: .12em; color: var(--gold); font-weight: 600; }
.spec dl { margin: 0; display: grid; grid-template-columns: 7.5em 1fr; gap: 5px 10px; font-size: 13px; line-height: 1.5; }
.spec dt { color: var(--mist); }
.spec dd { margin: 0; }
.fine { color: var(--mist); font-size: 11px; line-height: 1.5; margin-top: 8px; }
.toast { position: absolute; left: 50%; top: 18%; transform: translateX(-50%); background: rgba(14, 17, 25, .92); border: 1px solid var(--gold-soft); padding: 9px 16px; border-radius: 10px; font-size: 13px; pointer-events: none; z-index: 5; }

/* ---- 縦長の画面（スマホ）：人を左、操作パネルを右に並べる ----
   なぜ：人の絵は縦に細長いので、左の細い列でも全身が大きく映る。パネルを下に置くと、人も選択肢も狭くなった（2026-11-15 ユーザー指摘） */
@media not all and (min-width: 900px) and (min-aspect-ratio: 5/4) {
  #app.side #stage { right: 56%; }
  #app.side .panel { left: auto; right: 0; top: 56px; bottom: 0; width: 56%; max-height: none; border-radius: 0; border-top: 0; border-left: 1px solid var(--gold-soft); }
  #app.side .panel .grab { display: none; }
  #app.side .tabs { padding-top: 6px; }
  #app.side .body { padding: 6px 9px 12px; }
  #app.side .views { left: 4px; right: 56%; align-items: center; }
  #app.side .viewrow { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; max-width: none; }
  #app.side .chip { padding: 5px 8px; font-size: 11.5px; }
  #app.side .fabrics { grid-template-columns: repeat(2, 1fr); }
  #app.side .fabrics.small { grid-template-columns: repeat(3, 1fr); }
  #app.side .opt { padding: 6px 9px; font-size: 12.5px; }
}

/* ---- 広い画面（PC）：右に操作パネル ---- */
@media (min-width: 900px) and (min-aspect-ratio: 5/4) {
  #stage { right: 420px; }
  .panel { left: auto; top: 0; width: 420px; max-height: none; border-radius: 0; border-top: 0; border-left: 1px solid var(--gold-soft); padding-top: 56px; }
  .panel .grab { display: none; }
  .top { right: 420px; }
  .views { right: 432px; }
  .title { padding-right: 420px; }
  .result { left: 0; }
}

/* 画面の下に貼りつく広告の帯（約90px）に、操作パネルが隠れないようにする。コンパクト表示（上94%）より、帯を避ける高さを優先する */
.compact .slidein #app, .slidein #app { height: min(94dvh, calc(100dvh - var(--slide-h, 90px) - env(safe-area-inset-bottom, 0px))); }

/* ---- パネルを閉じて、絵だけを画面いっぱいに見る（拡大して細部を見るため） ---- */
#app.full .panel { display: none; }
#app.full #stage { right: 0; }
#app.full .top { right: 0; }
#app.full .views { right: 8px; left: auto; }
#app.full .viewrow { display: flex; flex-direction: column; }
.foldbtn { border-color: var(--gold-soft); }
#app.side .foldbtn { grid-column: 1 / -1; }

/* 保存した一着 */
.closet { display: grid; gap: 8px; }
.closet .item .row { display: flex; gap: 10px; }
.closet .item .fabname { margin-top: 6px; font-size: 12px; word-break: keep-all; letter-spacing: -.02em; } /* 折り返すのは、生地の名前の空白の所だけ */
.closet .item { display: flex; flex-direction: column; padding: 8px; border: 1px solid rgba(255, 255, 255, .14); border-radius: 10px; background: rgba(255, 255, 255, .03); }
.closet .item.on { border-color: var(--gold); }
.closet img, .closet .noimg { width: 64px; height: 80px; border-radius: 6px; object-fit: cover; flex: none; background: #c9c3b9; }
.closet .meta { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.closet .meta b { font-size: 13px; font-weight: 600; word-break: keep-all; overflow-wrap: anywhere; }
.closet .meta span { font-size: 11px; color: var(--mist); }
.closet .btns { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; }
.closet .btns .opt { padding: 5px 10px; font-size: 12px; }
.closet .btns .opt:disabled { opacity: .55; }
