:root {
  --bg: #050b14;
  --panel: #101b2d;
  --panel-2: #17243a;
  --text: #f5f7fb;
  --muted: #a9b7ce;
  --line: rgba(255,255,255,.12);
  --accent: #ff8a8a;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
button, input { font: inherit; }
.app-shell {
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr) minmax(300px, 360px);
  min-height: 100vh;
}
.panel {
  background: linear-gradient(180deg, var(--panel), #0c1525 72%, #08111f);
  padding: 20px;
  overflow: auto;
  z-index: 1000;
}
.panel-left {
  border-right: 1px solid var(--line);
}
.panel-right {
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.brand-block { border-bottom: 1px solid var(--line); padding-bottom: 18px; margin-bottom: 16px; }
.group-logo { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 18px; border: 1px solid rgba(255,255,255,.18); box-shadow: 0 14px 45px rgba(0,0,0,.42); margin-bottom: 16px; }
.eyebrow { color: var(--accent); text-transform: uppercase; letter-spacing: .16em; font-size: 12px; font-weight: 800; }
h1 { font-size: 30px; line-height: 1.05; margin: 8px 0 12px; }
p { color: var(--muted); line-height: 1.5; margin: 0; }
.server-time-card { border: 1px solid rgba(255,138,138,.26); background: radial-gradient(circle at 30% 20%, rgba(255,73,73,.18), rgba(255,255,255,.055) 58%, rgba(255,255,255,.035)); border-radius: 22px; padding: 18px; margin: 16px 0; box-shadow: 0 16px 45px rgba(0,0,0,.24); }
.server-time-label { text-transform: uppercase; letter-spacing: .12em; color: var(--accent); font-size: 12px; font-weight: 900; }
.server-time-value { font-size: clamp(42px, 7vw, 62px); line-height: .95; font-weight: 950; letter-spacing: -.055em; margin-top: 8px; font-variant-numeric: tabular-nums; }
.server-date-value { color: var(--muted); font-weight: 800; margin-top: 8px; }
.event-planner { background: rgba(255,255,255,.05); border: 1px solid var(--line); border-radius: 18px; padding: 16px; margin: 18px 0; }
.planner-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.planner-header h2 { font-size: 16px; margin: 0 0 4px; }
.planner-header p { font-size: 12px; }
.planner-header strong { color: #ffd166; font-size: 20px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.event-slider { width: 100%; accent-color: #ff4d4d; }
.planner-scale { display: flex; justify-content: space-between; color: var(--muted); font-size: 10px; margin-top: 5px; }
.planner-number { margin: 14px 0; padding: 13px; border-radius: 16px; background: rgba(255,138,138,.09); border: 1px solid rgba(255,138,138,.18); }
.planner-number strong { display: block; font-size: 34px; line-height: 1; color: #ffd166; }
.planner-number span { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; font-weight: 800; }
.planner-lists { display: grid; grid-template-columns: 1fr; gap: 12px; }
.planner-lists h3 { margin: 0 0 7px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.planner-lists ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 5px; max-height: 112px; overflow: auto; }
.planner-lists li { color: var(--text); background: rgba(255,255,255,.045); border: 1px solid rgba(255,255,255,.08); border-radius: 9px; padding: 7px 8px; font-size: 12px; line-height: 1.25; }
.planner-lists li span { color: var(--muted); display: block; margin-top: 2px; }
.control-block { margin: 18px 0; }
.control-block label, .label-row span { color: var(--muted); display: block; font-size: 13px; font-weight: 800; margin-bottom: 8px; text-transform: uppercase; letter-spacing: .07em; }
input[type="search"] { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); outline: none; }
input[type="search"]:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 138, 138, .12); }
.rank-filter { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.rank-filter .label-row { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; }
.rank-filter label { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 9px 10px; text-transform: none; letter-spacing: 0; font-weight: 700; display: flex; gap: 8px; align-items: center; margin: 0; color: var(--text); }
button { border: 1px solid var(--line); background: rgba(23,36,58,.92); color: var(--text); border-radius: 999px; padding: 8px 12px; cursor: pointer; box-shadow: 0 10px 30px rgba(0,0,0,.18); }
button:hover { border-color: var(--accent); }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 20px 0; }
.stats-grid div { background: rgba(255,255,255,.06); border: 1px solid var(--line); padding: 12px; border-radius: 16px; }
.stats-grid strong { display: block; font-size: 22px; color: var(--accent); }
.stats-grid span { color: var(--muted); font-size: 12px; }
.details-panel { background: rgba(255,255,255,.05); border: 1px solid var(--line); border-radius: 18px; padding: 16px; margin: 18px 0; }
.details-panel.expanded { min-height: 340px; }
.details-panel h2 { margin: 0 0 6px; font-size: 19px; }
.detail-meta { display: grid; gap: 6px; color: var(--muted); margin: 10px 0 14px; }
.player-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; max-height: 58vh; overflow: auto; }
.player-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.player-topline { display: flex; justify-content: space-between; gap: 8px; font-weight: 850; }
.player-meta { color: var(--muted); font-size: 13px; margin-top: 3px; }
.legend { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 16px; }
.legend h2 { font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; margin: 0 0 10px; }
.legend div.legend-item { display: flex; align-items: center; gap: 9px; color: var(--muted); margin: 7px 0; }
.swatch { width: 18px; height: 12px; border-radius: 999px; display: inline-block; border: 1px solid rgba(255,255,255,.3); }
.note-box { margin-top: 20px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.045); color: var(--muted); line-height: 1.42; }
.note-box strong { display: block; color: var(--accent); margin-bottom: 5px; }
.map-wrap { position: relative; min-width: 0; background: #07111f; }
#map { height: 100vh; width: 100%; background: #07111f; }
.map-topbar { position: absolute; top: 16px; left: 16px; right: 16px; z-index: 900; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; pointer-events: none; }
.map-topbar > * { pointer-events: auto; }
#dataStatus { justify-self: start; background: rgba(16,27,45,.92); backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: 999px; color: var(--text); padding: 10px 14px; box-shadow: 0 8px 30px rgba(0,0,0,.25); max-width: 460px; }
.map-buttons { justify-self: end; display: flex; gap: 8px; }
.overlay-switch { justify-self: center; display: inline-flex; gap: 0; background: rgba(10, 19, 35, .94); border: 1px solid rgba(255,255,255,.14); border-radius: 999px; box-shadow: 0 10px 30px rgba(0,0,0,.28); padding: 4px; }
.overlay-switch button { border: none; box-shadow: none; background: transparent; color: var(--muted); padding: 8px 14px; font-size: 12px; font-weight: 800; letter-spacing: .06em; }
.overlay-switch button.active { background: linear-gradient(180deg, rgba(255,120,120,.18), rgba(255,80,80,.14)); color: #fff; border-radius: 999px; }
.tz-tooltip { background: rgba(8, 15, 28, .98); color: var(--text); border: 1px solid rgba(255,255,255,.18); border-radius: 14px; box-shadow: 0 14px 40px rgba(0,0,0,.4); padding: 0; }
.tz-tooltip .leaflet-tooltip-content { margin: 0; }
.tooltip-inner { min-width: 420px; max-width: 620px; padding: 12px; }
.tooltip-header { display: flex; align-items: stretch; justify-content: space-between; gap: 14px; padding-bottom: 10px; margin-bottom: 10px; border-bottom: 1px solid rgba(255,255,255,.12); }
.tooltip-zone-block { min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.tooltip-inner h3 { margin: 0 0 5px; font-size: 17px; line-height: 1.08; letter-spacing: -.01em; }
.tooltip-player-count { color: var(--muted); font-size: 13px; font-weight: 700; }
.tooltip-clock { flex: 0 0 auto; min-width: 116px; text-align: right; display: flex; flex-direction: column; justify-content: center; line-height: 1; }
.tooltip-time { font-size: 23px; font-weight: 900; letter-spacing: -.03em; color: var(--text); white-space: nowrap; }
.tooltip-date { margin-top: 5px; font-size: 12px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; white-space: nowrap; }
.tooltip-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px 10px; }
.tooltip-player-cell { background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.09); border-radius: 10px; padding: 7px 9px; font-size: 13px; line-height: 1.25; }
.tooltip-player-line { display: block; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tooltip-player-city { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; font-weight: 700; }
.leaflet-container { font: inherit; background: #07111f; }
.leaflet-tile-pane { filter: saturate(.72) contrast(1.08) brightness(.74); }
.leaflet-control-attribution { background: rgba(5,11,20,.75); color: var(--muted); }
.leaflet-control-attribution a { color: #cfe8ff; }
.leaflet-interactive { outline: none; }
.active-player-zone { filter: drop-shadow(0 0 4px rgba(255, 107, 107, .14)); }
.leaflet-bottom.leaflet-right .leaflet-control-zoom { border: 1px solid rgba(255,255,255,.16); box-shadow: 0 10px 30px rgba(0,0,0,.28); }
.leaflet-control-zoom a { background: rgba(16,27,45,.94); color: #ffffff; border-bottom-color: rgba(255,255,255,.12); }
.leaflet-control-zoom a:hover { background: rgba(23,36,58,.98); color: var(--accent); }
@media (max-width: 1180px) {
  .map-topbar { grid-template-columns: 1fr; justify-items: start; }
  .overlay-switch, .map-buttons { justify-self: start; }
}
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; min-height: auto; }
  .panel { max-height: none; border-right: none; border-bottom: 1px solid var(--line); padding: 16px; }
  #map { height: 62vh; min-height: 420px; }
  .map-topbar { top: 10px; left: 10px; right: 10px; }
  .tooltip-inner { min-width: 320px; max-width: min(92vw, 560px); }
  .tooltip-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .group-logo { max-height: 180px; }
  .server-time-card { padding: 15px; }
  .server-time-value { font-size: 44px; }
  .planner-lists { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .planner-lists { grid-template-columns: 1fr; }
  .tooltip-time { font-size: 20px; }
  .tooltip-header { flex-direction: column; }
  .tooltip-clock { text-align: left; }
}

.planner-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}
.planner-number {
  margin: 0;
}
.planner-number.sleep-count {
  background: rgba(93, 16, 23, .22);
}
.planner-footnote {
  font-size: 11px;
  margin-top: 10px;
}
@media (max-width: 420px) {
  .planner-summary { grid-template-columns: 1fr; }
}


.panel-right .control-block,
.panel-right .details-panel {
  margin: 0;
}

.panel-right .details-panel {
  flex: 1 1 auto;
  min-height: 420px;
}

.panel-right .rank-filter {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.panel-right .rank-filter .label-row {
  grid-column: 1 / -1;
}

.panel-right .control-block label,
.panel-right .label-row span {
  margin-bottom: 8px;
}

.map-wrap {
  border-left: none;
  border-right: none;
}

@media (max-width: 1280px) {
  .app-shell {
    grid-template-columns: minmax(280px, 330px) minmax(0, 1fr) minmax(280px, 330px);
  }
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .panel-left,
  .panel-right {
    border: none;
  }

  .panel-left {
    border-bottom: 1px solid var(--line);
  }

  .panel-right {
    border-top: 1px solid var(--line);
    gap: 16px;
  }

  #map {
    height: 62vh;
    min-height: 420px;
  }
}

@media (max-width: 560px) {
  .panel-right .rank-filter {
    grid-template-columns: repeat(2, 1fr);
  }

  .panel-right .details-panel {
    min-height: 300px;
  }
}
