/* =====================================================================
   HomeHub — «домашний пульт»
   У каждого раздела свой цвет (--hue). Он заливает шапку, кнопки и
   активную вкладку; при переключении интерфейс плавно перекрашивается.
   Тема (светлая/тёмная) берётся из Telegram или из настроек системы.
   ===================================================================== */

:root {
  /* Тёмная тема (по умолчанию) */
  --bg: #1a1d26;
  --surface: #232733;
  --raised: #2c3140;
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #eceef4;
  --muted: #979eb0;
  --danger: #ff6b6b;
  --ok: #3fd3a2;
  --warn: #f5b841;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.28);

  /* Цвета разделов */
  --amber: #f5b841;
  --mint: #3fd3a2;
  --violet: #a193ff;
  --sky: #58b6ff;
  --rose: #ff7c9c;
  --tangerine: #ff9f5a;
  --lime: #b5df5d;

  --hue: var(--amber);
  --hue-soft: rgba(245, 184, 65, 0.14);
  --hue-line: rgba(245, 184, 65, 0.4);
  --on-hue: #1a1d26;

  /* Типографика */
  --font-display: "Unbounded", "Onest", system-ui, sans-serif;
  --font-body: "Onest", "Segoe UI", system-ui, -apple-system, sans-serif;

  /* Сетка и радиусы: крупные блоки круглее, мелкие элементы строже */
  --r-tile: 26px;
  --r-card: 20px;
  --r-control: 14px;
  --r-pill: 999px;
  --gap: 10px;
  --touch: 46px;

  --app-w: 540px;
  --side-w: 248px;
  --nav-h: 64px;
  --nav-gap: 10px;
  --bottom-nav-h: calc(var(--nav-h) + var(--nav-gap) * 2 + env(safe-area-inset-bottom, 0px));
  --sticky-h: 66px;
  --ease: cubic-bezier(0.32, 0.72, 0, 1);

  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #eef0f4;
  --surface: #ffffff;
  --raised: #f3f4f8;
  --line: rgba(20, 24, 36, 0.08);
  --line-strong: rgba(20, 24, 36, 0.16);
  --text: #1a1d26;
  --muted: #646b7d;
  --danger: #e04848;
  --ok: #12a57a;
  --warn: #c98a0c;
  --shadow: 0 10px 30px rgba(26, 29, 38, 0.08);

  --amber: #e9a420;
  --mint: #15b384;
  --violet: #6e5bf2;
  --sky: #1f8eeb;
  --rose: #e5507a;
  --tangerine: #ec7a2c;
  --lime: #6e9f1c;
  color-scheme: light;
}

/* Цвет раздела задаётся по активной вкладке */
body[data-active-tab="remind"] {
  --hue: var(--amber);
  --hue-soft: rgba(245, 184, 65, 0.15);
  --hue-line: rgba(245, 184, 65, 0.45);
  --on-hue: #1a1d26;
}
body[data-active-tab="virus"] {
  --hue: var(--mint);
  --hue-soft: rgba(63, 211, 162, 0.14);
  --hue-line: rgba(63, 211, 162, 0.45);
  --on-hue: #10241d;
}
body[data-active-tab="odyssey"] {
  --hue: var(--violet);
  --hue-soft: rgba(140, 122, 255, 0.16);
  --hue-line: rgba(140, 122, 255, 0.5);
  --on-hue: #ffffff;
}
body[data-active-tab="study"] {
  --hue: var(--tangerine);
  --hue-soft: rgba(255, 159, 90, 0.15);
  --hue-line: rgba(255, 159, 90, 0.45);
  --on-hue: #2b1606;
}
body[data-active-tab="scan"] {
  --hue: var(--lime);
  --hue-soft: rgba(181, 223, 93, 0.15);
  --hue-line: rgba(181, 223, 93, 0.45);
  --on-hue: #1d2a08;
}
:root[data-theme="light"] body[data-active-tab="scan"] {
  --on-hue: #ffffff;
}
body[data-active-tab="weather"] {
  --hue: var(--sky);
  --hue-soft: rgba(88, 182, 255, 0.15);
  --hue-line: rgba(88, 182, 255, 0.45);
  --on-hue: #0e2134;
}
body[data-active-tab="media"] {
  --hue: var(--rose);
  --hue-soft: rgba(255, 124, 156, 0.15);
  --hue-line: rgba(255, 124, 156, 0.45);
  --on-hue: #ffffff;
}
:root[data-theme="dark"] body[data-active-tab="odyssey"],
:root:not([data-theme]) body[data-active-tab="odyssey"] {
  --on-hue: #17132e;
}
:root[data-theme="dark"] body[data-active-tab="media"],
:root:not([data-theme]) body[data-active-tab="media"] {
  --on-hue: #2e0f18;
}

/* ===================== База ===================== */

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  -webkit-text-size-adjust: 100%;
  height: 100%;
  height: 100dvh;
  background: var(--bg);
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding-bottom: var(--bottom-nav-h);
  transition: background-color 0.4s var(--ease);
}

