/* Регистрируем CSS-переменные цвета неба через @property для плавного градиентного перехода */
@property --sky-top {
  syntax: '<color>';
  inherits: true;
  initial-value: #020617;
}
@property --sky-mid {
  syntax: '<color>';
  inherits: true;
  initial-value: #0f172a;
}
@property --sky-bottom {
  syntax: '<color>';
  inherits: true;
  initial-value: #1e1b4b;
}
@property --horizon-glow {
  syntax: '<color>';
  inherits: true;
  initial-value: rgba(99, 102, 241, 0.22);
}

:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --sky-ease: 2.3s cubic-bezier(0.22, 1, 0.36, 1);
  --weather-ease: 1.8s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ==================== СВЕТЛАЯ ТЕМА КАРТОЧЕК (УТРО / ДЕНЬ) ==================== */
html[data-theme="light"] {
  --card-bg: rgba(255, 255, 255, 0.56);
  --card-bg-hover: rgba(255, 255, 255, 0.72);
  --card-shadow: 0 14px 36px -8px rgba(15, 23, 42, 0.12), 0 4px 12px rgba(15, 23, 42, 0.05);

  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;

  --item-bg: rgba(255, 255, 255, 0.58);
  --item-border: rgba(255, 255, 255, 0.45);

  --accent-color: #0284c7;
  --positive-color: #059669;
  --positive-bg: rgba(16, 185, 129, 0.15);
  --negative-color: #dc2626;
  --negative-bg: rgba(239, 68, 68, 0.15);
}

/* ==================== ТЕМНАЯ ТЕМА КАРТОЧЕК (ВЕЧЕР / НОЧЬ) ==================== */
html[data-theme="dark"] {
  --card-bg: rgba(15, 23, 42, 0.56);
  --card-bg-hover: rgba(15, 23, 42, 0.72);
  --card-shadow: 0 18px 44px -10px rgba(0, 0, 0, 0.5);

  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;

  --item-bg: rgba(30, 41, 59, 0.56);
  --item-border: rgba(148, 163, 184, 0.12);

  --accent-color: #38bdf8;
  --positive-color: #34d399;
  --positive-bg: rgba(16, 185, 129, 0.16);
  --negative-color: #f87171;
  --negative-bg: rgba(239, 68, 68, 0.16);
}

/* ==================== 4 ВРЕМЕНИ СУТОК НА ФОНЕ ГЛАВНОЙ СТРАНИЦЫ ==================== */
html[data-day-phase="morning"] {
  --sky-top: #1d4ed8;
  --sky-mid: #38bdf8;
  --sky-bottom: #fed7aa;
  --horizon-glow: rgba(251, 146, 60, 0.65);
}

html[data-day-phase="day"] {
  --sky-top: #0284c7;
  --sky-mid: #38bdf8;
  --sky-bottom: #bae6fd;
  --horizon-glow: rgba(254, 240, 138, 0.42);
}

html[data-day-phase="evening"] {
  --sky-top: #0f172a;
  --sky-mid: #4c1d95;
  --sky-bottom: #ea580c;
  --horizon-glow: rgba(249, 115, 22, 0.68);
}

html[data-day-phase="night"] {
  --sky-top: #020617;
  --sky-mid: #0f172a;
  --sky-bottom: #1e1b4b;
  --horizon-glow: rgba(99, 102, 241, 0.22);
}

/* ==================== СБРОС И FULL-SCREEN МАСШТАБ ==================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  max-width: 100vw;
  height: 100vh;
  overflow: hidden;
  font-family: var(--font-sans);
  color: var(--text-primary);
  user-select: none;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  transition:
    --sky-top var(--sky-ease),
    --sky-mid var(--sky-ease),
    --sky-bottom var(--sky-ease),
    --horizon-glow var(--sky-ease),
    color 0.6s ease;
}

/* ==================== АНИМИРОВАННОЕ НЕБО И ПОГОДНЫЕ СЛОИ ==================== */
.sky-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 58%, var(--sky-bottom) 100%);
  overflow: hidden;
}

