.boot {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 30%, #3a2218, var(--ink-deep) 62%);
  z-index: 20;
}

.boot-card { text-align: center; }

.boot-egg {
  width: 54px;
  height: 70px;
  margin: 0 auto 12px;
  border-radius: 50% 50% 48% 48%;
  background: radial-gradient(circle at 35% 30%, #fff, #ffe7a3 45%, #e0b15a);
  box-shadow: 0 8px 0 #8a5a12, inset 0 8px 0 rgba(255, 255, 255, 0.45);
  animation: bob 1.1s ease-in-out infinite;
}

.app {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-columns: minmax(0, 1fr);
  position: relative;
}

.atmosphere {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.atmosphere-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.28;
  filter: saturate(1.15);
}

.atmosphere-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(12, 14, 19, 0.2), rgba(12, 14, 19, 0.82)),
    repeating-linear-gradient(90deg, transparent 0 18px, rgba(255, 197, 49, 0.04) 18px 20px);
}

.lane-drift, .lane-drift-b {
  position: absolute;
  top: -20%;
  bottom: -20%;
  width: 3px;
  background: linear-gradient(var(--secondary), transparent);
  opacity: 0.35;
  animation: drift 9s linear infinite;
}

.lane-drift { left: 18%; }
.lane-drift-b { left: 78%; animation-duration: 12s; }

.topbar, .stage, .dock { position: relative; z-index: 1; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: calc(10px + var(--safe-top)) 14px 8px;
}

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

.brand-kicker {
  margin: 0;
  color: var(--accent);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.brand-name {
  margin: 0;
  font-size: clamp(1rem, 3.4vw, 1.35rem);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-stats { display: flex; gap: 6px; flex: 0 0 auto; }

.top-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  background: rgba(20, 23, 31, 0.78);
  border: 1px solid var(--line);
  font-family: var(--display);
  font-size: 0.85rem;
}

.stage {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 4px 12px calc(112px + var(--safe-bottom));
  scrollbar-width: none;
}

.stage::-webkit-scrollbar { display: none; }

.dock {
  position: absolute;
  z-index: 4;
  left: 50%;
  bottom: calc(10px + var(--safe-bottom));
  transform: translateX(-50%);
  width: min(480px, calc(100% - 16px));
  height: 78px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: end;
  padding: 8px;
  border-radius: 30px;
  background:
    linear-gradient(180deg, rgba(255, 197, 49, 0.28), transparent 22%),
    linear-gradient(180deg, #323846, #151820);
  border: 2px solid var(--secondary);
  box-shadow: 0 8px 0 #07080c, 0 16px 28px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.dock-blob {
  position: absolute;
  left: 8px;
  top: 10px;
  width: calc((100% - 16px) / 5);
  height: calc(100% - 20px);
  border-radius: 20px;
  background: radial-gradient(circle at 50% 20%, rgba(255, 231, 163, 0.95), rgba(255, 77, 46, 0.18) 72%);
  transform: translateX(calc(var(--slot, 0) * 100%));
  transition: transform 0.45s cubic-bezier(0.2, 1.35, 0.32, 1);
  pointer-events: none;
}

.dock-btn {
  position: relative;
  z-index: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  padding: 6px 2px 4px;
  color: var(--text);
}

.dock-btn span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.68rem;
}

.dock-btn.play {
  margin-top: -22px;
}

.dock-btn.play .play-face {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 50% 50% 46% 46%;
  color: #2a120c;
  background: radial-gradient(circle at 35% 28%, #fff 0 8%, #ffb15a 9%, #ff4d2e 62%, #c81d12);
  box-shadow: 0 6px 0 #6e0d0a, inset 0 2px 0 rgba(255, 255, 255, 0.55);
}

.dock-btn[aria-current="page"] { color: #2a120c; }

.dock-btn.play[aria-current="page"] .play-face {
  box-shadow: 0 6px 0 #6e0d0a, 0 0 0 3px var(--highlight), inset 0 2px 0 rgba(255, 255, 255, 0.55);
}

#modal-root, #toast-root {
  position: fixed;
  z-index: 8;
  inset: 0;
  pointer-events: none;
}

#toast-root {
  inset: auto 12px calc(104px + var(--safe-bottom)) 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

body.in-run .topbar,
body.in-run .dock { visibility: hidden; pointer-events: none; }

body.in-run .stage {
  padding: 0;
  overflow: hidden;
}

body.in-run #toast-root { bottom: calc(12px + var(--safe-bottom)); }

@media (max-width: 350px) {
  .dock-btn span { display: none; }
  .brand-name { font-size: 0.92rem; }
  .top-pill { font-size: 0.75rem; }
}

@media (max-height: 640px) {
  .dock { height: 64px; }
  .dock-btn.play { margin-top: -14px; }
  .dock-btn.play .play-face { width: 48px; height: 48px; }
  .stage { padding-bottom: calc(88px + var(--safe-bottom)); }
}

@media (min-width: 880px), (orientation: landscape) and (max-height: 520px) {
  .topbar { padding-left: 118px; }
  .stage {
    padding: 8px 18px 16px 118px;
  }
  .dock {
    left: calc(8px + env(safe-area-inset-left, 0px));
    top: calc(10px + var(--safe-top));
    bottom: calc(10px + var(--safe-bottom));
    transform: none;
    width: 96px;
    height: auto;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: repeat(5, minmax(0, 1fr));
    align-items: stretch;
  }
  .dock-blob {
    left: 8px;
    top: 8px;
    width: calc(100% - 16px);
    height: calc((100% - 16px) / 5);
    transform: translateY(calc(var(--slot, 0) * 100%));
  }
  .dock-btn { justify-content: center; }
  .dock-btn.play { margin-top: 0; }
  .dock-btn.play .play-face { width: 52px; height: 52px; }
  #toast-root { left: 120px; bottom: 16px; }
}

@media (orientation: landscape) and (max-height: 520px) {
  .dock-btn span { display: none; }
  .topbar { display: none; }
  .stage { padding-top: 8px; }
}

.reduce-motion .boot-egg,
.reduce-motion .lane-drift,
.reduce-motion .lane-drift-b,
.reduce-motion .dock-blob { animation: none; transition: none; }

@keyframes bob {
  50% { transform: translateY(6px); }
}

@keyframes drift {
  from { transform: translateY(-8%); }
  to { transform: translateY(8%); }
}