body[data-active-tab="remind"] {
  padding-bottom: calc(var(--bottom-nav-h) + var(--sticky-h));
}

:focus-visible {
  outline: 2px solid var(--hue);
  outline-offset: 2px;
}

::selection {
  background: var(--hue-soft);
}

.hidden {
  display: none !important;
}

h1,
h2 {
  margin: 0;
}

h2 {
  font-size: 1rem;
  font-weight: 700;
}

.app {
  width: 100%;
  max-width: var(--app-w);
  margin: 0 auto;
  padding: max(10px, env(safe-area-inset-top)) 12px 0;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ===================== Шапка-плитка раздела ===================== */

.app-header {
  position: relative;
  flex-shrink: 0;
  margin-bottom: var(--gap);
  padding: 14px 16px 18px;
  border-radius: var(--r-tile);
  background: var(--hue);
  color: var(--on-hue);
  overflow: hidden;
  isolation: isolate;
  transition: background-color 0.45s var(--ease), color 0.45s var(--ease);
}

/* Крупный круг-«лампа» справа: силуэт пульта, меняет цвет вместе с разделом */
.app-header-glow {
  position: absolute;
  right: -46px;
  top: -40px;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  border: 26px solid currentColor;
  opacity: 0.1;
  z-index: -1;
  pointer-events: none;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.14);
  color: inherit;
  flex-shrink: 0;
}

.brand-mark svg {
  width: 18px;
  height: 18px;
}

.brand-copy {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand-section {
  font-size: 0.82rem;
  font-weight: 500;
  opacity: 0.72;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-section::before {
  content: "/";
  margin-right: 8px;
  opacity: 0.5;
}

.hero-head {
  padding: 0;
}

h1 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  line-height: 1.05;
  font-weight: 700;
  letter-spacing: -0.035em;
  animation: titleIn 0.45s var(--ease);
}

.subtitle {
  margin: 6px 0 0;
  font-size: 0.92rem;
  font-weight: 500;
  opacity: 0.78;
}

@keyframes titleIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

/* ===================== Панели и карточки ===================== */

.tab-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tab-panel.scroll,
#panelRemind {
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-bottom: 14px;
  scrollbar-width: none;
}

.tab-panel.scroll::-webkit-scrollbar,
#panelRemind::-webkit-scrollbar {
  display: none;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 14px;
  margin-bottom: var(--gap);
  flex-shrink: 0;
}

.card-title,
.list-header h2 {
  font-family: var(--font-display);
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 12px;
}

.list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.list-header h2 {
  margin: 0;
}

label {
  display: block;
  font-size: 0.86rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--muted);
}

.hint {
  margin: 0 0 8px;
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.4;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 22px 8px 14px;
  font-size: 0.94rem;
}

.meta {
  text-align: right;
  font-size: 0.75rem;
  color: var(--muted);
  margin: 6px 2px 12px;
  font-variant-numeric: tabular-nums;
}

/* ===================== Поля ввода ===================== */

input,
textarea {
  width: 100%;
  font: inherit;
  font-size: 16px;
  color: var(--text);
  background: var(--raised);
  border: 1.5px solid transparent;
  border-radius: var(--r-control);
  padding: 13px 15px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 0.75;
}

input:focus,
textarea:focus {
  border-color: var(--hue);
  box-shadow: 0 0 0 4px var(--hue-soft);
  background: var(--surface);
}

textarea {
  resize: none;
  line-height: 1.45;
}

#text {
  min-height: 84px;
  max-height: 140px;
}

input[type="datetime-local"] {
  min-height: var(--touch);
}

.input-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.input-row input {
  flex: 1;
  min-width: 0;
}

.file-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  padding: 14px;
  border-radius: var(--r-control);
  border: 1.5px dashed var(--line-strong);
  background: var(--raised);
}

.file-input {
  width: 100%;
  font-size: 0.9rem;
  color: var(--muted);
  padding: 0;
  background: transparent;
  border: none;
}

.file-input:focus {
  box-shadow: none;
  background: transparent;
}

.file-input::file-selector-button {
  font: inherit;
  font-weight: 600;
  margin-right: 10px;
  padding: 8px 14px;
  border: none;
  border-radius: var(--r-pill);
  background: var(--hue-soft);
  color: var(--text);
  cursor: pointer;
}