.overcast-veil {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.72) 0%, rgba(51, 65, 85, 0.58) 60%, rgba(71, 85, 105, 0.48) 100%);
  transition: opacity var(--weather-ease);
  z-index: 2;
}

html[data-weather-fx="partly-cloudy"] .overcast-veil {
  opacity: 0.16;
}

html[data-weather-fx="overcast"] .overcast-veil {
  opacity: 0.68;
}

html[data-weather-fx="thunder"] .overcast-veil {
  opacity: 0.84;
}

.lightning-flash {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 20%, rgba(224, 242, 254, 0.82), rgba(186, 230, 253, 0.22) 60%, transparent 100%);
  opacity: 0;
  pointer-events: none;
  z-index: 4;
  transition: opacity 0.14s ease-out;
}

.lightning-flash.strike {
  opacity: 0.85;
}

#starsCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity var(--sky-ease);
  pointer-events: none;
  z-index: 1;
}

html[data-day-phase="night"] #starsCanvas {
  opacity: 1;
}

html[data-day-phase="evening"] #starsCanvas {
  opacity: 0.42;
}

html[data-weather-fx="overcast"] #starsCanvas,
html[data-weather-fx="thunder"] #starsCanvas {
  opacity: 0.12 !important;
}

.horizon-glow {
  position: absolute;
  bottom: -18vh;
  left: 8%;
  right: 8%;
  height: 45vh;
  border-radius: 50%;
  background: radial-gradient(circle, var(--horizon-glow) 0%, transparent 70%);
  filter: blur(45px);
  transition: transform var(--sky-ease), opacity var(--sky-ease);
  pointer-events: none;
  z-index: 1;
}

.celestial-orbit {
  position: absolute;
  left: 50%;
  bottom: -35vh;
  width: 86vw;
  height: 115vh;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 1;
}

/* СОЛНЦЕ */
.sun {
  position: absolute;
  left: 50%;
  top: 12%;
  width: 96px;
  height: 96px;
  margin-left: -48px;
  border-radius: 50%;
  will-change: transform, opacity, filter;
  transition:
    transform var(--sky-ease),
    opacity var(--sky-ease),
    filter var(--sky-ease);
}

.sun-core {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fffbeb 0%, #fde047 45%, #f59e0b 85%, #ea580c 100%);
  box-shadow:
    0 0 60px 18px rgba(251, 191, 36, 0.65),
    0 0 130px 45px rgba(245, 158, 11, 0.35);
}

.sun-corona {
  position: absolute;
  inset: -24px;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    rgba(254, 240, 138, 0.35) 20deg,
    transparent 40deg,
    rgba(254, 240, 138, 0.3) 80deg,
    transparent 110deg,
    rgba(254, 240, 138, 0.35) 160deg,
    transparent 200deg,
    rgba(254, 240, 138, 0.3) 250deg,
    transparent 290deg,
    rgba(254, 240, 138, 0.35) 330deg,
    transparent 360deg
  );
  filter: blur(8px);
  animation: spinCorona 32s linear infinite;
}

@keyframes spinCorona {
  to { transform: rotate(360deg); }
}

html[data-day-phase="morning"] .sun {
  transform: translate3d(-24vw, 22vh, 0) scale(0.95);
  opacity: 0.95;
  filter: hue-rotate(-8deg);
}

html[data-day-phase="day"] .sun {
  transform: translate3d(0, 0, 0) scale(1);
  opacity: 1;
  filter: hue-rotate(0deg);
}

html[data-day-phase="evening"] .sun {
  transform: translate3d(24vw, 28vh, 0) scale(1.05);
  opacity: 0.92;
  filter: hue-rotate(-22deg) saturate(1.35);
}

html[data-day-phase="night"] .sun {
  transform: translate3d(30vw, 68vh, 0) scale(0.75);
  opacity: 0;
  filter: hue-rotate(-25deg);
}

html[data-weather-fx="overcast"] .sun,
html[data-weather-fx="thunder"] .sun {
  opacity: 0.16 !important;
  filter: blur(12px) grayscale(0.35);
}

