:root {
  --ink: #1c241c;
  --mute: #5c675c;
  --paper: #fff;
  --green: #3d7a22;
  --line: rgba(28, 36, 28, 0.12);
  --safe: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --bar: 58px;
  --gap: 10px;
  --shadow: 0 8px 24px rgba(28, 36, 28, 0.14);
}

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

html, body, #map { height: 100%; width: 100%; }

body.hub2 {
  font-family: "DM Sans", system-ui, sans-serif;
  color: var(--ink);
  overflow: hidden;
  background: #d9e2d4;
  -webkit-tap-highlight-color: transparent;
}

#map { z-index: 1; }

.leaflet-control-zoom,
.leaflet-control-attribution { display: none !important; }

.hub2-bar {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  pointer-events: none;
}

.hub2-bar > * { pointer-events: auto; }

.hub2-bar-top {
  top: var(--safe-top);
  height: calc(var(--bar) + 8px);
  padding-top: 8px;
}

.hub2-bar-bot {
  bottom: var(--safe);
  height: calc(var(--bar) + 8px);
  padding-bottom: 8px;
}

.hub2-icon {
  width: var(--bar);
  height: var(--bar);
  flex-shrink: 0;
  border: 0;
  border-radius: 18px;
  background: var(--green);
  box-shadow: var(--shadow);
  font: 800 11px/1.15 "DM Sans", system-ui, sans-serif;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4px;
  text-decoration: none;
}

