:root {
  color-scheme: dark; font-family: "VT323", monospace; background: #0b1722; color: #f4f9fa;
  /* Signed-in surfaces are slightly see-through so the pixel sky shows behind them. */
  --glass: rgba(16, 40, 56, .72); --glass-inner: rgba(11, 34, 49, .6); --glass-card: rgba(16, 43, 57, .62);
}
* { box-sizing: border-box; }
body { min-height: 100vh; margin: 0; display: grid; place-items: center; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid #fff; outline-offset: 4px; }
[hidden] { display: none !important; }
.shell { position: relative; z-index: 1; width: min(100% - 2rem, 560px); padding: 2.5rem 0; }
.shell.setup-active { width: min(100% - 2rem, 1040px); }
.brand { display: inline-block; margin-bottom: 2rem; color: #a9eaf7; font-size: 3.5rem; line-height: 1; text-decoration: none; }
.brand span { color: #f4f9fa; }
.panel { border: 3px solid #69bed0; box-shadow: 8px 8px 0 #071018; background: #102838; padding: clamp(1.5rem, 5vw, 2.5rem); }
.panel-top { display: flex; justify-content: space-between; gap: 1rem; padding-bottom: 1rem; border-bottom: 2px solid #31546a; color: #a9eaf7; font-size: 1.2rem; letter-spacing: .08em; }
.eyebrow { color: #a9eaf7; text-transform: uppercase; letter-spacing: .12em; font-size: 1.3rem; margin: 2rem 0 .4rem; }
h1 { font-size: clamp(2.8rem, 7vw, 4.25rem); line-height: .95; margin: 0; font-weight: 400; }
.intro { color: #c6dce2; font-size: 1.5rem; line-height: 1.1; margin: 1.1rem 0 1.6rem; }
.mode-switch { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-bottom: 2rem; }
.mode-switch button { border: 2px solid #4a8092; padding: .45rem; color: #c6dce2; background: transparent; font-size: 1.35rem; }
.mode-switch button.selected { color: #0b1722; background: #a9eaf7; border-color: #a9eaf7; }
label { display: block; margin-bottom: .45rem; font-size: 1.5rem; }
input { width: 100%; border: 2px solid #69bed0; border-radius: 0; background: #071b29; color: #fff; font-size: 1.85rem; padding: .65rem .8rem; }
input::placeholder { color: #7b9daa; }
.hint { color: #bfd5dc; font-size: 1.2rem; margin: .55rem 0 1.6rem; }
.hint a { color: #a9eaf7; }
.chosen { display: flex; align-items: baseline; gap: .7rem; border-bottom: 2px solid #31546a; padding-bottom: .7rem; margin-bottom: 1.5rem; font-size: 1.3rem; }
.chosen span { color: #bfd5dc; }
.chosen strong { color: #a9eaf7; font-weight: 400; font-size: 1.6rem; overflow-wrap: anywhere; }
.chosen button { margin-left: auto; color: #a9eaf7; background: none; border: 0; text-decoration: underline; font-size: 1.2rem; }
#confirm-wrap { margin-top: 1.5rem; }
.error { color: #ffb9af; border-left: 3px solid #ffb9af; padding-left: .7rem; font-size: 1.3rem; margin: .4rem 0 1rem; }
.actions { display: flex; justify-content: flex-end; gap: .75rem; margin-top: 1.8rem; }
.primary, .secondary { border: 2px solid #a9eaf7; padding: .6rem 1.1rem; font-size: 1.45rem; }
.primary { background: #a9eaf7; color: #0b1722; }
.primary:hover { background: #d1f7ff; }
.secondary { background: transparent; color: #a9eaf7; }
.secondary:hover { background: #18394a; }
@media (max-width: 420px) { .panel { padding: 1.25rem; } .mode-switch button { font-size: 1.2rem; } }

.setup-screen { border: 3px solid #69bed0; background: var(--glass); box-shadow: 10px 10px 0 #071018; padding: clamp(1.25rem, 4vw, 2.5rem); }
.setup-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; border-bottom: 2px solid #31546a; padding-bottom: .75rem; color: #a9eaf7; letter-spacing: .08em; font-size: 1.2rem; }
.setup-account { display: flex; align-items: center; gap: 1rem; color: #c6dce2; letter-spacing: 0; }
.setup-sign-out { color: #a9eaf7; border: 0; background: transparent; text-decoration: underline; font-size: 1.2rem; }
.setup-sign-out:hover { color: #fff; }
.agent-guide { display: grid; justify-items: center; margin: 1rem auto 1.4rem; }
.agent-stage { width: 178px; height: 155px; position: relative; display: grid; place-items: center; isolation: isolate; }
.agent-halo { position: absolute; inset: 8px 14px 0; z-index: -1; background: #1a4050; clip-path: polygon(22% 0, 78% 0, 78% 5%, 88% 5%, 88% 12%, 94% 12%, 94% 22%, 100% 22%, 100% 78%, 94% 78%, 94% 88%, 88% 88%, 88% 95%, 78% 95%, 78% 100%, 22% 100%, 22% 95%, 12% 95%, 12% 88%, 6% 88%, 6% 78%, 0 78%, 0 22%, 6% 22%, 6% 12%, 12% 12%, 12% 5%, 22% 5%); }
.agent-mascot { width: 140px; height: 140px; image-rendering: pixelated; filter: drop-shadow(5px 6px 0 #071724); animation: agent-bob 3s steps(3, end) infinite; }
.agent-guide p { margin: .25rem 0 0; color: #a9eaf7; font-size: 1.2rem; letter-spacing: .12em; }
.setup-eyebrow { color: #a9eaf7; font-size: 1.25rem; letter-spacing: .12em; margin: 0 0 .55rem; text-align: center; }
.setup-title { font-size: clamp(2.5rem, 5vw, 4.35rem); line-height: .92; font-weight: 400; text-align: center; max-width: 850px; margin: 0 auto; text-wrap: balance; }
.setup-title:focus { outline: none; }
.setup-intro { color: #c6dce2; font-size: 1.5rem; line-height: 1.1; text-align: center; margin: .9rem auto 1.6rem; }
.sensor-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.sensor-card { display: grid; grid-template-columns: 60px 1fr; grid-template-rows: auto auto; align-items: center; column-gap: .85rem; min-height: 112px; text-align: left; border: 2px solid #47778a; background: var(--glass-inner); color: #f4f9fa; padding: .85rem; box-shadow: 5px 5px 0 #071724; transition: transform .12s steps(2, end), box-shadow .12s steps(2, end), border-color .12s; }
.sensor-card:hover, .sensor-card:focus-visible { transform: translate(-3px, -3px); box-shadow: 8px 8px 0 #071724; border-color: var(--sensor-color); }
.sensor-card[aria-pressed="true"] { border-color: var(--sensor-color); background: rgba(23, 55, 71, .82); box-shadow: 5px 5px 0 var(--sensor-color); }
.sensor-card[aria-pressed="true"]::after { content: "✓ SELECTED"; grid-column: 2; color: var(--sensor-color); font-size: 1.05rem; letter-spacing: .04em; }
.sensor-icon { grid-row: 1 / 3; width: 58px; height: 58px; display: grid; place-items: center; border: 2px solid var(--sensor-color); background: #102b39; color: var(--sensor-color); box-shadow: 3px 3px 0 #071724; }
.sensor-icon svg { width: 36px; height: 36px; fill: currentColor; }
.sensor-icon .icon-cutout { fill: #102b39; }
.sensor-name { color: var(--sensor-color); font-size: 1.85rem; line-height: .9; align-self: end; }
.sensor-detail { color: #bdd5dc; font-size: 1.12rem; line-height: 1; align-self: start; margin-top: .3rem; }
.setup-error { margin: 1.4rem auto 0; padding: .4rem .7rem; max-width: 600px; border-left: 3px solid #ffb9af; color: #ffb9af; font-size: 1.35rem; text-align: center; }
.setup-retry { display: block; margin: 1rem auto 0; }
.selection-status { color: #a9eaf7; font-size: 1.5rem; line-height: 1.1; text-align: center; margin: 1.8rem auto .4rem; }
.setup-start { display: block; margin: .8rem auto 1rem; }
.selection-note { color: #bdd5dc; font-size: 1.15rem; text-align: center; margin: 0; }
@keyframes agent-bob { 50% { transform: translateY(-6px); } }
.kind-badge { --badge-bg: #102b39; width: 40px; height: 40px; flex: none; display: grid; place-items: center; border: 2px solid var(--sensor-color); background: var(--badge-bg); color: var(--sensor-color); box-shadow: 3px 3px 0 #071724; }
.kind-badge svg { width: 24px; height: 24px; fill: currentColor; }
.kind-badge .icon-cutout { fill: var(--badge-bg); }
@media (max-width: 760px) {
  .sensor-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
  .sensor-card { grid-template-columns: 44px 1fr; min-height: 92px; padding: .7rem; column-gap: .65rem; }
  .sensor-icon { width: 43px; height: 43px; }
  .sensor-icon svg { width: 29px; height: 29px; }
  .sensor-name { font-size: 1.55rem; }
  .sensor-detail { font-size: 1rem; }
}
@media (max-width: 470px) {
  .setup-screen { padding: 1rem; }
  .setup-bar { align-items: flex-start; flex-direction: column; font-size: 1.1rem; }
  .setup-account { width: 100%; justify-content: space-between; gap: .45rem; }
  .setup-sign-out { font-size: 1rem; }
  .agent-stage { width: 145px; height: 125px; }
  .agent-mascot { width: 115px; height: 115px; }
  .sensor-card { display: flex; flex-direction: column; align-items: flex-start; min-height: 116px; gap: .22rem; }
  .sensor-card[aria-pressed="true"]::after { font-size: .9rem; }
  .sensor-icon { margin-bottom: .2rem; }
  .sensor-name, .sensor-detail { align-self: auto; }
  .sensor-name { font-size: 1.5rem; }
  .sensor-card[data-kind="custom"] { grid-column: 1 / -1; display: grid; grid-template-columns: 43px 1fr; grid-template-rows: auto auto; min-height: 76px; }
}
@media (prefers-reduced-motion: reduce) {
  .agent-mascot { animation: none; }
  .sensor-card { transition: none; }
}
