* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: #05080f; color: #eaf2ff; font: 16px/1.45 "Segoe UI", Arial, sans-serif; }
.sim { max-width: 520px; margin: 0 auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
header { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
h1 { margin: 0; font-size: 22px; color: #7fd4ff; }
header p { margin: 0; color: #9fb3c8; font-size: 14px; }
#clock { margin-left: auto; font-variant-numeric: tabular-nums; color: #ffd479; }
.stage { position: relative; width: 100%; max-width: 440px; margin: 0 auto; aspect-ratio: 1 / 1; background: #0b1220; border: 1px solid #1e3a5c; border-radius: 12px; overflow: hidden; }
#face { width: 100%; height: 100%; object-fit: cover; display: block; }
#status { position: absolute; left: 8px; right: 8px; bottom: 8px; margin: 0; padding: 10px 12px; border-radius: 8px; background: rgba(3, 8, 18, .88); border: 1px solid #2b5a8a; text-align: center; font-size: 16px; }
/* Subspace call: the starfield, the viewscreen opening and closing, and the frame around the picture */
#space { position: absolute; inset: 0; width: 100%; height: 100%; display: block; transition: opacity .5s; }
#face { position: relative; opacity: 0; }
#glitch { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.stage[data-state="open"] #space { opacity: 0; }
.stage[data-state="open"] #face { opacity: 1; animation: viewscreen-open .8s cubic-bezier(.2, .8, .2, 1) backwards; }
.stage[data-state="closing"] #face { animation: viewscreen-close .9s cubic-bezier(.6, 0, .8, .4) both; }
@keyframes viewscreen-open {
    0% { opacity: 1; transform: scale(0, .004); filter: brightness(6); }
    35% { transform: scale(1, .006); filter: brightness(5); }
    100% { opacity: 1; transform: scale(1, 1); filter: brightness(1); }
}
@keyframes viewscreen-close {
    0% { opacity: 1; transform: scale(1, 1); filter: brightness(1); }
    55% { opacity: 1; transform: scale(1, .006); filter: brightness(5); }
    100% { opacity: 0; transform: scale(0, .004); filter: brightness(6); }
}
.hud { position: absolute; inset: 0; pointer-events: none; }
.corner { position: absolute; width: 34px; height: 34px; border: 0 solid #ff9900; }
.corner.tl { left: 6px; top: 6px; border-width: 5px 0 0 5px; border-top-left-radius: 18px; }
.corner.tr { right: 6px; top: 6px; border-width: 5px 5px 0 0; border-top-right-radius: 18px; border-color: #cc99cc; }
.corner.bl { left: 6px; bottom: 6px; border-width: 0 0 5px 5px; border-bottom-left-radius: 18px; border-color: #99ccff; }
.corner.br { right: 6px; bottom: 6px; border-width: 0 5px 5px 0; border-bottom-right-radius: 18px; border-color: #ffcc99; }
.tag { position: absolute; top: 14px; left: 48px; font: 700 11px/1.2 "Segoe UI", Arial, sans-serif; letter-spacing: .18em; color: #ffcc99; text-shadow: 0 0 6px #000, 0 0 2px #000; }
.tag.state { left: auto; right: 48px; display: flex; align-items: center; gap: 7px; }
.tag.state em { font-style: normal; }
.tag.state b { width: 9px; height: 9px; border-radius: 50%; background: #99ccff; box-shadow: 0 0 8px currentColor; animation: link-blink 2.4s ease-in-out infinite; }
.stage[data-state="hailing"] .tag.state b { background: #ff9900; animation-duration: .5s; }
.stage[data-state="open"] .tag.state b { background: #35c46f; }
.stage[data-state="closing"] .tag.state b { background: #ff5a4d; animation-duration: .35s; }
@keyframes link-blink { 50% { opacity: .15; } }
#wave { position: absolute; left: 48px; right: 48px; bottom: 6px; width: calc(100% - 96px); height: 46px; opacity: 0; transition: opacity .4s; }
.stage[data-state="open"] #wave { opacity: .9; }
.sweep { position: absolute; left: 0; right: 0; top: 0; height: 18%; background: linear-gradient(transparent, rgba(153, 204, 255, .10), transparent); opacity: 0; }
.stage[data-state="open"] .sweep { opacity: 1; animation: link-sweep 6s linear infinite; }
@keyframes link-sweep { from { transform: translateY(-100%); } to { transform: translateY(660%); } }
#banner { position: absolute; left: 8px; right: 8px; top: 70%; margin: 0; text-align: center; font: 700 17px/1.3 "Segoe UI", Arial, sans-serif; letter-spacing: .22em; color: #ff9900; text-shadow: 0 0 10px #000, 0 0 3px #000; }
#banner:empty { display: none; }
.stage[data-state="closing"] #status { visibility: hidden; }
.stage.glitching .tag.state { color: #ff9900; }
.stage.glitching .tag.state b { background: #ff9900; }
.stage[data-state="hailing"] #banner { animation: link-blink 1.5s ease-in-out infinite; }
#note { margin: 0; text-align: center; font-size: 15px; color: #ffd479; }
#note:empty { display: none; }
.bar { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
button { min-height: 46px; padding: 10px 18px; border: 0; border-radius: 8px; background: #1f7ae0; color: #fff; font-family: inherit; font-size: 16px; font-weight: 600; cursor: pointer; }
button.alt { background: #23344d; }
button.stop { background: #b3372f; }
button:disabled { opacity: .5; cursor: default; }

/* Inside the main site's COMMS window: fill the frame and let the video take the spare height */
body.embed { background: #05080f; }
.embed .sim { max-width: none; height: 100vh; height: 100dvh; padding: 6px 8px; gap: 8px; }
.embed h1 { font-size: 18px; }
.embed .stage { flex: 1 1 auto; min-height: 160px; max-width: none; aspect-ratio: auto; background: #02060d; }
.embed #face { position: absolute; inset: 0; object-fit: contain; }
.embed #status { max-width: 36em; margin: 0 auto; }
.embed button { min-height: 40px; padding: 8px 16px; }
@media (max-width: 520px) { .embed button { min-height: 44px; } .embed header p { display: none; } }