.hub2-icon[data-menu="hub"] { background: #3d7a22; }
.hub2-icon[data-menu="map"] { background: #1f6f8a; }
.hub2-icon#hub2FindBtn { background: #f5b301; color: #1a1a1a; }
.hub2-icon[data-menu="more"] { background: #3d4a7a; }

.hub2-icon.is-on {
  box-shadow: 0 0 0 3px #f5b301, var(--shadow);
  filter: brightness(1.08);
}

@keyframes hub2Flash {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.hub2-flash {
  animation: hub2Flash 1.15s ease-in-out infinite;
  background: #1c241c !important;
  color: #fff !important;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.hub2-council-hud {
  position: fixed;
  left: 50%;
  top: calc(var(--safe-top) + var(--bar) + 18px);
  transform: translateX(-50%);
  z-index: 22;
  background: var(--paper);
  color: var(--ink);
  font: 800 13px "DM Sans", system-ui, sans-serif;
  padding: 8px 14px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  max-width: min(90vw, 360px);
  text-align: center;
  pointer-events: none;
}

.hub2-search {
  flex: 1;
  min-width: 0;
  height: var(--bar);
  display: flex;
  background: var(--paper);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.hub2-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  font: 600 16px/1.2 "DM Sans", system-ui, sans-serif;
  padding: 0 14px;
  outline: none;
  color: var(--ink);
  text-align: center;
}

.hub2-search button {
  width: 52px;
  border: 0;
  background: var(--green);
  font: 800 13px "DM Sans", system-ui, sans-serif;
  color: #fff;
  cursor: pointer;
}

.hub2-add {
  flex: 1;
  min-width: 0;
  height: var(--bar);
  border: 0;
  border-radius: 18px;
  background: var(--green);
  color: #fff;
  font: 800 15px "DM Sans", system-ui, sans-serif;
  box-shadow: var(--shadow);
  cursor: pointer;
}

.hub2-add.is-on { background: #1c241c; }

.hub2-util {
  flex: 1;
  min-width: 0;
  height: var(--bar);
  display: flex;
  background: var(--green);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.hub2-util-go {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: #fff;
  font: 800 15px "DM Sans", system-ui, sans-serif;
  cursor: pointer;
}

.hub2-util-plus {
  width: 52px;
  border: 0;
  border-left: 1px solid rgba(255,255,255,0.28);
  background: transparent;
  color: #fff;
  font: 800 22px/1 "DM Sans", system-ui, sans-serif;
  cursor: pointer;
}

.hub2-util.is-on {
  background: #1c241c;
}

.hub2-chat-log {
  flex: 1;
  min-height: 140px;
  overflow: auto;
  margin: 8px 0;
}

.hub2-chat-item .who {
  display: block;
  font-size: 12px;
  color: var(--mute);
  font-weight: 700;
  margin-bottom: 2px;
}

.hub2-chat-item button {
  margin-top: 6px;
  border: 0;
  background: #eef3ea;
  border-radius: 999px;
  padding: 6px 10px;
  font: 800 12px "DM Sans", system-ui, sans-serif;
  cursor: pointer;
}

.hub2-people {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}

.hub2-people button {
  border: 0;
  background: #eef3ea;
  border-radius: 999px;
  padding: 6px 10px;
  font: 700 12px "DM Sans", system-ui, sans-serif;
  cursor: pointer;
}

.hub2-people button.is-on {
  background: var(--green);
  color: #fff;
}

.hub2-compose {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.hub2-compose input {
  flex: 1;
  min-width: 0;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 10px;
  font: 500 15px "DM Sans", system-ui, sans-serif;
}

.hub2-name {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 10px;
  font: 500 15px "DM Sans", system-ui, sans-serif;
  margin-bottom: 8px;
}

.hub2-stage {
  position: fixed;
  left: 10px;
  right: 10px;
  top: calc(var(--safe-top) + var(--bar) + 16px);
  bottom: calc(var(--safe) + var(--bar) + 16px);
  z-index: 30;
  background: var(--paper);
  border-radius: 20px;
  box-shadow: var(--shadow);
  overflow: auto;
  padding: 18px 16px 24px;
  display: none;
  -webkit-overflow-scrolling: touch;
}

body.hub2-m-hub .hub2-stage[data-panel="hub"],
body.hub2-m-map .hub2-stage[data-panel="map"],
body.hub2-m-more .hub2-stage[data-panel="more"],
body.hub2-m-util .hub2-stage[data-panel="util"],
body.hub2-m-chat .hub2-stage[data-panel="chat"],
body.hub2-m-helper .hub2-stage[data-panel="helper"],
body.hub2-m-comments .hub2-stage[data-panel="comments"],
body.hub2-m-brief .hub2-stage[data-panel="brief"],
body.hub2-m-marker .hub2-stage[data-panel="marker"],
body.hub2-open .hub2-stage[data-panel="lane"] {
  display: block;
}

body.hub2-open .hub2-stage[data-panel="lane"] {
  top: auto;
  bottom: calc(var(--safe) + var(--bar) + 22px);
  z-index: 45;
  max-height: min(62vh, 440px);
  overflow: auto;
  padding: 18px 16px 16px;
}

body.hub2-m-chat .hub2-stage[data-panel="chat"],
body.hub2-m-helper .hub2-stage[data-panel="helper"] {
  display: flex;
  flex-direction: column;
}

.hub2-h {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 6px;
}

.hub2-sub { color: var(--mute); font-size: 14px; margin-bottom: 16px; }

.hub2-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  font-weight: 700;
}

.hub2-row button,
.hub2-act {
  border: 0;
  background: #eef3ea;
  border-radius: 999px;
  padding: 8px 14px;
  font: 800 13px "DM Sans", system-ui, sans-serif;
  cursor: pointer;
  color: var(--ink);
}

.hub2-row button.is-on {
  background: var(--green);
  color: #fff;
}

.hub2-act {
  display: block;
  width: 100%;
  text-align: center;
  text-decoration: none;
  padding: 14px;
  border-radius: 14px;
  margin-top: 8px;
}

.hub2-act-go {
  background: var(--green);
  color: #fff;
}

.hub2-danger {
  background: #9b1c1c;
  color: #fff;
}

.hub2-pin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  font-size: 13px;
  font-weight: 700;
}

.hub2-pin-row button {
  flex-shrink: 0;
  border: 0;
  background: #9b1c1c;
  color: #fff;
  border-radius: 999px;
  padding: 8px 12px;
  font: 800 12px "DM Sans", system-ui, sans-serif;
  cursor: pointer;
}

.hub2-bases {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.hub2-bases button {
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font: 800 13px "DM Sans", system-ui, sans-serif;
  cursor: pointer;
}

.hub2-bases button.is-on {
  border-color: var(--green);
  background: #eef3ea;
  color: var(--green);
}

.hub2-player {
  position: fixed;
  left: 50%;
  right: auto;
  width: min(430px, calc(100vw - 20px));
  transform: translateX(-50%);
  top: calc(var(--safe-top) + var(--bar) + 8px);
  bottom: calc(var(--safe) + var(--bar) + 8px);
  z-index: 42;
  height: auto;
  min-height: 0;
  background: #111;
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
  display: none;
  flex-direction: column;
}
body.hub2-player-on.hub2-open .hub2-player {
  bottom: calc(var(--safe) + var(--bar) + 210px);
}
body.hub2-player-on.hub2-open.hub2-player-vid .hub2-player {
  bottom: calc(var(--safe) + var(--bar) + 72px);
  height: auto;
  max-height: none;
}
body.hub2-player-on .hub2-player { display: flex; }
body.hub2-player-on.hub2-open .hub2-stage[data-panel="lane"] {
  max-height: 200px;
  padding: 12px 14px 12px;
}
body.hub2-player-on.hub2-open.hub2-player-vid .hub2-stage[data-panel="lane"] {
  max-height: 58px;
  padding: 10px 44px 10px 14px;
  overflow: hidden;
}
body.hub2-player-vid .hub2-stage[data-panel="lane"] .hub2-lane-btn,
body.hub2-player-vid .hub2-stage[data-panel="lane"] .hub2-act,
body.hub2-player-vid .hub2-stage[data-panel="lane"] .hub2-sub,
body.hub2-player-vid .hub2-stage[data-panel="lane"] .hub2-kind,
body.hub2-player-vid .hub2-stage[data-panel="lane"] .hub2-comments,
body.hub2-player-vid .hub2-stage[data-panel="lane"] #hub2BriefOut {
  display: none !important;
}
body.hub2-player-vid .hub2-stage[data-panel="lane"] .hub2-title {
  font-size: 1.15rem;
  margin: 0;
}
#hub2PlayerMap {
  flex: 1 1 auto;
  min-height: 240px;
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
#hub2VidPlay[hidden] {
  display: none !important;
}
body.hub2-player-vid #hub2PlayerMap { display: none !important; }
body.hub2-player-vid #hub2VidPlay {
  display: block !important;
  position: relative;
  flex: 1 1 0;
  width: 100%;
  min-height: 180px;
  margin: 0;
  background: #000;
}
body.hub2-player-vid #hub2VidList,
body.hub2-player-vid #hub2VidForm,
body.hub2-player-vid .hub2-fly-note {
  display: none !important;
}
body.hub2-player-vid #hub2VidPlay iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  display: block;
}
.hub2-player-dock {
  background: #fff;
  padding: 8px 10px 10px;
  flex: 0 0 auto;
  max-height: 148px;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
body.hub2-player-vid .hub2-player-dock {
  flex: 0 0 auto;
  max-height: none;
  overflow: hidden;
}
#hub2VidList {
  min-height: 0;
}
body:not(.hub2-sos) #hub2SosMsg,
body:not(.hub2-sos) #hub2SosOff {
  display: none !important;
}
.hub2-vid-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 0;
  background: #eef3ea;
  border-radius: 10px;
  padding: 8px;
  margin-bottom: 6px;
  text-align: left;
  cursor: pointer;
  font: 700 13px "DM Sans", system-ui, sans-serif;
}
.hub2-vid-item img {
  width: 64px;
  height: 40px;
  object-fit: cover;
  border-radius: 6px;
  background: #ddd;
}
#hub2VidPlay {
  margin-bottom: 8px;
}
#hub2VidPlay iframe {
  width: 100%;
  height: 160px;
  border: 0;
  border-radius: 10px;
}
.hub2-fly {
  background: #eef3ea;
  border-radius: 14px;
  padding: 10px;
  margin: 0 0 10px;
}
.hub2-fly-note {
  font-size: 12px;
  color: var(--mute);
  margin: 0 0 8px;
  line-height: 1.35;
}
.hub2-fly-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.hub2-fly-row button {
  border: 0;
  background: #fff;
  border-radius: 10px;
  padding: 8px 4px;
  font: 800 12px "DM Sans", system-ui, sans-serif;
  cursor: pointer;
  color: var(--ink);
}
.hub2-fly-row button.is-on {
  background: var(--green);
  color: #fff;
}
.hub2-kind {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--green);
}

