:root {
  --bg: #fff;
  --fg: #1a1a1a;
  --muted: #6a6a6a;
  --line: rgba(0, 0, 0, 0.12);
  --machine-blue: #1a1a1a;
  --machine-blue-dark: #000;
  --machine-blue-soft: #f5f5f5;
  --navbar-height: 80px;
  --navbar-logo-pad: 10px;
  --toolbar-height: 64px;
  color-scheme: only light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  color-scheme: light;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body {
  overflow: hidden;
}

.stage {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 100vh;
  min-height: 100dvh;
}

.navbar {
  position: relative;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: var(--navbar-height);
  padding: 0 40px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.navbar__left {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.navbar__overview {
  display: inline-flex;
  align-items: center;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #fff;
  color: var(--machine-blue);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
}

.navbar__overview:hover,
.navbar__overview:focus-visible {
  border-color: var(--machine-blue);
  color: var(--machine-blue-dark);
}

.navbar__overview:focus-visible {
  outline: 2px solid var(--machine-blue);
  outline-offset: 3px;
}

.navbar__overview[hidden] {
  display: none;
}

.navbar__kicker,
.navbar__hint {
  margin: 0;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.navbar__kicker {
  color: var(--machine-blue);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.navbar__logo {
  position: absolute;
  left: 50%;
  top: 0;
  height: var(--navbar-height);
  display: flex;
  align-items: center;
  color: var(--fg);
  text-decoration: none;
  transform: translateX(-50%);
}

.navbar__logo-svg {
  display: block;
  height: calc(var(--navbar-height) - 2 * var(--navbar-logo-pad));
  width: auto;
  max-width: min(320px, 42vw);
}

.navbar__logo:hover,
.navbar__logo:focus-visible {
  color: #000;
}

.navbar__logo:focus-visible {
  outline: 2px solid var(--machine-blue);
  outline-offset: 4px;
}

.navbar__hint {
  margin-left: auto;
  color: var(--machine-blue);
  font-size: 12px;
  font-weight: 600;
  text-align: right;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: var(--toolbar-height);
  padding: 10px 40px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  flex-shrink: 0;
}

.toolbar__meta,
.toolbar__actions {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.toolbar__field {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toolbar__field[hidden] {
  display: none;
}

.toolbar__label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.toolbar__select {
  appearance: none;
  min-width: 180px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--machine-blue-soft);
  color: var(--fg);
  font: inherit;
  font-size: 13px;
}

.toolbar__select:focus-visible {
  outline: 2px solid var(--machine-blue);
  outline-offset: 2px;
}

.toolbar__file {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toolbar__btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #fff;
  color: var(--machine-blue);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
}

.toolbar__btn:hover,
.toolbar__btn:focus-visible {
  border-color: var(--machine-blue);
}

.toolbar__btn:focus-visible {
  outline: 2px solid var(--machine-blue);
  outline-offset: 3px;
}

.toolbar__btn[aria-pressed="true"] {
  background: var(--machine-blue);
  border-color: var(--machine-blue);
  color: #fff;
}

.viewport {
  position: relative;
  flex: 1;
  min-height: 0;
  background:
    radial-gradient(900px 420px at 50% 0%, rgba(0, 0, 0, 0.04), transparent 70%),
    #fff;
}

.viewport__canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.viewport__canvas.is-hotspot-hover {
  cursor: pointer;
}

.hotspot-status {
  position: absolute;
  left: 28px;
  bottom: 28px;
  z-index: 5;
  margin: 0;
  padding: 8px 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  color: var(--machine-blue);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  pointer-events: none;
}

.hotspot-status[hidden] {
  display: none;
}

.hotspot-status[data-state="error"] {
  border-color: #d14343;
  color: #b42318;
}

.hotspot-panel {
  position: absolute;
  right: 28px;
  bottom: 28px;
  z-index: 6;
  box-sizing: border-box;
  overflow: auto;
}

.hotspot-panel[hidden] {
  display: none;
}

.hotspot-panel--simple {
  width: min(360px, calc(100% - 40px));
  padding: 22px 48px 22px 22px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.1);
}

.hotspot-panel--machine {
  display: flex;
  flex-direction: column;
  width: min(520px, calc(100% - 40px));
  max-height: min(78vh, 860px);
  padding: 28px 32px 32px;
  background: #fff;
  border: 5px solid var(--machine-blue);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.hotspot-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.hotspot-panel__head[hidden] {
  display: none;
}

.hotspot-panel__titles {
  min-width: 0;
}

.hotspot-panel__title {
  margin: 0;
  color: var(--machine-blue);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.hotspot-panel__sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.5;
}

.hotspot-panel__sub[hidden] {
  display: none;
}

.hotspot-panel__close {
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin: 0;
  padding: 8px;
  border: 0;
  border-radius: 2px;
  background: var(--machine-blue);
  color: #fff;
  cursor: pointer;
}

.hotspot-panel__close[hidden] {
  display: none;
}

.hotspot-panel__close-icon {
  display: block;
  width: 20px;
  height: 20px;
}

.hotspot-panel__close:hover,
.hotspot-panel__close:focus-visible {
  background: var(--machine-blue-dark);
}

.hotspot-panel__close:focus-visible {
  outline: 2px solid var(--machine-blue);
  outline-offset: 3px;
}

.hotspot-panel__close--simple {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--machine-blue);
  font-size: 22px;
  line-height: 1;
}

.hotspot-panel__close--simple:hover,
.hotspot-panel__close--simple:focus-visible {
  border-color: var(--machine-blue);
  background: #fff;
}

.hotspot-panel__body {
  color: var(--fg);
}

.hotspot-panel--simple .hotspot-panel__body {
  font-size: 15px;
  line-height: 1.55;
}

.hotspot-panel--machine .hotspot-panel__body p {
  margin: 0;
  color: var(--muted);
}

.hotspot-panel--machine .hotspot-panel__body p + p {
  margin-top: 0.8em;
}

.hotspot-panel--machine .hotspot-panel__body .overlay__lead {
  margin: 0 0 20px;
  color: var(--fg);
  font-size: 15px;
}

.hotspot-panel--machine .hotspot-panel__body .overlay__specs {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.hotspot-panel--machine .hotspot-panel__body .overlay__specs th,
.hotspot-panel--machine .hotspot-panel__body .overlay__specs td {
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-weight: 400;
}

.hotspot-panel--machine .hotspot-panel__body .overlay__specs th {
  width: 46%;
  padding-right: 16px;
  color: var(--fg);
}

.hotspot-panel--machine .hotspot-panel__body .overlay__specs td {
  color: var(--muted);
}

.hotspot-panel--machine .hotspot-panel__body .overlay__list {
  margin: 18px 0 0;
  padding-left: 1.15em;
  color: var(--muted);
  font-size: 14px;
}

.hotspot-panel--machine .hotspot-panel__body .overlay__list li + li {
  margin-top: 0.35em;
}

.hotspot-panel--machine .hotspot-panel__body .overlay__source {
  margin: 20px 0 0;
  font-size: 12px;
}

.hotspot-panel--machine .hotspot-panel__body .overlay__source a {
  color: var(--machine-blue);
  text-decoration: none;
}

.hotspot-panel--machine .hotspot-panel__body .overlay__source a:hover {
  text-decoration: underline;
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(255, 255, 255, 0.86);
}

.overlay[hidden] {
  display: none;
}

.overlay__card {
  position: relative;
  width: min(460px, 100%);
  padding: 28px 24px;
  border: 1px solid var(--line);
  background: #fff;
  text-align: center;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.08);
}

.overlay__kicker {
  margin: 0 0 10px;
  color: var(--machine-blue);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.overlay__title {
  margin: 0 0 10px;
  color: var(--machine-blue);
  font-size: clamp(22px, 3vw, 28px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.overlay__text {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
  word-break: break-word;
}

.overlay[data-state="loading"] .overlay__card::after {
  content: "";
  display: block;
  width: 140px;
  height: 3px;
  margin: 22px auto 0;
  overflow: hidden;
  background: linear-gradient(
    90deg,
    rgba(0, 0, 0, 0.08) 0%,
    rgba(26, 26, 26, 0.7) 50%,
    rgba(0, 0, 0, 0.08) 100%
  );
  background-size: 200% 100%;
  animation: overlay-load 1.1s linear infinite;
}

@keyframes overlay-load {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: -100% 0;
  }
}

@media (max-width: 900px) {
  .navbar,
  .toolbar {
    padding-left: 20px;
    padding-right: 20px;
  }

  .navbar__kicker,
  .navbar__hint {
    display: none;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .toolbar__meta,
  .toolbar__actions {
    flex-wrap: wrap;
  }

  .toolbar__file {
    white-space: normal;
  }
}

@media (prefers-reduced-motion: reduce) {
  .toolbar__btn,
  .navbar__overview,
  .navbar__logo {
    transition: none;
  }
}
