:root {
  --ink: #18251f;
  --muted: #56645b;
  --accent: #2f7d5e;
  --bad: #a9362f;
  --surface: #ffffff;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--surface);
}

body {
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
}

.embed,
.stage,
.diagram {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.stage,
.diagram {
  display: flex;
  align-items: center;
  justify-content: center;
}

.diagram {
  touch-action: manipulation;
}

.diagram svg {
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  overflow: visible;
}

.message {
  position: absolute;
  inset: 50% auto auto 50%;
  width: min(92vw, 34rem);
  margin: 0;
  padding: 1rem 1.1rem;
  border-left: 0.25rem solid var(--accent);
  color: var(--ink);
  background: var(--surface);
  transform: translate(-50%, -50%);
}

.message strong {
  display: block;
  margin-bottom: 0.35rem;
}

.message span {
  color: var(--muted);
}

.message.error {
  border-left-color: var(--bad);
}

.message:not([hidden]) + .stage {
  display: none;
}

.source-dialog {
  width: min(42rem, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  padding: 1rem;
  border: 0;
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 1rem 3rem rgb(0 0 0 / 24%);
}

.source-dialog::backdrop {
  background: rgb(0 0 0 / 28%);
}

.source-dialog pre {
  max-height: min(60vh, 28rem);
  margin: 0 0 1rem;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.source-dialog code {
  user-select: text;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.dialog-actions button {
  padding: 0.45rem 0.75rem;
  border: 1px solid #d7ddd8;
  color: var(--ink);
  background: var(--surface);
  font: inherit;
  cursor: pointer;
}

.dialog-actions button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
