/* Shell-only responsive layout: tier runtimes remain independent. */
html { min-width: 0; }
body { min-height: 100svh; display: flex; flex-direction: column; }
#mainViewportWrapper { min-width: 0; padding: 12px; }
#jigsawHubContainer {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: clamp(6px, 2vw, 12px);
  width: 100%;
  max-width: 440px;
  margin-block: 8px;
}
#jigsawHubContainer:has(#world4SideCard:not(.hidden)) {
  grid-template-columns: minmax(0, 1fr) clamp(88px, 22vw, 126px);
  max-width: 578px;
}
#puzzleBoardWrap { width: 100%; min-width: 0; height: auto; aspect-ratio: 1; }
#world4SideCard { width: 100%; min-width: 0; height: auto; min-height: 114px; aspect-ratio: 88 / 102; margin-left: 0; }
#mainViewportWrapper h1 { font-size: clamp(28px, 8.5vw, 72px); }
#mainViewportWrapper .nav-candy-btn { min-width: 0; min-height: 44px; padding-inline: 4px; }
body > header > div { min-width: 0; max-width: 100%; }
body > header > div > span:last-child { overflow-wrap: anywhere; }
@media (min-width: 640px) { #mainViewportWrapper { padding: 24px; } #world4SideCard { min-height: 152px; } }

/* Right-sized shell backgrounds; gameplay artwork is unchanged. */
#galaxyBgLayer { background-image: url('../images/hub-bg-mobile.webp'); background-size: cover; }
@media (min-width: 641px) { #galaxyBgLayer { background-image: url('../images/hub-bg-desktop.webp'); } }
@media (min-width: 1025px) { #galaxyBgLayer { background-image: url('../images/hub-bg-widescreen.webp'); } }

#jigsawHubContainer, #puzzleBoardWrap, #world4SideCard { transition: none; }

.hub-legal-links { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 20px; margin-top: 8px; }
.hub-legal-links a { min-height: 44px; display: inline-flex; align-items: center; color: #d8b4fe; text-decoration: underline; }
.hub-panel-open { overflow: hidden; }
#compassModal > div { max-height: 90dvh; overflow-y: auto; }
.hub-scores-overlay { position: fixed; inset: 0; z-index: 50; padding: 16px; background: #020617dd; align-items: center; justify-content: center; }
.hub-scores-panel { position: relative; width: 100%; max-width: 600px; max-height: 90dvh; overflow-y: auto; border: 3px solid #fbbf24; border-radius: 24px; background: #0f172a; color: #e2e8f0; padding: 20px; }
.hub-scores-panel h2 { font-size: 24px; color: #fcd34d; font-weight: 900; padding-right: 72px; }
.hub-scores-panel h3 { font-weight: 800; color: #a5b4fc; margin-top: 20px; }
.hub-panel-close { position: absolute; right: 12px; top: 12px; min-height: 44px; padding: 8px; }
.hub-score-summary { color: #6ee7b7; margin-block: 12px; font-weight: 800; }
.hub-score-row { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; padding-block: 10px; border-bottom: 1px solid #334155; font-size: 12px; }
.hub-score-row strong { color: #fcd34d; }

.hub-legal-links button { min-height: 44px; color: #d8b4fe; text-decoration: underline; }
.hub-guide-command { display: flex; align-items: center; gap: 10px; padding: 8px; border: 2px solid #6366f166; border-radius: 16px; background: #1e293b; color: #e2e8f0; font-weight: 800; text-align: left; }
.hub-guide-icon { width: 36px; height: 36px; flex-shrink: 0; } .hub-guide-icon svg { width: 100%; height: 100%; }
.hub-portal-panel { background: #f8fafc; color: #1e293b; border-color: #fcd34d; }
.hub-portal-header { display: flex; align-items: center; gap: 12px; padding-right: 60px; }
.hub-portal-header img { width: 48px; height: 48px; border-radius: 12px; }
.hub-portal-header h2 { color: #0f172a; padding: 0; }
.hub-portal-tabs { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); margin-block: 16px; border-bottom: 1px solid #cbd5e1; }
.hub-portal-tabs button { min-height: 48px; padding: 8px 4px; font-size: 12px; font-weight: 800; }
.hub-portal-tabs button[aria-pressed="true"] { color: #047857; background: white; border: 1px solid #cbd5e1; border-radius: 16px 16px 0 0; }
.hub-portal-panel .hub-portal-box { padding: 12px; margin-block: 12px; border: 1px solid #dbeafe; border-radius: 16px; background: white; }
.hub-portal-panel h3 { color: #334155; margin: 0 0 6px; }
.hub-portal-body p { font-size: 13px; line-height: 1.7; }
.hub-policy-link { display: block; color: #047857; text-decoration: underline; min-height: 44px; padding-top: 12px; }
.hub-portal-body label { display: block; margin-block: 12px; font-weight: 700; }
.hub-portal-body input,.hub-portal-body textarea { display: block; width: 100%; padding: 12px; border: 1px solid #cbd5e1; border-radius: 12px; margin-top: 6px; background: white; }
.hub-portal-primary,.hub-portal-secondary { display: block; width: 100%; min-height: 48px; margin-block: 10px; padding: 10px; border-radius: 12px; font-weight: 800; }
.hub-portal-primary { background: #7c3aed; color: white; } .hub-portal-secondary { border: 1px solid #cbd5e1; color: #475569; }
.hub-gate-question { font-size: 20px !important; font-weight: 900; text-align: center; color: #7c3aed; }

.sc-hub-reset { width:44px; height:44px; border:0; background:transparent; color:#a5f3fc; font-size:19px; cursor:pointer; isolation:isolate; }
.sc-hub-reset::before { content:""; position:absolute; width:26px; height:26px; border:1px solid #67e8f9; border-radius:50%; background:#0f172ae6; z-index:-1; }
#world4SideCard { position:relative; }
.sc-hub-reset { position:absolute; top:4px; z-index:5; display:flex; align-items:center; justify-content:center; }
.sc-hub-reset-world-1 { right:calc(66.6667% + 4px); }
.sc-hub-reset-world-2 { right:calc(33.3333% + 4px); }
.sc-hub-reset-world-3 { right:4px; }
.sc-hub-reset-four { right:4px; top:4px; }
.sc-hub-reset-dialog { width:min(420px,calc(100vw - 24px)); max-height:calc(100dvh - 24px); padding:24px; border:2px solid #22d3ee; border-radius:20px; background:#0f172a; color:white; }
.sc-hub-reset-dialog::backdrop { background:#020617cc; }
.sc-hub-reset-dialog h2 { font-weight:800; font-size:22px; margin-bottom:12px; }
.sc-hub-reset-dialog p { margin-bottom:20px; }
.sc-hub-reset-dialog > div { display:flex; gap:12px; }
.sc-hub-reset-dialog button { min-height:48px; flex:1; border:2px solid #67e8f9; border-radius:12px; padding:8px; }
#hubResetConfirm { background:#be123c; border-color:#fb7185; }

.sc-hub-reset[hidden] { display:none; }
