/* 限定公開の版の入口の画面 (8・10・11 番)。specs/proto-screens/design-entry/options.html の案 A。色は結果の画面 (12 番) と同じ */
:root {
  --ink: #1f2328; --sub: #59616d; --line: #d9dce1; --soft: #e9ebee; --ground: #f4f5f7; --sel: #eaf0f8; --blue: #1a5fb4; --stop: #b00020;
  --edge: clamp(16px, 3vw, 28px);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; display: flex; flex-direction: column; background: var(--soft); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.5; }
p, h1, ul { margin: 0; padding: 0; }
ul { list-style: none; }
::selection { background: #cfdcf0; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.step-question:focus { outline: none; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* 上の帯とロゴの大きさ: specs/logo/spec.md 3.4 */
#app-header { flex: none; height: 72px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 16px; padding: 0 var(--edge); }
#header-mark { flex: none; height: 44px; margin-right: -6px; }
#header-service { flex: 1; min-width: 0; font-size: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#header-service img { display: block; height: 40px; }
#header-user { flex: none; font-size: 14px; color: var(--sub); }
#header-terms { flex: none; font-size: 14px; color: var(--blue); }

/* 利用規約と見つからない画面の本文 */
.doc { flex: 1; overflow: auto; background: #fff; padding: 24px var(--edge) 40px; }
.doc > * { max-width: 46em; }
.doc h2 { font-size: 18px; margin: 28px 0 0; }
.doc :is(p, ul) { margin-top: 8px; }
.doc ul { list-style: disc; padding-left: 1.5em; }
.doc a { color: var(--blue); }

#check-screen { flex: 1; min-height: 0; display: flex; flex-direction: row-reverse; }
.list { width: 52%; min-width: 0; overflow: auto; background: #fff; border-left: 1px solid var(--line); display: flex; flex-direction: column; }
.paper { flex: 1; min-width: 0; background: var(--soft); display: flex; align-items: center; justify-content: center; padding: clamp(16px, 3vh, 32px); }

.panel { display: none; }
#check-screen[data-state="setup"][data-step="1"] [data-panel="1"],
#check-screen[data-state="setup"][data-step="3"] [data-panel="3"],
#check-screen[data-state="checking"] #checking-section { display: block; }

.head { padding: 20px var(--edge) 14px; border-bottom: 1px solid var(--line); display: flex; align-items: baseline; flex-wrap: wrap; gap: 14px; }
h1 { font-size: 28px; line-height: 1.35; word-break: auto-phrase; text-wrap: balance; font-variant-numeric: tabular-nums; }
#checking-meta { font-size: 15px; color: var(--sub); }
.act { padding: 16px var(--edge); display: grid; gap: 14px; border-bottom: 1px solid var(--line); }
.chosen { display: flex; align-items: center; gap: 14px; padding: 10px 14px; background: var(--sel); border-radius: 6px; }
.chosen > div { flex: 1; min-width: 0; }
.name { font-size: 18px; overflow-wrap: anywhere; line-height: 1.4; }
.pg { font-size: 14px; color: var(--sub); }

.btn { font: inherit; font-size: 14px; min-height: 44px; padding: 8px 14px; border-radius: 6px; border: 1px solid #b9bec6; background: #fff; color: var(--ink); cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--ground); }
#start-button { font: inherit; font-size: 16px; width: 100%; min-height: 52px; border: 0; border-radius: 6px; background: var(--blue); color: #fff; cursor: pointer; }
#start-button:hover { background: #174f98; }
#start-button:disabled { background: var(--soft); color: var(--sub); cursor: not-allowed; }
#start-reason { font-size: 14px; color: var(--sub); margin-top: 8px; }
#start-reason:empty { display: none; }
#consent-box label { display: flex; gap: 12px; font-size: 15px; line-height: 1.6; cursor: pointer; word-break: auto-phrase; text-wrap: pretty; }
#consent-box a { color: var(--blue); }
#consent-box input { flex: none; width: 18px; height: 18px; margin: 3px 0 0; accent-color: var(--blue); cursor: pointer; }

#progress-bar { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; }
#progress-segments { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.progress-seg { height: 8px; border-radius: 2px; background: #c9d7ea; }
.progress-seg[data-mark="done"] { background: var(--blue); }
.progress-seg[data-mark="current"] { background: linear-gradient(90deg, var(--blue) 0 50%, #c9d7ea 50%); background-size: 200% 100%; animation: flow 1.6s linear infinite; }
@keyframes flow { from { background-position: 100% 0; } to { background-position: 0 0; } }
#close-warning { font-size: 15px; }
#check-error { font-size: 16px; line-height: 1.6; }
#check-error:empty { display: none; }
#checking-section[data-failed="1"] #progress-text { color: var(--stop); }
#checking-section[data-failed="1"] :is(#checking-meta, #progress-segments, #close-warning) { display: none; }

.kinds { padding: 6px var(--edge) 16px; flex: 1; }
.kind { padding-top: clamp(16px, 3.4vh, 34px); }
.kh { font-size: 18px; color: var(--c); padding: 0 4px 7px; border-bottom: 2px solid var(--c); }
.ks { font-size: 14px; color: var(--sub); padding: 7px 4px 0; }
#check-screen[data-step="3"][data-state="setup"] .ks { display: none; }
#check-screen[data-step="3"][data-state="setup"] .kind { padding-top: 12px; }

#drop-zone { position: relative; height: 100%; max-height: 100%; aspect-ratio: 1 / 1.3; max-width: 100%; background: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, .14); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 24px; text-align: center; overflow: hidden; }
#drop-zone::before { content: ""; position: absolute; inset: 14px; border: 2px dashed var(--blue); border-radius: 6px; background: var(--sel); }
#drop-zone.is-over::before { background: #cfdcf0; }
#drop-zone > * { position: relative; }
.drop-put { font-size: 20px; }
.drop-or { font-size: 13px; color: var(--sub); }
#upload-error { font-size: 14px; color: var(--stop); }
#upload-error[data-waiting] { color: var(--sub); }
#upload-error:empty, #chosen-name, #chosen-pages { display: none; }
#drop-zone[data-chosen="1"]::before, #drop-zone[data-chosen="1"] :is(.drop-put, .drop-or, #pick-button) { display: none; }
#drop-zone[data-chosen="1"] :is(#chosen-name, #chosen-pages) { display: block; }

#drop-zone > .scan { display: none; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--blue); animation: scan 2.4s ease-in-out infinite alternate; }
#check-screen[data-state="checking"]:not(:has(#checking-section[data-failed="1"])) .scan { display: block; }
@keyframes scan { from { top: 0; } to { top: calc(100% - 3px); } }

#result-section { display: none; }
body:has(#check-screen[data-state="result"]) { background: var(--ground); }
#check-screen[data-state="result"] { display: block; padding: 0 24px; overflow: auto; }
#check-screen[data-state="result"] :is(.list, .paper) { display: none; }
#check-screen[data-state="result"] #result-section { display: block; }
#result-frame { width: 100%; height: 80vh; border: 1px solid var(--line); background: #fff; }

/* 「別の PDF をチェックする」の確かめ: specs/leave-warning/spec.md 1 章 */
#leave-dialog { width: min(32em, calc(100vw - 32px)); padding: 24px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); box-shadow: 0 2px 10px rgba(0, 0, 0, .14); }
#leave-dialog::backdrop { background: rgba(31, 35, 40, .4); }
#leave-title { margin: 0; font-size: 20px; line-height: 1.4; }
#leave-text { margin-top: 12px; line-height: 1.7; word-break: auto-phrase; text-wrap: pretty; }
.leave-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 12px; margin-top: 24px; }
#leave-back { font: inherit; font-size: 14px; min-height: 44px; padding: 8px 14px; border: 0; border-radius: 6px; background: var(--blue); color: #fff; cursor: pointer; }
#leave-back:hover { background: #174f98; }

@media (prefers-reduced-motion: reduce) {
  .progress-seg[data-mark="current"] { animation: none; background-size: 100% 100%; }
  #drop-zone > .scan { animation: none; }
}
@media (max-width: 820px) {
  #check-screen:not([data-state="result"]) { display: block; overflow: auto; }
  .list { width: auto; border-left: 0; border-bottom: 1px solid var(--line); overflow: visible; }
  .kinds { display: none; }
  .paper { height: clamp(220px, 38vh, 320px); }
  #drop-zone { aspect-ratio: auto; width: 100%; }
}