/* ===================== Кнопки ===================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--touch);
  padding: 12px 18px;
  font: inherit;
  font-size: 0.98rem;
  font-weight: 700;
  border: none;
  border-radius: var(--r-control);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.12s var(--ease), background-color 0.2s, color 0.2s, opacity 0.2s;
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.45;
  cursor: default;
  transform: none;
}

.btn.full {
  width: 100%;
  margin-top: 10px;
}

.btn.primary {
  width: 100%;
  background: var(--hue);
  color: var(--on-hue);
}

.btn.primary.big {
  min-height: 52px;
  font-size: 1.02rem;
  border-radius: 18px;
}

.btn.ghost {
  background: var(--raised);
  color: var(--text);
}

.btn.ghost.small,
.btn.small {
  min-height: 40px;
  padding: 8px 14px;
  font-size: 0.9rem;
}

.btn.danger {
  min-height: 36px;
  padding: 6px 14px;
  font-size: 0.86rem;
  background: transparent;
  color: var(--danger);
  border: 1.5px solid currentColor;
  border-radius: var(--r-pill);
}

.btn-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 14px;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  background: var(--raised);
  border: none;
  border-radius: var(--r-pill);
  cursor: pointer;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
  color: var(--hue);
}

/* Быстрые кнопки времени и выбор качества */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}

.chips.chips-auto {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(84px, 1fr));
}

.chips button {
  flex: 0 0 auto;
  min-height: 42px;
  padding: 6px 14px;
  white-space: nowrap;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  background: var(--raised);
  border: 1.5px solid transparent;
  border-radius: var(--r-pill);
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color 0.18s, color 0.18s, transform 0.1s;
}

.chips button:active {
  transform: scale(0.96);
}

.chips button.active {
  background: var(--hue);
  color: var(--on-hue);
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  margin: 14px 0;
  border-radius: 16px;
  background: var(--raised);
}

.segmented button {
  min-height: 42px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--muted);
  background: transparent;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}

.segmented button.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.datetime-details summary {
  display: inline-block;
  padding: 10px 0 4px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--hue);
  cursor: pointer;
  list-style: none;
}

.datetime-details summary::-webkit-details-marker {
  display: none;
}

.datetime-details summary::after {
  content: " ▾";
}

.datetime-details[open] summary {
  margin-bottom: 8px;
}

.datetime-details[open] summary::after {
  content: " ▴";
}

/* ===================== Напоминания ===================== */

.reminder-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.reminder-item {
  position: relative;
  padding: 12px 14px 12px 18px;
  border-radius: 16px;
  background: var(--raised);
  overflow: hidden;
}

.reminder-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: var(--hue);
}

.reminder-item .time {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--hue);
  margin-bottom: 4px;
  font-variant-numeric: tabular-nums;
}

.reminder-item .body {
  white-space: pre-wrap;
  margin-bottom: 10px;
  overflow-wrap: anywhere;
}

.reminder-item .foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.reminder-item .id {
  font-size: 0.78rem;
  color: var(--muted);
}

/* ===================== Плашки статуса ===================== */

.status-banner {
  margin: 0 0 var(--gap);
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--hue-soft);
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.45;
}

.status-banner strong {
  font-weight: 700;
}

.status-banner.status-action {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.status-action > span {
  flex: 1 1 180px;
  white-space: pre-line;
}

.status-action .btn {
  width: auto;
  flex: 0 0 auto;
}

textarea:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.status-banner-warn {
  background: rgba(255, 107, 107, 0.12);
  color: var(--danger);
}

/* ===================== VirusTotal ===================== */

.virus-result {
  padding: 0;
  overflow: hidden;
  --status: var(--muted);
  border-color: var(--status);
}

.virus-result.status-clean {
  --status: var(--ok);
}
.virus-result.status-suspicious {
  --status: var(--warn);
}
.virus-result.status-malicious {
  --status: var(--danger);
}

.virus-result-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
}

.virus-result-text {
  flex: 1;
  min-width: 0;
}

.virus-result-icon {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 18px;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  background: var(--status);
  color: var(--bg);
}

.virus-badge {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--status, var(--text));
  margin-bottom: 4px;
}

.virus-badge.status-clean {
  color: var(--ok);
}
.virus-badge.status-suspicious {
  color: var(--warn);
}
.virus-badge.status-malicious {
  color: var(--danger);
}

.virus-target {
  margin: 0 0 4px;
  font-size: 0.9rem;
  word-break: break-all;
}

.virus-ratio {
  margin: 0 0 8px;
  font-size: 0.85rem;
  color: var(--muted);
}

.virus-details-link {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--hue);
  text-decoration: none;
}

.vt-limit {
  text-align: center;
  margin-top: 2px;
}

/* ===================== Погода ===================== */

.weather-now {
  position: relative;
  overflow: hidden;
}

.weather-place {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  min-width: 0;
}

.weather-pin {
  display: none;
}

#weatherPlace {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.weather-source {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  background: var(--hue-soft);
  color: var(--hue);
}

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

.weather-main > div:last-child {
  order: -1;
}

.weather-temp {
  font-family: var(--font-display);
  font-size: 4.2rem;
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.06em;
  font-variant-numeric: tabular-nums;
}

.weather-label {
  margin-top: 6px;
  font-weight: 600;
  color: var(--muted);
}

.weather-icon {
  font-size: 4rem;
  line-height: 1;
}

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

.weather-stats div {
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--raised);
}

