:root {
  --bg: #0f2620;
  --bg-card: #16332b;
  --bg-card-2: #1d3f35;
  --accent: #4fd1a5;
  --accent-dim: #2f9c7a;
  --text: #e8f2ee;
  --text-dim: #9fb8af;
  --warn-bg: #4a2f12;
  --warn-border: #d98b34;
  --warn-text: #ffd9a0;
  --danger-bg: #4a1f1f;
  --danger-border: #e06b6b;
  --danger-text: #ffc4c4;
  --radius: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-text-size-adjust: 100%;
}

.app-header {
  padding: calc(env(safe-area-inset-top) + 18px) 20px 16px;
  background: linear-gradient(160deg, #1d3f35, #16332b);
  border-bottom: 1px solid #244a3e;
}
.app-header h1 { font-size: 1.35rem; letter-spacing: .01em; }
.subtitle { color: var(--text-dim); font-size: .85rem; margin-top: 2px; }

.container {
  flex: 1;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 18px 16px 32px;
}

.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 18px;
  border: 1px solid #244a3e;
}

.field-label {
  display: block;
  font-size: .8rem;
  color: var(--text-dim);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.water-select {
  width: 100%;
  padding: 14px 12px;
  font-size: 1.05rem;
  background: var(--bg-card-2);
  color: var(--text);
  border: 1px solid #2f5a4b;
  border-radius: 10px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%234fd1a5' stroke-width='3'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}

.placeholder {
  color: var(--text-dim);
  text-align: center;
  padding: 32px 16px;
  font-size: .92rem;
}

.hidden { display: none !important; }

/* 判定結果 */
.result { animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.result-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}
.result-head h2 { font-size: 1.2rem; }
.region-tag {
  font-size: .72rem;
  color: var(--accent);
  border: 1px solid var(--accent-dim);
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.rule-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 14px 0;
}
.rule-cell {
  background: var(--bg-card);
  border: 1px solid #244a3e;
  border-radius: 12px;
  padding: 12px 14px;
}
.rule-cell.full { grid-column: 1 / -1; }
.rule-cell .k {
  font-size: .72rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.rule-cell .v {
  font-size: 1.15rem;
  font-weight: 600;
  margin-top: 2px;
}
.rule-cell .v.sm { font-size: .98rem; font-weight: 500; line-height: 1.5; }

.didymo-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: var(--danger-text);
  border-radius: 12px;
  padding: 12px 14px;
  margin: 14px 0;
  font-size: .9rem;
}
.didymo-banner.safe {
  background: var(--bg-card-2);
  border-color: #2f5a4b;
  color: var(--text-dim);
}
.didymo-banner .icon { font-size: 1.3rem; line-height: 1; }

.verify-note {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  color: var(--warn-text);
  border-radius: 12px;
  padding: 12px 14px;
  margin-top: 14px;
  font-size: .86rem;
}
.verify-note .label { font-weight: 700; }

/* ===== ボトムナビ ===== */
.bottom-nav {
  position: sticky;
  bottom: 0;
  display: flex;
  background: #0c1f1a;
  border-top: 1px solid #244a3e;
  z-index: 20;
}
.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 9px 2px calc(env(safe-area-inset-bottom) + 9px);
  background: none;
  border: none;
  color: var(--text-dim);
  font-family: inherit;
  cursor: pointer;
}
.nav-ic { font-size: 1.1rem; line-height: 1; }
.nav-tx { font-size: .67rem; white-space: nowrap; }
.nav-btn.active { color: var(--accent); font-weight: 700; box-shadow: inset 0 2px 0 var(--accent); }

.view.hidden { display: none; }

/* ===== ボタン共通 ===== */
.btn {
  font-family: inherit;
  font-size: .92rem;
  border-radius: 10px;
  padding: 10px 14px;
  border: 1px solid transparent;
  cursor: pointer;
}
.btn-accent { background: var(--accent-dim); color: #06150f; font-weight: 700; border-color: var(--accent); }
.btn-ghost { background: transparent; color: var(--text); border-color: #2f5a4b; }
.btn-danger { background: var(--danger-bg); color: var(--danger-text); border-color: var(--danger-border); }

/* ===== 釣果ログ ===== */
.card-title { font-size: 1.1rem; }
.log-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.log-actions { display: flex; gap: 8px; }
.log-count { color: var(--text-dim); font-size: .8rem; margin-top: 8px; }

.log-list { display: flex; flex-direction: column; gap: 10px; }
.catch-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid #244a3e;
  border-radius: 12px;
  padding: 12px 14px;
}
.catch-main { flex: 1; min-width: 0; }
.catch-line1 { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.catch-line1 .sp { font-weight: 700; font-size: 1.05rem; }
.catch-line1 .size { color: var(--accent); font-weight: 600; }
.catch-line1 .water { color: var(--text-dim); font-size: .82rem; }
.catch-line2 { font-size: .88rem; margin-top: 2px; }
.catch-meta { color: var(--text-dim); font-size: .76rem; margin-top: 4px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip { background: var(--bg-card-2); border: 1px solid #2f5a4b; border-radius: 999px; padding: 1px 8px; font-size: .72rem; }
.catch-edit {
  flex-shrink: 0;
  background: var(--bg-card-2);
  border: 1px solid #2f5a4b;
  color: var(--accent);
  border-radius: 10px;
  width: 38px; height: 38px;
  font-size: 1rem;
  cursor: pointer;
}

/* ===== モーダル ===== */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; }
.modal.hidden { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.55); }
.modal-sheet {
  position: relative;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  background: var(--bg-card);
  border-radius: 18px 18px 0 0;
  border-top: 1px solid #2f5a4b;
  padding: 18px 16px calc(env(safe-area-inset-bottom) + 20px);
  max-height: 90vh;
  overflow-y: auto;
}
@media (min-width: 560px) {
  .modal { align-items: center; }
  .modal-sheet { border-radius: 18px; }
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-head h3 { font-size: 1.15rem; }
.modal-close { background: none; border: none; color: var(--text-dim); font-size: 1.1rem; cursor: pointer; padding: 4px 8px; }
body.modal-open { overflow: hidden; }

.catch-form { display: flex; flex-direction: column; gap: 14px; }
.f-label { display: flex; flex-direction: column; gap: 6px; font-size: .8rem; color: var(--text-dim); }
.f-input {
  width: 100%;
  padding: 11px 12px;
  font-size: 1rem;
  font-family: inherit;
  background: var(--bg-card-2);
  color: var(--text);
  border: 1px solid #2f5a4b;
  border-radius: 10px;
}
.f-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.f-gps { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; }
.f-hint { font-size: .76rem; color: var(--text-dim); }
.form-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 6px; }
.form-actions .btn-accent { flex: 1; }
.error { color: var(--danger-text); }

/* ===== 現場メモ ===== */
.note-cta { display: flex; gap: 8px; margin: 12px 0 4px; }
.note-cta .btn-accent { flex: 1; }
.chip-link { color: var(--accent); text-decoration: none; }

.note-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid #244a3e;
  border-radius: 12px;
  padding: 12px 14px;
}
.note-icon { font-size: 1.4rem; line-height: 1.2; flex-shrink: 0; }
.note-main { flex: 1; min-width: 0; }
.note-line1 { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.note-name { font-weight: 700; font-size: 1rem; }
.note-cat { color: var(--text-dim); font-size: .76rem; }
.note-body { font-size: .88rem; margin-top: 3px; white-space: pre-wrap; word-break: break-word; }
.note-meta { color: var(--text-dim); font-size: .76rem; margin-top: 5px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
textarea.f-input { resize: vertical; line-height: 1.5; }

/* ===== 写真 ===== */
.photo-hint { font-size: .78rem; color: var(--text-dim); margin: 4px 0 8px; font-weight: normal; }
.photo-section { margin-top: 6px; }
.photo-add { display: flex; gap: 8px; margin-bottom: 10px; }
.photo-add.busy { opacity: .5; pointer-events: none; }
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.photo-thumb {
  position: relative;
  padding: 0;
  border: 1px solid #2f5a4b;
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-card-2);
  cursor: pointer;
  aspect-ratio: 1 / 1;
}
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-thumb .photo-cap {
  position: absolute; left: 0; right: 0; bottom: 0;
  font-size: .64rem; color: #fff;
  background: linear-gradient(transparent, rgba(0,0,0,.7));
  padding: 10px 6px 3px; text-align: left;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.photo-empty { font-size: .82rem; color: var(--text-dim); }
.photo-chip.hidden { display: none; }

.photo-viewer { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; }
.photo-viewer.hidden { display: none; }
.pv-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.85); }
.pv-inner {
  position: relative;
  width: 100%; max-width: 640px;
  margin: 0 16px;
  display: flex; flex-direction: column; gap: 10px;
  max-height: 92vh;
}
.pv-img {
  width: 100%; max-height: 64vh; object-fit: contain;
  border-radius: 12px; background: #000;
}
.pv-meta { font-size: .78rem; color: #c9d8d2; }
.pv-actions { display: flex; justify-content: space-between; gap: 10px; }

/* ===== 「今日」ダッシュボード ===== */
.today-hero { background: linear-gradient(160deg, #1d3f35, #16332b); }
.today-date-row { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; }
.today-label { font-size: .78rem; color: var(--text-dim); letter-spacing: .08em; }
.today-date { font-size: 1.5rem; font-weight: 700; color: var(--accent); }
.today-saved {
  margin-left: auto;
  font-size: .72rem;
  color: var(--accent);
  opacity: 0;
  transition: opacity .2s;
}
.today-saved.show { opacity: 1; }

.today-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sum-cell { background: var(--bg-card-2); border: 1px solid #2f5a4b; border-radius: 12px; padding: 12px 14px; }
.sum-k { font-size: .74rem; color: var(--text-dim); }
.sum-v { font-size: 1.6rem; font-weight: 700; margin-top: 2px; }
.sum-v .u { font-size: .9rem; font-weight: 500; color: var(--text-dim); }

#view-today .card-title { margin-bottom: 10px; }

/* ===== 拠点・生活インフラ ===== */
.places-filter { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.filter-chip {
  font-family: inherit;
  font-size: .8rem;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--bg-card-2);
  color: var(--text-dim);
  border: 1px solid #2f5a4b;
  cursor: pointer;
  white-space: nowrap;
}
.filter-chip.active { background: var(--accent-dim); color: #06150f; border-color: var(--accent); font-weight: 700; }

.places-list { display: flex; flex-direction: column; gap: 18px; }
.places-group-title { font-size: .9rem; color: var(--accent); margin-bottom: 8px; letter-spacing: .02em; }
.places-group { display: flex; flex-direction: column; gap: 10px; }
.places-group-title { grid-column: 1 / -1; }

.place-item {
  background: var(--bg-card);
  border: 1px solid #244a3e;
  border-radius: 12px;
  padding: 12px 14px;
}
.place-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.place-name { font-weight: 700; font-size: 1rem; }
.place-town { color: var(--text-dim); font-size: .76rem; border: 1px solid #2f5a4b; border-radius: 999px; padding: 1px 8px; }
.place-note { font-size: .86rem; color: var(--text); margin-top: 5px; line-height: 1.5; }
.place-foot { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; align-items: center; }
.place-action {
  font-size: .82rem;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid #2f5a4b;
}
.place-action.tel { background: var(--accent-dim); color: #06150f; font-weight: 700; border-color: var(--accent); }
.place-action.map { background: var(--bg-card-2); color: var(--accent); }
.places-source { font-size: .76rem; color: var(--text-dim); margin-top: 16px; line-height: 1.5; }

/* ===== 地図（SVG模式図） ===== */
.layer-chip.active { background: var(--chip, var(--accent-dim)); border-color: var(--chip, var(--accent)); color: #06150f; }
.map-svg-wrap { margin-bottom: 14px; }
.map-svg {
  width: 100%;
  height: auto;
  display: block;
  background: #0c1f1a;
  border: 1px solid #244a3e;
  border-radius: 14px;
}
.map-bg { fill: #0e241d; }
.map-svg .pin { cursor: pointer; }
.map-svg .pin:active circle { stroke: var(--accent); }
.town-label { fill: #8fb0a6; font-size: 17px; font-family: inherit; }
.town-dot { fill: #8fb0a6; }

.map-detail { margin-bottom: 14px; }
.map-detail-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--accent-dim);
  border-radius: 14px;
  padding: 14px 16px;
}
.map-detail-close {
  position: absolute; top: 10px; right: 10px;
  background: none; border: none; color: var(--text-dim); font-size: 1rem; cursor: pointer;
}
.md-head { display: flex; gap: 10px; align-items: center; padding-right: 24px; }
.md-icon {
  width: 34px; height: 34px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; flex-shrink: 0;
}
.md-name { font-weight: 700; font-size: 1.02rem; }
.md-sub { color: var(--text-dim); font-size: .78rem; }
.md-note { font-size: .88rem; margin-top: 10px; line-height: 1.5; }
.md-coord { color: var(--text-dim); font-size: .78rem; margin-top: 8px; }
.map-detail-card .place-action.map { display: inline-block; margin-top: 12px; }

/* ===== ディディモ洗浄チェック ===== */
.didymo-intro { color: var(--text-dim); font-size: .88rem; margin-top: 8px; }
.didymo-intro strong { color: var(--accent); }

.cert-verdict {
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 18px;
  border: 1px solid;
}
.cert-verdict h3 { font-size: 1.05rem; margin-bottom: 4px; }
.cert-verdict p { font-size: .9rem; }
.cert-verdict.level-danger { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger-text); }
.cert-verdict.level-warn { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-text); }
.cert-verdict.level-ok { background: var(--bg-card-2); border-color: var(--accent-dim); color: var(--text); }

.check-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.check-progress { font-size: .82rem; color: var(--text-dim); white-space: nowrap; }
.check-progress.complete { color: var(--accent); font-weight: 700; }

.check-group { margin-bottom: 14px; }
.check-group-title { font-size: .82rem; color: var(--accent); font-weight: 700; margin-bottom: 8px; letter-spacing: .03em; }
.check-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-card-2);
  border: 1px solid #2f5a4b;
  border-radius: 10px;
  margin-bottom: 8px;
  font-size: .9rem;
  cursor: pointer;
}
.check-item input[type="checkbox"] {
  width: 20px; height: 20px;
  margin-top: 1px;
  accent-color: var(--accent);
  flex-shrink: 0;
}
.check-foot { display: flex; justify-content: flex-end; margin: 4px 0 14px; }

.app-footer {
  padding: 16px 20px calc(env(safe-area-inset-bottom) + 20px);
  border-top: 1px solid #244a3e;
  background: #0c1f1a;
}
.source-line { font-size: .74rem; color: var(--text-dim); margin-bottom: 8px; }
.legal { font-size: .78rem; color: var(--warn-text); }
.legal strong { color: #ffe6c2; }
