:root {
  --blue: #009fe3;
  --blue-dark: #0077b3;
  --amber: #e8890c;
  --green: #2e7d32;
  --dark: #111111;
  --gray: #666666;
  --line: #dddddd;
  --bg: #f4f4f4;
  --card: #ffffff;
}
* { box-sizing: border-box; }
.install-banner { display: none; text-align: center; font-size: 13px; padding: 6px 10px; background: #e6f5fc; border-bottom: 1px solid #bfe3f5; }
.install-banner a { color: #0077b6; font-weight: 600; }

/* New-version bar (gold when an update is available, neutral for info) */
.update-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  background: #ffe082; border-bottom: 1px solid #e6c200;
  padding: 8px 12px; font-size: 0.95rem;
}
.update-bar.info { background: #e6f5fc; border-bottom-color: #bfe3f5; }
.update-go {
  background: var(--amber); color: #fff; border: 0; border-radius: 999px;
  padding: 6px 14px; font-size: 0.9rem; font-weight: 700; cursor: pointer;
}

.install-page { max-width: 640px; margin: 0 auto; padding: 16px; }
.install-page .version-line { color: var(--gray); font-size: 0.9rem; margin: 0 0 12px; }
.install-page h2 { margin: 8px 0; }
.install-page h3 { margin: 18px 0 6px; }
.install-page ol { margin: 0 0 0 20px; }
.install-page li { margin-bottom: 6px; }

[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--dark);
  background: var(--bg);
  line-height: 1.45;
}
a { color: var(--blue-dark); }

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  padding: 10px 14px;
  border-bottom: 3px solid var(--blue);
}
.app-header .logo { height: 54px; width: auto; flex: none; }
.header-text h1 { font-size: 1.25rem; margin: 0; line-height: 1.15; }
.header-text p { margin: 0; color: var(--gray); font-size: 0.9rem; }
.install-btn {
  margin-left: auto;
  background: var(--blue);
  color: #fff;
  border: 0;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.9rem;
  cursor: pointer;
}

/* Tabs */
.tabs { display: flex; background: var(--card); border-bottom: 1px solid var(--line); }
.tab {
  flex: 1;
  padding: 12px 8px;
  font-size: 1rem;
  background: none;
  border: 0;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  color: var(--dark);
}
.tab.active { border-bottom-color: var(--blue); font-weight: 700; color: var(--blue-dark); }
.tab .count { color: var(--gray); font-weight: 400; font-size: 0.85rem; }

/* Controls */
.controls { padding: 10px 12px 0; }
.controls input[type="search"] {
  width: 100%;
  font-size: 1rem;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip {
  border: 1px solid var(--blue);
  background: var(--card);
  color: var(--blue-dark);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.9rem;
  cursor: pointer;
}
.chip.active { background: var(--blue); color: #fff; }

/* Layout: map on top, list below (mobile); side by side on wide screens */
main { padding: 12px; }
#mapWrap { margin-bottom: 12px; }
#map {
  height: 46vh;
  min-height: 300px;
  border-radius: 12px;
  border: 1px solid var(--line);
  z-index: 0;
}
@media (min-width: 900px) {
  main {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 16px;
    align-items: start;
    max-width: 1200px;
    margin: 0 auto;
  }
  #mapWrap { margin-bottom: 0; position: sticky; top: 12px; }
  #map { height: calc(100vh - 220px); min-height: 420px; }
}
.status { color: var(--gray); margin: 4px 2px 10px; font-size: 0.9rem; }
.status.error { color: #b00020; }

/* Numbered map pins */
.pin {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  border: 2px solid #fff;
  box-shadow: 0 1px 5px rgba(0,0,0,0.4);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
}
.pin span { transform: rotate(45deg); }
.pin-popup { background: var(--blue); }
.pin-light { background: var(--amber); }
.pin-event { background: var(--green); }
.pin.selected { outline: 3px solid var(--dark); }

/* List */
.entry-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.entry {
  display: flex;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  font: inherit;
}
.entry:hover, .entry:focus-visible { border-color: var(--blue); outline: none; }
.entry .num {
  flex: none;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  margin-top: 2px;
}
.entry.light .num { background: var(--amber); }
.entry.event .num { background: var(--green); }
.entry .entry-name { font-weight: 700; font-size: 1.05rem; }
.entry .entry-sub { color: var(--gray); font-size: 0.9rem; }
.entry .entry-dates { font-size: 0.9rem; margin-top: 2px; }
.entry .tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--amber);
  margin-top: 4px;
}
.empty { color: var(--gray); padding: 16px 4px; }

/* Detail bottom sheet */
.sheet-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1000;
}
.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 1001;
  background: var(--card);
  border-radius: 16px 16px 0 0;
  max-height: 78vh;
  overflow-y: auto;
  padding: 20px 18px calc(18px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 24px rgba(0,0,0,0.3);
}
@media (min-width: 700px) {
  .sheet { left: 50%; right: auto; transform: translateX(-50%); width: 620px; }
}
.sheet-close {
  position: sticky; top: 0;
  float: right;
  background: #eee;
  border: 0; border-radius: 50%;
  width: 32px; height: 32px;
  font-size: 1rem; cursor: pointer;
}
.sheet h2 { margin: 0 0 4px; font-size: 1.35rem; padding-right: 40px; }
.sheet h3 { margin: 18px 0 6px; font-size: 1.1rem; }
.sheet ol { margin: 0 0 0 20px; }
.sheet ol li { margin-bottom: 6px; }
.sheet .install-note { color: var(--gray); font-size: 0.9rem; }
.sheet .sheet-venue { color: var(--gray); margin: 0 0 12px; }
.sheet dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; }
.sheet dt { font-weight: 700; }
.sheet dd { margin: 0; }
.sheet .links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.sheet .links a {
  display: inline-block;
  background: var(--blue);
  color: #fff;
  text-decoration: none;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.95rem;
}
.sheet .links a.secondary { background: #eee; color: var(--dark); }

/* Footer */
.app-footer {
  display: flex; flex-wrap: wrap; gap: 4px 14px;
  align-items: baseline;
  padding: 14px;
  color: var(--gray);
  font-size: 0.85rem;
}
.offline-note { color: #b00020; }
.app-footer .footer-btn {
  background: none; border: 0; padding: 0;
  color: var(--blue-dark); font: inherit; cursor: pointer;
}

@media (max-width: 700px) {
  .install-banner { display: block; }
}

@media (display-mode: standalone) {
  .install-banner { display: none !important; }
}
