:root {
  color-scheme: dark;
  --bg: #080a0d;
  --surface: #101319;
  --surface-2: #171b22;
  --surface-3: #20252e;
  --text: #f6f7f9;
  --muted: #9aa3af;
  --muted-2: #6d7682;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --accent: #7b8cff;
  --accent-strong: #a2adff;
  --success: #62dca5;
  --danger: #ff6a7c;
  --radius-lg: 22px;
  --radius-md: 16px;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  min-width: 320px;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 82% -5%, rgba(85, 96, 214, 0.23), transparent 31rem),
    radial-gradient(circle at 7% 35%, rgba(35, 132, 125, 0.12), transparent 28rem),
    var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(123, 140, 255, 0.52);
  outline-offset: 3px;
}

.sr-only {
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

.app-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 0 40px 36px;
}

.topbar {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand {
  color: inherit;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand img {
  filter: drop-shadow(0 8px 24px rgba(123, 140, 255, 0.26));
}

.brand span,
.mode-button span,
.hero-status div {
  display: flex;
  flex-direction: column;
}

.brand strong {
  letter-spacing: -0.02em;
  font-size: 17px;
}

.brand small,
.mode-button small,
.hero-status span,
.count-label {
  color: var(--muted);
  font-size: 12px;
}

.topbar-tools {
  display: flex;
  align-items: center;
  gap: 12px;
}

.environment-chip,
.language-picker select,
.clock {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  background: rgba(16, 19, 25, 0.72);
  border-radius: 999px;
  color: var(--muted);
  padding: 0 15px;
  font-size: 13px;
  backdrop-filter: blur(18px);
}

.environment-chip {
  gap: 8px;
}

.environment-chip.vehicle {
  color: var(--text);
}

.status-dot,
.pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted-2);
}

.environment-chip.vehicle .status-dot,
.pulse {
  background: var(--success);
  box-shadow: 0 0 0 5px rgba(98, 220, 165, 0.1);
}

.language-picker select {
  appearance: none;
  padding-right: 32px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 17px) 18px,
    calc(100% - 12px) 18px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.clock {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.safety-banner {
  margin: 16px 0 0;
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 10px 12px 10px 18px;
  border: 1px solid rgba(255, 187, 99, 0.2);
  background: rgba(99, 65, 25, 0.23);
  border-radius: var(--radius-md);
}

.safety-banner[hidden] {
  display: none;
}

.safety-banner div {
  display: flex;
  gap: 10px;
  align-items: baseline;
}

.safety-banner strong {
  color: #ffd5a1;
  white-space: nowrap;
}

.safety-banner span {
  color: #cbb38f;
  font-size: 13px;
}

.text-button {
  border: 0;
  color: var(--accent-strong);
  background: transparent;
  min-height: 40px;
  padding: 0 12px;
  font-weight: 650;
  white-space: nowrap;
}

.hero {
  min-height: 280px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 44px;
  padding: 54px 0 34px;
}

.hero-copy {
  max-width: 760px;
}

.eyebrow {
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin: 0 0 12px;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 18px;
  font-size: clamp(38px, 5vw, 72px);
  line-height: 0.98;
  letter-spacing: -0.055em;
  font-weight: 650;
}

h2 {
  margin-bottom: 0;
  font-size: 24px;
  letter-spacing: -0.035em;
}

.hero-copy > p:last-child {
  max-width: 650px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.55;
}

.hero-status {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 265px;
  padding: 16px 18px;
  border-left: 1px solid var(--line-strong);
}

.hero-status strong {
  margin-bottom: 4px;
  font-size: 14px;
}

.control-panel {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto auto;
  gap: 12px;
  align-items: stretch;
}

.search-box,
.mode-button,
.primary-button,
.secondary-button {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  min-height: 64px;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 18px;
  background: rgba(16, 19, 25, 0.82);
}

.search-icon {
  width: 18px;
  height: 18px;
  border: 2px solid var(--muted);
  border-radius: 50%;
  position: relative;
  flex: 0 0 auto;
}

.search-icon::after {
  content: "";
  position: absolute;
  width: 7px;
  height: 2px;
  background: var(--muted);
  transform: rotate(45deg);
  right: -5px;
  bottom: -2px;
}

.search-box input {
  width: 100%;
  min-width: 0;
  height: 58px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 16px;
}

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

kbd {
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--muted);
  border-radius: 7px;
  min-width: 27px;
  padding: 4px 7px;
  text-align: center;
}

.mode-button,
.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 0 20px;
  color: var(--text);
}

.mode-button {
  min-width: 205px;
  justify-content: flex-start;
  background: var(--surface);
}

.mode-button[aria-pressed="true"] .mode-icon {
  background: var(--success);
  box-shadow: 0 0 0 6px rgba(98, 220, 165, 0.1);
}

.mode-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.mode-icon {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted-2);
}

.mode-button strong {
  margin-top: 3px;
  font-size: 14px;
}

.primary-button {
  border-color: transparent;
  background: var(--text);
  color: #090b0e;
  font-weight: 750;
}

.primary-button:hover {
  background: #dfe2e8;
}

.secondary-button {
  background: var(--surface-2);
  font-weight: 650;
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 0 12px;
  overflow-x: auto;
  scrollbar-width: none;
}