/* ЛУНА */
.moon {
  position: absolute;
  left: 52%;
  top: 13%;
  width: 82px;
  height: 82px;
  margin-left: -41px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, #ffffff 0%, #e2e8f0 55%, #94a3b8 100%);
  box-shadow:
    inset -12px -10px 20px rgba(15, 23, 42, 0.35),
    0 0 45px 10px rgba(226, 232, 240, 0.35),
    0 0 100px 30px rgba(56, 189, 248, 0.16);
  will-change: transform, opacity, filter;
  transition:
    transform var(--sky-ease),
    opacity var(--sky-ease),
    filter var(--sky-ease);
}

.moon-crater {
  position: absolute;
  border-radius: 50%;
  background: rgba(100, 116, 139, 0.25);
  box-shadow: inset 1px 2px 3px rgba(15, 23, 42, 0.35);
}

.moon-crater.c1 { width: 18px; height: 18px; top: 22px; left: 20px; }
.moon-crater.c2 { width: 12px; height: 12px; top: 46px; left: 42px; }
.moon-crater.c3 { width: 9px; height: 9px; top: 24px; left: 50px; }

html[data-day-phase="night"] .moon {
  transform: translate3d(0, 0, 0) rotate(0deg) scale(1);
  opacity: 1;
}

html[data-day-phase="evening"] .moon {
  transform: translate3d(-22vw, 18vh, 0) rotate(-12deg) scale(0.84);
  opacity: 0.45;
}

html[data-day-phase="morning"] .moon,
html[data-day-phase="day"] .moon {
  transform: translate3d(-26vw, 65vh, 0) rotate(-35deg) scale(0.7);
  opacity: 0;
}

html[data-weather-fx="overcast"] .moon,
html[data-weather-fx="thunder"] .moon {
  opacity: 0.2 !important;
  filter: blur(8px);
}

/* ==================== ОБЛАКА И ТУЧИ ==================== */
.ambient-clouds {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 3;
}

.cloud {
  position: absolute;
  border-radius: 999px;
  filter: blur(28px);
  transition: background var(--weather-ease), opacity var(--weather-ease);
}

html[data-theme="light"] .cloud {
  background: rgba(255, 255, 255, 0.68);
}

html[data-theme="dark"] .cloud {
  background: rgba(51, 65, 85, 0.55);
}

.cloud-1 { width: 420px; height: 95px; top: 10%; left: 10%; animation: driftCloud 38s ease-in-out infinite alternate; }
.cloud-2 { width: 480px; height: 115px; top: 18%; right: 10%; animation: driftCloud 46s ease-in-out infinite alternate-reverse; }
.cloud-3 { width: 560px; height: 130px; top: 6%; left: 32%; animation: driftCloud 42s ease-in-out infinite alternate; opacity: 0; }
.cloud-4 { width: 620px; height: 140px; top: 26%; left: -4%; animation: driftCloud 50s ease-in-out infinite alternate-reverse; opacity: 0; }
.cloud-5 { width: 580px; height: 135px; top: 24%; right: -4%; animation: driftCloud 44s ease-in-out infinite alternate; opacity: 0; }

html[data-weather-fx="clear"] .cloud-1,
html[data-weather-fx="clear"] .cloud-2,
html[data-weather-fx="rain"] .cloud-1,
html[data-weather-fx="rain"] .cloud-2 {
  opacity: 0.22;
}

html[data-weather-fx="partly-cloudy"] .cloud-1,
html[data-weather-fx="partly-cloudy"] .cloud-2,
html[data-weather-fx="partly-cloudy"] .cloud-3 {
  opacity: 0.6;
}

html[data-weather-fx="overcast"] .cloud {
  opacity: 0.86;
  background: rgba(100, 116, 139, 0.7);
}

html[data-weather-fx="thunder"] .cloud {
  opacity: 0.94;
  background: rgba(30, 41, 59, 0.85);
}

@keyframes driftCloud {
  from { transform: translateX(-45px); }
  to { transform: translateX(55px); }
}

/* ==================== СЛОЙ ТУМАНА (FOG) ==================== */
.fog-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--weather-ease);
  z-index: 4;
}

html[data-weather-fx="fog"] .fog-layer {
  opacity: 1;
}

