:root {
  color-scheme: dark;
  --abyss: #040c15;
  --deep: #071523;
  --water: #0b2436;
  --panel: #0f2134;
  --line: #1e3550;
  --cyan: #3ed9e8;
  --cyan-soft: rgba(62, 217, 232, 0.14);
  --ink: #e9f3fa;
  --mist: #93aabe;
  --dim: #6b8298;
  --caution: #ffd34a;
  --jp: "Zen Kaku Gothic New", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", system-ui, sans-serif;
  --gauge: "Barlow Condensed", "Arial Narrow", "Helvetica Neue", sans-serif;
  --gutter: 16px;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--deep);
  color: var(--ink);
  font-family: var(--jp);
  font-size: 15px;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
button { font: inherit; color: inherit; }

.bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  align-items: flex-end;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) var(--gutter) 12px;
  border-bottom: 1px solid var(--line);
  background: var(--abyss);
}
.eyebrow { font-family: var(--gauge); letter-spacing: 0.18em; font-size: 12px; color: var(--dim); }
.bar h1 { margin: 0; font-size: 20px; font-weight: 700; text-wrap: balance; }
.tag { font-size: 11px; font-weight: 500; color: var(--caution); border: 1px solid currentColor; border-radius: 6px; padding: 1px 6px; vertical-align: 3px; }
.account-link { margin-left: auto; order: 1; padding: 5px 12px; border: 1px solid var(--cyan); border-radius: 999px; color: var(--cyan); font-size: 13px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.search input {
  width: min(260px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  padding: 7px 10px;
  font: inherit;
}
.search input:focus { outline: 2px solid var(--cyan); outline-offset: 1px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--mist);
  padding: 4px 12px;
  cursor: pointer;
  font-size: 13px;
}
.chips button.on { background: var(--cyan-soft); border-color: var(--cyan); color: var(--cyan); }

.layout { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 380px; min-height: 0; }
.map-wrap { position: relative; min-height: 0; }
.map { position: absolute; inset: 0; background: var(--water); }
.map-note {
  position: absolute; left: 12px; right: 12px; bottom: 28px; margin: 0; z-index: 1000;
  background: var(--panel); border: 1px solid var(--caution); color: var(--caution);
  border-radius: var(--radius); padding: 8px 10px; font-size: 13px;
}
.panel { border-left: 1px solid var(--line); background: var(--panel); overflow-y: auto; padding: 16px var(--gutter) 32px; }

.sea-canvas { position: absolute; pointer-events: none; }
.sea-bar {
  position: absolute; left: 12px; bottom: 28px; z-index: 2; width: min(300px, calc(100% - 24px));
  display: grid; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius);
  background: rgba(4, 12, 21, 0.82); backdrop-filter: blur(6px);
}
.sea-modes { display: flex; flex-wrap: wrap; gap: 6px; }
.sea-modes button {
  flex: 1; min-height: 36px; padding: 0 6px; border: 1px solid var(--line); border-radius: 8px;
  background: transparent; color: var(--mist); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.sea-modes button.on { border-color: var(--cyan); background: var(--cyan-soft); color: var(--cyan); }
.sea-modes .sea-only { flex: 1 0 100%; }
.sea-time { display: grid; gap: 2px; font-size: 13px; color: var(--ink); }
.sea-time input { width: 100%; margin: 0; accent-color: var(--cyan); }
.sea-legend { display: grid; gap: 2px; }
.sea-scale { display: block; height: 6px; border-radius: 3px; }
.sea-ticks { display: flex; justify-content: space-between; font-family: var(--gauge); font-size: 12px; color: var(--mist); }
.sea-source { margin: 0; font-size: 11px; color: var(--dim); }
.sea-bar.off .sea-time, .sea-bar.off .sea-legend, .sea-bar.off .sea-source { display: none; }
.sea-fold { min-height: 28px; border: none; background: transparent; color: var(--mist); font-size: 12px; cursor: pointer; }
.sea-bar.folded .sea-time, .sea-bar.folded .sea-legend, .sea-bar.folded .sea-source, .sea-bar.folded .sea-only { display: none; }
.pin-wrap { background: none; border: none; }
.pin {
  min-width: 30px; height: 30px; padding: 0 8px; border-radius: 999px;
  background: var(--cyan); color: #04202a; border: 2px solid var(--deep);
  font-family: var(--gauge); font-size: 16px; font-weight: 600; line-height: 26px;
  cursor: pointer; transform: translate(-50%, -50%);
}
.pin--empty { min-width: 14px; width: 14px; height: 14px; padding: 0; background: var(--dim); border-width: 2px; }
.pin--selected { background: var(--caution); color: #2a2100; box-shadow: 0 0 0 3px rgba(255, 211, 74, 0.35); }
/* Google の AdvancedMarker は自分で中心合わせするので、ずらしを戻す */
gmp-advanced-marker .pin { transform: none; }

.panel h2 { margin: 0; font-size: 22px; font-weight: 700; }
.panel h3 { margin: 22px 0 8px; font-size: 13px; font-weight: 500; color: var(--mist); letter-spacing: 0.04em; }
.sub { color: var(--mist); font-size: 13px; margin: 2px 0 0; }
.hint { color: var(--mist); font-size: 14px; }
.back { background: none; border: none; color: var(--cyan); padding: 0; margin-bottom: 10px; cursor: pointer; font-size: 14px; }

.shop {
  margin-top: 14px; border: 1px dashed var(--line); border-radius: var(--radius); padding: 10px 12px;
  color: var(--dim); font-size: 13px;
}
.shop b { color: var(--mist); font-weight: 500; }

.rows { list-style: none; margin: 0; padding: 0; }
.rows li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.rows li:first-child { border-top: none; }
.rows .main { flex: 1; min-width: 0; }
.rows .name { font-weight: 500; background: none; border: none; padding: 0; cursor: pointer; text-align: left; }
.rows .meta { color: var(--mist); font-size: 12px; }
.count { font-family: var(--gauge); font-size: 22px; font-weight: 600; color: var(--cyan); min-width: 28px; text-align: right; }
.saw {
  flex: none; background: var(--cyan-soft); color: var(--cyan); border: 1px solid var(--cyan);
  border-radius: 999px; padding: 4px 12px; cursor: pointer; font-size: 13px; font-weight: 500;
}
.saw:active { transform: scale(0.97); }
.link { background: none; border: none; color: var(--cyan); padding: 0; cursor: pointer; font-size: inherit; text-align: left; }

.add { display: grid; gap: 8px; margin-top: 8px; }
.add input, .add textarea {
  background: var(--deep); border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--ink); padding: 8px 10px; font: inherit; width: 100%;
}
.add textarea { min-height: 56px; resize: vertical; }
.add .primary {
  background: var(--cyan); color: #04202a; border: none; border-radius: var(--radius);
  padding: 9px 12px; font-weight: 700; cursor: pointer;
}
.error { color: var(--caution); font-size: 13px; margin: 0; }

.comment { display: block; }
.comment p { margin: 2px 0 0; overflow-wrap: anywhere; }
.sample { font-size: 11px; color: var(--caution); border: 1px solid currentColor; border-radius: 5px; padding: 0 5px; margin-left: 4px; }
.report { background: none; border: none; color: var(--dim); font-size: 12px; cursor: pointer; padding: 0; margin-left: auto; }
.foot { margin-top: 28px; color: var(--dim); font-size: 12px; }
.foot button { margin-top: 6px; }

.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 20px); transform: translateX(-50%);
  background: var(--ink); color: var(--deep); border-radius: 999px; padding: 8px 16px; font-size: 14px; font-weight: 500;
}

