/* イロヌノ — 見た目は ChatGPT の画面案(design/chatgpt_v2)に合わせた「Silk Editorial」。
   ホーム・結果・全部ひらく = 濃紺と絹 / 撮る・補正・顔・布・質問 = 白と無彩色だけ / 本棚・記録 = 白地の見本帳 */
:root {
  --navy: #152232; --deep: #0F2033; --navy2: #1D2D42; --navy3: #26384F; --ink: #202B3A; --sub: #5B6472; --muted: #8A919B;
  --mist: #F3F5F6; --mist2: #EBEEF0; --line: #DDE1E5; --white: #FFFFFF;
  --spring: #F2765E; --summer: #D98AA8; --autumn: #A9482E; --winter: #2747C6;
  --serif: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Noto Serif JP", "Noto Serif CJK JP", "Source Han Serif JP", serif;
  --sans: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Noto Sans CJK JP", "Yu Gothic UI", "Yu Gothic", "Meiryo", system-ui, sans-serif;
  --latin: "Cormorant Garamond", "Didot", "Bodoni 72", "Times New Roman", Georgia, serif;
  --pad: 24px; --r-card: 18px; --r-btn: 999px; --tab-h: 64px;
  /* 上下の逃げ。Web は env()、Android(Capacitor 8 の SystemBars)は html に入る --safe-area-inset-* の大きい方 */
  --safe-b: max(env(safe-area-inset-bottom, 0px), var(--safe-area-inset-bottom, 0px)); --safe-t: max(env(safe-area-inset-top, 0px), var(--safe-area-inset-top, 0px));
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--navy); color: var(--ink); font-family: var(--sans); -webkit-text-size-adjust: 100%; }
body { overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
img { display: block; max-width: 100%; }
#app { position: fixed; inset: 0; display: flex; flex-direction: column; max-width: 560px; margin: 0 auto; background: var(--white); overflow: hidden; }
#screen { flex: 1; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; outline: none; padding-top: var(--safe-t); }
/* 下のタブが無い画面は、いちばん下の文字・ボタンがナビゲーションバーに隠れないように下を空ける(タブがある時はタブが受け持つ) */
#app:has(> #tabs[hidden]) #screen { padding-bottom: var(--safe-b); }
#app[data-mode="dark"] { background: var(--deep); color: #fff; }
#app[data-mode="lab"] { background: #F8F9FA; }
#app[data-mode="neutral"] { background: #fff; }
.serif { font-family: var(--serif); font-weight: 500; }
.latin { font-family: var(--latin); letter-spacing: .32em; text-transform: uppercase; font-size: 11px; }
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ボタン */
.btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 56px; padding: 0 24px; border: 0; border-radius: var(--r-btn); font-size: 17px; font-weight: 600; letter-spacing: .06em; position: relative; text-decoration: none; }
.btn .arr { position: absolute; right: 22px; top: 50%; transform: translateY(-50%); }
.btn-navy { background: var(--navy); color: #fff; }
.btn-navy:disabled { background: #B9C0C8; color: #fff; cursor: default; }
.btn-line { background: #fff; color: var(--ink); border: 1.5px solid var(--ink); }
.btn-pearl { background: linear-gradient(180deg, #FFFFFF 0%, #ECEFF3 100%); color: var(--navy); box-shadow: 0 10px 30px rgba(0,0,0,.25), inset 0 1px 0 #fff; }
.btn-gray { background: #fff; color: var(--ink); border: 1.5px solid #CDD2D7; border-radius: 14px; min-height: 52px; padding: 0 8px; font-size: 14px; font-weight: 500; letter-spacing: 0; white-space: nowrap; }
.btn-gray:disabled { color: #A9AFB6; border-color: #E2E5E8; }
.btn-text { background: none; border: 0; color: var(--sub); font-size: 14px; margin-top: 10px !important; text-decoration: underline; text-underline-offset: 5px; min-height: 44px; width: auto; margin: 0 auto; display: flex; padding: 0 8px; }
.btn.file { overflow: hidden; }
.btn.file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.stack { display: grid; gap: 12px; }
.privacy { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--sub); font-size: 13px; letter-spacing: .04em; margin: 16px 0 0; }
.privacy svg { flex: none; }

/* 上の帯(戻る+進みの段) */
.bar { display: flex; align-items: flex-start; gap: 6px; padding: 14px 16px 4px 8px; }
.back { flex: none; width: 44px; height: 44px; border: 0; background: none; display: grid; place-items: center; color: var(--ink); }
.steps { flex: 1; display: grid; grid-template-columns: repeat(5, 1fr); list-style: none; margin: 4px 0 0; padding: 0; position: relative; }
.steps li { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); white-space: nowrap; letter-spacing: .02em; }
.steps li::before { content: ""; position: absolute; top: 12px; left: -50%; width: 100%; height: 2px; background: var(--line); z-index: 0; }
.steps li:first-child::before { display: none; }
.steps li.done::before, .steps li.now::before { background: var(--ink); }
.steps i { position: relative; z-index: 1; width: 24px; height: 24px; border-radius: 50%; background: #D9DDE1; display: grid; place-items: center; }
.steps li.done i { background: var(--ink); color: #fff; }
.steps li.now i { background: var(--ink); box-shadow: 0 0 0 4px rgba(32,43,58,.12); }
.steps li.now { color: var(--ink); font-weight: 700; }

/* 機能の画面の本文 */
.lab { padding: 8px var(--pad) 28px; }
.h1 { font-family: var(--serif); font-weight: 500; font-size: clamp(19px, 5.5vw, 28px); line-height: 1.35; letter-spacing: 0; text-align: center; margin: 22px 0 8px; color: var(--ink); }
.lead { text-align: center; color: var(--sub); font-size: 14px; line-height: 1.7; margin: 0 0 18px; }
.photo { position: relative; border-radius: var(--r-card); overflow: hidden; background: #D8DCE0; }
.photo canvas, .photo img { display: block; width: 100%; height: auto; }
.photo canvas { touch-action: manipulation; cursor: crosshair; max-height: 56vh; object-fit: contain; background: #CFD3D8; }
.hint { color: var(--muted); font-size: 13px; text-align: center; margin: 10px 0 0; line-height: 1.6; }

/* 撮り方 */
.howto-pic { margin: 6px calc(-1 * var(--pad)) 0; position: relative; }
.howto-pic img { width: 100%; height: 300px; object-fit: cover; object-position: 50% 30%; -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 8%, #000 84%, transparent); mask-image: linear-gradient(180deg, transparent 0, #000 8%, #000 84%, transparent); }
.tips { list-style: none; margin: -8px 0 22px; padding: 4px 18px; background: #EDF0F3; border-radius: var(--r-card); position: relative; }
.tips li { display: flex; align-items: center; gap: 16px; padding: 14px 0; font-size: 14px; line-height: 1.5; }
.tips li + li { border-top: 1px solid var(--line); }
.tips img { width: 42px; height: 42px; border-radius: 50%; flex: none; }

/* 白で補正 */
.ring { position: absolute; width: 44px; height: 44px; border: 3px solid #fff; border-radius: 50%; transform: translate(-50%, -50%); box-shadow: 0 0 0 1px rgba(0,0,0,.18), 0 2px 8px rgba(0,0,0,.25); pointer-events: none; }
.split { position: relative; margin-top: 14px; border-radius: var(--r-card); overflow: hidden; background: #CFD3D8; touch-action: pan-y; user-select: none; }
.split canvas { display: block; width: 100%; height: 170px; object-fit: cover; }
.split .after { position: absolute; inset: 0; clip-path: inset(0 0 0 var(--cut, 50%)); }
.split .knob { position: absolute; top: 0; bottom: 0; left: var(--cut, 50%); width: 2px; background: #fff; transform: translateX(-1px); }
.split .knob::after { content: ""; position: absolute; top: 50%; left: 50%; width: 40px; height: 40px; border-radius: 50%; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 7l-5 5 5 5M15 7l5 5-5 5' fill='none' stroke='%23202B3A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/20px no-repeat; transform: translate(-50%, -50%); box-shadow: 0 2px 10px rgba(0,0,0,.25); }
.split input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: ew-resize; }
.tag { position: absolute; top: 10px; padding: 4px 12px; border-radius: 999px; background: rgba(255,255,255,.92); font-size: 12px; color: var(--ink); pointer-events: none; }
.tag.l { left: 10px; } .tag.r { right: 10px; }
.wb { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 12px 0 18px; padding: 12px 14px; background: #EDF0F3; border-radius: 14px; font-size: 13px; color: var(--sub); }
.wb .dot { width: 30px; height: 30px; border-radius: 50%; border: 1px solid rgba(0,0,0,.08); box-shadow: inset 0 1px 2px rgba(0,0,0,.08); flex: none; }
.wb .ok { display: flex; align-items: center; gap: 8px; color: var(--ink); }
.wb .sep { flex-basis: 100%; height: 0; }
.warns { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; flex-basis: 100%; }
.warns li { color: #8A5A00; background: #FFF6E0; border-radius: 10px; padding: 8px 12px; line-height: 1.5; }

/* 顔の位置 */
.slider { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 4px 18px; margin: 20px 4px 22px; }
.slider b { font-size: 15px; letter-spacing: .06em; }
.slider input { width: 100%; }
.slider small { grid-column: 2; display: flex; justify-content: space-between; color: var(--sub); font-size: 12px; }
input[type=range] { -webkit-appearance: none; appearance: none; height: 28px; background: transparent; }
input[type=range]::-webkit-slider-runnable-track { height: 10px; border-radius: 6px; background: linear-gradient(90deg, var(--ink) var(--v, 50%), #D9DDE1 var(--v, 50%)); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 30px; height: 30px; margin-top: -10px; border-radius: 50%; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.3); }
input[type=range]::-moz-range-track { height: 10px; border-radius: 6px; background: #D9DDE1; }
input[type=range]::-moz-range-progress { height: 10px; border-radius: 6px; background: var(--ink); }
input[type=range]::-moz-range-thumb { width: 30px; height: 30px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.3); }

/* 布で比べる(白と灰色だけ) */
.cmp-top { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; padding: 12px 20px 0 8px; }
.cmp-top h2 { margin: 0; font-size: 16px; font-weight: 600; text-align: center; letter-spacing: .06em; }
.cmp-top .n { font-size: 15px; color: var(--ink); font-variant-numeric: tabular-nums; min-width: 44px; text-align: right; }
.cmp-top .n b { font-size: 18px; }
.track { height: 3px; background: #E4E6E8; margin: 10px 20px 0; border-radius: 2px; overflow: hidden; }
.track i { display: block; height: 100%; background: #6E737A; }
.neutral .h1 { margin-top: 26px; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 18px 0 8px; }
.drape { border: 0; padding: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.drape canvas { width: 100%; aspect-ratio: 420 / 780; height: auto; border-radius: 16px; background: #E9EBED; box-shadow: 0 0 0 1px #E1E4E7; transition: transform .15s; }
.drape:active canvas { transform: scale(.98); }
.drape span { font-size: 14px; color: var(--sub); }
.drape span { display: block; width: 92%; padding: 6px 0; border-radius: 10px; background: #EEF0F2; color: var(--ink); font-size: 15px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }

/* 質問 */
.opts { display: grid; gap: 12px; margin: 22px 0 0; }
.opt { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 64px; padding: 12px 18px; background: #fff; border: 1.5px solid #DADDE1; border-radius: 16px; text-align: left; font-size: 16px; line-height: 1.45; }
.opt img { width: 56px; height: 56px; border-radius: 12px; object-fit: cover; flex: none; }
.opt .rd { margin-left: auto; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid #B8BEC4; flex: none; }
.opt[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.opt[aria-pressed="true"] .rd { border: 7px solid var(--ink); }
.opt-grid { grid-template-columns: repeat(3, 1fr); }
.opt-grid .opt { flex-direction: column; justify-content: center; text-align: center; padding: 12px 8px 14px; gap: 10px; font-size: 14px; }
.opt-grid .opt img { width: 100%; height: auto; aspect-ratio: 3 / 5; object-fit: cover; border-radius: 12px; }
.opt-grid .opt .rd { margin: 0; }

/* 下のタブ(診断のあと) */
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); height: calc(var(--tab-h) + var(--safe-b)); padding-bottom: var(--safe-b); background: var(--navy); border-top: 1px solid rgba(255,255,255,.08); border-radius: 22px 22px 0 0; flex: none; }
.tabs[hidden] { display: none; }
#app[data-mode="light"] .tabs, #app[data-mode="lab"] .tabs { background: #fff; border-top: 1px solid var(--line); }
.tabs button { border: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 11px; color: rgba(255,255,255,.62); letter-spacing: .06em; position: relative; }
#app[data-mode="light"] .tabs button, #app[data-mode="lab"] .tabs button { color: var(--muted); }
.tabs button[aria-current="page"] { color: #fff; }
#app[data-mode="light"] .tabs button[aria-current="page"], #app[data-mode="lab"] .tabs button[aria-current="page"] { color: var(--ink); font-weight: 700; }
.tabs button[aria-current="page"]::after { content: ""; position: absolute; bottom: 4px; width: 58%; max-width: 92px; height: 3px; border-radius: 2px; background: currentColor; }

#app[data-mode="light"] .tabs button[aria-current="page"] svg { color: var(--ink); }

/* トースト */
.toast { position: fixed; left: 50%; bottom: calc(90px + var(--safe-b)); transform: translate(-50%, 20px); background: rgba(21,34,50,.94); color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 14px; opacity: 0; pointer-events: none; transition: .25s; max-width: calc(100% - 40px); z-index: 30; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

.menu .arr, .lastcard .arr, .rec-last .arr, .shelf-cta .arr { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); }
