.menu-scrim {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: none;
  background: rgba(28, 31, 30, 0.08);
}

.start-menu {
  position: fixed;
  left: 50%;
  bottom: max(96px, calc(82px + env(safe-area-inset-bottom)));
  z-index: 15;
  width: min(980px, calc(100vw - 28px));
  max-height: min(720px, calc(100svh - 126px));
  overflow: auto;
  padding: 18px;
  border: 1px solid rgba(20, 23, 25, 0.16);
  border-radius: 8px;
  background: rgba(250, 248, 242, 0.93);
  box-shadow: 0 30px 100px rgba(46, 55, 52, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(24px) saturate(1.08);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 16px) scale(0.98);
  transition: opacity 160ms ease, transform 160ms ease;
}

body[data-menu-open="true"] .start-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0) scale(1);
}

body[data-menu-open="true"] .menu-scrim { display: block; }

.menu-header,
.third-party {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 18px;
  align-items: center;
}

.system-status strong,
.menu-brand strong,
.app-tile strong,
.third-party h2 {
  display: block;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.system-status span,
.menu-brand span,
.app-tile small,
.third-party p {
  color: var(--graphite);
  font-size: 0.78rem;
}

.system-status i {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 16px rgba(45, 143, 98, 0.5);
}

.menu-brand { text-align: center; }

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

.menu-actions button,
.mode-switch button,
.third-party button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.48);
  color: var(--ink);
  cursor: pointer;
}

.menu-actions button {
  width: 34px;
  height: 34px;
}

.account-entry {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 120px;
  color: inherit;
  text-decoration: none;
}

.account-entry span {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  font-weight: 800;
}

.account-entry small { color: var(--graphite); line-height: 1.15; }

.account-entry strong {
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 750;
}

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 190px;
  margin: 18px auto;
  padding: 4px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.36);
}

.mode-switch button {
  height: 34px;
  border-color: transparent;
}

.mode-switch .is-active {
  background: #15191a;
  color: #fff;
}

.command-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.56);
}

.command-bar span {
  color: var(--graphite);
  font-size: 0.78rem;
}

.command-bar input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.menu-section h2,
.third-party h2 {
  margin: 18px 0 12px;
  font-size: 0.76rem;
}

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

.app-tile {
  display: flex;
  min-height: 76px;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.45);
  color: inherit;
  text-decoration: none;
}

.app-tile span:last-child {
  min-width: 0;
}

.app-tile strong,
.app-tile small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile-mark {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  background: linear-gradient(145deg, #fff, var(--warm));
  font-weight: 800;
}

.third-party {
  grid-template-columns: 1fr auto;
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.34);
}

.third-party h2,
.third-party p { margin: 0; }

.third-party button {
  padding: 10px 14px;
  opacity: 0.55;
  cursor: not-allowed;
}

@media (max-width: 720px) {
  .start-menu {
    inset: auto 10px max(86px, calc(74px + env(safe-area-inset-bottom)));
    width: auto;
    max-height: calc(100svh - 104px);
    transform: translateY(18px);
  }

  body[data-menu-open="true"] .start-menu { transform: translateY(0); }

  .menu-header {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .menu-brand { text-align: left; }
  .menu-actions { justify-content: flex-start; }
  .account-entry { min-width: 0; }
  .app-grid { grid-template-columns: 1fr 1fr; }

  .app-tile {
    min-height: 58px;
    padding: 10px;
  }

  .app-tile small { display: none; }

  .third-party {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

@media (max-width: 340px) {
  .app-grid { grid-template-columns: 1fr; }

  .start-menu {
    padding: 16px;
  }
}
