: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 {
  border: 0;
  cursor: pointer;
}

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;
}

.chrome {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 5;
  transition: opacity 180ms ease, transform 180ms ease;
}

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

.chrome-top {
  top: 0;
  display: flex;
  justify-content: center;
  padding: calc(var(--safe-top) + 0.75rem) 0.9rem 0;
  transform: translateY(0);
}

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

.chrome-bottom {
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  padding: 0 0.9rem calc(var(--safe-bottom) + 1rem);
  transform: translateY(0);
}

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

.pill,
.nav-button,
.button,
.jump-form {
  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);
}

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

.nav-button {
  min-width: 124px;
  padding: 0.82rem 1rem;
  font-size: 1rem;
}

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

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

.jump-cta {
  position: fixed;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  padding: calc(var(--safe-top) + 1rem) 1rem calc(var(--safe-bottom) + 1rem);
  pointer-events: none;
}

.jump-form {
  width: min(88vw, 540px);
  padding: 1rem;
  border-radius: 28px;
  background: rgba(14, 14, 14, 0.86);
  pointer-events: auto;
}

.jump-label {
  display: block;
  margin: 0 0 0.65rem;
  color: var(--accent);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
}

.jump-row {
  display: flex;
  gap: 0.7rem;
}

.jump-input {
  width: 100%;
  min-width: 0;
  padding: 1rem 1.1rem;
  border-radius: 22px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: clamp(1.5rem, 3vw, 2rem);
  text-align: center;
  letter-spacing: 0.04em;
  outline: none;
}

.jump-input::placeholder {
  color: rgba(244, 243, 238, 0.42);
}

.jump-input:focus {
  border-color: rgba(242, 208, 107, 0.75);
  box-shadow: 0 0 0 2px rgba(242, 208, 107, 0.16);
}

.jump-button {
  min-width: 108px;
  padding: 0 1.15rem;
  border-radius: 22px;
  font-size: 1.05rem;
}

.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,
.install-card {
  width: min(92vw, 340px);
  margin: 0;
  padding: 1rem;
  border-radius: 24px;
  border: 1px solid var(--border);
  background: rgba(14, 14, 14, 0.94);
  color: var(--text);
  box-shadow: var(--shadow);
}

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

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

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

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

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

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

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

.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);
}

@media (max-width: 720px) {
  .chrome-top {
    padding-left: 0.7rem;
    padding-right: 0.7rem;
  }

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

  .jump-form {
    width: min(92vw, 480px);
    padding: 0.9rem;
  }

  .jump-row {
    gap: 0.55rem;
  }

  .jump-button {
    min-width: 88px;
  }

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

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

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

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