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

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f5f5;
  color: #111;
}

/* ── Header ── */
header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 0 16px;
  height: 48px;
  background: #fff;
  border-bottom: 1px solid #e8e8e8;
  position: sticky;
  top: 0;
  z-index: 10;
}

h1 { font-size: 1rem; font-weight: 700; }
#summary { font-size: 0.78rem; color: #bbb; }

/* ── Filter bar ── */
.filter-bar {
  position: sticky;
  top: 48px;
  z-index: 10;
  height: 44px;
  background: #fff;
  border-bottom: 1px solid #e8e8e8;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}
.filter-bar::-webkit-scrollbar { display: none; }

.line-filters {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 16px;
  height: 100%;
  width: max-content;
}

.filter-all {
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid #ddd;
  background: transparent;
  color: #888;
  cursor: pointer;
}
.filter-all.active { background: #111; color: #fff; border-color: #111; }

.bullet-filter {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
  background: var(--c);
  color: var(--t);
  opacity: 0.6;
  transition: opacity 0.1s, box-shadow 0.1s;
}
.bullet-filter.active { opacity: 1; box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--c); }

/* ── Main ── */
main {
  padding: 16px;
  display: grid;
  gap: 12px;
  max-width: 800px;
  margin: 0 auto;
}

input[type="search"] {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #e8e8e8;
  border-radius: 10px;
  font: inherit;
  font-size: 0.9rem;
  background: #fff;
  outline: none;
}
input[type="search"]:focus { border-color: #ccc; }

#stopList {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}

/* ── Cards ── */
.card {
  width: 100%;
  height: 110px;
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  padding: 12px;
  font: inherit;
  color: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  text-align: left;
  transition: box-shadow 0.15s;
}

.card:active { background: #fafafa; }
.card.visited { border-color: #c8e6c8; background: #f8fff8; }

.card-bullets { display: flex; flex-wrap: wrap; gap: 3px; }
.card-name {
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.3;
  flex: 1;
}
.card-meta { font-size: 0.72rem; color: #5a9a5a; font-weight: 500; }

/* ── Bullets ── */
.bullet {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 800;
  flex-shrink: 0;
}
.b-sm { width: 20px; height: 20px; font-size: 10px; }
.b-md { width: 27px; height: 27px; font-size: 13px; }

/* ── Detail sheet ── */
dialog {
  width: min(94vw, 400px);
  max-height: 85vh;
  border: none;
  border-radius: 16px;
  padding: 0;
  background: #fff;
  box-shadow: 0 4px 40px rgba(0,0,0,0.15);
  overflow: hidden;
}

dialog::backdrop { background: rgba(0,0,0,0.25); }

.sheet {
  padding: 22px 20px 20px;
  display: grid;
  gap: 11px;
  position: relative;
  overflow-y: auto;
  max-height: 85vh;
}

.close-btn {
  position: absolute;
  top: 14px; right: 14px;
  width: 26px; height: 26px;
  border-radius: 50%;
  border: none;
  background: #f2f2f2;
  color: #666;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.sheet-bullets { display: flex; flex-wrap: wrap; gap: 5px; }
.sheet h2 { font-size: 1.1rem; font-weight: 700; padding-right: 30px; }
.visit-count { font-size: 0.82rem; color: #aaa; margin-top: -4px; }

.here-btn {
  width: 100%;
  padding: 13px;
  border: none;
  border-radius: 10px;
  background: #111;
  color: #fff;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
}
.here-btn:active { background: #333; }

.section-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #ccc;
  margin-bottom: -4px;
}

.ideas-list { padding-left: 15px; display: grid; gap: 3px; }
.ideas-list li { font-size: 0.88rem; color: #333; }
.history-list { list-style: none; padding: 0; display: grid; gap: 2px; }
.history-list li { font-size: 0.82rem; color: #aaa; }

.text-btn {
  border: none; background: none;
  color: #ccc; font: inherit; font-size: 0.8rem;
  cursor: pointer; padding: 0;
}
.text-btn:hover { color: #999; }