.weather-stats dt {
  font-size: 0.76rem;
  color: var(--muted);
}

.weather-stats dd {
  margin: 2px 0 0;
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.weather-actions {
  display: flex;
  gap: 8px;
}

.weather-actions .btn {
  flex: 1;
}

.weather-hourly {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: 14px;
  margin: 0 -14px;
  padding: 0 14px 4px;
  scrollbar-width: none;
}

.weather-hourly::-webkit-scrollbar {
  display: none;
}

.weather-hour {
  flex: 0 0 64px;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 4px;
  border-radius: 16px;
  background: var(--raised);
}

.weather-hour:first-child {
  background: var(--hue);
  color: var(--on-hue);
}

.weather-hour:first-child .weather-hour-time,
.weather-hour:first-child .weather-hour-rain {
  color: inherit;
  opacity: 0.8;
}

.weather-hour-time,
.weather-hour-rain {
  font-size: 0.72rem;
  color: var(--muted);
}

.weather-hour-icon {
  font-size: 1.45rem;
}

.weather-hour-temp {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
}

.weather-daily {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.weather-day {
  display: grid;
  grid-template-columns: 82px 30px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 10px 2px;
  border-top: 1px solid var(--line);
  font-size: 0.92rem;
}

.weather-day:first-child {
  border-top: none;
}

.weather-day-name {
  font-weight: 700;
}

.weather-day-icon {
  font-size: 1.35rem;
  text-align: center;
}

.weather-day-label {
  font-size: 0.82rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.weather-day-rain {
  font-size: 0.78rem;
  color: var(--hue);
}

.weather-day-temps {
  font-family: var(--font-display);
  font-size: 0.88rem;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

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

/* ===================== Загрузки ===================== */

.media-video {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.media-thumb {
  width: 132px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 14px;
  flex-shrink: 0;
  background: var(--raised);
}

.media-meta {
  min-width: 0;
}

.media-title {
  margin: 0 0 4px;
  font-weight: 700;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.media-job {
  --job: var(--hue);
}

.media-job[data-status="done"] {
  --job: var(--ok);
  border-color: var(--ok);
}

.media-job[data-status="error"] {
  --job: var(--danger);
  border-color: var(--danger);
}

.media-job-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
  font-weight: 700;
}

#mediaJobPercent {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--job);
  font-variant-numeric: tabular-nums;
}

.media-job[data-status="error"] #mediaJobStatus {
  color: var(--danger);
}

.progress {
  height: 10px;
  border-radius: var(--r-pill);
  background: var(--raised);
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--job);
  transition: width 0.4s var(--ease), background-color 0.3s;
}

.media-job[data-status="processing"] .progress-bar {
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.5;
  }
}

.media-job-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px;
}

.media-job .media-job-actions .btn.primary {
  background: var(--job);
  color: var(--bg);
}

.summary-text {
  white-space: pre-wrap;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.summary-text b {
  font-weight: 700;
}

/* ===================== Учёба ===================== */

.study-nav {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin: 0 -12px var(--gap);
  padding: 2px 12px;
  scrollbar-width: none;
  flex-shrink: 0;
}

.study-nav::-webkit-scrollbar,
.chips-scroll::-webkit-scrollbar {
  display: none;
}

.study-nav button,
.chips-scroll button {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 6px 14px;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  white-space: nowrap;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  cursor: pointer;
}

.study-nav button.active,
.chips-scroll button.active {
  color: var(--on-hue);
  background: var(--hue);
  border-color: transparent;
}

.chips.chips-scroll {
  flex-wrap: nowrap;
  overflow-x: auto;
  margin: 0 -12px var(--gap);
  padding: 0 12px;
  scrollbar-width: none;
}

.study-date {
  margin: 0 2px 10px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
}

.study-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
  margin-bottom: var(--gap);
}

.stat-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 14px;
  text-align: left;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  cursor: pointer;
}

.stat-tile b {
  font-family: var(--font-display);
  font-size: 1.7rem;
  line-height: 1;
  color: var(--hue);
}

.stat-tile span {
  font-size: 0.8rem;
  color: var(--muted);
}

.study-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.study-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--raised);
  min-width: 0;
}

.study-row > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.study-row > .hint:last-of-type {
  white-space: nowrap;
}

.grow {
  flex: 1;
  min-width: 0;
}

.study-time {
  font-family: var(--font-display);
  font-size: 0.82rem;
  color: var(--hue);
  white-space: nowrap;
}

.icon-x {
  flex-shrink: 0;
  margin-left: auto;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 1.2rem;
  cursor: pointer;
}

.link-btn {
  padding: 0;
  margin: 0 0 10px;
  font: inherit;
  font-weight: 600;
  color: var(--hue);
  background: none;
  border: none;
  cursor: pointer;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
}

