* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #7c83ff;
  --primary-light: #a5adff;
  --secondary: #9b8cff;
  --accent: #22d3ee;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;

  --bg-primary: #f4f7fb;
  --bg-secondary: #ffffff;
  --bg-tertiary: #eef2f7;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-tertiary: #64748b;
  --border: #dbe4f0;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 12px 30px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 18px 42px rgba(15, 23, 42, 0.12);
  --shadow-xl: 0 28px 64px rgba(15, 23, 42, 0.18);
}

[data-theme="dark"] {
  --primary: #8f8bff;
  --primary-light: #afb2ff;
  --secondary: #b69cff;
  --accent: #3dd5f3;
  --success: #34d399;
  --warning: #fbbf24;
  --danger: #f87171;

  --bg-primary: #09101f;
  --bg-secondary: #182235;
  --bg-tertiary: #233247;
  --text-primary: #edf2ff;
  --text-secondary: #c3cee0;
  --text-tertiary: #98a6bd;
  --border: rgba(148, 163, 184, 0.18);
  --shadow-sm: 0 1px 2px rgba(2, 6, 23, 0.24);
  --shadow-md: 0 12px 30px rgba(2, 6, 23, 0.34);
  --shadow-lg: 0 20px 44px rgba(2, 6, 23, 0.42);
  --shadow-xl: 0 28px 64px rgba(2, 6, 23, 0.52);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  min-height: 100vh;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-primary);
}

[data-theme="dark"] body {
  background:
    radial-gradient(circle at top left, rgba(124, 131, 255, 0.18), transparent 28%),
    radial-gradient(circle at top right, rgba(61, 213, 243, 0.12), transparent 24%),
    linear-gradient(180deg, #09101f 0%, #0d1524 55%, #09101f 100%);
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 64px 64px;
  opacity: 0.35;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border);
  background: rgba(18, 27, 44, 0.82);
  backdrop-filter: blur(18px);
  box-shadow: 0 12px 28px rgba(2, 6, 23, 0.18);
}

.site-header--compact {
  background: rgba(18, 27, 44, 0.9);
}

