@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600&family=Spline+Sans+Mono:wght@400;600&display=swap');

:root {
  color-scheme: light;
  --bg: radial-gradient(circle at top, #fef6e9 0%, #f5f0e6 30%, #e7f0f6 65%, #dde6ef 100%);
  --panel: rgba(255, 255, 255, 0.82);
  --panel-strong: rgba(255, 255, 255, 0.95);
  --ink: #1f2430;
  --muted: #5b6670;
  --accent: #d3544f;
  --accent-2: #1e90a8;
  --line: rgba(31, 36, 48, 0.12);
  --shadow: 0 20px 40px rgba(31, 36, 48, 0.12);
  --radius: 22px;
  --mono: "Spline Sans Mono", "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: "Space Grotesk", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
}

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 24px 64px;
}

.hero {
  padding: 28px 32px 30px;
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(12px);
  animation: fadeIn 0.6s ease both;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(30, 144, 168, 0.12);
  color: var(--accent-2);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 12px;
}

.hero h1 {
  margin: 18px 0 10px;
  font-size: clamp(28px, 3vw, 40px);
  line-height: 1.1;
}

.hero p {
  margin: 0 0 18px;
  max-width: 620px;
  color: var(--muted);
  font-size: 16px;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
}

.add-zone {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 260px;
}

.add-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

#addCity {
  flex: 1;
  min-width: 180px;
  padding: 10px 12px;
  font-size: 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  font-family: var(--sans);
}

.add-status {
  font-size: 12px;
  color: var(--muted);
}

.add-status.error {
  color: #9f3c38;
}

.add-status.success {
  color: #1e7d62;
}

.controls label {
  font-weight: 600;
}

select {
  min-width: 220px;
  padding: 10px 14px;
  font-size: 15px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  font-family: var(--sans);
}

.now {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(211, 84, 79, 0.12);
  color: #9f3c38;
  font-weight: 600;
  font-size: 14px;
}

.pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 rgba(211, 84, 79, 0.5);
  animation: pulse 1.6s ease infinite;
}

.zone-section {
  margin-top: 32px;
}

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.section-title h2 {
  margin: 0;
  font-size: 22px;
}

.muted {
  margin: 0;
  color: var(--muted);
}

.zone-card {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
  animation: rise 0.6s ease both;
  animation-delay: var(--delay, 0ms);
}

.zone-card.selected {
  border-color: rgba(211, 84, 79, 0.6);
  box-shadow: 0 18px 40px rgba(211, 84, 79, 0.2);
}

.zone-meta {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.zone-meta h3 {
  margin: 0 0 4px;
  font-size: 20px;
}

.zone-meta .tz {
  font-family: var(--mono);
  color: var(--muted);
  font-size: 13px;
}

.zone-meta .time-block {
  text-align: right;
  min-width: 160px;
}

.zone-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.zone-button {
  border-radius: 999px;
  padding: 6px 12px;
  border: 1px solid rgba(31, 36, 48, 0.2);
  background: rgba(255, 255, 255, 0.7);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}

.zone-button.small {
  padding: 4px 10px;
  font-size: 11px;
}

.zone-card.draggable {
  cursor: grab;
}

.zone-card.dragging {
  opacity: 0.6;
}

.zone-card.drag-over {
  border-color: rgba(30, 144, 168, 0.6);
  box-shadow: 0 18px 40px rgba(30, 144, 168, 0.18);
}

.drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px dashed rgba(31, 36, 48, 0.25);
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  cursor: grab;
}

.drag-handle:active {
  cursor: grabbing;
}

.zone-button:hover {
  border-color: rgba(31, 36, 48, 0.45);
  color: #1f2430;
}

.zone-button:disabled {
  cursor: default;
  opacity: 0.6;
}

.zone-meta .time {
  font-size: 24px;
  font-weight: 600;
}

.zone-meta .date {
  color: var(--muted);
  font-size: 14px;
}

.hour-strip {
  overflow-x: auto;
  padding-bottom: 8px;
}

.hours {
  display: grid;
  grid-template-columns: repeat(24, minmax(30px, 1fr));
  gap: 6px;
  min-width: 760px;
}

.hour {
  font-family: var(--mono);
  font-size: 12px;
  text-align: center;
  padding: 8px 0 6px;
  border-radius: 10px;
  border: 1px solid rgba(31, 36, 48, 0.08);
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
  position: relative;
}

