/* Only the public station is a one-screen instrument. Account screens keep normal document flow. */
html:has(.hero:not(.compact,[hidden])) { background: #0d1c17; overscroll-behavior: none; }
body:has(.hero:not(.compact,[hidden])) {
  --deck: #10241c; --rail: #354d3d; --phosphor: #d5ff91; --caption: #c2d1bf;
  --head: clamp(3.3rem,8svh,5rem); --edge: clamp(.65rem,2vw,2rem);
  min-height: 100dvh; display: flex; flex-direction: column;
  padding: max(.25rem,env(safe-area-inset-top)) env(safe-area-inset-right) max(var(--edge),env(safe-area-inset-bottom)) env(safe-area-inset-left);
  background: #0d1c17; color: #f0f6e6;
}
body:has(.hero:not(.compact,[hidden])) :is(.top,main) { width: min(100% - 2 * var(--edge),100rem); }
body:has(.hero:not(.compact,[hidden])) main { flex: 1 0 auto; display: flex; flex-direction: column; min-height: 0; margin-block: 0; }
body:has(.hero:not(.compact,[hidden])) .top { flex: none; min-height: var(--head); border: 0; }
body:has(.hero:not(.compact,[hidden])) .footer { display: none; }
body:has(.hero:not(.compact,[hidden])) .top #nav-how { display: inline-flex; align-items: center; min-height: 44px; }
body:has(.hero:not(.compact,[hidden])) .nav-login { color: #ecf4e3; background: #223a2e; border-color: #658164; }
body:has(.hero:not(.compact,[hidden])) .nav-login:hover { background: #36513e; }
.launch-actions { display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; }
#signup-dialog, #proxy-manual { max-height: calc(100dvh - 2rem); }
#signup-dialog .form-hint { color: var(--muted); }
#signup-dialog form[method="dialog"] { margin-top: 1rem; }
#signup-status:not(:empty) { margin: .8rem 0 0; color: #8e2d20; }
.hero:not(.compact) {
  position: relative; isolation: isolate; display: grid; grid-template-columns: minmax(0,1fr);
  grid-template-rows: minmax(min-content,1fr) auto; align-items: stretch;
  flex: 1 0 auto; min-width: 0;
  padding: 0; gap: 0; border: 1px solid var(--rail); background: var(--deck);
}
.hero:not(.compact) .hero-copy { grid-area: 1 / 1; align-self: center; width: 44%; padding: clamp(1rem,3.2vw,3.5rem); z-index: 1; container-type: inline-size; }
.hero:not(.compact) .eyebrow { color: var(--phosphor); margin: 0 0 clamp(.6rem,2vh,1.5rem); font-size: .65rem; }
.hero:not(.compact) h1 { font-size: min(13cqi,5rem); font-weight: 690; line-height: 1; white-space: nowrap; }
.hero:not(.compact) h1 em { display: block; color: #d2ecaf; }
.hero:not(.compact) .intro { max-width: 34ch; text-wrap: balance; color: #d4dfcf; margin: clamp(.65rem,2vh,1.35rem) 0; }
.hero:not(.compact) #proxy-copy { color: #172b1a; background: var(--phosphor); border-color: var(--phosphor); }
.hero:not(.compact) #proxy-copy:hover { background: #e6ffb8; }
.hero:not(.compact) #signup-start { color: #e7f1df; border-color: #6a836d; background: #193126; }
.hero:not(.compact) .form-hint:not(dialog *) { color: var(--caption); }
.hero:not(.compact) :focus-visible { outline-color: var(--phosphor); }
.hero:not(.compact) dialog :focus-visible { outline-color: var(--accent); }
.hero:not(.compact) .preview { display: contents; }
.hero:not(.compact) .scene { grid-area: 1 / 1; overflow: hidden; isolation: isolate; background: var(--deck); }
.terrain { position: absolute; inset: 0 0 0 auto; width: 63%; container-type: size; display: grid; place-items: center; background: #142a21; }
.plant-map { position: relative; width: min(100cqw, 166.6667cqh); aspect-ratio: 5 / 3; container-type: inline-size; }
.plant-drawing { display: block; width: 100%; height: 100%; overflow: visible; }
.terrain::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(90deg,var(--deck),transparent 10%); }
/* Artwork coordinates: mast tips at (205,123) and (585,99) in the 800 × 480 map. */
.plant-map :is(.station-a,.aerial-a) { left: 25.625%; --tip: 25.625%; }
.plant-map :is(.station-b,.aerial-b) { left: 73.125%; --tip: 20.625%; }
.aerial { position: absolute; top: var(--tip); width: 0; height: 0; pointer-events: none; }
@media (prefers-reduced-motion: no-preference) {
  .aerial::after { position: absolute; pointer-events: none; top: 0; left: 0; }
  .preview:has(#demo-address:not([hidden])) .aerial::after {
    content: ''; width: 10px; height: 10px; border: 2px solid #eaffad; border-radius: 50%;
    animation: local-work 2s ease-out forwards;
  }
  .preview:has(#demo-address:not([hidden])) .aerial-b::after { animation-delay: -.25s; }
  @keyframes local-work { from { transform: translate(-50%,-50%) scale(.5); } to { transform: translate(-50%,-50%) scale(2.5); opacity: 0; } }
  .preview:has(#demo-send:not([hidden])) .aerial-a::after,
  .preview:has(#demo-reply:not([hidden])) .aerial-b::after {
    content: ''; width: 96cqw; aspect-ratio: 1; border-radius: 50%; opacity: 0;
    background: radial-gradient(closest-side,transparent 78%,#d9ffad 79%,transparent 80% 88%,#d9ffad 89%,transparent 90% 98%,#f0ffc2 99%,transparent);
    animation: radio-wave 3s ease-out forwards;
  }
  @keyframes radio-wave { 0% { transform: translate(-50%,-50%) scale(.015); opacity: .95; } 62% { transform: translate(-50%,-50%) scale(1); opacity: .8; } 70%,100% { transform: translate(-50%,-50%) scale(1.08); opacity: 0; } }
  .preview:has(#demo-send:not([hidden])) .aerial-b::after,
  .preview:has(#demo-reply:not([hidden])) .aerial-a::after {
    content: 'RX ✓'; background: #d5ff91; color: #142a21; padding: .15rem .3rem; white-space: nowrap;
    transform: translateX(-50%); animation: radio-received 3s linear forwards;
  }
  @keyframes radio-received { 0%,61% { opacity: 0; } 70%,100% { opacity: 1; } }
}
.scene .scene-tag { z-index: 1; left: auto; right: .7rem; top: .7rem; font-size: .6rem; border: 1px solid #617e62; }
.scene .station { z-index: 1; min-height: 44px; min-width: 48px; font-size: .78rem; box-shadow: 2px 2px #10241c; border-radius: 0; letter-spacing: .02em; }
.plant-map .station { top: max(44px,var(--tip)); transform: translate(-50%,-100%); }
.scene .station[aria-pressed="true"] { color: var(--deck); background: var(--phosphor); }
.scene .station:hover { border-color: white; }
.relay-console { grid-row: 2; min-width: 0; display: grid; grid-template-columns: minmax(0,1fr) minmax(15rem,32%); align-items: center; gap: 1rem; padding: clamp(.65rem,1.5vw,1.6rem) clamp(1rem,3.2vw,3.5rem); border-top: 1px solid var(--rail); background: #142a21; color: #eef5e6; }
.relay-console .transcript { padding: 0; }
.relay-console .preview-top { display: block; color: var(--caption); }
.relay-console .preview-top span { color: #739370; margin-inline: .35rem; }
.relay-console .thread-body { padding-top: .45rem; }
.relay-console .thread-body p { font-size: clamp(1rem,2vw,1.7rem); line-height: 1.18; letter-spacing: -.025em; }
.relay-console .demo-controls { border: 1px solid #6c846f; border-radius: .35rem; }
.relay-console .demo-controls button { border-radius: .25rem; }
.invite { width: 100%; min-height: 44px; padding-block: .25rem; border: 0; background: transparent; color: var(--caption); font: .77rem ui-monospace,monospace; }
.invite:hover { background: #233e2e; color: var(--phosphor); }
@media (max-width: 680px) and (min-height: 451px) {
  .hero:not(.compact) { grid-template-rows: auto minmax(5.6rem,1fr) auto; }
  .hero:not(.compact) .hero-copy { grid-row: 1; width: auto; padding: clamp(.75rem,2svh,1.5rem) 1rem; }
  .hero:not(.compact) .eyebrow { margin-bottom: .4rem; }
  .hero:not(.compact) .intro { font-size: .97rem; line-height: 1.35; margin-block: .6rem; }
  .hero:not(.compact) .form-hint:not(dialog *) { margin-top: .25rem; }
  .hero:not(.compact) .scene { grid-area: 2 / 1; }
  .terrain { width: 100%; }
  .terrain::after { display: none; }
  .relay-console { grid-row: 3; grid-template-columns: minmax(0,1fr); gap: .45rem; padding: .65rem .9rem .1rem; }
  .relay-console .thread-body { padding-top: .1rem; }
  .relay-console .thread-body p { font-size: 1rem; margin: 0; }
}
@media (max-width: 450px) {
  body:has(.hero:not(.compact,[hidden])) .top { gap: .4rem; }
  body:has(.hero:not(.compact,[hidden])) .top nav { gap: .55rem; }
  body:has(.hero:not(.compact,[hidden])) .nav-login { min-width: 0; padding-inline: .75rem; }
  body:has(.hero:not(.compact,[hidden])) .brand { gap: .32rem; font-size: .88rem; }
}
@media (max-height: 540px) and (min-width: 520px) {
  body:has(.hero:not(.compact,[hidden])) { --head: 2.85rem; --edge: .5rem; }
  .hero:not(.compact) .hero-copy { width: 49%; padding: .65rem 1rem; }
  .hero:not(.compact) .eyebrow { margin-bottom: .35rem; }
  .hero:not(.compact) .intro { font-size: .91rem; line-height: 1.25; margin-block: .4rem; }
  .hero:not(.compact) .form-hint:not(dialog *) { margin-top: .15rem; }
  .terrain { width: 63%; }
  .relay-console { padding: .3rem 1rem; }
  .relay-console .thread-body { padding-top: 0; }
}
@media (max-width: 370px) {
  .launch-actions { gap: .35rem; }
  .launch-actions button { font-size: .83rem; padding-inline: .65rem; }
}
@media (max-width: 680px) and (max-height: 650px) and (min-height: 451px) {
  .hero:not(.compact) .eyebrow { display: none; }
  .hero:not(.compact) .hero-copy { padding-block: .6rem; }
  .hero:not(.compact) .form-hint:not(dialog *) { margin-bottom: 0; }
  .scene .scene-tag { top: auto; bottom: .25rem; right: .25rem; padding: .12rem .28rem; pointer-events: none; }
  .relay-console .thread-body small { display: block; }
}
/* Reserve the controls before the landscape on unusually short viewports. */
@media (max-height: 570px) {
  .hero:not(.compact) .intro { margin-block: .3rem; }
  .hero:not(.compact) #agent-start { display: none; }
}
@media (min-width: 681px) and (max-height: 760px) {
  .hero:not(.compact) .hero-copy { padding: clamp(.75rem,2vh,1.4rem) clamp(1rem,2vw,2rem); }
  .hero:not(.compact) .intro { margin-block: .55rem; }
  .relay-console { padding-block: .5rem; }
}
