* { box-sizing: border-box; }
body { margin: 0; color: var(--textColor); background: var(--skyColor); font-family: "Microsoft JhengHei", system-ui, sans-serif; }
header { min-height: 108px; display: flex; align-items: center; gap: 30px; padding: 20px 38px; background: var(--panelColor); border-bottom: 1px solid var(--buildingSecondary); }
.brand { flex: 1; min-width: 0; }
.brand p { margin: 0 0 7px; font-size: 11px; letter-spacing: .18em; color: var(--primaryAccent); }
h1 { margin: 0; font-size: 25px; font-weight: 600; letter-spacing: .08em; }
.boundary { display: grid; gap: 5px; font-size: 11px; line-height: 1.5; }
.boundary strong { color: var(--secondaryAccent); letter-spacing: .08em; }
a { color: inherit; display: inline-block; padding: 12px 18px; text-decoration: none; border: 1px solid var(--buildingSecondary); border-radius: 30px; font-size: 13px; }
a:hover { background: var(--pathColor); }
a:focus-visible, canvas:focus-visible { outline: 3px solid var(--selectionColor); outline-offset: 3px; }
#world { position: relative; height: calc(100dvh - 108px); min-height: 460px; overflow: hidden; }
canvas { display: block; width: 100%; height: 100%; touch-action: none; }
#labels { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.module-label { position: absolute; width: max-content; max-width: 186px; padding: 7px 10px; background: var(--panelColor); border: 1px solid var(--buildingSecondary); border-radius: 8px; box-shadow: 0 3px 10px color-mix(in srgb, var(--textColor) 8%, transparent); text-align: center; line-height: 1.45; }
.module-label b { display: block; font-size: 12px; font-weight: 600; }
.module-label small { display: block; font-size: 9px; color: var(--secondaryAccent); }
.module-label .number { font-size: 10px; letter-spacing: .12em; color: var(--primaryAccent); }
.module-label.deep { border-color: var(--primaryAccent); }
.core-label { max-width: 145px; background: transparent; border: 0; box-shadow: none; }
.core-label b { font-size: 15px; }
.campus-caption { position: absolute; top: 22px; left: 38px; z-index: 3; font-size: 14px; margin: 0; pointer-events: none; }
.campus-caption span { display: block; font-size: 10px; letter-spacing: .16em; color: var(--secondaryAccent); margin-bottom: 8px; }
.controls-help { position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 24px); margin: 0; padding: 9px 16px; font-size: 11px; border-radius: 20px; background: var(--panelColor); text-align: center; }
#status { position: absolute; bottom: 18px; left: 26px; margin: 0; font-size: 10px; color: var(--textColor); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; background: var(--panelColor); border: 1px solid var(--buildingSecondary); border-radius: 8px; }
button:focus-visible { outline: 3px solid var(--selectionColor); outline-offset: 2px; }
button:disabled { opacity: .45; cursor: default; }
.floating-panel { position: absolute; z-index: 5; background: var(--panelColor); border: 1px solid var(--buildingSecondary); border-radius: 12px; box-shadow: 0 8px 24px color-mix(in srgb, var(--textColor) 12%, transparent); max-width: calc(100% - 24px); }
.flow-panel { top: 80px; left: 20px; width: 310px; }
.all-panel { top: 140px; left: 20px; width: 310px; }
.flow-panel:has([aria-expanded="true"]) { z-index: 6; }
#all-handoff { padding: 0 12px 12px; font-size: 12px; line-height: 1.6; }
#all-handoff a { border-color: var(--deepExperienceAccent); color: var(--deepExperienceAccent); border-radius: 8px; }
.module-panel { top: 20px; right: 20px; width: 245px; }
.module-panel:has([aria-expanded="true"]) { z-index: 7; }
.exploration-panels { display: contents; }
.info-panel { top: 80px; right: 20px; width: 340px; }
#info-content { max-height: none; overflow: visible; }
#info-scroll { max-height: min(540px, calc(100dvh - 320px)); overflow-y: auto; padding: 0 3px; }
#info-scroll:focus-visible { outline: 2px solid var(--panelAccent); outline-offset: 2px; }
#info-scroll ul, #info-scroll ol { padding-left: 19px; font-size: 11px; line-height: 1.65; margin: 6px 0; }
#info-scroll h3 { color: var(--panelAccent); }
#info-english { color: var(--secondaryAccent); }
#info-status { display: inline-block; border: 1px solid var(--panelAccent); border-radius: 5px; padding: 3px 7px; color: var(--panelAccent); }
#info-limitations { border-left: 3px solid var(--primaryAccent); padding: 1px 8px; background: color-mix(in srgb, var(--pathColor) 45%, transparent); }
#info-related { display: grid; gap: 6px; }
#info-related button { font-size: 11px; text-align: left; padding: 8px; min-height: 40px; }
#info-related small { display: block; margin-top: 4px; font-weight: normal; }
#info-deep-link { border-color: var(--deepExperienceAccent); color: var(--deepExperienceAccent); border-radius: 8px; margin: 6px 0; }
.info-actions { display: flex; gap: 6px; padding-top: 10px; }
.info-actions button { flex: 1; padding: 9px 6px; font-size: 12px; min-height: 38px; }
#hub-fallback { padding: 12px; }
.panel-toggle { width: 100%; display: flex; justify-content: space-between; gap: 8px; padding: 12px 14px; border: 0; background: transparent; font-size: 12px; font-weight: 600; text-align: left; }
.panel-content { border-top: 1px solid var(--buildingSecondary); padding: 12px; max-height: min(480px, calc(100dvh - 250px)); overflow-y: auto; overflow-wrap: anywhere; }
.panel-content h2 { font-size: 15px; margin: 6px 0; }.panel-content h3 { font-size: 13px; margin: 12px 0 5px; }
.panel-content p, .panel-content dl { font-size: 11px; line-height: 1.6; margin: 6px 0; }
.demo-caption, #flow-state, #flow-deep { color: var(--flowActiveColor); } #flow-scope { color: var(--primaryAccent); }
.panel-content dt { font-weight: 600; margin-top: 6px; }.panel-content dd { margin: 2px 0; }
#flow-progress { width: 100%; height: 8px; accent-color: var(--flowActiveColor); }
#flow-step-list { padding-left: 22px; font-size: 10px; line-height: 1.5; }
#flow-step-list li { padding: 3px 0; } #flow-step-list [aria-current="step"] { font-weight: bold; color: var(--flowActiveColor); }
#flow-content { max-height: none; overflow: visible; }
#flow-scroll { max-height: min(390px, calc(100dvh - 320px)); overflow-y: auto; }
.flow-actions { display: flex; flex-wrap: wrap; gap: 6px; background: var(--panelColor); padding: 8px 0 0; }
.flow-actions button { padding: 8px 10px; min-height: 36px; font-size: 11px; }
#module-buttons { display: grid; gap: 6px; } #module-buttons button { padding: 9px; min-height: 40px; font-size: 11px; text-align: left; }
#module-buttons [aria-pressed="true"] { border-color: var(--selectionColor); font-weight: bold; }
#flow-labels { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.flow-node-label { position: absolute; transform: translate(-50%, -50%); padding: 2px 4px; border-radius: 12px; background: var(--panelColor); border: 1px solid var(--flowInactiveColor); font-size: 10px; color: var(--textColor); }
.flow-node-label.current { border: 2px solid var(--flowActiveColor); font-weight: bold; }
.flow-node-label.future { opacity: .8; }
@media (max-width: 650px) {
  .exploration-panels { display: flex; flex-direction: column; gap: 8px; position: absolute; z-index: 5; left: 12px; top: 84px; width: calc(100% - 24px); max-height: calc(100% - 170px); overflow-y: auto; padding: 3px; }
  .exploration-panels .floating-panel { position: static; flex-shrink: 0; width: 100%; max-width: 100%; }
  .module-panel { right: 12px; top: 12px; width: 160px; }
  .campus-caption { max-width: calc(100% - 190px); }
  .panel-content { max-height: min(400px, calc(100dvh - 285px)); }
  #flow-scroll { max-height: min(320px, calc(100dvh - 365px)); }
  #info-scroll { max-height: min(300px, calc(100dvh - 410px)); }
  .exploration-panels:has(#flow-content:not([hidden])):has(#info-content:not([hidden])) #flow-scroll,
  .exploration-panels:has(#flow-content:not([hidden])):has(#info-content:not([hidden])) #info-scroll { max-height: 150px; }
}
@media (max-width: 650px) {
  header { min-height: 144px; padding: 16px; flex-wrap: wrap; gap: 12px; }
  h1 { font-size: 20px; }.brand { flex-basis: 100%; }.brand p { font-size: 9px; }
  .boundary { flex: 1; font-size: 9px; } a { padding: 10px 12px; font-size: 11px; }
  #world { height: calc(100dvh - 144px); min-height: 440px; }
  .campus-caption { left: 16px; font-size: 11px; }
  .module-label { max-width: 116px; padding: 4px 5px; }.module-label b { font-size: 9px; }.module-label small { display: none; }
  #status { bottom: 58px; left: 16px; }
}

/* Mobile presentation shares the existing scene and controllers. */
.mobile-only, .short-title { display: none; }
@media (max-width: 700px), (max-width: 950px) and (max-height: 500px) {
  body { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
  header { min-height: 0; flex: none; padding: max(8px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 8px max(12px, env(safe-area-inset-left)); gap: 4px 10px; flex-wrap: wrap; }
  .brand { flex: 1; flex-basis: auto; }.brand p { display: none; } h1 { font-size: 18px; letter-spacing: 0; }
  .boundary { flex: none; order: 3; width: 100%; font-size: 12px; }.boundary span { display: none; }
  header a { min-height: 44px; display: inline-flex; align-items: center; padding: 8px; font-size: 14px; }
  main { flex: 1; min-height: 0; } #world { height: 100%; min-height: 0; }
  .campus-caption, .controls-help { display: none; }
  #status { bottom: auto; top: 8px; left: max(12px, env(safe-area-inset-left)); max-width: calc(100% - 24px); font-size: 12px; background: var(--panelColor); padding: 4px 8px; border-radius: 8px; }
  #hub-fallback { position: fixed; top: 110px; left: 12px; right: 12px; padding: 12px; background: var(--panelColor); z-index: 10; }
  .module-label { max-width: 88px; padding: 3px 5px; }
  .module-label .number { font-size: 0; letter-spacing: 0; white-space: nowrap; }
  .module-label .number::before { content: attr(data-mobile); font-size: 12px; }
  .module-label .full-title, .module-label small { display: none; }
  .module-label .short-title { display: block; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .module-label.compact-label .short-title { display: none; }
  .core-label { max-width: 125px; }.core-label b { font-size: 14px; }
  .exploration-panels { display: contents; }
  .floating-panel, .exploration-panels .floating-panel { display: none; position: absolute; top: auto; bottom: calc(108px + env(safe-area-inset-bottom)); left: max(8px, env(safe-area-inset-left)); right: max(8px, env(safe-area-inset-right)); width: auto; max-width: none; max-height: 48%; overflow-y: auto; border-radius: 16px; z-index: 8; overscroll-behavior-y: contain; touch-action: pan-y pinch-zoom; }
  .floating-panel.mobile-open, .exploration-panels .floating-panel.mobile-open { display: block; }
  .panel-toggle { min-height: 44px; font-size: 14px; position: sticky; top: 0; background: var(--panelColor); z-index: 1; }
  .panel-content, #flow-content, #info-content { max-height: none; overflow: visible; }
  #flow-scroll, #info-scroll, .exploration-panels:has(#flow-content:not([hidden])):has(#info-content:not([hidden])) #flow-scroll, .exploration-panels:has(#flow-content:not([hidden])):has(#info-content:not([hidden])) #info-scroll { max-height: none; overflow: visible; }
  .panel-content p, .panel-content dl, .panel-content dd, .panel-content dt, #info-scroll ul, #info-scroll ol, #flow-step-list, #info-related button, #module-buttons button { font-size: 14px; line-height: 1.6; }
  .panel-content h2 { font-size: 18px; }.panel-content h3 { font-size: 16px; }
  #world button, #world a { min-height: 44px; min-width: 44px; font-size: 14px; }
  .flow-actions { position: sticky; bottom: 0; padding: 8px 0; z-index: 1; }.flow-actions button { flex: 1 1 auto; }
  #mobile-hub-bar { display: block; position: absolute; z-index: 9; bottom: 0; left: 0; right: 0; padding: 4px max(8px, env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); background: var(--panelColor); border-top: 1px solid var(--buildingSecondary); }
  #mobile-hub-current { width: 100%; border: 0; text-align: left; padding: 4px 8px; }
  #mobile-hub-bar > div { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
  #mobile-hub-bar [aria-expanded="true"] { border-color: var(--selectionColor); font-weight: bold; }
  .all-panel:not(.mobile-open):has(#all-handoff:not([hidden])) { display: block; padding: 4px; }
  .all-panel:not(.mobile-open) > .panel-toggle, .all-panel:not(.mobile-open) #all-handoff p { display: none; }
  #all-handoff { padding: 4px; } #all-handoff a { display: flex; align-items: center; justify-content: center; width: 100%; }
  #world:has(.mobile-open) .all-panel:not(.mobile-open) { display: none; }
}
@media (max-width: 950px) and (max-height: 500px) {
  header .boundary { display: none; } header { flex-wrap: nowrap; } header h1 { font-size: 16px; }
  #mobile-hub-bar { display: flex; gap: 8px; } #mobile-hub-current { width: 35%; } #mobile-hub-bar > div { flex: 1; }
  .floating-panel, .exploration-panels .floating-panel { bottom: calc(64px + env(safe-area-inset-bottom)); right: auto; width: min(420px, 55%); max-height: calc(100% - 76px); }
}
