:root {
  --pf-shell-header-height: 48px;
  --pf-shell-z-header: 2147482100;
  --pf-shell-z-overlay: 2147482200;
  --pf-shell-drawer-width: min(420px, calc(100vw - 20px));
}

html[data-pf-shell="active"] body {
  padding-top: var(--pf-shell-header-height);
}

html[data-pf-shell="active"] body.pf-shell-page-field-lobby,
html[data-pf-shell="active"] body.pf-shell-page-blankpage-rooms-prototype,
html[data-pf-shell="active"] body.pf-shell-page-map-blueprint-prototype {
  padding-top: 0;
}

html[data-pf-shell="active"] body.pf-shell-page-field-lobby #hud,
html[data-pf-shell="active"] body.pf-shell-page-blankpage-rooms-prototype #hud,
html[data-pf-shell="active"] body.pf-shell-page-map-blueprint-prototype #hud {
  display: none !important;
}

html[data-pf-shell="active"] body.pf-shell-page-field-lobby #hint,
html[data-pf-shell="active"] body.pf-shell-page-blankpage-rooms-prototype #hint,
html[data-pf-shell="active"] body.pf-shell-page-map-blueprint-prototype #hint {
  top: calc(var(--pf-shell-header-height) + 12px) !important;
}

html[data-pf-shell="active"] body.pf-shell-page-field-lobby #creatorDrawer,
html[data-pf-shell="active"] body.pf-shell-page-blankpage-rooms-prototype #creatorDrawer,
html[data-pf-shell="active"] body.pf-shell-page-map-blueprint-prototype #creatorDrawer {
  top: var(--pf-shell-header-height) !important;
}

html[data-pf-shell="active"] body.pf-shell-page-reality-cartographer #fieldJournal762 {
  top: calc(var(--pf-shell-header-height) + 10px + env(safe-area-inset-top, 0px)) !important;
}

html[data-pf-shell="active"] body.pf-shell-page-reality-cartographer .topbar,
html[data-pf-shell="active"] body.pf-shell-page-reality-cartographer #topbar,
html[data-pf-shell="active"] body.pf-shell-page-sound-pets .topbar,
html[data-pf-shell="active"] body.pf-shell-page-sound-pets #topbar {
  top: var(--pf-shell-header-height) !important;
}

.pf-shell-root,
.pf-shell-root * {
  box-sizing: border-box;
}