.study-row input[type="checkbox"],
.check input[type="checkbox"] {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  margin: 0;
  padding: 0;
  border-radius: 7px;
  border: 2px solid var(--line-strong);
  background: var(--surface);
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.study-row input[type="checkbox"]:checked,
.check input[type="checkbox"]:checked {
  background: var(--hue);
  border-color: var(--hue);
}

.study-row input[type="checkbox"]:checked::after,
.check input[type="checkbox"]:checked::after {
  content: "✓";
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--on-hue);
}

.study-list .check input:checked + span {
  text-decoration: line-through;
  color: var(--muted);
}

.countdown {
  flex-shrink: 0;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--surface);
  white-space: nowrap;
}

.deadline.is-soon .countdown {
  background: var(--hue);
  color: var(--on-hue);
}

.deadline.is-overdue .countdown {
  background: var(--danger);
  color: #fff;
}

.deadline.is-done {
  opacity: 0.55;
}

.card.is-today {
  border-color: var(--hue-line);
}

.study-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.study-form .btn.full {
  margin-top: 2px;
}

.study-form select {
  width: 100%;
  min-height: var(--touch);
  padding: 10px 14px;
  font: inherit;
  color: var(--text);
  background: var(--raised);
  border: 1.5px solid transparent;
  border-radius: var(--r-control);
}

.row2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-items: center;
}

.segmented label {
  margin: 0;
}

.segmented label input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented label span {
  display: grid;
  place-items: center;
  min-height: 40px;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
}

