:root {
  color-scheme: dark;
  --bg: #050807;
  --panel: #0b1110;
  --line: rgba(196, 255, 224, 0.18);
  --text: #edf7f1;
  --muted: #9aaba2;
  --green: #63f2ad;
  --amber: #f5c264;
}

* { box-sizing: border-box; }

html,
body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Helvetica Neue", Arial, sans-serif;
}

body {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  min-height: 100svh;
  overflow: hidden;
}

.sim-header {
  display: grid;
  grid-template-columns: minmax(160px, 0.75fr) minmax(240px, 1.5fr) auto auto;
  align-items: center;
  gap: 18px;
  min-height: 58px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 8, 7, 0.98);
}

a { color: inherit; }

.back-link {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-decoration: none;
}

.back-link:hover,
.back-link:focus-visible { color: var(--green); }

.identity {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
}

.identity span {
  color: var(--green);
  font-size: 10px;
  letter-spacing: 0.13em;
  white-space: nowrap;
}

.identity strong {
  overflow: hidden;
  font-size: 14px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status {
  display: flex;
  gap: 6px;
}

.status span {
  padding: 5px 8px;
  border: 1px solid;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.11em;
  white-space: nowrap;
}

.status-proxy { border-color: rgba(99, 242, 173, 0.55); color: var(--green); }
.status-boundary { border-color: rgba(245, 194, 100, 0.55); color: var(--amber); }

.language-switch {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 10px;
}

.language-switch button {
  padding: 5px 3px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

.language-switch button[aria-pressed="true"] { color: var(--green); }

.boundary-note {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  padding: 11px 16px 12px;
  border-bottom: 1px solid rgba(245, 194, 100, 0.26);
  background: linear-gradient(90deg, rgba(245, 194, 100, 0.09), rgba(99, 242, 173, 0.035));
}

.boundary-note strong {
  display: block;
  margin-bottom: 4px;
  color: var(--amber);
  font-size: 12px;
}

.boundary-note p,
.boundary-note small {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.boundary-note small { color: #7f9188; }

.boundary-note button {
  min-width: 92px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.2);
  color: var(--muted);
  cursor: pointer;
  font-size: 10px;
}

.boundary-note .label-collapsed { display: none; }

body.note-collapsed .boundary-note {
  min-height: 36px;
  padding-top: 5px;
  padding-bottom: 5px;
}

body.note-collapsed .boundary-note > div { display: none; }
body.note-collapsed .boundary-note button { grid-column: 2; justify-self: end; }
body.note-collapsed .boundary-note .label-expanded { display: none; }
body.note-collapsed .boundary-note .label-collapsed { display: inline; }

.sim-frame,
.sim-frame iframe {
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
}

.sim-frame { background: var(--bg); }
.sim-frame iframe { display: block; }

@media (max-width: 860px) {
  .sim-header {
    grid-template-columns: 1fr auto;
    gap: 7px 12px;
  }

  .back-link { grid-column: 1; grid-row: 1; }
  .language-switch { grid-column: 2; grid-row: 1; justify-self: end; }
  .status { grid-column: 1 / -1; grid-row: 2; justify-self: start; }
  .identity { grid-column: 1 / -1; grid-row: 3; }
  .boundary-note { align-items: start; gap: 10px; }
  .boundary-note p { max-height: 6.2em; overflow: auto; }
}

@media (max-width: 520px) {
  .sim-header { padding: 8px 10px; }
  .identity span { display: none; }
  .identity strong { font-size: 12px; }
  .status span { padding: 4px 6px; font-size: 8px; }
  .boundary-note { padding: 9px 10px 10px; }
  .boundary-note small { display: none; }
  .boundary-note button { min-width: 76px; padding: 7px 8px; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}
