:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --border: #2d3a4d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --accent: #58a6ff;
  --work-start: 8;
  --work-end: 18;
  --bar-height: 2.5rem;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "DM Sans", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
}

header {
  margin-bottom: 2rem;
}

h1 {
  font-size: 1.75rem;
  font-weight: 600;
  margin: 0 0 0.25rem 0;
  letter-spacing: -0.02em;
}

.subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.timezone-bars {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 2.5rem;
}

.timezone-row {
  display: grid;
  grid-template-columns: 160px 1fr 100px;
  align-items: center;
  gap: 1rem;
}

@media (max-width: 640px) {
  .timezone-row {
    grid-template-columns: 1fr 80px;
    grid-template-rows: auto auto;
  }
  .timezone-row .label { grid-column: 1; }
  .timezone-row .bar-wrap { grid-column: 1 / -1; }
  .timezone-row .time { grid-column: 2; grid-row: 1; }
}

.timezone-row .label {
  font-weight: 500;
  font-size: 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.timezone-row .label .city-name {
  font-weight: 600;
}

.timezone-row .label .tz-abbrev {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-muted);
}

.timezone-row .time {
  font-variant-numeric: tabular-nums;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.bar-wrap-cell {
  min-width: 0;
}

.bar-wrap {
  position: relative;
  height: var(--bar-height);
  background: var(--surface);
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.bar-inner {
  position: absolute;
  inset: 0;
  display: flex;
}

/* 24 segments for each hour */
.bar-segment {
  flex: 1;
  height: 100%;
  min-width: 2px;
}

.bar-segment.work {
  background: rgba(88, 166, 255, 0.2);
}

.bar-segment.night {
  background: rgba(88, 166, 255, 0.06);
}

.bar-segment.current {
  background: var(--accent);
  opacity: 0.9;
}

.now-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3px;
  background: #fff;
  box-shadow: 0 0 8px var(--accent);
  z-index: 2;
  border-radius: 1px;
}

.remove-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  border-radius: 4px;
  margin-left: 0.5rem;
}

.remove-btn:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

.add-timezone h2 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.75rem 0;
  color: var(--text-muted);
}

.add-form {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

#timezone-select {
  flex: 1;
  min-width: 200px;
  padding: 0.5rem 0.75rem;
  font-size: 0.95rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
}

#add-btn {
  padding: 0.5rem 1rem;
  font-size: 0.95rem;
  font-weight: 500;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

#add-btn:hover {
  filter: brightness(1.1);
}

.hint {
  margin: 0.5rem 0 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Hour labels under the first bar (optional) */
.legend {
  display: grid;
  grid-template-columns: 160px 1fr 100px;
  gap: 1rem;
  margin-bottom: 0.25rem;
  padding-left: 0;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.legend .bar-ticks {
  display: flex;
  justify-content: space-between;
  padding: 0 2px;
}

@media (max-width: 640px) {
  .legend {
    grid-template-columns: 1fr 80px;
  }
  .legend .bar-ticks { grid-column: 1; }
}

/* World map */
.world-map-section {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.world-map-section h2 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 1rem 0;
  color: var(--text-muted);
}

.world-map {
  width: 100%;
  max-width: 900px;
  aspect-ratio: 2 / 1;
  background: var(--surface);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.world-map-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.world-map-svg {
  background: var(--surface);
}

.world-map-svg .world-ocean {
  fill: #0d1117;
}

.world-map-svg .world-land {
  fill: #21262d;
  stroke: #30363d;
  stroke-width: 0.5;
}

.world-map-svg .map-dot {
  fill: var(--accent);
  stroke: var(--bg);
  stroke-width: 2;
}

.world-map-svg .map-label {
  fill: var(--text);
  font-size: 11px;
  font-weight: 500;
  font-family: inherit;
  paint-order: stroke;
  stroke: var(--bg);
  stroke-width: 2px;
}