.segmented label input:checked + span {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.deck {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px;
  border-radius: 14px;
  background: var(--raised);
}

.deck .grow {
  flex: 1 1 180px;
}

.deck-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.deck-actions .btn.primary {
  width: auto;
}

.review-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.review-head .link-btn {
  margin: 0;
}

.flashcard {
  min-height: 260px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  text-align: center;
}

.flash-front {
  font-family: var(--font-display);
  font-size: 1.25rem;
  line-height: 1.3;
  padding: 24px 6px 0;
  white-space: pre-wrap;
}

.flash-back {
  padding: 14px;
  border-radius: 14px;
  background: var(--raised);
  white-space: pre-wrap;
  line-height: 1.5;
}

.grades {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.grades .btn {
  padding: 8px 4px;
  font-size: 0.84rem;
  color: #fff;
}

.grade-0 { background: var(--danger); }
.grade-1 { background: var(--warn); color: #1a1d26 !important; }
.grade-2 { background: var(--ok); color: #10241d !important; }
.grade-3 { background: var(--sky); color: #0e2134 !important; }

.quiz-q {
  margin: 0 0 12px;
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.4;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quiz-option {
  padding: 12px 14px;
  text-align: left;
  font: inherit;
  color: var(--text);
  background: var(--raised);
  border: 1.5px solid transparent;
  border-radius: var(--r-control);
  cursor: pointer;
}

.quiz-option.is-right {
  border-color: var(--ok);
  background: rgba(63, 211, 162, 0.15);
}

.quiz-option.is-wrong {
  border-color: var(--danger);
  background: rgba(255, 107, 107, 0.12);
}

.quiz-option:disabled {
  cursor: default;
  opacity: 1;
}

.quiz-expl {
  margin: 12px 0 0;
}

.quiz-score {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: 1.4rem;
}

.quiz-score b {
  font-size: 2.6rem;
  color: var(--hue);
}

.focus-clock {
  margin: 10px 0 6px;
  text-align: center;
  font-family: var(--font-display);
  font-size: 4.6rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  color: var(--hue);
}

.center {
  text-align: center;
}

.study-total {
  margin: 0 0 12px;
}

.bars {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  height: 120px;
  margin-bottom: 12px;
}

.bar {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  color: var(--muted);
}

.bar-fill {
  width: 100%;
  min-height: 3px;
  border-radius: 8px 8px 3px 3px;
  background: var(--hue);
}

.bar small {
  font-size: 0.66rem;
}

.fr-word {
  margin: 0 0 6px;
  font-size: 1.05rem;
}

.fr-word b {
  font-family: var(--font-display);
  color: var(--hue);
}

.plan li {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}

details summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--hue);
  margin: 6px 0 10px;
}

/* ===================== Скан ===================== */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}

.scan-pick {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.scan-btn {
  position: relative;
  width: 100%;
  font-size: 0.95rem;
}

.scan-pages {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
}

.scan-page {
  margin: 0;
  border-radius: 14px;
  overflow: hidden;
  background: var(--raised);
}

.scan-page img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
}

.scan-page figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 4px;
  font-size: 0.82rem;
}

.scan-page button {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 1.1rem;
  cursor: pointer;
}

.scan-page button:disabled {
  opacity: 0.25;
}

.scan-page .scan-del {
  color: var(--danger);
}

.scan-modes {
  grid-template-columns: repeat(3, 1fr);
  margin: 0 0 4px;
}

.scan-previews {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin: 0 -14px 10px;
  padding: 0 14px 4px;
  scrollbar-width: none;
}

.scan-previews img {
  flex: 0 0 auto;
  height: 220px;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

/* ===================== DeepSeek ===================== */

body.odyssey-tab .hero-head .subtitle {
  display: none;
}

.odyssey-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.odyssey-chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.odyssey-chat-title {
  flex: 1;
  min-width: 0;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.odyssey-chat {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

body[data-active-tab="odyssey"] .odyssey-chat {
  padding-bottom: calc(126px + env(safe-area-inset-bottom, 0px));
}

.odyssey-messages {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  padding-bottom: 6px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.odyssey-bubble {
  max-width: 86%;
  padding: 11px 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.96rem;
  border-radius: 20px;
}

.odyssey-bubble.user {
  align-self: flex-end;
  background: var(--hue);
  color: var(--on-hue);
  border-bottom-right-radius: 6px;
}

.odyssey-bubble.assistant {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-bottom-left-radius: 6px;
}

.odyssey-bubble.thinking {
  color: var(--muted);
  animation: pulse 1.4s ease-in-out infinite;
}

.odyssey-compose {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: var(--bottom-nav-h);
  z-index: 125;
  width: min(100%, var(--app-w));
  padding: 6px 12px 8px;
  background: linear-gradient(to top, var(--bg) 78%, transparent);
}

.odyssey-compose textarea {
  min-height: 46px;
  max-height: 96px;
  margin-bottom: 6px;
  background: var(--surface);
  border-color: var(--line);
}

.odyssey-compose-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
}

#odysseyAttachBtn {
  margin-right: auto;
}

.odyssey-compose-actions .btn.primary {
  width: auto;
  min-width: 124px;
}

.odyssey-file-input {
  display: none;
}

.odyssey-file-hint {
  margin: 6px 0 0;
  font-size: 0.74rem;
}

.odyssey-attachment {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  padding: 8px 12px;
  border-radius: var(--r-pill);
  background: var(--hue-soft);
}

.odyssey-attachment-name {
  flex: 1;
  min-width: 0;
  font-size: 0.84rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.odyssey-attachment-remove {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

/* ===================== Модальные окна ===================== */

.modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 12, 18, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: opacity 0.28s ease;
}

.modal:not(.modal-sheet) .modal-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 380px;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  font-size: 1.3rem;
  line-height: 0;
  color: var(--muted);
  background: var(--raised);
  border: none;
  border-radius: 50%;
  cursor: pointer;
}

.phone-banner {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 22px 18px 18px;
  border-radius: var(--r-tile);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.phone-banner-title {
  font-family: var(--font-display);
  font-size: 1rem;
}

.phone-url {
  color: var(--hue);
  font-weight: 700;
  word-break: break-all;
  text-decoration: none;
}

.modal-sheet {
  align-items: flex-end;
  padding: 0;
}

.sheet-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--app-w);
  margin: 0 auto;
  padding: 0 16px calc(16px + env(safe-area-inset-bottom, 0px));
  border-radius: 28px 28px 0 0;
  background: var(--surface);
  box-shadow: 0 -16px 40px rgba(0, 0, 0, 0.3);
  will-change: transform;
}

.sheet-panel.sheet-enter {
  animation: sheetUp 0.38s var(--ease);
}

.sheet-panel.sheet-dragging {
  animation: none;
  transition: none !important;
}

.sheet-panel.sheet-closing {
  animation: none;
}

@keyframes sheetUp {
  from {
    transform: translateY(100%);
  }
}

.sheet-drag-zone {
  display: flex;
  justify-content: center;
  padding: 10px 24px 14px;
  margin: 0 -16px;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.sheet-handle {
  width: 40px;
  height: 5px;
  border-radius: var(--r-pill);
  background: var(--line-strong);
  transition: width 0.2s var(--ease), background-color 0.2s;
}

.sheet-panel.sheet-drag-active .sheet-handle,
.sheet-drag-zone:active .sheet-handle {
  width: 56px;
  background: var(--hue);
}

.sheet-subtitle {
  margin: 4px 0 0;
  font-size: 0.84rem;
  color: var(--muted);
}

.odyssey-chats-panel {
  max-height: min(78dvh, 640px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}

.odyssey-chats-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.odyssey-chats-head h2 {
  font-family: var(--font-display);
  font-size: 1.1rem;
}

.odyssey-chats-head .modal-close {
  position: static;
}

.odyssey-new-chat-btn {
  margin-top: 0;
}

.odyssey-conversations-list {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1 1 auto;
  min-height: 120px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.odyssey-conversation-item {
  display: flex;
  align-items: stretch;
  min-width: 0;
  border-radius: 16px;
  background: var(--raised);
  overflow: hidden;
  border: 1.5px solid transparent;
}

.odyssey-conversation-item.active {
  border-color: var(--hue);
  background: var(--hue-soft);
}

.odyssey-conversation-open {
  flex: 1 1 0;
  width: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  text-align: left;
  font: inherit;
  color: inherit;
  background: transparent;
  border: none;
  cursor: pointer;
}

.odyssey-conversation-title,
.odyssey-conversation-preview,
.odyssey-conversation-meta {
  display: block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.odyssey-conversation-title {
  font-weight: 700;
  font-size: 0.92rem;
}

.odyssey-conversation-preview {
  font-size: 0.8rem;
  color: var(--muted);
}

.odyssey-conversation-meta {
  font-size: 0.72rem;
  color: var(--muted);
}

.odyssey-conversation-delete {
  flex: 0 0 42px;
  display: grid;
  place-items: center;
  font-size: 1.15rem;
  color: var(--muted);
  background: transparent;
  border: none;
  cursor: pointer;
}

.odyssey-conversation-delete:active {
  color: var(--danger);
}

/* ===================== Нижняя кнопка и тост ===================== */

.sticky-bar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: var(--bottom-nav-h);
  z-index: 125;
  width: min(100%, var(--app-w));
  padding: 4px 12px 6px;
  background: linear-gradient(to top, var(--bg) 70%, transparent);
}

.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--bottom-nav-h) + 12px);
  z-index: 400;
  width: max-content;
  max-width: min(calc(100% - 32px), 460px);
  padding: 12px 18px;
  border-radius: var(--r-pill);
  font-size: 0.92rem;
  font-weight: 600;
  text-align: center;
  background: var(--text);
  color: var(--bg);
  box-shadow: var(--shadow);
  animation: toastIn 0.3s var(--ease);
}

.toast.err {
  background: var(--danger);
  color: #fff;
}

body[data-active-tab="remind"] .toast {
  bottom: calc(var(--bottom-nav-h) + var(--sticky-h) + 6px);
}

body[data-active-tab="odyssey"] .toast {
  bottom: calc(var(--bottom-nav-h) + 118px);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translate(-50%, 10px);
  }
}

/* ===================== Нет связи с ПК ===================== */

.offline-screen {
  position: fixed;
  inset: 0;
  z-index: 450;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
  animation: toastIn 0.3s var(--ease);
}

.offline-card {
  width: 100%;
  max-width: 360px;
  text-align: center;
}

.offline-icon {
  width: 84px;
  height: 84px;
  margin: 0 auto 20px;
  display: grid;
  place-items: center;
  border-radius: 28px;
  background: var(--hue);
  color: var(--on-hue);
}

.offline-icon svg {
  width: 40px;
  height: 40px;
}

.offline-card h2 {
  font-family: var(--font-display);
  font-size: 1.45rem;
  letter-spacing: -0.03em;
  margin-bottom: 10px;
}

.offline-text {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.5;
}

.offline-countdown {
  margin: 0 0 14px;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--hue);
  font-variant-numeric: tabular-nums;
}

/* ===================== Навигация ===================== */

.bottom-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--nav-gap) + env(safe-area-inset-bottom, 0px));
  z-index: 130;
  width: min(calc(100% - var(--nav-gap) * 2), calc(var(--app-w) - var(--nav-gap) * 2));
  height: var(--nav-h);
  display: flex;
  align-items: stretch;
  gap: 2px;
  padding: 6px;
  border-radius: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.nav-indicator {
  position: absolute;
  top: 0;
  left: 0;
  border-radius: 18px;
  background: var(--hue-soft);
  transition: transform 0.4s var(--ease), width 0.3s var(--ease), height 0.3s var(--ease),
    background-color 0.4s var(--ease);
  pointer-events: none;
  z-index: 0;
}

