:root {
  color-scheme: dark;
  --bg: #0f0f10;
  --bg-elevated: rgba(22, 22, 24, 0.78);
  --bg-soft: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.2);
  --text: #f5f3ef;
  --muted: rgba(245, 243, 239, 0.68);
  --muted-strong: rgba(245, 243, 239, 0.84);
  --accent: #d6d0c4;
  --danger: #f0c9c9;
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.28);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --font-ui: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--text);
  background: var(--bg);
  font-family: var(--font-ui);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    linear-gradient(140deg, rgba(255, 255, 255, 0.045), transparent 24%),
    radial-gradient(circle at top left, rgba(214, 208, 196, 0.09), transparent 28%);
  pointer-events: none;
  z-index: -1;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.background,
.background-overlay {
  position: fixed;
  inset: 0;
}

.background {
  z-index: -3;
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 255, 255, 0.07), transparent 26%),
    radial-gradient(circle at 85% 14%, rgba(214, 208, 196, 0.08), transparent 24%),
    linear-gradient(150deg, #0b0b0c 0%, #171719 42%, #09090a 100%);
  background-size: cover;
  background-position: center;
  transform: scale(1.02);
  transition: background-image 220ms ease;
}

.background-overlay {
  z-index: -2;
  background:
    linear-gradient(180deg, rgba(8, 8, 9, 0.18), rgba(8, 8, 9, 0.6)),
    radial-gradient(circle at center, transparent 10%, rgba(0, 0, 0, 0.28) 100%);
}

