:root {
  --tz1-bg:     #fff0f0;
  --tz1-muted:  #f4a0a0;
  --tz1-strong: #e03030;
  --tz2-bg:     #f0f4ff;
  --tz2-muted:  #90b4f0;
  --tz2-strong: #2060e0;
  --overlap:    #9040c0;
  --no-overlap: #e03030;
  --radius:     10px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f2f2f7;
  color: #1c1c1e;
  min-height: 100vh;
  padding: 2.5rem 1rem;
}

.container {
  max-width: 860px;
  margin: 0 auto;
}

h1 {
  text-align: center;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 2rem;
}

/* ── Panels ─────────────────────────────────────────────────────── */

.panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

@media (max-width: 580px) {
  .panels { grid-template-columns: 1fr; }
}

.panel {
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  box-shadow: 0 1px 6px rgba(0,0,0,0.08);
}

.panel-tz1 { background: var(--tz1-bg); border: 1.5px solid var(--tz1-muted); }
.panel-tz2 { background: var(--tz2-bg); border: 1.5px solid var(--tz2-muted); }

.panel h2 {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 1rem;
  color: #444;
}

.field { margin-bottom: 0.75rem; }

.field label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #666;
  margin-bottom: 0.3rem;
}

.field select,
.field input[type="time"] {
  width: 100%;
  padding: 0.45rem 0.65rem;
  border-radius: 7px;
  border: 1.5px solid #d0d0d8;
  font-size: 0.9rem;
  background: #fff;
  color: #1c1c1e;
  outline: none;
  transition: border-color 0.15s;
  appearance: auto;
}

.field select:focus,
.field input[type="time"]:focus {
  border-color: #888;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

/* ── Button ─────────────────────────────────────────────────────── */

.actions { text-align: center; margin-bottom: 1.5rem; }

#calculate {
  background: #1c1c1e;
  color: #fff;
  border: none;
  padding: 0.7rem 2.5rem;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

#calculate:hover        { background: #3a3a3c; }
#calculate:active       { transform: scale(0.98); }
#calculate:focus-visible { outline: 3px solid #2060e0; outline-offset: 2px; }

/* ── Results ────────────────────────────────────────────────────── */

.results {
  background: #fff;
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: 0 1px 6px rgba(0,0,0,0.08);
}

.results.hidden { display: none; }

.overlap-summary {
  text-align: center;
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  letter-spacing: -0.01em;
}

.overlap-summary.has-overlap { color: var(--overlap); }
.overlap-summary.no-overlap  { color: var(--no-overlap); }

/* ── Timeline ───────────────────────────────────────────────────── */

#timeline { overflow-x: auto; }

.tl-wrapper { min-width: 400px; }

.tl-row {
  display: flex;
  align-items: stretch;
  margin-bottom: 6px;
}

.tl-label {
  width: 58px;
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: right;
  padding-right: 10px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  color: #888;
}

.tl-label.tl-tz1 { color: var(--tz1-strong); }
.tl-label.tl-tz2 { color: var(--tz2-strong); }
.tl-label.tl-ovr { color: var(--overlap); }

.tl-bars {
  flex: 1;
  height: 22px;
  position: relative;
  border-radius: 5px;
  overflow: hidden;
  background: #ebebf0;
}

/* axis rows: taller, transparent, timezone day/hour labels above and below bars */
.tl-axis-bar {
  height: 42px;
  background: transparent;
  overflow: visible;
  border-radius: 0;
}

.bar-seg {
  position: absolute;
  top: 0;
  height: 100%;
}

.axis-day {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #555;
  border-left: 1px solid #d8d8df;
  overflow: hidden;
  white-space: nowrap;
}

.tl-axis-top    .axis-day { top: 0;    height: 22px; }
.tl-axis-bottom .axis-day { bottom: 0; height: 22px; }

.day-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(120,120,128,0.25);
  z-index: 3;
  pointer-events: none;
}

.hour-gridline {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(255,255,255,0.5);
  z-index: 2;
  pointer-events: none;
}

.axis-hour {
  position: absolute;
  font-size: 0.6rem;
  color: #999;
  transform: translateX(-50%);
  white-space: nowrap;
  pointer-events: none;
}

.tl-axis-top    .axis-hour { bottom: 3px; }
.tl-axis-bottom .axis-hour { top: 3px; }

/* legend */
.tl-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin-top: 1rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  color: #666;
}

.legend-swatch {
  width: 18px;
  height: 11px;
  border-radius: 3px;
  flex-shrink: 0;
}
