:root {
  color-scheme: dark;
}

body.launchpad-shell {
  background:
    var(--theme-flare-a),
    var(--theme-flare-b),
    var(--image-overlay),
    var(--background-image),
    var(--theme-background);
  background-attachment: fixed;
  background-position: center;
  background-size: cover;
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  color: var(--text-main);
}

body.login-shell {
  background:
    radial-gradient(circle at 15% 20%, rgba(56, 189, 248, 0.22), transparent 25%),
    radial-gradient(circle at 85% 15%, rgba(168, 85, 247, 0.18), transparent 22%),
    radial-gradient(circle at 50% 100%, rgba(14, 165, 233, 0.14), transparent 30%),
    linear-gradient(145deg, #020617 0%, #0f172a 40%, #1e293b 100%);
}

.login-card {
  background:
    linear-gradient(160deg, rgba(15, 23, 42, 0.92), rgba(30, 41, 59, 0.82));
  border: 1px solid rgba(125, 211, 252, 0.16);
  box-shadow:
    0 24px 80px rgba(2, 6, 23, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.login-card-glow {
  position: absolute;
  inset: -20% auto auto -10%;
  width: 12rem;
  height: 12rem;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.26), transparent 68%);
  pointer-events: none;
}

.login-input {
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(2, 6, 23, 0.4);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.login-input:focus {
  border-color: rgba(103, 232, 249, 0.7);
  box-shadow:
    0 0 0 1px rgba(103, 232, 249, 0.35),
    0 0 0 6px rgba(34, 211, 238, 0.08);
}

.login-primary-button {
  background: linear-gradient(135deg, #67e8f9, #38bdf8);
  color: #082f49;
}

.login-primary-button:hover {
  filter: brightness(1.05);
}

.login-secondary-button {
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: #f8fafc;
}

.login-secondary-button:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(125, 211, 252, 0.3);
}

.glass-panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  box-shadow: 0 18px 60px rgba(2, 6, 23, 0.35);
  backdrop-filter: blur(20px);
}

.launchpad-card {
  transition: transform 150ms ease, background 150ms ease;
}

.launchpad-card:hover {
  transform: translateY(-2px);
  background: var(--panel-bg-hover);
}

.theme-chip,
.theme-subtle-button,
.theme-dashed-button,
.theme-input,
.theme-tile,
.launchpad-modal {
  border-color: var(--muted-border);
}

.theme-chip,
.theme-subtle-button,
.theme-dashed-button {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
}

.theme-chip:hover,
.theme-subtle-button:hover,
.theme-dashed-button:hover,
.theme-tile:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.theme-chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--button-text);
}

.search-type-chip {
  cursor: pointer;
}

.search-type-row-disabled {
  opacity: 0.45;
}

#search-type-row {
  flex-wrap: nowrap;
}

@media (max-width: 1279px) {
  #search-type-row {
    flex-wrap: wrap;
  }
}

@media (min-width: 1280px) {
  .header-bar {
    display: grid;
    grid-template-columns: minmax(18rem, 21rem) max-content minmax(0, 1fr);
    align-items: center;
    gap: 1.75rem;
  }

  .header-brand-shell {
    min-width: 18rem;
  }

  .header-brand {
    min-width: 0;
  }

  .weather-panel {
    width: max-content;
    min-width: 14rem;
    max-width: 20rem;
    justify-self: center;
  }

  #header-controls {
    width: min(100%, 64rem);
    justify-self: end;
    gap: 0.75rem;
    min-width: 0;
    align-items: flex-start;
  }

  #search-form {
    flex: 1 1 auto;
    min-width: 0;
  }

  #header-actions {
    flex: 0 0 auto;
    justify-content: flex-end;
    align-self: flex-start;
  }

  body.edit-mode #search-form {
    flex-basis: calc(100% - 22rem);
  }

  body.edit-mode #header-actions {
    flex-basis: 22rem;
  }
}

.weather-panel {
  min-width: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  backdrop-filter: none;
  cursor: pointer;
}

.logout-button {
  min-height: 2.3rem;
}

.weather-topline {
  display: block;
}

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

.weather-location {
  display: block;
  font-size: 0.58rem;
  line-height: 1;
  letter-spacing: 0.1em;
  white-space: nowrap;
}

.weather-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  min-width: 0;
  font-size: 0.64rem;
  line-height: 1.1;
}

.weather-current {
  display: flex;
  align-items: center;
  gap: 0.38rem;
  min-width: 0;
}

.weather-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  height: 1.1rem;
}

.weather-icon-svg {
  width: 1.1rem;
  height: 1.1rem;
  overflow: visible;
}

.weather-rain {
  font-size: 0.58rem;
  line-height: 1;
  white-space: nowrap;
}

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

.weather-panel:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 0.2rem;
}

.weather-stats {
  display: flex;
  gap: 0.35rem;
  align-items: stretch;
  justify-content: center;
  width: 100%;
}

