/* Age / research-use gate. Hidden once accepted (html.age-ok is set in <head> before paint).
   Sizing scales with viewport height (vh, then dvh where supported) so the card always fits the screen without scrolling. */
.agegate{position:fixed;inset:0;z-index:100;display:flex;align-items:center;justify-content:center;padding:12px;background:rgba(10,20,32,.72);-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);overflow:hidden;overscroll-behavior:contain;opacity:1;transition:opacity .3s}
html.age-ok .agegate{display:none}
html:not(.age-ok),html:not(.age-ok) body{overflow:hidden}
.agegate.out{opacity:0;pointer-events:none}

.ag-box{
  --vh:1vh;
  width:100%;max-width:580px;
  max-height:calc(100vh - 24px);max-height:calc(100dvh - 24px);
  overflow-y:auto;overscroll-behavior:contain; /* last resort on extreme sizes: scrolls inside the card, never the page */
  background:linear-gradient(180deg,#fff 0%,#f0f6ff 100%);
  border-radius:clamp(18px,calc(var(--vh)*3.2),28px);
  padding:clamp(18px,calc(var(--vh)*5),44px) clamp(18px,5vw,48px) clamp(16px,calc(var(--vh)*4),36px);
  text-align:center;box-shadow:0 30px 80px rgba(0,0,0,.35)
}
@supports (height:1dvh){.ag-box{--vh:1dvh}}

.ag-logo{width:clamp(110px,calc(var(--vh)*20),190px);height:auto;margin:0 auto clamp(8px,calc(var(--vh)*2.4),22px)}
.ag-title{font-family:var(--font-head);font-size:clamp(11px,calc(var(--vh)*1.5),13px);font-weight:700;letter-spacing:.28em;color:var(--navy);margin-bottom:clamp(6px,calc(var(--vh)*1.8),18px)}
.ag-desc{font-size:clamp(12.5px,calc(var(--vh)*1.9),16px);line-height:1.6;color:var(--muted);margin:0 auto clamp(12px,calc(var(--vh)*3),28px);max-width:470px}

.ag-opt{display:flex;align-items:flex-start;gap:clamp(10px,calc(var(--vh)*1.8),16px);text-align:left;background:#fff;border:1px solid rgba(10,27,51,.12);border-radius:clamp(12px,calc(var(--vh)*2),18px);padding:clamp(10px,calc(var(--vh)*2.2),20px) clamp(12px,2.4vw,22px);margin-bottom:clamp(8px,calc(var(--vh)*1.7),16px);font-size:clamp(12px,calc(var(--vh)*1.7),14px);line-height:1.65;color:var(--ink);cursor:pointer;transition:border-color .2s,box-shadow .2s}
.ag-opt:hover{border-color:rgba(10,27,51,.28)}
.ag-opt input{position:absolute;opacity:0;width:1px;height:1px}
.ag-cb{flex-shrink:0;width:clamp(20px,calc(var(--vh)*2.8),24px);height:clamp(20px,calc(var(--vh)*2.8),24px);margin-top:1px;border:1.5px solid rgba(10,27,51,.3);border-radius:7px;background:#fff;display:flex;align-items:center;justify-content:center;transition:all .2s}
.ag-cb::after{content:"";width:6px;height:11px;border:solid #fff;border-width:0 2px 2px 0;transform:rotate(45deg) translate(-1px,-1px);opacity:0}
.ag-opt input:checked+.ag-cb{background:var(--navy);border-color:var(--navy)}
.ag-opt input:checked+.ag-cb::after{opacity:1}
.ag-opt input:focus-visible+.ag-cb{outline:2px solid var(--green);outline-offset:3px}
.ag-opt:has(input:checked){border-color:var(--navy);box-shadow:0 4px 16px rgba(8,20,171,.08)}
.ag-opt b{font-weight:700}
.ag-opt a{font-weight:700;color:var(--navy);text-decoration:underline;text-underline-offset:3px}

.ag-enter{width:100%;height:clamp(44px,calc(var(--vh)*6.6),60px);margin-top:clamp(2px,calc(var(--vh)*1),10px);border:0;border-radius:14px;background:var(--navy);color:#fff;font:700 clamp(14px,calc(var(--vh)*1.9),16px) var(--font-body);display:flex;align-items:center;justify-content:center;gap:10px;box-shadow:0 8px 24px rgba(8,20,171,.3);transition:background .2s,color .2s,box-shadow .2s}
.ag-enter:disabled{background:#dbe2ea;color:#8a94a6;box-shadow:none;cursor:not-allowed}
.ag-leave{display:inline-block;margin-top:clamp(10px,calc(var(--vh)*2.6),26px);font-size:clamp(12.5px,calc(var(--vh)*1.7),14px);font-weight:600;color:var(--navy)}
.ag-leave:hover{text-decoration:underline}
.ag-note{margin:clamp(8px,calc(var(--vh)*1.8),18px) auto 0;max-width:480px;font-size:clamp(11px,calc(var(--vh)*1.45),13px);line-height:1.6;color:var(--muted)}

/* Narrow phones: text wraps more, so tighten a little further. */
@media (max-width:420px){
  .ag-box{padding-left:16px;padding-right:16px}
  .ag-desc{line-height:1.5}
  .ag-opt{line-height:1.5}
  .ag-note{line-height:1.45}
}
/* Very short portrait screens (e.g. 320x568): drop the least important spacing. */
@media (max-height:600px) and (max-width:599px){
  .ag-logo{width:104px;margin-bottom:6px}
  .ag-desc{font-size:12px;margin-bottom:10px}
  .ag-opt{font-size:11.5px;line-height:1.45;padding:9px 12px;margin-bottom:7px}
  .ag-leave{margin-top:8px}
  .ag-note{font-size:10.5px;line-height:1.4;margin-top:6px}
}

/* Short, wide screens (landscape phones, small laptop windows): two columns. */
@media (max-height:520px) and (min-width:600px){
  .ag-box{max-width:860px;display:grid;grid-template-columns:1fr 1.25fr;column-gap:28px;align-items:center;text-align:left;padding:18px 24px}
  .ag-intro{grid-column:1}
  .ag-form{grid-column:2;text-align:center}
  .ag-note{grid-column:1 / -1;text-align:center;max-width:none}
  .ag-logo{margin-left:0;width:130px}
  .ag-desc{margin-left:0;margin-bottom:0}
  .ag-opt{padding:9px 14px;margin-bottom:8px;font-size:12.5px;line-height:1.5}
  .ag-enter{height:44px;margin-top:2px}
  .ag-leave{margin-top:8px}
  .ag-note{margin-top:8px}
}
