/**
 * Production PWA shell — full viewport, no prototype sidebar or faux phone frame.
 * Loaded after app.css.
 */

html {
  height: 100%;
}

body.pwa-body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--studio-bg);
}

/* Replace prototype “phone in canvas” sizing with real viewport shell */
.pwa-root.phone {
  display: flex;
  flex-direction: column;
  position: relative;
  width: 100%;
  max-width: none;
  height: 100dvh;
  max-height: 100dvh;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  aspect-ratio: auto !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: linear-gradient(180deg, #ffffff 0%, var(--phone-shell) 35%, #e8eaee 100%);
  isolation: isolate;
  overflow: hidden;
}

/* Shader sat below fake status bar in prototype; align to top on real PWA */
.pwa-root .signin-shader-bg {
  top: 0 !important;
}

/* Desktop / large-pointer gate */
.desktop-gate[hidden] {
  display: none !important;
}

.desktop-gate:not([hidden]) {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  box-sizing: border-box;
  background: rgba(18, 21, 26, 0.94);
  backdrop-filter: blur(6px);
}

html.desktop-gate-open,
html.desktop-gate-open body.pwa-body {
  overflow: hidden;
  height: 100%;
}

.desktop-gate__panel {
  width: 100%;
  max-width: 28rem;
  background: var(--surface);
  padding: 22px 20px 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}

.desktop-gate__title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0 0 10px;
  color: var(--text);
}

.desktop-gate__text {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-secondary);
  margin: 0 0 14px;
}

.desktop-gate__label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin: 0 0 4px;
}

.desktop-gate__url.mono {
  font-family: ui-monospace, Consolas, "Courier New", monospace;
  font-size: 12px;
  word-break: break-all;
  color: var(--accent);
  margin: 0 0 12px;
  padding: 10px 12px;
  background: var(--surface-subtle);
  border: 1px solid var(--hairline);
}

.desktop-gate .btn {
  width: 100%;
  margin-top: 8px;
}

.desktop-gate__hint {
  font-size: 12px;
  color: var(--text-tertiary);
  margin: 14px 0 0;
  line-height: 1.45;
}

/* First-visit install prompt (below desktop gate z-index) */
.install-prompt-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 8000;
  padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 10px max(12px, env(safe-area-inset-left));
  background: rgba(255, 255, 255, 0.97);
  border-bottom: 1px solid var(--hairline);
  box-shadow: 0 6px 20px rgba(15, 20, 25, 0.08);
}

.install-prompt-bar__inner {
  max-width: 32rem;
  margin: 0 auto;
}

.install-prompt-bar__text {
  margin: 0 0 10px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text);
}

.install-prompt-bar__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.install-prompt-bar__btn {
  width: auto;
  min-width: 0;
  flex: 1 1 auto;
  margin-top: 0;
}

/* Sign-in: Email vs WhatsApp */
.signin-method-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 12px;
  border: 1px solid var(--hairline);
}

.signin-method-tabs__btn {
  flex: 1;
  border: 0;
  padding: 10px 8px;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
}

.signin-method-tabs__btn.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: inset 0 -2px 0 0 var(--accent);
}

.signin-method-panel {
  margin-bottom: 4px;
}

#phone.phone--install-prompt #screenScroll {
  padding-top: 108px;
}

/*
 * Footer + scroll: long screens (Me, Newsfeed, …) grow .screen height and scroll
 * inside #screenScroll — not expand #phone past the viewport (overflow:hidden had
 * clipped the footer and prevented scrolling).
 */
.pwa-root.phone .screen-scroll {
  flex: 1 1 0%;
  min-height: 0;
}

.pwa-root.phone .screen-scroll .screen.is-active {
  flex: 0 0 auto;
  width: 100%;
  /* At least one viewport of the scroll area when content is short; grow with long content so #screenScroll scrolls */
  min-height: 100%;
}