.pf-shell-root {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: var(--pf-shell-z-header);
  font-family: var(--pf-font-body, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
  color: var(--pf-text, #f5ead0);
  pointer-events: none;
}

.pf-shell-root button,
.pf-shell-root input,
.pf-shell-root select,
.pf-shell-root textarea {
  font: inherit;
}

.pf-shell-header {
  position: fixed;
  top: env(safe-area-inset-top, 0px);
  left: 0;
  right: 0;
  height: var(--pf-shell-header-height);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px max(10px, env(safe-area-inset-right, 0px)) 6px max(10px, env(safe-area-inset-left, 0px));
  border-bottom: 1px solid var(--pf-line, rgba(245,234,208,.16));
  background: color-mix(in srgb, var(--pf-bg-deep, #08040b) 88%, transparent);
  box-shadow: 0 10px 36px rgba(0,0,0,.32), inset 0 -1px 0 rgba(255,255,255,.035);
  backdrop-filter: blur(18px) saturate(1.12);
  pointer-events: auto;
}

.pf-shell-brand {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 36px;
  max-width: min(360px, 42vw);
  padding: 0 10px 0 4px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.pf-shell-brand:hover,
.pf-shell-brand:focus-visible {
  background: color-mix(in srgb, var(--pf-surface-raised, #2c1836) 72%, transparent);
  outline: none;
}

.pf-shell-mark {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--pf-highlight, #f4d84d);
  color: var(--pf-text-inverse, #160b1d);
  box-shadow: 3px 3px 0 color-mix(in srgb, var(--pf-accent, #d94cff) 58%, black);
  transform: rotate(-5deg);
  font: 950 15px/1 var(--pf-font-display, system-ui);
  letter-spacing: -.12em;
}

.pf-shell-page-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 950;
  letter-spacing: -.02em;
}

.pf-shell-divider {
  width: 1px;
  height: 24px;
  margin: 0 2px;
  background: var(--pf-line, rgba(245,234,208,.16));
}

.pf-shell-spacer {
  flex: 1 1 auto;
  min-width: 8px;
}

.pf-shell-button,
.pf-shell-chip {
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 11px;
  border-radius: 12px;
  border: 1px solid var(--pf-line, rgba(245,234,208,.16));
  background: color-mix(in srgb, var(--pf-surface, #211329) 76%, transparent);
  color: var(--pf-text, #f5ead0);
  cursor: pointer;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .065em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
}

.pf-shell-button:hover,
.pf-shell-chip:hover,
.pf-shell-button:focus-visible,
.pf-shell-chip:focus-visible,
.pf-shell-button[aria-expanded="true"] {
  background: var(--pf-surface-raised, #2c1836);
  border-color: var(--pf-line-strong, rgba(245,234,208,.34));
  outline: none;
}

.pf-shell-button.pf-shell-accent {
  background: var(--pf-highlight, #f4d84d);
  color: var(--pf-text-inverse, #160b1d);
  border-color: color-mix(in srgb, var(--pf-highlight, #f4d84d) 60%, black);
  box-shadow: 0 4px 0 rgba(0,0,0,.24);
}

.pf-shell-kbd {
  min-width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  padding: 0 5px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--pf-bg-deep, #08040b) 76%, transparent);
  color: var(--pf-highlight, #f4d84d);
  font-size: 11px;
  font-weight: 950;
  line-height: 1;
}

.pf-shell-menu {
  position: fixed;
  top: calc(var(--pf-shell-header-height) + 8px + env(safe-area-inset-top, 0px));
  min-width: 230px;
  max-width: calc(100vw - 20px);
  display: none;
  padding: 7px;
  border-radius: 16px;
  border: 1px solid var(--pf-line-strong, rgba(245,234,208,.34));
  background: color-mix(in srgb, var(--pf-bg-deep, #08040b) 94%, transparent);
  box-shadow: 0 20px 70px rgba(0,0,0,.52);
  backdrop-filter: blur(18px);
  pointer-events: auto;
}

.pf-shell-menu[data-open="true"] {
  display: grid;
  gap: 4px;
}

.pf-shell-menu button,
.pf-shell-menu a {
  width: 100%;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--pf-text, #f5ead0);
  text-decoration: none;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  text-align: left;
}

.pf-shell-menu button:hover,
.pf-shell-menu a:hover,
.pf-shell-menu button:focus-visible,
.pf-shell-menu a:focus-visible {
  background: color-mix(in srgb, var(--pf-surface-raised, #2c1836) 84%, transparent);
  outline: none;
}

.pf-shell-menu small {
  color: var(--pf-text-muted, #bcaec6);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.pf-shell-scrim {
  position: fixed;
  inset: 0;
  z-index: calc(var(--pf-shell-z-overlay) - 1);
  display: none;
  background: rgba(0,0,0,.26);
  pointer-events: auto;
}

.pf-shell-scrim[data-open="true"] {
  display: block;
}

.pf-shell-drawer,
.pf-shell-panel {
  position: fixed;
  top: calc(var(--pf-shell-header-height) + 8px + env(safe-area-inset-top, 0px));
  bottom: 10px;
  z-index: var(--pf-shell-z-overlay);
  display: none;
  overflow: hidden;
  border-radius: 22px;
  border: 1px solid var(--pf-line-strong, rgba(245,234,208,.34));
  background: color-mix(in srgb, var(--pf-bg-deep, #08040b) 92%, transparent);
  color: var(--pf-text, #f5ead0);
  box-shadow: 0 28px 90px rgba(0,0,0,.58);
  backdrop-filter: blur(22px) saturate(1.12);
  pointer-events: auto;
}

.pf-shell-drawer[data-open="true"],
.pf-shell-panel[data-open="true"] {
  display: grid;
}

.pf-shell-drawer {
  left: 10px;
  width: var(--pf-shell-drawer-width);
  grid-template-rows: auto minmax(0,1fr) auto;
}

.pf-shell-panel {
  right: 10px;
  width: min(520px, calc(100vw - 20px));
  grid-template-rows: auto minmax(0,1fr);
}

.pf-shell-overlay-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--pf-line, rgba(245,234,208,.16));
}

.pf-shell-overlay-head h2 {
  margin: 0;
  font-size: 22px;
  line-height: .96;
  letter-spacing: -.045em;
}

.pf-shell-overlay-head p {
  margin: 5px 0 0;
  color: var(--pf-text-muted, #bcaec6);
  font-size: 12px;
  line-height: 1.35;
}

.pf-shell-close {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--pf-line, rgba(245,234,208,.16));
  border-radius: 12px;
  background: color-mix(in srgb, var(--pf-surface, #211329) 78%, transparent);
  color: var(--pf-text, #f5ead0);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.pf-shell-close:hover,
.pf-shell-close:focus-visible {
  background: var(--pf-surface-raised, #2c1836);
  outline: none;
}

.pf-shell-drawer-body,
.pf-shell-panel-body {
  overflow: auto;
  min-height: 0;
  padding: 12px;
}

.pf-shell-search {
  width: 100%;
  height: 38px;
  margin-bottom: 12px;
  border: 1px solid var(--pf-line, rgba(245,234,208,.16));
  border-radius: 13px;
  background: color-mix(in srgb, var(--pf-surface-inset, #160b1d) 86%, transparent);
  color: var(--pf-text, #f5ead0);
  padding: 0 12px;
  outline: none;
}

.pf-shell-search:focus {
  border-color: var(--pf-highlight, #f4d84d);
  box-shadow: var(--pf-selection-ring, 0 0 0 2px var(--pf-highlight));
}

.pf-shell-nav-group {
  display: grid;
  gap: 6px;
  margin: 0 0 16px;
}

.pf-shell-nav-group h3 {
  margin: 0 0 2px;
  color: var(--pf-text-muted, #bcaec6);
  font-size: 10px;
  font-weight: 950;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.pf-shell-nav-card {
  display: grid;
  grid-template-columns: 34px minmax(0,1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 8px;
  border-radius: 15px;
  border: 1px solid transparent;
  background: color-mix(in srgb, var(--pf-surface, #211329) 48%, transparent);
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

.pf-shell-nav-card:hover,
.pf-shell-nav-card:focus-visible,
.pf-shell-nav-card[aria-current="page"] {
  border-color: var(--pf-line-strong, rgba(245,234,208,.34));
  background: color-mix(in srgb, var(--pf-surface-raised, #2c1836) 78%, transparent);
  outline: none;
}

.pf-shell-nav-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: color-mix(in srgb, var(--pf-highlight, #f4d84d) 18%, var(--pf-surface-raised, #2c1836));
  color: var(--pf-highlight, #f4d84d);
  font-size: 13px;
  font-weight: 950;
}

.pf-shell-nav-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 930;
  letter-spacing: -.015em;
}

.pf-shell-nav-desc {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 2px;
  color: var(--pf-text-muted, #bcaec6);
  font-size: 11px;
  line-height: 1.2;
}

.pf-shell-nav-arrow {
  color: var(--pf-text-muted, #bcaec6);
  font-size: 16px;
}

.pf-shell-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-top: 1px solid var(--pf-line, rgba(245,234,208,.16));
  color: var(--pf-text-muted, #bcaec6);
  font-size: 11px;
  line-height: 1.25;
}

.pf-shell-section {
  display: grid;
  gap: 10px;
  padding: 12px;
  margin-bottom: 12px;
  border-radius: 18px;
  border: 1px solid var(--pf-line, rgba(245,234,208,.16));
  background: color-mix(in srgb, var(--pf-surface, #211329) 48%, transparent);
}

.pf-shell-section h3 {
  margin: 0;
  font-size: 14px;
  line-height: 1.1;
}

.pf-shell-section p {
  margin: 0;
  color: var(--pf-text-muted, #bcaec6);
  font-size: 12px;
  line-height: 1.45;
}

.pf-shell-field {
  display: grid;
  gap: 5px;
}

.pf-shell-field span {
  color: var(--pf-text-muted, #bcaec6);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.pf-shell-field input,
.pf-shell-field select,
.pf-shell-field textarea {
  width: 100%;
  border: 1px solid var(--pf-line, rgba(245,234,208,.16));
  border-radius: 12px;
  background: color-mix(in srgb, var(--pf-surface-inset, #160b1d) 86%, transparent);
  color: var(--pf-text, #f5ead0);
  padding: 10px;
  outline: none;
}

.pf-shell-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pf-shell-toast {
  position: fixed;
  right: 10px;
  top: calc(var(--pf-shell-header-height) + 10px + env(safe-area-inset-top, 0px));
  z-index: calc(var(--pf-shell-z-overlay) + 30);
  max-width: min(360px, calc(100vw - 20px));
  display: none;
  padding: 11px 13px;
  border-radius: 15px;
  border: 1px solid var(--pf-line-strong, rgba(245,234,208,.34));
  background: color-mix(in srgb, var(--pf-bg-deep, #08040b) 94%, transparent);
  color: var(--pf-text, #f5ead0);
  box-shadow: 0 18px 60px rgba(0,0,0,.5);
  pointer-events: auto;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.pf-shell-toast[data-open="true"] {
  display: block;
}

@media (max-width: 860px) {
  .pf-shell-button span.pf-shell-label-optional,
  .pf-shell-chip .pf-shell-label-optional {
    display: none;
  }

  .pf-shell-button,
  .pf-shell-chip {
    padding-inline: 9px;
  }
}

@media (max-width: 680px) {
  :root { --pf-shell-header-height: 46px; }

  .pf-shell-header {
    gap: 5px;
    padding-left: max(7px, env(safe-area-inset-left, 0px));
    padding-right: max(7px, env(safe-area-inset-right, 0px));
  }

  .pf-shell-brand {
    max-width: min(52vw, 240px);
    padding-right: 6px;
    gap: 7px;
  }

  .pf-shell-mark {
    width: 30px;
    height: 30px;
    border-radius: 10px;
    font-size: 14px;
  }

  .pf-shell-page-title {
    font-size: 12px;
  }

  .pf-shell-button[data-mobile-hide="true"],
  .pf-shell-divider[data-mobile-hide="true"] {
    display: none;
  }

  .pf-shell-drawer,
  .pf-shell-panel {
    left: 8px;
    right: 8px;
    width: auto;
    bottom: 8px;
  }

  .pf-shell-menu {
    left: 8px !important;
    right: 8px !important;
    width: auto;
  }
}


/* Phase 1.1 shell reserve pass
   The PF header is fixed above every tool. These overrides reserve that strip
   for fixed/canvas-heavy webtools without requiring each prototype to rewrite
   its own layout system. */
:root{
  --pf-shell-top-reserve: calc(var(--pf-shell-header-height) + env(safe-area-inset-top, 0px));
}

html[data-pf-shell="active"] body.pf-shell-page-field-lobby,
html[data-pf-shell="active"] body.pf-shell-page-sound-pets,
html[data-pf-shell="active"] body.pf-shell-page-palette-pets,
html[data-pf-shell="active"] body.pf-shell-page-video-pets,
html[data-pf-shell="active"] body.pf-shell-page-reality-deck,
html[data-pf-shell="active"] body.pf-shell-page-reality-cartographer {
  padding-top: 0 !important;
}

html[data-pf-shell="active"] body.pf-shell-page-chara-kit {
  padding-top: var(--pf-shell-top-reserve) !important;
  overflow: hidden !important;
}
html[data-pf-shell="active"] body.pf-shell-page-chara-kit .app {
  height: calc(100dvh - var(--pf-shell-top-reserve)) !important;
  min-height: 0 !important;
}

html[data-pf-shell="active"] body.pf-shell-page-field-lobby #scene,
html[data-pf-shell="active"] body.pf-shell-page-field-lobby #roomHost,
html[data-pf-shell="active"] body.pf-shell-page-field-lobby #blueprintScene {
  top: var(--pf-shell-top-reserve) !important;
  bottom: 0 !important;
  height: auto !important;
}
html[data-pf-shell="active"] body.pf-shell-page-field-lobby #creatorDrawer {
  top: var(--pf-shell-top-reserve) !important;
}
html[data-pf-shell="active"] body.pf-shell-page-field-lobby #hint {
  top: calc(var(--pf-shell-top-reserve) + 12px) !important;
}

html[data-pf-shell="active"] body.pf-shell-page-blankpage .topbar {
  top: var(--pf-shell-top-reserve) !important;
}
html[data-pf-shell="active"] body.pf-shell-page-blankpage #viewport {
  inset: calc(var(--pf-shell-top-reserve) + var(--toolbar-h, 36px)) 0 0 0 !important;
}
html[data-pf-shell="active"] body.pf-shell-page-blankpage .toast,
html[data-pf-shell="active"] body.pf-shell-page-blankpage .touch-tip {
  bottom: max(82px, env(safe-area-inset-bottom, 0px) + 82px) !important;
}

html[data-pf-shell="active"] body.pf-shell-page-sound-pets #app,
html[data-pf-shell="active"] body.pf-shell-page-palette-pets #app,
html[data-pf-shell="active"] body.pf-shell-page-video-pets #app {
  position: fixed !important;
  inset: var(--pf-shell-top-reserve) 0 0 0 !important;
  width: 100% !important;
  height: auto !important;
}

html[data-pf-shell="active"] body.pf-shell-page-reality-deck .world {
  inset: var(--pf-shell-top-reserve) 0 0 0 !important;
}
html[data-pf-shell="active"] body.pf-shell-page-reality-deck .topbar {
  top: calc(var(--pf-shell-top-reserve) + 14px) !important;
}
html[data-pf-shell="active"] body.pf-shell-page-reality-deck .dock,
html[data-pf-shell="active"] body.pf-shell-page-reality-deck .inspector {
  top: calc(var(--pf-shell-top-reserve) + 92px) !important;
}

html[data-pf-shell="active"] body.pf-shell-page-reality-cartographer #app {
  height: calc(100dvh - var(--pf-shell-top-reserve)) !important;
  margin-top: var(--pf-shell-top-reserve) !important;
}
html[data-pf-shell="active"] body.pf-shell-page-reality-cartographer .topbar {
  top: auto !important;
}

@media (max-width: 680px) {
  html[data-pf-shell="active"] body.pf-shell-page-reality-deck .dock,
  html[data-pf-shell="active"] body.pf-shell-page-reality-deck .inspector {
    top: calc(var(--pf-shell-top-reserve) + 72px) !important;
  }
}
