:root {
  --bg0: #101418;
  --bg1: #171c22;
  --ink: #f2efe8;
  --muted: #9aa8b8;
  --accent: #3d9cf0;
  --accent-2: #e8a54b;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg0);
  color: var(--ink);
  font-family: "Instrument Sans", sans-serif;
  overscroll-behavior: none;
}

.stage {
  height: 100dvh;
  height: 100vh;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: var(--safe-bottom);
}

.chrome {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.4rem 0.75rem 0.2rem;
  background: var(--bg0);
}

.era-meta {
  min-width: 0;
  flex: 1;
}

.era-label {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.era-date {
  margin: 0.1rem 0 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  color: var(--accent-2);
}

.chrome-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.era-index {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  color: var(--muted);
}

.controls {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  padding: 0.15rem 0.65rem 0.55rem;
  background: var(--bg0);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.viewport-wrap {
  position: relative;
  width: 100%;
  min-height: 0;
  overflow: hidden;
  background: #fff;
}

.era-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
  opacity: 1;
  transition: opacity 180ms ease;
}

.era-frame.is-switching { opacity: 0.12; }

.nav-btn, .play-btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
  border-radius: 12px;
  height: 44px;
  min-width: 44px;
  font: inherit;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
}

.play-btn {
  height: 32px;
  min-width: 0;
  padding: 0 0.65rem;
  font-size: 0.78rem;
  font-weight: 600;
}

.nav-btn:active, .play-btn:active {
  transform: scale(0.97);
}

.play-btn[aria-pressed="true"] {
  background: var(--accent);
  border-color: transparent;
  color: #071018;
}

.slider-block {
  flex: 1;
  min-width: 0;
}

#era-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 44px;
  margin: 0;
  background: transparent;
  cursor: pointer;
  touch-action: pan-x;
}

#era-slider:focus { outline: none; }

#era-slider::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
}

#era-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 28px;
  height: 28px;
  margin-top: -10px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

#era-slider::-moz-range-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
}

#era-slider::-moz-range-thumb {
  width: 28px;
  height: 28px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--accent);
}

.era-ticks {
  display: none;
  justify-content: space-between;
  margin-top: 0.1rem;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.62rem;
  color: var(--muted);
  gap: 0.2rem;
}

.era-ticks span {
  flex: 1;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.era-ticks span.is-active {
  color: var(--accent);
  font-weight: 500;
}

/* Phone + tablet stay full-bleed; only large desktops get a phone-width column */
@media (min-width: 1024px) {
  body {
    background:
      radial-gradient(900px 420px at 15% -10%, #2a3f5c 0%, transparent 55%),
      radial-gradient(700px 380px at 100% 0%, #3a2a1a 0%, transparent 50%),
      linear-gradient(165deg, var(--bg0), var(--bg1));
  }

  .stage {
    max-width: 430px;
    width: 100%;
    margin: 0 auto;
  }

  .chrome,
  .controls {
    padding-left: 0.9rem;
    padding-right: 0.9rem;
  }

  .viewport-wrap {
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  }

  .era-ticks { display: flex; }

  .era-label { font-size: 1.05rem; }
}
