/* Ocean Memory Group Mode — Responsive Fit 1
   Presentation geometry only.
   Protected runtime geometry is intentionally untouched:
   no participant field, projector surface, video, canvas, iframe, marker,
   calibration coordinate, collision, timing, state, audio or storage rules. */

/* ---------- Group home ---------- */
#groupHomeScreen {
  padding-top: clamp(78px, 9vh, 96px);
  padding-right: max(20px, env(safe-area-inset-right));
  padding-bottom: max(96px, calc(env(safe-area-inset-bottom) + 78px));
  padding-left: max(20px, env(safe-area-inset-left));
  overflow-x: hidden;
  overflow-y: auto;
}
#groupHomeScreen .group-home-copy {
  margin-bottom: clamp(12px, 2vh, 22px);
}
#groupHomeScreen .group-home-copy h2 {
  font-size: clamp(36px, 4.4vw, 56px);
  line-height: 1.08;
}
#groupHomeScreen .group-entry-lead {
  font-size: clamp(17px, 1.8vw, 23px);
}
#groupHomeScreen .group-activity-grid {
  width: min(1180px, calc(100vw - 56px));
  gap: clamp(14px, 1.6vw, 24px);
}
#groupHomeScreen .group-activity-card {
  min-width: 0;
  min-height: clamp(250px, 40dvh, 340px);
  padding: clamp(104px, 14vh, 128px) clamp(18px, 2vw, 28px) 24px;
  border-radius: clamp(24px, 2.6vw, 34px);
}
#groupHomeScreen .group-activity-card strong {
  font-size: clamp(28px, 3vw, 40px);
  line-height: 1.15;
}
#groupHomeScreen .group-activity-card > span:not(.activity-star-stack) {
  margin-top: 7px;
  font-size: clamp(16px, 1.65vw, 21px);
  line-height: 1.42;
}
#groupHomeScreen .group-activity-card .activity-meta {
  margin-top: 10px;
  font-size: clamp(14px, 1.35vw, 17px);
}
#groupHomeScreen .group-activity-card .activity-cta {
  margin-top: 13px;
  padding: 7px 18px;
  font-size: clamp(15px, 1.45vw, 18px);
}

/* Preserve icon artwork, only scale the existing home slot as one unit. */
@media (max-width: 1180px) and (orientation: landscape) {
  #groupHomeScreen .activity-star-stack {
    transform: translateX(-50%) scale(.82);
    transform-origin: top center;
  }
}

/* Keep three activities visible on normal iPad landscape widths without
   forcing the cards to retain desktop typography. */
@media (min-width: 861px) and (max-width: 1180px) {
  #groupHomeScreen .group-activity-grid {
    width: min(1060px, calc(100vw - 44px));
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
  }
  #groupHomeScreen .group-activity-card {
    min-height: clamp(244px, 38dvh, 310px);
    padding: clamp(96px, 13vh, 114px) 16px 20px;
  }
  #groupHomeScreen .group-activity-card strong { font-size: clamp(27px, 3vw, 34px); }
  #groupHomeScreen .group-activity-card > span:not(.activity-star-stack) { font-size: clamp(15px, 1.7vw, 19px); }
}

/* Mid-width landscape: two columns are easier to read than three compressed cards. */
@media (min-width: 601px) and (max-width: 860px) {
  #groupHomeScreen .group-activity-grid {
    width: min(760px, calc(100vw - 40px));
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  #groupHomeScreen .group-activity-card {
    min-height: 260px;
    padding-top: 108px;
  }
}

@media (max-width: 600px) {
  #groupHomeScreen {
    padding: 88px 14px max(92px, calc(env(safe-area-inset-bottom) + 74px));
  }
  #groupHomeScreen .group-home-copy { margin-bottom: 14px; }
  #groupHomeScreen .group-home-copy h2 { font-size: clamp(32px, 10vw, 38px); }
  #groupHomeScreen .group-activity-grid {
    width: 100%;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }
  #groupHomeScreen .group-activity-card {
    min-height: 232px;
    padding: 102px 16px 20px;
    border-radius: 24px;
  }
  #groupHomeScreen .activity-star-stack {
    transform: translateX(-50%) scale(.72);
    transform-origin: top center;
  }
  #groupHomeScreen .group-activity-card strong { font-size: clamp(27px, 8vw, 34px); }
  #groupHomeScreen .group-activity-card > span:not(.activity-star-stack) { font-size: 16px; }
}

/* ---------- StarBag setup screen ----------
   Make setup content document-scrollable when height is tight instead of
   clipping a fixed-height panel. Activity/gameplay screens are not targeted. */