.nav-item {
  position: relative;
  z-index: 1;
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 4px 2px;
  font: inherit;
  color: var(--muted);
  background: transparent;
  border: none;
  border-radius: 18px;
  cursor: pointer;
  touch-action: manipulation;
  transition: color 0.3s var(--ease);
}

.nav-item.active {
  color: var(--hue);
}

.nav-icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
}

.nav-icon svg {
  width: 22px;
  height: 22px;
}

.nav-label {
  max-width: 100%;
  font-size: 0.64rem;
  letter-spacing: -0.01em;
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-item.active .nav-label {
  color: var(--text);
}

@media (max-width: 899px) {
  .bottom-nav {
    overflow-x: auto;
    scrollbar-width: none;
  }

  .bottom-nav::-webkit-scrollbar {
    display: none;
  }

  .bottom-nav .nav-item {
    flex: 1 0 58px;
  }
}

/* ===================== Мышь ===================== */

@media (hover: hover) {
  .btn.ghost:not(:disabled):hover,
  .chips button:not(.active):hover,
  .icon-btn:hover,
  .odyssey-conversation-item:not(.active):hover {
    background: var(--line-strong);
  }

  .btn.primary:not(:disabled):hover {
    filter: brightness(1.06);
  }

  .nav-item:not(.active):hover {
    color: var(--text);
  }
}

/* ===================== Маленькие экраны ===================== */

@media (max-width: 380px) {
  .chips.chips-auto {
    grid-template-columns: repeat(auto-fit, minmax(76px, 1fr));
  }

  .media-thumb {
    width: 104px;
  }

  .weather-day {
    grid-template-columns: 74px 28px minmax(0, 1fr) auto;
  }

  .weather-day-label {
    display: none;
  }

  .weather-temp {
    font-size: 3.4rem;
  }
}

@media (max-height: 700px) {
  :root {
    --sticky-h: 60px;
  }

  .app-header {
    padding: 12px 14px 14px;
  }

  .brand-row {
    margin-bottom: 8px;
  }

  h1 {
    font-size: 1.4rem;
  }

  .subtitle {
    display: none;
  }

  .card {
    padding: 12px;
  }

  #text {
    min-height: 64px;
  }

  .chips button {
    min-height: 38px;
  }

  .odyssey-file-hint {
    display: none;
  }
}

