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

:root {
  --green: #2e7d32;
  --green-dark: #1b5e20;
  --green-light: #e8f5e9;
  --amber: #ff8f00;
  --gray: #666;
  --border: #ddd;
}

html, body { height: 100%; }

body {
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic UI", Meiryo, sans-serif;
  display: flex;
  flex-direction: column;
  color: #222;
}

#header {
  background: var(--green);
  color: #fff;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

#header h1 { font-size: 18px; }

#progress { font-size: 13px; text-align: right; }

#progress-bar {
  width: 200px;
  height: 6px;
  background: rgba(255,255,255,.3);
  border-radius: 3px;
  margin-top: 4px;
}

#progress-fill {
  height: 100%;
  width: 0;
  background: #ffd54f;
  border-radius: 3px;
  transition: width .3s;
}

#main { flex: 1; display: flex; min-height: 0; }

#sidebar {
  width: 320px;
  min-width: 320px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: #fafafa;
}

#filters { padding: 10px; border-bottom: 1px solid var(--border); }

#search, #pref-select, #visited-filter {
  width: 100%;
  padding: 7px 10px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  background: #fff;
}

#facility-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
}

.facility-chip {
  font-size: 11px;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  user-select: none;
}

.facility-chip.active {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}

#data-tools { display: flex; gap: 6px; margin-bottom: 8px; }

#data-tools button {
  flex: 1;
  padding: 6px 8px;
  font-size: 12px;
  border: 1px solid var(--green);
  border-radius: 6px;
  background: #fff;
  color: var(--green-dark);
  cursor: pointer;
}

#data-tools button:hover { background: var(--green-light); }

#result-count { font-size: 12px; color: var(--gray); }

#station-list {
  flex: 1;
  overflow-y: auto;
  list-style: none;
}

#station-list li {
  padding: 8px 12px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}

#station-list li:hover { background: var(--green-light); }

#station-list li .visited-mark { font-size: 14px; }

#station-list li .st-name { font-weight: 600; }

#station-list li .st-memo { font-size: 11px; }

#station-list li .st-nocoord {
  font-size: 10px;
  color: #c62828;
  border: 1px solid #ef9a9a;
  border-radius: 8px;
  padding: 0 4px;
  margin-left: 4px;
}

#station-list li .st-loc { color: var(--gray); font-size: 11px; }

#map { flex: 1; }

.locate-btn { font-size: 16px; text-align: center; }

#detail {
  position: absolute;
  top: 70px;
  right: 16px;
  width: 320px;
  max-height: calc(100% - 140px);
  overflow-y: auto;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,.25);
  z-index: 1000;
  padding: 16px;
}

#detail.hidden { display: none; }

#detail-close {
  position: absolute;
  top: 8px;
  right: 10px;
  border: none;
  background: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--gray);
}

#detail h2 { font-size: 17px; color: var(--green-dark); margin-bottom: 2px; }

#detail .d-loc { font-size: 12px; color: var(--gray); margin-bottom: 10px; }

#detail .d-facilities {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 10px 0;
}

#detail .d-facility {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 12px;
  background: var(--green-light);
  color: var(--green-dark);
}

#detail .d-note { font-size: 12px; color: #888; }

#detail .d-warn {
  font-size: 12px;
  color: #b26a00;
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: 6px;
  padding: 6px 8px;
  margin: 8px 0;
}

.memo-label {
  display: block;
  margin-top: 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--green-dark);
}

.memo-input {
  display: block;
  width: 100%;
  min-height: 80px;
  margin-top: 6px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: normal;
  resize: vertical;
  box-sizing: border-box;
}

.memo-input:focus { outline: 2px solid var(--green-light); border-color: var(--green); }

#detail .d-links { margin-top: 10px; font-size: 13px; }

#detail .d-links a {
  display: block;
  color: var(--green-dark);
  margin-bottom: 4px;
}

.visit-btn {
  width: 100%;
  padding: 8px;
  margin-top: 12px;
  border: 2px solid var(--green);
  border-radius: 8px;
  background: #fff;
  color: var(--green);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.visit-btn.visited {
  background: var(--green);
  color: #fff;
}

#footer {
  font-size: 11px;
  color: var(--gray);
  padding: 4px 12px;
  background: #f0f0f0;
  border-top: 1px solid var(--border);
}

.station-marker-visited { filter: hue-rotate(280deg); }

@media (max-width: 700px) {
  #main { flex-direction: column; }
  #sidebar { width: 100%; min-width: 0; max-height: 45%; }
  #detail { width: calc(100% - 32px); }
}
