/* 点の記 撮影アプリ。配色はPC側（点の記作成アプリ）のテーマに合わせる */
:root {
  --primary: #00695C;
  --primary-dark: #004D40;
  --primary-light: #E0F2F1;
  --border: #80CBC4;
  --bg: #F4FAF9;
  --text: #212121;
  --none: #9E9E9E;
  --part: #FB8C00;
  --done: #2E7D32;
  --danger: #E53935;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic UI", "Noto Sans JP", sans-serif;
  font-size: 16px; color: var(--text); background: var(--bg);
  display: flex; flex-direction: column; overflow: hidden;
  overscroll-behavior: none;
}
#appbar {
  background: var(--primary-dark); color: #fff;
  padding: calc(env(safe-area-inset-top) + 8px) 14px 8px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
#title { font-weight: bold; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#progress { font-size: 14px; white-space: nowrap; }
main { flex: 1; min-height: 0; position: relative; }
.view { position: absolute; inset: 0; display: flex; flex-direction: column; overflow-y: auto; -webkit-overflow-scrolling: touch; }
#view-io { padding: 0 12px 24px; display: block; }
#view-plot { overflow: hidden; }

.toolbar { display: flex; gap: 8px; align-items: center; padding: 8px 10px; background: #fff; border-bottom: 1px solid var(--border); flex: none; }
.toolbar select { flex: 1; min-width: 0; }
select, input[type=text] {
  font-size: 16px; padding: 8px; border: 1px solid var(--border); border-radius: 6px; background: #fff; color: var(--text);
}
.chip input { position: absolute; opacity: 0; }
.chip span { display: inline-block; padding: 6px 14px; border: 1px solid var(--border); border-radius: 16px; background: #fff; }
.chip input:checked + span { background: var(--primary); color: #fff; border-color: var(--primary); }

button { font: inherit; color: inherit; }
.btn {
  display: block; width: 100%; margin: 8px 0; padding: 12px 10px; min-height: 48px;
  background: var(--primary); color: #fff; border: none; border-radius: 8px;
  font-weight: bold; text-align: center; cursor: pointer;
}
.btn:active { background: var(--primary-dark); }
.btn.secondary { background: #fff; color: var(--primary-dark); border: 1px solid var(--border); }
.btn.danger { background: var(--danger); }
.btn:disabled { background: #BDBDBD; color: #757575; }
.mini { min-height: 40px; min-width: 44px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; background: #fff; }
.link { background: none; border: none; color: var(--primary-dark); text-decoration: underline; padding: 8px 4px; min-height: 40px; }
.link.del { color: var(--danger); }

/* 点名リスト */
#point-list { list-style: none; margin: 0; padding: 0; }
#point-list li {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-height: 56px;
  background: #fff; border-bottom: 1px solid #E0E0E0; cursor: pointer;
}
#point-list li:active { background: var(--primary-light); }
#point-list .nm { flex: 1; font-size: 18px; font-weight: bold; word-break: break-all; }
#point-list .cat { font-size: 12px; color: #616161; }
#point-list .marks { font-size: 13px; color: #616161; white-space: nowrap; }
#point-list .marks b { color: var(--done); }
.dot { display: inline-block; width: 16px; height: 16px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px #616161; flex: none; vertical-align: middle; }
.st-none { background: var(--none); }
.st-part { background: var(--part); }
.st-done { background: var(--done); }
.dot.skip { background: #fff; }
.empty { padding: 24px 16px; color: #616161; }

/* 画地プロット */
#plot-wrap { flex: 1; min-height: 0; position: relative; background: #fff; }
#plot { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; display: block; cursor: pointer; }
#legend {
  position: absolute; left: 8px; bottom: 8px; display: flex; gap: 10px; flex-wrap: wrap;
  font-size: 12px; background: rgba(255,255,255,.88); padding: 4px 8px; border-radius: 6px; pointer-events: none;
}
#legend .dot { width: 12px; height: 12px; margin-right: 3px; }

/* 入出力・設定 */
h2 { font-size: 15px; color: var(--primary-dark); margin: 18px 2px 6px; }
.card { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.card p { margin: 6px 0; }
.hint { font-size: 13px; color: #616161; }
.hint.warn { color: #BF360C; font-weight: bold; }
.form label { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; }
.form select { max-width: 60%; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.switch {
  appearance: none; -webkit-appearance: none; width: 52px; height: 30px; border-radius: 15px;
  background: #BDBDBD; position: relative; flex: none; margin: 0; cursor: pointer; transition: background .15s;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; transition: left .15s;
}
.switch:checked { background: var(--primary); }
.switch:checked::after { left: 25px; }
#board-preview { display: block; width: 100%; max-width: 320px; margin: 8px auto 0; border: 1px solid #E0E0E0; }

/* タブバー */
#tabbar { display: flex; background: #fff; border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom); flex: none; }
#tabbar button { flex: 1; min-height: 52px; border: none; background: none; color: #616161; font-size: 14px; }
#tabbar button.active { color: var(--primary-dark); font-weight: bold; box-shadow: inset 0 3px 0 var(--primary); }

/* 撮影メニュー（下から出るシート） */
#sheet-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 10; }
#sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 11; background: #fff;
  border-radius: 14px 14px 0 0; padding: 12px 14px calc(env(safe-area-inset-bottom) + 12px);
  max-height: 92%; overflow-y: auto; box-shadow: 0 -4px 16px rgba(0,0,0,.25);
}
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
#sheet-name { font-size: 26px; font-weight: bold; word-break: break-all; }
#sheet-sub { font-size: 13px; color: #616161; }
.board-row { padding: 8px 0; border-bottom: 1px solid #EEE; margin-bottom: 8px; }
.shots { display: flex; gap: 10px; }
.shot { flex: 1; min-width: 0; }
.shot-title { font-weight: bold; text-align: center; margin-bottom: 4px; }
.thumb {
  aspect-ratio: 4 / 3; background: #EEEEEE; border: 1px solid #BDBDBD; border-radius: 6px;
  display: flex; align-items: center; justify-content: center; color: #757575; overflow: hidden;
}
.thumb img { width: 100%; height: 100%; object-fit: contain; background: #000; }
.shot-sub { display: flex; justify-content: space-between; }
.sheet-nav { display: flex; gap: 10px; }
.sheet-nav .btn { margin: 4px 0 0; }

#viewer { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.92); display: flex; align-items: center; justify-content: center; }
#viewer img { max-width: 100%; max-height: 100%; }
#busy { position: fixed; inset: 0; z-index: 30; background: rgba(255,255,255,.7); display: flex; align-items: center; justify-content: center; }
#busy div { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 16px 24px; font-weight: bold; }
#toast {
  /* 画面の上側に出す（下側だと撮影メニューの撮影ボタンに重なる）。操作のじゃまをしないよう、押せない表示にする */
  position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 52px); transform: translateX(-50%); z-index: 40;
  max-width: 90%; width: max-content; pointer-events: none;
  background: rgba(33,33,33,.92); color: #fff; padding: 10px 16px; border-radius: 20px; font-size: 14px;
}
