:root {
  --bg: #f6f1e7;
  --surface: #fffdf8;
  --text: #2f2a24;
  --muted: #6d6458;
  --line: #ddd3c2;
  --accent: #9a4a26;
  --accent-text: #fffdf8;
  --video: #27566b;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1f1c18;
    --surface: #2a2621;
    --text: #f1eadf;
    --muted: #b5aa9a;
    --line: #443d34;
    --accent: #e0935f;
    --accent-text: #1f1c18;
    --video: #7fb6cf;
  }
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif;
  line-height: 1.6;
}

.app {
  display: grid;
  grid-template-columns: 400px 1fr;
  height: 100dvh;
}

.map { min-width: 0; background: var(--line); }

.panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--line);
}

.panel-header {
  padding: 16px 16px 12px;
  padding-top: max(16px, env(safe-area-inset-top));
  border-bottom: 1px solid var(--line);
}

h1 {
  margin: 0 0 10px;
  font-family: "Hiragino Mincho ProN", "Noto Serif JP", serif;
  font-size: 22px;
  line-height: 1.2;
}

.filters { display: grid; gap: 6px; }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  flex: none;
  min-height: 32px;
  padding: 3px 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.chip[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-text);
}

.panel-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-bottom: env(safe-area-inset-bottom);
}

.count {
  margin: 0;
  padding: 10px 16px 4px;
  color: var(--muted);
  font-size: 13px;
}

.empty { padding: 32px 16px; color: var(--muted); text-align: center; }

.list { margin: 0; padding: 0 8px 8px; list-style: none; }