.fog-band {
  position: absolute;
  left: -20%;
  right: -20%;
  height: 36vh;
  background: linear-gradient(180deg, transparent 0%, rgba(203, 213, 225, 0.42) 50%, transparent 100%);
  filter: blur(32px);
}

.fog-band-1 {
  bottom: 8%;
  animation: fogFlow 26s ease-in-out infinite alternate;
}

.fog-band-2 {
  top: 28%;
  animation: fogFlow 34s ease-in-out infinite alternate-reverse;
}

@keyframes fogFlow {
  from { transform: translateX(-6%); }
  to { transform: translateX(6%); }
}

/* ==================== ХОЛСТ ОСАДКОВ НА ВЕСЬ ЭКРАН ==================== */
.rain-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 5;
  pointer-events: none;
}

/* ==================== ОСНОВНАЯ СЕТКА ДАШБОРДА ==================== */
.dashboard-viewport {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 100vw;
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 16px 28px 18px;
  gap: 12px;
}

/* ==================== ВЕРХНЯЯ ПАНЕЛЬ ==================== */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.brand-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  box-shadow: var(--card-shadow);
  flex-shrink: 0;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 10px #10b981;
  animation: pulseDot 2.4s infinite;
  flex-shrink: 0;
}

@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.25); opacity: 0.65; }
}

.brand-title {
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: var(--item-bg);
  color: var(--text-secondary);
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.3s ease, color 0.2s ease, background 0.2s ease;
}

.icon-btn:hover {
  color: var(--accent-color);
  transform: rotate(90deg);
}

.top-right-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

/* Переключатель языка [RU | EN] */
.lang-segmented-control {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 4px;
  border-radius: 999px;
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  box-shadow: var(--card-shadow);
  flex-shrink: 0;
}

.lang-seg-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.25s ease;
}

.lang-seg-btn:hover {
  color: var(--text-primary);
}

.lang-seg-btn.active {
  background: var(--item-bg);
  color: var(--accent-color);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

/* Сегментированный переключатель [День | Ночь | Авто] */
.mode-segmented-control {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px;
  border-radius: 999px;
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--card-shadow);
}

.mode-seg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background 0.35s cubic-bezier(0.22, 1, 0.36, 1),
    color 0.3s ease,
    box-shadow 0.35s ease;
}

.mode-seg-btn:hover {
  color: var(--text-primary);
}

.mode-seg-btn.active {
  background: var(--item-bg);
  color: var(--text-primary);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.14);
}

.mode-seg-btn[data-sky-mode="auto"].active {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.28), rgba(37, 99, 235, 0.28));
  box-shadow: 0 4px 16px rgba(14, 165, 233, 0.22);
}

.mode-seg-svg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-color);
}

.mode-seg-btn[data-sky-mode="day"] .mode-seg-svg {
  color: #f59e0b;
}

.mode-seg-btn[data-sky-mode="night"] .mode-seg-svg {
  color: #38bdf8;
}

/* ==================== ТРЕХКОЛОНОЧНАЯ РАБОЧАЯ ЗОНА ==================== */
.widgets-grid {
  display: grid;
  grid-template-columns: minmax(320px, 390px) 1fr minmax(320px, 405px);
  gap: 24px;
  align-items: start;
  min-height: 0;
  height: 100%;
  width: 100%;
}

.column {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 100%;
  min-height: 0;
  min-width: 0;
  width: 100%;
}

.column-left {
  overflow-y: auto;
  padding: 4px 6px 8px 2px;
  scrollbar-width: thin;
}

.column-left::-webkit-scrollbar {
  width: 4px;
}

.column-left::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.35);
  border-radius: 99px;
}

.column-right {
  overflow: visible;
  padding: 2px;
}

/* ==================== КАРТОЧКИ ВИДЖЕТОВ ==================== */
.widget-card {
  width: 100%;
  min-width: 0;
  background: var(--card-bg);
  border: none;
  outline: none;
  border-radius: 22px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--card-shadow);
  overflow: hidden;
  transition: background 0.45s ease, box-shadow 0.45s ease;
}

.widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.widget-header:hover {
  background: rgba(255, 255, 255, 0.04);
}

.header-right-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.mini-refresh-btn {
  width: 26px;
  height: 26px;
  border-radius: 8px;
}

.widget-title-group {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.widget-badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 5px 8px;
  border-radius: 8px;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.fiat-badge {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
}

.crypto-badge {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #ffffff;
}

.news-badge {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
}

.widget-title {
  font-size: 0.94rem;
  font-weight: 600;
}

.widget-subtitle {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.collapse-btn {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: none;
  background: var(--item-bg);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), background 0.2s ease;
}

.collapsible-widget.is-collapsed .collapse-btn {
  transform: rotate(-90deg);
}

.widget-body {
  padding: 0 14px 13px;
  max-height: 360px;
  opacity: 1;
  overflow: hidden;
  transition: max-height 0.42s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s ease, padding 0.3s ease;
}

.collapsible-widget.is-collapsed .widget-body {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
}

/* ==================== СПИСКИ КУРСОВ ВАЛЮТ И КРИПТЫ ==================== */
.rates-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rate-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 11px;
  border-radius: 13px;
  background: var(--item-bg);
  transition: transform 0.18s ease, background 0.2s ease;
}

.rate-row:hover {
  transform: translateX(3px);
}

.rate-asset {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.asset-symbol-icon {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.84rem;
  color: #fff;
  flex-shrink: 0;
}

.asset-name {
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.asset-code {
  font-size: 0.69rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.rate-values {
  text-align: right;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.rate-price {
  font-family: var(--font-mono);
  font-size: 0.84rem;
  font-weight: 600;
  white-space: nowrap;
}

.rate-change {
  font-family: var(--font-mono);
  font-size: 0.71rem;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 7px;
  min-width: 56px;
  text-align: center;
  flex-shrink: 0;
}

.rate-change.up {
  color: var(--positive-color);
  background: var(--positive-bg);
}

.rate-change.down {
  color: var(--negative-color);
  background: var(--negative-bg);
}

.rate-change.neutral {
  color: var(--text-muted);
  background: rgba(148, 163, 184, 0.14);
}

/* ==================== ВИДЖЕТ НОВОСТЕЙ ==================== */
.news-region-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  margin-bottom: 9px;
}

.region-tab {
  border: none;
  background: var(--item-bg);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.71rem;
  font-weight: 600;
  padding: 6px 4px;
  border-radius: 9px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.region-tab:hover {
  color: var(--text-primary);
}

.region-tab.active {
  background: rgba(56, 189, 248, 0.26);
  color: var(--text-primary);
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.5);
}

.news-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 195px;
  overflow-y: auto;
  padding-right: 3px;
  scrollbar-width: thin;
}

.news-list::-webkit-scrollbar {
  width: 4px;
}

.news-list::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.35);
  border-radius: 99px;
}

.news-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--item-bg);
  text-decoration: none;
  color: var(--text-primary);
  transition: transform 0.18s ease, background 0.2s ease;
}

.news-item:hover {
  transform: translateX(3px);
  background: var(--card-bg-hover);
}

.news-item-title {
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.news-item-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.67rem;
  color: var(--text-muted);
}

.news-source-tag {
  font-weight: 600;
  color: var(--accent-color);
}