.header-content {
  max-width: 1600px;
  margin: 0 auto;
  padding: 1.25rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.auth-widget {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
  min-width: 320px;
}

.auth-form,
.auth-widget__user {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  width: 100%;
}

.auth-form__input {
  width: 118px;
  min-width: 0;
  padding: 0.52rem 0.7rem;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 12px;
  background: rgba(8, 15, 29, 0.72);
  color: #f8fafc;
  font: inherit;
  font-size: 0.85rem;
}

.auth-form__input:focus {
  outline: none;
  border-color: rgba(124, 131, 255, 0.72);
  box-shadow: 0 0 0 3px rgba(124, 131, 255, 0.13);
}

.auth-widget__user span {
  max-width: 180px;
  overflow: hidden;
  color: #f8fbff;
  font-size: 0.9rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-widget__status {
  min-height: 1rem;
  max-width: 320px;
  color: var(--text-tertiary);
  font-size: 0.78rem;
  line-height: 1.25;
  text-align: right;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex: 1;
}

h1 {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--primary-light);
  white-space: nowrap;
  animation: fadeIn 0.5s ease;
}

.search {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  max-width: 760px;
  flex-wrap: nowrap;
}

.search__input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.8rem 1.1rem;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 14px;
  background: rgba(8, 15, 29, 0.72);
  color: #f8fafc;
  font-size: 0.98rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.search__input::placeholder {
  color: #8a98b2;
}

.search__input:focus {
  outline: none;
  border-color: rgba(124, 131, 255, 0.72);
  box-shadow: 0 0 0 4px rgba(124, 131, 255, 0.15);
  transform: translateY(-1px);
}

#unitSelect,
#daysSelect {
  flex: 0 0 auto;
  min-width: 92px;
  white-space: nowrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.78rem 1.15rem;
  border: 0;
  border-radius: 14px;
  font-family: inherit;
  font-size: 0.96rem;
  font-weight: 700;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, opacity 0.2s ease;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn--primary {
  color: #fff;
  background: linear-gradient(135deg, #9b8cff 0%, #7c83ff 100%);
  box-shadow: 0 14px 24px rgba(124, 131, 255, 0.22);
  white-space: nowrap;
}

.btn--secondary {
  color: #e6ebf5;
  background: rgba(76, 95, 125, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.16);
}

.btn--secondary:hover {
  background: rgba(92, 111, 141, 0.72);
}

.btn--danger {
  color: #ffd7d7;
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(239, 68, 68, 0.28);
}

.btn--small {
  padding: 0.52rem 0.9rem;
  font-size: 0.85rem;
  border-radius: 12px;
}

.compact-search-icon {
  display: none;
}

.theme-toggle {
  width: 62px;
  height: 32px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: rgba(59, 77, 106, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.18);
  cursor: pointer;
  position: relative;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.theme-toggle::before {
  content: '🌙';
  position: absolute;
  top: 3px;
  left: 33px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  background: linear-gradient(135deg, #9b8cff 0%, #7c83ff 100%);
  box-shadow: 0 8px 16px rgba(124, 131, 255, 0.25);
}

[data-theme="light"] .theme-toggle::before {
  content: '☀️';
  left: 3px;
}

.container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 1.75rem 2rem 2.5rem;
}

.loading,
.error {
  max-width: 720px;
  margin: 1.5rem auto;
  border-radius: 24px;
  padding: 2.5rem;
  text-align: center;
  box-shadow: var(--shadow-md);
}

.loading {
  background: rgba(24, 34, 53, 0.9);
  border: 1px solid var(--border);
  animation: pulse 1.8s ease-in-out infinite;
}

.loading::before {
  content: '⏳';
  display: block;
  margin-bottom: 0.85rem;
  font-size: 2.75rem;
  animation: spin 1.8s linear infinite;
}

.loading p {
  color: var(--text-secondary);
  font-weight: 600;
}

.error {
  background: rgba(127, 29, 29, 0.18);
  border: 1px solid rgba(248, 113, 113, 0.38);
}

.error p {
  color: #fecaca;
  font-weight: 700;
}

.weather-brief {
  position: relative;
  overflow: hidden;
  margin-bottom: 1.5rem;
  padding: 2rem 2rem 2.1rem;
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(27, 38, 60, 0.96) 0%, rgba(22, 31, 49, 0.96) 100%);
  border: 1px solid rgba(148, 163, 184, 0.16);
  box-shadow: 0 22px 50px rgba(2, 6, 23, 0.32);
  animation: fadeIn 0.55s ease;
}

.weather-brief::before {
  content: '';
  position: absolute;
  inset: 1px;
  border-radius: inherit;
  background:
    radial-gradient(circle at top left, rgba(61, 213, 243, 0.12), transparent 28%),
    radial-gradient(circle at top right, rgba(249, 115, 22, 0.1), transparent 26%);
  pointer-events: none;
}

.weather-brief > * {
  position: relative;
  z-index: 1;
}

.weather-brief__head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  padding-bottom: 1rem;
  margin-bottom: 1.1rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.weather-brief__eyebrow {
  color: #aeb9cb;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.83rem;
  font-weight: 800;
  margin-bottom: 0.25rem;
}

.weather-brief__head h3 {
  font-size: 1.65rem;
  line-height: 1.1;
  color: #f8fbff;
  letter-spacing: -0.02em;
}

.weather-brief__badge {
  flex: 0 0 auto;
  padding: 0.52rem 0.95rem;
  border-radius: 999px;
  border: 1px solid rgba(249, 115, 22, 0.45);
  background: rgba(249, 115, 22, 0.14);
  color: #f59e0b;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.weather-brief__badge--low {
  border-color: rgba(34, 197, 94, 0.34);
  background: rgba(34, 197, 94, 0.12);
  color: #4ade80;
}

.weather-brief__badge--moderate {
  border-color: rgba(249, 115, 22, 0.45);
  background: rgba(249, 115, 22, 0.14);
  color: #f59e0b;
}

.weather-brief__badge--elevated {
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.14);
  color: #f87171;
}

.weather-brief__headline {
  color: #edf2ff;
  font-size: 1.12rem;
  font-weight: 700;
  line-height: 1.45;
  margin-bottom: 1.35rem;
}

.weather-brief__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.weather-brief__section {
  min-width: 0;
  padding: 1rem 1rem 0.95rem;
  border-radius: 20px;
  background: rgba(9, 16, 31, 0.88);
  border: 1px solid rgba(148, 163, 184, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.weather-brief__section h4 {
  margin-bottom: 0.75rem;
  color: #c8d2e5;
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.weather-brief__section ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.weather-brief__section li {
  position: relative;
  padding-left: 1rem;
  color: #f8fbff;
  font-size: 0.97rem;
  line-height: 1.45;
}

.weather-brief__section li::before {
  content: '';
  position: absolute;
  top: 0.58rem;
  left: 0;
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  background: var(--accent);
}

.layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

.left,
.right {
  min-width: 0;
}

.card {
  border-radius: 24px;
  padding: 1.9rem;
  background: linear-gradient(180deg, rgba(27, 38, 60, 0.96) 0%, rgba(21, 30, 47, 0.96) 100%);
  border: 1px solid rgba(148, 163, 184, 0.16);
  box-shadow: 0 18px 42px rgba(2, 6, 23, 0.28);
}

.card:hover {
  box-shadow: 0 24px 60px rgba(2, 6, 23, 0.36);
}

.current {
  position: relative;
  overflow: hidden;
  margin-bottom: 1rem;
}

.current__meta-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.45rem;
}

.current__place {
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.05;
  color: #f8fbff;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.current__date {
  color: var(--text-secondary);
  margin-bottom: 1.8rem;
}

.current__temp {
  display: flex;
  align-items: center;
  gap: 1.4rem;
}

.current__icon {
  font-size: clamp(4rem, 6vw, 6.5rem);
  filter: drop-shadow(0 10px 18px rgba(2, 6, 23, 0.25));
  animation: float 3s ease-in-out infinite;
}

.current__value {
  font-size: clamp(3rem, 6vw, 5.25rem);
  line-height: 1;
  font-weight: 800;
  color: #f8fbff;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin: 1rem 0 1.25rem;
}

.stat {
  min-width: 0;
  padding: 1.1rem 1rem;
  border-radius: 20px;
  background: rgba(9, 16, 31, 0.88);
  border: 1px solid rgba(148, 163, 184, 0.14);
}

.stat__label {
  margin-bottom: 0.45rem;
  color: #9fb0c8;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stat__value {
  color: #f8fbff;
  font-size: 1.65rem;
  font-weight: 800;
}

.daily {
  margin-top: 1rem;
}

.section-title {
  margin-bottom: 1rem;
  color: #f8fbff;
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.daily__list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.day {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.15rem;
  border-radius: 18px;
  background: rgba(9, 16, 31, 0.86);
  border: 1px solid rgba(148, 163, 184, 0.14);
}

.day__name {
  min-width: 84px;
  color: var(--text-secondary);
  font-weight: 700;
}

.day__icon {
  font-size: 1.8rem;
}

.day__temps {
  display: flex;
  gap: 0.8rem;
  align-items: baseline;
  margin-left: auto;
}

.day__temps strong {
  color: #f8fbff;
}

.day__temps span {
  color: var(--text-tertiary);
}

.panel {
  margin-bottom: 1rem;
}

.panel__head {
  padding-bottom: 0.85rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
}

.panel__head h3 {
  color: #f8fbff;
  font-size: 1.06rem;
  font-weight: 800;
}

.favorites,
.hourly,
.videos {
  list-style: none;
}

.favorites__empty,
.videos__empty {
  padding: 1.5rem 1rem;
  text-align: center;
  color: var(--text-tertiary);
  font-style: italic;
}

.favorites__item {
  padding: 1rem;
  margin-bottom: 0.75rem;
  border-radius: 18px;
  background: rgba(9, 16, 31, 0.86);
  border: 1px solid rgba(148, 163, 184, 0.14);
}

.favorites__name {
  display: block;
  margin-bottom: 0.75rem;
  color: #f8fbff;
  font-weight: 700;
}

.favorites__actions {
  display: flex;
  gap: 0.5rem;
}

.hour {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  margin-bottom: 0.6rem;
  border-radius: 16px;
  background: rgba(9, 16, 31, 0.86);
  border: 1px solid rgba(148, 163, 184, 0.14);
}

.hour__time {
  min-width: 68px;
  color: var(--text-secondary);
  font-weight: 700;
}

.hour__icon {
  font-size: 1.6rem;
}

.hour__temp {
  color: #f8fbff;
  font-weight: 800;
}

.video-card {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 1rem;
  margin-bottom: 0.9rem;
  border-radius: 18px;
  background: rgba(9, 16, 31, 0.86);
  border: 1px solid rgba(148, 163, 184, 0.14);
}

.video-card__thumbnail {
  width: 150px;
  height: 96px;
  object-fit: cover;
  border-radius: 14px;
  flex-shrink: 0;
}

.video-card__content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.video-card__title {
  color: #f8fbff;
  font-size: 1rem;
  line-height: 1.35;
}

.video-card__meta {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  color: var(--text-tertiary);
  font-size: 0.84rem;
}

.video-card__channel {
  color: var(--text-secondary);
  font-weight: 700;
}

.video-card__link {
  margin-top: 0.3rem;
  width: fit-content;
  padding: 0.5rem 0.85rem;
  border-radius: 10px;
  color: #fff;
  text-decoration: none;
  background: linear-gradient(135deg, #9b8cff 0%, #7c83ff 100%);
  box-shadow: 0 12px 20px rgba(124, 131, 255, 0.18);
}

.site-footer {
  margin-top: 2.5rem;
  padding: 1.5rem 1rem 2rem;
  text-align: center;
  color: var(--text-tertiary);
}

::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: rgba(9, 16, 31, 0.85);
}

::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.34);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(124, 131, 255, 0.55);
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .weather-brief__grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    align-items: stretch;
  }

  .auth-widget {
    align-items: stretch;
    min-width: 0;
  }

  .auth-form,
  .auth-widget__user {
    flex-wrap: wrap;
    justify-content: stretch;
  }

  .auth-form__input {
    flex: 1 1 calc(50% - 0.35rem);
    width: auto;
  }

  .auth-widget .btn {
    flex: 1 1 calc(50% - 0.35rem);
  }

  .auth-widget__status {
    max-width: none;
    text-align: left;
  }

  .header-left {
    flex-direction: column;
    align-items: stretch;
  }

  h1 {
    font-size: 1.45rem;
  }

  .search {
    flex-wrap: wrap;
    max-width: none;
  }

  .search__input,
  #unitSelect,
  #daysSelect,
  .btn--primary {
    width: 100%;
  }

  #unitSelect,
  #daysSelect {
    flex: 1 1 calc(50% - 0.4rem);
  }

  .btn--primary {
    flex: 1 1 100%;
  }

  .theme-toggle {
    align-self: flex-end;
  }

  .container {
    padding: 1rem;
  }

  .weather-brief,
  .card {
    padding: 1.25rem;
    border-radius: 20px;
  }

  .weather-brief__head {
    flex-direction: column;
  }

  .stats {
    grid-template-columns: 1fr;
  }

  .current__temp {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .video-card {
    flex-direction: column;
  }

  .video-card__thumbnail {
    width: 100%;
    height: 180px;
  }
}