@media (max-width: 760px) {
  .layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: 48vh auto; }
  .panel { border-left: none; border-top: 1px solid var(--line); overflow: visible; }
  body { display: block; }
  .map-wrap { height: 48vh; }
  .sea-bar { left: 8px; bottom: 8px; width: min(260px, calc(100% - 16px)); padding: 6px 8px; gap: 4px; }
  .sea-source { font-size: 10px; }
  .account-link { order: 0; }
  .filters { order: 2; flex-basis: 100%; }
  .sea-modes button { min-height: 30px; }
}

.sea { margin-top: 18px; }
.sea-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.sea-table th { text-align: left; color: var(--mist); font-weight: 500; padding: 4px 6px 4px 0; border-bottom: 1px solid var(--line); }
.sea-table td { padding: 6px 6px 6px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.sea-table td.warn { color: var(--caution); }
.sea .meta { margin-top: 8px; font-size: 12px; color: var(--mist); }
.sea-table td:first-child { white-space: nowrap; }
.sea-table td { word-break: keep-all; }
.sea .sub.warn { color: var(--caution); }
.sea .meta a { color: var(--cyan); margin-left: 4px; }

.consent { width: min(420px, calc(100% - 32px)); padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--ink); }
.consent::backdrop { background: rgba(4, 12, 21, 0.7); }
.consent h3 { margin: 0 0 8px; font-size: 17px; }
.consent p { margin: 0 0 8px; font-size: 14px; }
.consent a { color: var(--cyan); }
.consent-actions { display: grid; gap: 8px; margin: 12px 0; }
.consent-actions button { min-height: 44px; border-radius: var(--radius); font-weight: 700; cursor: pointer; }
.consent-actions .primary { border: 1px solid var(--cyan); background: var(--cyan); color: var(--abyss); }
.consent-actions .plain { border: 1px solid var(--line); background: transparent; }

.place-mark { width: 16px; height: 16px; margin: -8px 0 0 -8px; border: 2px solid var(--abyss); border-radius: 50%; background: var(--cyan); box-shadow: 0 0 0 3px var(--cyan-soft); }
.favorite { min-height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--mist); font-size: 13px; cursor: pointer; }
.favorite[aria-pressed="true"] { border-color: var(--caution); color: var(--caution); }
.place-table { overflow-x: auto; }
.sea-table .day th { padding-top: 12px; color: var(--ink); font-weight: 700; }
.alert { padding: 10px 12px; margin-top: 10px; border: 1px solid var(--line); border-radius: var(--radius); font-size: 14px; }
.alert.warning { border-color: #ff5c6c; color: #ff8a96; }
.alert.advisory { border-color: var(--caution); color: var(--caution); }
.alert p { margin: 0; }
.alert small { display: block; margin-top: 4px; color: var(--mist); font-size: 12px; }
.alert a { color: var(--cyan); }
.typhoon { border-color: #ff5c6c; }
.typhoon button { padding: 0; border: none; background: none; color: #ff8a96; font-size: 15px; font-weight: 700; cursor: pointer; text-align: left; }

/* 見るだけの地図（view.html） */
.home-link { color: inherit; text-decoration: none; }
.home-link:hover { text-decoration: underline; }
.notes { margin: 0; padding-left: 1.2em; color: var(--mist); font-size: 13px; line-height: 1.8; }
.foot a { color: var(--cyan); }
.foot div + div { margin-top: 6px; }
/* 国土地理院の淡色地図を、色を反転して暗くする（重ねる風・波の色はそのまま） */
.dark-map .base-tiles { filter: invert(1) hue-rotate(180deg) brightness(0.8) contrast(0.9) saturate(0.55); }
.dark-map .leaflet-container { background: #0b1722; }
/* Leaflet の層（z-index 400〜）が、地図の上に置くボタンや注意書きを隠さないようにする */
.map { z-index: 0; isolation: isolate; }
