:root {
  --theme: #2e8fa0;
  --theme-dark: #236f7c;
  --theme-weak: #e7f2f4;
  --bg: #fdfaf5;
  --text: #3a3a3a;
  --muted: #8a8378;
  --card: #ffffff;
  --line: #ece5da;
  --warn-bg: #fff8ec;
  --warn-line: #f0e2c4;
  --warn-text: #6f5a2e;
  --radius: 18px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 18px;
}
.app {
  max-width: 760px;
  margin: 0 auto;
  padding: 16px 20px calc(80px + env(safe-area-inset-bottom));
}
.top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.title { font-weight: 700; color: var(--theme); font-size: 1.1rem; }
.badge {
  display: inline-block; background: var(--theme-weak); color: var(--theme);
  font-size: .75rem; padding: 2px 12px; border-radius: 999px; margin-left: 6px; vertical-align: middle;
}
h1 { font-size: 1.5rem; color: var(--theme); margin: 8px 0 12px; line-height: 1.4; }
h2 { font-size: 1.2rem; color: var(--theme); margin: 28px 0 8px; }
.muted { color: var(--muted); font-size: .9rem; }

.screen { display: none; }
.screen.active { display: block; animation: fade .25s ease both; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.field { display: block; margin: 0 0 22px; }
.field > span { display: block; font-weight: 700; margin-bottom: 6px; }
input[type=text], input[type=number], textarea {
  width: 100%; font: inherit; font-size: 1.2rem; padding: 14px 18px;
  border: 2px solid var(--line); border-radius: 14px; background: var(--card); color: var(--text);
}
input:focus, textarea:focus { outline: none; border-color: var(--theme); }
textarea { font-size: 1rem; resize: vertical; }

.pills { display: flex; flex-wrap: wrap; gap: 10px; }
.pill {
  font: inherit; min-height: 56px; min-width: 96px; padding: 10px 22px;
  border-radius: 999px; border: 2px solid var(--line); background: var(--card); color: var(--text); cursor: pointer;
}
.pill[aria-pressed=true] { border-color: var(--theme); background: var(--theme); color: #fff; font-weight: 700; }

.btn {
  display: block; width: 100%; font: inherit; font-weight: 700; font-size: 1.15rem;
  min-height: 64px; padding: 14px 24px; border-radius: 999px; border: 2px solid var(--theme); cursor: pointer;
}
.btn.primary { background: var(--theme); color: #fff; }
.btn.primary:active { background: var(--theme-dark); }
.btn.ghost { background: var(--card); color: var(--theme); }
.btn:disabled { opacity: .45; cursor: default; }
.link {
  font: inherit; font-size: .95rem; background: none; border: none; color: var(--theme);
  text-decoration: underline; cursor: pointer; padding: 10px 4px; min-height: 44px;
}
.actions { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 14px; }
.actions.two { flex-direction: row; }
.actions.two .btn { flex: 1; }
.shutter { min-height: 80px; font-size: 1.3rem; }

.err { color: #a33b2b; font-weight: 700; }
.warn {
  background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn-text);
  padding: 12px 14px; border-radius: 12px; font-size: .95rem;
}

.steprow { display: flex; align-items: center; justify-content: space-between; }
.dots { display: flex; gap: 8px; }
.dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--theme); }
.dot.done { background: var(--theme); }
.guide-text { margin: 0 0 12px; padding-left: 1.2em; font-size: 1rem; }

/* カメラ＋撮影ガイド。stage の縦横比はカメラ映像に合わせて JS で設定する */
.stage { position: relative; width: 100%; aspect-ratio: 3 / 4; max-height: 62vh; margin: 0 auto;
  background: #222; border-radius: var(--radius); overflow: hidden; }
.stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.overlay { position: absolute; inset: 0; pointer-events: none; }
.overlay .frame { position: absolute; left: 20%; right: 20%; top: 4%; bottom: 8%;
  border: 3px dashed rgba(255,255,255,.85); border-radius: 12px; }
.overlay .floor { position: absolute; left: 0; right: 0; bottom: 8%; border-top: 3px solid #ffd27a; }
.overlay .floor span { position: absolute; right: 8px; top: 2px; color: #ffd27a; font-size: .8rem;
  text-shadow: 0 0 4px #000; }
.overlay .feet { position: absolute; left: 50%; bottom: calc(8% - 10px); width: 22%; height: 20px;
  transform: translateX(-50%); border: 3px solid #ffd27a; border-radius: 50%; }
.overlay .center { position: absolute; left: 50%; top: 4%; bottom: 8%; border-left: 2px dashed rgba(255,255,255,.5); }
.overlay .face { position: absolute; top: 6%; left: 50%; transform: translateX(-50%);
  color: #fff; background: rgba(46,143,160,.85); padding: 2px 14px; border-radius: 999px; font-size: .9rem; }
.cam-msg { position: absolute; inset: auto 12px 40% 12px; color: #fff; text-align: center; margin: 0; }

canvas.shot { display: block; width: 100%; max-height: 62vh; object-fit: contain;
  background: #222; border-radius: var(--radius); }
.vals { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; margin: 12px 0; font-size: 1.05rem; }
.vals dt { font-weight: 700; }
.vals dd { margin: 0; }

.view-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; margin-bottom: 18px; }
.view-card h3 { margin: 0 0 10px; color: var(--theme); }
table.res { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 1rem; }
table.res th, table.res td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: right; }
table.res th:first-child, table.res td:first-child { text-align: left; }
table.res thead th { font-size: .85rem; color: var(--muted); font-weight: 400; }
.note-small { font-size: .8rem; color: var(--muted); }

.disclaimer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  background: var(--theme-weak); color: var(--theme-dark); text-align: center;
  font-size: .9rem; padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid #cfe5e9;
}