.dashboard {
  width: min(1180px, calc(100% - 40px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 30px 0 24px;
  display: flex;
  flex-direction: column;
}

.topbar,
.clock-row,
.weather-header,
.weather-main,
.weather-details,
.weather-footer,
.settings-header,
.settings-actions,
.compact-actions,
.search-grid,
.location-config-header {
  display: flex;
}

.topbar {
  align-items: center;
  justify-content: space-between;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  min-height: 46px;
  color: var(--text);
}

.brand-text {
  display: block;
  font-size: 0.95rem;
  letter-spacing: 0.18em;
  font-weight: 700;
}

.icon-button,
.close-button,
.primary-button,
.secondary-button,
.preset,
.search-results button {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.icon-button,
.close-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 20, 22, 0.58);
  cursor: pointer;
}

.icon-button:hover,
.icon-button:focus-visible,
.close-button:hover,
.close-button:focus-visible,
.primary-button:hover,
.primary-button:focus-visible,
.secondary-button:hover,
.secondary-button:focus-visible,
.preset:hover,
.preset:focus-visible,
.search-results button:hover,
.search-results button:focus-visible {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  outline: none;
}

.icon-button {
  width: 46px;
  height: 46px;
}

.icon-gear {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.hero {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: 32px;
  align-items: center;
  padding: 82px 0 56px;
}

.clock-panel {
  padding-right: 10px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  font-weight: 700;
}

.clock-row {
  align-items: flex-start;
  gap: 12px;
}

.clock-display {
  display: inline-flex;
  align-items: baseline;
  gap: 0.08em;
  margin: 0;
  font-size: clamp(5.2rem, 13vw, 10rem);
  line-height: 0.84;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.clock-hours,
.clock-minutes,
.clock-separator {
  display: block;
}

.clock-separator {
  margin: 0 0.02em;
}

.seconds {
  margin: 0.14em 0 0;
  color: var(--accent);
  font-size: clamp(1.35rem, 3vw, 2.1rem);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.date {
  margin: 24px 0 0;
  color: var(--muted-strong);
  font-size: clamp(1rem, 2vw, 1.25rem);
  text-transform: capitalize;
}

.weather-section {
  min-width: 0;
}

.weather-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.panel-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--bg-elevated);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(112%);
  -webkit-backdrop-filter: blur(18px) saturate(112%);
}

.weather-card {
  min-height: 100%;
  padding: 22px;
}

.weather-header {
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.weather-header h2,
.settings-header h2,
.settings-section-heading h3,
.location-config-header h4 {
  margin: 0;
}

.weather-header h2 {
  font-size: 1.12rem;
  line-height: 1.25;
}

.weather-subtitle,
.weather-meta,
.settings-section-heading p,
.helper-message {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.weather-subtitle:empty {
  display: none;
}

.weather-icon {
  width: 60px;
  height: 60px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  position: relative;
  flex: 0 0 auto;
}

.weather-icon-core,
.weather-icon-accent {
  position: absolute;
  display: block;
}

.weather-icon-clear .weather-icon-core {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  top: 19px;
  left: 19px;
  box-shadow: 0 0 0 8px rgba(214, 208, 196, 0.08);
}

.weather-icon-partly .weather-icon-core,
.weather-icon-cloudy .weather-icon-core,
.weather-icon-fog .weather-icon-core,
.weather-icon-rain .weather-icon-core,
.weather-icon-storm .weather-icon-core,
.weather-icon-snow .weather-icon-core {
  width: 30px;
  height: 18px;
  left: 15px;
  top: 22px;
  background: rgba(245, 243, 239, 0.86);
  border-radius: 999px;
}

.weather-icon-partly .weather-icon-core::before,
.weather-icon-cloudy .weather-icon-core::before,
.weather-icon-fog .weather-icon-core::before,
.weather-icon-rain .weather-icon-core::before,
.weather-icon-storm .weather-icon-core::before,
.weather-icon-snow .weather-icon-core::before,
.weather-icon-partly .weather-icon-core::after,
.weather-icon-cloudy .weather-icon-core::after,
.weather-icon-fog .weather-icon-core::after,
.weather-icon-rain .weather-icon-core::after,
.weather-icon-storm .weather-icon-core::after,
.weather-icon-snow .weather-icon-core::after {
  content: "";
  position: absolute;
  background: inherit;
  border-radius: 50%;
}

.weather-icon-partly .weather-icon-core::before,
.weather-icon-cloudy .weather-icon-core::before,
.weather-icon-fog .weather-icon-core::before,
.weather-icon-rain .weather-icon-core::before,
.weather-icon-storm .weather-icon-core::before,
.weather-icon-snow .weather-icon-core::before {
  width: 18px;
  height: 18px;
  left: 2px;
  top: -8px;
}

.weather-icon-partly .weather-icon-core::after,
.weather-icon-cloudy .weather-icon-core::after,
.weather-icon-fog .weather-icon-core::after,
.weather-icon-rain .weather-icon-core::after,
.weather-icon-storm .weather-icon-core::after,
.weather-icon-snow .weather-icon-core::after {
  width: 16px;
  height: 16px;
  right: 3px;
  top: -6px;
}

.weather-icon-partly .weather-icon-accent {
  width: 18px;
  height: 18px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  left: 12px;
  top: 12px;
}

.weather-icon-fog .weather-icon-accent,
.weather-icon-rain .weather-icon-accent,
.weather-icon-storm .weather-icon-accent,
.weather-icon-snow .weather-icon-accent {
  width: 30px;
  left: 15px;
}

.weather-icon-fog .weather-icon-accent {
  top: 42px;
  height: 2px;
  background: rgba(245, 243, 239, 0.7);
  box-shadow: 0 -6px 0 rgba(245, 243, 239, 0.34);
}

.weather-icon-rain .weather-icon-accent {
  top: 42px;
  height: 10px;
  background:
    linear-gradient(90deg, transparent 0 12%, rgba(214, 208, 196, 0.82) 12% 18%, transparent 18% 46%, rgba(214, 208, 196, 0.82) 46% 52%, transparent 52% 80%, rgba(214, 208, 196, 0.82) 80% 86%, transparent 86% 100%);
}

.weather-icon-storm .weather-icon-accent {
  top: 41px;
  height: 12px;
}

.weather-icon-storm .weather-icon-accent::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 0;
  width: 8px;
  height: 12px;
  background: var(--accent);
  clip-path: polygon(55% 0, 100% 0, 55% 55%, 82% 55%, 25% 100%, 40% 62%, 12% 62%);
}

.weather-icon-snow .weather-icon-accent {
  top: 42px;
  height: 10px;
}

.weather-icon-snow .weather-icon-accent::before,
.weather-icon-snow .weather-icon-accent::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid rgba(245, 243, 239, 0.8);
  top: 0;
}

.weather-icon-snow .weather-icon-accent::before {
  left: 5px;
}

.weather-icon-snow .weather-icon-accent::after {
  right: 5px;
}

.weather-main {
  align-items: flex-end;
  justify-content: space-between;
  margin-top: 20px;
  gap: 14px;
}

.temperature {
  display: block;
  font-size: clamp(3.6rem, 6vw, 4.8rem);
  line-height: 0.88;
  letter-spacing: -0.08em;
}

.weather-description {
  margin: 10px 0 0;
  color: var(--muted);
}

.weather-range {
  display: grid;
  gap: 8px;
  text-align: right;
  color: var(--muted);
  font-size: 0.88rem;
}

.weather-range strong,
.weather-details strong {
  color: var(--text);
}

.weather-details {
  justify-content: space-between;
  gap: 10px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.weather-details span,
.weather-details strong {
  display: block;
}

.weather-details span {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.78rem;
}

.weather-details strong {
  font-size: 0.94rem;
}

.weather-footer {
  justify-content: space-between;
  align-items: flex-end;
  gap: 10px;
  margin-top: 12px;
}

.weather-status,
.weather-updated {
  min-height: 18px;
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.weather-status[data-state="error"] {
  color: var(--danger);
}

.weather-updated:empty {
  display: none;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding-top: 16px;
  color: rgba(245, 243, 239, 0.5);
  font-size: 0.75rem;
}

.site-footer a {
  color: inherit;
}

.settings-panel {
  width: min(760px, calc(100% - 28px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: rgba(14, 14, 15, 0.94);
  color: var(--text);
  box-shadow: 0 36px 110px rgba(0, 0, 0, 0.52);
  backdrop-filter: blur(26px);
  -webkit-backdrop-filter: blur(26px);
}

.settings-panel::backdrop {
  background: rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(4px);
}

.settings-form {
  display: grid;
  gap: 24px;
  padding: 28px;
}

.settings-header {
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.close-button {
  width: 40px;
  height: 40px;
  font-size: 1.5rem;
  line-height: 1;
}

.settings-section {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.03);
}

.settings-section-heading p,
.upload-control p,
.field span,
.preset-label,
.search-results strong,
.search-results small,
.upload-control label {
  display: block;
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.preset {
  padding: 10px;
  background: rgba(255, 255, 255, 0.03);
  text-align: left;
  cursor: pointer;
}

.preset-preview {
  display: block;
  aspect-ratio: 1.3;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.preset-label {
  margin-top: 10px;
  font-size: 0.88rem;
  color: var(--muted-strong);
}

.preset.is-selected {
  border-color: rgba(214, 208, 196, 0.72);
  background: rgba(214, 208, 196, 0.08);
  box-shadow: inset 0 0 0 1px rgba(214, 208, 196, 0.16);
}

.preset.is-selected .preset-label {
  color: var(--text);
}

.preset-night {
  background:
    radial-gradient(circle at 15% 18%, rgba(255, 255, 255, 0.08), transparent 22%),
    linear-gradient(145deg, #0b0b0c 0%, #171719 54%, #09090a 100%);
}

.preset-graphite {
  background:
    radial-gradient(circle at 80% 18%, rgba(255, 255, 255, 0.07), transparent 24%),
    linear-gradient(145deg, #101113 0%, #25272b 52%, #121416 100%);
}

.preset-stone {
  background:
    radial-gradient(circle at 12% 16%, rgba(223, 214, 199, 0.18), transparent 24%),
    linear-gradient(145deg, #181614 0%, #3b352f 50%, #121111 100%);
}

.preset-mist {
  background:
    radial-gradient(circle at 75% 20%, rgba(255, 255, 255, 0.18), transparent 28%),
    linear-gradient(145deg, #4b4c4f 0%, #73767c 52%, #36393d 100%);
}

.upload-control,
.location-config-card {
  margin-top: 18px;
  padding: 18px;
  border: 1px dashed rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
}

.upload-control label,
.field span {
  margin-bottom: 8px;
  font-size: 0.88rem;
  color: var(--muted-strong);
}

.upload-control input,
.field input {
  width: 100%;
}

.field input,
.upload-control input::file-selector-button,
.primary-button,
.secondary-button,
.search-results button {
  font: inherit;
}

.field input,
.upload-control input {
  min-height: 46px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.upload-control input::file-selector-button {
  margin-right: 12px;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: rgba(214, 208, 196, 0.16);
  color: var(--text);
  cursor: pointer;
}

.location-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.location-config-header {
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.location-config-card .helper-message {
  width: 100%;
}

.search-grid {
  gap: 12px;
  align-items: flex-end;
  margin-top: 16px;
}

.field {
  flex: 1 1 auto;
}

.search-grid .primary-button {
  flex: 0 0 auto;
  min-width: 112px;
}

.search-results {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.search-results button {
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.035);
  text-align: left;
  cursor: pointer;
}

.search-results strong {
  margin-bottom: 3px;
}

.search-results small {
  color: var(--muted);
  line-height: 1.45;
}

.primary-button,
.secondary-button {
  min-height: 46px;
  padding: 12px 18px;
  cursor: pointer;
}

.primary-button {
  background: rgba(214, 208, 196, 0.14);
  color: var(--text);
}

.secondary-button {
  background: transparent;
  color: var(--muted-strong);
}

.settings-actions {
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-top: 18px;
}

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

.helper-message[data-state="error"] {
  color: var(--danger);
}

.helper-message[data-state="success"] {
  color: var(--accent);
}

@media (max-width: 1100px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 22px;
    padding: 48px 0 28px;
  }

  .clock-panel {
    padding-right: 0;
  }
}

@media (max-width: 860px) {
  .weather-grid,
  .location-settings-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .dashboard {
    width: min(100% - 34px, 700px);
    padding-top: 12px;
    padding-bottom: 16px;
  }

  .clock-row {
    gap: 7px;
    align-items: baseline;
  }

  .topbar {
    margin-bottom: 2px;
  }

  .brand-link {
    min-height: 40px;
  }

  .brand-text {
    font-size: 0.86rem;
    letter-spacing: 0.16em;
  }

  .icon-button {
    width: 44px;
    height: 44px;
  }

  .hero {
    gap: 12px;
    padding: 18px 0 14px;
  }

  .clock-display {
    font-size: clamp(3.35rem, 16vw, 4.55rem);
    line-height: 0.86;
  }

  .clock-separator {
    margin: 0 0.04em;
  }

  .seconds {
    margin-top: 0.18em;
    font-size: 1.12rem;
  }

  .date {
    margin-top: 10px;
    font-size: 0.9rem;
    line-height: 1.28;
  }

  .weather-card,
  .settings-section {
    padding: 14px;
  }

  .weather-main,
  .search-grid,
  .settings-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .weather-header {
    gap: 10px;
  }

  .weather-header .eyebrow {
    display: none;
  }

  .weather-header h2 {
    font-size: 1rem;
    line-height: 1.15;
  }

  .weather-subtitle,
  .weather-meta,
  .weather-description,
  .weather-status,
  .weather-updated {
    font-size: 0.78rem;
    line-height: 1.3;
  }

  .weather-subtitle,
  .weather-meta {
    margin-top: 4px;
  }

  .weather-main {
    margin-top: 10px;
    gap: 8px;
  }

  .temperature {
    font-size: clamp(2.55rem, 10.8vw, 3.1rem);
    line-height: 0.9;
  }

  .weather-range {
    gap: 4px;
    text-align: left;
    font-size: 0.76rem;
    line-height: 1.25;
  }

  .weather-details {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin-top: 10px;
    padding-top: 10px;
  }

  .weather-details div {
    min-width: 0;
    text-align: center;
  }

  .weather-details span {
    margin-bottom: 2px;
    font-size: 0.64rem;
    line-height: 1.2;
  }

  .weather-details strong {
    font-size: 0.74rem;
    line-height: 1.15;
  }

  .weather-footer {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
  }

  .weather-status {
    min-height: 0;
    flex: 1 1 auto;
  }

  .weather-updated {
    min-height: 0;
    text-align: right;
    flex: 0 0 auto;
  }

  .preset-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .settings-form {
    padding: 20px;
  }

  .site-footer {
    gap: 10px;
    padding-top: 10px;
    font-size: 0.7rem;
  }
}

@media (max-width: 430px) {
  .dashboard {
    width: min(100% - 28px, 700px);
  }

  .clock-display {
    font-size: clamp(3.08rem, 15.4vw, 4.1rem);
  }

  .weather-card {
    padding: 13px;
  }

  .weather-icon {
    width: 46px;
    height: 46px;
    border-radius: 13px;
  }

  .weather-icon-clear .weather-icon-core {
    width: 16px;
    height: 16px;
    top: 15px;
    left: 15px;
    box-shadow: 0 0 0 5px rgba(214, 208, 196, 0.08);
  }

  .weather-icon-partly .weather-icon-core,
  .weather-icon-cloudy .weather-icon-core,
  .weather-icon-fog .weather-icon-core,
  .weather-icon-rain .weather-icon-core,
  .weather-icon-storm .weather-icon-core,
  .weather-icon-snow .weather-icon-core {
    width: 22px;
    height: 13px;
    left: 12px;
    top: 17px;
  }

  .weather-icon-fog .weather-icon-accent,
  .weather-icon-rain .weather-icon-accent,
  .weather-icon-storm .weather-icon-accent,
  .weather-icon-snow .weather-icon-accent {
    width: 22px;
    left: 12px;
  }

  .weather-icon-fog .weather-icon-accent,
  .weather-icon-rain .weather-icon-accent,
  .weather-icon-storm .weather-icon-accent,
  .weather-icon-snow .weather-icon-accent {
    top: 32px;
  }

  .site-footer {
    gap: 8px;
  }
}

@media (max-width: 375px) {
  .dashboard {
    width: min(100% - 22px, 700px);
    padding-top: 10px;
  }

  .hero {
    padding-top: 16px;
  }

  .clock-display {
    font-size: clamp(2.92rem, 14.8vw, 3.8rem);
  }

  .seconds {
    font-size: 1rem;
  }

  .date {
    font-size: 0.84rem;
  }

  .weather-details span {
    font-size: 0.64rem;
  }

  .weather-details strong {
    font-size: 0.74rem;
  }
}