/* ==================== ЦЕНТРАЛЬНАЯ КОЛОНКА (ЧАСЫ И ПОИСК) ==================== */
.column-center {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.center-hero {
  width: 100%;
  max-width: 500px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
}

.date-chip {
  font-size: 0.82rem;
  font-weight: 500;
  padding: 5px 14px;
  border-radius: 999px;
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  color: var(--text-secondary);
}

.digital-clock {
  font-family: var(--font-mono);
  font-size: clamp(2.4rem, 4.8vw, 4.4rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
  text-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
}

.greeting-text {
  font-size: 1.02rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.search-box {
  width: 100%;
  display: flex;
  align-items: center;
  background: var(--card-bg);
  border-radius: 999px;
  padding: 6px 8px;
  backdrop-filter: blur(20px);
  box-shadow: var(--card-shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.search-box:focus-within {
  transform: translateY(-2px);
  box-shadow: 0 0 0 2px var(--accent-color), var(--card-shadow);
}

.search-engine-toggle {
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.engine-badge {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  transition: transform 0.2s ease;
}

.engine-badge.yandex {
  background: #fc3f1d;
  color: #ffffff;
}

.engine-badge.google {
  background: #4285f4;
  color: #ffffff;
}

.search-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  padding: 8px 12px;
  font-size: 0.92rem;
  color: var(--text-primary);
  font-family: inherit;
  outline: none;
}

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

.search-submit-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--item-bg);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s ease, color 0.2s ease;
}

.search-submit-btn:hover {
  background: var(--accent-color);
  color: #ffffff;
}

.atmosphere-status-pill {
  margin-top: 4px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--card-bg);
  color: var(--text-secondary);
  font-size: 0.76rem;
  font-weight: 500;
  backdrop-filter: blur(14px);
  max-width: 100%;
}

.pill-svg-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ==================== ПРАВАЯ КОЛОНКА: ВИДЖЕТ ПОГОДЫ С SVG-ИКОНКАМИ ==================== */
.weather-widget {
  width: 100%;
  border: none !important;
  outline: none !important;
}

.weather-summary {
  padding: 15px 18px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.weather-summary:hover {
  background: rgba(255, 255, 255, 0.04);
}

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

.location-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 0;
}

.location-pill span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.weather-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.mini-pill-btn {
  border: none;
  background: var(--item-bg);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mini-pill-btn:hover {
  color: var(--text-primary);
  background: var(--card-bg-hover);
}

.expand-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--item-bg);
  color: var(--text-secondary);
  transition: transform 0.38s cubic-bezier(0.22, 1, 0.36, 1);
}

.weather-widget.is-expanded .expand-chevron {
  transform: rotate(180deg);
}

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

.weather-temp-block {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.weather-big-svg {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.weather-temp {
  font-family: var(--font-mono);
  font-size: 2.05rem;
  font-weight: 700;
  line-height: 1.05;
}

.weather-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 3px;
}

.weather-feels {
  text-align: right;
  font-size: 0.76rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}

.weather-feels strong {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--text-primary);
}

.weather-expand-hint {
  margin-top: 11px;
  padding-top: 8px;
  border-top: 1px dashed rgba(148, 163, 184, 0.25);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.73rem;
  color: var(--text-muted);
}

.weather-details-panel {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  padding: 0 18px;
  transition:
    max-height 0.45s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.35s ease,
    padding 0.35s ease;
}

.weather-widget.is-expanded .weather-details-panel {
  max-height: 520px;
  opacity: 1;
  padding: 4px 18px 16px;
}

.weather-metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 7px;
  margin-bottom: 10px;
}

.metric-item {
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--item-bg);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.metric-label {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.metric-value {
  font-family: var(--font-mono);
  font-size: 0.84rem;
  font-weight: 600;
}

.hourly-section {
  margin-bottom: 10px;
}

.hourly-title {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.hourly-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.hour-pill {
  background: var(--item-bg);
  border-radius: 12px;
  padding: 7px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
}

.hour-time {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.67rem;
}

.hour-icon-svg {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hour-temp {
  font-family: var(--font-mono);
  font-weight: 600;
}

.sim-controls-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 10px;
  padding-top: 8px;
  border-top: 1px dashed rgba(148, 163, 184, 0.25);
}

.sim-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
}

.sim-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: none;
  background: var(--item-bg);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.69rem;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sim-chip:hover {
  color: var(--text-primary);
}

.sim-chip.active {
  background: rgba(56, 189, 248, 0.28);
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.55);
  color: var(--text-primary);
  font-weight: 600;
}

.chip-svg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
}

