/* ポータルの共通の見た目。藍（仕事着・のれんの色）を軸に、朱は「確認印」だけに使う。 */
:root {
  --ai: #1e3a5f;        /* 藍 */
  --ai-deep: #132a45;
  --ai-soft: #e6edf6;
  --ai-mist: #f1f5fa;
  --paper: #f6f8fb;     /* 冷たい白 */
  --sheet: #ffffff;
  --ink: #1d232b;       /* 墨 */
  --ink-2: #56606d;
  --ink-3: #8a94a1;
  --line: #d8dfe8;
  --shu: #c1352b;       /* 朱（確認印だけ） */
  --bad: #9b2c22;
  --good: #24684d;
  --font: "BIZ UDPGothic", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Noto Sans CJK JP", "Yu Gothic UI", "Meiryo", sans-serif;
  --r: 12px;
  --tap: 52px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--paper); color: var(--ink); font-family: var(--font);
  font-size: 16px; line-height: 1.6; -webkit-text-size-adjust: 100%;
  font-feature-settings: "palt" 1;
}
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--ai); }
:focus-visible { outline: 3px solid #6f9ad1; outline-offset: 2px; }
.wrap { max-width: 560px; margin: 0 auto; padding: 0 16px calc(120px + env(safe-area-inset-bottom)); }

/* 上の帯：戻るはいつも左上 */
.top { position: sticky; top: 0; z-index: 5; background: var(--paper); display: flex; align-items: center; gap: 4px; min-height: 56px; margin: 0 -16px; padding: 4px 8px; padding-top: max(4px, env(safe-area-inset-top)); }
.top h1 { font-size: 17px; font-weight: 700; margin: 0; flex: 1; letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.back { width: 44px; height: 44px; border: 0; background: transparent; border-radius: 50%; display: grid; place-items: center; cursor: pointer; }
.back svg { width: 22px; height: 22px; stroke: var(--ink); }
.top .side { font-size: 13px; color: var(--ink-2); padding-right: 8px; }

h2 { font-size: 21px; line-height: 1.4; margin: 20px 0 8px; font-weight: 700; letter-spacing: .01em; }
h3 { font-size: 16px; margin: 20px 0 6px; font-weight: 700; }
p { margin: 8px 0; }
.lead { font-size: 15px; color: var(--ink-2); margin: 0 0 16px; }
.small { font-size: 13px; color: var(--ink-2); }
.tiny { font-size: 12px; color: var(--ink-3); }
.num { font-variant-numeric: tabular-nums; }

/* 下の大きなボタン（親指の届く所） */
.dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: linear-gradient(to top, var(--paper) 70%, rgba(246,248,251,0)); padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); }
.dock .inner { max-width: 560px; margin: 0 auto; display: grid; gap: 8px; }
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: var(--tap); padding: 12px 18px; border-radius: var(--r); border: 1.5px solid var(--ai); background: var(--ai); color: #fff; font-size: 17px; font-weight: 700; cursor: pointer; text-decoration: none; letter-spacing: .03em; }
.btn:active { background: var(--ai-deep); }
.btn[disabled] { background: #9aa8b8; border-color: #9aa8b8; cursor: not-allowed; }
.btn.ghost { background: var(--sheet); color: var(--ai); }
.btn.ghost:active { background: var(--ai-mist); }
.btn.line { background: #06c755; border-color: #06c755; }
.btn.quiet { background: transparent; border-color: transparent; color: var(--ai); min-height: 44px; font-weight: 600; font-size: 15px; }
.btn.danger { background: var(--sheet); color: var(--bad); border-color: #e2b8b3; }
.row-btns { display: flex; gap: 8px; }
.row-btns .btn { min-height: 44px; font-size: 15px; padding: 8px 12px; }

/* 送る物を選ぶ大きな入口 */
.starts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 8px 0 24px; }
.start { position: relative; display: flex; flex-direction: column; justify-content: flex-end; min-height: 112px; padding: 14px; border-radius: 16px; background: var(--ai); color: #fff; border: 0; text-align: left; cursor: pointer; overflow: hidden; }
.start.wide { grid-column: 1 / -1; min-height: 96px; background: var(--sheet); color: var(--ai); border: 1.5px solid var(--ai); }
.start b { font-size: 18px; letter-spacing: .03em; }
.start span { font-size: 13px; opacity: .85; }
.start svg { position: absolute; right: 12px; top: 12px; width: 30px; height: 30px; stroke: currentColor; opacity: .9; }
.start input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* 一覧 */
.list { background: var(--sheet); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; margin: 8px 0 16px; }
.item { display: flex; align-items: center; gap: 12px; padding: 14px 14px; border-top: 1px solid var(--line); text-decoration: none; color: inherit; min-height: 60px; background: transparent; width: 100%; border-left: 0; border-right: 0; border-bottom: 0; text-align: left; cursor: pointer; }
.item:first-child { border-top: 0; }
.item .grow { flex: 1; min-width: 0; }
.item .t { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .s { font-size: 13px; color: var(--ink-2); }
.chev { width: 16px; height: 16px; stroke: var(--ink-3); flex: none; }
.empty { padding: 22px 16px; text-align: center; color: var(--ink-2); font-size: 15px; }

/* 選ぶ（1 画面 1 決め） */
.choices { display: grid; gap: 10px; margin: 12px 0; }
.choice { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--sheet); cursor: pointer; text-align: left; width: 100%; }
.choice .dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--ink-3); flex: none; margin-top: 2px; display: grid; place-items: center; }
.choice[aria-checked="true"] { border-color: var(--ai); background: var(--ai-mist); }
.choice[aria-checked="true"] .dot { border-color: var(--ai); }
.choice[aria-checked="true"] .dot::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--ai); }
.choice .check { width: 24px; height: 24px; border-radius: 7px; border: 2px solid var(--ink-3); flex: none; display: grid; place-items: center; margin-top: 1px; }
.choice[aria-checked="true"] .check { background: var(--ai); border-color: var(--ai); }
.choice[aria-checked="true"] .check::after { content: ""; width: 11px; height: 6px; border: 3px solid #fff; border-top: 0; border-right: 0; transform: translateY(-1px) rotate(-45deg); }
.choice b { display: block; font-size: 16px; }
.choice span { display: block; font-size: 13px; color: var(--ink-2); }

.field { display: grid; gap: 6px; margin: 12px 0; }
.field label { font-size: 14px; font-weight: 700; }
.input { width: 100%; min-height: 50px; padding: 10px 14px; border: 1.5px solid var(--line); border-radius: var(--r); background: var(--sheet); font-size: 17px; }
.input:focus { border-color: var(--ai); outline: none; box-shadow: 0 0 0 3px rgba(30,58,95,.15); }
textarea.input { min-height: 90px; resize: vertical; }
.code { font-family: var(--font); font-size: clamp(18px, 5.6vw, 24px); letter-spacing: .08em; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.inline-add { display: flex; gap: 8px; }
.inline-add .input { flex: 1; }
.inline-add .btn { width: auto; min-height: 50px; }

.note { background: var(--ai-mist); border-radius: 12px; padding: 12px 14px; font-size: 14px; color: var(--ink); margin: 12px 0; }
.warn { background: #fdf3e6; border-radius: 12px; padding: 12px 14px; font-size: 14px; color: #6e4a07; margin: 12px 0; }
.err { color: var(--bad); font-size: 14px; margin: 6px 0; }

.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px; margin: 10px 0; }
.thumbs img, .thumbs .ph { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; background: var(--ai-soft); display: block; }
.bar { height: 8px; background: var(--ai-soft); border-radius: 4px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--ai); width: 0; transition: width .3s; }

/* 確認印（このアプリの印） */
.seal { --s: 28px; width: var(--s); height: var(--s); border-radius: 50%; border: 2px solid var(--shu); color: var(--shu); display: inline-grid; place-items: center; font-size: calc(var(--s) * .46); font-weight: 700; transform: rotate(-9deg); flex: none; line-height: 1; box-shadow: inset 0 0 0 1.5px rgba(193,53,43,.25); }
.seal.off { border-color: var(--line); color: var(--ink-3); box-shadow: none; }
.seal.big { --s: 132px; border-width: 5px; font-size: 30px; letter-spacing: .08em; }
@keyframes press { 0% { transform: scale(1.8) rotate(-9deg); opacity: 0; } 60% { transform: scale(.94) rotate(-9deg); opacity: 1; } 100% { transform: scale(1) rotate(-9deg); } }
.seal.press { animation: press .55s cubic-bezier(.2,.8,.3,1) both; }
@media (prefers-reduced-motion: reduce) { .seal.press { animation: none; } }

/* ページの帯（レポート） */
.strip { display: flex; gap: 3px; flex-wrap: wrap; margin-top: 6px; }
.strip i { width: 16px; height: 16px; border-radius: 4px; background: var(--ai-soft); position: relative; }
.strip i.v::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; border: 1.5px solid var(--shu); }
.tag { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--ai-soft); color: var(--ai-deep); margin-left: 6px; vertical-align: 2px; white-space: nowrap; }
.tag.self { background: #f2ece2; color: #6b5432; }
.score { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
.score > div { background: var(--sheet); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.score b { font-size: 22px; font-variant-numeric: tabular-nums; }
.score span { display: block; font-size: 12px; color: var(--ink-2); }

table.t { width: 100%; border-collapse: collapse; font-size: 14px; background: var(--sheet); }
table.t th, table.t td { padding: 8px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.t th { font-size: 12px; color: var(--ink-2); font-weight: 700; }
table.t td.r, table.t th.r { text-align: right; font-variant-numeric: tabular-nums; }

.toast { position: fixed; left: 50%; bottom: calc(110px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 14px; z-index: 50; max-width: 90vw; box-shadow: 0 6px 20px rgba(0,0,0,.18); }
.sheet-bg { position: fixed; inset: 0; background: rgba(15,25,40,.45); z-index: 40; display: grid; align-items: end; }
.sheet { background: var(--sheet); border-radius: 18px 18px 0 0; padding: 16px 16px calc(20px + env(safe-area-inset-bottom)); max-width: 560px; width: 100%; margin: 0 auto; max-height: 86vh; overflow: auto; display: grid; gap: 10px; }
.sheet h3 { margin: 4px 0 0; }
.sheet p { margin: 0; }
.qr { display: grid; place-items: center; padding: 10px; }
.qr img { width: 220px; height: 220px; image-rendering: pixelated; }
.spin { width: 18px; height: 18px; border: 2.5px solid var(--ai-soft); border-top-color: var(--ai); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }
.hide { display: none !important; }

/* PC：結果や一人ずつの画面は広く使う（携帯の時は変わらない） */
@media (min-width: 900px) {
  .wrap.wide { max-width: 980px; }
  .dock.wide .inner { max-width: 980px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
}
@media (min-width: 900px) {
  .wrap.wide main > .btn, .wrap.wide .no-print .btn { max-width: 360px; }
}
.print-only { display: none; }
/* PC：写真や PDF を画面に落とす */
.start.drop { background: var(--sheet); color: var(--ai); border: 1.5px dashed var(--ai); }
body.dropping .start.drop { background: var(--ai-mist); border-style: solid; }
body.dropping::after { content: "ここで離すと始まります"; position: fixed; inset: 12px; border: 3px dashed var(--ai); border-radius: 18px; background: rgba(241,245,250,.82); display: grid; place-items: center; font-size: 22px; font-weight: 700; color: var(--ai); z-index: 60; pointer-events: none; }

/* 印刷・PDF で保存：ボタンや下の帯は出さず、色の帯はそのまま出す */
@media print {
  body { background: #fff; }
  .wrap, .wrap.wide { max-width: none; padding: 0 0 12px; }
  .top { position: static; margin: 0; padding: 0 0 6px; border-bottom: 1px solid var(--line); }
  .top .back, .dock, .toast, .sheet-bg, .no-print, button.btn, a.btn { display: none !important; }
  .print-only { display: block; }
  .item .chev { display: none; }
  .list, .score > div, table.t { break-inside: avoid; }
  .strip i, .seal, .tag, .score > div { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  a { color: inherit; text-decoration: none; }
}
