:root {
  color-scheme: light;
  --bg: #f7f6f3;
  --panel: #ffffff;
  --panel-soft: #fbfbfa;
  --ink: #1d2527;
  --muted: #687275;
  --line: #dddeda;
  --line-strong: #c9ccc8;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --accent-soft: #eff6ff;
  --accent-line: #bfdbfe;
  --accent-ring: rgba(37, 99, 235, 0.16);
  --accent-ring-strong: rgba(37, 99, 235, 0.26);
  --danger: #9f1239;
  --danger-soft: #fff1f2;
  --danger-line: #fecdd3;
  --danger-dark: #881337;
  --notice-bg: #fff4d7;
  --notice-line: #ead18b;
  --success: #24713f;
  --success-soft: #e8f7ee;
  --shadow: rgba(29, 37, 39, 0.14);
  --overlay: rgba(0, 0, 0, 0.58);
  --sticky-panel: rgba(255, 255, 255, 0.97);
}

:root[data-theme="light"] {
  color-scheme: light;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101315;
  --panel: #171b1e;
  --panel-soft: #121619;
  --ink: #edf1f2;
  --muted: #9aa5a8;
  --line: #2a3034;
  --line-strong: #3a4248;
  --accent: #60a5fa;
  --accent-dark: #93c5fd;
  --accent-soft: #10243d;
  --accent-line: #25537e;
  --accent-ring: rgba(96, 165, 250, 0.2);
  --accent-ring-strong: rgba(96, 165, 250, 0.32);
  --danger: #fb7185;
  --danger-soft: #32141b;
  --danger-line: #7f1d2d;
  --danger-dark: #fecdd3;
  --notice-bg: #2c2512;
  --notice-line: #6f5b1f;
  --success: #86efac;
  --success-soft: #102817;
  --shadow: rgba(0, 0, 0, 0.38);
  --overlay: rgba(0, 0, 0, 0.72);
  --sticky-panel: rgba(23, 27, 30, 0.97);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --bg: #101315;
    --panel: #171b1e;
    --panel-soft: #121619;
    --ink: #edf1f2;
    --muted: #9aa5a8;
    --line: #2a3034;
    --line-strong: #3a4248;
    --accent: #60a5fa;
    --accent-dark: #93c5fd;
    --accent-soft: #10243d;
    --accent-line: #25537e;
    --accent-ring: rgba(96, 165, 250, 0.2);
    --accent-ring-strong: rgba(96, 165, 250, 0.32);
    --danger: #fb7185;
    --danger-soft: #32141b;
    --danger-line: #7f1d2d;
    --danger-dark: #fecdd3;
    --notice-bg: #2c2512;
    --notice-line: #6f5b1f;
    --success: #86efac;
    --success-soft: #102817;
    --shadow: rgba(0, 0, 0, 0.38);
    --overlay: rgba(0, 0, 0, 0.72);
    --sticky-panel: rgba(23, 27, 30, 0.97);
  }
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

.selection-input {
  display: none;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.nav-open {
  overflow: hidden;
}

a {
  color: var(--accent-dark);
}

button,
.button {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
  background: var(--accent);
  color: white;
  font: inherit;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
}

button:hover,
.button:hover {
  background: var(--accent-dark);
}

.secondary-button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: var(--panel);
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}

