:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --text: #24211d;
  --muted: #6f6a62;
  --border: #e2ddd3;
  --accent: #b4532a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, 'Hiragino Sans', 'Noto Sans JP', sans-serif;
  line-height: 1.7;
}

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

.site-header,
.site-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.site-footer {
  border-top: 1px solid var(--border);
  border-bottom: none;
  color: var(--muted);
  font-size: 0.875rem;
}

.site-header nav,
.site-footer nav {
  display: flex;
  gap: 16px;
}

.site-name {
  font-weight: 700;
  font-size: 1.25rem;
  text-decoration: none;
}

main {
  max-width: 760px;
  margin: 0 auto;
  padding: 16px;
}

main.wide {
  max-width: none;
  padding: 0;
}

h1 {
  font-size: 1.5rem;
  line-height: 1.3;
}

h1 small {
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--muted);
}

h2 {
  margin-top: 2em;
  font-size: 1.125rem;
  border-bottom: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

tr.changed td {
  background: #fdf1d8;
}

dl {
  display: grid;
  grid-template-columns: 6em 1fr;
  gap: 4px 12px;
}

dt {
  color: var(--muted);
}

dd {
  margin: 0;
}

.pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.meta {
  color: var(--muted);
  font-size: 0.875rem;
}

.flash,
.memorial {
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
}

.memorial-mark {
  color: var(--muted);
}

.stack {
  display: grid;
  gap: 12px;
  margin: 16px 0;
}

.stack label {
  display: grid;
  gap: 4px;
}

.stack label:has(input[type='checkbox']) {
  display: block;
}

input:not([type='checkbox']),
select,
textarea {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  font: inherit;
}

button {
  padding: 8px 16px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  cursor: pointer;
}

.stack button {
  justify-self: start;
}

form.inline {
  display: inline-block;
  margin-right: 8px;
}

.card,
.comment {
  margin: 12px 0;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.comment p {
  margin: 0;
}

/* 動物園マップ */
.map-page {
  display: grid;
  grid-template-columns: 320px 1fr;
  height: calc(100vh - 56px);
  min-height: 420px;
}

.map-panel {
  padding: 12px 16px;
  overflow-y: auto;
  background: var(--surface);
  border-right: 1px solid var(--border);
}

.map-panel h1 {
  margin: 0 0 12px;
  font-size: 1.125rem;
}

#map {
  min-height: 0;
}

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

.chips button {
  padding: 4px 12px;
  border-color: var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.875rem;
}

.chips button.active {
  border-color: var(--text);
  background: var(--text);
  color: #fff;
}

#map-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

#map-list li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

#map-list li:hover {
  background: var(--bg);
}

#map-list .count {
  font-weight: 700;
  white-space: nowrap;
}

.map-marker {
  padding: 2px 8px;
  border: 1px solid var(--text);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

@media (max-width: 720px) {
  .map-page {
    grid-template-columns: 1fr;
    grid-template-rows: 55vh auto;
    height: auto;
  }

  #map {
    grid-row: 1;
  }

  .map-panel {
    border-right: none;
    border-top: 1px solid var(--border);
  }
}
