@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500&display=swap");

:root {
  --bg: #0a0a0b;
  --text: #e4e4e7;
  --text-dim: #a1a1aa;
  --text-faint: #52525b;
  --accent: #f59e0b;
  --accent-dim: rgba(245, 158, 11, 0.15);
  --hover: rgba(255, 255, 255, 0.04);
  --font: "Inter", -apple-system, system-ui, sans-serif;
  --mono: "JetBrains Mono", monospace;
}

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

html, body { height: 100%; }

body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent-dim); }

.bg { display: none; }

.wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 40px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* Auth */
.auth {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(10, 10, 11, 0.95);
  backdrop-filter: blur(24px);
  z-index: 100;
  padding: 24px;
}

.auth-box {
  width: min(320px, 100%);
  display: grid;
  gap: 20px;
  text-align: center;
}

.auth-box h1 {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.auth-box p { display: none; }

.auth-box input {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--text-faint);
  padding: 12px 0;
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  text-align: center;
  transition: border-color 0.2s;
}

.auth-box input:focus {
  outline: none;
  border-color: var(--accent);
}

.auth-box button {
  background: transparent;
  border: none;
  padding: 12px;
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--accent);
  cursor: pointer;
  transition: opacity 0.15s;
}

.auth-box button:hover { opacity: 0.7; }

.auth-error {
  color: #ef4444;
  font-size: 0.8rem;
  min-height: 1em;
}

.locked .wrap {
  filter: blur(16px);
  pointer-events: none;
}

/* Header */
.top {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 32px;
}

/* Search */
.search {
  flex: 1;
  max-width: 680px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.search input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--text-faint);
  padding: 12px 0;
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 300;
  font-family: inherit;
  transition: border-color 0.2s;
}

.search input::placeholder { color: var(--text-faint); }
.search input:focus {
  outline: none;
  border-color: var(--text-dim);
}

.engines {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.engine {
  padding: 6px 12px;
  border-radius: 4px;
  background: transparent;
  color: var(--text-dim);
  border: none;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 500;
  font-family: inherit;
  transition: color 0.15s, background 0.15s;
}

.engine:hover {
  color: var(--text);
  background: var(--hover);
}

.engine.active {
  color: var(--accent);
}

.go { display: none; }

/* Meta (date + time + city toggle) */
.meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.meta-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.city-toggle {
  font-size: 0.78rem;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
  padding: 4px 8px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}

.city-toggle:hover {
  color: var(--text);
  background: var(--hover);
}

.sun-times {
  font-size: 0.72rem;
  color: var(--text-faint);
  font-family: var(--mono);
}

.date-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
}

#date-display {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-weight: 400;
}

.ip-mobile {
  display: none;
  font-size: 0.72rem;
  font-family: var(--mono);
  color: var(--text-faint);
}

.time {
  font-size: 0.82rem;
  cursor: pointer;
  user-select: none;
  position: relative;
}

.time strong { display: none; }

.time-compact {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-dim);
  transition: color 0.15s;
}

.time:hover .time-compact {
  color: var(--text);
}

.time-compact .value {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--text);
}

.expand-icon {
  font-size: 0.65rem;
  opacity: 0.5;
  transition: transform 0.2s, opacity 0.15s;
}

.time:hover .expand-icon { opacity: 1; }

.expanded .expand-icon { transform: rotate(180deg); }

/* Expanded time panel */
.time-expanded {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg);
  border: 1px solid var(--text-faint);
  border-radius: 8px;
  padding: 12px 16px;
  min-width: 200px;
  z-index: 50;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

.expanded .time-expanded { display: block; }

.time-expanded-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.time-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}

.time-row .label { color: var(--text-dim); }
.time-row .value {
  font-family: var(--mono);
  font-size: 0.82rem;
}

/* Info row (IP + forecast) */
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
}

.ip-info {
  font-size: 0.72rem;
  font-family: var(--mono);
  color: var(--text-faint);
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}

/* Forecast row - always visible, compact, flushed right */
.forecast-row {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--text-faint) transparent;
  padding-bottom: 4px;
}

.forecast-row::-webkit-scrollbar { height: 3px; }
.forecast-row::-webkit-scrollbar-track { background: transparent; }
.forecast-row::-webkit-scrollbar-thumb { background: var(--text-faint); border-radius: 2px; }

.forecast-card {
  flex: 0 0 78px;
  width: 78px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}

.forecast-card.today {
  border-color: var(--text-faint);
}

.forecast-day {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--text-dim);
}

.forecast-day span {
  color: var(--text-dim);
}

.forecast-icon {
  font-size: 1.1rem;
  line-height: 1;
}

.forecast-temp {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text);
}

.forecast-detail {
  font-size: 0.62rem;
  color: var(--text-dim);
  white-space: nowrap;
}

/* Links */
.links {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 40px 56px;
}

.category {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.category h2 {
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--text-faint);
}

.link-grid {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  text-decoration: none;
  color: var(--text-dim);
  transition: color 0.15s;
}

.link:hover { color: var(--text); }

.link img {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  opacity: 0.6;
  transition: opacity 0.15s;
}

.link:hover img { opacity: 1; }

.link span {
  font-size: 0.88rem;
  font-weight: 400;
}

/* Responsive */
@media (max-width: 900px) {
  .wrap { padding: 32px 24px; gap: 28px; }
  .header-row { flex-direction: column; gap: 20px; }
  .search { max-width: 100%; }
  .meta { align-self: flex-end; }
}

@media (max-width: 600px) {
  .wrap { padding: 16px 16px; gap: 20px; }
  .links { grid-template-columns: 1fr 1fr; gap: 24px 16px; }

  .info-row {
    flex-direction: column-reverse;
    gap: 12px;
  }

  .forecast-row {
    justify-content: flex-start;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .forecast-card {
    flex: 0 0 68px;
    width: 68px;
    min-width: 68px;
    padding: 6px 4px;
  }
  .forecast-icon { font-size: 1rem; }
  .forecast-temp { font-size: 0.68rem; }
  .forecast-detail { font-size: 0.58rem; }
  .forecast-day { font-size: 0.62rem; }

  .ip-info {
    display: none;
  }

  .ip-mobile {
    display: block;
  }

  .header-row {
    flex-direction: column;
  }

  .meta {
    width: 100%;
  }

  .date-row {
    justify-content: space-between;
    width: 100%;
  }

  .meta-row,
  .sun-times {
    align-self: flex-end;
  }

  .header-row {
    gap: 16px;
  }

  .meta {
    gap: 2px;
  }

  .search input {
    font-size: 1rem;
  }

  .engines {
    gap: 2px;
  }

  .engine {
    padding: 5px 8px;
    font-size: 0.72rem;
  }

  .category h2 {
    font-size: 0.64rem;
  }

  .link span {
    font-size: 0.82rem;
  }
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-faint); border-radius: 3px; }
