:root {
  color-scheme: dark;
  --surface: rgba(16, 16, 16, 0.78);
  --surface-strong: rgba(18, 18, 18, 0.96);
  --surface-soft: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.11);
  --text: #f4f3ee;
  --muted: #beb8ac;
  --accent: #f2d06b;
  --accent-strong: #dbb23b;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: #000;
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  overscroll-behavior: none;
}

body {
  min-height: 100vh;
}

button,
input {
  font: inherit;
}

button:disabled {
  opacity: 0.58;
}

.app-shell {
  min-height: 100vh;
  background:
    radial-gradient(circle at top, rgba(77, 66, 32, 0.34), transparent 34%),
    linear-gradient(180deg, #111 0%, #040404 58%, #000 100%);
}

.viewer-shell {
  position: relative;
  display: grid;
  min-height: 100vh;
  width: 100%;
  place-items: center;
  padding: 0;
  touch-action: manipulation;
  user-select: none;
}

#page-image {
  display: block;
  width: 100vw;
  height: 100vh;
  object-fit: contain;
  background: #090909;
  transition: opacity 160ms ease;
  touch-action: manipulation;
}

#page-image.is-loading {
  opacity: 0.72;
}

.loading {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 0.85rem 1.15rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.08);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-size: 0.78rem;
  box-shadow: var(--shadow);
  z-index: 3;
}

.loading.is-hidden,
.is-hidden {
  display: none !important;
}

.fullscreen-guard {
  position: fixed;
  inset: 0;
  z-index: 7;
  display: grid;
  place-items: center;
  padding: calc(var(--safe-top) + 1rem) 1rem calc(var(--safe-bottom) + 1rem);
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.fullscreen-guard-card {
  width: min(92vw, 340px);
  padding: 1rem;
  border-radius: 22px;
  border: 1px solid var(--border);
  background: rgba(14, 14, 14, 0.94);
  box-shadow: var(--shadow);
}

.fullscreen-guard-eyebrow {
  margin: 0 0 0.35rem;
  color: var(--accent);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.fullscreen-guard-title {
  margin: 0 0 0.45rem;
  font-size: 1.55rem;
}

.fullscreen-guard-copy {
  margin: 0 0 0.9rem;
  color: var(--muted);
  line-height: 1.35;
}

.fullscreen-guard-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
}

.launch-screen {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  padding: calc(var(--safe-top) + 1rem) 1rem calc(var(--safe-bottom) + 1.25rem);
  background:
    radial-gradient(circle at top, rgba(248, 215, 112, 0.18), transparent 33%),
    linear-gradient(180deg, rgba(8, 8, 8, 0.94) 0%, rgba(4, 4, 4, 0.98) 100%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.launch-card {
  width: min(92vw, 420px);
  padding: 1rem;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(14, 14, 14, 0.92);
  box-shadow: var(--shadow);
}

.launch-icon {
  width: 84px;
  height: 84px;
  display: block;
  margin-bottom: 0.95rem;
  border-radius: 22px;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.35);
}

.launch-eyebrow,
.install-eyebrow {
  margin: 0 0 0.35rem;
  color: var(--accent);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.launch-title,
.install-title {
  margin: 0 0 0.8rem;
  font-size: clamp(1.7rem, 5vw, 2.5rem);
  line-height: 1;
}

.launch-copy,
.install-copy {
  margin: 0 0 0.8rem;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.35;
}

.launch-steps,
.install-steps {
  margin: 0 0 0.85rem;
  padding-left: 1.2rem;
  display: grid;
  gap: 0.36rem;
  color: var(--text);
}

.launch-steps li,
.install-steps li {
  line-height: 1.4;
}

.launch-actions {
  display: grid;
  gap: 0.5rem;
}

.launch-button,
.launch-link,
.pill,
.pill-button,
.nav-button {
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.launch-button,
.launch-link,
.pill-button,
.nav-button,
.button {
  border: 0;
  cursor: pointer;
}

.launch-button {
  width: 100%;
  padding: 0.9rem 1rem;
  font-size: 1rem;
}

.launch-button-primary,
.pill-button:not(.pill-button-secondary),
.nav-button-fullscreen,
.button-primary {
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #17120a;
  font-weight: 700;
}

.launch-button-secondary,
.pill-button-secondary,
.button-secondary,
.nav-button-primary {
  background: rgba(20, 20, 20, 0.84);
  color: var(--text);
}

.launch-link {
  width: 100%;
  padding: 0.9rem 1rem;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
}

.chrome {
  position: fixed;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-left: 0.9rem;
  padding-right: 0.9rem;
  z-index: 5;
  transition: opacity 180ms ease, transform 180ms ease;
}

.chrome.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.chrome-top {
  top: 0;
  padding-top: calc(var(--safe-top) + 0.75rem);
  transform: translateY(0);
}

.chrome-top.is-hidden {
  transform: translateY(-12px);
}

.chrome-bottom {
  bottom: 0;
  justify-content: center;
  padding-bottom: calc(var(--safe-bottom) + 1rem);
  transform: translateY(0);
}

.chrome-bottom.is-hidden {
  transform: translateY(12px);
}

.chrome-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.55rem;
}

.pill {
  padding: 0.72rem 1rem;
  font-size: 0.95rem;
  line-height: 1;
}

.pill-button,
.nav-button {
  padding: 0.78rem 1rem;
  font-size: 1rem;
}

.nav-button {
  min-width: 120px;
}

.nav-button-fullscreen {
  min-width: 196px;
  font-size: 1.03rem;
}

.install-sheet {
  border: 0;
  padding: 0;
  background: transparent;
}

.install-sheet::backdrop {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 9;
  display: grid;
  place-items: center;
  padding: calc(var(--safe-top) + 1rem) 1rem calc(var(--safe-bottom) + 1.25rem);
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.modal-card,
.install-card {
  width: min(88vw, 360px);
  margin: 0;
  padding: 1.1rem;
  border-radius: 24px;
  border: 1px solid var(--border);
  background: var(--surface-strong);
  color: var(--text);
  box-shadow: var(--shadow);
}

.modal-label {
  display: block;
  margin: 0 0 0.8rem;
}

#song-number {
  width: 100%;
  margin-bottom: 1rem;
  padding: 0.95rem 1rem;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--text);
  font-size: 1.45rem;
  text-align: center;
}

.modal-actions,
.install-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.7rem;
}

.button {
  border-radius: 15px;
  padding: 0.82rem 1rem;
}

.nav-button:disabled,
.launch-button:disabled,
.launch-link:disabled {
  opacity: 0.42;
}

@media (max-width: 720px) {
  .launch-card {
    width: min(94vw, 390px);
    padding: 0.95rem;
    border-radius: 22px;
  }

  .launch-icon {
    width: 72px;
    height: 72px;
    border-radius: 19px;
  }

  .chrome {
    padding-left: 0.65rem;
    padding-right: 0.65rem;
  }

  .chrome-top {
    align-items: flex-start;
    flex-direction: column;
  }

  .fullscreen-guard-actions {
    flex-direction: column;
  }

  .chrome-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .pill,
  .pill-button,
  .nav-button {
    font-size: 0.95rem;
  }

  .chrome-bottom {
    gap: 0.55rem;
    padding-left: 0.65rem;
    padding-right: 0.65rem;
  }

  .nav-button {
    min-width: 0;
    flex: 1;
  }

  .nav-button-fullscreen {
    flex: 1.35;
  }
}