.card {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 12px;
  width: 100%;
  padding: 8px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.card:hover { background: var(--surface); }

.card img {
  width: 88px;
  height: 66px;
  border-radius: 4px;
  background: var(--line);
  object-fit: cover;
}

.card-title { display: block; font-size: 15px; font-weight: 600; line-height: 1.4; }

.card-meta { display: block; color: var(--muted); font-size: 12px; }

.badge { color: var(--accent); font-weight: 600; }

.badge.video { color: var(--video); }

.detail { padding: 12px 16px 24px; }

.back {
  min-height: 36px;
  margin-bottom: 8px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.media {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 6px;
  overflow: hidden;
  background: #000;
}

.media img { display: block; width: 100%; height: auto; }

.media.video { aspect-ratio: 16 / 9; cursor: pointer; }

.media.video img, .media.video iframe {
  width: 100%;
  height: 100%;
  border: 0;
  object-fit: cover;
}

.play {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .72);
  transform: translate(-50%, -50%);
}

.play::after {
  content: "";
  position: absolute;
  top: 19px;
  left: 25px;
  border-style: solid;
  border-width: 13px 0 13px 21px;
  border-color: transparent transparent transparent #fff;
}

.detail h2 {
  margin: 14px 0 2px;
  font-family: "Hiragino Mincho ProN", "Noto Serif JP", serif;
  font-size: 20px;
  line-height: 1.4;
}

.year { margin: 0; color: var(--accent); font-weight: 600; }

.detail h3 { margin: 16px 0 0; font-size: 16px; line-height: 1.4; }

.scenes { display: grid; gap: 2px; margin: 12px 0 0; padding: 0; list-style: none; }

.scene {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 40px;
  padding: 4px 8px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: inherit;
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}

.scene:hover { background: var(--surface); }

.scene[aria-current="true"] { background: var(--surface); font-weight: 600; }

.scene-number {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 5px;
  background: #27566b;
  color: #fff;
  font-size: 12px;
  line-height: 22px;
  text-align: center;
}

.scene-time { flex: none; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

.facts { margin: 12px 0; }

.facts dt { color: var(--muted); font-size: 12px; }

.facts dd { margin: 0 0 8px; font-size: 14px; overflow-wrap: anywhere; }

.detail a { color: var(--accent); }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.action {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 4px 14px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  font-size: 14px;
  text-decoration: none;
}

button.action {
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

button.action:disabled { opacity: .45; cursor: default; }

.edit-bar {
  padding: 8px 16px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.edit-bar p { margin: 0; font-size: 13px; font-weight: 600; }

.edit-bar .actions { margin-top: 6px; }

.edit-form { display: grid; gap: 4px; margin: 12px 0; font-size: 14px; }

.edit-form p { margin: 0; }

.edit-form label { margin-top: 8px; color: var(--muted); font-size: 12px; }

.edit-form select, .edit-form textarea {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 16px;
}

.estimate-tag {
  flex: none;
  display: inline-block;
  padding: 0 6px;
  border: 1px solid var(--accent);
  border-radius: 4px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  line-height: 18px;
}

.action.primary { background: var(--accent); color: var(--accent-text); }

.form-target { margin: 2px 0 8px; color: var(--accent); font-weight: 600; }

.report-form { display: grid; gap: 4px; font-size: 14px; }

.report-form > label, .report-form legend { margin-top: 8px; color: var(--muted); font-size: 12px; }

.report-form input[type="url"], .report-form textarea, .admin-form input:not([type]), .admin-form input[type="url"], .admin-form input[type="password"], .admin-form textarea, .admin-form select {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 16px;
}

.report-form fieldset { margin: 0; padding: 0; border: 0; }

.choice { display: flex; align-items: center; gap: 8px; min-height: 36px; font-size: 14px; }

.form-note { margin: 8px 0 0; color: var(--muted); font-size: 12px; }

.form-message { margin: 8px 0 0; color: var(--accent); font-weight: 600; }

.pin.proposal {
  width: 30px;
  height: 30px;
  border: 3px solid #fff;
  background: #f2b705;
  box-shadow: 0 1px 6px rgba(0, 0, 0, .6);
  cursor: grab;
}

.pin.current {
  width: 24px;
  height: 24px;
  background: #9a4a26;
}

.report-card { grid-template-columns: 1fr; }

.admin-photo { display: block; width: 100%; height: auto; border-radius: 4px; }

.admin-form { display: grid; gap: 4px; margin-top: 12px; font-size: 14px; }

.admin-form > label { margin-top: 8px; color: var(--muted); font-size: 12px; }

.admin-form > label.choice { color: inherit; font-size: 14px; }

.pin {
  display: block;
  width: 26px;
  height: 26px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #9a4a26;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .45);
  color: #fff;
  font-size: 12px;
  line-height: 22px;
  text-align: center;
}

.pin.video { border-radius: 6px; background: #27566b; }

.pin.approx { border-style: dashed; }

.pin.active { outline: 3px solid #f2b705; transform: scale(1.25); }

.site-links { display: flex; gap: 16px; margin: 0; padding: 8px 16px 16px; font-size: 12px; }

.site-links a, .form-note a { color: var(--accent); }

.legal { max-width: 720px; margin: 0 auto; padding: 24px 16px 48px; }

.legal h1 { display: block; margin-bottom: 4px; }

.legal h2 { margin: 28px 0 4px; font-size: 17px; line-height: 1.4; }

.legal p, .legal li { font-size: 15px; }

.legal p { margin: 8px 0; }

.legal ul { margin: 8px 0; padding-left: 20px; }

.legal a { color: var(--accent); }

.legal .updated { color: var(--muted); font-size: 13px; }

@media (max-width: 767px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: 42dvh 1fr;
  }

  .map { grid-row: 1; }

  .panel { grid-row: 2; min-height: 0; border-right: 0; border-top: 1px solid var(--line); }

  .panel-header { padding: 10px 16px 8px; }

  h1 { display: none; }

  .chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .chips::-webkit-scrollbar { display: none; }
}

.site-intro { padding: 16px 16px 0; font-size: 13px; color: var(--muted); }

.site-intro p { margin: 0 0 8px; }

.place-links { display: flex; flex-wrap: wrap; gap: 4px 12px; }

.place-links a { color: var(--accent); }

.page-breadcrumb { color: var(--muted); font-size: 13px; }

.page-figure { display: block; margin: 12px 0; }

.page-figure img { display: block; width: 100%; height: auto; border-radius: 6px; background: var(--line); }

.legal .page-list { margin: 16px 0; padding: 0; list-style: none; }

.page-list a { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }

.page-list img { flex: none; width: 96px; height: 72px; object-fit: cover; border-radius: 4px; background: var(--line); }

.page-list strong { display: block; color: var(--accent); }

.page-list small { display: block; color: var(--muted); font-size: 12px; }

.page-footer { flex-wrap: wrap; margin-top: 32px; padding: 16px 0 0; border-top: 1px solid var(--line); }

.legal .page-caption { margin-top: -4px; color: var(--muted); font-size: 12px; }
