/* GSEIO · LAMBDA-FIS Web Viewer / phase 1, based on LFIS 0.127 styles */
:root{--toolbar-height:44px;--panel-bg:#18202c;--edge:#ffffff30;--accent:#5d8aff;--text:#f3f6fc;font-family:Arial,'Segoe UI',sans-serif;color:#27303a}
*{box-sizing:border-box}html,body{margin:0;width:100%;height:100%;overflow:hidden}body{display:grid;grid-template-rows:var(--toolbar-height) minmax(0,1fr);background:#969696}
button{font:inherit;cursor:pointer}.skip-link{position:absolute;top:-100px;left:12px;background:white;color:#15243b;z-index:99;padding:8px}.skip-link:focus{top:4px}
.app-toolbar{position:relative;z-index:12;display:flex;align-items:center;justify-content:space-between;gap:15px;min-width:0;background:var(--panel-bg);color:var(--text);padding:0 16px;box-shadow:0 1px 4px #0004}
.toolbar-brand-group{display:flex;align-items:center;gap:12px;min-width:0}.app-brand{font-size:22px;font-weight:700;letter-spacing:.028em;color:#f8f9fa;text-decoration:none;white-space:nowrap}.app-brand:hover{text-decoration:underline;text-decoration-color:#86afe7}.brand-fis{color:#edf0f6}.viewer-tag{border-left:1px solid #4b5b70;padding-left:12px;color:#afbed0;font-size:10px;letter-spacing:.09em;white-space:nowrap}
.toolbar-right{display:flex;align-items:center;gap:22px}.toolbar-dates{display:flex;align-items:center;gap:4px}.date-arrow{width:30px;height:29px;border:0;border-radius:4px;background:transparent;color:#e0e9f9;font-size:26px;line-height:18px}.date-arrow:hover:not(:disabled),.today-btn:hover{background:#ffffff20}.date-arrow:disabled{opacity:.3;cursor:default}.date-range{display:flex;gap:8px;align-items:center;white-space:nowrap;font-size:12px;font-weight:600;font-variant-numeric:tabular-nums}.range-dash{color:#a9bcd3}.today-btn{margin-left:7px;border:1px solid #60718a;background:transparent;color:#edf2fa;border-radius:5px;padding:5px 10px;font-size:11px}.home-link{color:#b2c7dc;text-decoration:none;font-size:11px;font-weight:700}.home-link:hover{color:#fff}
.viewer-main{position:relative;min-height:0;height:100%;overflow:hidden}#map{position:absolute;inset:0;background:#969696;outline:0}#map:focus-visible{outline:2px solid #8cacdf;outline-offset:-3px}
.lfis-gray-relief{filter:grayscale(1) brightness(1.65)}.coastline-filter-defs{position:absolute;width:0;height:0;overflow:hidden;pointer-events:none}.lfis-coastline canvas{filter:url(#lfis-coastline-outline)}
.layers{position:absolute;z-index:6;left:12px;top:16px;width:214px;padding:12px 10px 11px;background:rgba(24,32,44,.91);color:var(--text);border:1px solid #ffffff24;border-radius:12px;box-shadow:0 4px 20px #0004;backdrop-filter:blur(8px)}.layers h1{display:flex;justify-content:space-between;align-items:center;margin:0 4px 10px;padding:0 0 9px;border-bottom:1px solid var(--edge);font-size:13px;font-weight:700}.layers h1 span{font-size:10px;color:#a5bad1;font-weight:400}
.layer-controls{display:flex;flex-direction:column;gap:6px}.layer-toggle{display:flex;width:100%;align-items:center;gap:9px;min-height:37px;border:1px solid #ffffff20;border-radius:22px;padding:4px 9px 4px 5px;background:rgba(31,41,56,.88);color:#ecf1f9;text-align:left;font-size:12px;font-weight:600}.layer-toggle:hover{background:#33445b;border-color:#ffffff45}.layer-toggle:focus-visible{outline:2px solid #a9caff;outline-offset:2px}.layer-symbol{display:grid;place-items:center;width:26px;height:26px;flex:none;border-radius:50%;color:#4f79e6;background:white;font-weight:700;font-size:14px}.layer-name{flex:1}.off-label{flex:none;font-size:10px;font-weight:700;color:#8fa3ba}.layer-note{margin-top:11px;padding:8px 7px;border-top:1px solid var(--edge);color:#b5c8da;font-size:10px;line-height:1.5}
.viewer-info{position:absolute;z-index:5;top:16px;right:16px;max-width:min(280px,calc(100% - 256px));background:rgba(24,32,44,.94);color:#f0f5fa;padding:13px 15px;border-radius:10px;box-shadow:0 3px 12px #0004;font-size:11px}.info-title{color:#9fb5d5;letter-spacing:.07em;font-size:9px;margin-bottom:5px}.viewer-info strong{font-size:13px}.viewer-info p{color:#c1cbd9;font-size:11px;line-height:1.45;margin:9px 0 0}.map-footer{position:absolute;z-index:5;bottom:0;left:0;right:0;display:flex;justify-content:space-between;gap:16px;padding:4px 12px 5px;background:rgba(236,240,243,.88);color:#4b5964;font-size:10px;pointer-events:none}.map-footer strong{font-weight:700}.map-footer span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.map-credit{max-width:50%}
.error-banner{position:absolute;z-index:9;left:50%;top:14px;transform:translateX(-50%);max-width:calc(100% - 480px);width:max-content;background:white;color:#26384b;padding:9px 14px;border-radius:7px;border:1px solid #b8c6d3;box-shadow:0 3px 12px #0003;font-size:12px}
.ol-zoom{top:auto;left:auto;right:12px;bottom:62px}.ol-attribution{bottom:26px;right:0;max-width:calc(100% - 230px);background:rgba(255,255,255,.86);font:9px/16px Arial,sans-serif}.ol-attribution li:not(:last-child)::after{content:' · '}.ol-attribution a{color:#36536c}
@media(max-width:850px){.viewer-tag{display:none}.home-link{display:none}.layers{width:192px}.viewer-info{max-width:215px;font-size:10px}.error-banner{max-width:calc(100% - 48px);top:232px}}
@media(max-width:590px){:root{--toolbar-height:75px}.app-toolbar{align-items:flex-start;flex-direction:column;justify-content:center;padding:7px 10px;gap:5px}.app-brand{font-size:18px}.toolbar-right{width:100%;justify-content:center}.toolbar-dates{width:100%;justify-content:center}.date-range{font-size:11px}.today-btn{margin-left:auto}.layers{top:11px;left:8px;width:180px;max-height:calc(100% - 70px);overflow:auto;padding:9px 7px}.layer-toggle{font-size:11px;min-height:34px}.layer-symbol{width:24px;height:24px}.viewer-info{top:auto;bottom:35px;right:8px;max-width:calc(100% - 202px);padding:10px 9px}.map-footer{font-size:9px}.map-credit{display:none}.ol-attribution{bottom:28px;max-width:100%}.error-banner{top:14px;left:auto;right:8px;transform:none;max-width:calc(100% - 202px)}}
@media(max-height:500px){.layers{top:7px}.layer-toggle{min-height:29px}.layer-note{margin-top:4px}.viewer-info{top:7px}.map-footer{padding:2px 8px}}


/* GSEIO v0.8 / Web Viewer v0.2 — three requested UI refinements only. */
:root { --panel-bg:#102237; }
.app-toolbar { background:#102237; }
.app-brand { display:inline-flex;align-items:center;gap:8px;line-height:1; }
.brand-mark { display:block;width:69px;height:32px;flex:none;object-fit:contain; }
.brand-title { display:inline-flex;align-items:baseline;white-space:nowrap; }
.toolbar-dates { display:flex;align-items:center;gap:5px;min-height:36px; }
.date-arrow { display:inline-flex;align-items:center;justify-content:center;flex:none;width:32px;height:32px;line-height:1;padding:0; }
.date-arrow svg { display:block;flex:none; }
.date-range { display:inline-flex;align-items:center;justify-content:center;min-height:32px;line-height:1; }
.date-range time,.range-dash { display:inline-flex;align-items:center;justify-content:center;min-height:32px; }
.today-btn { display:inline-flex;align-items:center;justify-content:center;min-height:32px;line-height:1;margin-left:7px; }
@media(max-width:590px){
  .brand-mark { width:53px;height:25px; }
  .toolbar-dates { min-height:34px; }
  .date-arrow { height:30px;width:30px; }
  .date-range,.date-range time,.range-dash { min-height:30px; }
  .today-btn { min-height:30px; }
}

/* v0.3 — stage 2, source-authentic tectonic reference line overlays. */
.layer-toggle.is-active {background:#244e84;border-color:#94b7fc;color:#fff;}
.layer-toggle.is-active .off-label {color:#dff3ff;}
.layer-toggle.is-loading {opacity:.8;cursor:progress;}
.tectonic-legend{margin-top:10px;padding:10px 7px 5px;border-top:1px solid #ffffff35;}
.tectonic-legend[hidden]{display:none!important;}
.legend-heading{font-size:10px;font-weight:700;letter-spacing:.08em;color:#d8eaff;margin-bottom:8px;}
.legend-heading.minor{margin-top:10px;font-size:9px;}
.legend-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px 5px;font-size:9px;color:#d3deea;line-height:1.25;}
.legend-grid span{display:flex;align-items:center;gap:5px;}
.legend-grid i{width:16px;min-width:16px;border-top:3px solid var(--swatch);display:inline-block;}
.legend-grid i.dash{border-top-style:dashed;}
.legend-count{font-size:9px;color:#aebfd4;margin-top:11px;}
.layers{max-height:calc(100% - 62px);overflow-y:auto;scrollbar-width:thin;scrollbar-color:#667990 transparent;}
@media(max-width:590px){.layers{max-height:calc(100% - 60px)}.legend-grid{grid-template-columns:1fr;}}

/* GSEIO v0.10 / LAMBDA-FIS Web Viewer v0.4: weekly observed earthquakes.
   Uses the original LFIS 0.127 hypocentral depth palette and magnitude radius. */
.earthquakes-legend{margin-top:12px;border-top:1px solid #ffffff34;padding:12px 5px 0;}
.earthquakes-legend .legend-heading{margin-bottom:7px;}
.quake-legend-row{display:flex;align-items:center;justify-content:space-between;gap:6px;color:#d5e0ee;font-size:9px;}
.quake-min{font-weight:800;background:#344962;border-radius:4px;padding:2px 6px;color:#fff;white-space:nowrap;}
.quake-depth-swatches{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));margin-top:10px;gap:2px;}
.quake-depth-swatches span{display:flex;flex-direction:column;align-items:center;gap:4px;color:#dbe6f1;font-size:8px;white-space:nowrap;}
.quake-depth-swatches i{display:block;background:var(--depth-color);height:8px;width:100%;border:1px solid #0004;border-radius:2px;}
.quake-depth-units{color:#a9bfce;font-size:9px;margin-top:8px;}
.quake-layer-status{font-size:10px;line-height:1.4;color:#d5e6f4;margin-top:8px;min-height:14px;}
.quake-layer-status.is-error{color:#ffd2b8;}
.quake-details{position:absolute;z-index:8;top:16px;right:16px;width:320px;max-width:calc(100% - 265px);max-height:calc(100% - 80px);overflow:auto;background:rgba(16,34,55,.97);color:#f3f8fb;box-shadow:0 6px 24px #0006;border:1px solid #ffffff38;border-radius:10px;padding:17px 18px;scrollbar-color:#8194ac transparent;}
.quake-details[hidden],.viewer-info[hidden]{display:none!important;}
.quake-detail-head{display:flex;align-items:center;justify-content:space-between;gap:10px;}
.quake-close{display:flex;align-items:center;justify-content:center;width:25px;height:25px;background:#ffffff0c;border:1px solid #ffffff40;border-radius:5px;color:#eef4f9;font-size:20px;line-height:1;}
.quake-close:hover{background:#ffffff26;}
.quake-title-row{display:flex;align-items:baseline;gap:9px;margin-top:4px;}
.quake-magnitude{font-size:33px;line-height:1.2;letter-spacing:-.03em;color:#fff;}
.quake-review-status{color:#b4c8dd;font-size:10px;}
.quake-place{font-size:16px;line-height:1.35;margin:5px 0 13px;font-weight:700;}
.quake-attributes{margin:0;border-top:1px solid #ffffff2d;}
.quake-attributes div{display:grid;grid-template-columns:43% minmax(0,1fr);gap:5px;padding:8px 0;border-bottom:1px solid #ffffff1b;}
.quake-attributes dt{color:#a7c1d5;font-size:10px;}
.quake-attributes dd{color:#fff;font-size:11px;margin:0;text-align:right;overflow-wrap:anywhere;}
.quake-secondary{font-size:11px;line-height:1.5;margin-top:12px;color:#dceaf7;}
.quake-source-link{display:block;background:#2d6680;border:1px solid #84c8de55;border-radius:5px;text-align:center;text-decoration:none;color:white;font-size:12px;font-weight:700;padding:9px;margin-top:15px;}
.quake-source-link:hover{background:#337a96;}
.quake-note{color:#a9bfce;font-size:10px;line-height:1.5;margin:12px 0 0;}
@media(max-width:850px){.quake-details{width:290px;max-width:calc(100% - 215px);}}
@media(max-width:590px){.quake-details{top:auto;left:8px;right:8px;bottom:38px;width:auto;max-width:none;max-height:54%;padding:12px;}.quake-place{font-size:14px;}.quake-magnitude{font-size:25px;}.viewer-info{max-width:calc(100% - 210px);}}
@media(max-height:500px){.quake-details{top:7px;max-height:calc(100% - 36px);}}

/* GSEIO v0.11 — first published model, original LFIS 0.127 LogNRI palette. */
.lognri-legend{position:absolute;z-index:7;top:16px;right:16px;width:294px;max-width:calc(100% - 260px);color:#eef4fa;background:rgba(16,34,55,.97);border:1px solid #ffffff35;border-radius:10px;padding:14px;box-shadow:0 6px 24px #0006;font-size:11px}
.lognri-legend[hidden]{display:none!important}
.lognri-legend .legend-heading{font-size:10px;line-height:1.4;margin-bottom:10px}
.lognri-gradient{height:13px;border-radius:4px;background:linear-gradient(to right, rgb(54,124,247) 0%,rgb(73,201,232) 25%,rgb(255,255,106) 50%,rgb(255,126,53) 75%,rgb(199,30,43) 90%,rgb(23,17,26) 100%);border:1px solid #ffffff4a}
.lognri-ticks{display:flex;justify-content:space-between;color:#cfdbeb;font-size:9px;padding-top:5px}
.lognri-details{border-top:1px solid #ffffff2f;margin:11px 0 0;padding:7px 0 0}
.lognri-details div{display:grid;grid-template-columns:46% minmax(0,1fr);gap:6px;margin:6px 0}
.lognri-details dt{color:#a5bed1}.lognri-details dd{margin:0;text-align:right;overflow-wrap:anywhere}
.lognri-legend p{border-top:1px solid #ffffff27;padding-top:8px;color:#b6cddd;font-size:10px;line-height:1.5;margin:11px 0 0}
@media(max-width:850px){.lognri-legend{width:245px;max-width:calc(100% - 214px)}}
@media(max-width:590px){.lognri-legend{top:auto;right:8px;bottom:35px;max-width:calc(100% - 205px);width:210px;padding:10px}.lognri-details div{display:block}.lognri-details dd{text-align:left}}

/* GSEIO v0.17: saved TectonicStress high-density paired animation. */
.tectonic-stress-legend{position:absolute;z-index:7;right:16px;top:16px;width:294px;max-width:calc(100% - 260px);background:rgba(16,34,55,.97);color:#eef4fa;padding:14px;border:1px solid #ffffff35;border-radius:10px;box-shadow:0 6px 24px #0006;font-size:11px;}
.tectonic-stress-legend[hidden]{display:none!important;}
.tectonic-stress-legend.with-lognri{top:284px;}
.tectonic-stress-legend .legend-heading{margin-bottom:9px;}
.tectonic-stress-legend p{border-top:1px solid #ffffff27;padding-top:9px;font-size:10px;line-height:1.5;color:#b9cfe0;}
.eq-recent-canvas,.stress-animation-canvas{pointer-events:none!important;}
@media(max-width:850px){.tectonic-stress-legend{width:245px;max-width:calc(100% - 214px)}.tectonic-stress-legend.with-lognri{top:282px;}}
@media(max-width:590px){.tectonic-stress-legend{top:auto;right:8px;bottom:37px;width:210px;max-width:calc(100% - 205px);padding:10px}.tectonic-stress-legend.with-lognri{top:auto;bottom:275px;} .tectonic-stress-legend .lognri-details div{display:block;} .tectonic-stress-legend .lognri-details dd{text-align:left;}}
@media(prefers-reduced-motion:reduce){.stress-animation-canvas,.eq-recent-canvas{display:none!important;}}

/* GSEIO v0.19: independent Shear stress legend, one colour raster slot. */
.shear-stress-legend{z-index:7}
.tectonic-stress-legend.with-scalar{top:284px}
@media(max-width:850px){.tectonic-stress-legend.with-scalar{top:282px}}
@media(max-width:590px){.tectonic-stress-legend.with-scalar{top:auto;bottom:275px}}

/* GSEIO v0.21: Shear traction uses the existing scalar-map legend style. */
.shear-traction-legend{z-index:7}

/* v0.22 · Independent saved weighted Waves overlay, legend at lower right. */
.waves-legend{position:absolute;z-index:7;right:16px;bottom:34px;width:294px;max-width:calc(100% - 260px);
  padding:13px 14px;color:#eef4fa;background:rgba(16,34,55,.97);border:1px solid #ffffff35;
  border-radius:10px;box-shadow:0 6px 24px #0006;font-size:11px;}
.waves-legend[hidden]{display:none!important;}
.waves-legend .legend-heading{margin-bottom:8px;}
.waves-gradient{height:7px;border-radius:3px;border:1px solid #ffffff32;
  background:linear-gradient(to right,rgb(42,104,235),rgb(39,202,233),rgb(53,199,114),rgb(255,223,63),rgb(242,57,70));}
.waves-range{display:flex;justify-content:space-between;color:#bbd0df;font-size:9px;margin:4px 0 9px;}
.waves-details{margin:0;padding-top:5px;border-top:1px solid #ffffff25;}
.waves-details div{display:flex;justify-content:space-between;gap:12px;margin:4px 0;}
.waves-details dt{color:#a9bfd2;}
.waves-details dd{margin:0;overflow-wrap:anywhere;text-align:right;}
.waves-legend p{font-size:9px;line-height:1.45;color:#b9cfe0;margin:8px 0 0;}
@media(max-width:850px){.waves-legend{max-width:calc(100% - 214px);width:245px;}}
@media(max-width:590px){.waves-legend{right:8px;bottom:35px;max-width:calc(100% - 205px);width:210px;padding:10px;}}


/* GSEIO v0.23 — compact factual legends, all model-layer opacities at 100%. */
.layer-note, .legend-count, .quake-depth-units, .viewer-info {display:none!important;}
/* Keep live earthquake loading/error status for troubleshooting. */
.model-legend-stack {
  position:absolute; z-index:7; top:16px; right:16px;
  width:294px; max-width:calc(100% - 260px);
  max-height:calc(100% - 76px);
  display:flex; flex-direction:column; align-items:stretch; gap:10px;
  overflow-y:auto; overscroll-behavior:contain;
  scrollbar-width:thin; scrollbar-color:#75869a transparent;
}
.model-legend-stack > .lognri-legend,
.model-legend-stack > .tectonic-stress-legend,
.model-legend-stack > .waves-legend {
  position:relative!important;
  top:auto!important; right:auto!important; bottom:auto!important; left:auto!important;
  width:100%!important; max-width:none!important;
  flex:0 0 auto;
  margin:0;
}
.model-legend-stack > [hidden]{display:none!important;}
.model-legend-stack .lognri-legend p,
.model-legend-stack .tectonic-stress-legend p,
.model-legend-stack .waves-legend p { display:none!important; }
@media(max-width:850px){.model-legend-stack{width:245px;max-width:calc(100% - 214px);}}
@media(max-width:590px){.model-legend-stack{top:10px;right:8px;width:210px;max-width:calc(100% - 205px);max-height:calc(100% - 83px);}}
@media(max-height:500px){.model-legend-stack{top:7px;max-height:calc(100% - 58px);}}


/* GSEIO v0.24 — keep earthquake details to the LEFT of model legends. */
@media (min-width:851px){
  .quake-details{right:324px;width:320px;max-width:calc(100% - 568px);}
}
@media (min-width:761px) and (max-width:850px){
  .quake-details{right:275px;width:290px;max-width:calc(100% - 490px);}
}
@media (max-width:760px){
  .quake-details{top:auto;left:8px;right:8px;bottom:36px;width:auto;max-width:none;max-height:44%;}
}

/* Small screens: when an event sheet opens, keep model cards in a scrollable
   upper region rather than letting them cover the selected earthquake. */
@media (max-width:760px){
  .viewer-main:has(.quake-details:not([hidden])) .model-legend-stack{
    max-height:calc(56% - 55px);
  }
}