.city-presets {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.preset-label {
  font-size: 0.71rem;
  color: var(--text-muted);
  margin-right: 2px;
}

.city-chip {
  border: none;
  background: var(--item-bg);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.71rem;
  padding: 4px 9px;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.city-chip:hover {
  color: var(--text-primary);
  background: var(--card-bg-hover);
}

/* ==================== НИЖНИЙ ДОК С КРУГЛЫМИ ИКОНКАМИ ==================== */
.bottom-dock-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
}

.quick-links-dock {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  padding: 10px 22px;
  border-radius: 999px;
  background: var(--card-bg);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  box-shadow: var(--card-shadow);
  max-width: 100%;
}

.dock-circle-link {
  position: relative;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  background: var(--item-bg);
  color: var(--text-primary);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
  transition:
    transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.28s ease,
    background 0.25s ease,
    color 0.25s ease;
}

.dock-circle-link:hover {
  transform: translateY(-7px) scale(1.1);
}

.dock-circle-link img.dock-favicon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  object-fit: contain;
}

.github-link:hover {
  background: #24292f;
  color: #ffffff;
  box-shadow: 0 12px 24px rgba(36, 41, 47, 0.45);
}

.telegram-link {
  color: #2aabee;
}

.telegram-link:hover {
  background: linear-gradient(135deg, #2aabee, #229ed9);
  color: #ffffff;
  box-shadow: 0 12px 24px rgba(42, 171, 238, 0.45);
}

.yandex-link {
  color: #fc3f1d;
}

.yandex-link:hover {
  background: #fc3f1d;
  color: #ffffff;
  box-shadow: 0 12px 24px rgba(252, 63, 29, 0.45);
}

.google-link:hover {
  background: #ffffff;
  box-shadow: 0 12px 24px rgba(66, 133, 244, 0.35);
}

.dock-circle-link::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.88);
  color: #f8fafc;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.dock-circle-link:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ==================== ИКОНКА НАСТРОЕК ВНИЗУ СПРАВА И МОДАЛЬНОЕ ОКНО ==================== */
.settings-fab-btn {
  position: fixed;
  right: 26px;
  bottom: 22px;
  z-index: 30;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: none;
  background: var(--card-bg);
  color: var(--text-primary);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--card-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.25s ease, color 0.25s ease;
}

.settings-fab-btn:hover {
  transform: scale(1.1) rotate(45deg);
  background: var(--card-bg-hover);
  color: var(--accent-color);
}

.settings-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(2, 6, 23, 0.62);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 1;
  transition: opacity 0.25s ease;
}

.settings-modal-backdrop.hidden {
  opacity: 0;
  pointer-events: none;
}

.settings-modal-card {
  width: 100%;
  max-width: 560px;
  background: var(--card-bg);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border-radius: 24px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.55);
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 88dvh;
  overflow-y: auto;
}

.settings-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.settings-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
}

.settings-title-wrap h3 {
  font-size: 1.05rem;
  font-weight: 700;
}

.settings-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: var(--item-bg);
  padding: 5px;
  border-radius: 14px;
}

.settings-tab-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.settings-tab-btn.active {
  background: var(--card-bg-hover);
  color: var(--accent-color);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}

.settings-panel {
  display: none;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

.settings-panel.active {
  display: flex;
}

.settings-help {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.settings-region-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.settings-select {
  border: none;
  background: var(--item-bg);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 7px 11px;
  border-radius: 10px;
  outline: none;
  cursor: pointer;
}

.settings-select option {
  background: #0f172a;
  color: #f8fafc;
}

.settings-add-form {
  display: grid;
  grid-template-columns: 1fr 1.3fr auto;
  gap: 8px;
}

.settings-input {
  border: none;
  background: var(--item-bg);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.8rem;
  padding: 9px 12px;
  border-radius: 11px;
  outline: none;
  min-width: 0;
}

.settings-input:focus {
  box-shadow: 0 0 0 2px var(--accent-color);
}

.settings-primary-btn {
  border: none;
  background: linear-gradient(135deg, #0ea5e9, #2563eb);
  color: #ffffff;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 9px 15px;
  border-radius: 11px;
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.15s ease;
}

.settings-primary-btn:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

.settings-items-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
  padding-right: 4px;
}

.settings-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--item-bg);
}

.settings-item-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.settings-item-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
}