/* ===================== Планшет ===================== */

@media (min-width: 600px) {
  :root {
    --app-w: 680px;
  }
}

/* ===================== ПК: боковое меню ===================== */

@media (min-width: 900px) {
  :root {
    --app-w: 1120px;
  }

  body,
  body[data-active-tab="remind"] {
    padding-left: var(--side-w);
    padding-bottom: 0;
  }

  body[data-active-tab="remind"] {
    padding-bottom: calc(var(--sticky-h) + 12px);
  }

  .app {
    padding: 24px 32px 0;
  }

  .app-header {
    padding: 22px 28px 26px;
    margin-bottom: 16px;
  }

  .app-header-glow {
    width: 260px;
    height: 260px;
    right: -60px;
    top: -90px;
    border-width: 40px;
  }

  .brand-row {
    display: none;
  }

  h1 {
    font-size: 2.4rem;
  }

  .subtitle {
    display: block;
    font-size: 1rem;
  }

  .bottom-nav {
    left: 12px;
    top: 12px;
    bottom: 12px;
    transform: none;
    width: calc(var(--side-w) - 24px);
    height: auto;
    flex-direction: column;
    justify-content: flex-start;
    gap: 4px;
    padding: 16px 10px;
    border-radius: var(--r-tile);
  }

  .bottom-nav::before {
    content: "HomeHub";
    display: block;
    padding: 6px 14px 22px;
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text);
  }

  .nav-item {
    flex: none;
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    min-height: 50px;
    padding: 10px 14px;
  }

  .nav-label {
    font-size: 0.95rem;
    font-weight: 600;
  }

  .sticky-bar,
  .odyssey-compose {
    left: var(--side-w);
    right: 0;
    width: auto;
    transform: none;
    bottom: 0;
    padding-left: max(32px, calc((100vw - var(--side-w) - var(--app-w)) / 2 + 32px));
    padding-right: max(32px, calc((100vw - var(--side-w) - var(--app-w)) / 2 + 32px));
  }

  .sticky-bar {
    display: flex;
    justify-content: flex-end;
    padding-bottom: 14px;
  }

  .sticky-bar .btn.primary.big {
    max-width: 360px;
  }

  .toast,
  body[data-active-tab] .toast {
    left: calc(var(--side-w) + (100vw - var(--side-w)) / 2);
    bottom: 90px;
  }

  .modal-sheet {
    padding-left: var(--side-w);
  }

  #panelRemind:not(.hidden),
  #panelVirus:not(.hidden) {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    align-content: start;
    align-items: start;
  }

  #panelRemind .card,
  #panelVirus .card,
  #panelWeather .card {
    margin-bottom: 0;
    min-width: 0;
  }

  #panelVirus .virus-result,
  #panelVirus .vt-limit {
    grid-column: 1 / -1;
  }

  #text {
    min-height: 120px;
    max-height: 200px;
  }

  #panelWeather:not(.hidden) {
    display: grid;
    grid-template-columns: minmax(320px, 400px) minmax(0, 1fr);
    gap: 16px;
    align-content: start;
    align-items: start;
  }

  #weatherStatus,
  #weatherDailyCard {
    grid-column: 1 / -1;
  }

  .weather-hour {
    flex-basis: 72px;
  }

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

  .weather-day {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
    gap: 6px;
    padding: 14px 8px;
    border: none;
    border-radius: 16px;
    background: var(--raised);
  }

  .weather-day-icon {
    font-size: 2rem;
  }

  .weather-day-label {
    white-space: normal;
  }

  #panelStudy > * {
    width: 100%;
    max-width: 860px;
    margin-left: auto;
    margin-right: auto;
  }

  .study-nav {
    margin-left: auto;
    margin-right: auto;
    padding: 2px 0;
  }

  #panelMedia > * {
    width: 100%;
    max-width: 760px;
    margin-left: auto;
    margin-right: auto;
  }

  .media-thumb {
    width: 220px;
  }

  .odyssey-bubble {
    max-width: 70%;
  }
}

/* ===================== Доступность ===================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
