.workspace-figure { margin: 0; }
.workspace-figure figcaption {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 6px;
  padding-inline-end: 12px;
  color: var(--muted);
  font-size: 14px;
  font-style: italic;
}

.flow-toggle {
  display: none;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid transparent;
  border-radius: 50%;
  padding: 0;
  background: transparent;
}
.flow-toggle:hover, .flow-toggle:focus-visible {
  border-color: var(--rule);
  color: var(--accent);
  background: #ffffffa6;
}
.flow-play-icon, .flow-toggle[aria-pressed="true"] .flow-pause-icon { display: none; }
.flow-toggle[aria-pressed="true"] .flow-play-icon { display: block; }

.workspace {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  min-height: clamp(385px, 36.2vw, 558px);
  overflow: hidden;
  overflow: clip;
  border-radius: clamp(20px, 2.3vw, 34px);
  padding: 0 clamp(28px, 4.7vw, 76px) 28px;
  color: #f8f4ff;
  background: #110b21;
}

.workspace-wallpaper {
  position: absolute;
  z-index: -1;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.workspace-wallpaper::before {
  content: "";
  position: absolute;
  inset: -22%;
  background:
    radial-gradient(ellipse at 54% 57%, #9676d480, transparent 38%),
    radial-gradient(ellipse at 32% 68%, #4d53a296, transparent 41%),
    radial-gradient(ellipse at 77% 36%, #85517177, transparent 43%);
}
.workspace-glow {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  visibility: hidden;
}
.workspace-wallpaper[data-glow-rendered]::before { display: none; }
.workspace-wallpaper[data-glow-rendered] .workspace-glow { visibility: visible; }

.code-window {
  --editor-angle: -4deg;
  position: absolute;
  inset-inline-start: clamp(20px, 3.5vw, 56px);
  bottom: -40px;
  width: min(54%, 760px);
  overflow: hidden;
  border: 1px solid #f1dff963;
  border-radius: 23px 23px 0 0;
  color: #e8dcf4;
  background: linear-gradient(135deg, #272039f2, #1d182ce8);
  box-shadow: 0 18px 46px #10071f70;
  transform: skewX(var(--editor-angle));
  pointer-events: none;
}
html[dir="rtl"] .code-window { --editor-angle: 4deg; }

.code-toolbar {
  display: flex;
  align-items: center;
  gap: 32px;
  min-height: 47px;
  border-bottom: 1px solid #eddbff2b;
  padding-inline: 23px;
  color: #efe8f5;
  background: #ffffff0d;
  font-size: clamp(12px, 1.2vw, 17px);
  font-weight: 570;
}
.window-lights { display: flex; gap: 7px; }
.window-lights i {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #f08b8c;
}
.window-lights i:nth-child(2) { background: #f5c16d; }
.window-lights i:nth-child(3) { background: #82c492; }

.code-lines {
  counter-reset: sample-line;
  min-height: 143px;
  padding: 14px 20px 27px 30px;
  list-style: none;
}
.code-lines li {
  display: flex;
  align-items: baseline;
  gap: 24px;
  min-height: 1.55em;
  color: #e1d6f0;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: clamp(12px, 1.28vw, 19px);
  line-height: 1.55;
}
.code-lines li::before {
  counter-increment: sample-line;
  content: counter(sample-line);
  width: 1.1em;
  color: #aba0b8;
  text-align: end;
}
.code-lines code { font: inherit; white-space: pre; }
.code-keyword { color: #e7a8ff; }
.code-type { color: #91daf8; }
.code-function { color: #f3db9a; }
.code-value { color: #d2df9b; }

.float-unit {
  position: relative;
  width: min(100%, clamp(340px, 34.5vw, 514px));
  margin-top: clamp(92px, 9.25vw, 141px);
  transition: margin-top .42s var(--ease-out);
}
.float-unit[open] { margin-top: clamp(23px, 2.55vw, 40px); }

.float-toggle {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(8px, 1.22vw, 19px);
  min-height: clamp(56px, 4.6vw, 69px);
  border: 1px solid #dbc0fc9e;
  border-radius: 25px;
  padding: 8px clamp(10px, 1.4vw, 21px);
  background: #251a39f0;
  box-shadow: inset 0 1px 0 #f2dfff54, 0 12px 26px #190a3575, 0 0 26px #c696ff45;
  list-style: none;
  cursor: pointer;
  user-select: none;
  transition: background-color .2s ease, border-color .2s ease, box-shadow .25s ease;
}
.float-toggle::-webkit-details-marker { display: none; }
.float-toggle::marker { content: ""; }
.float-toggle:hover, .float-toggle:focus-visible {
  border-color: #f3ddff;
  background: #302048;
  box-shadow: inset 0 1px 0 #f2dfff64, 0 13px 30px #190a3582, 0 0 30px #e2b9ff60;
}
.float-toggle img {
  width: clamp(28px, 3.14vw, 47px);
  height: auto;
}

.float-provider {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  border-inline-start: 1px solid #ead8ff36;
  padding-inline-start: clamp(7px, 1vw, 15px);
  font-size: clamp(13px, 1.4vw, 20px);
  font-weight: 560;
  white-space: nowrap;
}
.float-provider strong {
  font-size: 1.08em;
  font-weight: 745;
  font-variant-numeric: tabular-nums;
}
.float-chevron {
  color: #f0ddff;
  transition: transform .35s var(--ease-out);
}
.float-unit[open] .float-chevron { transform: rotate(180deg); }

.float-hint {
  position: absolute;
  inset-inline-end: 18px;
  inset-block-end: calc(100% + 9px);
  display: flex;
  align-items: flex-start;
  gap: 4px;
  max-width: calc(100% - 22px);
  color: #f9efff;
  font-size: clamp(12px, 1.14vw, 17px);
  font-style: italic;
  font-weight: 570;
  text-shadow: 0 1px 8px #170b2f, 0 0 13px #170b2f;
  text-align: end;
  pointer-events: none;
  transition: opacity .18s ease, transform .25s var(--ease-out);
}
.float-unit[open] .float-hint { opacity: 0; transform: translateY(5px); }
.float-hint svg { flex: none; margin-top: 3px; }
html[dir="rtl"] .float-hint svg { scale: -1 1; }

.float-drawer { padding-top: 8px; }
.demo {
  display: grid;
  gap: 13px;
  border: 1px solid #c8abe35c;
  border-radius: 24px;
  padding: clamp(14px, 1.55vw, 23px);
  color: #f8f4ff;
  background: linear-gradient(145deg, #22192ff9, #181325f9);
  box-shadow: inset 0 1px 0 #eddcff15, 0 20px 50px #160d2673;
}
.provider-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px;
  border-radius: 13px;
  padding: 3px;
  background: #ffffff0e;
}
.provider-switch button {
  min-height: 38px;
  border: 0;
  border-radius: 10px;
  padding: 7px 6px;
  color: #eae0f6;
  background: transparent;
  font-size: clamp(13px, 1.16vw, 16px);
  font-weight: 650;
  line-height: 1.2;
  white-space: nowrap;
  transition: background-color .2s ease, color .2s ease;
}
.provider-switch button:hover { background: #ffffff16; }
.provider-switch button[aria-pressed="true"] { color: #fff; background: #7351ca; }

.quota-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.quota-label, .quota-number {
  font-size: clamp(14px, 1.31vw, 19px);
  font-weight: 680;
  line-height: 1.2;
}
.quota-number { color: #f8f4ff; font-variant-numeric: tabular-nums; text-align: end; }
.quota-track {
  overflow: hidden;
  height: 8px;
  margin-top: 8px;
  border-radius: 999px;
  background: #43364f;
}
.quota-track span {
  display: block;
  width: var(--remaining);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #caadf9, #a989e6);
  transition: width .33s var(--ease-out);
}
.quota-reset {
  margin-top: 6px;
  color: #d4c6e5;
  font-size: clamp(12px, 1.12vw, 16px);
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
}
.activity { border-top: 1px solid #dbc6f030; padding-top: 12px; }
.activity-title {
  margin-bottom: 8px;
  font-size: clamp(14px, 1.28vw, 18px);
  font-weight: 690;
}
.activity-plot {
  --plot-height: clamp(40px, 4.75vw, 70px);
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: clamp(5px, 1vw, 11px);
  padding: 0;
  color: #ddd1eb;
  list-style: none;
}
.activity-plot li {
  display: grid;
  grid-template-rows: var(--plot-height) auto;
  justify-items: center;
  align-items: end;
  gap: 5px;
  min-width: 0;
  font-size: clamp(9px, 1vw, 13px);
  font-weight: 560;
  line-height: 1.2;
}
.bar {
  width: min(77%, 37px);
  height: var(--volume);
  border-radius: 4px 4px 2px 2px;
  background: linear-gradient(#c0a5f4, #a687e3);
  transition: height .36s var(--ease-out);
}

@media (prefers-reduced-motion: no-preference) {
  .flow-toggle:enabled { display: inline-grid; }

  .workspace[data-flow-ready] .workspace-wallpaper::before { animation: mist-drift 16s ease-in-out infinite; }
  .workspace:is([data-flow-paused], [data-flow-offscreen]) .workspace-wallpaper::before { animation-play-state: paused; }

  .code-window { animation: editor-appear 1s var(--ease-out) both; }
  .float-toggle { animation: meter-appear .85s var(--ease-out) both; }

  @supports (interpolate-size: allow-keywords) and selector(details::details-content) {
    .float-unit { interpolate-size: allow-keywords; }
    .float-unit::details-content {
      height: 0;
      overflow: clip;
      opacity: 0;
      transition: height .42s var(--ease-out), opacity .23s ease, content-visibility .42s allow-discrete;
    }
    .float-unit[open]::details-content { height: auto; opacity: 1; }
  }
}

@keyframes mist-drift {
  0%, 100% { transform: translate(-4%, 2%) rotate(-3deg); opacity: .83; }
  35% { transform: translate(4%, -5%) rotate(3deg) scale(1.13); opacity: .97; }
  70% { transform: translate(6%, 2%) rotate(-1deg) scale(1.06); opacity: .88; }
}

@keyframes editor-appear {
  from { opacity: .55; transform: translateY(27px) skewX(var(--editor-angle)); }
  to { opacity: 1; transform: translateY(0) skewX(var(--editor-angle)); }
}
@keyframes meter-appear {
  from { opacity: .55; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 810px) {
  .workspace {
    min-height: clamp(330px, 61vw, 430px);
    padding-inline: clamp(15px, 4vw, 32px);
  }
  .float-unit { width: min(100%, 415px); }
  .code-window { width: min(81%, 570px); }
  .code-toolbar { min-height: 38px; gap: 18px; padding-inline: 15px; }
  .code-lines { padding-inline: 13px; padding-bottom: 21px; }
  .code-lines li { gap: 13px; }
}

@media (max-width: 510px) {
  .workspace { padding-bottom: 19px; }
  .float-unit { width: 100%; margin-top: 83px; }
  .float-unit[open] { margin-top: 20px; }
  .float-toggle { gap: 6px; min-height: 54px; border-radius: 18px; }
  .float-provider { gap: 4px; font-size: clamp(11px, 3.2vw, 14px); }
  .float-chevron { width: 17px; height: 17px; }
  .float-hint { inset-inline-end: 12px; inset-block-end: calc(100% + 6px); }
  .float-hint svg { width: 25px; height: 34px; }
  .code-window { inset-inline-start: 11px; bottom: -34px; width: 94%; border-radius: 16px 16px 0 0; }
  .code-lines li { font-size: 11px; }
  .demo {
    gap: 11px;
    border-radius: 17px;
    background: linear-gradient(145deg, #22192f, #181325);
  }
  .code-toolbar .window-lights i { width: 8px; height: 8px; }
}

