:root {
  color-scheme: dark;
  --bg1: #10141f;
  --bg2: #1a2233;
  --card: rgba(255,255,255,.075);
  --card-border: rgba(255,255,255,.12);
  --text: #f7f8fb;
  --muted: #aeb7c8;
  --accent: #ffd166;
  --accent2: #ff9f43;
  --shadow: 0 18px 60px rgba(0,0,0,.28);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 10%, rgba(255,190,90,.16), transparent 25%),
    radial-gradient(circle at 85% 15%, rgba(84,129,255,.14), transparent 28%),
    linear-gradient(145deg, var(--bg1), var(--bg2));
  background-attachment: fixed;
  transition: background .8s ease;
}

body.phase-day {
  --bg1: #162c46;
  --bg2: #294b68;
}
body.phase-twilight {
  --bg1: #241b35;
  --bg2: #5b3444;
}
body.phase-night {
  --bg1: #090d18;
  --bg2: #101a2d;
}

.wrap { width: min(1240px, calc(100% - 32px)); margin: 0 auto; padding: 32px 0 24px; }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.eyebrow { color: var(--accent); font-weight: 800; letter-spacing: .16em; font-size: 12px; }
h1 { margin: 5px 0 4px; font-size: clamp(34px, 4vw, 54px); line-height: 1; }
.muted { color: var(--muted); }
.clockbox { text-align: right; }
.clock { font-size: clamp(28px, 3vw, 42px); font-variant-numeric: tabular-nums; font-weight: 800; letter-spacing: .03em; }

.hero {
  min-height: 122px;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 24px 28px;
  border: 1px solid var(--card-border);
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(255,209,102,.12), rgba(255,255,255,.055));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  margin-bottom: 20px;
}
.hero-icon { font-size: 58px; filter: drop-shadow(0 8px 20px rgba(0,0,0,.22)); }
.hero-title { font-size: clamp(24px, 3vw, 40px); font-weight: 850; line-height: 1.1; }
.hero-sub { margin-top: 7px; color: var(--muted); font-size: 16px; }

.grid { display: grid; gap: 20px; }
.grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.lower-grid { margin-top: 20px; }

.card {
  padding: 22px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 22px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}
.card-title { display: flex; gap: 9px; align-items: center; font-size: 18px; font-weight: 800; margin-bottom: 18px; }
.kv { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 8px 0; color: var(--muted); border-bottom: 1px solid rgba(255,255,255,.055); }
.kv:last-child { border-bottom: 0; }
.kv strong { color: var(--text); font-size: 17px; text-align: right; font-variant-numeric: tabular-nums; }
.separator { height: 1px; background: rgba(255,255,255,.10); margin: 14px 0; }

.countdown-card { background: linear-gradient(155deg, rgba(255,209,102,.12), rgba(255,255,255,.055)); }
.big-label { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .08em; }
.big-label.second { margin-top: 18px; }
.big-value { font-size: clamp(34px, 4vw, 52px); line-height: 1.08; margin-top: 3px; font-weight: 900; font-variant-numeric: tabular-nums; }
.big-value.smaller { font-size: clamp(25px, 3vw, 36px); }
.day-progress-wrap { margin-top: 25px; }
.day-progress-labels { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; margin-bottom: 7px; }
.day-progress { height: 9px; border-radius: 99px; background: rgba(255,255,255,.10); overflow: hidden; }
.day-progress-fill { width: 0; height: 100%; background: linear-gradient(90deg, #ffd166, #ff9f43); border-radius: inherit; transition: width .8s ease; }

.moon-phase-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-bottom: 12px; }
.moon-phase { font-size: 21px; font-weight: 850; }
.moon-percent { font-size: 36px; font-weight: 900; font-variant-numeric: tabular-nums; }

.twilight-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.twilight-grid > div, .golden-block { padding: 14px; background: rgba(255,255,255,.045); border-radius: 15px; }
.twilight-grid span, .golden-block span { display: block; color: var(--muted); font-size: 13px; margin-bottom: 4px; }
.twilight-grid strong, .golden-block strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.golden-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }

footer { display: flex; justify-content: space-between; gap: 16px; color: var(--muted); font-size: 12px; padding: 20px 4px 0; }

@media (max-width: 980px) {
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .wrap { width: min(100% - 20px, 1240px); padding-top: 20px; }
  .topbar { align-items: flex-start; }
  .clock { font-size: 24px; }
  .hero { padding: 20px; }
  .hero-icon { font-size: 44px; }
  .twilight-grid, .golden-grid { grid-template-columns: 1fr; }
  footer { flex-direction: column; }
}
.location-tools {
  margin-top: 12px;
  max-width: 520px;
}