.secondary-button:hover {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.danger-button {
  background: var(--danger-soft);
  color: var(--danger);
}

.danger-button:hover {
  background: var(--danger-line);
  color: var(--danger-dark);
}

.topbar {
  height: 58px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 0 18px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 40;
}

.topbar-with-content {
  grid-template-columns: auto minmax(0, 760px) auto;
}

.topbar-actions {
  grid-column: 3;
  display: inline-flex;
  align-items: center;
  justify-content: end;
  gap: 8px;
  min-width: max-content;
  justify-self: end;
}

.brand {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}

.brand-logo {
  width: 108px;
  height: auto;
  display: block;
}

.theme-logo-light {
  display: none;
}

.theme-asset-light {
  display: none;
}

:root[data-theme="dark"] .theme-logo-dark {
  display: none;
}

:root[data-theme="dark"] .theme-logo-light,
:root[data-theme="dark"] .theme-asset-light {
  display: block;
}

:root[data-theme="light"] .theme-logo-dark,
:root[data-theme="light"] .theme-asset-dark {
  display: block;
}

:root[data-theme="light"] .theme-logo-light,
:root[data-theme="light"] .theme-asset-light {
  display: none;
}

:root[data-theme="dark"] .theme-asset-dark {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .theme-logo-dark,
  :root:not([data-theme]) .theme-asset-dark {
    display: none;
  }

  :root:not([data-theme]) .theme-logo-light,
  :root:not([data-theme]) .theme-asset-light {
    display: block;
  }
}

.theme-toggle {
  justify-self: end;
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

.theme-toggle .theme-icon-dark {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .theme-icon-light {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .theme-icon-dark {
  display: block;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .theme-toggle .theme-icon-light {
    display: none;
  }

  :root:not([data-theme]) .theme-toggle .theme-icon-dark {
    display: block;
  }
}

.brand-mark {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--accent);
  color: white;
}

.icon-button {
  flex: 0 0 auto;
  justify-self: end;
  min-width: 40px;
  width: 40px;
  height: 40px;
  padding: 0;
  font-size: 22px;
}

.nav-title-input {
  width: min(760px, 100%);
  max-width: 100%;
  justify-self: start;
  margin: 0;
  min-height: 38px;
  border-left-color: var(--line);
  padding-left: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
  z-index: 80;
}

.overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(320px, 86vw);
  height: 100vh;
  background: var(--panel);
  z-index: 90;
  transform: translateX(100%);
  transition: transform 180ms ease;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-left: 1px solid var(--line-strong);
  box-shadow: -18px 0 42px rgba(29, 37, 39, 0.18);
}

.drawer.open {
  transform: translateX(0);
}

.drawer a,
.drawer form button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 44px;
  padding: 0 10px;
  border-radius: 6px;
  color: var(--ink);
  background: transparent;
  text-decoration: none;
  font-weight: 700;
}

.drawer form {
  margin: 0;
}

.drawer-close {
  align-self: flex-end;
}

main {
  min-height: calc(100vh - 58px);
  min-width: 0;
}

@media (min-width: 1180px) {
  .authed-layout .topbar {
    grid-template-columns: auto minmax(0, 1fr) auto;
    margin-left: 248px;
    min-width: 0;
  }

  .authed-layout .topbar-with-content {
    grid-template-columns: auto minmax(0, 760px) auto;
  }

  .authed-layout #navToggle,
  .authed-layout .drawer-close,
  .authed-layout .overlay {
    display: none;
  }

  .authed-layout .drawer {
    top: 0;
    right: auto;
    left: 0;
    width: 248px;
    height: 100vh;
    padding: 72px 14px 18px;
    transform: none;
    border-right: 1px solid var(--line);
    border-left: 0;
    box-shadow: none;
    background: var(--panel);
  }

  .authed-layout .drawer a,
  .authed-layout .drawer form button {
    min-height: 42px;
    padding: 0 12px;
  }

  .authed-layout .drawer a:hover,
  .authed-layout .drawer form button:hover {
    background: var(--accent-soft);
    color: var(--accent-dark);
  }

  .authed-layout main {
    margin-left: 248px;
    min-width: 0;
  }
}

.login-wrap,
.content,
.workspace,
.artifact,
.quiz-wrap,
.landing {
  width: min(1240px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.workspace {
  width: min(1180px, calc(100% - 32px));
}

.login-wrap {
  min-height: calc(100vh - 58px);
  display: grid;
  place-items: center;
}

.login-card {
  width: min(380px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  display: grid;
  gap: 14px;
}

.landing {
  padding: 44px 0 72px;
}

.landing-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.94fr);
  align-items: center;
  gap: clamp(44px, 6vw, 88px);
  min-height: min(680px, calc(100vh - 96px));
  padding: 30px 0 54px;
}

.landing-hero-copy {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.eyebrow {
  margin: 0;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.landing h1 {
  margin: 0;
  max-width: 780px;
  font-size: clamp(46px, 6.4vw, 82px);
  line-height: 0.98;
  letter-spacing: 0;
}

.hero-copy {
  max-width: 660px;
  margin: 0;
  color: var(--muted);
  font-size: 20px;
  line-height: 1.45;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.hero-artifact-visual {
  position: relative;
  display: grid;
  place-items: center;
  justify-self: end;
  width: min(100%, 640px);
  min-height: 600px;
  isolation: isolate;
  overflow: visible;
}

.hero-artifact-glow {
  position: absolute;
  width: min(72%, 430px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.24), rgba(37, 99, 235, 0.08) 42%, transparent 70%);
  filter: blur(2px);
  z-index: -3;
}

.hero-orbit {
  position: absolute;
  width: min(92%, 540px);
  aspect-ratio: 1;
  border: 1px solid var(--accent-line);
  border-radius: 50%;
  opacity: 0.68;
  z-index: -2;
}

.hero-orbit::before,
.hero-orbit::after {
  content: "";
  position: absolute;
  inset: 13%;
  border: 1px solid var(--line);
  border-radius: 50%;
}

.hero-orbit::after {
  inset: 29%;
  border-style: dashed;
  opacity: 0.55;
}

.hero-artifact-icon {
  width: min(70%, 440px);
  height: auto;
  margin: 0;
  filter: drop-shadow(0 30px 44px var(--shadow)) brightness(1.04);
  z-index: 1;
  animation: heroRise 700ms ease-out both;
}

.hero-fragment,
.hero-preview {
  position: absolute;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 12px 34px rgba(29, 37, 39, 0.08);
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.02em;
  z-index: 2;
  animation: heroRise 780ms ease-out both;
}

.hero-fragment {
  padding: 8px 10px;
  text-transform: uppercase;
}

.hero-fragment-one {
  top: 28px;
  left: 10%;
  animation-delay: 80ms;
}

.hero-fragment-two {
  right: 0;
  top: 132px;
  animation-delay: 150ms;
}

.hero-fragment-three {
  right: 8%;
  bottom: 34px;
  color: var(--accent-dark);
  animation-delay: 220ms;
}

.hero-preview {
  left: 0;
  bottom: 22px;
  width: min(210px, 38%);
  padding: 14px;
  font-weight: 700;
  letter-spacing: 0;
  animation-delay: 260ms;
}

.hero-preview strong {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 14px;
}

.hero-preview p {
  margin: 0 0 6px;
}

.hero-preview ul {
  margin: 0;
  padding-left: 18px;
}

.hero-preview span {
  display: block;
  margin-top: 10px;
  color: var(--accent-dark);
  font-size: 11px;
  text-transform: uppercase;
}

.feature-intro {
  display: grid;
  gap: 8px;
  max-width: 680px;
  margin: 10px 0 18px;
}

.feature-intro h2 {
  margin: 0;
  max-width: 680px;
  font-size: clamp(28px, 3vw, 40px);
  line-height: 1.08;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 20px;
}

.feature-grid article {
  min-height: 190px;
  padding: 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  align-content: start;
}

.feature-grid h2 {
  margin: 12px 0 12px;
  font-size: 18px;
}

.feature-grid p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.feature-icon {
  display: inline-flex;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--accent-dark);
  background: var(--panel-soft);
}

.feature-icon svg {
  width: 18px;
  height: 18px;
}

@keyframes heroRise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-artifact-icon,
  .hero-fragment,
  .hero-preview {
    animation: none;
  }
}

@media (max-width: 1120px) {
  .hero-artifact-visual {
    min-height: 560px;
  }

  .hero-artifact-icon {
    width: min(66%, 360px);
    margin: 0;
  }

  .hero-preview {
    left: 8px;
    bottom: 8px;
    width: 184px;
  }

  .hero-fragment-one {
    left: 4%;
  }

  .hero-fragment-two {
    right: 0;
  }

  .hero-fragment-three {
    right: 4%;
  }
}

label {
  display: grid;
  gap: 6px;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  color: var(--ink);
  font: inherit;
  background: var(--panel);
}

input:hover,
textarea:hover,
select:hover {
  border-color: var(--line-strong);
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  outline: 3px solid var(--accent-ring);
}

textarea {
  min-height: 130px;
  resize: vertical;
}

.error {
  color: var(--danger);
}

.notice {
  background: var(--notice-bg);
  border: 1px solid var(--notice-line);
  border-radius: 6px;
  padding: 12px;
}

.page-head,
.editor-header,
.toolbar,
.actions,
.block-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.page-head,
.editor-header {
  justify-content: space-between;
  margin-bottom: 20px;
}

.content > h2 {
  margin: 26px 0 12px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.content > h2:first-of-type {
  margin-top: 18px;
}

.page-head h1 {
  margin: 0;
  font-size: clamp(40px, 5vw, 54px);
  line-height: 1;
}

.back-link {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: var(--panel);
  color: var(--accent-dark);
  font-weight: 800;
  text-decoration: none;
}

.back-link:hover {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.usage-content {
  width: min(100% - 40px, 1240px);
}

.usage-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.usage-page-head h1 {
  margin: 0;
  font-size: clamp(40px, 5vw, 54px);
  line-height: 1;
}

.usage-page-head p {
  max-width: 620px;
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.usage-month-picker {
  display: flex;
  align-items: end;
  gap: 8px;
  flex: 0 0 auto;
}

.usage-month-picker label {
  gap: 4px;
}

.usage-month-picker label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.usage-month-picker select {
  min-width: 180px;
  min-height: 40px;
  padding-block: 0;
}

.usage-empty-note {
  max-width: 620px;
  margin-bottom: 18px;
  border: 1px solid var(--accent-line);
  border-radius: 8px;
  background: var(--accent-soft);
  padding: 14px 16px;
}

.usage-empty-note strong {
  display: block;
  margin-bottom: 4px;
}

.usage-empty-note p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.usage-primary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.usage-primary-card,
.usage-panel,
.usage-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.usage-panel {
  padding: 16px;
}

.usage-primary-card {
  min-height: 150px;
  padding: 18px;
  display: grid;
  align-content: space-between;
  gap: 12px;
}

.usage-primary-card span,
.usage-metric-band span,
.usage-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.usage-primary-card strong {
  display: block;
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1;
}

.usage-cost-card {
  border-color: var(--accent-line);
}

.usage-cost-card strong {
  color: var(--accent-dark);
}

.usage-primary-card small {
  color: var(--muted);
  font-size: 13px;
}

.usage-section {
  margin-top: 18px;
  padding: 16px;
}

.usage-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.usage-section-head h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.usage-section-head details {
  color: var(--muted);
  font-size: 13px;
  max-width: 420px;
}

.usage-section-head summary {
  color: var(--accent-dark);
  cursor: pointer;
  font-weight: 800;
  list-style-position: inside;
}

.usage-section-head details p {
  margin: 8px 0 0;
  line-height: 1.45;
}

.usage-metric-band {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.usage-metric-band article {
  min-width: 0;
  border-left: 1px solid var(--line);
  padding-left: 14px;
}

.usage-metric-band article:first-child {
  border-left: 0;
  padding-left: 0;
}

.usage-metric-band strong {
  display: block;
  margin-top: 5px;
  font-size: 24px;
  line-height: 1.1;
}

.usage-empty-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--panel-soft);
}

.usage-empty-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.usage-empty-panel p + p {
  margin-top: 4px;
}

.usage-table-wrap {
  overflow-x: auto;
}

.usage-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
}

.usage-table th,
.usage-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
  text-align: left;
  vertical-align: middle;
}

.usage-table th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.usage-table td {
  color: var(--ink);
}

.usage-table .num {
  text-align: right;
  white-space: nowrap;
}

.usage-table .cost {
  color: var(--accent-dark);
  font-weight: 850;
}

.usage-technical {
  background: var(--panel-soft);
}

.usage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.usage-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 12px;
}

.usage-grid strong {
  display: block;
  margin-top: 4px;
  font-size: 20px;
}

.editor-header {
  align-items: center;
  gap: 6px;
  margin: 0;
}

.editor-header button[type="submit"] {
  min-height: 28px;
  padding: 0 10px;
  border-radius: 6px;
  flex: 0 0 auto;
  font-size: 13px;
}

.editor-sticky {
  position: sticky;
  top: 58px;
  z-index: 35;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "tools save";
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin: -16px 0 18px;
  padding: 10px;
  background: var(--sticky-panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(29, 37, 39, 0.05);
  backdrop-filter: blur(8px);
}

.content .editor-sticky {
  padding-inline: 10px;
}

.editor-sticky .editor-header {
  display: contents;
}

.editor-sticky .title-input {
  grid-area: title;
}

.editor-sticky .editor-header button[type="submit"] {
  grid-area: save;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 6px;
  font-size: 14px;
  white-space: nowrap;
}

.editor-actions {
  grid-area: save;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.preview-button {
  min-height: 40px;
  padding: 0 12px;
  white-space: nowrap;
}

.autosave-status {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.autosave-status[data-state="saving"] {
  color: var(--accent-dark);
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.autosave-status[data-state="error"] {
  color: var(--danger);
  border-color: var(--danger-line);
  background: var(--danger-soft);
}

.editor-quiz-toggle {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
  white-space: nowrap;
}

.editor-quiz-toggle input {
  width: auto;
  min-height: auto;
  margin: 0;
}

.editor-quiz-toggle:has(input:checked) {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.editor-sticky .toolbar {
  grid-area: tools;
  margin: 0;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  min-width: 0;
  overflow: visible;
}

.editor-sticky-form {
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 0;
}

.editor-sticky-form .toolbar {
  display: grid;
  align-content: start;
  gap: 6px;
  overflow: visible;
  padding-right: 0;
}

.toolbar-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
}

.toolbar-format-row {
  justify-content: space-between;
}

.toolbar-insert-row,
.toolbar-question-row {
  justify-content: flex-start;
}

.toolbar-format-row .format-tools {
  min-width: 0;
}

.toolbar-format-row .editor-actions {
  flex: 0 0 auto;
}

.toolbar-label {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 0 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.editor-sticky .toolbar > button,
.editor-sticky .toolbar-row > button,
.editor-sticky .toolbar-row > a.button {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 6px;
  font-size: 13px;
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.editor-sticky .toolbar > button:hover,
.editor-sticky .toolbar-row > button:hover,
.editor-sticky .toolbar-row > a.button:hover,
.format-tools button:hover,
.block-icon-button:hover {
  background: var(--accent-line);
}

.format-tools {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
}

.editor-sticky-form .format-tools {
  flex: 0 1 auto;
  padding-top: 2px;
}

.format-tools button {
  min-height: 36px;
  padding: 0 10px;
  border-radius: 6px;
  font-size: 13px;
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.format-tools .color-trigger {
  width: 36px;
  min-width: 36px;
  height: 36px;
  padding: 0;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0) 42%),
    linear-gradient(135deg, #fff02a 0%, #ff4b5f 28%, #d51bea 52%, #23d7f1 76%, #38ed6e 100%);
  border: 1px solid var(--line);
  box-shadow: inset 0 0 0 3px var(--panel), inset 0 0 0 4px rgba(29, 37, 39, 0.12);
}

.format-tools .color-trigger:hover {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0) 42%),
    linear-gradient(135deg, #fff02a 0%, #ff4b5f 28%, #d51bea 52%, #23d7f1 76%, #38ed6e 100%);
  border-color: var(--line-strong);
}

.color-trigger span {
  display: none;
}

.color-picker {
  position: fixed;
  inset: auto auto 0 0;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}

.reference-chooser::backdrop {
  background: var(--overlay);
}

.reference-panel {
  display: grid;
  gap: 14px;
  min-width: min(420px, calc(100vw - 40px));
  padding: 18px;
}

.reference-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.reference-head h2 {
  margin: 0;
  font-size: 20px;
}

.reference-panel label {
  display: grid;
  gap: 6px;
  font-weight: 800;
}

.reference-panel select {
  min-height: 42px;
}

.format-tools select {
  width: auto;
  min-width: 104px;
  min-height: 36px;
  border-radius: 6px;
  padding: 0 8px;
  font-size: 13px;
}

.tool-group {
  display: inline-flex;
  align-items: center;
  gap: 1px;
}

.tool-group button {
  border-radius: 0;
}

.tool-group button:first-child {
  border-radius: 5px 0 0 5px;
}

.tool-group button:last-child {
  border-radius: 0 5px 5px 0;
}

.title-input {
  max-width: 100%;
  min-width: 0;
  min-height: 36px;
  border-color: transparent;
  border-radius: 0;
  padding: 0;
  font-size: clamp(18px, 3vw, 24px);
  line-height: 1.08;
  font-weight: 800;
  background: transparent;
}

.editor-layout {
  display: block;
  overflow: visible;
  padding-bottom: 56px;
}

.editor-create-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 18px;
}

.preview,
.row,
.asset-grid figure,
.artif4ct-quiz,
.artif4ct-form,
.art3fact-quiz,
.art3fact-form,
.hmake-quiz,
.hmake-form {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.blocks {
  display: grid;
  gap: 8px;
  max-width: 1100px;
  margin: 0 auto;
}

.block {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 12px 10px 12px 44px;
  display: grid;
  gap: 8px;
  position: relative;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.block:hover:not(:has(button:hover, input:hover, textarea:hover, select:hover, label:hover)),
.block-selected {
  border-color: var(--line-strong);
  background: var(--panel-soft);
}

.block-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.block input,
.block textarea,
.block select,
.block label,
.editable-content {
  cursor: initial;
}

.block button {
  cursor: pointer;
}

.question-editor {
  display: grid;
  gap: 16px;
}

.block:has(.question-editor) {
  border-color: var(--line);
  background: var(--panel);
  padding: 20px 18px 18px 50px;
}

.block-selected:has(.question-editor) {
  border-color: var(--accent);
}

.list-editor {
  display: grid;
  gap: 10px;
}

.list-settings {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.list-settings label {
  display: grid;
  gap: 6px;
  font-weight: 800;
}

.list-settings select {
  min-width: 180px;
}

.list-items {
  display: grid;
  gap: 8px;
}

.list-item-row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 34px;
  gap: 8px;
  align-items: center;
}

.list-marker {
  color: var(--muted);
  font-weight: 850;
  text-align: right;
}

.list-item-row button[data-remove-list-item] {
  width: 34px;
  min-height: 34px;
  padding: 0;
  background: transparent;
  color: var(--muted);
}

.list-item-row button[data-remove-list-item]:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.list-item-row:has([data-remove-list-item][hidden]) {
  grid-template-columns: 30px minmax(0, 1fr);
}

.add-list-item-button {
  width: fit-content;
  min-height: 34px;
}

.question-main {
  display: grid;
}

.question-main textarea {
  min-height: 86px;
  resize: vertical;
  font-size: 17px;
  font-weight: 750;
}

.question-settings {
  border-top: 1px solid var(--line);
  padding-top: 0;
}

.question-settings summary {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 850;
}

.question-settings-grid {
  display: grid;
  grid-template-columns: minmax(150px, 220px) auto;
  gap: 10px;
  align-items: end;
  padding-top: 10px;
}

.question-settings-grid label,
.question-answer {
  display: grid;
  gap: 6px;
  font-weight: 800;
}

.question-options {
  display: grid;
  gap: 8px;
}

.question-options-wrap {
  display: grid;
  gap: 8px;
}

.question-field-label {
  color: var(--ink);
  font-size: 13px;
  font-weight: 850;
}

.option-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.option-row input[data-option-text] {
  flex: 1 1 220px;
  min-width: 0;
}

.option-row label {
  flex: 0 0 auto;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.option-correct {
  border: 0;
  border-radius: 8px;
  padding: 0 8px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.option-correct:has(input:checked) {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.option-row button[data-remove-option] {
  flex: 0 0 34px;
  width: 34px;
  min-height: 34px;
  padding: 0;
  background: transparent;
  color: var(--muted);
}

.option-row button[data-remove-option]:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.add-option-button {
  width: fit-content;
  min-height: 34px;
}

.option-row input[type="radio"],
.option-row input[type="checkbox"],
.question-settings-grid input[type="checkbox"] {
  width: auto;
  min-height: auto;
}

.block-drag-handle {
  position: absolute;
  z-index: 3;
  top: 10px;
  bottom: 10px;
  left: 8px;
  width: 26px;
  min-height: 44px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
  cursor: grab;
  opacity: 0.55;
  touch-action: none;
  user-select: none;
  transition: opacity 120ms ease, color 120ms ease, background 120ms ease, border-color 120ms ease;
}

.block-drag-handle:hover {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent-dark);
}

.block-drag-handle:active {
  cursor: grabbing;
}

.block:hover .block-drag-handle,
.block-selected .block-drag-handle {
  opacity: 0.95;
}

.block-controls {
  position: relative;
  justify-self: end;
  display: grid;
  grid-template-columns: auto 34px 34px;
  justify-content: initial;
  flex-wrap: nowrap;
  gap: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
  z-index: 2;
}

.text-artifact-editor form {
  display: grid;
  gap: 18px;
  max-width: 820px;
}

.text-artifact-content {
  white-space: normal;
  overflow-wrap: anywhere;
  font-size: 20px;
  line-height: 1.65;
}

.block:hover .block-controls,
.block-selected .block-controls {
  opacity: 1;
  pointer-events: auto;
}

.block-controls span {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  padding: 0 8px;
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.block-icon-button {
  min-height: 34px;
  width: 34px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 16px;
  padding: 0;
}

.block-settings {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  margin-top: 2px;
  background: var(--panel);
}

.block-settings label {
  max-width: 220px;
}

.block-dragging {
  opacity: 0.38;
  background: var(--accent-soft);
  border-color: var(--accent-line);
  box-shadow: none;
  cursor: grabbing;
}

.block-dragging img {
  max-height: 160px;
  width: auto;
}

.block-drag-preview {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 80;
  max-height: 220px;
  overflow: hidden;
  padding: 8px;
  background: var(--panel);
  border: 1px solid var(--accent);
  border-radius: 6px;
  box-shadow: 0 16px 44px rgba(29, 37, 39, 0.18);
  transform: translate3d(-10000px, -10000px, 0);
  transform-origin: top left;
  pointer-events: none;
}

.block-drag-preview .block-controls {
  display: none;
}

.block-drag-preview img {
  max-height: 150px;
  width: auto;
}

.block-drag-preview p {
  max-height: 100px;
  overflow: hidden;
}

.block-drop-before::before,
.block-drop-after::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  height: 3px;
  border-radius: 999px;
  background: var(--accent);
}

.block-drop-before::before {
  top: -8px;
}

.block-drop-after::after {
  bottom: -8px;
}

.block img,
.markdown img,
.preview img,
.asset-grid img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}

.block-divider,
.markdown hr,
.preview hr,
.artif4ct-form hr,
.art3fact-form hr,
.hmake-form hr {
  width: 100%;
  height: 1px;
  border: 0;
  border-top: 1px solid var(--line-strong);
}

.block-divider {
  margin: 16px 0;
}

.markdown hr,
.preview hr,
.artif4ct-form hr,
.art3fact-form hr,
.hmake-form hr {
  margin: 30px 0;
}

.editable-content {
  min-height: 1.4em;
  outline: none;
  overflow-wrap: anywhere;
  cursor: text;
}

.editable-content:empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
}

.block h1,
.block h2,
.block h3,
.block h4,
.block h5,
.block h6,
.block p {
  margin: 0;
}

.block h1,
.block h2,
.block h3,
.block h4,
.block h5,
.block h6 {
  line-height: 1.08;
}

.block p {
  line-height: 1.7;
}

.preview {
  padding: 16px;
  position: sticky;
  top: 76px;
}

.list {
  display: grid;
  gap: 10px;
}

.artifact-index-sticky {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "tools";
  align-items: start;
  margin-bottom: 24px;
}

.artifact-index-sticky .toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  gap: 8px;
  overflow: visible;
}

.artifact-actions-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
  overflow: visible;
  padding-bottom: 2px;
}

.artifact-toolbar-row {
  justify-content: flex-start;
  flex-wrap: wrap;
  flex: 0 0 auto;
}

.artifact-actions-row .artifact-toolbar-row + .artifact-toolbar-row {
  border-left: 1px solid var(--line);
  padding-left: 10px;
}

.artifact-search-row {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(112px, 180px) minmax(130px, 220px);
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.artifact-search-row input,
.artifact-search-row select {
  min-height: 36px;
  margin: 0;
  padding-block: 0;
}

.artifact-command-toolbar form {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.artifact-command-toolbar .button,
.artifact-command-toolbar .secondary-button,
.artifact-command-toolbar .danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  white-space: nowrap;
}

.artifact-command-toolbar .artifact-icon-button {
  width: 40px;
  min-width: 40px;
  padding: 0;
}

.artifact-icon-button svg {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
}

.artifact-command-toolbar .danger-button.artifact-icon-button {
  background: var(--danger-soft);
  color: var(--danger);
}

.artifact-command-toolbar .danger-button.artifact-icon-button:hover {
  background: var(--danger-line);
  color: var(--danger-dark);
}

.artifact-icon-button.is-copied {
  background: var(--success-soft);
  color: var(--success);
}

.toolbar-status {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  color: var(--success);
  font-size: 13px;
  font-weight: 850;
  opacity: 0;
  transition: opacity 140ms ease;
  white-space: nowrap;
}

.toolbar-status.is-visible {
  opacity: 1;
}

.artifact-command-toolbar [aria-disabled="true"],
.artifact-command-toolbar button:disabled {
  opacity: 0.48;
  pointer-events: none;
}

.artifact-action-dialog {
  width: min(460px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 20px 60px rgba(29, 37, 39, 0.24);
}

.artifact-action-dialog::backdrop {
  background: var(--overlay);
}

.artifact-action-dialog form,
.artifact-action-dialog label {
  display: grid;
  gap: 10px;
}

.dialog-head,
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.dialog-head h2 {
  margin: 0;
  font-size: 20px;
}

.dialog-actions {
  justify-content: flex-end;
}

.artifact-name-list {
  display: grid;
  gap: 0;
  border-block: 1px solid var(--line);
}

.artifact-list-row[hidden] {
  display: none;
}

.artifact-list-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px;
  gap: 12px;
  align-items: center;
  min-height: 66px;
  border-bottom: 1px solid var(--line);
  border-left: 3px solid transparent;
  border-radius: 0;
  padding: 8px 10px 8px 12px;
  background: var(--panel);
  cursor: pointer;
  outline: none;
  transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.artifact-list-row:last-child {
  border-bottom: 0;
}

.artifact-list-row:hover,
.artifact-row-selected {
  background: var(--accent-soft);
}

.artifact-row-selected {
  border-left-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent-ring);
}

.artifact-list-row:focus-visible {
  border-left-color: var(--accent);
  box-shadow: inset 0 0 0 2px var(--accent-ring-strong);
}

.artifact-row-main {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.artifact-row-main strong {
  min-width: 0;
  color: var(--ink);
  font-size: 16px;
  font-weight: 750;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.type-pill {
  justify-self: end;
  min-width: 50px;
  border-radius: 999px;
  padding: 3px 8px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  text-transform: uppercase;
}

.meta-line {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.25;
}

.artifact-rename-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.artifact-rename-form label {
  display: grid;
  gap: 6px;
  font-weight: 800;
}

.type-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.type-choice {
  min-height: 150px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  display: grid;
  align-content: start;
  gap: 8px;
  background: var(--panel);
  color: var(--ink);
  text-decoration: none;
}

.type-choice:hover {
  border-color: var(--line-strong);
  box-shadow: 0 8px 24px rgba(29, 37, 39, 0.08);
}

.type-choice strong {
  font-size: 20px;
}

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

.artifact-upload-form {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: var(--panel);
  display: grid;
  gap: 14px;
}

.artifact-upload-form h2 {
  margin: 0;
  font-size: 22px;
}

.artifact-upload-form label {
  display: grid;
  gap: 6px;
  font-weight: 800;
}

.upload-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(160px, 220px);
  gap: 10px;
}

.guide-panel {
  display: grid;
  gap: 14px;
  max-width: 860px;
}

.guide-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.guide-panel pre {
  margin: 0;
  padding: 16px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.row {
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 1px 2px rgba(29, 37, 39, 0.04);
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.row:hover {
  border-color: var(--line-strong);
  box-shadow: 0 8px 24px rgba(29, 37, 39, 0.08);
  transform: translateY(-1px);
}

.row h2 {
  margin: 0 0 8px;
  font-size: 21px;
  line-height: 1.2;
}

.row p,
.empty {
  color: var(--muted);
}

.row p {
  margin: 0;
  font-size: 14px;
}

.row .actions {
  justify-content: flex-end;
  flex-wrap: nowrap;
}

.row .actions a {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  color: var(--accent-dark);
  font-weight: 800;
}

.row .actions button {
  min-height: 40px;
}

.actions form {
  display: inline-flex;
}

.public-link {
  overflow-wrap: anywhere;
}

.public-link a {
  color: var(--muted);
  font-size: 13px;
}

.chat-edit-content {
  max-width: 920px;
}

.chat-edit-content .page-head {
  align-items: center;
  margin-bottom: 24px;
}

.chat-edit-content .page-head h1 {
  font-size: clamp(34px, 4vw, 46px);
}

.chat-edit-content .back-link {
  min-height: 40px;
}

.chat-edit-form {
  display: grid;
  gap: 24px;
  max-width: 900px;
}

.chat-edit-section {
  gap: 14px;
}

.chat-edit-section .request-section-head {
  gap: 5px;
}

.chat-edit-section .request-section-head h2 {
  font-size: 16px;
}

.chat-edit-field {
  display: grid;
  gap: 8px;
  font-weight: 800;
  color: var(--ink);
}

.chat-edit-field input {
  min-height: 44px;
}

.chat-edit-form input[readonly] {
  background: var(--bg);
  color: var(--muted);
}

.readonly-copy-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
}

.readonly-copy-field input {
  min-width: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
}

.readonly-copy-field input:focus {
  outline: 0;
}

.readonly-copy-field .secondary-button {
  min-height: 32px;
  margin-right: 6px;
  border-color: transparent;
  padding: 0 10px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}

.readonly-copy-field .secondary-button:hover {
  border-color: var(--line);
  background: var(--panel);
  color: var(--accent-dark);
}

.chat-edit-actions {
  justify-content: flex-start;
  margin-top: 0;
  padding-top: 2px;
}

.chat-edit-artifact-picker {
  gap: 0;
  padding: 0;
  overflow: auto;
}

.chat-edit-artifact-picker .check-list {
  display: grid;
  gap: 0;
}

.chat-context-row {
  min-height: 52px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.chat-context-row:last-child {
  border-bottom: 0;
}

.chat-context-row:hover {
  background: var(--panel-soft);
}

.chat-context-row:has(input:checked) {
  background: var(--accent-soft);
}

.chat-context-row input {
  width: 16px;
  height: 16px;
  min-height: 16px;
  margin: 0;
}

.chat-context-row span {
  min-width: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.25;
}

.chat-context-row small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.chat-artifact-picker {
  max-height: min(48vh, 420px);
  overflow: auto;
}

.chat-artifact-choice {
  padding: 8px;
  border-radius: 8px;
}

.chat-artifact-choice:hover {
  background: var(--bg);
}

.chat-login-card h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.15;
}

.chat-room {
  width: min(1040px, calc(100% - 48px));
  min-height: calc(100vh - 58px);
  margin: 0 auto;
  padding: clamp(32px, 5vh, 48px) 0 44px;
}

.chat-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 14px;
  min-height: clamp(650px, calc(100vh - 150px), 820px);
}

.chat-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: start;
  margin-bottom: 12px;
}

.chat-head h1 {
  margin: 0;
  font-size: clamp(34px, 4.6vw, 50px);
  line-height: 1.04;
  font-weight: 780;
}

.chat-head p {
  max-width: 680px;
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}


.chat-messages {
  min-height: 0;
  height: 100%;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: 0 10px 28px rgba(29, 37, 39, 0.04);
}

.chat-messages:has(.chat-empty-state:not([hidden])) {
  align-content: center;
}

.chat-empty-state {
  align-self: center;
  justify-self: center;
  max-width: 470px;
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 22px 10px;
  color: var(--muted);
  text-align: center;
}

.chat-empty-mark {
  width: 112px;
  height: 112px;
  display: block;
}

.chat-empty-mark img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.chat-empty-mark img.theme-asset-light {
  display: none;
}

:root[data-theme="dark"] .chat-empty-mark img.theme-asset-dark {
  display: none;
}

:root[data-theme="dark"] .chat-empty-mark img.theme-asset-light {
  display: block;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .chat-empty-mark img.theme-asset-dark {
    display: none;
  }

  :root:not([data-theme]) .chat-empty-mark img.theme-asset-light {
    display: block;
  }
}

.chat-empty-state h2 {
  margin: 6px 0 0;
  color: var(--ink);
  font-size: 19px;
  line-height: 1.2;
}

.chat-empty-state p {
  max-width: 360px;
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
}

.chat-suggestions {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.chat-suggestions button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0 10px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.chat-suggestions button:hover {
  border-color: var(--line-strong);
  background: var(--bg);
  color: var(--ink);
}

.chat-message {
  max-width: min(720px, 80%);
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--panel-soft);
}

.chat-message-user {
  justify-self: end;
  max-width: min(640px, 74%);
  background: var(--accent);
  color: white;
  border-bottom-right-radius: 5px;
}

.chat-message-assistant {
  justify-self: start;
  border: 1px solid var(--line);
  border-bottom-left-radius: 5px;
}

.chat-message strong {
  font-size: 12px;
  color: var(--muted);
}

.chat-message-user strong {
  color: rgba(255, 255, 255, 0.78);
}

.chat-message p {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.55;
}

.chat-compose {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  min-height: 58px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: 0 8px 22px rgba(29, 37, 39, 0.04);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.chat-compose:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.chat-compose textarea {
  flex: 1 1 auto;
  min-height: 42px;
  max-height: 144px;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  resize: none;
  background: transparent;
  font-size: 16px;
  line-height: 1.4;
  overflow: auto;
}

.chat-compose textarea:focus {
  outline: none;
  box-shadow: none;
}

.chat-compose button {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 18px;
  gap: 7px;
  border-radius: 9px;
  font-weight: 760;
}

.quiz-create-form,
.artifact-request-form {
  display: grid;
  gap: 18px;
  max-width: 820px;
}

.artifact-request-content {
  width: min(960px, calc(100% - 40px));
}

.artifact-request-content .page-head {
  align-items: center;
  margin-bottom: 20px;
}

.artifact-request-content .page-head h1 {
  font-size: clamp(44px, 4.6vw, 50px);
}

.artifact-request-content .page-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 16px;
  font-weight: 650;
}

.artifact-request-content .back-link {
  min-height: 40px;
}

.artifact-request-form {
  gap: 30px;
  max-width: none;
}

.artifact-request-form .upload-grid {
  grid-template-columns: minmax(0, 7fr) minmax(180px, 3fr);
  gap: 14px;
}

.request-field {
  gap: 6px;
  font-weight: 850;
}

.request-field small,
.request-section-head p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
}

.request-field input,
.request-field select {
  min-height: 44px;
}

.request-context-field textarea {
  min-height: 210px;
}

.request-form-section {
  display: grid;
  gap: 14px;
}

.request-section-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.request-section-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 850;
  line-height: 1.2;
}

.request-section-head > span {
  width: 24px;
  height: 24px;
  display: inline-flex;
  flex: 0 0 24px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--accent-dark);
  background: var(--panel-soft);
  font-size: 12px;
  font-weight: 850;
}

.request-contained-input {
  min-height: 58px;
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.request-llm-controls {
  display: grid;
  grid-template-columns: minmax(140px, 180px) minmax(170px, 1fr) auto;
  align-items: end;
  gap: 10px;
}

.request-llm-status {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 750;
  white-space: nowrap;
}

.request-context-list {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}

.request-context-row,
.request-model-card,
.request-generate-row {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 14px;
}

.request-file-input-row {
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.request-context-row {
  border-bottom: 1px solid var(--line);
}

.request-context-row:last-child {
  border-bottom: 0;
}

.request-context-row-copy,
.request-model-copy {
  min-width: 0;
}

.request-context-row-copy > strong,
.request-model-copy > strong {
  display: block;
  font-weight: 850;
}

.request-context-row-copy > p,
.request-model-copy > p,
.request-generate-row > p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
}

.request-model-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.request-generate-section {
  gap: 12px;
}

.request-generate-row {
  padding: 0;
}

.request-generate-row > button[type="submit"] {
  min-height: 48px;
  padding: 0 18px;
  font-size: 15px;
}

.quiz-create-form fieldset,
.artifact-request-form fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.quiz-create-form legend,
.artifact-request-form legend {
  padding: 0 6px;
  font-weight: 800;
}

.check-list {
  display: grid;
  gap: 8px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--panel);
  font-weight: 700;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.check-row input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.check-row:hover,
.check-row:has(input:focus-visible) {
  border-color: var(--line-strong);
}

.check-row:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
  box-shadow: inset 0 0 0 1px var(--accent-ring);
}

.chat-edit-artifact-picker.request-contained-input {
  gap: 0;
  padding: 0;
  overflow: auto;
}

.chat-edit-artifact-picker .check-list {
  gap: 0;
}

.check-row.chat-context-row {
  min-height: 52px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 0;
  margin: 0;
  padding: 0 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  cursor: pointer;
}

.check-row.chat-context-row:last-child {
  border-bottom: 0;
}

.check-row.chat-context-row:has(input:checked) {
  border-bottom-color: var(--accent-line);
}

.request-asset-picker {
  display: grid;
  gap: 10px;
}

.request-asset-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.request-asset-picker-head span {
  font-weight: 850;
}

.request-selected-assets {
  min-height: 22px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}

.request-selected-artifacts {
  min-height: 22px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}

.request-selected-assets .empty,
.request-selected-artifacts .empty,
.request-contained-input .empty {
  margin: 0;
  font-size: 14px;
}

.request-selected-asset {
  min-width: 0;
  max-width: 230px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 28px;
  gap: 6px;
  align-items: center;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.request-selected-artifact {
  min-width: 0;
  max-width: 260px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.request-native-file {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.request-file-button {
  width: max-content;
  min-height: 40px;
}

.request-native-file:focus + .request-file-button {
  border-color: var(--accent);
  outline: 3px solid var(--accent-ring);
}

.request-native-file:disabled + .request-file-button {
  opacity: 0.58;
  pointer-events: none;
}

.request-file-name {
  display: block;
  margin-top: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.request-file-remove {
  min-height: 36px;
  padding: 0 10px;
  color: var(--accent-dark);
}

.request-loading {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  margin-top: 4px;
  padding: 14px;
  border: 1px solid var(--accent-line);
  border-radius: 8px;
  background: var(--accent-soft);
}

.request-loading strong {
  display: block;
  font-weight: 850;
}

.request-loading p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}

.request-loading-spinner {
  width: 22px;
  height: 22px;
  border: 3px solid var(--accent-line);
  border-top-color: var(--accent);
  border-radius: 999px;
  animation: request-spin 800ms linear infinite;
}

.artifact-request-form.is-submitting {
  cursor: progress;
}

.artifact-request-form.is-submitting input,
.artifact-request-form.is-submitting textarea,
.artifact-request-form.is-submitting select,
.artifact-request-form.is-submitting button,
.artifact-request-form.is-submitting .request-file-button {
  cursor: progress;
}

@keyframes request-spin {
  to {
    transform: rotate(360deg);
  }
}

.request-selected-asset img {
  width: 42px;
  height: 34px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
}

.request-selected-asset div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.request-selected-artifact div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.request-selected-asset strong,
.request-selected-asset span,
.request-selected-artifact strong,
.request-selected-artifact span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.request-selected-asset strong,
.request-selected-artifact strong {
  font-size: 13px;
}

.request-selected-asset span,
.request-selected-artifact span {
  color: var(--muted);
  font-size: 12px;
}

.request-selected-asset .icon-button,
.request-selected-artifact .icon-button {
  width: 28px;
  min-height: 28px;
  background: transparent;
  color: var(--muted);
}

.request-selected-asset .icon-button:hover,
.request-selected-artifact .icon-button:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.request-assets-dialog,
.request-artifacts-dialog {
  width: min(1040px, calc(100% - 28px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 24px 80px rgba(29, 37, 39, 0.25);
}

.request-assets-dialog::backdrop,
.request-artifacts-dialog::backdrop {
  background: var(--overlay);
}

.request-assets-panel,
.request-artifacts-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.request-asset-choice-grid,
.request-artifact-choice-grid {
  max-height: min(58vh, 560px);
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 8px;
  padding-right: 2px;
}

.request-artifact-choice-grid {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.request-asset-choice {
  min-height: 0;
  display: grid;
  gap: 5px;
  justify-items: stretch;
  padding: 6px;
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: left;
}

.request-asset-choice:hover,
.request-asset-selected {
  background: var(--panel);
  border-color: var(--accent);
  box-shadow: 0 8px 20px rgba(29, 37, 39, 0.08);
}

.request-artifact-choice {
  min-height: 72px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 12px;
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: left;
}

.request-artifact-choice:hover,
.request-artifact-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.request-artifact-choice span,
.request-artifact-choice small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.request-artifact-choice span {
  font-weight: 850;
}

.request-artifact-choice small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.request-asset-choice img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--bg);
}

.request-asset-choice span,
.request-asset-choice small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.request-asset-choice span {
  font-size: 12px;
  font-weight: 850;
}

.request-asset-choice small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.response-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
}

.response-table th,
.response-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.response-table th {
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 13px;
  text-transform: uppercase;
}

.response-table tr:last-child td {
  border-bottom: 0;
}

.asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 8px;
}

.asset-card {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.asset-card:hover,
.asset-row-selected {
  border-color: var(--accent);
  box-shadow: 0 8px 22px rgba(29, 37, 39, 0.08);
}

.asset-row-selected {
  background: var(--accent-soft);
}

.asset-card:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.asset-card:hover {
  transform: translateY(-1px);
}

.asset-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 6px;
  background: var(--bg);
  border: 1px solid var(--line);
}

.asset-thumb img {
  width: 100%;
  height: 100%;
  border-radius: 0;
  object-fit: contain;
}

.asset-row-main {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.asset-row-main strong,
.asset-row-main span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-row-main strong {
  font-size: 12px;
  line-height: 1.25;
}

.asset-row-main .meta-line {
  font-size: 10px;
}

.asset-actions-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  overflow-x: auto;
}

.asset-toolbar-row {
  flex: 0 0 auto;
  display: inline-flex;
  gap: 6px;
}

.asset-icon-button {
  width: 40px;
  min-height: 40px;
  padding: 0;
}

.asset-icon-button svg {
  width: 19px;
  height: 19px;
}

.asset-toolbar-upload,
.asset-toolbar-rename,
.asset-toolbar-delete {
  display: grid;
  gap: 14px;
}

.asset-toolbar-upload input[type="file"] {
  padding: 7px;
}

.asset-toolbar-upload input[type="file"]::file-selector-button {
  min-height: 30px;
  margin-right: 10px;
  border: 0;
  border-radius: 7px;
  padding: 0 11px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font: inherit;
  font-weight: 800;
}

.dialog-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.data-card {
  padding: 16px 18px;
}

.restore-form {
  width: min(560px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.asset-grid figcaption {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.asset-chooser {
  width: min(760px, calc(100% - 28px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 24px 80px rgba(29, 37, 39, 0.25);
}

.asset-chooser::backdrop {
  background: var(--overlay);
}

.asset-chooser-panel {
  padding: 18px;
  display: grid;
  gap: 14px;
}

.asset-chooser-head,
.asset-chooser-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.asset-chooser-head h2 {
  margin: 0;
}

.asset-choice-grid {
  max-height: min(520px, 60vh);
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.asset-choice {
  min-height: auto;
  padding: 8px;
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  text-align: left;
}

.asset-choice:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.asset-choice img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: var(--bg);
}

.asset-choice span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.artifact {
  max-width: 820px;
}

.artifact h1 {
  font-size: clamp(32px, 5vw, 56px);
  line-height: 1.02;
}

.markdown {
  font-size: 18px;
  line-height: 1.7;
}

.markdown pre {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--panel-soft);
  line-height: 1.55;
}

.markdown code {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 5px;
  background: var(--panel-soft);
  font-size: 0.92em;
}

.markdown pre code {
  border: 0;
  padding: 0;
  background: transparent;
  font-size: 0.9em;
}

.markdown .chroma {
  background: transparent;
}

.markdown .chroma .c,
.markdown .chroma .c1,
.markdown .chroma .cm,
.markdown .chroma .cp {
  color: #6a737d;
  font-style: italic;
}

.markdown .chroma .k,
.markdown .chroma .kc,
.markdown .chroma .kd,
.markdown .chroma .kn,
.markdown .chroma .kp,
.markdown .chroma .kr,
.markdown .chroma .kt {
  color: #d73a49;
  font-weight: 700;
}

.markdown .chroma .s,
.markdown .chroma .s1,
.markdown .chroma .s2,
.markdown .chroma .sa,
.markdown .chroma .sb,
.markdown .chroma .sc,
.markdown .chroma .sd,
.markdown .chroma .se,
.markdown .chroma .sh,
.markdown .chroma .si,
.markdown .chroma .sr,
.markdown .chroma .ss {
  color: #032f62;
}

.markdown .chroma .m,
.markdown .chroma .mi,
.markdown .chroma .mf,
.markdown .chroma .mh {
  color: #005cc5;
}

.markdown .chroma .na,
.markdown .chroma .nb,
.markdown .chroma .nc,
.markdown .chroma .nf,
.markdown .chroma .nx {
  color: #6f42c1;
}

.markdown .chroma .nt {
  color: #22863a;
}

.markdown .chroma .o,
.markdown .chroma .ow {
  color: #d73a49;
}

:root[data-theme="dark"] .markdown .chroma .c,
:root[data-theme="dark"] .markdown .chroma .c1,
:root[data-theme="dark"] .markdown .chroma .cm,
:root[data-theme="dark"] .markdown .chroma .cp {
  color: #8b949e;
}

:root[data-theme="dark"] .markdown .chroma .k,
:root[data-theme="dark"] .markdown .chroma .kc,
:root[data-theme="dark"] .markdown .chroma .kd,
:root[data-theme="dark"] .markdown .chroma .kn,
:root[data-theme="dark"] .markdown .chroma .kp,
:root[data-theme="dark"] .markdown .chroma .kr,
:root[data-theme="dark"] .markdown .chroma .kt,
:root[data-theme="dark"] .markdown .chroma .o,
:root[data-theme="dark"] .markdown .chroma .ow {
  color: #ff7b72;
}

:root[data-theme="dark"] .markdown .chroma .s,
:root[data-theme="dark"] .markdown .chroma .s1,
:root[data-theme="dark"] .markdown .chroma .s2,
:root[data-theme="dark"] .markdown .chroma .sa,
:root[data-theme="dark"] .markdown .chroma .sb,
:root[data-theme="dark"] .markdown .chroma .sc,
:root[data-theme="dark"] .markdown .chroma .sd,
:root[data-theme="dark"] .markdown .chroma .se,
:root[data-theme="dark"] .markdown .chroma .sh,
:root[data-theme="dark"] .markdown .chroma .si,
:root[data-theme="dark"] .markdown .chroma .sr,
:root[data-theme="dark"] .markdown .chroma .ss {
  color: #a5d6ff;
}

:root[data-theme="dark"] .markdown .chroma .m,
:root[data-theme="dark"] .markdown .chroma .mi,
:root[data-theme="dark"] .markdown .chroma .mf,
:root[data-theme="dark"] .markdown .chroma .mh {
  color: #79c0ff;
}

:root[data-theme="dark"] .markdown .chroma .na,
:root[data-theme="dark"] .markdown .chroma .nb,
:root[data-theme="dark"] .markdown .chroma .nc,
:root[data-theme="dark"] .markdown .chroma .nf,
:root[data-theme="dark"] .markdown .chroma .nx {
  color: #d2a8ff;
}

:root[data-theme="dark"] .markdown .chroma .nt {
  color: #7ee787;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .markdown .chroma .c,
  :root:not([data-theme]) .markdown .chroma .c1,
  :root:not([data-theme]) .markdown .chroma .cm,
  :root:not([data-theme]) .markdown .chroma .cp {
    color: #8b949e;
  }

  :root:not([data-theme]) .markdown .chroma .k,
  :root:not([data-theme]) .markdown .chroma .kc,
  :root:not([data-theme]) .markdown .chroma .kd,
  :root:not([data-theme]) .markdown .chroma .kn,
  :root:not([data-theme]) .markdown .chroma .kp,
  :root:not([data-theme]) .markdown .chroma .kr,
  :root:not([data-theme]) .markdown .chroma .kt,
  :root:not([data-theme]) .markdown .chroma .o,
  :root:not([data-theme]) .markdown .chroma .ow {
    color: #ff7b72;
  }

  :root:not([data-theme]) .markdown .chroma .s,
  :root:not([data-theme]) .markdown .chroma .s1,
  :root:not([data-theme]) .markdown .chroma .s2,
  :root:not([data-theme]) .markdown .chroma .sa,
  :root:not([data-theme]) .markdown .chroma .sb,
  :root:not([data-theme]) .markdown .chroma .sc,
  :root:not([data-theme]) .markdown .chroma .sd,
  :root:not([data-theme]) .markdown .chroma .se,
  :root:not([data-theme]) .markdown .chroma .sh,
  :root:not([data-theme]) .markdown .chroma .si,
  :root:not([data-theme]) .markdown .chroma .sr,
  :root:not([data-theme]) .markdown .chroma .ss {
    color: #a5d6ff;
  }

  :root:not([data-theme]) .markdown .chroma .m,
  :root:not([data-theme]) .markdown .chroma .mi,
  :root:not([data-theme]) .markdown .chroma .mf,
  :root:not([data-theme]) .markdown .chroma .mh {
    color: #79c0ff;
  }

  :root:not([data-theme]) .markdown .chroma .na,
  :root:not([data-theme]) .markdown .chroma .nb,
  :root:not([data-theme]) .markdown .chroma .nc,
  :root:not([data-theme]) .markdown .chroma .nf,
  :root:not([data-theme]) .markdown .chroma .nx {
    color: #d2a8ff;
  }

  :root:not([data-theme]) .markdown .chroma .nt {
    color: #7ee787;
  }
}

.public-footer {
  width: min(820px, calc(100% - 40px));
  margin: -10px auto 40px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.quiz-wrap {
  max-width: 820px;
}

.artif4ct-quiz,
.artif4ct-form,
.art3fact-quiz,
.art3fact-form,
.hmake-quiz,
.hmake-form {
  padding: 22px;
  display: grid;
  gap: 22px;
}

.quiz-question,
.form-question {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  margin: 0;
  display: grid;
  gap: 12px;
  background: var(--panel);
}

.quiz-question legend,
.form-question legend {
  float: left;
  width: 100%;
  margin: 0 0 12px;
  padding: 0;
  color: var(--ink);
  font-size: 18px;
  font-weight: 850;
  line-height: 1.35;
}

.quiz-question legend::after,
.form-question legend::after {
  content: "";
  display: block;
  clear: both;
}

.answer-option {
  min-height: 48px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  font-weight: 700;
  line-height: 1.35;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.answer-option:hover,
.answer-option:has(input:focus-visible) {
  border-color: var(--line-strong);
  background: var(--panel);
  box-shadow: 0 4px 14px rgba(29, 37, 39, 0.06);
}

.answer-option:has(input:checked) {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.answer-option span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.quiz-question input[type="radio"],
.quiz-question input[type="checkbox"],
.form-question input[type="radio"],
.form-question input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 0;
  padding: 0;
  accent-color: var(--accent);
}

.form-question > input,
.form-question > textarea {
  margin-top: 2px;
}

.artif4ct-quiz > button[type="submit"],
.artif4ct-form > button[type="submit"],
.art3fact-quiz > button[type="submit"],
.art3fact-form > button[type="submit"],
.hmake-quiz > button[type="submit"],
.hmake-form > button[type="submit"] {
  min-height: 52px;
  margin-top: 4px;
}

@media (max-width: 860px) {
  .topbar {
    gap: 12px;
    padding: 0 12px;
  }

  .topbar-with-content {
    grid-template-columns: minmax(72px, auto) minmax(0, 1fr) auto;
  }

  .brand-logo {
    width: 96px;
  }

  .landing {
    padding-top: 32px;
  }

  .landing-hero {
    grid-template-columns: 1fr;
    gap: 24px;
    min-height: 0;
    padding: 20px 0 36px;
  }

  .landing h1 {
    font-size: clamp(42px, 12vw, 64px);
  }

  .hero-copy {
    font-size: 18px;
  }

  .hero-artifact-visual {
    justify-self: center;
    width: min(100%, 520px);
    min-height: 430px;
  }

  .hero-artifact-icon {
    width: min(68vw, 280px);
    margin: 0;
  }

  .hero-orbit {
    width: min(82vw, 380px);
  }

  .hero-preview {
    left: 0;
    bottom: 0;
    width: min(190px, 42%);
  }

  .hero-fragment-one {
    top: 10px;
    left: 2%;
  }

  .hero-fragment-two {
    top: 72px;
    right: 2%;
  }

  .hero-fragment-three {
    display: none;
  }

  .feature-intro {
    margin-top: 0;
  }

  .feature-grid {
    grid-template-columns: 1fr;
  }

  .feature-grid article {
    min-height: 0;
  }

  .nav-title-input {
    width: 100%;
  }

  .page-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .usage-page-head {
    align-items: stretch;
    flex-direction: column;
  }

  .usage-month-picker {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .usage-month-picker label {
    flex: 1 1 180px;
  }

  .usage-primary-grid,
  .usage-metric-band {
    grid-template-columns: 1fr;
  }

  .usage-primary-card {
    min-height: 124px;
  }

  .usage-section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .usage-metric-band article,
  .usage-metric-band article:first-child {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding: 12px 0 0;
  }

  .usage-metric-band article:first-child {
    border-top: 0;
    padding-top: 0;
  }

  .row {
    align-items: flex-start;
    flex-direction: column;
  }

  .type-grid,
  .upload-grid {
    grid-template-columns: 1fr;
  }

  .artifact-search-row {
    grid-template-columns: 1fr;
  }

  .restore-form {
    grid-template-columns: 1fr;
  }

  .artifact-index-sticky .toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .artifact-actions-row {
    overflow: visible;
  }

  .artifact-actions-row .artifact-toolbar-row + .artifact-toolbar-row {
    border-left: 0;
    padding-left: 0;
  }

  .artifact-command-toolbar form {
    align-items: center;
    flex-direction: row;
  }

  .artifact-command-toolbar a,
  .artifact-command-toolbar button,
  .artifact-command-toolbar input {
    width: auto;
  }

  .artifact-search-row input,
  .artifact-search-row select {
    width: 100%;
  }

  .artifact-index-sticky {
    margin-bottom: 18px;
  }

  .row .actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .editor-sticky {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "tools save";
    overflow: visible;
  }

  .editor-sticky .editor-header {
    display: contents;
  }

  .editor-sticky .title-input {
    max-width: 100%;
    min-width: 0;
  }

  .editor-header button[type="submit"] {
    width: auto;
  }

  .editor-sticky .editor-header button[type="submit"] {
    font-size: 14px;
    padding: 0 12px;
    width: auto;
  }

  .editor-actions {
    gap: 6px;
  }

  .preview-button,
  .autosave-status {
    padding-inline: 10px;
  }

  .editor-sticky .toolbar {
    align-items: stretch;
    display: flex;
    min-width: 0;
    overflow: visible;
    padding-bottom: 2px;
  }

  .artifact-index-sticky .toolbar {
    align-items: stretch;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    overflow: visible;
  }

  .editor-sticky-form .toolbar {
    align-items: center;
    display: grid;
    overflow: visible;
  }

  .toolbar-format-row {
    justify-content: flex-start;
  }

  .question-settings-grid {
    grid-template-columns: 1fr;
  }

  .option-row {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .option-correct,
  .add-option-button {
    width: 100%;
  }

  .editor-sticky .toolbar > button {
    flex: 0 1 auto;
  }

  .format-tools {
    flex-wrap: nowrap;
  }
}

@media (max-width: 560px) {
  .content,
  .workspace,
  .artifact,
  .quiz-wrap,
  .landing {
    width: min(100% - 32px, 1240px);
  }

  .artifact-request-content {
    width: min(100% - 32px, 960px);
  }

  .request-context-row,
  .request-model-card,
  .request-generate-row,
  .request-llm-controls,
  .request-file-input-row {
    grid-template-columns: 1fr;
  }

  .request-context-row,
  .request-model-card {
    align-items: stretch;
  }

  .request-generate-row > button[type="submit"] {
    width: 100%;
  }

  .request-llm-status {
    min-height: 24px;
    white-space: normal;
  }

  .chat-room {
    width: min(100% - 32px, 1040px);
    min-height: calc(100vh - 58px);
    padding: 26px 0 34px;
  }

  .chat-shell {
    min-height: calc(100vh - 118px);
    grid-template-rows: auto minmax(340px, 1fr) auto;
  }

  .chat-head {
    grid-template-columns: 1fr;
    margin-bottom: 8px;
  }


  .chat-messages {
    padding: 18px;
  }

  .chat-compose {
    gap: 7px;
    padding: 6px;
  }

  .chat-compose button {
    min-height: 42px;
    padding: 0 13px;
  }

  .chat-compose button span:first-child {
    display: none;
  }

  .chat-message,
  .chat-message-user {
    max-width: 90%;
  }

  .chat-suggestions {
    align-items: center;
  }

  .chat-suggestions button {
    max-width: 100%;
  }

  .asset-grid,
  .request-asset-choice-grid,
  .request-artifact-choice-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .block:has(.question-editor) {
    padding: 18px 12px 16px 44px;
  }
}