.hour.day {
  background: rgba(255, 255, 255, 0.95);
  color: #1f2430;
}

.hour.night {
  background: rgba(43, 56, 84, 0.08);
  color: #3a4557;
}

.hour.current {
  border: 2px solid var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.hour span {
  display: block;
  font-size: 9px;
  letter-spacing: 0.08em;
  margin-top: 4px;
  color: inherit;
}

.zone-grid {
  display: grid;
  gap: 16px;
}

.hidden-bar {
  display: none;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 10px 0 14px;
  font-size: 13px;
}

.hidden-label {
  font-weight: 600;
  color: var(--muted);
}

.chip {
  border-radius: 999px;
  padding: 6px 12px;
  border: 1px solid rgba(31, 36, 48, 0.15);
  background: rgba(255, 255, 255, 0.85);
  font-family: var(--sans);
  font-size: 12px;
  cursor: pointer;
  color: #1f2430;
}

.chip.clear {
  background: rgba(211, 84, 79, 0.12);
  border-color: rgba(211, 84, 79, 0.35);
  color: #9f3c38;
  font-weight: 600;
}

.foot {
  margin-top: 40px;
  padding: 18px 22px;
  border-radius: 16px;
  background: rgba(31, 36, 48, 0.06);
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: space-between;
  font-size: 13px;
}

.legend {
  display: flex;
  gap: 12px;
  align-items: center;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  display: inline-block;
  border: 1px solid rgba(31, 36, 48, 0.15);
}

.legend-swatch.day {
  background: rgba(255, 255, 255, 0.95);
}

.legend-swatch.night {
  background: rgba(43, 56, 84, 0.08);
}

.legend-swatch.current {
  border: 2px solid var(--accent);
}

.foot-meta {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

.link-button {
  border: none;
  background: none;
  color: var(--accent-2);
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  font-size: 13px;
}

.link-button:hover {
  color: #156b7e;
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(31, 36, 48, 0.45);
  backdrop-filter: blur(4px);
  padding: 24px;
  z-index: 10;
}

.modal.active {
  display: flex;
}

.modal-card {
  background: var(--panel-strong);
  border-radius: 20px;
  padding: 22px 24px;
  max-width: 520px;
  width: 100%;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.7);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.modal-header h2 {
  margin: 0;
  font-size: 20px;
}

.icon-button {
  border: none;
  background: rgba(31, 36, 48, 0.08);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
}

.icon-button:hover {
  background: rgba(31, 36, 48, 0.16);
}

.modal-body {
  margin-top: 12px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.cookie-banner {
  position: fixed;
  inset: auto 24px 24px 24px;
  display: flex;
  justify-content: center;
  z-index: 12;
}

.cookie-card {
  width: min(760px, 100%);
  background: var(--panel-strong);
  border-radius: 18px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.cookie-card p {
  margin: 6px 0 0;
  font-size: 13px;
}

.cookie-actions {
  display: inline-flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.zone-button.primary {
  background: rgba(30, 144, 168, 0.12);
  border-color: rgba(30, 144, 168, 0.45);
  color: var(--accent-2);
}

.zone-button.primary:hover {
  background: rgba(30, 144, 168, 0.2);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(211, 84, 79, 0.5);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(211, 84, 79, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(211, 84, 79, 0);
  }
}

@media (max-width: 900px) {
  .section-title {
    flex-direction: column;
    align-items: flex-start;
  }

  .zone-meta {
    flex-direction: column;
    align-items: flex-start;
  }

  .zone-meta .time-block {
    text-align: left;
  }

  .zone-actions {
    justify-content: flex-start;
  }

  .hours {
    min-width: 680px;
  }
}

@media (max-width: 600px) {
  .page {
    padding: 32px 16px 48px;
  }

  .hero {
    padding: 24px 20px;
  }

  select {
    width: 100%;
  }

  .add-zone {
    width: 100%;
  }

  .add-row {
    flex-direction: column;
    align-items: stretch;
  }

  .add-row .zone-button {
    width: 100%;
  }

  .controls {
    align-items: flex-start;
  }

  .now {
    width: 100%;
  }

  .cookie-banner {
    inset: auto 16px 16px 16px;
  }

  .cookie-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .cookie-actions {
    width: 100%;
    justify-content: flex-start;
  }
}