.weather-stat {
  min-width: 0;
  padding: 0.22rem 0.42rem 0.28rem;
  border-radius: 0.7rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.weather-stat-label {
  display: block;
  font-size: 0.5rem;
  line-height: 1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.weather-stat-value {
  display: block;
  margin-top: 0.22rem;
  font-size: 0.63rem;
  line-height: 1;
  color: var(--text-main);
}

.theme-input,
.launchpad-modal {
  background: rgba(2, 6, 23, 0.88);
  color: var(--text-main);
}

.login-modal {
  background: rgba(2, 6, 23, 0.95);
}

.theme-input::placeholder {
  color: var(--text-soft);
}

.theme-input:focus,
.theme-checkbox:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.theme-primary-button {
  background: var(--accent);
  color: var(--button-text);
  transition: filter 150ms ease, transform 150ms ease;
}

.theme-primary-button:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.theme-danger-button {
  background: rgba(127, 29, 29, 0.22);
  border-color: rgba(252, 165, 165, 0.3);
  color: #fecaca;
}

.theme-danger-button:hover {
  background: rgba(185, 28, 28, 0.28);
}

.theme-tile {
  background: rgba(255, 255, 255, 0.05);
  transition: background 150ms ease, border-color 150ms ease;
}

.theme-file-input {
  color: var(--text-muted);
}

.theme-file-input::file-selector-button {
  margin-right: 1rem;
  border: 0;
  border-radius: 1rem;
  background: var(--accent-soft);
  color: var(--text-main);
  padding: 0.5rem 1rem;
}

.theme-checkbox {
  border-color: var(--muted-border);
  color: var(--accent-strong);
}

.theme-icon-well {
  background: rgba(2, 6, 23, 0.26);
  border: 1px solid var(--muted-border);
}

.link-icon-well {
  flex: 0 0 2.5rem;
  min-width: 2.5rem;
  min-height: 2.5rem;
}

.link-icon-image {
  display: block;
  flex-shrink: 0;
  margin: 0 auto;
}

.search-submit-button {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
}

.somafm-kicker {
  line-height: 1;
}

.somafm-widget-shell {
  min-width: 0;
}

.somafm-deck-row,
.somafm-meta {
  min-width: 0;
}

.somafm-deck-row {
  display: grid;
  grid-template-columns: minmax(11rem, 16rem) minmax(10rem, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
}

.somafm-brand-block {
  min-width: 0;
}

.somafm-kicker {
  margin: 0;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.somafm-title-line {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
  min-width: 0;
  margin-top: 0.35rem;
}

.somafm-title {
  margin: 0;
  flex: 0 0 auto;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1;
}

.somafm-description {
  margin: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.somafm-station-select {
  min-width: 0;
}

.somafm-control-cluster {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  justify-content: flex-end;
}

.somafm-station-select {
  width: 13rem;
  max-width: 13rem;
}

.somafm-color-scheme {
  width: 7rem;
  max-width: 7rem;
}

.somafm-volume-shell {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  white-space: nowrap;
}

.somafm-volume-label {
  font-size: 0.68rem;
  line-height: 1;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.somafm-volume-slider {
  width: 5.5rem;
  accent-color: var(--accent-strong);
}

.somafm-visualizer-shell {
  min-width: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02)),
    rgba(2, 6, 23, 0.22);
}

.somafm-visualizer {
  display: block;
  width: 100%;
  height: 25px;
  min-height: 25px;
  max-height: 25px;
}

.somafm-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.somafm-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem;
  margin-top: 0.55rem;
  padding-top: 0.45rem;
  border-top: 1px solid var(--muted-border);
  font-size: 0.72rem;
  color: var(--text-muted);
}

.somafm-meta span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.somafm-link {
  flex: 0 0 auto;
  white-space: nowrap;
  color: var(--accent);
}

@media (max-width: 1279px) {
  .somafm-deck-row {
    grid-template-columns: 1fr;
    gap: 0.55rem;
  }

  .somafm-control-cluster,
  .somafm-controls {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .somafm-meta {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .somafm-meta span,
  .somafm-link,
  .somafm-description {
    white-space: normal;
  }
}

.card-header {
  cursor: grab;
  user-select: none;
}

.card-header:active {
  cursor: grabbing;
}

.launchpad-card.sortable-ghost {
  opacity: 0.35;
}

.launchpad-card.sortable-drag {
  transform: rotate(1deg);
}

.edit-mode .edit-controls,
.edit-mode .add-card-button,
.edit-mode .theme-picker,
.edit-mode .link-edit-controls {
  display: flex;
}

.launchpad-modal::backdrop {
  background: transparent;
}

.link-item.sortable-ghost {
  opacity: 0.35;
}

.card-dropzone {
  min-height: 8rem;
}

.link-item.sortable-drag {
  transform: scale(0.98);
}

.link-drag-handle {
  cursor: grab;
}

.link-drag-handle:active {
  cursor: grabbing;
}

@media (max-width: 1279px) {
  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767px) {
  .dashboard-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