.location-search {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.location-search input {
  flex: 1;
  min-width: 0;
  padding: 10px 13px;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  background: rgba(255,255,255,.08);
  color: var(--text);
  font: inherit;
  outline: none;
}

.location-search input::placeholder {
  color: var(--muted);
}

.location-search input:focus {
  border-color: var(--accent);
}

.location-tools button {
  padding: 10px 14px;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  background: rgba(255,255,255,.09);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.location-tools button:hover {
  background: rgba(255,255,255,.15);
}

.search-results {
  display: none;
  margin-top: 8px;
  overflow: hidden;
  border: 1px solid var(--card-border);
  border-radius: 14px;
  background: #151c29;
  box-shadow: var(--shadow);
}

.search-results.active {
  display: block;
}

.search-result {
  display: block;
  width: 100%;
  padding: 11px 13px;
  border: 0;
  border-bottom: 1px solid rgba(255,255,255,.07);
  border-radius: 0 !important;
  background: transparent !important;
  text-align: left;
}

.search-result:last-child {
  border-bottom: 0;
}

.search-result:hover {
  background: rgba(255,255,255,.08) !important;
}

.search-result strong {
  display: block;
}

.search-result span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

/* --- METEO --- */

.weather-mini {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 20;
  width: 190px;
  padding: 15px 16px;
  border: 1px solid var(--card-border);
  border-radius: 16px;
  background: rgba(15, 20, 30, .78);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
  color: var(--text);
}

.weather-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--muted);
}

.weather-temp {
  margin-top: 5px;
  font-size: 30px;
  font-weight: 700;
}

.weather-condition {
  margin-bottom: 10px;
  font-size: 13px;
}

.weather-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}

.weather-details b {
  color: var(--text);
  font-weight: 600;
}

.weather-updated {
  margin-top: 9px;
  font-size: 10px;
  color: var(--muted);
}

@media (max-width: 720px) {
  .weather-mini {
    position: relative;
    top: auto;
    right: auto;
    width: auto;
    margin: 12px 16px;
  }
}

/* ===== MOBILE - AFISARE MAI MARE ===== */

@media (max-width: 720px) {

  html {
    font-size: 18px;
  }

  body {
    overflow-x: hidden;
  }

  .wrap {
    width: calc(100% - 20px);
    padding-top: 16px;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    margin-bottom: 20px;
  }

  .clockbox {
    text-align: left;
  }

  .eyebrow {
    font-size: 13px;
  }

  h1 {
    font-size: 38px;
    line-height: 1.05;
  }

  .muted {
    font-size: 16px;
  }

  .clock {
    font-size: 32px;
  }

  .hero {
    padding: 20px;
    gap: 16px;
    min-height: auto;
  }

  .hero-icon {
    font-size: 48px;
  }

  .hero-title {
    font-size: 28px;
  }

  .hero-sub {
    font-size: 17px;
  }

  .grid {
    gap: 14px;
  }

  .card {
    padding: 20px;
    border-radius: 18px;
  }

  .card-title {
    font-size: 21px;
    margin-bottom: 15px;
  }

  .kv {
    padding: 11px 0;
  }

  .kv span {
    font-size: 17px;
  }

  .kv strong {
    font-size: 18px;
  }

  .big-label {
    font-size: 15px;
  }

  .big-value {
    font-size: 43px;
  }

  .big-value.smaller {
    font-size: 32px;
  }

  .day-progress-labels {
    font-size: 14px;
  }

  .moon-phase {
    font-size: 23px;
  }

  .moon-percent {
    font-size: 38px;
  }

  .twilight-grid span,
  .golden-block span {
    font-size: 16px;
  }

  .twilight-grid strong,
  .golden-block strong {
    font-size: 21px;
  }

  .location-tools {
    max-width: none;
    width: 100%;
  }

  .location-search {
    width: 100%;
  }

  .location-search input {
    font-size: 17px;
    padding: 13px;
  }

  .location-tools button {
    font-size: 16px;
    padding: 13px 15px;
  }

  .weather-mini {
    width: calc(100% - 20px);
    margin: 14px 10px;
    padding: 20px;
  }

  .weather-title {
    font-size: 14px;
  }

  .weather-temp {
    font-size: 42px;
  }

  .weather-condition {
    font-size: 17px;
  }

  .weather-details {
    font-size: 16px;
    gap: 7px;
  }

  footer {
    font-size: 14px;
  }
}
