:root {
  --paper: #ffffff;
  --void: #e6e4de;
  --ink: #1c1a17;
  --mute: #8a8680;
  --line: rgba(28, 26, 23, 0.08);
  --accent: #e8284a;
  --shadow: 0 18px 48px rgba(28, 26, 23, 0.08);
  --radius: 22px;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--void);
  color: var(--ink);
  font-family: "Inter", sans-serif;
  font-weight: 400;
}

#c {
  display: block;
  width: 100%;
  height: 100%;
}

#hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

#hud > * { pointer-events: auto; }

.kicker {
  font-family: "DM Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--mute);
}

.topbar {
  position: absolute;
  top: 28px;
  left: 32px;
  right: 32px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  pointer-events: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
  pointer-events: auto;
}

.mark {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.04em;
}

.brand .kicker a {
  color: inherit;
  text-decoration: none;
}

.brand .kicker a:hover { color: var(--accent); }

.brand h1 {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1.05;
}

.brand h1 em {
  font-style: normal;
  font-weight: 400;
  color: var(--mute);
  margin-left: 6px;
}

.brand .kicker span { color: var(--line); }

.coords {
  font-family: "DM Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--mute);
  text-align: right;
  padding-top: 8px;
}

.coords span {
  display: block;
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 10px;
}

body.is-night .brand h1,
body.is-night .coords {
  color: #f4f1ea;
}

body.is-night .brand h1 em,
body.is-night .brand .kicker,
body.is-night .coords span {
  color: rgba(244, 241, 234, 0.62);
}

body.is-night .brand .mark {
  background: #f4f1ea;
  color: #1c1a17;
}

.brand h1,
.brand h1 em,
.brand .kicker,
.coords,
.brand .mark {
  transition: color 0.45s ease, background-color 0.45s ease;
}

.explorer {
  position: absolute;
  top: 118px;
  left: 32px;
  width: 272px;
  max-height: calc(100vh - 290px);
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.explorer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 18px 20px 12px;
  font-family: "DM Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--mute);
  background: transparent;
  border: 0;
  cursor: pointer;
  text-align: left;
}

.places {
  display: flex;
  flex-direction: column;
  overflow: auto;
  padding: 0 8px 8px;
  flex: 1;
}

.places button {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 2px 10px;
  background: transparent;
  border: 0;
  border-radius: 14px;
  color: var(--ink);
  text-align: left;
  font-family: inherit;
  padding: 10px 12px;
  cursor: pointer;
}

.places button:hover { background: #f4f2ec; }

.places .n {
  grid-row: 1 / span 2;
  align-self: center;
  font-family: "DM Mono", monospace;
  font-size: 11px;
  color: var(--mute);
}

.places .t {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.places .s {
  font-size: 11px;
  color: var(--mute);
}

.dock {
  position: absolute;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  width: min(920px, calc(100vw - 64px));
  display: flex;
  align-items: center;
  gap: 22px;
  background: var(--paper);
  border-radius: 999px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  padding: 14px 22px 14px 26px;
}

.clock-block {
  min-width: 132px;
  background: transparent;
  border: 0;
  color: inherit;
  text-align: left;
  font-family: inherit;
  cursor: default;
  padding: 0;
}

#clock {
  font-family: "DM Mono", monospace;
  font-size: 28px;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin: 2px 0 0;
}

#period {
  font-size: 12px;
  color: var(--mute);
}

.slider-wrap { flex: 1; min-width: 0; }

.ticks {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-family: "DM Mono", monospace;
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mute);
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, #1c2438, #e8b89a 22%, #f4e27a 48%, #c97a4a 74%, #1a2030);
  outline: none;
  border-radius: 2px;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--ink);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(28, 26, 23, 0.16);
}

.weather {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.wx {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 14px 0 10px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--mute);
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
}

.wx svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
}

.wx.on {
  color: var(--ink);
  border-color: var(--ink);
  background: #f6f4ef;
}

.explorer .credit {
  padding: 10px 20px 14px;
  font-size: 9px;
  line-height: 1.45;
  letter-spacing: 0.01em;
  color: var(--mute);
  border-top: 1px solid var(--line);
}

.explorer .credit a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.explorer .credit a:hover { color: var(--accent); }

#loader {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--void);
  transition: opacity 0.6s ease;
}

#loader .mark {
  width: 64px;
  height: 64px;
  font-size: 26px;
  margin-bottom: 16px;
}

#loader h1 {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.04em;
}

#loader p {
  margin-top: 8px;
  font-size: 12px;
  color: var(--mute);
}

#bar {
  margin-top: 28px;
  width: 220px;
  height: 2px;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
}

#bar > i {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.2s;
}

.hidden { opacity: 0; pointer-events: none; }

@media (max-width: 780px) {
  .topbar { top: 14px; left: 14px; right: 14px; }
  .coords { display: none; }
  .brand h1 { font-size: 22px; }
  .mark { width: 44px; height: 44px; font-size: 18px; }

  .explorer {
    top: 78px;
    left: 14px;
    width: min(280px, calc(100vw - 28px));
    max-height: calc(100vh - 200px);
  }
  .explorer:not(.open) .places,
  .explorer:not(.open) .credit { display: none; }
  .explorer:not(.open) { width: auto; }
  .explorer:not(.open) .explorer-head { padding: 12px 16px; }

  .dock {
    left: 0;
    right: 0;
    bottom: 0;
    transform: none;
    width: 100%;
    max-width: none;
    border-radius: 18px 18px 0 0;
    flex-wrap: wrap;
    gap: 8px 12px;
    padding: 10px 0 14px;
  }
  .clock-block {
    min-width: 0;
    cursor: pointer;
    padding: 0 12px 0 16px;
  }
  .dock:not(.open) .ticks { display: none; }
  .weather {
    padding: 0 16px 0 0;
    margin-left: auto;
  }
  .wx span { display: none; }
  .wx {
    width: 40px;
    height: 40px;
    padding: 0;
    justify-content: center;
  }
  .slider-wrap {
    flex: 1 1 100%;
    width: 100%;
    padding: 0;
    order: 3;
  }
  .slider-wrap input[type="range"] {
    width: 100%;
    border-radius: 0;
  }
  .ticks { padding: 0 16px; }
}
