:root {
  font-family: Inter, "Segoe UI", sans-serif;
  color: #19232f;
  background: #f5f8fc;
  letter-spacing: 0;
  --blue: #095bd9;
  --muted: #718093;
  --line: #dde5ef;
  --green: #087e53;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; min-width: 320px; }
body { overflow: hidden; }
[hidden] { display: none !important; }
.sr-only { position: absolute!important; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
a { color: var(--blue); text-decoration: none; }
button, a { -webkit-tap-highlight-color: transparent; }
button, .primary-link, .back-link {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-height: 42px; border: 1px solid transparent; border-radius: 6px;
  padding: 0 15px; font: inherit; font-size: 13px; font-weight: 650; cursor: pointer;
}
button svg, a svg { width: 17px; height: 17px; flex: none; }
button:disabled { opacity: .38; cursor: default; }
button.primary, .primary-link { color: white; background: var(--blue); border-color: var(--blue); box-shadow: 0 5px 15px #095bd922; }
button.primary:hover:not(:disabled), .primary-link:hover { background: #064ebb; }
button.secondary { color: #37506d; background: white; border-color: var(--line); }
.icon { width: 40px; min-height: 40px; padding: 0; background: transparent; color: #5b6e83; }
.icon:hover, .back-link:hover { background: #edf3fb; }
.text-button { background: transparent; color: var(--blue); padding-inline: 0; }
.result-details-link { color: #718093; min-height: 32px; padding: 4px 0; font-size: 12px; font-weight: 400; text-decoration: underline; text-underline-offset: 3px; }
.result-details-link:hover { color: var(--blue); }
:focus-visible { outline: 3px solid #2cc7e7; outline-offset: 3px; }
.site-header { display: flex; height: 64px; align-items: center; justify-content: space-between; padding: 0 30px; background: #fff; border-bottom: 1px solid var(--line); }
.brand-lockup { display: flex; align-items: center; gap: 24px; min-width: 0; }
.brand-lockup > a { flex: none; }
.denk-brand { display: block; object-fit: contain; }
.site-header nav { display: flex; align-items: center; gap: 5px; }
.header-download { flex: none; white-space: nowrap; margin-right: 8px; }
.download-label-short { display: none; }
.back-link { margin-left: 10px; border-left: 1px solid var(--line); border-radius: 0; }
.connection-stage { position: relative; display: grid; grid-template-rows: minmax(0, 1fr); height: calc(100svh - 64px); padding: 18px 30px 24px; max-width: 1720px; margin: auto; }
.hero-identity { display: grid; grid-template-columns: auto; justify-items: start; gap: 3px; }
.hero-identity > span { font-size: 9px; color: #6c7d92; font-weight: 800; }
.hero-identity img { display: block; width: 226px; height: 32px; object-fit: contain; mix-blend-mode: multiply; }
.experience { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(340px, .85fr); min-height: 0; box-shadow: 0 16px 48px #22355a12; }
.figure-stage {
  position: relative; display: grid; place-items: center; min-height: 0; overflow: hidden;
  background: #14171c; color: #dbe8f1; isolation: isolate; container-type: size;
}
.stage-caption { position: absolute; left: 30px; top: 26px; display: flex; align-items: center; gap: 12px; font-size: 10px; color: #9bacba; font-weight: 650; z-index: 1; }
.caption-line { width: 30px; height: 1px; background: #21cadb; }
.stage-signature { position: absolute; bottom: 26px; left: 30px; color: #7d8b98; font-size: 10px; font-weight: 700; }
.stage-baseline { position: absolute; bottom: 26px; right: 30px; width: 54px; height: 1px; background: #777a90; }
.figure-depth {
  width: min(91cqw, 160cqh); aspect-ratio: 16 / 9; min-width: 0;
  transform: translateY(var(--presence-y, 26px)) scale(var(--presence-scale, .36));
  filter: blur(var(--presence-blur, 28px));
  opacity: var(--presence-opacity, .2);
  will-change: transform, filter;
}
.figure-gaze, .figure-blink { width: 100%; height: 100%; min-width: 0; min-height: 0; }
.figure-gaze { transform-origin: center; }
.figure-blink { position: relative; }
.kaos-presence, .kaos-wink {
  display: block; width: 100%; height: 100%; object-fit: contain; user-select: none;
  filter: drop-shadow(-7px 8px 14px #0ab9d526) drop-shadow(8px -4px 16px #9557e126);
}
.kaos-wink { position: absolute; inset: 0; pointer-events: none; }
.operation-monitor { display: flex; flex-direction: column; min-height: 0; padding: 30px 34px 24px; background: #fff; overflow: auto; }
.monitor-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 10px; font-weight: 750; color: #76869a; }
.activity-mode { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: #788595; font-weight: 650; }
.activity-mode::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.progress-reading { display: flex; align-items: center; gap: 18px; margin: 24px 0 15px; }
.progress-reading strong { min-width: 5.6ch; font-size: 54px; line-height: 1; font-weight: 550; font-variant-numeric: tabular-nums; }
.progress-reading > span { color: #8692a1; font-size: 11px; line-height: 1.6; }
.progress-track { height: 3px; background: #e8eef4; flex: none; overflow: hidden; }
.progress-track > span { display: block; height: 100%; width: var(--progress,0%); background: linear-gradient(90deg,#1266e9,#16c4d8 65%,#8e40ef); }
.operation-monitor:is([data-state="failed"], [data-state="uncertain"], [data-state="cancelled"]) :is(.progress-reading, .progress-track) { display: none; }
.current-activity { margin-top: 25px; }
h1 { margin: 0; font-size: 24px; line-height: 1.3; font-weight: 600; }
#operation-current { margin: 11px 0 0; color: #53667c; font-size: 14px; line-height: 1.45; }
#activity-detail { margin: 9px 0 0; color: #8290a0; font-size: 12px; line-height: 1.55; }
#steps { margin: 17px 0 10px; padding: 0; list-style: none; min-height: 0; overflow: auto; font-size: 11px; line-height: 1.5; }
#steps:empty { display: none; }
#steps li { display: flex; gap: 9px; padding: 6px 0; color: #7c8898; }
#steps li::before { content: ""; flex: none; width: 6px; height: 6px; margin-top: 5px; border: 1px solid #a7b3c2; border-radius: 50%; }
#steps li[data-state="succeeded"] { color: #44665b; }
#steps li[data-state="succeeded"]::before { background: #269777; border-color: #269777; }
#steps li[data-state="leased"], #steps li[data-state="running"] { color: var(--green); }
#steps li[data-state="failed"], #steps li[data-state="uncertain"] { color: #af4c4b; }
#operation-monitor[data-state="working"] .activity-mode,
#operation-monitor[data-state="working"] #operation-current { color: var(--green); animation: working-text 1500ms ease-in-out infinite; }
#operation-monitor[data-state="succeeded"] .activity-mode { color: var(--green); }
#operation-monitor[data-state="failed"] .activity-mode,
#operation-monitor[data-state="uncertain"] .activity-mode { color: #b74c43; }
@keyframes working-text { 50% { opacity: .48; } }
.action-area { margin-top: auto; padding-top: 14px; flex: none; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.device-alert { margin: 0 0 10px; font-size: 12px; color: #7c7055; }
.device-alert:empty { display: none; }
#notice { margin: 10px 0 0; font-size: 11px; line-height: 1.4; color: #7d8997; overflow-wrap: anywhere; }
#notice:empty { display: none; }
#notice[data-error] { color: #b64c46; }
.approval-panel { position: absolute; right: 30px; bottom: 24px; top: 18px; width: calc((100% - 60px) * .85 / 2.2); z-index: 5; background: #fffffff5; display: grid; place-items: center; backdrop-filter: blur(16px); }
.approval-inner { padding: 30px; }
.approval-icon { width: 32px; height: 32px; color: var(--blue); margin-bottom: 20px; }
.eyebrow { color: var(--blue); font-size: 10px; font-weight: 700; }
.approval-inner h2 { margin: 10px 0 18px; font-size: 24px; line-height: 1.35; font-weight: 600; }
#device-link-info, #device-link-status { font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
#device-link-status { color: #b64c46; }
.approval-inner .toolbar { margin-top: 24px; }
#connection-details { width: min(700px, calc(100% - 32px)); max-height: calc(100svh - 48px); padding: 0; border: 1px solid #d2dde9; border-radius: 8px; color: #233447; background: #fcfdff; box-shadow: 0 25px 90px #0a16383d; }
#connection-details::backdrop { background: #14233477; backdrop-filter: blur(8px); }
.details-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 22px; border-bottom: 1px solid var(--line); }
.details-header h2 { font-size: 18px; margin: 0; }
.details-body { padding: 22px; overflow-wrap: anywhere; }
.details-body h3 { margin: 0 0 14px; font-size: 14px; font-weight: 650; }
.device-details { padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.device-details dl { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 0 0 18px; }
dt { color: #8894a3; font-size: 11px; }
dd { margin: 4px 0 0; font-size: 13px; }
.results-panel { padding-top: 22px; }
.results-dashboard-link { display: inline-flex; align-items: center; gap: 8px; min-height: 42px; margin-top: 10px; font-size: 13px; font-weight: 600; }
.results-dashboard-link:hover { text-decoration: underline; }
.results-heading { display: flex; justify-content: space-between; gap: 16px; }
#operation-state, #provenance { font-size: 11px; color: #76869a; }
.table-wrap { max-height: 230px; overflow: auto; border-block: 1px solid var(--line); }
table { border-collapse: collapse; width: 100%; text-align: left; }
th, td { padding: 10px 0; border-bottom: 1px solid #e8edf3; font-size: 12px; }
th { font-size: 10px; color: #7a8796; }
#evidence { margin-top: 15px; font-size: 11px; }
summary { cursor: pointer; }
pre { max-height: 260px; overflow: auto; padding: 12px; font-size: 10px; white-space: pre-wrap; word-break: break-word; background: #eff4fa; }
.health-strip { display: grid; grid-template-columns: repeat(3,1fr); gap: 15px; margin: 24px 0 0; border-top: 1px solid var(--line); padding-top: 16px; }
.health-strip dd { font-size: 11px; }
@media (max-height: 750px) and (min-width: 761px) {
  .connection-stage { padding-block: 16px; }
  .operation-monitor { padding: 22px 26px 18px; }
  .progress-reading { margin: 18px 0 12px; }
  .progress-reading strong { font-size: 46px; }
  .current-activity { margin-top: 18px; }
  h1 { font-size: 22px; }
  #activity-detail { margin-top: 6px; }
  #steps { margin: 10px 0 6px; }
  #steps li { padding: 4px 0; }
  .approval-panel { top: 16px; bottom: 16px; }
}
@media (max-width: 1100px) {
  .header-download .download-label { display: none; }
  .header-download .download-label-short { display: inline; }
  .back-link { width: 40px; padding: 0; margin-left: 0; }
  .back-link span { display: none; }
}
@media (max-width: 760px) {
  .site-header { height: 54px; padding: 0 16px; }
  .site-header { gap: 10px; }
  .brand-lockup { gap: 12px; }
  .denk-brand { width: 80px; height: 20px; }
  .site-header nav { flex: none; gap: 2px; }
  .site-header .icon { width: 30px; min-height: 38px; }
  .back-link { width: 30px; padding: 0; margin-left: 0; }
  .back-link span { display: none; }
  .connection-stage { height: calc(100svh - 54px); padding: 12px; }
  .hero-identity img { width: 132px; height: 19px; }
  .hero-identity { gap: 2px; }
  .hero-identity > span { font-size: 8px; }
  .experience { grid-template-columns: 1fr; grid-template-rows: minmax(110px,.75fr) minmax(0,1.25fr); }
  .figure-depth { width: min(85cqw, 160cqh); height: auto; }
  .stage-caption { top: 16px; left: 18px; font-size: 8px; }
  .stage-signature { bottom: 14px; left: 18px; font-size: 8px; }
  .stage-baseline { bottom: 14px; right: 18px; width: 26px; }
  .operation-monitor { padding: 17px 21px; }
  .progress-reading { margin: 12px 0 10px; gap: 12px; }
  .progress-reading strong { font-size: 35px; }
  .progress-reading > span { font-size: 9px; }
  .current-activity { margin-top: 12px; }
  h1 { font-size: 20px; }
  #operation-current { font-size: 12px; margin-top: 7px; }
  #activity-detail { font-size: 11px; margin-top: 5px; }
  #steps { font-size: 10px; margin: 8px 0 0; }
  #steps li { padding: 3px 0; }
  .action-area { padding-top: 10px; }
  .toolbar { gap: 8px; }
  button, .primary-link { min-height: 38px; font-size: 12px; }
  #notice { font-size: 10px; margin-top: 7px; }
  .approval-panel { inset: 12px; width: auto; }
}
@media (max-width: 480px) {
  .site-header { height: 98px; flex-wrap: wrap; padding-block: 8px; gap: 4px; }
  .site-header nav { width: 100%; justify-content: flex-end; }
  .header-download { margin-right: auto; }
  .connection-stage { height: calc(100svh - 98px); }
}
@media (max-width: 360px) {
  .site-header { padding-inline: 12px; gap: 8px; }
  .brand-lockup { gap: 8px; }
  .denk-brand { width: 64px; height: 16px; }
  .hero-identity img { width: 108px; height: 16px; }
}
@media (max-width: 760px) and (max-height: 680px) {
  .experience { grid-template-rows: minmax(90px, .45fr) minmax(0, 1.55fr); }
  .operation-monitor { padding: 14px 18px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}


.device-choices { display: flex; flex-direction: column; gap: 8px; margin: 0 0 12px; max-height: 160px; overflow-y: auto; }
.device-choices[hidden] { display: none; }
.device-choice { justify-content: flex-start; text-align: left; flex-shrink: 0; white-space: normal; overflow-wrap: anywhere; }
/* Device approval occupies its own page region; errors and login remain visible. */
.connection-stage:has(#device-link:not([hidden])) { display: block; height: auto; min-height: calc(100svh - 64px); overflow: auto; padding: 36px 20px; }
.connection-stage:has(#device-link:not([hidden])) .experience { display: none; }
.connection-stage .approval-panel { position: static; inset: auto; width: min(100%, 560px); margin: 0 auto; border: 1px solid #dce5ee; border-radius: 24px; background: #fff; box-shadow: 0 18px 60px #143b6212; backdrop-filter: none; }
.approval-inner { width: 100%; box-sizing: border-box; padding: clamp(24px, 5vw, 42px); }
.connection-checklist { list-style: none; padding: 0; margin: 24px 0; display: grid; gap: 10px; font-size: 13px; line-height: 1.5; }
.connection-checklist li { padding: 12px 14px; background: #f3f6fa; border-radius: 10px; }
.connection-checklist [data-state="ready"] { background: #e9f5ed; color: #246440; }
.connection-login { display: grid; gap: 10px; margin: 24px 0; }
.connection-login label { font-size: 13px; }
.connection-login input { width: 100%; box-sizing: border-box; min-height: 44px; padding: 10px 12px; border: 1px solid #b9c8d8; border-radius: 8px; font: inherit; }
.connection-login input:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
#device-link-status { color: #455569; min-height: 24px; }
#device-link-status[data-error] { color: #a12e28; }
body:has(#device-link:not([hidden])) { overflow: auto; }
