:root {
  --bg: #f7f8f9;
  --panel: #ffffff;
  --ink: #1a1d1f;
  --sub: #6f767e;
  --line: #e4e7ea;
  --accent: #0b57d0;
  --danger: #e5484d;
  font-size: 14px;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: "Hiragino Sans", "Yu Gothic UI", "Noto Sans JP", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

#topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 14px;
  background: #10243e;
  color: #fff;
}
#topbar h1 { font-size: 17px; margin: 0; letter-spacing: .5px; }
#topbar h1 .jp { color: #7cc0ff; }
.updated { font-size: 12px; color: #b8c7d9; }
.updated .warn { color: #ffb224; }
#btn-list {
  margin-left: auto;
  background: #7cc0ff; border: 0; border-radius: 6px;
  padding: 5px 12px; font-weight: 600; cursor: pointer;
}

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

#panel {
  width: 360px;
  min-width: 300px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.panel-section { padding: 8px 12px; border-bottom: 1px solid var(--line); }
.panel-section.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.section-title { font-size: 12px; font-weight: 700; color: var(--sub); margin-bottom: 6px; }
#search {
  width: 100%; padding: 7px 10px;
  border: 1px solid var(--line); border-radius: 8px; font-size: 13px;
}
label { font-size: 12px; color: var(--sub); display: inline-flex; flex-direction: column; gap: 3px; }
label.check { flex-direction: row; align-items: center; gap: 6px; color: var(--ink); }
select { padding: 5px 6px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; }
#reset {
  margin-left: auto; background: none; border: 1px solid var(--line);
  border-radius: 6px; padding: 5px 10px; cursor: pointer; color: var(--sub); font-size: 12px;
}

.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px; cursor: pointer;
  border: 1.5px solid var(--line); font-size: 12px; user-select: none;
  background: #fff; color: var(--sub);
}
.chip .dot { width: 8px; height: 8px; border-radius: 50%; }
.chip .n { font-size: 11px; opacity: .8; }
.chip.on { color: #fff; border-color: transparent; }

.list-head { display: flex; align-items: center; justify-content: space-between; }
#list-count { font-weight: 400; color: var(--sub); }
.apt-filter {
  display: inline-flex; align-items: center; gap: 6px;
  background: #e8f1fe; color: var(--accent);
  border-radius: 999px; padding: 2px 4px 2px 10px; font-size: 12px; font-weight: 600;
}
.apt-filter button { border: 0; background: none; cursor: pointer; color: var(--accent); font-size: 14px; }

#list { flex: 1; overflow-y: auto; margin: 0; padding: 0; list-style: none; }
#list li {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
#list li:hover { background: #f2f6fc; }
.li-top { display: flex; align-items: center; gap: 7px; margin-bottom: 3px; }
.badge {
  font-size: 10px; font-weight: 700; color: #fff;
  border-radius: 4px; padding: 1px 6px; white-space: nowrap;
}
.li-loc { font-weight: 700; font-size: 12.5px; }
.li-num { color: var(--sub); font-size: 11px; margin-left: auto; }
.li-summary { font-size: 13px; line-height: 1.45; }
.li-summary .dict { font-weight: 600; }
.li-time { font-size: 11px; color: var(--sub); margin-top: 3px; }
.li-time .active-now { color: #12a594; font-weight: 700; }
.li-time .future { color: #f76b15; font-weight: 700; }

#map { flex: 1; min-width: 0; }
.count-icon {
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; color: #fff; font-weight: 700; font-size: 11px;
  border: 2px solid rgba(255,255,255,.9);
  box-shadow: 0 1px 4px rgba(0,0,0,.4);
}

/* detail modal */
.modal {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(15, 23, 42, .45);
  display: flex; align-items: center; justify-content: center; padding: 18px;
}
.modal[hidden] { display: none; }
.modal-box {
  background: #fff; border-radius: 12px; max-width: 720px; width: 100%;
  max-height: 86vh; overflow-y: auto; padding: 18px 20px; position: relative;
}
.modal-close {
  position: absolute; top: 8px; right: 10px;
  border: 0; background: none; font-size: 22px; cursor: pointer; color: var(--sub);
}
.d-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.d-title { font-size: 16px; font-weight: 700; margin: 6px 0; }
.d-meta { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 12.5px; }
.d-meta th {
  text-align: left; color: var(--sub); font-weight: 600;
  padding: 4px 10px 4px 0; white-space: nowrap; vertical-align: top; width: 90px;
}
.d-meta td { padding: 4px 0; }
.d-sect { font-size: 12px; font-weight: 700; color: var(--sub); margin: 14px 0 4px; }
.d-ja {
  background: #f0f7f0; border: 1px solid #cce3cc; border-radius: 8px;
  padding: 10px 12px; font-size: 13.5px; line-height: 1.65; white-space: pre-wrap;
}
.d-ja.none { background: #f6f6f6; border-color: var(--line); color: var(--sub); }
.d-raw {
  background: #10243e; color: #d7e3f4;
  border-radius: 8px; padding: 12px; font-size: 12px; line-height: 1.55;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  white-space: pre-wrap; word-break: break-word;
}
.mt-note { font-size: 11px; color: var(--sub); margin-top: 4px; }

/* overlapping-shape picker popup */
.pick-list { max-height: 260px; overflow-y: auto; min-width: 240px; }
.pick-head { font-size: 11px; font-weight: 700; color: var(--sub); margin-bottom: 6px; }
.pick-item {
  display: flex; align-items: center; gap: 6px; width: 100%;
  border: 0; background: none; cursor: pointer; text-align: left;
  padding: 6px 4px; border-bottom: 1px solid var(--line); font-size: 12px;
}
.pick-item:hover { background: #f2f6fc; }
.pick-txt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-more { font-size: 11px; color: var(--sub); padding: 6px 4px; }

#disclaimer {
  padding: 6px 14px; font-size: 11px; color: var(--sub);
  background: #fff8e6; border-top: 1px solid #f0e2b6;
}
#disclaimer a { color: var(--accent); }

.mobile-only { display: none; }
@media (max-width: 720px) {
  .mobile-only { display: block; }
  #layout { position: relative; }
  #panel {
    position: absolute; inset: 0; z-index: 1500; width: 100%;
    transform: translateX(-102%); transition: transform .2s ease;
  }
  #panel.open { transform: none; }
  :root { font-size: 15px; }
}