.filter-row::-webkit-scrollbar {
  display: none;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-divider {
  width: 1px;
  height: 25px;
  background: var(--line-strong);
  flex: 0 0 auto;
}

.filter-button {
  min-height: 42px;
  white-space: nowrap;
  padding: 0 15px;
  border-radius: 999px;
  border: 1px solid transparent;
  color: var(--muted);
  background: transparent;
}

.filter-button:hover {
  color: var(--text);
  background: var(--surface);
}

.filter-button[aria-pressed="true"] {
  color: var(--text);
  background: var(--surface-2);
  border-color: var(--line);
}

.content-section {
  padding: 40px 0 8px;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.section-heading .eyebrow {
  margin-bottom: 6px;
}

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

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

.app-card {
  position: relative;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.035), transparent 45%),
    rgba(16, 19, 25, 0.82);
  overflow: hidden;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.app-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  background: var(--surface-2);
}

.card-open {
  width: 100%;
  min-height: 146px;
  border: 0;
  background: transparent;
  color: inherit;
  display: flex;
  align-items: flex-start;
  gap: 15px;
  padding: 20px 54px 20px 18px;
  text-align: left;
}

.app-icon,
.modal-app-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 15px;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -0.02em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 10px 30px rgba(0, 0, 0, 0.22);
}

.accent-red { background: linear-gradient(145deg, #ff5f6d, #b31e32); }
.accent-blue { background: linear-gradient(145deg, #6aa9ff, #334ec4); }
.accent-cyan { background: linear-gradient(145deg, #55cfef, #087d9e); }
.accent-purple { background: linear-gradient(145deg, #a383ff, #6031be); }
.accent-green { background: linear-gradient(145deg, #55dda0, #14784a); }
.accent-pink { background: linear-gradient(145deg, #ff7cb5, #b52766); }
.accent-amber { background: linear-gradient(145deg, #ffc864, #b36c0c); }
.accent-orange { background: linear-gradient(145deg, #ff9a5e, #b6431f); }

.card-copy {
  min-width: 0;
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 8px;
}

.card-copy strong {
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
}

.card-copy small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.card-arrow {
  position: absolute;
  right: 19px;
  bottom: 18px;
  color: var(--muted-2);
  font-size: 18px;
}

.favorite-button,
.remove-button,
.icon-button {
  border: 0;
  background: transparent;
  color: var(--muted-2);
}

.favorite-button {
  position: absolute;
  top: 14px;
  right: 13px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 16px;
}

.favorite-button:hover,
.favorite-button[aria-pressed="true"] {
  color: #ffd875;
  background: rgba(255, 216, 117, 0.08);
}

.remove-button {
  position: absolute;
  left: 8px;
  bottom: 5px;
  width: 32px;
  height: 32px;
  font-size: 19px;
}

.empty-state {
  padding: 70px 20px;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  color: var(--muted);
}

.empty-state strong,
.empty-state span {
  display: block;
}

.empty-state strong {
  margin-bottom: 8px;
  color: var(--text);
}

footer {
  margin-top: 52px;
  padding: 28px 0 4px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  color: var(--muted-2);
  font-size: 12px;
}

footer p {
  margin-bottom: 0;
  max-width: 820px;
  line-height: 1.6;
}

.modal {
  width: min(520px, calc(100vw - 28px));
  border: 1px solid var(--line-strong);
  border-radius: 26px;
  padding: 0;
  background: #11151b;
  color: var(--text);
  box-shadow: var(--shadow);
}

.modal::backdrop {
  background: rgba(1, 3, 6, 0.75);
  backdrop-filter: blur(10px);
}

.modal form {
  position: relative;
  padding: 30px;
}

.close-button {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface-2);
  font-size: 22px;
}

.modal-app-icon {
  width: 64px;
  height: 64px;
  margin-bottom: 25px;
  border-radius: 19px;
}

.modal h2 {
  font-size: 34px;
  margin-bottom: 12px;
}

.modal-description {
  color: var(--muted);
  line-height: 1.55;
}

.destination {
  min-height: 48px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.launch-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.info-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 26px;
}

.form-modal h2 {
  margin-bottom: 10px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 13px;
}

.form-field input {
  width: 100%;
  min-height: 55px;
  padding: 0 15px;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 16px;
}

.form-error {
  min-height: 20px;
  margin: 10px 0 0;
  color: var(--danger);
  font-size: 12px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  z-index: 20;
  transform: translate(-50%, 24px);
  min-height: 48px;
  display: flex;
  align-items: center;
  padding: 0 18px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(28, 33, 42, 0.95);
  color: var(--text);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 1080px) {
  .app-grid,
  .favorites-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .hero-status {
    display: none;
  }
}

@media (max-width: 820px) {
  .app-shell {
    padding: 0 20px 28px;
  }

  .environment-chip,
  .clock {
    display: none;
  }

  .hero {
    min-height: auto;
    padding-top: 46px;
  }

  .control-panel {
    grid-template-columns: 1fr 1fr;
  }

  .search-box {
    grid-column: 1 / -1;
  }

  .mode-button {
    min-width: 0;
  }

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

  .safety-banner div {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }
}

@media (max-width: 560px) {
  .app-shell {
    padding-inline: 14px;
  }

  .topbar {
    min-height: 70px;
  }

  .brand small {
    display: none;
  }

  .language-picker select {
    max-width: 126px;
  }

  .safety-banner {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .hero {
    padding: 38px 0 26px;
  }

  h1 {
    font-size: 42px;
  }

  .control-panel {
    grid-template-columns: 1fr;
  }

  .search-box,
  .mode-button,
  .control-panel > .primary-button {
    grid-column: 1;
  }

  .app-grid,
  .favorites-grid {
    grid-template-columns: 1fr;
  }

  .card-open {
    min-height: 124px;
  }

  footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .modal form {
    padding: 24px 20px 20px;
  }

  .modal-actions {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