.hub2-title {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 4px 0 10px;
}

.hub2-nav-row { display: flex; gap: 8px; margin: 12px 0 16px; }

.hub2-go, .hub2-ghost {
  flex: 1;
  height: 48px;
  border: 0;
  border-radius: 14px;
  font: 800 15px "DM Sans", system-ui, sans-serif;
  cursor: pointer;
}

.hub2-go { background: var(--green); color: #fff; }
.hub2-ghost { background: #eef3ea; }

.hub2-comments { list-style: none; }
.hub2-comments li {
  padding: 10px 0;
  border-top: 1px solid var(--line);
  font-size: 14px;
  line-height: 1.45;
}

.hub2-comments .who {
  display: block;
  font-size: 12px;
  color: var(--mute);
  font-weight: 700;
  margin-bottom: 4px;
}

.hub2-empty { color: var(--mute); font-size: 14px; padding: 4px 0 12px; }

#hub2-comment {
  width: 100%;
  min-height: 70px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  font: 400 15px "DM Sans", system-ui, sans-serif;
  margin: 8px 0;
}

.hub2-toast {
  position: fixed;
  left: 50%;
  top: calc(var(--safe-top) + var(--bar) + 20px);
  transform: translateX(-50%);
  z-index: 50;
  background: var(--ink);
  color: #fff;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  display: none;
  max-width: min(92vw, 360px);
}

.hub2-toast.is-on { display: block; }

.hub2-busy {
  position: fixed;
  inset: 0;
  z-index: 45;
  background: rgba(28, 36, 28, 0.28);
  display: none;
  align-items: center;
  justify-content: center;
}

.hub2-busy.is-on { display: flex; }

.hub2-busy span {
  background: #fff;
  padding: 14px 22px;
  border-radius: 14px;
  font-weight: 800;
  box-shadow: var(--shadow);
}

.hub2-legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 12px;
}
.hub2-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
}
.hub2-dot.boat { background: #e74c3c; }
.hub2-dot.ucr { background: #2980b9; }
.hub2-dot.pin { background: #3d7a22; }
.hub2-tip {
  background: #eef3ea;
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.45;
  margin-bottom: 12px;
}
.hub2-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 10px 0 12px;
}
.hub2-grid button {
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: #eef3ea;
  font: 800 13px "DM Sans", system-ui, sans-serif;
  cursor: pointer;
}
.hub2-kit {
  list-style: none;
  margin: 8px 0 0;
}
.hub2-kit li {
  padding: 10px 0;
  border-top: 1px solid var(--line);
  font-size: 14px;
  line-height: 1.45;
}

.hub2-pop { }
.hub2-x {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  color: #6b7280;
}
.hub2-title { padding-right: 36px; }
.hub2-lane-btn {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 14px;
  margin-top: 8px;
  font: 800 15px "DM Sans", system-ui, sans-serif;
  cursor: pointer;
  color: #fff;
}
.hub2-lane-dark { background: #3d6b1e; }
.hub2-lane-mid { background: #4f8a28; }
.hub2-lane-go { background: #5fa832; }
.hub2-check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  margin-bottom: 8px;
  background: #f4f4f5;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
}
.hub2-check input { width: 18px; height: 18px; }
.hub2-check span { flex: 1; }
.hub2-check-tro { background: #fff7ed; border-color: #fdba74; color: #9a3412; }
.hub2-check-tro em { font-style: normal; font-size: 12px; }
.hub2-line {
  width: 30px;
  height: 4px;
  border-radius: 2px;
}
.hub2-line.boat { background: #e74c3c; }
.hub2-line.ucr { background: #2980b9; }
.hub2-tro-help {
  font-size: 12px;
  color: #9a3412;
  line-height: 1.45;
  margin: -2px 0 12px 4px;
}
.hub2-switch {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 2px solid var(--line);
  background: #f7f8f6;
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 8px;
  font: 800 15px "DM Sans", system-ui, sans-serif;
  cursor: pointer;
  text-align: left;
  color: var(--ink);
}
.hub2-switch span { flex: 1; }
.hub2-switch-ico { flex: none; font-size: 22px; width: 28px; text-align: center; }
.hub2-svc {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #2d4a16;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hub2-svc svg { width: 16px; height: 16px; }
.hub2-switch i {
  flex: none;
  width: 46px;
  height: 26px;
  border-radius: 13px;
  background: #d5dad2;
  position: relative;
}
.hub2-switch i::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
}
.hub2-switch.is-on i { background: var(--green); }
.hub2-switch.is-on i::after { left: 23px; }
.hub2-sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.hub2-sheet-close {
  border: 0;
  border-radius: 12px;
  padding: 8px 12px;
  cursor: pointer;
  flex-shrink: 0;
}
.hub2-label {
  display: block;
  font-size: 13px;
  font-weight: 800;
  margin: 8px 0 4px;
}
.hub2-select, #hub2MarkerDesc {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  font: 500 15px "DM Sans", system-ui, sans-serif;
  margin-bottom: 8px;
}
#hub2MarkerDesc { min-height: 90px; }
.hub2-comment-list { margin-bottom: 12px; }
.hub2-comment-list p { font-size: 14px; padding: 10px 0; border-top: 1px solid var(--line); }
.hub2-wx-card {
  background: #eef3ea;
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 10px;
  font-weight: 800;
}
.hub2-wx-card div + div { font-weight: 600; color: var(--mute); font-size: 13px; margin-top: 2px; }
.hub2-brief-chips { display: flex; gap: 8px; margin: 10px 0; }
.hub2-brief-chips button {
  flex: 1;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 10px 6px;
  font: 800 12px "DM Sans", system-ui, sans-serif;
  cursor: pointer;
}
.hub2-brief-sheet { background: #eef3ea; border-radius: 14px; padding: 12px 14px; font-size: 14px; line-height: 1.45; margin-bottom: 8px; }
.hub2-brief-sheet ul { margin: 8px 0 0 18px; }
.hub2-foot { font-size: 12px; color: var(--mute); margin-top: 10px; }
.hub2-emoji {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 8px 0 12px;
}
.hub2-emoji button {
  border: 2px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 10px 6px;
  font: 700 11px "DM Sans", system-ui, sans-serif;
  cursor: pointer;
}
.hub2-emoji button span { display: block; font-size: 22px; margin-bottom: 4px; }
.hub2-emoji button.is-on { border-color: var(--green); background: #eef3ea; }
.hub2-custom-pin { background: none !important; border: none !important; }
.hub2-sos-mark { background: none !important; border: none !important; }
.hub2-sos-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #dc2626;
  border: 3px solid #fff;
  box-shadow: 0 0 0 10px rgba(220, 38, 38, 0.28);
  animation: hub2SosPulse 1s ease-in-out infinite;
}
@keyframes hub2SosPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.55; }
}

@media (min-width: 800px) {
  .hub2-bar-top,
  .hub2-bar-bot {
    left: 50%;
    width: min(430px, calc(100vw - 24px));
    transform: translateX(-50%);
    padding-left: 0;
    padding-right: 0;
  }

  .hub2-stage {
    left: 50%;
    right: auto;
    width: min(430px, calc(100vw - 24px));
    transform: translateX(-50%);
  }
}
