:root {
  --ink: #0f2233;
  --sky: #2f6f9f;
  --sky-light: #e8f1f8;
  --paper: #ffffff;
  --muted: #4b5d6b;
  --ok: #1f6f43;
  --warn: #9b2c2c;
  --radius: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--sky-light);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { -webkit-text-size-adjust: 100%; }
#app { max-width: 560px; margin: 0 auto; min-height: 100%; }
.screen { padding: max(20px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom)); }
[hidden] { display: none !important; }
h1 { font-size: 2rem; margin: 24px 0 8px; letter-spacing: -0.01em; }
h2 { font-size: 1.3rem; margin: 16px 0 10px; }
h1:focus, h2:focus { outline: none; }
.lead { font-size: 1.05rem; line-height: 1.45; margin: 0 0 20px; }
.hint { color: var(--muted); font-size: 0.95rem; line-height: 1.4; }
.status { min-height: 1.4em; color: var(--muted); }
.field-label { display: block; font-weight: 600; margin: 8px 0 6px; }
input[type=email] {
  width: 100%; font-size: 1.05rem; padding: 14px; border-radius: 10px;
  border: 1.5px solid #9fb3c3; background: var(--paper); color: var(--ink);
}
input[type=email]:focus { outline: 3px solid #7fb3d9; outline-offset: 1px; }
button, .ghost {
  font: inherit; font-size: 1.05rem; border-radius: 12px; cursor: pointer;
  min-height: 48px; padding: 12px 18px; border: none;
}
button:focus-visible, label.ghost:focus-within { outline: 3px solid #7fb3d9; outline-offset: 2px; }
.primary { background: var(--sky); color: #fff; width: 100%; font-weight: 600; margin-top: 14px; }
.primary:disabled { opacity: 0.6; }
.ghost { background: transparent; color: var(--sky); border: 1.5px solid var(--sky); display: inline-flex; align-items: center; gap: 6px; }
.small { font-size: 0.95rem; min-height: 44px; padding: 8px 12px; }
.danger { background: transparent; color: var(--warn); border: 1.5px solid var(--warn); width: 100%; margin-top: 28px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; margin-top: 14px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Camera */
#screen-camera { padding: 0; background: #000; min-height: 100vh; display: flex; flex-direction: column; }
.viewfinder { position: relative; flex: 1; overflow: hidden; }
#video { width: 100%; height: 100%; object-fit: cover; display: block; min-height: 60vh; }
.frame-guide {
  position: absolute; left: 50%; top: 50%; width: 76vmin; height: 76vmin; max-width: 440px; max-height: 440px;
  transform: translate(-50%, -50%); border: 2px solid rgba(255,255,255,0.7); border-radius: 8px; pointer-events: none;
}
.dir-readout {
  position: absolute; top: max(12px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  color: #fff; background: rgba(0,0,0,0.45); padding: 6px 12px; border-radius: 20px; font-size: 0.95rem;
}
.dir-readout:empty { display: none; }
.cam-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 16px 16px max(18px, env(safe-area-inset-bottom)); background: #000;
}
.cam-bar .ghost { color: #fff; border-color: rgba(255,255,255,0.6); }
.shutter {
  width: 74px; height: 74px; border-radius: 50%; background: #fff; padding: 0;
  box-shadow: 0 0 0 5px #000, 0 0 0 8px #fff; flex: none;
}
.shutter:active { transform: scale(0.94); }
.cam-status { color: #dfe8ef; text-align: center; margin: 0; padding: 0 16px 12px; background: #000; }
#log-count { background: rgba(255,255,255,0.2); border-radius: 10px; padding: 1px 8px; font-size: 0.85rem; }

/* Result */
.shot { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius); display: block; background: #cfdde8; }
.guesses { list-style: none; padding: 0; margin: 0 0 18px; }
.guesses li { display: grid; grid-template-columns: 9.5em 1fr 3em; align-items: center; gap: 10px; padding: 8px 0; font-size: 1.05rem; }
.g-name { font-weight: 600; }
.bar { height: 10px; background: #d5e2ec; border-radius: 6px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--sky); border-radius: 6px; }
.g-pct { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.question { font-weight: 600; font-size: 1.1rem; margin: 6px 0 10px; }
.choices, .type-list { display: grid; gap: 10px; }
.type-list { grid-template-columns: 1fr 1fr; margin-bottom: 14px; }
.choice { background: var(--paper); color: var(--ink); border: 1.5px solid #9fb3c3; text-align: left; }
.choice:active { background: #dbe9f3; }
.choice.alt { color: var(--sky); border-color: var(--sky); }

/* Log */
.log-list { list-style: none; padding: 0; margin: 0; }
.log-list li { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid #c9d8e3; }
.log-list img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; background: #cfdde8; flex: none; }
.log-list div { display: flex; flex-direction: column; gap: 2px; }
.log-list span { color: var(--muted); font-size: 0.9rem; }
.log-list .empty { color: var(--muted); border: none; }

/* App additions */
.install-hint { position: absolute; left: 12px; right: 12px; bottom: 12px; display: flex; gap: 8px; align-items: center;
  background: rgba(255,255,255,0.95); color: var(--ink); border-radius: 14px; padding: 10px 12px; font-size: 0.95rem; }
.install-hint span { flex: 1; }
.pill { min-height: 40px; padding: 6px 12px; border-radius: 20px; background: var(--sky); color: #fff; font-size: 0.9rem; }
.pill.ghosty { background: transparent; color: var(--ink); min-width: 40px; }
.cam-start { position: absolute; inset: 0; margin: auto; width: 70%; height: 64px; background: #fff; color: var(--ink); font-weight: 600; }
.wide { width: 100%; margin-top: 10px; justify-content: center; }
.choice[aria-pressed="true"] { background: var(--sky); color: #fff; border-color: var(--sky); }
.choice:disabled { opacity: 0.5; }
.small-choice { min-height: 44px; padding: 8px 12px; }
.type-list { margin-top: 10px; }
#screen-setup { padding-top: 15vh; }

/* 0.4 */
.big { min-height: 60px; font-size: 1.15rem; }
.label-btn { display: flex; align-items: center; justify-content: center; border-radius: 12px; cursor: pointer; width: 100%; margin-top: 14px; }
.rules { padding-left: 1.2em; line-height: 1.6; color: var(--muted); }
.step { color: var(--sky); font-weight: 600; margin: 8px 0 0; }
.tips { padding-left: 1.2em; line-height: 1.5; margin: 6px 0 12px; }
.check { font-weight: 600; min-height: 1.4em; }
.opt { color: var(--muted); font-weight: 400; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip { min-height: 40px; padding: 6px 12px; border-radius: 20px; background: var(--paper); border: 1.5px solid #9fb3c3; color: var(--ink); font-size: 0.95rem; }
.chip[aria-pressed="true"] { background: var(--sky); color: #fff; border-color: var(--sky); }
#screen-home h1 { margin-top: 32px; }
#screen-home .install-hint { position: static; margin-top: 20px; }

.version { color: var(--muted); font-size: 0.8rem; text-align: center; margin-top: 28px; }

/* 0.5.1: clearer photo steps */
.steps { list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0; margin: 4px 0 12px; }
.slot { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; border: 2px solid #c9d8e3; background: var(--paper); opacity: 0.7; }
.slot.current { border-color: var(--sky); opacity: 1; box-shadow: 0 0 0 3px rgba(47,111,159,0.15); }
.slot.done { opacity: 1; }
.slot-img { position: relative; width: 52px; height: 52px; border-radius: 8px; background: #dfeaf3; flex: none; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.slot-img img { width: 100%; height: 100%; object-fit: cover; }
.slot-num { position: absolute; font-weight: 700; font-size: 1.2rem; color: var(--sky); }
.slot.done .slot-num { top: 2px; right: 4px; font-size: 0.85rem; color: #fff; background: var(--ok); border-radius: 10px; padding: 0 6px; }
.slot.done .slot-num::after { content: " ✓"; }
.slot-label { font-weight: 600; }
.how svg { width: 100%; height: auto; display: block; margin-bottom: 8px; }
.shot.tag-cloud, .shot.tag-up { outline: 3px solid var(--sky); outline-offset: -3px; }
.pair { display: grid; grid-template-columns: 2fr 1fr; gap: 8px; }
.pair figure { margin: 0; }
.pair img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 12px; display: block; background: #cfdde8; }
.pair-main img { aspect-ratio: 4 / 5; }
.pair figcaption { font-size: 0.9rem; font-weight: 600; margin-top: 4px; }
.log-list .up-thumb { width: 40px; height: 40px; }

.pair img, .pair-main img { aspect-ratio: auto; height: 34vh; max-height: 300px; }

/* 0.6: aiming */
.preview-wrap { position: relative; width: 100%; margin: 6px auto 4px; border-radius: 12px; overflow: hidden; background: #cfdde8; }
.preview-wrap img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; display: block; }
.preview-wrap.tag-cloud, .preview-wrap.tag-up { outline: 3px solid var(--sky); outline-offset: -3px; }
.preview-wrap.aimable { cursor: crosshair; }
.aim-box { position: absolute; border: 2px dashed rgba(255,255,255,0.95); box-shadow: 0 0 0 9999px rgba(15,34,51,0.35); pointer-events: none; }
.aim { position: absolute; width: 44px; height: 44px; transform: translate(-50%, -50%); pointer-events: none; }
.aim::before, .aim::after { content: ""; position: absolute; background: #fff; box-shadow: 0 0 0 1.5px rgba(15,34,51,0.8); }
.aim::before { left: 50%; top: 0; width: 2px; height: 100%; transform: translateX(-50%); }
.aim::after { top: 50%; left: 0; height: 2px; width: 100%; transform: translateY(-50%); }
.aim-hint { font-size: 0.95rem; font-weight: 600; color: var(--sky); margin: 4px 0 8px; }

.setup-card { background: var(--paper); border-radius: 12px; padding: 12px 16px; margin: 10px 0; border: 1.5px solid #c9d8e3; }
.setup-card h2 { font-size: 1.05rem; margin: 2px 0 6px; }
.setup-card ol { margin: 0; padding-left: 1.3em; line-height: 1.6; }

.sub { margin: 4px 0 6px; font-size: 0.9rem; color: #4a5a68; }
.full-name { font-size: 1.15rem; font-style: italic; font-weight: 600; margin: 0 0 8px; }
.chip small { display: block; font-size: 0.75rem; opacity: 0.8; font-style: normal; }
.chip i { font-style: italic; }

/* answer grid: fixed layout, nothing moves when the tool's guesses arrive */
button, .chip, .choice, label { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.hint-line { margin: -4px 0 8px; font-size: 0.9rem; color: #4a5a68; }
#type-list { grid-template-columns: 1fr 1fr; margin: 0 0 16px; }
#type-list .choice { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; min-height: 56px; transition: background-color .15s, border-color .15s; }
#type-list .badge { display: block; min-height: 1.1em; font-size: 0.75rem; color: var(--sky); font-weight: 600; }
#type-list .choice.guess { border-color: var(--sky); border-width: 2px; }
#type-list .choice[aria-pressed="true"] .badge { color: #fff; }
/* picture chips for the optional detail */
.chip.pic { display: flex; flex-direction: column; align-items: center; width: calc(33.3% - 6px); padding: 6px 4px 8px; border-radius: 12px; text-align: center; transition: background-color .15s, border-color .15s; }
.chip.pic svg { width: 100%; max-width: 96px; height: auto; border-radius: 6px; margin-bottom: 4px; }
.chip.pic i { font-weight: 600; font-size: 0.85rem; }
.chip.pic small { font-size: 0.7rem; line-height: 1.2; }
.chip.pic[aria-pressed="true"] svg { outline: 3px solid #fff; }

#type-list .choice.guess { grid-column: span 1; min-height: 64px; font-size: 1.05rem; }
.else-btn { margin: -6px 0 14px; }
.else-btn[aria-pressed="true"] { color: var(--sky); }
#type-list .choice[hidden] { display: none; }

/* answer buttons with a picture and a plain description */
#type-list .choice { flex-direction: row; align-items: center; gap: 10px; padding: 8px; }
#type-list .choice svg { flex: 0 0 64px; width: 64px; height: 45px; border-radius: 6px; }
#type-list .t-text { display: flex; flex-direction: column; min-width: 0; }
#type-list .t-name { font-weight: 600; }
#type-list .t-help { font-size: 0.75rem; line-height: 1.25; opacity: 0.85; }
#type-list .choice.guess { grid-column: 1 / -1; }
#type-list .choice.guess svg { flex-basis: 96px; width: 96px; height: 67px; }
/* check screen */
.confirm-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.confirm-pair figure { margin: 0; }
.confirm-pair img, .confirm-pic svg { width: 100%; aspect-ratio: 80 / 56; height: auto; object-fit: cover; border-radius: 10px; display: block; }
.confirm-pair figcaption { font-size: 0.8rem; color: #4a5a68; text-align: center; margin-top: 4px; }
.confirm-name { font-size: 1.35rem; font-weight: 700; font-style: italic; margin: 4px 0 6px; }
.confirm-parts { margin: 0 0 16px; padding-left: 18px; font-size: 0.95rem; }
.confirm-parts li { margin: 2px 0; }
#type-list .choice { justify-content: flex-start; text-align: left; }

/* example photos */
#type-list .choice img { flex: 0 0 72px; width: 72px; height: 50px; object-fit: cover; border-radius: 6px; background: #c8d6e2; }
#type-list .choice.guess img { flex-basis: 110px; width: 110px; height: 76px; }
.chip.pic img { width: 100%; aspect-ratio: 80 / 56; object-fit: cover; border-radius: 6px; margin-bottom: 4px; background: #c8d6e2; }
.chip.pic[aria-pressed="true"] img { outline: 3px solid #fff; }
.lookfor { font-size: 0.9rem; margin: -6px 0 12px; padding: 8px 10px; background: #fff; border-left: 4px solid var(--sky); border-radius: 4px; }
.lookfor:empty { display: none; }
.confirm-pic img, .confirm-pic svg { width: 100%; aspect-ratio: 80 / 56; height: auto; object-fit: cover; border-radius: 10px; display: block; background: #c8d6e2; }
.confirm-parts { list-style: none; padding: 0; }
.confirm-parts li { display: flex; gap: 10px; align-items: flex-start; margin: 6px 0; }
.confirm-parts .part-photo { flex: 0 0 84px; width: 84px; height: 59px; object-fit: cover; border-radius: 6px; }
.credits { font-size: 0.75rem; color: #4a5a68; margin-top: 12px; }
.credits ul { padding-left: 16px; margin: 4px 0; }

.point-box { background: #fff; border: 2px solid var(--sky); border-radius: 12px; padding: 12px; margin: 10px 0; }
.point-title { font-weight: 700; margin: 0 0 4px; }
.point-how { margin: 0 0 6px; font-size: 0.95rem; }
.point-live { font-size: 1.05rem; font-weight: 600; color: var(--sky); margin: 4px 0 8px; min-height: 1.4em; }
#gate-code{width:100%;font-size:1.3rem;letter-spacing:2px;text-transform:uppercase;padding:10px;border-radius:10px;border:1.5px solid #9fb3c3;box-sizing:border-box;margin-bottom:12px}