.settings-item-url {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-delete-btn {
  border: none;
  background: rgba(239, 68, 68, 0.16);
  color: var(--negative-color);
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s ease;
}

.settings-delete-btn:hover {
  background: rgba(239, 68, 68, 0.28);
}

.settings-footer-row {
  display: flex;
  justify-content: flex-end;
  padding-top: 6px;
}

.settings-secondary-btn {
  border: none;
  background: var(--item-bg);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
}

.settings-secondary-btn:hover {
  color: var(--text-primary);
  background: var(--card-bg-hover);
}

/* ==================== МОБИЛЬНАЯ И ПЛАНШЕТНАЯ ОПТИМИЗАЦИЯ ==================== */
@media (max-width: 1100px) {
  html, body {
    overflow-x: hidden;
    overflow-y: auto;
    height: auto;
    min-height: 100dvh;
  }

  .dashboard-viewport {
    height: auto;
    min-height: 100dvh;
    padding: 12px 14px calc(24px + env(safe-area-inset-bottom, 0px));
    gap: 14px;
    display: flex;
    flex-direction: column;
  }

  /* Шапка адаптируется в 2 аккуратных ряда без вылета за правый край */
  .top-bar {
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
  }

  .brand-pill {
    padding: 7px 12px;
  }

  .top-right-controls {
    flex: 1;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
  }

  /* Векторные колонки выстраиваются в логичном порядке для телефона:
     1) Часы и Поиск -> 2) Погода -> 3) Валюты, Крипта и Новости */
  .widgets-grid {
    display: flex;
    flex-direction: column;
    gap: 14px;
    height: auto;
    width: 100%;
  }

  .column-center {
    order: 1;
    width: 100%;
    padding: 4px 0;
  }

  .column-right {
    order: 2;
    width: 100%;
    padding: 0;
  }

  .column-left {
    order: 3;
    width: 100%;
    overflow: visible;
    max-height: none;
    padding: 0;
  }

  .settings-add-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  /* На узких экранах смартфонов переключатель [День | Ночь | Авто] занимает 100% ширины 2-й строкой */
  .top-bar {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
  }

  .brand-pill {
    justify-self: start;
  }

  .top-right-controls {
    display: contents;
  }

  .lang-segmented-control {
    justify-self: end;
  }

  .mode-segmented-control {
    grid-column: 1 / -1;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    padding: 4px;
  }

  .mode-seg-btn {
    padding: 8px 6px;
    font-size: 0.78rem;
    width: 100%;
  }

  /* Компактный блок часов и поиска на мобильном */
  .center-hero {
    gap: 7px;
  }

  .digital-clock {
    font-size: 2.65rem;
  }

  .greeting-text {
    font-size: 0.88rem;
    margin-bottom: 2px;
  }

  .atmosphere-status-pill {
    font-size: 0.71rem;
    padding: 5px 11px;
  }

  /* Солнце и луна чуть компактнее на вертикальном экране */
  .sun {
    width: 72px;
    height: 72px;
    margin-left: -36px;
    top: 7%;
  }

  .moon {
    width: 64px;
    height: 64px;
    margin-left: -32px;
    top: 8%;
  }

  /* Карточки и строки курсов без обрезания справа */
  .widget-header {
    padding: 11px 14px;
  }

  .widget-body {
    padding: 0 12px 12px;
  }

  .rate-row {
    padding: 8px 10px;
  }

  .rate-price {
    font-size: 0.8rem;
  }

  .rate-change {
    font-size: 0.68rem;
    min-width: 52px;
    padding: 3px 5px;
  }

  /* Нижний док и кнопка настроек */
  .bottom-dock-wrapper {
    padding-bottom: 6px;
    padding-right: 58px; /* Оставляем место справа под плавающую кнопку настроек ⚙️ */
  }

  .quick-links-dock {
    padding: 8px 14px;
    gap: 10px;
    width: 100%;
    justify-content: space-around;
  }

  .dock-circle-link {
    width: 44px;
    height: 44px;
  }

  .settings-fab-btn {
    right: 14px;
    bottom: 18px;
    width: 46px;
    height: 46px;
  }

  .settings-modal-card {
    padding: 16px;
    border-radius: 20px;
  }
}