html[data-screen="SETUP"][data-device="desktop"],
html[data-screen="SETUP"][data-device="desktop"] body,
html[data-screen="SETUP"][data-device="tablet"],
html[data-screen="SETUP"][data-device="tablet"] body {
  height: auto;
  min-height: 100%;
  overflow: auto;
}
html[data-screen="SETUP"][data-device="desktop"] .starbag-app,
html[data-screen="SETUP"][data-device="tablet"] .starbag-app {
  height: auto;
  min-height: 100dvh;
  overflow: visible;
}
html[data-device="desktop"] #setupScreen,
html[data-device="tablet"] #setupScreen {
  position: relative;
  min-height: 100dvh;
  padding: clamp(82px, 9vh, 96px) clamp(24px, 3vw, 48px) 104px;
}
html[data-device="desktop"] #setupScreen .setup-panel,
html[data-device="tablet"] #setupScreen .setup-panel {
  width: min(1120px, 100%);
  height: auto;
  min-height: 0;
  max-height: none;
  grid-template-columns: minmax(0, .9fr) minmax(340px, 1.1fr);
  align-items: center;
  gap: clamp(20px, 2.4vw, 32px);
  padding: clamp(22px, 2.5vw, 32px);
}
html[data-device="desktop"] #setupScreen .setup-intro,
html[data-device="tablet"] #setupScreen .setup-intro { min-width: 0; padding: 6px 10px; }
html[data-device="desktop"] #setupScreen .setup-intro h2,
html[data-device="tablet"] #setupScreen .setup-intro h2 {
  font-size: clamp(34px, 3.6vw, 50px);
  line-height: 1.08;
}
html[data-device="desktop"] #setupScreen .setup-intro > p:not(.section-kicker),
html[data-device="tablet"] #setupScreen .setup-intro > p:not(.section-kicker) {
  font-size: clamp(17px, 1.55vw, 21px);
  line-height: 1.5;
}
html[data-device="desktop"] #setupScreen .setup-form,
html[data-device="tablet"] #setupScreen .setup-form { min-width: 0; gap: 10px; }
html[data-device="desktop"] #setupScreen .setup-form label span,
html[data-device="tablet"] #setupScreen .setup-form label span { min-height: 50px; }

@media (orientation: landscape) and (max-height: 820px) {
  html[data-device="desktop"] #setupScreen,
  html[data-device="tablet"] #setupScreen { padding-top: 76px; padding-bottom: 86px; }
  html[data-device="desktop"] #setupScreen .setup-panel,
  html[data-device="tablet"] #setupScreen .setup-panel { gap: 18px; padding: 20px 24px; }
  html[data-device="desktop"] #setupScreen .setup-star,
  html[data-device="tablet"] #setupScreen .setup-star { width: 86px; margin-bottom: 8px; }
  html[data-device="desktop"] #setupScreen .prototype-note,
  html[data-device="tablet"] #setupScreen .prototype-note { padding: 10px 14px; }
}

/* ---------- Gather Light presentation surfaces ---------- */
.gather-light-community #gatherLightApp {
  padding-top: clamp(80px, 9vh, 104px);
  padding-bottom: max(76px, calc(env(safe-area-inset-bottom) + 60px));
}
.gather-light-community .gather-panel {
  width: min(680px, calc(100vw - 32px));
  margin: clamp(16px, 4vh, 32px) auto;
  padding: clamp(20px, 3vw, 32px);
}
.gather-light-community .gather-panel h2,
.gather-light-community .gather-camera-stage h2 {
  line-height: 1.15;
}
.gather-light-community .gather-camera-stage {
  width: min(980px, calc(100% - 24px));
  padding-left: clamp(16px, 2.5vw, 26px);
  padding-right: clamp(16px, 2.5vw, 26px);
}
.gather-light-community .gather-camera-stage-head > div { min-width: 0; }

@media (max-width: 600px) {
  .gather-light-community #gatherLightApp { padding: 82px 12px 92px; }
  .gather-light-community .gather-panel { width: 100%; padding: 20px 18px; border-radius: 24px; }
  .gather-light-community .gather-camera-stage { width: 100%; margin-left: 0; margin-right: 0; border-radius: 22px; }
}

/* ---------- Starlight Resonance presentation surfaces ---------- */
.starlight-community #starlightApp {
  padding-top: clamp(80px, 9vh, 104px);
  padding-bottom: max(76px, calc(env(safe-area-inset-bottom) + 60px));
}
.starlight-community .starlight-panel {
  width: min(720px, calc(100vw - 32px));
  margin: clamp(16px, 4vh, 36px) auto;
  padding: clamp(20px, 3vw, 32px);
}
.starlight-community .starlight-scene-choice-panel {
  width: min(1120px, calc(100vw - 32px));
}
.starlight-community .starlight-scene-grid {
  gap: clamp(12px, 1.5vw, 18px);
  margin: 20px 0 18px;
}
.starlight-community .starlight-scene-copy { padding: 14px 15px 16px; }

@media (orientation: landscape) and (max-height: 820px) {
  .starlight-community #starlightApp { padding-top: 76px; padding-bottom: 60px; }
  .starlight-community .starlight-panel { margin: 14px auto 20px; padding: 20px 24px; }
  .starlight-community .starlight-panel p { font-size: 18px; line-height: 1.6; }
  .starlight-community .starlight-scene-grid { margin-top: 16px; }
}

/* ---------- Shared memory sea presentation ---------- */
.community-sea-toolbar {
  flex-wrap: wrap;
  align-items: center;
}
.community-sea-toolbar a,
.community-sea-toolbar button {
  max-width: 100%;
  white-space: normal;
  text-align: center;
}
@media (max-width: 600px) {
  .community-sea-toolbar { padding: max(14px, env(safe-area-inset-top)) 12px 8px; }
  .community-sea-toolbar a,
  .community-sea-toolbar button { font-size: 16px; padding: 9px 12px; }
  .community-sea-title { padding: 10px 16px; }
  .community-sea-title h1 { margin: 10px 0; }
  .community-dialog { width: calc(100vw - 20px); padding: 20px; }
}
