/* Chrome for the deployed prototype: device stage + screen-state switcher + password gate. */
:root { --rail: 248px; --bar: 44px; }

html, body { height: 100%; margin: 0; background: #06070a; overscroll-behavior: none; }
body { overflow: hidden; }
#root { display: contents; }

/* ---------- layout ----------
   Device size is CSS-driven. JS only picks the desktop fit scale, so a late or
   failed measurement can never leave the app taller than the visible viewport. */
.gg-stage {
  position: fixed; inset: 0 var(--rail) 0 0;
  display: flex; align-items: center; justify-content: center;
  padding: 16px; box-sizing: border-box; overflow: hidden;
  background:
    radial-gradient(60% 50% at 50% 0%, rgba(0, 229, 219, 0.07), transparent 70%),
    #06070a;
}
.gg-device { position: relative; flex: none; transform: scale(var(--gg-scale, 1)); transform-origin: center; }
.gg-modals { position: absolute; inset: 0; border-radius: var(--radius-device); overflow: hidden; }

/* ---------- screen switcher (desktop rail) ---------- */
.gg-switch {
  position: fixed; top: 0; right: 0; bottom: 0; width: var(--rail);
  display: flex; flex-direction: column; box-sizing: border-box;
  background: #0b0c12; border-left: 1px solid var(--gg-line);
  font-family: var(--font-ui);
}
.gg-switch-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 18px 12px; border-bottom: 1px solid var(--gg-line);
}
.gg-switch-title { font-size: 12px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--gg-cyan); }
.gg-switch-count { font-size: 11px; font-weight: 700; color: var(--text-disabled); }
.gg-switch-list { flex: 1; min-height: 0; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.gg-switch-foot { padding: 12px; border-top: 1px solid var(--gg-line); display: flex; flex-direction: column; gap: 6px; }

.gg-pill {
  display: flex; align-items: center; min-height: 38px; padding: 0 14px;
  border-radius: 9999px; border: 1px solid var(--gg-line-strong); background: transparent;
  color: var(--text-muted); font-family: var(--font-ui); font-size: 13px; font-weight: 700;
  text-align: left; text-decoration: none; cursor: pointer; transition: all 140ms var(--ease);
}
.gg-pill:hover { background: var(--gg-fill-hover); color: #fff; }
.gg-pill.is-active { border-color: var(--gg-cyan); color: var(--gg-cyan); background: color-mix(in srgb, var(--gg-cyan) 14%, transparent); }
.gg-pill-link { color: var(--gg-cyan); }
.gg-pill-warn { color: var(--gg-domain-speed); }
.gg-pill-quiet { color: var(--text-disabled); }

.gg-switch-fab, .gg-scrim { display: none; }

/* ---------- mobile: app fills the screen, switcher becomes a sheet ---------- */
/* ---------- full-bleed app mode: phones, and any touch device up to tablet ----------
   svh = the viewport with browser toolbars showing, so the app always fits whether
   or not iOS/Android has retracted them. */
@media (max-width: 760px), (pointer: coarse) and (max-width: 1024px) {
  :root {
    --device-w: min(100vw, 440px);
    --device-h: calc(100vh - var(--bar));
    --device-h: calc(100svh - var(--bar));
    --radius-device: 0px;
  }
  .gg-stage {
    inset: auto; top: var(--bar); left: 0; right: 0;
    height: calc(100vh - var(--bar));
    height: calc(100svh - var(--bar));
    padding: 0; align-items: flex-start;
  }
  .gg-device { transform: none; }
  .gg-device > div { box-sizing: border-box; }

  /* Prototype chrome sits in its own bar, so it never covers the app UI. */
  .gg-switch-fab {
    position: fixed; top: 0; left: 0; right: 0; height: var(--bar); z-index: 90;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    border: 0; border-bottom: 1px solid var(--gg-line); border-radius: 0;
    background: #0b0c12; color: var(--gg-cyan);
    font-family: var(--font-ui); font-size: 13px; font-weight: 800;
    letter-spacing: 0.06em; text-transform: uppercase; cursor: pointer;
  }
  .gg-switch-fab .material-symbols-outlined { font-size: 20px; }

  .gg-scrim {
    display: block; position: fixed; inset: 0; z-index: 95;
    background: rgba(0, 0, 0, 0.6); opacity: 0; pointer-events: none; transition: opacity 180ms;
  }
  .gg-scrim.is-open { opacity: 1; pointer-events: auto; }

  .gg-switch {
    top: auto; left: 0; right: 0; bottom: 0; width: auto; z-index: 100;
    max-height: 70svh; border-left: 0; border-top: 1px solid var(--gg-line-strong);
    border-radius: 24px 24px 0 0; box-shadow: 0 -16px 40px rgba(0, 0, 0, 0.6);
    padding-bottom: env(safe-area-inset-bottom);
    transform: translateY(101%); transition: transform 240ms var(--ease);
  }
  .gg-switch.is-open { transform: none; }
  .gg-switch-list { flex-direction: row; flex-wrap: wrap; }
  .gg-pill { flex: none; }
}

/* ---------- password gate ---------- */
:root:not([data-unlocked]) .gg-stage,
:root:not([data-unlocked]) .gg-switch,
:root:not([data-unlocked]) .gg-switch-fab { display: none !important; }

#gate {
  position: fixed; inset: 0; z-index: 999;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  font-family: var(--font-ui); color: #fff;
  background:
    radial-gradient(70% 55% at 50% 0%, rgba(0, 229, 219, 0.12), transparent 70%),
    #06070a;
}
#gate[data-shake] form { animation: gg-shake 0.4s ease; }
@keyframes gg-shake { 10%, 90% { transform: translateX(-2px); } 30%, 70% { transform: translateX(5px); } 50% { transform: translateX(-7px); } }

#gate form { width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 14px; text-align: center; }
#gate img { width: 190px; margin: 0 auto 4px; mix-blend-mode: lighten; }
#gate h1 { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
#gate p { margin: -6px 0 6px; font-size: 14px; font-weight: 500; color: var(--text-muted); }
#gate input {
  height: 56px; padding: 0 18px; box-sizing: border-box; width: 100%;
  border-radius: var(--radius-card); border: 1px solid var(--gg-line-strong);
  background: var(--surface-card); color: #fff; outline: none;
  font-family: var(--font-ui); font-size: 16px; font-weight: 600; text-align: center;
}
#gate input:focus { border-color: var(--gg-cyan); box-shadow: 0 0 18px color-mix(in srgb, var(--gg-cyan) 28%, transparent); }
#gate button {
  height: 56px; border: 0; border-radius: 9999px; cursor: pointer;
  background: var(--grad-cta); color: var(--text-on-accent);
  font-family: var(--font-ui); font-size: 18px; font-weight: 800; letter-spacing: 0.025em;
  box-shadow: var(--glow-cta);
}
#gate #gate-error { min-height: 18px; font-size: 13px; font-weight: 700; color: var(--gg-domain-speed); }
