/* Demo section, phone frame, fullscreen overlay */

.demo-section {
  padding: 60px 24px 80px;
  text-align: center;
  background: linear-gradient(180deg, var(--bg) 0%, #0a1018 100%);
}

/* Grid layout: center the phone, feedback panel sits to the right */
.demo-layout {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0;
  align-items: start;
  max-width: 1200px;
  margin: 0 auto;
}

.demo-layout .phone-frame {
  grid-column: 2;
}

.demo-layout .feedback-panel {
  grid-column: 3;
  justify-self: start;
  margin-left: 40px;
  margin-top: 40px;
}

.demo-section h2 {
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 8px;
}

.demo-hint {
  font-size: 14px;
  color: var(--text-2);
  margin-bottom: 40px;
}

/* Phone frame */
.phone-frame {
  position: relative;
  width: 390px;
  height: 844px;
  margin: 0 auto;
  background: #000;
  border-radius: 50px;
  border: 4px solid #2a2a2a;
  box-shadow:
    0 0 0 2px #1a1a1a,
    0 20px 60px rgba(0,0,0,0.6),
    inset 0 0 0 2px #333;
  overflow: hidden;
}

.phone-notch {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 160px;
  height: 34px;
  background: #000;
  border-radius: 0 0 24px 24px;
  z-index: 10;
}

.phone-frame iframe {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 46px;
  background: var(--bg);
}

/* Fullscreen button */
.btn-fullscreen {
  position: absolute;
  bottom: 16px;
  right: 16px;
  z-index: 20;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 25, 35, 0.85);
  color: var(--text-2);
  border: 1px solid var(--divider);
  border-radius: 10px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.btn-fullscreen:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(15, 25, 35, 0.95);
}

/* Fullscreen overlay */
.fullscreen-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  /* Use dvh so the overlay never extends behind browser / OS chrome */
  height: 100vh; /* fallback */
  height: 100dvh;
  z-index: 9999;
  background: var(--bg);
  flex-direction: column;
  /* Cover safe area notch/home indicator */
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  /* Prevent touch-through to page underneath */
  touch-action: none;
  overscroll-behavior: none;
}

.fullscreen-overlay.active {
  display: flex;
}

/* Lock the body when fullscreen is active */
body.fullscreen-active {
  overflow: hidden;
  position: fixed;
  width: 100%;
  height: 100%;
}

.fullscreen-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: var(--card);
  border-bottom: 1px solid var(--divider);
  flex-shrink: 0;
  gap: 8px;
}

.fullscreen-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.fullscreen-actions .btn-auth {
  padding: 6px 14px;
  font-size: 13px;
  white-space: nowrap;
}

.fullscreen-actions .btn-save {
  padding: 6px 14px;
  font-size: 13px;
  white-space: nowrap;
}

.fullscreen-actions .btn-sign-out {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 160px;
}

.fullscreen-overlay .auth-status {
  text-align: center;
  padding: 4px 16px;
  font-size: 13px;
  flex-shrink: 0;
  min-height: 0;
}

.fullscreen-overlay .auth-status:empty {
  display: none;
}

.btn-exit-fullscreen {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  color: var(--text-2);
  border: 1px solid var(--divider);
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.btn-exit-fullscreen:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.fullscreen-iframe {
  flex: 1;
  width: 100%;
  border: none;
  background: var(--bg);
}

/* Hidden on desktop, shown on mobile */
.btn-fullscreen,
.demo-hint-mobile {
  display: none;
}
