* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
:root {
  --ink: #1d1d1f;
  --sub: #6e6e73;
  --accent: #8c2f1b;      /* うなぎのタレ色 */
  --accent-dark: #6e2414;
  --paper: #f6f4ef;
  --line: #e4e0d8;
  --ok: #1d7a46;
  --ng: #c0392b;
}
[hidden] { display: none !important; }
html { font-size: 16px; }
body {
  font-family: "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", sans-serif;
  background: var(--paper);
  color: var(--ink);
  min-height: 100svh;
  line-height: 1.6;
}
.screen { max-width: 560px; margin: 0 auto; padding: 16px 16px 48px; }

/* ---------- PIN ---------- */
#gate { display: flex; align-items: center; justify-content: center; min-height: 100svh; }
.gate-card { text-align: center; width: 100%; max-width: 360px; }
.gate-logo { display: block; width: 240px; max-width: 80%; margin: 0 auto 22px; }
.gate-card h1 { font-size: 1.3rem; }
.gate-note { margin-top: 20px; font-size: .85rem; color: var(--sub); }
#pin {
  display: block; width: 180px; margin: 10px auto; padding: 10px;
  font-size: 2rem; text-align: center; letter-spacing: .4em;
  border: 2px solid var(--line); border-radius: 12px; background: #fff;
}
#pin:focus { outline: none; border-color: var(--accent); }
.err { color: var(--ng); font-size: .85rem; min-height: 1.4em; margin-top: 8px; }

/* ---------- LINE内ブラウザ向けの案内 ---------- */
.line-banner {
  position: sticky; top: 0; z-index: 20;
  background: #fff6d8; border-bottom: 1.5px solid #e6c84a;
  padding: 10px 14px; font-size: .82rem; line-height: 1.5;
}
.line-banner b { color: #8a6d00; }

/* ---------- 共通 ---------- */
.top { text-align: center; margin: 12px 0 16px; }
.top-logo { display: block; width: 170px; max-width: 60%; margin: 4px auto 10px; }
.top h1 { font-size: 1.25rem; }
.sub { color: var(--sub); font-size: .85rem; }
.card {
  background: #fff; border: 1px solid var(--line); border-radius: 16px;
  padding: 18px; margin-bottom: 14px;
}
.card h2 { font-size: 1rem; margin-bottom: 8px; }
.lead { font-size: .95rem; margin-bottom: 14px; }
.hints { margin-top: 12px; padding-left: 1.2em; color: var(--sub); font-size: .82rem; }

.btn {
  display: block; width: 100%; text-align: center; cursor: pointer;
  border: 1.5px solid var(--line); border-radius: 12px; background: #fff;
  padding: 12px; font-size: 1rem; color: var(--ink); margin-top: 10px;
  font-weight: 600;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:active { background: var(--accent-dark); }
.btn.big { padding: 15px; font-size: 1.05rem; }
.btn.small { width: auto; display: inline-block; padding: 7px 14px; font-size: .85rem; margin: 0; }
.btn.danger { border-color: var(--ng); color: var(--ng); background: #fff; }
/* ボタンに透明のファイル入力を重ねる（LINE内ブラウザ等でも確実にカメラが開く） */
.filebtn { position: relative; overflow: hidden; }
.filebtn input[type="file"] {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; cursor: pointer; font-size: 100px;
}

/* ---------- 読み取り中 ---------- */
#busy { display: flex; align-items: center; justify-content: center; min-height: 100svh; }
.busy-box { text-align: center; }
.spinner {
  width: 44px; height: 44px; margin: 0 auto 16px;
  border: 4px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 確認・修正フォーム ---------- */
.photo-card { padding: 10px; text-align: center; }
#photo { width: 100%; border-radius: 10px; display: block; }
.photo-hint { font-size: .75rem; color: var(--sub); margin-top: 6px; }

.fgroup { margin: 18px 0 8px; font-size: .85rem; font-weight: 700; color: var(--sub); }
.frow {
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; margin-bottom: 8px;
  display: flex; align-items: center; gap: 10px;
}
.flabel { flex: 0 0 7.2em; font-size: .8rem; color: var(--sub); }
.finput {
  flex: 1; min-width: 0; padding: 9px 10px; font-size: 1rem; font-weight: 600;
  border: 1.5px solid var(--line); border-radius: 8px; background: #fff;
  font-family: inherit; color: var(--ink);
}
.finput:focus { outline: none; border-color: var(--accent); }
select.finput { appearance: auto; }

.pcheck {
  border-radius: 10px; padding: 9px 12px; margin: 0 0 8px;
  font-size: .82rem; line-height: 1.5;
}
.pcheck.ok { background: #e8f5ee; color: var(--ok); border: 1px solid #bfe3cf; }
.pcheck.ng { background: #fdf3f2; color: var(--ng); border: 1px solid #efc2bc; font-weight: 600; }

/* ---------- 名簿 ---------- */
#searchBox {
  width: 100%; padding: 11px 12px; font-size: 1rem;
  border: 1.5px solid var(--line); border-radius: 10px; background: #fff;
  font-family: inherit;
}
#searchBox:focus { outline: none; border-color: var(--accent); }
.sel-bar { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.sel-count { font-size: .85rem; color: var(--accent); font-weight: 700; margin-left: auto; }

.mrow-card {
  background: #fff; border: 1.5px solid var(--line); border-radius: 12px;
  padding: 10px 12px; margin-bottom: 8px;
  display: flex; align-items: center; gap: 10px; cursor: pointer;
}
.mrow-card.sel { border-color: var(--accent); background: #fdf6f0; }
.mchk {
  flex: 0 0 26px; height: 26px; border: 1.5px solid var(--line); border-radius: 7px;
  background: #fff; color: #fff; font-size: 1rem; line-height: 23px; text-align: center;
}
.mrow-card.sel .mchk { background: var(--accent); border-color: var(--accent); }
.mmain { flex: 1; min-width: 0; }
.mname { font-size: .98rem; font-weight: 700; }
.msub { font-size: .78rem; color: var(--sub); word-break: break-all; }
.medit {
  flex: 0 0 auto; border: 1.5px solid var(--line); background: #fff; color: var(--sub);
  border-radius: 8px; padding: 7px 12px; font-size: .85rem; cursor: pointer;
}

/* ---------- モーダル ---------- */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 40;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-box {
  background: #fff; border-radius: 16px; padding: 20px; width: 100%; max-width: 420px;
}
.modal-box h2 { font-size: 1.05rem; margin-bottom: 8px; }
.modal-box p { font-size: .9rem; margin-bottom: 12px; }

/* ---------- 拡大 ---------- */
#zoom {
  position: fixed; inset: 0; background: rgba(0,0,0,.88); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 10px;
}
#zoomImg { max-width: 100%; max-height: 100%; }
