/* Desktop chrome gives the network most of the window; fullscreen retains only
   floating controls. The canvas always renders at its actual displayed size. */
html { min-width: 0; min-height: 100%; }
body { min-width: 0; }

.viewbar { flex-wrap: wrap; }
.view-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 7px 12px; margin-left: auto; min-width: 0; }
.view-actions button { font-size: 12px; min-height: 36px; padding: 6px 11px; }
#globeFullscreen { color: var(--gold); border-color: #726044; background: #24251e; }
#globeFullscreen:hover { background: #373326; }
.desktop-status:empty { display: none; }
.desktop-status { font-size: 12px; color: #ffcebb; }
.viewhint { display: none; }
.zoom-readout { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; padding: 0 3px; align-self: stretch; color: var(--gold); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.navigation-hint { color: var(--muted); white-space: nowrap; }
.back { white-space: nowrap; }

.method { padding: 7px 20px; font-size: 12px; }
.method summary { width: fit-content; padding: 2px 0; }
.method summary:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }
.method details[open] summary { margin-bottom: 10px; }
.method p:last-child { margin-bottom: 3px; }
.error .desktop-error-message { margin: 0 0 15px; line-height: 1.6; }
.error .desktop-reload { border-color: #b58c6e; background: #241a19; color: #ffe7d7; }
.error .desktop-reload:hover { background: #49302a; }

@media (min-width: 950px) {
  html { height: 100%; overflow: hidden; }
  body { height: 100vh; height: 100dvh; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; overflow: hidden; }
  header { display: flex; align-items: center; gap: 22px; padding: 11px 22px 12px; }
  header > div:first-child { min-width: 0; }
  header h1 { font-size: clamp(24px, 2.1vw, 29px); margin-bottom: 2px; }
  .eyebrow { margin-bottom: 4px; font-size: 10px; letter-spacing: .18em; }
  .subtitle { font-size: 12px; }
  .metrics { flex: 0 0 auto; gap: 22px; margin-top: 0; flex-wrap: nowrap; }
  .metrics strong { font-size: 19px; }
  .metrics span { font-size: 9px; }
  main { min-height: 0; min-width: 0; grid-template-columns: minmax(0, 1fr) clamp(290px, 23vw, 330px); overflow: hidden; }
  .graph { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-height: 0; min-width: 0; overflow: hidden; }
  .viewbar { padding: 7px 14px; min-width: 0; gap: 8px; }
  .modes button { min-height: 36px; padding: 6px 10px; font-size: 13px; }
  .stage { height: auto; min-height: 0; min-width: 0; }
  #sphere { flex: 1 1 0%; min-height: 0; min-width: 0; width: 100%; }
  .camera { padding: 8px 14px; }
  .camera button { min-height: 36px; padding: 6px 10px; }
  .density { margin-left: auto; }
  .graphfoot { padding: 7px 14px; gap: 7px 18px; font-size: 11px; }
  .legend { gap: 12px; }
  #viewlabel { overflow-wrap: anywhere; }
  aside { min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior-y: contain; scrollbar-gutter: stable; padding: 19px 18px 22px; }
  aside, .neighbors, .verse-list, .method { scrollbar-width: thin; scrollbar-color: #53606b #10171f; }
  .asidehead h2 { font-size: 23px; }
  .picktabs { margin: 14px 0; }
  .picktabs button { padding-left: 8px; padding-right: 8px; font-size: 13px; }
  .method { max-height: min(28vh, 240px); overflow-y: auto; overscroll-behavior-y: contain; scrollbar-gutter: stable; }
}

@media (min-width: 950px) and (max-width: 1150px) {
  header { padding-left: 18px; padding-right: 18px; }
  .metrics { gap: 16px; }
  .metrics strong { font-size: 18px; }
  .camera { padding-left: 11px; padding-right: 11px; }
  .camera button { padding-left: 9px; padding-right: 9px; }
  .density { padding-left: 7px; padding-right: 7px; gap: 6px; }
  .density input { width: 65px; }
  .view-actions button { padding-left: 9px; padding-right: 9px; }
  .asidehead h2 { font-size: 20px; }
  body:not(.globe-fullscreen) .navigation-hint { display: none; }
}

/* A real full-screen drawing surface: no header, reserved sidebar or footer.
   The optional selection panel overlays the globe without resizing its camera. */
body.globe-fullscreen { display: block; position: fixed; inset: 0; width: 100%; height: 100%; overflow: hidden; background: var(--bg); }
body.globe-fullscreen > header,
body.globe-fullscreen > .method { display: none; }
body.globe-fullscreen main { position: absolute; inset: 0; display: block; overflow: hidden; }
body.globe-fullscreen .graph { position: absolute; inset: 0; display: block; overflow: hidden; }
body.globe-fullscreen .stage { position: absolute; inset: 0; height: 100%; display: block; }
body.globe-fullscreen #sphere { position: absolute; inset: 0; width: 100%; height: 100%; }
body.globe-fullscreen .viewbar { position: absolute; z-index: 10; top: 14px; left: 16px; right: 16px; padding: 7px 10px; min-height: 51px; border: 1px solid #354047; border-radius: 8px; background: #0c1219f5; box-shadow: 0 4px 18px #0006; }
body.globe-fullscreen .camera { position: absolute; z-index: 10; left: 16px; bottom: 46px; right: 16px; padding: 0; gap: 7px; }
body.globe-fullscreen .camera button { min-height: 38px; background: #101820f5; border-color: #4c575e; }
body.globe-fullscreen .density { background: #0c1219f5; border: 1px solid #354047; padding: 6px 12px; }
body.globe-fullscreen .graphfoot { position: absolute; z-index: 10; bottom: 13px; left: 16px; right: 16px; border: 0; padding: 0; pointer-events: none; text-shadow: 0 1px 4px #000; }
body.globe-fullscreen aside { position: absolute; z-index: 20; top: var(--selection-panel-top, 77px); right: 16px; bottom: 100px; width: min(360px, calc(100% - 32px)); border: 1px solid #46505a; border-radius: 8px; background: #10171ffa; box-shadow: 0 12px 40px #0009; overflow-y: auto; padding: 20px; }
body.globe-fullscreen:not(.globe-selection-open) aside { display: none; }
body.globe-fullscreen .error { z-index: 25; top: 90px; }
body.globe-fullscreen .desktop-status { position: absolute; top: 100%; right: 0; padding: 8px; background: var(--panel); }

@media (max-width: 949px) {
  .method { padding: 11px 18px; }
  .viewbar { flex-wrap: wrap; }
  .view-actions { margin-left: 0; }
  body.globe-fullscreen .viewbar { flex-wrap: wrap; left: 8px; right: 8px; top: 8px; }
  body.globe-fullscreen .modes button, body.globe-fullscreen .view-actions button { padding: 6px 8px; font-size: 12px; }
  body.globe-fullscreen .view-actions { margin-left: auto; }
}

/* Reference overlay follows the actual canvas bounds and never captures input. */
#verseLabels { position: absolute; z-index: 2; pointer-events: none; }
#verseLabels[hidden] { display: none; }
/* A consistent inset arrow replaces the platform-native edge-hugging arrow.
   Keep text clear of both the chevron and the right border. */
select, #verseLabelMode, #themeLabelMode {
  appearance: none; -webkit-appearance: none;
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%23d5d6d2' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-position: right 14px center; background-size: 12px 8px; background-repeat: no-repeat;
}
.label-control { display: flex; align-items: center; gap: 8px; white-space: nowrap; font-size: 12px; }
#verseLabelMode, #themeLabelMode { width: 190px; margin: 0; min-height: 36px; padding-top: 6px; padding-bottom: 6px; padding-left: 10px; font-size: 12px; }
#themeLabelMode { width: 202px; }
.label-control select[data-enabled="true"] { color: var(--gold); border-color: #8a7045; background-color: #30291e; }
@media (max-width: 1150px) {
 .label-control { flex-direction: column; align-items: flex-start; gap: 3px; font-size: 11px; }
 .view-actions { align-items: flex-end; }
 #verseLabelMode { width: 186px; }
 #themeLabelMode { width: 198px; }
}
.stage { background: radial-gradient(ellipse at 50% 50%,var(--globe-halo, #151711) 0%,#0b1015 43%,#070c12 72%); }
.legend > span > .dot { background: var(--globe-color, #dfbd7d); }
.legend > span > .diamond { background: rgb(var(--globe-theme-color, 255 230 173)); }

#selectionColors { color: var(--gold); border-color: #726044; }
#selectionColors[aria-expanded="true"] { background: #30291e; }
#selectionColorPanel { position: fixed; inset: auto; margin: 0; box-sizing: border-box; width: min(450px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow-y: auto; padding: 17px 18px; border: 1px solid #6c614c; border-radius: 10px; background: #111922; color: var(--text); box-shadow: 0 12px 45px #0009; }
.color-panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.color-panel-heading h2 { font: 600 18px system-ui, sans-serif; margin: 0; color: var(--gold); }
.color-panel-heading button { min-height: 28px; width: 28px; padding: 0; font-size: 21px; }
#selectionColorPanel p { font-size: 12px; color: var(--muted); margin: 9px 0 16px; line-height: 1.5; }
.color-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.color-columns fieldset { border: 0; padding: 0; min-width: 0; margin: 0; }
.color-columns legend { color: var(--gold); font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.selection-color-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; font-size: 12px; color: #e6dfd0; cursor: pointer; }
.selection-color-row input[type="color"] { flex: 0 0 39px; width: 39px; height: 29px; min-height: 0; padding: 3px; border: 1px solid #62717a; border-radius: 5px; background: #111920; cursor: pointer; }
.selection-color-row input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.selection-color-row input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 2px; }
.globe-color-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; padding: 16px 0; border-bottom: 1px solid #354047; }
.globe-color-row label { flex: 1; margin: 0; min-width: 150px; }
.globe-color-row button { font-size: 12px; min-height: 32px; padding: 5px 9px; color: var(--gold); }
.focus-legend, .focus-legend > span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.focus-legend { gap: 14px; flex-wrap: wrap; }
.focus-legend[hidden], .focus-legend > [hidden] { display: none; }
.selection-line { width: 15px; height: 2px; display: inline-block; }
.legend { flex-wrap: wrap; }
