:root {
  --bg: #0a0d13;
  --panel: #121822;
  --line: #253246;
  --line-2: rgba(149, 186, 241, 0.18);
  --muted: #93a5bd;
  --text: #eef5ff;
  --accent: #5aa3ff;
  --blur: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(750px 420px at 100% 100%, rgba(34, 58, 94, 0.32) 0%, transparent 65%),
    radial-gradient(650px 380px at 0% 0%, rgba(31, 58, 97, 0.28) 0%, transparent 60%),
    var(--bg);
}

@keyframes wfShimmer {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

html.wf-weather-loading .skeletonable {
  color: transparent !important;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.06));
  background-size: 200% 100%;
  animation: wfShimmer 1.15s ease-in-out infinite;
  border-radius: 14px;
}

@media (prefers-reduced-motion: reduce) {
  html.wf-weather-loading .skeletonable {
    animation: none;
  }
}

.widget {
  width: min(520px, 96vw);
  margin: 12px auto 18px;
  padding: 10px;
  display: grid;
  gap: 10px;
}

.widget-head,
.widget-search,
.widget-card,
.widget-install {
  border: 1px solid var(--line-2);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(22, 30, 44, 0.88), rgba(14, 20, 30, 0.9));
}

.widget-head {
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.widget-brand {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
}

.widget-updated {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.widget-full-link {
  color: #dcedff;
  text-decoration: none;
  border: 1px solid rgba(137, 172, 221, 0.45);
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 0.85rem;
  white-space: nowrap;
}

.widget-search {
  padding: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.widget-search input {
  min-width: 180px;
  flex: 1 1 220px;
  border: 1px solid rgba(131, 163, 205, 0.38);
  border-radius: 12px;
  background: rgba(16, 24, 35, 0.95);
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
}

.widget-search input:focus {
  outline: 2px solid rgba(90, 163, 255, 0.55);
  border-color: transparent;
}

.widget-search button {
  border: 0;
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  min-width: 110px;
}

.widget-search button[type="submit"] {
  color: #081424;
  background: linear-gradient(140deg, var(--accent), #8cc5ff);
}

#widgetLocateBtn {
  color: #dcecff;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(142, 177, 223, 0.35);
}

.widget-status {
  margin: 0 4px;
  min-height: 1.15em;
  color: var(--muted);
  font-size: 0.9rem;
}

.widget-status.error {
  color: #ff9595;
}

.widget-card {
  padding: 14px;
  display: grid;
  gap: 8px;
  background:
    radial-gradient(700px 320px at 80% 10%, rgba(140, 196, 255, 0.22) 0%, transparent 60%),
    linear-gradient(145deg, rgba(44, 90, 180, 0.5), rgba(14, 20, 30, 0.92));
}

.widget-city {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
}

.widget-temp-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: end;
}

.widget-temp {
  margin: 0;
  font-size: clamp(2.2rem, 9vw, 3.2rem);
  line-height: 0.95;
  font-weight: 800;
}

.widget-condition {
  margin: 0 0 5px;
  text-align: right;
  font-size: 1.03rem;
  color: #dbe9fb;
}

.widget-feels {
  margin: 0;
  color: #c6d9f2;
}

.widget-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.widget-metrics div {
  border: 1px solid rgba(128, 160, 204, 0.28);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  padding: 9px 10px;
}

.widget-metrics span {
  display: block;
  color: #99b0cb;
  font-size: 0.85rem;
}

.widget-metrics strong {
  display: block;
  margin-top: 5px;
  font-size: 1.05rem;
}

.widget-install {
  padding: 12px 14px;
  display: grid;
  gap: 8px;
}

.widget-install-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
}

.widget-install-text {
  margin: 0;
  color: #abc0dc;
  line-height: 1.35;
  font-size: 0.92rem;
}

.widget-permalink {
  color: #9ec9ff;
  text-decoration: none;
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}

.widget-permalink:hover {
  color: #d4ebff;
  text-decoration: underline;
}

body.widget-compact-mode {
  background: transparent;
  min-height: 0;
}

body.widget-compact-mode .widget {
  width: min(240px, 100vw);
  margin: 0;
  padding: 0;
  gap: 0;
}

body.widget-compact-mode .widget-head,
body.widget-compact-mode .widget-search,
body.widget-compact-mode .widget-status,
body.widget-compact-mode .widget-install {
  display: none;
}

body.widget-compact-mode .widget-card {
  border-radius: 24px;
  border: 1px solid rgba(142, 177, 223, 0.35);
  background: linear-gradient(180deg, #244d90, #1f427f);
  padding: 14px;
  min-height: 220px;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.28);
}

body.widget-compact-mode .widget-city {
  font-size: 0.98rem;
  font-weight: 700;
  color: #d6e8ff;
}

body.widget-compact-mode .widget-temp {
  font-size: 3rem;
}

body.widget-compact-mode .widget-condition {
  margin: 4px 0 0;
  max-width: 112px;
  text-align: right;
  font-size: 0.94rem;
  line-height: 1.2;
}

body.widget-compact-mode .widget-feels {
  margin-top: 2px;
  font-size: 0.9rem;
  line-height: 1.25;
  color: #e4efff;
}

body.widget-compact-mode .widget-metrics {
  display: none;
}

@media (max-width: 640px) {
  .widget {
    width: 100%;
    margin: 0 auto;
    padding: 8px;
  }

  .widget-head {
    align-items: start;
    flex-direction: column;
  }

  .widget-full-link {
    align-self: stretch;
    text-align: center;
  }

  .widget-search {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
  }

  .widget-search input {
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
  }

  .widget-search button {
    width: auto;
    min-width: 112px;
    min-height: 40px;
    padding: 8px 10px;
  }

  .widget-metrics {
    grid-template-columns: 1fr;
  }

  .widget-condition {
    text-align: left;
    margin: 0;
  }

  .widget-temp-row {
    align-items: start;
    flex-direction: column;
  }
}
