:root {
  color-scheme: dark;
  --bg-0: #120f0c;
  --bg-1: #1a1511;
  --bg-2: #261f19;
  --surface-0: #17120e;
  --surface-1: #1d1712;
  --surface-2: #262019;
  --line: #433628;
  --line-soft: #342a20;
  --text: #f4eee6;
  --muted: #b9aa95;
  --accent: #e4ba68;
  --accent-strong: #f2d79d;
  --accent-ink: #2c1b04;
  --accent-soft: rgba(228, 186, 104, 0.14);
  --field-border: #6d5840;
  --field-border-soft: #5a4834;
  --field-bg: #17120e;
  --field-bg-soft: #201913;
  --field-bg-strong: #2f2418;
  --shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
  --danger: #d8847a;
  --tap: 44px;
  --radius: 14px;
  --font-ui: "Aptos", "Segoe UI Variable Text", "SF Pro Text", "Inter", "Noto Sans", "Roboto", sans-serif;
  --font-display: "Aptos Display", "Segoe UI Variable Display", "SF Pro Display", "Inter", "Noto Sans", "Roboto", sans-serif;
  --type-xs: 0.84rem;
  --type-sm: 0.91rem;
  --type-base: 1rem;
  --type-md: 1.05rem;
  --type-lg: 1.16rem;
  --leading-snug: 1.32;
  --leading-normal: 1.5;
  --leading-relaxed: 1.62;
  --tracking-normal: 0.01em;
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-bottom-tappable: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  min-height: 100%;
}

html {
  background-color: #120f0c;
  background:
    radial-gradient(circle at top, rgba(228, 186, 104, 0.18) 0%, rgba(228, 186, 104, 0.04) 18%, transparent 36%),
    repeating-linear-gradient(
      180deg,
      #201913 0px,
      #19130f 640px,
      #120f0c 1280px,
      #17120e 1920px,
      #201913 2560px
    );
  scrollbar-color: #6b5941 #15110d;
}

* {
  scrollbar-width: thin;
  scrollbar-color: #6b5941 #15110d;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  background: #15110d;
}

*::-webkit-scrollbar-thumb {
  background: #6b5941;
  border: 2px solid #15110d;
  border-radius: 999px;
}

*::-webkit-scrollbar-thumb:hover {
  background: #836b4d;
}

body {
  background: transparent;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: var(--type-base);
  line-height: var(--leading-relaxed);
  letter-spacing: var(--tracking-normal);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

button,
input,
textarea {
  font: inherit;
}

.auth-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: max(16px, var(--safe-top)) max(14px, var(--safe-right)) max(16px, var(--safe-bottom)) max(14px, var(--safe-left));
}

.auth-card {
  width: min(100%, 330px);
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-1);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
}

.auth-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 16px;
  color: var(--accent-strong);
  font-family: var(--font-display);
  font-size: 0.94rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.auth-brand img {
  width: 28px;
  height: 28px;
  border-radius: 8px;
}

.auth-form {
  display: grid;
  gap: 9px;
}

.auth-form h1 {
  margin: 0 0 2px;
  text-align: center;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 0.84rem;
  line-height: 1.25;
  letter-spacing: 0.02em;
}

.auth-copy {
  margin-top: -7px;
  color: var(--muted);
  line-height: 1.55;
}

.auth-field {
  display: block;
}

.auth-field > span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.auth-field input {
  min-height: 40px;
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--field-border);
  border-radius: 10px;
  outline: none;
  background: var(--field-bg);
  color: var(--text);
  font-size: 0.82rem;
}

.auth-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.auth-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 3px;
}

.auth-icon-button {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--field-border);
  border-radius: 10px;
  background: var(--surface-0);
  color: var(--muted);
  cursor: pointer;
}

.auth-icon-button.is-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}

.auth-button-icon {
  display: block;
  width: 16px;
  height: 16px;
}

.auth-status {
  min-height: 1.35em;
  margin: 10px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
}

.auth-status[data-kind="error"] {
  color: var(--danger);
}

.auth-status[data-kind="success"] {
  color: #a9d39d;
}

.auth-recovery-title {
  margin: 0;
  text-align: center;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 0.84rem;
  font-weight: 700;
}

#app-root.is-signing-out {
  pointer-events: none;
}

.auth-form :disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.startup-loading-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: max(24px, var(--safe-top)) max(18px, var(--safe-right)) max(24px, var(--safe-bottom)) max(18px, var(--safe-left));
}

.startup-loading-card {
  width: min(100%, 330px);
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(160deg, rgba(38, 32, 25, 0.98), rgba(23, 18, 14, 0.98));
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.38);
}

.startup-loading-track {
  height: 10px;
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--field-bg);
}

.startup-loading-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
  transition: width 260ms ease;
}

.startup-loading-percent {
  margin-top: 8px;
  color: var(--accent-strong);
  font-size: var(--type-sm);
  font-weight: 800;
  text-align: right;
}

.startup-loading-card .auth-brand,
.startup-recovery-card .auth-brand {
  margin-bottom: 16px;
  font-size: 1.05rem;
}

.startup-loading-card .auth-brand img,
.startup-recovery-card .auth-brand img {
  width: 30px;
  height: 30px;
}

.startup-recovery-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: max(24px, var(--safe-top)) max(18px, var(--safe-right)) max(24px, var(--safe-bottom)) max(18px, var(--safe-left));
}

.startup-recovery-card {
  width: min(100%, 330px);
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(160deg, rgba(38, 32, 25, 0.98), rgba(23, 18, 14, 0.98));
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.38);
}

.startup-recovery-message {
  color: var(--muted);
  font-size: var(--type-sm);
  line-height: var(--leading-normal);
}

.startup-recovery-actions {
  display: flex;
  gap: 8px;
  margin-top: 18px;
}

.startup-recovery-icon {
  display: block;
  width: 18px;
  height: 18px;
}

.remote-library-overlay {
  position: fixed;
  z-index: 120;
  inset: 0;
}

.remote-library-overlay[hidden] {
  display: none;
}

.remote-library-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 6, 4, 0.76);
  backdrop-filter: blur(4px);
}

.remote-library-panel {
  --library-control-size: 30px;
  --library-inline-gap: 4px;
  position: absolute;
  top: 0;
  right: 0;
  width: min(100%, 430px);
  height: 100%;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto auto;
  overflow: hidden;
  padding: max(8px, var(--safe-top)) max(8px, var(--safe-right)) max(8px, var(--safe-bottom)) max(8px, var(--safe-left));
  border-left: 1px solid var(--line);
  background: var(--surface-1);
  box-shadow: -24px 0 60px rgba(0, 0, 0, 0.34);
}

.remote-library-header {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 6px;
  padding-bottom: 7px;
  background: var(--surface-1);
}

.remote-library-tab-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  align-items: center;
  gap: 4px;
}

.remote-library-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}

.remote-library-tab-row .remote-library-close {
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
  border-radius: 10px;
}

.remote-library-tab {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.remote-library-tab.is-active {
  border-color: var(--line);
  background: var(--surface-0);
  color: var(--accent-strong);
}

.remote-library-tab .remote-library-action-icon {
  width: 15px;
  height: 15px;
}

.remote-library-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.remote-library-primary-actions,
.remote-library-account-actions,
.remote-account-confirm-actions,
.remote-import-confirm-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.remote-account-confirm[hidden],
.remote-import-confirm[hidden] {
  display: none;
}

.remote-account-confirm,
.remote-import-confirm {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 10px;
  margin-top: 7px;
  padding: 9px;
  border: 1px solid rgba(183, 99, 83, 0.5);
  border-radius: 10px;
  background: var(--surface-0);
}

.remote-import-confirm {
  border-color: var(--line);
}

.remote-account-confirm p,
.remote-account-confirm span,
.remote-import-confirm p,
.remote-import-confirm span {
  margin: 0;
  font-size: 0.74rem;
  line-height: 1.3;
}

.remote-account-confirm p,
.remote-import-confirm p {
  color: var(--text);
  font-weight: 700;
}

.remote-account-confirm span,
.remote-import-confirm span {
  color: var(--muted);
}

.remote-account-confirm-actions,
.remote-import-confirm-actions {
  grid-column: 2;
  grid-row: 1 / span 2;
}

.remote-account-confirm .icon-ghost,
.remote-import-confirm .icon-ghost,
.remote-library-primary-actions .icon-ghost,
.remote-library-account-actions .icon-ghost {
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
  border-radius: 10px;
}

.icon-ghost.is-danger {
  border-color: rgba(183, 99, 83, 0.65);
  color: var(--danger);
}

.startup-sync-warning {
  position: fixed;
  z-index: 80;
  right: max(18px, var(--safe-right));
  bottom: max(18px, var(--safe-bottom));
  max-width: min(420px, calc(100vw - 36px));
  padding: 10px 14px;
  border: 1px solid var(--field-border);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--accent-strong);
  box-shadow: var(--shadow);
  font-size: var(--type-sm);
}

.startup-sync-warning:empty {
  display: none;
}

.local-durability {
  position: fixed;
  z-index: 81;
  left: 50%;
  bottom: max(18px, var(--safe-bottom));
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: min(410px, calc(100vw - var(--safe-left) - var(--safe-right) - 20px));
  padding: 9px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--muted);
  box-shadow: var(--shadow);
  font-size: var(--type-xs);
  transform: translateX(-50%);
}

.local-durability[hidden],
.local-durability [hidden] {
  display: none !important;
}

.local-durability[data-state="pending"] {
  color: var(--accent-strong);
}

.local-durability[data-state="error"] {
  border-color: var(--danger);
  color: var(--danger);
}

.local-durability .icon-ghost {
  flex: 0 0 auto;
}

.empty-state-copy,
.remote-library-status {
  margin: 0;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 400;
  line-height: 1.35;
  letter-spacing: var(--tracking-normal);
}

.remote-library-status {
  padding: 2px 4px 0;
}

.remote-library-status:empty {
  display: none;
}

.remote-library-progress {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 10px;
  row-gap: 10px;
  max-height: 34dvh;
  margin: 7px 0 0;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.remote-library-progress[hidden] {
  display: none;
}

.remote-library-progress-track {
  flex: 1 1 auto;
  height: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--field-bg);
}

.remote-library-progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
  transition: width 260ms ease;
}

.remote-library-progress-percent {
  min-width: 3.3em;
  color: var(--accent-strong);
  font-size: var(--type-sm);
  font-weight: 800;
  text-align: right;
}

.remote-library-progress-log {
  grid-column: 1 / -1;
  display: grid;
  gap: 5px;
  list-style: none;
}

.remote-library-progress-log li {
  display: flex;
  gap: 8px;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 400;
  line-height: 1.35;
}

.remote-library-progress-log-value {
  flex: 0 0 3.1em;
  color: var(--accent-strong);
  font-weight: 750;
  text-align: right;
}

.remote-library-content {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
  scrollbar-gutter: stable;
}

.remote-library-section {
  display: grid;
  gap: 5px;
}

.remote-library-view > .centered-section-heading-row {
  display: none;
}

.remote-library-view[hidden],
.remote-catalog-search[hidden] {
  display: none;
}

.remote-library-course-list {
  gap: 5px;
}

.remote-study-path-create,
.remote-catalog-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
}

.remote-study-path-rename[hidden] {
  display: none;
}

.remote-study-path-create input,
.remote-catalog-search input {
  min-width: 0;
  height: 34px;
  padding: 0 11px;
  border: 1px solid var(--field-border);
  border-radius: 10px;
  background: var(--field-bg);
  color: var(--text);
  font: inherit;
  font-size: 0.8rem;
}

.remote-catalog-search {
  grid-template-columns: auto minmax(0, 1fr);
  min-height: 36px;
  padding: 0 9px;
  border: 1px solid var(--field-border);
  border-radius: 10px;
  background: var(--field-bg);
  color: var(--muted);
}

.remote-catalog-search input {
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
}

.remote-study-path-card {
  display: grid;
  gap: 0;
  padding: 0;
  overflow: hidden;
}

.remote-study-path-card > summary {
  list-style: none;
  cursor: pointer;
}

.remote-study-path-card > summary::-webkit-details-marker {
  display: none;
}

.remote-study-path-body {
  display: grid;
  gap: 0;
  padding: 0 6px 6px;
  border-top: 1px solid var(--line-soft);
}

.remote-study-path-header,
.remote-study-path-course-row,
.remote-study-path-choice {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.remote-catalog-collection > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.remote-study-path-header {
  min-height: 38px;
  padding: 4px 6px 4px 9px;
}

.remote-study-path-header .card-title,
.remote-study-path-course-row > span,
.remote-study-path-choice > span,
.remote-catalog-collection > summary > span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.remote-inline-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: var(--library-inline-gap);
}

.remote-study-path-header .remote-course-action:disabled {
  opacity: 0.3;
}

.remote-study-path-course-list,
.remote-loose-course-paths {
  display: grid;
  gap: 0;
}

.remote-collection-courses {
  display: grid;
  gap: 4px;
}

.remote-loose-course {
  display: grid;
  gap: 0;
}

.remote-loose-course-paths {
  margin: 0;
  padding: 0 0 4px 12px;
}

.remote-loose-course-paths[hidden] {
  display: none;
}

.remote-study-path-course-row,
.remote-study-path-choice {
  min-height: 36px;
  padding: 3px 0 3px 6px;
  border-top: 1px solid var(--line-soft);
  color: var(--text);
  font-size: 0.78rem;
  line-height: 1.25;
}

.remote-study-path-course-list > :first-child > .remote-study-path-course-row,
.remote-study-path-course-list > .remote-study-path-course-row:first-child {
  border-top: 0;
}

.remote-study-path-course-row.is-recently-moved {
  background: var(--accent-soft);
}

.remote-study-path-choice {
  width: 100%;
  min-height: 34px;
  padding-left: 9px;
  border-top: 0;
  border-left: 1px solid var(--line-soft);
  border-radius: 0 8px 8px 0;
  background: rgba(228, 186, 104, 0.035);
  color: var(--muted);
  text-align: left;
}

.remote-study-path-choice .remote-course-action {
  flex: 0 0 auto;
}

.remote-study-path-course-list > .remote-library-empty {
  min-height: 36px;
  display: flex;
  align-items: center;
  padding: 4px 6px;
  font-size: 0.8rem;
}

.remote-catalog-collection {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-0);
}

.remote-catalog-collection > summary {
  min-height: 36px;
  padding: 5px 9px;
  cursor: pointer;
  list-style: none;
  font-family: var(--font-ui);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.25;
}

.remote-catalog-collection > summary::-webkit-details-marker {
  display: none;
}

.remote-collection-courses {
  padding: 0 5px 5px;
}

.remote-collection-courses .remote-course-card,
.remote-study-paths .remote-course-card {
  display: flex;
  min-height: 40px;
  align-items: center;
  gap: 6px;
  padding: 4px 5px 4px 8px;
  border-radius: 9px;
}

.remote-collection-courses .card-subtitle,
.remote-study-paths .card-subtitle {
  display: none;
}

.remote-collection-courses .remote-course-card.is-selected {
  border-color: rgba(108, 181, 95, 0.38);
  background: rgba(108, 181, 95, 0.07);
}

.remote-collection-courses .remote-course-card.is-selected .card-title {
  color: #cfe8c7;
}

.remote-library-panel .remote-course-card .navigation-main {
  flex: 1 1 auto;
  min-width: 0;
}

.remote-library-panel .remote-course-card .card-title,
.remote-study-path-course-row > span {
  overflow: hidden;
  font-family: var(--font-ui);
  color: #f6ead6;
  font-size: 0.8rem;
  font-weight: 400;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.remote-library-panel .remote-study-path-header .card-title {
  font-family: var(--font-ui);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.25;
}

.remote-library-panel .remote-course-actions {
  flex: 0 0 auto;
  align-self: center;
}

.remote-library-panel .remote-course-action,
.remote-library-panel .remote-course-pending {
  min-width: var(--library-control-size);
  min-height: var(--library-control-size);
  width: var(--library-control-size);
  height: var(--library-control-size);
  margin: 0;
  padding: 5px;
  border-radius: 9px;
  line-height: 1;
}

.remote-sync-issue {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 15px;
  border: 1px solid var(--warning-border, #8b6233);
  border-radius: var(--radius);
  background: var(--surface-0);
}

.remote-sync-issue p {
  flex-basis: 100%;
  color: var(--muted);
  font-size: var(--type-sm);
}

.remote-course-action {
  margin-top: 0;
}

.remote-course-pending {
  display: inline-grid;
  place-items: center;
  min-width: 40px;
  min-height: 40px;
  border: 1px solid var(--field-border);
  border-radius: 12px;
  color: var(--accent-strong);
}

.remote-library-action-icon {
  display: block;
  width: 16px;
  height: 16px;
}

.remote-library-footer {
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px solid var(--line-soft);
}

.remote-library-footer .icon-ghost {
  min-width: 34px;
  min-height: 34px;
  width: 34px;
  height: 34px;
  border-radius: 10px;
}

.remote-library-primary-actions [data-library-import-file] {
  display: none;
}

.home-study-path {
  display: grid;
  gap: 8px;
}

.home-study-path + .home-study-path {
  margin-top: 10px;
}

.home-study-path-heading {
  gap: 6px;
}

.home-study-path-icon {
  width: 16px;
  height: 16px;
  color: var(--accent-strong);
}

.home-study-path-courses {
  gap: 8px;
}

.home-study-path-empty {
  margin: 0;
  text-align: center;
}

select,
option {
  font: inherit;
}

button {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.topbar {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding-top: max(var(--safe-top), 8px);
  padding-right: var(--shell-scrollbar-comp);
}

.lesson-topbar {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  padding-left: 12px;
  position: relative;
  isolation: isolate;
}

.lesson-topbar::before {
  content: "";
  position: absolute;
  inset: 0 -10px 0;
  z-index: -1;
  pointer-events: none;
  background: transparent;
}

.navigation-topbar {
  gap: 10px;
  padding-top: max(var(--safe-top), 8px);
  padding-right: calc(var(--shell-scrollbar-comp) + 12px);
}

.navigation-topbar .lesson-top-actions {
  gap: 4px;
}

.navigation-topbar .topbar-space {
  width: 40px;
  height: 40px;
}

.navigation-topbar .icon-ghost {
  min-width: 40px;
  min-height: 40px;
  width: 40px;
  height: 40px;
  border-radius: 12px;
}

.navigation-topbar .topbar-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: 0.01em;
  color: #fff4e4;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lesson-top-actions,
.topbar-space {
  min-height: 40px;
}

.lesson-top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  position: relative;
  z-index: 1;
}

.topbar-space {
  width: 40px;
  height: 40px;
}

.lesson-topbar .icon-ghost {
  min-width: 40px;
  min-height: 40px;
  width: 40px;
  height: 40px;
  border-radius: 12px;
}

.topbar-heading {
  min-width: 0;
  display: flex;
  align-items: center;
}

.topbar-title {
  min-width: 0;
  flex: 1 1 auto;
  font-family: var(--font-display);
  font-size: clamp(0.98rem, 0.94rem + 0.3vw, 1.12rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0;
  color: #fff4e4;
  text-transform: none;
  font-variant-caps: normal;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  overflow-wrap: anywhere;
}

.brand-title {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  max-width: 100%;
  line-height: 1;
}

.brand-mark {
  width: 26px;
  height: 26px;
}

.brand-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.icon-ghost:active,
.open-main:active,
.open-mini:active,
.primary-btn:active,
.palette-icon:active {
  transform: translateY(1px);
}

.icon-ghost:hover,
.open-mini:hover,
.palette-icon:hover,
.primary-btn:hover {
  background: linear-gradient(180deg, rgba(39, 31, 24, 0.98), rgba(28, 22, 16, 0.98));
}

.icon-pill {
  min-width: var(--tap);
  min-height: var(--tap);
  width: var(--tap);
  height: var(--tap);
  display: inline-grid;
  place-items: center;
  padding: 0;
  border-radius: 11px;
  border: 1px solid rgba(83, 67, 49, 0.9);
  background: linear-gradient(180deg, rgba(31, 24, 19, 0.98), rgba(22, 17, 13, 0.98));
  color: var(--text);
  line-height: 1;
  vertical-align: middle;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.05s ease;
}

:where(
  button.icon-ghost,
  button.icon-pill,
  button.open-main,
  button.open-mini
)[title][aria-label] {
  display: inline-grid;
  place-items: center;
  padding: 0;
  line-height: 1;
  vertical-align: middle;
}

:where(
  button.icon-ghost,
  button.icon-pill,
  button.open-main,
  button.open-mini
)[title][aria-label] > :is(svg, .comment-glyph) {
  display: block;
  margin: 0;
  justify-self: center;
  align-self: center;
  flex: 0 0 auto;
}

.action-pill {
  min-height: var(--tap);
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(83, 67, 49, 0.9);
  background: linear-gradient(180deg, rgba(31, 24, 19, 0.98), rgba(22, 17, 13, 0.98));
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
  letter-spacing: 0.01em;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.05s ease;
  white-space: nowrap;
}

.action-pill:active {
  transform: translateY(1px);
}

.action-pill:hover {
  background: linear-gradient(180deg, rgba(39, 31, 24, 0.98), rgba(28, 22, 16, 0.98));
}

.action-pill.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
  box-shadow: 0 10px 18px rgba(157, 116, 39, 0.28);
}

.icon-pill:active {
  transform: translateY(1px);
}

.icon-pill:hover {
  background: linear-gradient(180deg, rgba(39, 31, 24, 0.98), rgba(28, 22, 16, 0.98));
}

.icon-pill.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
  font-weight: 700;
  box-shadow: 0 10px 18px rgba(157, 116, 39, 0.28);
}

.palette-icon,
.primary-btn {
  border-radius: 12px;
}

.courses-screen,
.course-screen,
.lesson-structure-screen {
  align-content: start;
}

.lesson-structure-screen {
  min-height: 0;
  overflow-y: auto;
  overflow-x: clip;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.microsequence-screen {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
  min-height: 0;
}

.study-reader-screen {
  padding-bottom: 0;
}

.study-reader-screen .screen-content {
  padding-bottom: 0;
  overflow: hidden;
  min-height: 0;
}

.study-reader-screen .microsequence-screen-edit {
  overflow-y: auto;
  overflow-x: clip;
  padding-bottom: 12px;
}

.entry-card,
.microsequence-panel,
.card-portrait,
.editor-step-nav {
  border-radius: var(--radius);
  border: 1px solid var(--line-soft);
  background:
    linear-gradient(180deg, rgba(29, 23, 18, 0.98), rgba(20, 16, 13, 0.99)),
    radial-gradient(circle at top, rgba(228, 186, 104, 0.06), transparent 60%);
  box-shadow:
    var(--shadow),
    inset 0 1px 0 rgba(255, 240, 217, 0.03);
  padding: 10px;
  display: grid;
  gap: 10px;
}

.module-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.lesson-stack,
.microsequence-list {
  display: grid;
  gap: 8px;
}

.microsequence-list {
  min-height: 0;
  overflow: visible;
}

.microsequence-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
}

.microsequence-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
  padding-right: 2px;
}

.microsequence-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 48px;
  flex: 0 0 auto;
  align-self: center;
}

.microsequence-runtime-toggle[disabled] {
  opacity: 0.42;
  cursor: not-allowed;
}

.microsequence-actions .open-mini:disabled,
.microsequence-actions .open-mini[aria-disabled="true"] {
  opacity: 0.44;
  cursor: not-allowed;
  box-shadow: none;
}

.microsequence-actions .open-mini:disabled:hover,
.microsequence-actions .open-mini[aria-disabled="true"]:hover {
  background: inherit;
}

[data-structure-target] {
  position: relative;
  transition:
    transform 120ms ease,
    border-color 120ms ease,
    box-shadow 120ms ease;
}

.structure-drag-origin {
  opacity: 0.74;
}

.structure-drop-before::before,
.structure-drop-after::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(241, 207, 139, 0.95), rgba(228, 186, 104, 0.75));
  box-shadow: 0 0 0 1px rgba(18, 12, 8, 0.45);
  pointer-events: none;
  z-index: 3;
}

.structure-drop-before::before {
  top: -2px;
}

.structure-drop-after::after {
  bottom: -2px;
}

.structure-drop-inline-before::before,
.structure-drop-inline-after::after {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(241, 207, 139, 0.95), rgba(228, 186, 104, 0.75));
  box-shadow: 0 0 0 1px rgba(18, 12, 8, 0.45);
  pointer-events: none;
  z-index: 3;
}

.structure-drop-inline-before::before {
  left: -2px;
}

.structure-drop-inline-after::after {
  right: -2px;
}

.draft-microsequence-card {
  border-color: rgba(228, 186, 104, 0.7);
  background:
    linear-gradient(180deg, rgba(43, 31, 19, 0.98), rgba(23, 17, 12, 0.995)),
    radial-gradient(circle at top left, rgba(228, 186, 104, 0.12), transparent 62%);
}

.course-badge {
  margin: 0 0 2px;
  color: #f2d8a0;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.course-card,
.clean-card[data-structure-target="module"],
.clean-card[data-structure-target="lesson"],
.clean-card[data-structure-target="microsequence"] {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  column-gap: 12px;
}

.course-copy,
.lesson-copy {
  min-width: 0;
}

.course-actions,
.lesson-actions,
.microsequence-actions {
  justify-self: end;
  align-self: stretch;
  justify-content: flex-start;
}

.card-title,
.lesson-title,
.section-heading {
  margin: 0;
  font-family: var(--font-display);
  font-variant-caps: normal;
  text-transform: none;
  letter-spacing: 0;
  color: #fff4e4;
  overflow-wrap: anywhere;
}

.card-title,
.lesson-title {
  font-size: clamp(0.96rem, 0.92rem + 0.26vw, 1.14rem);
  font-weight: 700;
  line-height: 1.28;
}

.section-heading {
  font-size: clamp(1.08rem, 1.02rem + 0.26vw, 1.2rem);
  font-weight: 700;
  line-height: 1.15;
}

.section-heading-row {
  margin: 0 0 2px;
}

.centered-section-heading-row {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}

.navigation-heading-row {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 2px 0 6px;
  padding-left: 0;
  padding-right: 0;
}

.centered-section-heading-row .section-heading {
  font-size: 1.02rem;
  line-height: 1.15;
  letter-spacing: 0.01em;
  color: #f6ead6;
}

.screen-summary-copy {
  display: none;
}

.navigation-screen {
  gap: 8px;
  padding-bottom: 10px;
}

.home-topbar {
  grid-template-columns: 34px minmax(0, 1fr) auto;
}

.home-topbar .brand-title {
  gap: 7px;
}

.home-topbar .brand-mark {
  width: 30px;
  height: 30px;
}

.home-topbar .brand-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.courses-home-heading-row {
  display: flex;
  align-items: center;
  justify-content: center;
}

.courses-home-screen .section-heading {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0.01em;
  font-variant-caps: normal;
  text-transform: none;
  color: #f6ead6;
}

.navigation-list {
  display: grid;
  gap: 8px;
}

.navigation-list-card {
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "main main"
    "meta actions";
  column-gap: 10px;
  row-gap: 8px;
  align-items: end;
  padding: 10px 12px;
  min-height: 0;
}

.microsequence-group {
  display: grid;
  gap: 8px;
}

.navigation-main {
  grid-area: main;
  display: grid;
  gap: 4px;
  padding-right: 0;
  min-width: 0;
}

.navigation-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.navigation-title-row .builder-tool-handle {
  min-width: 36px;
  min-height: 36px;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
}

.navigation-title-row .card-title {
  flex: 1 1 auto;
  min-width: 0;
}

.course-screen .card-title,
.lesson-structure-screen .card-title {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.26;
  letter-spacing: 0.01em;
  color: #fff3df;
}

.course-screen .card-subtitle,
.lesson-structure-screen .card-subtitle {
  display: block;
  font-size: 0.95rem;
  line-height: 1.38;
  color: #e4d7c5;
  overflow: visible;
  overflow-wrap: anywhere;
}

.navigation-list-card > .progress-meta {
  grid-area: meta;
  min-width: 0;
  align-self: end;
}

.navigation-actions {
  grid-area: actions;
  display: flex;
  width: auto;
  min-height: 0;
  justify-self: end;
  align-self: end;
  justify-content: flex-end;
  align-items: center;
  flex-direction: row;
  gap: 6px;
}

.navigation-actions .icon-ghost,
.navigation-actions .open-main,
.navigation-actions .open-mini {
  min-width: 40px;
  min-height: 40px;
  width: 40px;
  height: 40px;
  border-radius: 12px;
}

.courses-home-screen .card-title {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.26;
  letter-spacing: 0.01em;
  font-variant-caps: normal;
  text-transform: none;
  color: #fff3df;
}

.courses-home-screen .card-subtitle {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  font-size: 0.95rem;
  line-height: 1.38;
  color: #e4d7c5;
}

.courses-home-screen .progress-meta {
  margin-top: 2px;
  gap: 5px;
}

.courses-home-screen .progress-meta-item {
  gap: 3px;
}

.courses-home-screen .progress-meta-item-icon {
  width: 11px;
  height: 11px;
}

.courses-home-screen .course-actions .open-main {
  box-shadow: 0 8px 16px rgba(157, 116, 39, 0.22);
}

.microsequence-main-button {
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  display: grid;
  cursor: pointer;
  min-width: 0;
  padding: 0;
}

.microsequence-title-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.microsequence-state-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  position: relative;
  top: 1px;
}

.navigation-title-row .card-title .microsequence-state-icon {
  margin-right: 6px;
}

.microsequence-state-icon-svg {
  width: 18px;
  height: 18px;
  display: block;
}

.microsequence-state-icon.is-draft,
.microsequence-state-icon.is-ready {
  color: #f2c66a;
}

.microsequence-state-icon.is-excluded {
  color: #da6f6f;
}

.microsequence-title,
.row-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--type-base);
  font-weight: 600;
  line-height: var(--leading-snug);
  letter-spacing: 0.08em;
  font-variant-caps: all-small-caps;
  text-transform: lowercase;
  min-width: 0;
  overflow-wrap: anywhere;
  color: #fff4e4;
}

.list-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  align-items: center;
  gap: 6px;
  border-radius: 12px;
  border: 1px solid rgba(82, 67, 49, 0.82);
  background: rgba(20, 16, 13, 0.9);
  padding: 8px;
}

.row-main {
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  display: grid;
  gap: 5px;
  cursor: pointer;
  min-width: 0;
}

.row-sub {
  color: var(--muted);
  font-size: var(--type-xs);
}

.microsequence-row-sub {
  max-width: 30ch;
}

.didactic-tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  overflow: visible;
  padding: 2px 0 4px;
  justify-content: flex-start;
}

.microsequence-tag-row {
  padding: 0;
}

.didactic-tag-row-limited {
  max-height: 70px;
  overflow: hidden;
}

.didactic-tag {
  width: auto;
  max-width: 100%;
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 7px 0 12px;
  border-radius: 4px 999px 999px 4px;
  border: 1px solid rgba(142, 113, 76, 0.78);
  font-size: 0.66rem;
  line-height: 1;
  white-space: nowrap;
}

.didactic-tag::before {
  content: "";
  position: absolute;
  left: 4px;
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18) inset;
}

.didactic-tag-text {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  display: inline-block;
}

.dependency-tag-chip {
  background: linear-gradient(180deg, rgba(88, 67, 42, 0.98), rgba(56, 41, 25, 0.99));
  border-color: rgba(170, 134, 86, 0.72);
  color: #f5e6cb;
  box-shadow:
    0 1px 0 rgba(255, 244, 225, 0.06) inset,
    0 2px 6px rgba(0, 0, 0, 0.18);
}


.badge,
.context-chip {
  min-width: 0;
  max-width: 100%;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.18);
  color: var(--muted);
  padding: 6px 10px;
  font-size: 0.76rem;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.progress-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.progress-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.progress-meta-item-icon {
  width: 12px;
  height: 12px;
  display: block;
  flex: 0 0 auto;
}

.ui-icon-progress {
  transform: translateY(0.5px);
}

.progress-meta-item-value {
  line-height: 1;
}

.progress-meta-separator {
  color: rgba(205, 187, 160, 0.52);
}

.context-band {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
  min-width: 0;
}

.context-chip-metric {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.context-chip-icon {
  width: 12px;
  height: 12px;
  display: block;
  flex: 0 0 auto;
}

.context-chip-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.context-chip-separator {
  color: rgba(205, 187, 160, 0.52);
  flex: 0 0 auto;
}

.context-band-tight {
  gap: 6px;
  margin-top: 6px;
}

.muted-chip {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.microsequence-list-item {
  padding: 12px;
  display: grid;
  gap: 10px;
}

.lesson-panel-card {
  gap: 12px;
  min-height: 0;
}

.lesson-panel-head {
  display: grid;
  gap: 8px;
  justify-items: stretch;
}

.lesson-panel-title {
  width: 100%;
  text-align: center;
}

.lesson-panel-summary {
  justify-self: start;
  margin: 0;
}

.microsequence-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
}

.microsequence-panel-title {
  font-size: 0.98rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.microsequence-panel-objective {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.focus-panel {
  padding: 8px 10px;
  gap: 8px;
}

.microsequence-panel-meta {
  display: grid;
  justify-items: end;
  gap: 4px;
}

.study-context-panel {
  display: grid;
  gap: 4px;
}

.study-context-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 0 10px 4px;
  align-content: flex-start;
}

.light-tag {
  min-height: 18px;
  padding: 0 7px 0 11px;
  font-size: 0.62rem;
  opacity: 0.9;
}

.light-tag-more {
  min-width: 30px;
  justify-content: center;
  padding-left: 9px;
}

.compact-study-tags {
  min-height: 0;
}

.microsequence-stage-meta {
  flex: 0 0 auto;
  padding: 0 10px;
  color: #b8aa94;
  font-size: var(--type-xs);
  line-height: 1.28;
  letter-spacing: 0.025em;
  min-height: calc(var(--type-xs) * 1.28);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.microsequence-cards,
.card-strip,
.editor-step-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.workbench-surface {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  flex: 1 1 auto;
  gap: 10px;
  min-height: 0;
}

.workbench-surface-tabbar {
  position: relative;
  padding-top: 6px;
  padding-right: 10px;
  min-width: 0;
}

.workbench-surface-tabbar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 10px;
  bottom: 0;
  border-bottom: 1px solid rgba(111, 88, 62, 0.92);
}

.workbench-surface-strip {
  display: flex;
  gap: 0;
  min-width: 0;
  width: 100%;
}

.workbench-surface-tab {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 50%;
  min-width: 0;
  min-height: 38px;
  margin-right: -1px;
  padding: 7px 14px 6px;
  border: 1px solid rgba(111, 88, 62, 0.88);
  border-bottom: 0;
  border-radius: 14px 14px 0 0;
  background: linear-gradient(180deg, rgba(39, 31, 24, 0.98), rgba(23, 18, 14, 0.98));
  color: #cdbba0;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 240, 217, 0.04);
}

.workbench-surface-tab-icon {
  width: 16px;
  height: 16px;
  display: block;
  flex: 0 0 auto;
}

.workbench-surface-tab:hover {
  background: linear-gradient(180deg, rgba(50, 39, 29, 0.98), rgba(29, 23, 17, 0.99));
  color: #f0dcc0;
}

.workbench-surface-tab.active {
  z-index: 2;
  background: linear-gradient(180deg, rgba(73, 57, 33, 0.99), rgba(46, 35, 22, 0.99));
  border-color: rgba(214, 174, 96, 0.86);
  color: #fff0d4;
  box-shadow:
    inset 0 1px 0 rgba(255, 241, 214, 0.09),
    0 -1px 0 rgba(214, 174, 96, 0.14),
    0 0 0 1px rgba(246, 214, 150, 0.34);
}

.workbench-surface-tab.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: rgba(46, 35, 22, 0.99);
}

.workbench-surface-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  border: 1px solid rgba(214, 174, 96, 0.34);
  border-top: 0;
  border-radius: 0 18px 18px 18px;
  background:
    linear-gradient(180deg, rgba(73, 57, 33, 0.94), rgba(31, 24, 17, 0.98)),
    radial-gradient(circle at top, rgba(246, 214, 150, 0.12), transparent 62%);
  box-shadow: inset 0 1px 0 rgba(255, 241, 214, 0.06);
  padding: 12px;
  overflow: hidden;
}

.workbench-surface[data-workbench-pane="edit"] .workbench-surface-body {
  height: 100%;
  min-height: 0;
  padding: 10px 12px 12px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(73, 57, 33, 0.82), rgba(31, 24, 17, 0.96)),
    radial-gradient(circle at top, rgba(246, 214, 150, 0.16), transparent 68%);
}

.workbench-surface-pane {
  height: 100%;
  min-height: 0;
}

.workbench-preview-pane {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.workbench-preview-pane.study-reader-screen {
  height: 100%;
  min-height: 0;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.workbench-preview-pane .editor-card-stage-shell,
.generator-preview-stage > .editor-card-stage-shell {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
}

.editor-step-nav-head p {
  text-align: center;
}

.editor-step-empty {
  min-height: 120px;
  border-radius: 14px;
  border: 1px dashed rgba(118, 94, 67, 0.72);
  display: grid;
  place-items: center;
  padding: 12px;
  color: var(--muted);
  text-align: center;
}

.editor-card-strip-shell {
  position: relative;
  border: 1px solid rgba(214, 174, 96, 0.34);
  border-top: 0;
  border-radius: 0 0 18px 18px;
  background:
    linear-gradient(180deg, rgba(73, 57, 33, 0.94), rgba(31, 24, 17, 0.98)),
    radial-gradient(circle at top, rgba(246, 214, 150, 0.12), transparent 62%);
  box-shadow: inset 0 1px 0 rgba(255, 241, 214, 0.06);
}

.editor-card-strip-track {
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-behavior: smooth;
  padding: 12px 14px 10px;
}

.editor-card-strip-track::-webkit-scrollbar {
  display: none;
}

.editor-card-strip-shell[data-card-strip-overflowing="true"] .editor-card-strip-track {
  padding-left: 44px;
  padding-right: 44px;
}

.editor-card-strip-arrow {
  position: absolute;
  top: 6px;
  bottom: 6px;
  z-index: 2;
  width: 38px;
  border: 0;
  background: transparent;
  color: #f3e1bf;
  font-size: 1.55rem;
  line-height: 1;
  cursor: pointer;
}

.editor-card-strip-arrow.is-prev {
  left: 0;
  background: linear-gradient(90deg, rgba(24, 18, 12, 0.96), rgba(24, 18, 12, 0));
}

.editor-card-strip-arrow.is-next {
  right: 0;
  background: linear-gradient(270deg, rgba(24, 18, 12, 0.96), rgba(24, 18, 12, 0));
}

.editor-card-strip-arrow:hover {
  color: #fff5e4;
}

.editor-step-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.editor-step-nav .icon-ghost.tiny-icon {
  min-width: 36px;
  min-height: 36px;
  width: 36px;
  height: 36px;
}

.editor-step-nav .icon-ghost:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.mini-card {
  flex: 0 0 auto;
  width: 104px;
  min-height: 150px;
  border-radius: 14px;
  border: 1px solid rgba(98, 78, 57, 0.92);
  background:
    linear-gradient(180deg, rgba(36, 28, 21, 0.98), rgba(23, 18, 14, 0.98)),
    radial-gradient(circle at top, rgba(228, 186, 104, 0.08), transparent 58%);
  color: var(--text);
  padding: 8px;
  display: grid;
  grid-template-rows: auto auto 1fr;
  align-content: start;
  gap: 6px;
  text-align: left;
  cursor: pointer;
  min-width: 0;
  overflow: hidden;
  box-shadow:
    0 10px 18px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 rgba(255, 240, 217, 0.035);
}

.mini-card-slot {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: stretch;
}

.mini-card.active {
  border-color: var(--accent);
  box-shadow:
    0 0 0 2px var(--accent-soft) inset,
    0 12px 22px rgba(0, 0, 0, 0.2);
}

.mini-card.thumb {
  width: 84px;
  min-height: 120px;
  padding: 8px;
  gap: 4px;
}

.mini-card[data-structure-draggable="true"] {
  cursor: grab;
}

.mini-card[data-structure-draggable="true"]:active {
  cursor: grabbing;
}

.mini-card-kicker {
  color: var(--muted);
  min-height: 14px;
  display: inline-flex;
  align-items: center;
}

.mini-card-kicker-icon {
  width: 12px;
  height: 12px;
  display: block;
  flex: 0 0 auto;
}

.mini-card-title {
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.18;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.mini-card-canvas,
.mini-card-structure {
  display: grid;
  gap: 4px;
  align-content: start;
  min-height: 0;
}

.mini-card-canvas {
  border-radius: 10px;
  border: 1px solid rgba(93, 74, 52, 0.72);
  background: rgba(0, 0, 0, 0.18);
  padding: 6px;
}

.block-pill {
  min-height: 16px;
  padding: 0 6px;
  border-radius: 999px;
  border: 1px solid rgba(111, 88, 62, 0.76);
  background: rgba(0, 0, 0, 0.18);
  color: var(--muted);
  font-size: 0.62rem;
  display: inline-flex;
  align-items: center;
}

.block-pill-stack {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.block-pill-line {
  border-radius: 8px;
  border: 1px solid rgba(108, 85, 60, 0.72);
  background: rgba(0, 0, 0, 0.18);
  min-height: 14px;
  padding: 2px 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  min-width: 0;
}

.block-pill-line-main {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.58rem;
  color: #f0d7a2;
}

.block-pill-line-kind {
  flex: 0 0 auto;
  font-size: 0.54rem;
  color: var(--muted);
  text-transform: uppercase;
}

.mini-card-body {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-portrait {
  padding: 8px;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 8px;
  min-height: 0;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.editor-card-portrait {
  min-height: 0;
}

.study-stage {
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
  position: relative;
  overflow: hidden;
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  max-width: 100%;
}

.editor-card-stage-shell {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 8px;
  height: 100%;
  min-height: 0;
}

.editor-card-stage-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  justify-self: center;
  pointer-events: none;
}

.editor-card-count-icon {
  width: 14px;
  height: 14px;
}

.editor-card-count-value {
  line-height: 1;
}

.edit-stage {
  flex: 0 0 auto;
  min-height: 0;
}

.card-portrait-head,
.editor-step-nav-head {
  display: grid;
  grid-template-columns: 36px 1fr 36px;
  gap: 6px;
  align-items: center;
}

.study-nav-panel {
  display: grid;
  gap: 8px;
}

.study-reader-topbar {
  display: grid;
  grid-template-columns: var(--tap) var(--tap) minmax(0, 1fr) var(--tap) var(--tap);
  align-items: center;
  gap: 6px;
  padding-top: max(var(--safe-top), 10px);
  padding-right: var(--shell-scrollbar-comp);
}

.study-reader-progress {
  height: 8px;
  border-radius: 999px;
  background: rgba(61, 48, 34, 0.78);
  overflow: hidden;
  margin: 0 6px 0 2px;
  min-width: 0;
  max-width: 100%;
}

.study-reader-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #c89546, var(--accent-strong));
  max-width: 100%;
}

.study-reader-context {
  display: grid;
  gap: 2px;
  padding: 0 4px;
  flex: 0 0 auto;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.study-reader-line {
  min-height: 20px;
  min-width: 0;
}

.study-reader-context-line {
  display: block;
  color: #cfb88f;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  max-width: 100%;
}

.study-reader-course-title {
  display: block;
  color: #f0c66b;
  font-family: var(--font-display);
  font-size: var(--type-sm);
  font-weight: 600;
  line-height: var(--leading-snug);
  letter-spacing: 0.08em;
  font-variant-caps: all-small-caps;
  text-transform: lowercase;
  text-align: center;
  padding: 0 46px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.study-reader-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: var(--muted);
  white-space: nowrap;
  font-size: var(--type-xs);
}

.study-reader-count-icon {
  width: 12px;
  height: 12px;
  display: block;
  flex: 0 0 auto;
}

.study-reader-count-value {
  line-height: 1;
}

.study-reader-stage-meta {
  display: flex;
  justify-content: center;
  padding: 0 4px;
  flex: 0 0 auto;
}

.study-progress-rail {
  height: 8px;
  border-radius: 999px;
  background: rgba(28, 22, 16, 0.86);
  border: 1px solid rgba(101, 79, 55, 0.72);
  overflow: hidden;
}

.study-progress-rail span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(242, 215, 157, 0.95), rgba(228, 186, 104, 0.85));
}

.card-portrait-meta,
.chip-muted,
.editor-title {
  text-align: center;
  color: var(--muted);
  font-size: var(--type-xs);
}

.card-portrait-body {
  border-radius: var(--radius);
  border: 1px solid var(--line-soft);
  background:
    linear-gradient(180deg, rgba(29, 23, 18, 0.98), rgba(20, 16, 13, 0.99)),
    radial-gradient(circle at top, rgba(228, 186, 104, 0.06), transparent 60%);
  padding: 10px;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 10px;
  min-height: 0;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  box-shadow:
    var(--shadow),
    inset 0 1px 0 rgba(255, 240, 217, 0.03);
}

.runtime-card-sheet {
  height: 100%;
  min-height: 0;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.runtime-card-sheet-empty {
  justify-content: flex-start;
}

.runtime-card-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--type-base);
  font-weight: 700;
  line-height: var(--leading-snug);
  letter-spacing: 0.08em;
  font-variant-caps: all-small-caps;
  text-transform: lowercase;
  color: #fff1d8;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}

.card-sheet-content {
  flex: 1;
  min-height: 0;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  color: var(--text);
  line-height: var(--leading-relaxed);
  overflow-y: auto;
  overflow-x: auto;
  font-size: var(--type-base);
  overflow-wrap: anywhere;
  display: grid;
  align-content: start;
  gap: 8px;
  -webkit-overflow-scrolling: touch;
}

.card-answer-dock {
  z-index: 12;
  flex: 0 0 auto;
  max-height: min(30vh, 220px);
  overflow: auto;
  padding-top: 10px;
  padding-bottom: 4px;
  border-top: 1px solid rgba(92, 75, 55, 0.5);
  background:
    linear-gradient(180deg, rgba(18, 14, 11, 0.98), rgba(12, 10, 8, 0.98));
  display: grid;
  gap: 10px;
}

.card-answer-dock .runtime-exercise-controls,
.card-answer-dock .runtime-flow-practice-actions,
.card-answer-dock .runtime-flow-prompt-actions {
  justify-content: flex-end;
}

.runtime-block {
  margin: 0;
}

.runtime-heading {
  font-family: var(--font-display);
  font-size: var(--type-sm);
  font-weight: 700;
  letter-spacing: 0.08em;
  font-variant-caps: all-small-caps;
  text-transform: lowercase;
  color: #fff1d8;
}

.runtime-paragraph {
  color: var(--text);
  line-height: 1.72;
}

.runtime-paragraph strong,
.runtime-choice-body strong,
.runtime-complete-text strong,
.runtime-table-block strong,
.runtime-image-caption strong,
.runtime-markdown-paragraph strong,
.runtime-markdown-list strong {
  color: var(--accent-strong);
  font-weight: 800;
}

.runtime-markdown-paragraph + .runtime-markdown-paragraph,
.runtime-markdown-paragraph + .runtime-markdown-list,
.runtime-markdown-list + .runtime-markdown-paragraph,
.runtime-markdown-list + .runtime-markdown-list {
  margin-top: 10px;
}

.runtime-paragraph code,
.runtime-choice-body code,
.runtime-complete-text code,
.runtime-markdown-paragraph code,
.runtime-markdown-list code {
  display: inline;
  padding: 0.08em 0.36em;
  border-radius: 7px;
  border: 1px solid rgba(120, 95, 68, 0.62);
  background: rgba(31, 23, 17, 0.92);
  color: #f7dfb4;
  font-family: "Cascadia Code", "Consolas", "SFMono-Regular", "Cascadia Mono", monospace;
  font-size: 0.92em;
  line-height: 1.3;
  white-space: break-spaces;
  overflow-wrap: anywhere;
  word-break: normal;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  vertical-align: baseline;
}

.runtime-markdown-list {
  padding-left: 1.2rem;
}

.runtime-markdown-list li + li {
  margin-top: 4px;
}

.runtime-markdown-list li::marker {
  color: var(--accent);
}

.runtime-list-block,
.runtime-choice-block,
.runtime-flow-block {
  border-radius: 12px;
  border: 1px solid rgba(92, 75, 55, 0.78);
  background: rgba(13, 10, 8, 0.16);
  padding: 10px 12px;
}

.runtime-complete-block,
.runtime-code-block,
.runtime-table-block,
.runtime-paragraph-gap-block {
  display: grid;
  gap: 10px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.runtime-list {
  display: grid;
  gap: 6px;
  padding-left: 18px;
}

.runtime-table-title {
  color: #f1d39a;
  font-family: var(--font-display);
  font-size: 0.94rem;
  font-weight: 700;
  line-height: var(--leading-snug);
  letter-spacing: 0.08em;
  font-variant-caps: all-small-caps;
  text-transform: lowercase;
  margin-bottom: 0;
}

.runtime-table-focus-label {
  color: #f5dfb4;
  font-size: 0.82rem;
  line-height: 1.5;
  padding: 0 2px;
}

.runtime-choice-body {
  line-height: 1.62;
}

.runtime-complete-text {
  line-height: 1.78;
  overflow-wrap: anywhere;
}

.runtime-text-gap-blank {
  display: inline;
  vertical-align: baseline;
  padding: 0 0.08em 0 0;
  margin: 0;
  border-radius: 10px;
  border: 1px dashed rgba(230, 192, 117, 0.56);
  background: rgba(228, 186, 104, 0.08);
  color: var(--text);
  font: inherit;
  line-height: inherit;
  box-sizing: border-box;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  caret-color: var(--text);
  direction: ltr;
  unicode-bidi: plaintext;
  text-align: left;
  cursor: text;
}

.runtime-text-gap-choice-blank {
  cursor: pointer;
}

.runtime-text-gap-blank:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(230, 192, 117, 0.25);
  border-color: rgba(230, 192, 117, 0.92);
}

.runtime-text-gap-blank[data-empty="true"] {
  display: inline-block;
  min-width: calc(1ch + 0.1em);
}

.runtime-text-gap-choice-blank[data-empty="true"] {
  display: inline-flex;
  align-items: center;
  vertical-align: text-bottom;
  min-height: calc(1em + 2px);
  min-width: calc(3ch + 0.1em);
  padding: 0 0.18em;
  border-radius: 999px;
  line-height: 1;
}

.runtime-complete-blank,
.runtime-paragraph-gap-blank,
.runtime-editor-gap-blank,
.runtime-table-gap-blank {
  min-height: 1em;
}

.runtime-text-gap-paragraph,
.runtime-complete-text,
.runtime-table-cell-gap {
  line-height: 1.78;
}

.runtime-code-gap {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.runtime-code-block pre {
  margin: 0;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(92, 75, 55, 0.68);
  background:
    linear-gradient(180deg, rgba(17, 13, 10, 0.98), rgba(12, 9, 7, 0.98)),
    radial-gradient(circle at top left, rgba(228, 186, 104, 0.06), transparent 45%);
  color: #f5ead7;
  font-family: "Cascadia Code", "Consolas", "SFMono-Regular", "Cascadia Mono", monospace;
  font-size: 0.84rem;
  line-height: 1.58;
  overflow-x: auto;
}

.runtime-code-block code {
  font: inherit;
}

.runtime-code-gap code {
  white-space: inherit;
}

.multiple-choice-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.multiple-choice-option {
  width: 100%;
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid rgba(111, 88, 62, 0.88);
  background:
    linear-gradient(180deg, rgba(35, 27, 20, 0.98), rgba(24, 18, 13, 0.99)),
    radial-gradient(circle at left, rgba(228, 186, 104, 0.05), transparent 55%);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font-size: var(--type-sm);
  line-height: var(--leading-normal);
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.05s ease;
}

.multiple-choice-option:active {
  transform: translateY(1px);
}

.multiple-choice-option.active {
  border-color: #8fd85b;
  background:
    linear-gradient(180deg, rgba(24, 43, 24, 0.98), rgba(14, 24, 14, 0.99)),
    radial-gradient(circle at left, rgba(143, 216, 91, 0.12), transparent 55%);
}

.multiple-choice-option.selected-incorrect {
  border-color: #e07f7f;
  background:
    linear-gradient(180deg, rgba(50, 24, 24, 0.98), rgba(24, 12, 12, 0.99)),
    radial-gradient(circle at left, rgba(224, 127, 127, 0.14), transparent 55%);
}

.multiple-choice-mark {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid #7f674a;
  display: inline-grid;
  place-items: center;
  font-size: 0.82rem;
  color: #fff6eb;
  background: rgba(23, 18, 14, 0.84);
}

.multiple-choice-option.active .multiple-choice-mark {
  border-color: #8fd85b;
  background: rgba(59, 97, 37, 0.72);
}

.multiple-choice-option.selected-incorrect .multiple-choice-mark {
  border-color: #e07f7f;
  background: rgba(122, 46, 46, 0.72);
}

.multiple-choice-label {
  min-width: 0;
  overflow-wrap: anywhere;
}

.multiple-choice-label .runtime-markdown-paragraph + .runtime-markdown-paragraph,
.multiple-choice-label .runtime-markdown-paragraph + .runtime-markdown-list,
.multiple-choice-label .runtime-markdown-list + .runtime-markdown-paragraph,
.multiple-choice-label .runtime-markdown-list + .runtime-markdown-list {
  margin-top: 6px;
}

.multiple-choice-code {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(92, 75, 55, 0.68);
  background:
    linear-gradient(180deg, rgba(17, 13, 10, 0.98), rgba(12, 9, 7, 0.98)),
    radial-gradient(circle at top left, rgba(228, 186, 104, 0.06), transparent 45%);
  color: #f5ead7;
  font-family: "Cascadia Code", "Consolas", "SFMono-Regular", "Cascadia Mono", monospace;
  font-size: 0.82rem;
  line-height: 1.56;
  white-space: pre-wrap;
  overflow-x: auto;
}

.multiple-choice-code code {
  font: inherit;
  white-space: inherit;
}

.runtime-exercise-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 10px;
}

.runtime-exercise-feedback {
  margin-top: 8px;
  font-size: var(--type-sm);
  line-height: var(--leading-normal);
}

.runtime-exercise-feedback.is-correct {
  color: rgba(172, 226, 184, 0.95);
}

.runtime-exercise-feedback.is-wrong {
  color: rgba(233, 159, 147, 0.95);
}

.runtime-exercise-feedback.is-incomplete {
  color: rgba(245, 230, 203, 0.86);
}

.inline-feedback {
  border-radius: 12px;
  border: 1px solid rgba(126, 104, 67, 0.26);
  padding: 12px 14px;
}

.inline-feedback p {
  margin: 0;
}

.inline-feedback.ok {
  border-color: rgba(69, 150, 106, 0.78);
  background: rgba(27, 43, 34, 0.92);
  color: #eef8ef;
}

.inline-feedback.err {
  border-color: rgba(162, 78, 88, 0.82);
  background: rgba(55, 24, 28, 0.94);
  color: #fff1f1;
}

.inline-feedback.warn {
  border-color: rgba(190, 156, 82, 0.86);
  background: rgba(63, 48, 20, 0.94);
  color: #fff0c9;
}

.inline-feedback.has-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.feedback-icons {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.runtime-table-wrap {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}

.runtime-table-frame {
  display: inline-block;
  min-width: max-content;
  border: 1px solid rgba(130, 101, 63, 0.82);
  border-radius: 14px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(42, 32, 23, 0.98), rgba(24, 18, 13, 0.99)),
    radial-gradient(circle at top left, rgba(228, 186, 104, 0.08), transparent 56%);
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 217, 0.04),
    0 10px 18px rgba(0, 0, 0, 0.16);
}

.runtime-table {
  width: auto;
  min-width: max-content;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: auto;
}

.runtime-table th,
.runtime-table td {
  border-right: 1px solid rgba(116, 91, 61, 0.82);
  border-bottom: 1px solid rgba(116, 91, 61, 0.82);
  padding: 11px 12px;
  text-align: center;
  vertical-align: middle;
  overflow-wrap: normal;
  word-break: normal;
  white-space: nowrap;
  font-size: 0.9rem;
  line-height: 1.42;
  background: rgba(29, 22, 16, 0.92);
}

.runtime-table th:last-child,
.runtime-table td:last-child {
  border-right: 0;
}

.runtime-table tbody tr:last-child td {
  border-bottom: 0;
}

.runtime-table th {
  background:
    linear-gradient(180deg, rgba(58, 44, 31, 0.98), rgba(47, 35, 24, 0.98)),
    radial-gradient(circle at top, rgba(228, 186, 104, 0.08), transparent 62%);
  color: #fff1d8;
  font-family: var(--font-display);
  font-size: 0.94rem;
  font-weight: 700;
  line-height: var(--leading-snug);
  letter-spacing: 0.08em;
  font-variant-caps: all-small-caps;
  text-transform: lowercase;
}

.runtime-table th.is-focused-column,
.runtime-table td.is-focused-column,
.runtime-table td.is-focused-row {
  background:
    linear-gradient(180deg, rgba(95, 71, 32, 0.98), rgba(63, 47, 24, 0.98)),
    radial-gradient(circle at top, rgba(228, 186, 104, 0.12), transparent 62%);
}

.runtime-table td.is-focus-intersection {
  background:
    linear-gradient(180deg, rgba(118, 86, 34, 0.99), rgba(74, 54, 24, 0.99)),
    radial-gradient(circle at center, rgba(242, 215, 157, 0.14), transparent 64%);
  color: #fff4e0;
  font-weight: 700;
}

.runtime-table tbody tr:nth-child(even) td {
  background: rgba(24, 18, 13, 0.94);
}

.runtime-tree-block {
  display: grid;
  gap: 10px;
}

.runtime-tree-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.runtime-tree-item > .runtime-tree-list {
  margin-top: 6px;
  margin-left: 12px;
  padding-left: 14px;
  border-left: 1px solid rgba(228, 186, 104, 0.18);
}

.runtime-tree-entry {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  padding: 6px 10px;
  border: 1px solid rgba(116, 90, 57, 0.48);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(34, 27, 20, 0.94), rgba(21, 17, 13, 0.98)),
    radial-gradient(circle at top, rgba(228, 186, 104, 0.04), transparent 56%);
  box-shadow: inset 0 1px 0 rgba(255, 244, 225, 0.04);
}

.runtime-tree-item[data-type="file"] > .runtime-tree-entry {
  background:
    linear-gradient(180deg, rgba(27, 22, 18, 0.92), rgba(18, 14, 11, 0.98)),
    radial-gradient(circle at top, rgba(228, 186, 104, 0.03), transparent 56%);
}

.runtime-tree-node-chip {
  flex: 0 0 auto;
  min-width: 32px;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid rgba(228, 186, 104, 0.22);
  background: rgba(228, 186, 104, 0.08);
  color: #f2d79d;
  font-family: var(--font-ui);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
}

.runtime-tree-node-label {
  min-width: 0;
  color: #f5ead5;
  font-size: 0.92rem;
  line-height: 1.42;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.runtime-table-cell-gap {
  font-size: 0.9rem;
  line-height: 1.42;
}

.runtime-plane-block,
.runtime-matrix-block,
.runtime-graph-block,
.runtime-relation-map-block {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.runtime-plane-wrap {
  display: grid;
  gap: 9px;
  justify-items: center;
  max-width: 100%;
  padding: 2px 0 0;
}

.runtime-graph-wrap {
  display: grid;
  gap: 10px;
  justify-items: center;
  max-width: 100%;
  padding: 2px 0 0;
}

.runtime-relation-map-wrap {
  display: grid;
  gap: 10px;
  justify-items: center;
  max-width: 100%;
  padding: 2px 0 0;
}

.runtime-graph-svg {
  width: min(100%, 328px);
  max-height: min(46dvh, 420px);
  height: auto;
  overflow: visible;
}

.runtime-relation-map-svg {
  width: min(100%, 328px);
  height: auto;
  overflow: visible;
}

.runtime-graph-surface {
  fill: rgba(27, 22, 17, 0.98);
  stroke: none;
}

.runtime-graph-edge {
  stroke: rgba(240, 210, 147, 0.32);
  fill: none;
  vector-effect: non-scaling-stroke;
}

.runtime-graph-edge.is-highlighted {
  stroke: #f2d79d;
}

.runtime-graph-edge-group:not(.is-highlighted) .runtime-graph-edge {
  opacity: 0.5;
}

.runtime-graph-edge-group.is-highlighted .runtime-graph-edge {
  opacity: 1;
  filter: drop-shadow(0 0 2px rgba(242, 215, 157, 0.32));
}

.runtime-graph-edge-label text,
.runtime-graph-vertex-label {
  font-family: var(--font-ui);
  paint-order: stroke;
  stroke: rgba(18, 14, 11, 0.92);
  stroke-width: 3px;
  stroke-linejoin: round;
}

.runtime-graph-edge-label text {
  letter-spacing: 0.01em;
}

.runtime-graph-vertex {
  fill: rgba(47, 36, 25, 0.98);
  stroke: rgba(242, 215, 157, 0.58);
  vector-effect: non-scaling-stroke;
}

.runtime-graph-vertex.is-highlighted {
  fill: rgba(91, 66, 31, 0.98);
  stroke: #f2c96d;
}

.runtime-graph-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  max-width: min(100%, 340px);
}

.runtime-graph-legend-item {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 5px;
  padding: 3px 8px;
  border: 1px solid rgba(113, 88, 55, 0.82);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(43, 33, 23, 0.96), rgba(25, 19, 14, 0.96)),
    radial-gradient(circle at top, rgba(228, 186, 104, 0.08), transparent 58%);
  color: #f6ead8;
  font-size: 0.72rem;
  line-height: 1.2;
}

.runtime-graph-legend-item.is-highlighted {
  border-color: rgba(242, 201, 109, 0.76);
  color: #fff1d8;
}

.runtime-graph-legend-key {
  color: #f2c96d;
  font-weight: 800;
}

.runtime-graph-legend-separator {
  color: rgba(216, 197, 166, 0.72);
}

.runtime-graph-legend-label {
  overflow-wrap: anywhere;
}

.runtime-relation-map-set-label,
.runtime-relation-map-item text,
.runtime-relation-map-link-label {
  font-family: var(--font-ui);
  paint-order: stroke;
  stroke: rgba(18, 14, 11, 0.92);
  stroke-width: 3px;
  stroke-linejoin: round;
}

.runtime-relation-map-set-label {
  fill: #f2c96d;
  font-size: 4.3px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.runtime-relation-map-set-shell {
  fill: rgba(39, 30, 21, 0.34);
  stroke: rgba(242, 215, 157, 0.72);
  stroke-width: 1.15;
}

.runtime-relation-map-link {
  stroke: rgba(240, 210, 147, 0.88);
  stroke-width: 1.55;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.runtime-relation-map-link.is-highlighted {
  stroke: #f2c96d;
  stroke-width: 2.2;
}

.runtime-relation-map-link-label {
  fill: #f6ead8;
  font-size: 3.6px;
  font-weight: 700;
}

.runtime-relation-map-item-dot {
  fill: #f2c96d;
  stroke: rgba(255, 241, 216, 0.96);
  stroke-width: 0.8;
}

.runtime-relation-map-item.is-highlighted .runtime-relation-map-item-dot {
  fill: #fff1d8;
  stroke: #f2c96d;
  stroke-width: 1;
}

.runtime-relation-map-item-box {
  fill: rgba(40, 31, 21, 0.97);
  stroke: rgba(113, 88, 55, 0.88);
  stroke-width: 0.8;
}

.runtime-relation-map-item-box.is-highlighted {
  stroke: rgba(242, 201, 109, 0.94);
  stroke-width: 1;
}

.runtime-relation-map-item-label {
  fill: #fff1d8;
  font-size: 3.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.runtime-relation-map-item-label.is-right {
  text-anchor: end;
}

.runtime-relation-map-pairs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  max-width: min(100%, 340px);
}

.runtime-relation-map-pair {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border: 1px solid rgba(113, 88, 55, 0.82);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(43, 33, 23, 0.96), rgba(25, 19, 14, 0.96)),
    radial-gradient(circle at top, rgba(228, 186, 104, 0.08), transparent 58%);
  color: #f6ead8;
  font-size: 0.72rem;
  line-height: 1.2;
}

.runtime-relation-map-table-wrap {
  width: min(100%, 340px);
}

.runtime-relation-map-table {
  width: 100%;
}

.runtime-plane-svg {
  width: min(100%, 328px);
  max-height: min(46dvh, 420px);
  height: auto;
  overflow: visible;
}

.runtime-plane-surface {
  fill: rgba(27, 22, 17, 0.98);
  stroke: none;
}

.runtime-plane-frame {
  fill: none;
  stroke: rgba(139, 111, 70, 0.92);
  stroke-width: 1.15;
}

.runtime-plane-grid line {
  stroke: rgba(112, 91, 62, 0.52);
  stroke-width: 1;
  shape-rendering: crispEdges;
}

.runtime-plane-axis {
  stroke: #f2d79d;
  stroke-width: 2.1;
}

.runtime-plane-grid line,
.runtime-plane-axis,
.runtime-plane-vector line,
.runtime-plane-segment {
  vector-effect: non-scaling-stroke;
}

.runtime-plane-axis-label,
.runtime-plane-tick {
  fill: #d8c5a6;
  font-family: var(--font-ui);
  paint-order: stroke;
  stroke: rgba(18, 14, 11, 0.86);
  stroke-width: 3px;
}

.runtime-plane-axis-label {
  font-size: 14px;
  font-weight: 700;
  fill: #f2d79d;
}

.runtime-plane-tick {
  font-size: 11px;
}

.runtime-plane-vector,
.runtime-plane-point-group,
.runtime-plane-segment {
  color: #f2c96d;
}

.runtime-plane-vector.tone-secondary,
.runtime-plane-point-group.tone-secondary,
.runtime-plane-segment.tone-secondary {
  color: #e47b45;
}

.runtime-plane-vector.tone-tertiary,
.runtime-plane-point-group.tone-tertiary,
.runtime-plane-segment.tone-tertiary {
  color: #62b892;
}

.runtime-plane-vector.tone-quaternary,
.runtime-plane-point-group.tone-quaternary,
.runtime-plane-segment.tone-quaternary {
  color: #b99061;
}

.runtime-plane-vector.tone-result,
.runtime-plane-point-group.tone-result,
.runtime-plane-segment.tone-result {
  color: #93cf74;
}

.runtime-plane-segment.tone-guide {
  color: #9f8b6c;
}

.runtime-plane-vector line,
.runtime-plane-segment {
  stroke: currentColor;
  stroke-width: 2.25;
  fill: none;
}

.runtime-plane-vector.is-dashed line {
  stroke-dasharray: 8 7;
}

.runtime-plane-segment.is-dashed {
  stroke-dasharray: 7 6;
}

.runtime-plane-point {
  fill: currentColor;
  stroke: rgba(18, 14, 11, 0.94);
  stroke-width: 1.2;
}

.runtime-plane-origin {
  fill: #f2d79d;
}

.runtime-plane-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  max-width: min(100%, 340px);
}

.runtime-plane-legend-item {
  --plane-legend-color: currentColor;
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 6px;
  padding: 3px 8px;
  border: 1px solid rgba(113, 88, 55, 0.82);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(43, 33, 23, 0.96), rgba(25, 19, 14, 0.96)),
    radial-gradient(circle at top, rgba(228, 186, 104, 0.08), transparent 58%);
  color: #f6ead8;
  font-size: 0.72rem;
  line-height: 1.2;
}

.runtime-plane-legend-item.tone-primary {
  --plane-legend-color: #f2c96d;
}

.runtime-plane-legend-item.tone-secondary {
  --plane-legend-color: #e47b45;
}

.runtime-plane-legend-item.tone-tertiary {
  --plane-legend-color: #62b892;
}

.runtime-plane-legend-item.tone-quaternary {
  --plane-legend-color: #b99061;
}

.runtime-plane-legend-item.tone-result {
  --plane-legend-color: #93cf74;
}

.runtime-plane-legend-swatch {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--plane-legend-color);
  box-shadow: 0 0 0 2px rgba(18, 14, 11, 0.72);
}

.runtime-plane-legend-label {
  overflow-wrap: anywhere;
}

.runtime-plane-result {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  max-width: min(100%, 320px);
  padding: 6px 12px;
  border-radius: 14px;
  border: 1px solid rgba(228, 186, 104, 0.58);
  background:
    linear-gradient(180deg, rgba(51, 39, 26, 0.96), rgba(26, 20, 15, 0.98));
  color: #fff1d8;
  font-family: var(--font-ui);
  font-size: 0.88rem;
  line-height: 1.45;
  text-align: center;
}

.runtime-plane-note {
  max-width: min(100%, 420px);
  margin: 0 auto;
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.45;
  text-align: center;
}

.runtime-plane-gap-blank {
  background: rgba(18, 14, 11, 0.98);
  border-color: rgba(228, 186, 104, 0.68);
  color: #fff1d8;
}

.runtime-matrix-wrap {
  display: flex;
  justify-content: safe center;
  min-width: 0;
  overflow: auto;
  padding-bottom: 4px;
}

.runtime-matrix-equation {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: max-content;
}

.runtime-matrix-equation.is-sequence {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  align-items: center;
  justify-content: center;
  min-width: 0;
  max-width: 100%;
}

.runtime-matrix-sequence-prefix,
.runtime-matrix-sequence-operator {
  color: #f0c874;
  font-family: var(--font-ui);
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
}

.runtime-matrix-sequence-prefix {
  align-self: center;
}

.runtime-matrix-sequence-group {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  min-width: 0;
}

.runtime-matrix-sequence-operator {
  flex: 0 0 auto;
}

.runtime-matrix-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  max-width: 100%;
  min-width: 0;
}

.runtime-matrix-name {
  color: var(--accent-strong);
  font-family: var(--font-ui);
  font-size: var(--type-md);
  font-weight: 800;
  line-height: var(--leading-snug);
  letter-spacing: 0.01em;
}

.runtime-matrix-shell {
  display: inline-flex;
  align-items: stretch;
  gap: 10px;
}

.runtime-matrix-bracket {
  width: 14px;
  min-width: 14px;
}

.runtime-matrix-bracket.is-left {
  border-left: 3px solid rgba(242, 215, 157, 0.92);
  border-top: 3px solid rgba(242, 215, 157, 0.92);
  border-bottom: 3px solid rgba(242, 215, 157, 0.92);
}

.runtime-matrix-bracket.is-right {
  border-right: 3px solid rgba(242, 215, 157, 0.92);
  border-top: 3px solid rgba(242, 215, 157, 0.92);
  border-bottom: 3px solid rgba(242, 215, 157, 0.92);
}

.runtime-matrix-grid {
  display: grid;
  grid-template-columns: repeat(var(--matrix-columns), max-content);
  grid-template-rows: repeat(var(--matrix-rows), minmax(42px, auto));
  gap: 8px 14px;
  align-items: center;
  justify-items: center;
  padding: 6px 3px;
}

.runtime-matrix-cell {
  min-width: 44px;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 7px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: var(--type-base);
  font-weight: 650;
  line-height: var(--leading-snug);
  white-space: nowrap;
}

.runtime-matrix-cell.is-highlighted {
  border-color: rgba(228, 186, 104, 0.58);
  background:
    linear-gradient(180deg, rgba(88, 65, 34, 0.82), rgba(53, 39, 24, 0.82));
  color: #fff1d8;
  box-shadow:
    inset 0 1px 0 rgba(255, 241, 216, 0.12),
    0 0 0 1px rgba(18, 14, 11, 0.38);
}

.runtime-matrix-divider {
  width: 2px;
  align-self: stretch;
  justify-self: center;
  background: rgba(242, 215, 157, 0.68);
  border-radius: 999px;
}

.runtime-matrix-gap-blank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: calc(2ch + 0.3em);
  text-align: center;
}

.runtime-matrix-cell.is-highlighted .runtime-matrix-gap-blank {
  background: rgba(18, 14, 11, 0.58);
  border-color: rgba(242, 215, 157, 0.74);
  color: #fff1d8;
}

.runtime-matrix-equation.is-sequence .runtime-matrix-shell {
  gap: 8px;
}

.runtime-matrix-equation.is-sequence .runtime-matrix-bracket {
  width: 12px;
  min-width: 12px;
}

.runtime-matrix-equation.is-sequence .runtime-matrix-grid {
  gap: 6px 9px;
}

.runtime-matrix-equation.is-sequence .runtime-matrix-cell {
  min-width: 38px;
  min-height: 38px;
  padding: 3px 6px;
  font-size: var(--type-sm);
}

@media (max-width: 640px) {
  .runtime-plane-svg {
    width: min(100%, 304px);
    max-height: min(42dvh, 380px);
  }

  .runtime-graph-svg {
    width: min(100%, 304px);
    max-height: min(42dvh, 380px);
  }

  .runtime-relation-map-svg {
    width: min(100%, 304px);
  }

  .runtime-plane-axis-label {
    font-size: 12px;
  }

  .runtime-plane-tick {
    font-size: 10px;
  }

  .runtime-plane-legend {
    max-width: min(100%, 304px);
  }

  .runtime-plane-legend-item {
    font-size: 0.68rem;
    padding: 3px 7px;
  }

  .runtime-graph-legend-item {
    font-size: 0.68rem;
    padding: 3px 7px;
  }

  .runtime-relation-map-pair {
    font-size: 0.68rem;
    padding: 3px 7px;
  }

  .runtime-matrix-equation {
    gap: 10px;
  }

  .runtime-matrix-name {
    font-size: var(--type-base);
  }

  .runtime-matrix-grid {
    gap: 7px 10px;
  }

  .runtime-matrix-cell {
    min-width: 40px;
    min-height: 40px;
    font-size: var(--type-sm);
  }

  .runtime-matrix-equation.is-sequence {
    gap: 8px 9px;
  }

  .runtime-matrix-sequence-prefix,
  .runtime-matrix-sequence-operator {
    font-size: 0.8rem;
  }

  .runtime-matrix-sequence-group {
    gap: 6px;
  }

  .runtime-matrix-equation.is-sequence .runtime-matrix-grid {
    gap: 5px 7px;
  }

  .runtime-matrix-equation.is-sequence .runtime-matrix-cell {
    min-width: 34px;
    min-height: 34px;
    font-size: 0.82rem;
  }
}

.runtime-flow-block {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.runtime-flow-board-block {
  min-width: 0;
}

.runtime-flow-board-shell {
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: auto;
  min-height: 0;
  width: 100%;
  min-width: 0;
}

.runtime-flow-board-controls {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.runtime-flow-zoom-value {
  min-width: 62px;
}

.runtime-flow-board {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: visible;
  min-height: clamp(300px, 50dvh, 520px);
  max-height: none;
  padding: 4px;
  border-radius: 14px;
  border: 1px solid rgba(126, 104, 67, 0.22);
  background:
    linear-gradient(180deg, rgba(11, 10, 8, 0.72), rgba(9, 8, 7, 0.82)),
    radial-gradient(circle at top, rgba(199, 165, 104, 0.08), transparent 60%);
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  overscroll-behavior-y: auto;
  touch-action: auto;
  flex: 0 0 auto;
  min-height: 0;
  scrollbar-gutter: stable both-edges;
}

.runtime-flow-board-stage {
  position: relative;
  min-width: max-content;
}

.runtime-flow-board-canvas {
  position: relative;
}

.runtime-flow-board-svg {
  width: var(--flowchart-board-width);
  height: var(--flowchart-board-height);
  display: block;
  overflow: visible;
}

.runtime-flow-board-links {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.runtime-flow-route {
  fill: none;
  stroke: rgba(230, 192, 117, 0.92);
  stroke-width: 2.4;
  stroke-linecap: butt;
  stroke-linejoin: round;
}

.runtime-flow-board-arrows {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.runtime-flow-arrow polyline {
  fill: none;
  stroke: rgba(230, 192, 117, 0.92);
  stroke-width: 3;
  stroke-linecap: butt;
  stroke-linejoin: round;
}

.runtime-flow-arrow polygon {
  fill: rgba(230, 192, 117, 0.92);
  stroke: none;
}

.runtime-flow-label-button.is-placeholder {
  opacity: 0.78;
}

.runtime-flow-route[data-link-role="loop-return"] {
  stroke: rgba(206, 159, 87, 0.78);
  stroke-dasharray: 8 6;
}

.runtime-flow-route-label {
  fill: #f1dfbb;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.runtime-flow-board-surface {
  position: absolute;
  inset: 0;
  width: var(--flowchart-board-width);
  height: var(--flowchart-board-height);
  pointer-events: none;
  z-index: 2;
}

.runtime-flow-board-node {
  position: absolute;
  width: 104px;
  min-height: 110px;
  display: grid;
  justify-items: center;
  gap: 6px;
}

.runtime-flow-board-shape {
  width: 80px;
  height: 48px;
  display: grid;
  place-items: center;
}

.runtime-flow-board-shape .flowchart-shape-svg {
  width: 80px;
  height: 48px;
  overflow: visible;
}

.runtime-flow-board-shape .flowchart-shape-svg * {
  fill: rgba(28, 21, 15, 0.78);
  stroke: rgba(230, 192, 117, 0.92);
  stroke-width: 2.4;
}

.runtime-flow-shape-placeholder {
  width: 72px;
  height: 42px;
  border: 2px dashed rgba(230, 192, 117, 0.56);
  border-radius: 12px;
  background: rgba(228, 186, 104, 0.08);
}

.runtime-flow-board-node[data-shape="connector"] .runtime-flow-board-shape .flowchart-shape-svg * {
  fill: rgba(230, 192, 117, 0.14);
}

.runtime-flow-board-copy {
  width: 96px;
  min-height: 56px;
  color: #f5e6cb;
  font-size: 0.69rem;
  line-height: 1.14;
  font-weight: 600;
  text-align: center;
  text-wrap: balance;
  word-break: break-word;
  hyphens: auto;
}

.runtime-flow-board-shape-button,
.runtime-flow-board-copy-button,
.runtime-flow-label-button {
  pointer-events: auto;
  cursor: pointer;
}

.runtime-flow-inline-input {
  cursor: text;
  pointer-events: auto;
  position: relative;
  z-index: 3;
  caret-color: #f5e6cb;
}

.runtime-flow-board-shape-button,
.runtime-flow-board-copy-button {
  border: 0;
  background: transparent;
  padding: 0;
  font: inherit;
}

.runtime-flow-board-shape-button.practice-marked,
.runtime-flow-board-copy-button.practice-marked,
.runtime-flow-board-copy-input.practice-marked,
.runtime-flow-label-button.practice-marked {
  border: 1px dashed rgba(230, 192, 117, 0.56);
  background: rgba(228, 186, 104, 0.08);
  box-shadow: inset 0 0 0 1px rgba(228, 186, 104, 0.08);
}

.runtime-flow-board-shape-button.practice-marked {
  width: 72px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
}

.runtime-flow-board-shape-button.practice-marked .flowchart-shape-svg {
  position: relative;
  z-index: 1;
}

.runtime-flow-board-copy-button {
  width: 96px;
  min-height: 56px;
  border-radius: 10px;
  color: var(--text, #f5e6cb);
  padding: 6px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 160ms ease, box-shadow 160ms ease;
}

.runtime-flow-board-copy-input {
  width: 96px;
  min-height: 56px;
  border-radius: 10px;
  color: var(--text, #f5e6cb);
  padding: 6px 8px;
  font: inherit;
  text-align: center;
  appearance: none;
  transition: background 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.runtime-flow-board-copy-input:focus,
.runtime-flow-label-input:focus {
  outline: none;
  border-color: rgba(230, 192, 117, 0.92);
  box-shadow: 0 0 0 2px rgba(230, 192, 117, 0.92);
}

.runtime-flow-board-shape-button.is-active,
.runtime-flow-board-copy-button.is-active,
.runtime-flow-label-button.is-active {
  box-shadow: 0 0 0 2px rgba(230, 192, 117, 0.92);
}

.runtime-flow-board-copy-button.is-filled,
.runtime-flow-label-button.is-filled {
  background: rgba(228, 186, 104, 0.08);
}

.runtime-flow-board-copy-button.practice-marked:not(.is-filled),
.runtime-flow-board-copy-input.practice-marked:not(.is-filled),
.runtime-flow-label-button.practice-marked:not(.is-filled) {
  color: rgba(255, 239, 207, 0.8);
}

.runtime-flow-label-button {
  position: absolute;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  color: #fbf0dd;
  min-width: 34px;
  min-height: 20px;
  padding: 2px 8px;
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.02em;
  white-space: nowrap;
  box-shadow:
    0 0 0 1px rgba(24, 19, 15, 0.28),
    0 6px 12px rgba(2, 6, 14, 0.18);
}

.runtime-flow-label-input {
  min-width: 42px;
  max-width: 132px;
  font: inherit;
  text-align: center;
  padding: 2px 10px;
  appearance: none;
}

.runtime-flow-label-button.is-placeholder {
  border-style: dashed;
  color: rgba(251, 240, 221, 0.28);
}

.runtime-flow-label-button.is-anchor-start {
  transform: translate(0, -50%);
}

.runtime-flow-label-button.is-anchor-end {
  transform: translate(-100%, -50%);
}

.runtime-flow-practice-panel {
  display: grid;
  gap: 8px;
}

.runtime-flow-prompt {
  position: sticky;
  bottom: 8px;
  z-index: 12;
  border: 1px solid rgba(126, 104, 67, 0.3);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(15, 12, 10, 0.9), rgba(10, 9, 8, 0.94)),
    radial-gradient(circle at top, rgba(199, 165, 104, 0.08), transparent 64%);
  padding: 10px;
  display: grid;
  gap: 10px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.24);
}

.runtime-flow-prompt-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
}

.runtime-flow-prompt-badge {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #f1dfbb;
  text-transform: uppercase;
}

.runtime-flow-choice-list,
.token-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-start;
  align-content: flex-start;
  max-height: 32vh;
  overflow: auto;
  padding: 1px 0 6px;
  box-sizing: border-box;
}

.token-option {
  min-height: 36px;
  border: 1px solid rgba(111, 88, 62, 0.88);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(35, 27, 20, 0.98), rgba(24, 18, 13, 0.99));
  color: var(--text, #f5e6cb);
  padding: 7px 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.69rem;
  font-weight: 600;
  line-height: 1.14;
  cursor: pointer;
  flex: 0 0 auto;
  max-width: 100%;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.05s ease, box-shadow 0.2s ease;
}

.token-option:hover {
  background: linear-gradient(180deg, rgba(39, 31, 24, 0.98), rgba(28, 22, 16, 0.98));
}

.token-option:active {
  transform: translateY(1px);
}

.token-option.active {
  border-color: rgba(230, 192, 117, 0.92);
  box-shadow: none;
  background: rgba(60, 46, 25, 0.94);
  color: #fff3dc;
}

.runtime-flow-shape-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 8px;
}

.runtime-flow-shape-option {
  border: 1px solid rgba(126, 104, 67, 0.32);
  border-radius: 12px;
  background: rgba(18, 15, 12, 0.9);
  color: #f5e6cb;
  padding: 8px;
  display: grid;
  justify-items: center;
  gap: 6px;
}

.runtime-flow-shape-option .flowchart-shape-svg {
  width: 64px;
  height: 36px;
}

.runtime-flow-shape-option .flowchart-shape-svg * {
  fill: rgba(28, 21, 15, 0.78);
  stroke: rgba(230, 192, 117, 0.92);
  stroke-width: 2.4;
}

.runtime-flow-shape-option.is-active {
  box-shadow: 0 0 0 2px rgba(230, 192, 117, 0.92);
}

.runtime-flow-node {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid rgba(170, 134, 86, 0.72);
  background: rgba(228, 186, 104, 0.08);
  color: #f5e6cb;
  padding: 6px 10px;
  font-size: 0.86rem;
  line-height: 1.28;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.runtime-flow-arrow {
  color: #c9b08a;
  font-size: 0.9rem;
}

.runtime-flow-block {
  display: grid;
  gap: 12px;
  padding: 14px;
  overflow: visible;
}

.runtime-flow-nodes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-start;
  align-content: flex-start;
}

.runtime-flow-edges {
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 0;
}

.runtime-flow-edge {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  color: rgba(233, 220, 197, 0.92);
  font-size: 0.89rem;
  line-height: 1.38;
}

.runtime-flow-edge-label {
  min-width: 0;
  overflow-wrap: anywhere;
}

.runtime-flow-edge-arrow {
  color: #c9b08a;
  font-weight: 700;
}

.runtime-popup-block {
  border-radius: 12px;
  border: 1px solid rgba(92, 75, 55, 0.78);
  background: rgba(13, 10, 8, 0.16);
  overflow: hidden;
}

.runtime-popup-summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 12px;
  color: #f5e6cb;
  font-size: 0.84rem;
  letter-spacing: 0.03em;
}

.runtime-popup-summary::-webkit-details-marker {
  display: none;
}

.runtime-popup-body {
  display: grid;
  gap: 10px;
  padding: 0 12px 12px;
}

.study-reader-footer {
  flex: 0 0 auto;
  position: relative;
  z-index: 12;
  padding:
    0
    var(--shell-scrollbar-comp)
    var(--safe-bottom-tappable)
    0;
  background: transparent;
}

.workbench-preview-footer {
  padding:
    0
    0
    0
    0;
  margin-top: auto;
}

.workbench-preview-actions {
  justify-content: flex-end;
}

.study-action-dock {
  position: relative;
  display: flex;
  justify-content: stretch;
  align-items: flex-end;
  width: 100%;
  min-height: calc(var(--tap) + 4px);
  overflow: visible;
}

.study-action-stack {
  width: 100%;
  display: grid;
  gap: 8px;
}

.study-next-wrap {
  display: flex;
  width: 100%;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  position: relative;
  min-width: 0;
}

.study-next-wrap.is-popup-open > .study-comment-btn,
.study-next-wrap.is-popup-open > .study-continue-btn {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.study-continue-popup {
  width: 100%;
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(124, 94, 53, 0.78);
  background:
    linear-gradient(180deg, rgba(31, 24, 17, 0.98), rgba(18, 14, 10, 0.98)),
    rgba(16, 12, 9, 0.98);
  box-shadow:
    0 18px 36px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 240, 217, 0.04);
}

.study-continue-popup-shell {
  position: absolute;
  left: 0;
  right: calc(-1 * var(--shell-scrollbar-comp));
  bottom: 0;
  z-index: 18;
  padding: 0;
  pointer-events: none;
}

.study-continue-popup-shell .study-continue-popup {
  border-radius: 18px 18px var(--radius) var(--radius);
  pointer-events: auto;
}

.study-continue-popup-body {
  display: grid;
  gap: 12px;
  max-height: min(42vh, 360px);
  overflow: auto;
}

.study-continue-popup .popup-answer-dock {
  position: static;
  padding: 0;
  border-top: 0;
  background: none;
}

.study-continue-popup-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  padding-top: 4px;
}

.study-continue-popup-btn {
  position: relative;
  z-index: 1;
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
  border-radius: 14px;
}

.block-fixed-button .study-next-wrap,
.popup-builder-button-shell .study-next-wrap {
  justify-content: flex-end;
}

.study-comment-btn,
.study-continue-btn {
  width: 48px;
  height: 48px;
  min-height: 48px;
  min-width: 48px;
  border-radius: 14px;
}

.study-comment-btn {
  box-shadow: none;
  position: relative;
  padding: 0;
  font-size: 1rem;
}

.study-continue-btn {
  font-size: 1.1rem;
  box-shadow: 0 10px 18px rgba(157, 116, 39, 0.28);
}

.comment-glyph {
  position: relative;
  display: inline-block;
  width: 18px;
  height: 14px;
  border: 1.8px solid currentColor;
  border-radius: 5px;
  box-sizing: border-box;
}

.comment-glyph::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 8px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 4px 0 currentColor;
  opacity: 0.88;
}

.comment-glyph::after {
  content: "";
  position: absolute;
  left: 4px;
  bottom: -5px;
  width: 6px;
  height: 6px;
  border-left: 1.8px solid currentColor;
  border-bottom: 1.8px solid currentColor;
  transform: skewX(-24deg) rotate(-16deg);
  border-bottom-left-radius: 2px;
}

.next-icon,
.step-main-btn {
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
  border: 0;
  border-radius: 14px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 1.12rem;
  font-weight: 800;
  box-shadow: 0 10px 18px rgba(157, 116, 39, 0.28);
}

.step-main-btn[disabled],
.step-main-btn:disabled {
  opacity: 1;
  cursor: default;
}

.primary-btn {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  padding: 10px 12px;
  font-weight: 800;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 10px 18px rgba(157, 116, 39, 0.28);
}

.compact-btn {
  min-height: 38px;
  padding: 8px 10px;
  font-size: 0.88rem;
}

.editor-overlay {
  position: absolute;
  inset: 0;
  z-index: 90;
  background: rgba(5, 9, 15, 0.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding:
    max(var(--safe-top), 6px)
    calc(var(--safe-right) + 6px)
    calc(var(--safe-bottom-tappable) + 6px)
    calc(var(--safe-left) + 6px);
}

.assist-config-overlay {
  z-index: 94;
}

.assist-config-sheet {
  width: min(100%, 430px);
}

.assist-config-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.assist-config-body {
  display: grid;
  gap: 12px;
}

.assist-config-panel {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(151, 117, 68, 0.18);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(28, 22, 17, 0.42), rgba(20, 15, 12, 0.34));
}

.assist-config-panel-inline.is-inline {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.assist-config-inline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.assist-config-inline-title-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.assist-config-inline-title-icon {
  width: 15px;
  height: 15px;
  color: #d7b46a;
  flex: 0 0 auto;
}

.assist-config-inline-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.96rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0.01em;
  color: #f6ead6;
}

.assist-config-section-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: #f0ddb0;
  font-size: 12px;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.assist-config-section-icon {
  width: 14px;
  height: 14px;
  color: #d7b46a;
  flex: 0 0 auto;
}

.assist-config-grid,
.assist-config-local-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.assist-config-number-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.assist-config-rhythm-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.assist-config-field {
  display: grid;
  gap: 8px;
}

.assist-config-profile-field {
  gap: 10px;
}

.assist-config-profile-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
}

.assist-config-profile-toolbar-main {
  min-width: 0;
}

.assist-config-profile-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  flex-wrap: nowrap;
}

.assist-config-profile-toolbar-actions .assist-config-icon-action:not(.is-primary) {
  min-width: 38px;
  min-height: 38px;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 12px;
}

.assist-config-profile-toolbar-actions .assist-config-icon-action:not(.is-primary) .assist-config-action-icon {
  width: 15px;
  height: 15px;
}

.assist-config-label-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.assist-config-inline-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: #d8c29d;
  font-size: 12px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.assist-config-field-icon {
  width: 16px;
  height: 16px;
  color: #d7b46a;
  flex: 0 0 auto;
}

.assist-config-field select,
.assist-config-field input,
.assist-config-field textarea {
  width: 100%;
}

.assist-config-field select,
.assist-config-field input {
  min-height: 38px;
}

.assist-config-grid .assist-config-inline-label {
  min-height: 34px;
  align-items: flex-start;
}

.assist-config-panel-inline.is-inline .assist-config-inline-label,
.assist-config-panel-inline.is-inline .assist-config-section-label {
  color: rgba(244, 224, 190, 0.84);
}

.assist-config-panel-inline.is-inline .assist-config-field-icon,
.assist-config-panel-inline.is-inline .assist-config-section-icon,
.assist-config-panel-inline.is-inline .assist-config-inline-title-icon {
  color: #efc15e;
}

.assist-config-panel-inline.is-inline .field input,
.assist-config-panel-inline.is-inline .field select,
.assist-config-panel-inline.is-inline .field textarea {
  border-radius: 12px;
  border: 1px solid rgba(172, 131, 67, 0.72);
  background: rgba(15, 12, 9, 0.82);
  color: #fff8ec;
  font: inherit;
  font-weight: 400;
  letter-spacing: 0.01em;
}

.assist-config-panel-inline.is-inline .field textarea {
  box-sizing: border-box;
  line-height: 1.45;
}

.assist-config-course-request-field textarea {
  min-height: 108px;
  resize: vertical;
}

.assist-config-inline-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.assist-config-inline-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.assist-config-inference-hint {
  margin-top: 2px;
}

.assist-config-number-field input {
  text-align: center;
}

.assist-config-microsequence-range-field {
  gap: 10px;
}

.assist-config-range-ruler {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.assist-config-range-edge-label {
  color: #d8c29d;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.assist-config-range-shell {
  --assist-range-start: 18%;
  --assist-range-target: 36%;
  --assist-range-end: 64%;
  position: relative;
  min-height: 38px;
  min-width: 0;
  padding: 0;
}

.assist-config-range-track,
.assist-config-range-band {
  position: absolute;
  left: 15px;
  right: 15px;
  top: 50%;
  height: 10px;
  border-radius: 999px;
  transform: translateY(-50%);
}

.assist-config-range-track {
  z-index: 1;
  background: rgba(24, 18, 12, 0.98);
  border: 1px solid rgba(151, 117, 68, 0.42);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18);
}

.assist-config-range-band {
  z-index: 2;
  left: calc(15px + ((100% - 30px) * var(--assist-range-start) / 100));
  right: calc(15px + ((100% - 30px) * (100 - var(--assist-range-end)) / 100));
  background: #d5a645;
  box-shadow: 0 0 0 1px rgba(245, 218, 150, 0.3);
}

.assist-config-range-input {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  width: 100%;
  height: 38px;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  pointer-events: none;
}

.assist-config-range-input::-webkit-slider-runnable-track {
  height: 38px;
  background: transparent;
}

.assist-config-range-input::-moz-range-track {
  height: 38px;
  background: transparent;
  border: 0;
}

.assist-config-range-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 32px;
  height: 32px;
  margin-top: 3px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  pointer-events: auto;
}

.assist-config-range-input::-moz-range-thumb {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  pointer-events: auto;
}

.assist-config-range-input-min {
  z-index: 2;
}

.assist-config-range-input-target {
  z-index: 3;
}

.assist-config-range-input-max {
  z-index: 4;
}

.assist-config-range-handle-label {
  position: absolute;
  top: 50%;
  width: 34px;
  height: 34px;
  margin-left: -17px;
  border-radius: 999px;
  border: 2px solid #d5a645;
  background: #2a2015;
  color: #f8eed9;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  pointer-events: none;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18);
  transform: translateY(-50%);
  z-index: 5;
}

.assist-config-range-handle-label-min {
  left: calc(15px + ((100% - 30px) * var(--assist-range-start) / 100));
  z-index: 6;
}

.assist-config-range-handle-label-target {
  left: calc(15px + ((100% - 30px) * var(--assist-range-target) / 100));
  z-index: 7;
}

.assist-config-range-handle-label-max {
  left: calc(15px + ((100% - 30px) * var(--assist-range-end) / 100));
  z-index: 8;
}

.assist-config-student-field textarea {
  min-height: 48px;
  height: 48px;
  padding: 10px 12px;
  line-height: 1.35;
  resize: none;
}

.assist-config-semantic-section {
  display: grid;
  gap: 8px;
}

.assist-config-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.assist-config-pick-chip {
  min-height: 34px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid rgba(151, 117, 68, 0.28);
  background: rgba(28, 22, 17, 0.82);
  color: #d8c29d;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.assist-config-pick-chip.is-active {
  border-color: rgba(214, 174, 96, 0.58);
  background: rgba(80, 61, 31, 0.72);
  color: #f5dfae;
}

.assist-config-toggle-group {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 40px;
}

.assist-config-toggle-chip {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(151, 117, 68, 0.28);
  background: rgba(28, 22, 17, 0.82);
  color: #d8c29d;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.assist-config-toggle-chip.is-active {
  border-color: rgba(151, 117, 68, 0.52);
  background: rgba(80, 61, 31, 0.72);
  color: #f2d28d;
}

.assist-config-toggle-icon {
  width: 16px;
  height: 16px;
}

.assist-config-toggle-text {
  color: #d8c29d;
  font-size: 12px;
  line-height: 1.2;
  font-weight: 700;
}

.assist-config-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 4px;
}

.assist-config-footer-main,
.assist-config-footer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.provider-config-footer-actions {
  margin-left: auto;
  justify-content: flex-end;
}

.assist-config-save-action {
  border-color: rgba(238, 198, 95, 0.78);
  background: linear-gradient(180deg, rgba(233, 190, 87, 0.98), rgba(195, 151, 55, 0.98));
  color: #2b1a03;
}

.assist-config-save-action:disabled,
.assist-config-save-action[aria-disabled="true"] {
  opacity: 0.46;
  cursor: not-allowed;
}

.assist-config-icon-action.is-primary {
  min-width: 44px;
  min-height: 44px;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border-color: rgba(238, 198, 95, 0.78);
  background: linear-gradient(180deg, rgba(233, 190, 87, 0.98), rgba(195, 151, 55, 0.98));
  color: #2b1a03;
}

.assist-config-icon-action.is-primary:disabled,
.assist-config-icon-action.is-primary[aria-disabled="true"] {
  opacity: 0.58;
  cursor: wait;
}

.assist-config-status-action.is-saved {
  border-color: rgba(78, 168, 113, 0.42);
  background: linear-gradient(180deg, rgba(23, 44, 30, 0.98), rgba(16, 31, 22, 0.99));
  color: #78d690;
}

.assist-config-status-action.is-dirty {
  border-color: rgba(204, 89, 89, 0.42);
  background: linear-gradient(180deg, rgba(51, 21, 21, 0.98), rgba(35, 16, 16, 0.99));
  color: #f08e8e;
}

.assist-config-status-action.is-editing {
  border-color: rgba(214, 174, 96, 0.5);
  background: linear-gradient(180deg, rgba(56, 41, 19, 0.98), rgba(36, 27, 14, 0.99));
  color: #f4d28a;
}

.assist-config-local-panel {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(151, 117, 68, 0.22);
  border-radius: 16px;
  background: rgba(23, 18, 14, 0.54);
}

.assist-config-local-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  flex-wrap: wrap;
  gap: 8px;
}

.assist-config-icon-action {
  width: 32px;
  height: 32px;
  border-radius: 10px;
}

.assist-config-text-action {
  min-height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(151, 117, 68, 0.28);
  background: linear-gradient(180deg, rgba(34, 27, 20, 0.98), rgba(22, 17, 13, 0.99));
  color: #e9d7b5;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 10px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.assist-config-text-action:hover {
  background: linear-gradient(180deg, rgba(39, 31, 24, 0.98), rgba(28, 22, 16, 0.98));
}

.assist-config-text-action:active {
  transform: translateY(1px);
}

.assist-config-action-icon {
  width: 14px;
  height: 14px;
}

.assist-config-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(151, 117, 68, 0.34);
  background: linear-gradient(180deg, rgba(34, 27, 20, 0.98), rgba(22, 17, 13, 0.99));
  color: #e9d7b5;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255, 240, 217, 0.03);
  justify-content: center;
}

.assist-config-status-chip.is-ready {
  border-color: rgba(108, 181, 95, 0.45);
  color: #cfe8c7;
}

.assist-config-status-chip.is-offline {
  border-color: rgba(191, 97, 76, 0.45);
  color: #f0b4a8;
}

.assist-config-status-chip.is-checking {
  border-color: rgba(151, 117, 68, 0.45);
  color: #f2d28d;
}

.assist-config-status-chip.is-idle {
  border-color: rgba(151, 117, 68, 0.28);
  color: #d8c29d;
}

.assist-config-status-icon {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}

.assist-config-status-text {
  margin: 0;
}

.action-menu-overlay {
  position: absolute;
  inset: 0;
  z-index: 92;
  background: rgba(5, 9, 15, 0.5);
  display: flex;
  padding:
    max(var(--safe-top), 8px)
    calc(var(--safe-right) + 8px)
    calc(var(--safe-bottom-tappable) + 8px)
    calc(var(--safe-left) + 8px);
}

.action-menu-overlay-side {
  align-items: flex-start;
  justify-content: flex-end;
}

.action-menu-overlay-bottom {
  align-items: flex-end;
  justify-content: center;
}

.overlay-shell {
  position: absolute;
  inset: 0;
  z-index: 92;
  background: rgba(5, 9, 15, 0.55);
  display: flex;
  padding:
    max(var(--safe-top), 8px)
    calc(var(--safe-right) + 8px)
    calc(var(--safe-bottom-tappable) + 8px)
    calc(var(--safe-left) + 8px);
  align-items: flex-start;
  justify-content: flex-end;
}

.overlay-panel {
  display: flex;
  width: min(100%, 430px);
  max-height: min(
    calc(100dvh - var(--safe-top) - var(--safe-bottom-tappable) - 16px),
    860px
  );
  overflow: hidden;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(26, 21, 17, 0.995), rgba(18, 14, 11, 0.998)),
    radial-gradient(circle at top, rgba(228, 186, 104, 0.08), transparent 58%);
  border: 1px solid rgba(90, 73, 54, 0.92);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.34);
}

.overlay-panel-side {
  margin-left: auto;
}

.generation-overlay-shell {
  justify-content: center;
}

.generation-overlay-panel {
  padding: 0;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(35, 27, 18, 0.995), rgba(21, 16, 12, 0.998)),
    radial-gradient(circle at top, rgba(228, 186, 104, 0.05), transparent 58%);
  border: 0;
  border-radius: 18px;
  box-shadow: none;
}

.generation-progress-popup {
  position: fixed;
  right: calc(var(--safe-right) + 18px);
  bottom: calc(var(--safe-bottom-tappable) + 18px);
  z-index: 35;
  width: min(360px, calc(100vw - var(--safe-left) - var(--safe-right) - 28px));
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(214, 174, 96, 0.52);
  background:
    linear-gradient(180deg, rgba(24, 19, 13, 0.98), rgba(14, 11, 8, 0.98)),
    rgba(18, 14, 10, 0.96);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.42);
}

.generation-progress-popup.is-embedded {
  position: static;
  right: auto;
  bottom: auto;
  left: auto;
  width: auto;
  margin-top: 16px;
}

.generation-progress-popup.is-completed {
  border-color: rgba(111, 175, 94, 0.72);
}

.generation-progress-popup.is-failed {
  border-color: rgba(174, 94, 58, 0.9);
}

.generation-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.generation-progress-kicker,
.generation-progress-count {
  color: rgba(216, 194, 157, 0.82);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.generation-progress-title {
  margin: 0;
  color: #fff1d3;
  font-size: 1rem;
  font-weight: 900;
  line-height: 1.22;
}

.generation-progress-message {
  margin: 0;
  color: rgba(241, 224, 193, 0.82);
  font-size: 0.82rem;
  line-height: 1.35;
}

.generation-progress-bar {
  overflow: hidden;
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 241, 211, 0.1);
}

.generation-progress-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #c9a256, #83b66f);
  transition: width 0.22s ease;
}

.generation-progress-phases {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.generation-progress-phase-item {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  color: rgba(216, 194, 157, 0.74);
  font-size: 0.74rem;
  line-height: 1.3;
}

.generation-progress-phase-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid rgba(216, 194, 157, 0.24);
  color: rgba(216, 194, 157, 0.74);
  background: rgba(255, 241, 211, 0.04);
  font-size: 0.69rem;
  font-weight: 800;
}

.generation-progress-phase-item.is-current {
  color: rgba(255, 238, 201, 0.98);
}

.generation-progress-phase-item.is-current .generation-progress-phase-index {
  border-color: rgba(214, 174, 96, 0.52);
  color: #fff1d3;
  background: rgba(201, 162, 86, 0.18);
}

.generation-progress-phase-item.is-completed {
  color: rgba(222, 212, 188, 0.84);
}

.generation-progress-phase-item.is-completed .generation-progress-phase-index {
  border-color: rgba(111, 175, 94, 0.42);
  color: #d8f1cf;
  background: rgba(111, 175, 94, 0.18);
}

.action-menu-sheet {
  display: flex;
  gap: 10px;
  background:
    linear-gradient(180deg, rgba(26, 21, 17, 0.995), rgba(18, 14, 11, 0.998)),
    radial-gradient(circle at top, rgba(228, 186, 104, 0.08), transparent 58%);
  border: 1px solid rgba(90, 73, 54, 0.92);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.34);
}

.action-menu-sheet-side {
  width: 62px;
  min-height: 210px;
  padding: 10px 8px;
  border-radius: 18px;
  flex-direction: column;
  align-items: center;
}

.action-menu-sheet-bottom {
  width: min(100%, 430px);
  padding: 10px;
  border-radius: 18px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.action-menu-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(111, 88, 62, 0.88);
  background: linear-gradient(180deg, rgba(34, 27, 20, 0.98), rgba(22, 17, 13, 0.99));
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.action-menu-btn.is-danger {
  border-color: rgba(216, 132, 122, 0.72);
  color: #ffd8d2;
  background: linear-gradient(180deg, rgba(68, 31, 28, 0.98), rgba(38, 17, 16, 0.99));
}

.action-menu-icon {
  font-size: 1.2rem;
  line-height: 1;
}

.action-menu-svg-icon {
  width: 18px;
  height: 18px;
  display: block;
}

.generation-overlay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.generation-overlay-heading {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.generation-overlay-title {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: 0;
  color: #fff4e4;
}

.editor-sheet {
  width: min(100%, 430px);
  max-height: min(94dvh, 860px);
  overflow: auto;
  background:
    linear-gradient(180deg, rgba(26, 21, 17, 0.995), rgba(18, 14, 11, 0.998)),
    radial-gradient(circle at top, rgba(228, 186, 104, 0.08), transparent 58%);
  border: 1px solid rgba(90, 73, 54, 0.92);
  border-radius: 18px;
  padding: 8px;
  display: grid;
  gap: 8px;
}

.comment-sheet {
  max-height: min(70dvh, 560px);
}

.editor-head {
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  gap: 8px;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 4;
  padding-bottom: 8px;
  background: linear-gradient(180deg, rgba(26, 21, 17, 0.99) 0%, rgba(26, 21, 17, 0.95) 100%);
  border-bottom: 1px solid rgba(90, 73, 54, 0.78);
}

.editor-body {
  display: grid;
  gap: 10px;
}

.editor-helper-text {
  margin: 0;
  color: rgba(214, 193, 154, 0.9);
  font-size: 0.82rem;
  line-height: 1.5;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(111, 88, 62, 0.72);
  background: rgba(34, 27, 20, 0.72);
}

.editor-step-nav {
  border: 1px solid rgba(86, 69, 51, 0.88);
  border-radius: 12px;
  background: rgba(22, 18, 14, 0.86);
  padding: 8px;
  display: grid;
  gap: 8px;
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.field.is-secondary {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(92, 74, 55, 0.72);
  background: rgba(24, 19, 15, 0.68);
}

.card-sheet-content-empty {
  place-items: center;
  text-align: center;
}

.field label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: var(--type-xs);
}

.field-label-content {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.field-label-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.field-label-svg-icon {
  width: 16px;
  height: 16px;
}

.field-label-text {
  line-height: 1.2;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  border-radius: 10px;
  border: 1px solid var(--field-border-soft);
  background: var(--field-bg);
  color: var(--text);
  padding: 9px 10px;
  color-scheme: dark;
}

.entity-tag-combobox {
  display: grid;
  gap: 8px;
}

.entity-tag-chip-row {
  max-height: 132px;
  padding-top: 2px;
}

.entity-tag-combobox-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 8px;
  align-items: center;
}

.entity-tag-combobox-input {
  min-width: 0;
}

.entity-tag-combobox-add {
  min-height: 40px;
  border-radius: 10px;
  border: 1px solid var(--field-border-soft);
  background: rgba(28, 22, 17, 0.92);
  color: var(--text);
  font-size: 1rem;
  line-height: 1;
}

.entity-tag-chip {
  min-height: 28px;
}

.field select option {
  background: #1a1511;
  color: var(--text);
}

.field textarea {
  min-height: 160px;
  resize: vertical;
  font-family: inherit;
}

.assist-config-panel-inline.is-inline .assist-config-student-field textarea {
  min-height: 52px;
  height: 52px;
  padding: 6px 4px 6px 12px;
  line-height: 1.28;
  resize: none;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(172, 131, 67, 0.72) rgba(15, 12, 9, 0.18);
}

.assist-config-panel-inline.is-inline .assist-config-student-field textarea::-webkit-scrollbar {
  width: 4px;
}

.assist-config-panel-inline.is-inline .assist-config-student-field textarea::-webkit-scrollbar-track {
  background: rgba(15, 12, 9, 0.18);
  border-radius: 999px;
}

.assist-config-panel-inline.is-inline .assist-config-student-field textarea::-webkit-scrollbar-thumb {
  background: rgba(172, 131, 67, 0.72);
  border-radius: 999px;
}

.field-hint {
  margin: 0;
  color: rgba(193, 173, 138, 0.88);
  font-size: 0.76rem;
  line-height: 1.45;
}

@media (max-width: 420px) {
  .assist-config-inline-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.entity-action-group {
  display: grid;
  gap: 8px;
  padding-top: 4px;
}

.entity-action-list {
  display: grid;
  gap: 8px;
}

.entity-action-btn {
  width: 100%;
  min-height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(111, 88, 62, 0.88);
  background: linear-gradient(180deg, rgba(34, 27, 20, 0.98), rgba(22, 17, 13, 0.99));
  color: var(--text);
  padding: 9px 12px;
  text-align: left;
  cursor: pointer;
}

.entity-action-btn.is-danger {
  border-color: rgba(216, 132, 122, 0.72);
  color: #ffd8d2;
  background: linear-gradient(180deg, rgba(68, 31, 28, 0.98), rgba(38, 17, 16, 0.99));
}

.comment-textarea {
  min-height: 28dvh;
}

.compact-field {
  gap: 4px;
}

.compact-field label {
  font-size: 0.74rem;
}

.workbench-icon-label {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 16px;
  color: var(--muted);
}

.workbench-inline-icon {
  width: 34px;
  height: 38px;
}

.workbench-select-field {
  color: rgba(244, 224, 190, 0.76);
  font-size: 0.84rem;
}

.workbench-select-field input,
.workbench-editor-panel select,
.workbench-editor-panel textarea {
  width: 100%;
  border: 1px solid rgba(172, 131, 67, 0.72);
  border-radius: 12px;
  background: rgba(15, 12, 9, 0.82);
  color: #fff8ec;
  font: inherit;
  font-weight: 400;
  letter-spacing: 0.01em;
}

.workbench-select-field input,
.workbench-editor-panel select {
  min-height: 38px;
  padding: 0 12px;
  font-size: 0.9rem;
  line-height: 1.2;
}

.workbench-editor-panel textarea {
  padding: 10px 12px;
  font-size: 0.9rem;
  line-height: 1.45;
}

.workbench-icon {
  width: 14px;
  height: 14px;
  display: block;
  flex: 0 0 auto;
}

.editor-inline-card .field textarea {
  min-height: 24dvh;
}

.grow-field {
  min-height: 0;
}

.inline-editor-step-nav {
  padding: 8px;
}

.microsequence-assist-screen {
  display: grid;
  align-content: start;
  gap: 8px;
  overflow-y: auto;
  overflow-x: clip;
  padding-bottom: 12px;
  min-width: 0;
}

.microsequence-generator-screen {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  gap: 8px;
  overflow: hidden;
  min-height: 0;
  padding-bottom: calc(var(--safe-bottom-tappable) + 12px);
}

.microsequence-workbench-screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: 0;
}

.microsequence-workbench-screen > .topbar {
  flex: 0 0 auto;
}

.microsequence-workbench-screen > .screen-content {
  flex: 1 1 auto;
  min-height: 0;
  padding-bottom: 0;
}

.generator-preview-stage {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.generator-preview-stage .card-portrait-body {
  height: 100%;
  min-height: 0;
}

.microsequence-generator-panel {
  flex: 0 0 auto;
  margin-top: 0;
  max-height: none;
  overflow: visible;
}

.workbench-editor-panel {
  display: flex;
  flex-direction: column;
  gap: 9px;
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  overflow-x: clip;
  padding-right: 2px;
  padding-bottom: max(var(--safe-bottom-tappable), 8px);
}

.workbench-editor-pane {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
}

.workbench-editor-heading {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding-bottom: 2px;
}

.workbench-editor-title {
  font-size: 1.02rem;
}

.workbench-editor-panel .dependency-chip-row {
  min-height: 0;
  max-height: none;
  padding-bottom: 0;
}

.workbench-tag-layout {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.bottomup-grid {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.bottomup-grid-double {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.bottomup-primary-grid,
.bottomup-focus-grid {
  grid-template-columns: minmax(0, 1fr);
}

.bottomup-focus-panel {
  display: grid;
  gap: 8px;
}

.assist-simple-panel {
  gap: 10px;
}

.assist-action-options {
  display: grid;
  gap: 8px;
}

.assist-action-heading {
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
}

.workbench-editor-section-label {
  margin: 0;
  color: rgba(244, 224, 190, 0.78);
  font-size: 0.75rem;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: none;
}

.generate-section-title {
  min-width: 0;
  margin-bottom: 10px;
}

.generate-section-title-text {
  margin: 0;
  color: #e9c879;
  font-size: 11px;
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.assist-action-option {
  display: grid;
  grid-template-columns: 18px 18px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 16px;
  border: 1px solid rgba(172, 131, 67, 0.36);
  background: rgba(18, 14, 10, 0.72);
  cursor: pointer;
  min-width: 0;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.assist-action-option:hover {
  border-color: rgba(214, 174, 96, 0.52);
  background: rgba(28, 21, 15, 0.84);
}

.assist-action-option.is-selected {
  border-color: rgba(230, 192, 117, 0.88);
  background:
    linear-gradient(180deg, rgba(78, 56, 25, 0.9), rgba(35, 25, 16, 0.92)),
    rgba(18, 14, 10, 0.8);
  box-shadow: inset 0 1px 0 rgba(255, 240, 217, 0.04);
}

.assist-action-option.is-disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.assist-action-option.is-disabled:hover {
  border-color: rgba(172, 131, 67, 0.36);
  background: rgba(18, 14, 10, 0.72);
}

.assist-action-option input {
  margin: 0;
  accent-color: #d6b06d;
}

.assist-action-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #d8c29d;
}

.assist-action-icon-svg {
  width: 16px;
  height: 16px;
}

.assist-action-copy {
  min-width: 0;
}

.assist-action-title {
  color: #fff1d3;
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.2;
}

.assist-action-meta {
  display: block;
  margin-top: 4px;
  color: rgba(216, 194, 157, 0.78);
  font-size: 0.72rem;
  line-height: 1.25;
}

.bottomup-selection-panel {
  gap: 10px;
}

.bottomup-selection-head {
  display: grid;
  gap: 6px;
}

.bottomup-inline-picker {
  margin-top: 0;
}

.bottomup-selected-row {
  min-height: 0;
  max-height: none;
  padding-bottom: 0;
}

.bottomup-selected-chip {
  max-width: 100%;
}

.bottomup-selected-chip .dependency-chip-label {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bottomup-empty-copy {
  margin: 0;
}

.bottomup-chip-row {
  min-height: 0;
  gap: 6px;
}

.workbench-editor-panel .bottomup-chip-row {
  min-height: 0;
  max-height: none;
  padding-bottom: 0;
}

.bottomup-chip.is-active {
  border-color: rgba(236, 190, 95, 0.92);
  background:
    linear-gradient(180deg, rgba(91, 64, 27, 0.98), rgba(54, 37, 16, 0.995)),
    radial-gradient(circle at top, rgba(236, 190, 95, 0.18), transparent 62%);
  color: #fff4dc;
}

.bottomup-container-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.bottomup-container-label {
  min-height: 38px;
  padding: 0 11px;
  display: inline-flex;
  align-items: center;
  border-radius: 12px;
  border: 1px solid rgba(172, 131, 67, 0.72);
  background: rgba(15, 12, 9, 0.82);
  color: #fff8ec;
}

.workbench-form-row,
.workbench-tag-picker-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.workbench-tag-picker-row .assist-tag-picker {
  margin-top: 0;
}

.workbench-tag-picker-empty {
  min-height: 38px;
}

.workbench-tag-chip-row {
  padding-left: 42px;
}

.workbench-divider {
  margin: 2px 0;
}

.workbench-tag-field .assist-tag-picker {
  margin-top: 0;
}

.workbench-editor-panel .workbench-prompt-field {
  flex: 0 0 132px;
  min-height: 0;
  max-height: none;
  align-items: stretch;
}

.workbench-editor-panel .workbench-prompt-field .generate-prompt-layout {
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
}

.workbench-editor-panel .workbench-prompt-field .generate-prompt-content {
  min-width: 0;
}

.workbench-prompt-tools {
  width: 34px;
  display: grid;
  gap: 5px;
  align-content: start;
}

.workbench-inline-reset {
  margin-top: 2px;
}

.workbench-stack-button {
  min-width: 34px;
  min-height: 38px;
  width: 34px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid rgba(111, 88, 62, 0.78);
  background: linear-gradient(180deg, rgba(34, 27, 20, 0.98), rgba(22, 17, 13, 0.99));
  color: #efc15e;
  display: grid;
  place-items: center;
  padding: 0;
}

.assist-container-button-icon {
  width: 12px;
  height: 12px;
  display: block;
}

.assist-attachment-button-icon {
  width: 17px;
  height: 17px;
  display: block;
}

.assist-attachment-input {
  display: none;
}

.assist-attachment-chip-row {
  min-height: 0;
  padding-bottom: 0;
  gap: 8px;
}

.assist-attachment-chip {
  min-width: 0;
  max-width: 100%;
  min-height: 30px;
  padding: 0 10px 0 8px;
  border-radius: 10px;
  border: 1px solid rgba(170, 134, 86, 0.72);
  background: linear-gradient(180deg, rgba(54, 42, 30, 0.98), rgba(34, 27, 20, 0.99));
  color: #f5e6cb;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  box-shadow: inset 0 1px 0 rgba(255, 242, 214, 0.04);
}

.assist-attachment-chip-icon {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  color: #efc15e;
}

.assist-attachment-chip .assist-attachment-button-icon {
  width: 14px;
  height: 14px;
}

.assist-attachment-chip .dependency-chip-label {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workbench-editor-panel .assist-prompt {
  display: block;
  width: 100%;
  min-height: 118px;
  max-height: 38dvh;
  padding: 10px 12px;
  border: 1px solid rgba(172, 131, 67, 0.72);
  border-radius: 14px;
  background: rgba(15, 12, 9, 0.82);
  overflow-y: auto;
  resize: vertical;
}

.draft-generator-control-panel {
  height: auto;
  overflow: visible;
}

.draft-generator-control-panel .dependency-chip-row {
  min-height: 0;
  max-height: none;
  padding-bottom: 0;
}

.draft-generator-control-panel .workbench-prompt-field {
  grid-template-rows: auto auto;
  flex: 0 0 auto;
  min-height: 0;
  max-height: none;
}

.draft-generator-control-panel .assist-prompt {
  height: 84px;
  min-height: 64px;
  max-height: 38dvh;
  resize: vertical;
}

.builder-layout,
.inline-builder-layout {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 10px;
  align-items: start;
}

.palette-col,
.inline-palette-col {
  border: 1px solid rgba(86, 69, 51, 0.9);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(24, 19, 15, 0.985), rgba(17, 13, 10, 0.99)),
    radial-gradient(circle at top, rgba(228, 186, 104, 0.06), transparent 62%);
  display: grid;
  gap: 5px;
  align-content: start;
  padding: 5px;
}

.palette-icon {
  min-width: 44px;
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid rgba(83, 67, 49, 0.9);
  background: linear-gradient(180deg, rgba(31, 24, 19, 0.98), rgba(22, 17, 13, 0.98));
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 700;
}

.palette-icon[data-block-type="paragraph"] {
  border-color: rgba(236, 155, 175, 0.42);
  background:
    linear-gradient(180deg, rgba(63, 31, 40, 0.98), rgba(30, 15, 20, 0.99)),
    radial-gradient(circle at top, rgba(236, 155, 175, 0.24), transparent 62%);
  color: #ffe7ed;
}

.palette-icon[data-block-type="list"] {
  border-color: rgba(193, 158, 183, 0.46);
  background:
    linear-gradient(180deg, rgba(47, 30, 39, 0.985), rgba(22, 14, 18, 0.995)),
    radial-gradient(circle at top, rgba(193, 158, 183, 0.24), transparent 58%);
  color: #f8edf5;
}

.palette-icon[data-block-type="choice"] {
  border-color: rgba(126, 187, 213, 0.44);
  background:
    linear-gradient(180deg, rgba(22, 33, 40, 0.985), rgba(11, 18, 22, 0.995)),
    radial-gradient(circle at top, rgba(126, 187, 213, 0.2), transparent 60%);
  color: #e8f6ff;
}

.palette-icon[data-block-type="table"] {
  border-color: rgba(255, 176, 119, 0.46);
  background:
    linear-gradient(180deg, rgba(63, 35, 20, 0.985), rgba(29, 17, 10, 0.995)),
    radial-gradient(circle at top, rgba(255, 176, 119, 0.24), transparent 60%);
  color: #fff0e2;
}

.palette-icon[data-block-type="flowchart"] {
  border-color: rgba(175, 200, 152, 0.46);
  background:
    linear-gradient(180deg, rgba(31, 37, 24, 0.985), rgba(16, 19, 12, 0.995)),
    radial-gradient(circle at top, rgba(175, 200, 152, 0.24), transparent 56%);
  color: #f0f7e8;
}

.palette-icon[data-block-type="popup"] {
  border-color: rgba(153, 215, 119, 0.42);
  background:
    linear-gradient(180deg, rgba(23, 45, 21, 0.98), rgba(12, 24, 12, 0.99)),
    radial-gradient(circle at top, rgba(153, 215, 119, 0.2), transparent 60%);
  color: #f1ffe7;
}

.palette-icon.is-fixed,
.palette-icon:disabled {
  opacity: 0.72;
  cursor: default;
}

.canvas-col {
  border: 1px solid rgba(90, 73, 54, 0.9);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(18, 14, 11, 0.99), rgba(13, 10, 8, 0.995)),
    radial-gradient(circle at top, rgba(228, 186, 104, 0.05), transparent 58%);
  min-height: 180px;
  padding: 9px;
  display: grid;
  gap: 10px;
  box-shadow: inset 0 1px 0 rgba(255, 241, 221, 0.04);
}

.canvas-empty {
  min-height: 72px;
  color: #ab997f;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 8px;
  font-size: var(--type-sm);
  line-height: var(--leading-relaxed);
}

.builder-block {
  position: relative;
  border: 1px solid rgba(80, 64, 47, 0.92);
  border-radius: 16px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(28, 22, 17, 0.985), rgba(19, 15, 12, 0.992)),
    radial-gradient(circle at top, rgba(228, 186, 104, 0.05), transparent 62%);
  padding: 9px;
  display: grid;
  gap: 7px;
  box-shadow:
    0 12px 24px rgba(1, 4, 10, 0.18),
    inset 0 1px 0 rgba(255, 241, 221, 0.04);
}

.builder-block::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, rgba(228, 186, 104, 0.92), rgba(161, 118, 52, 0.62));
}

.builder-block[data-block-kind="heading"],
.builder-block.builder-block-kind-heading {
  border-color: #6d573c;
  background:
    linear-gradient(180deg, rgba(42, 34, 18, 0.96), rgba(23, 18, 10, 0.98)),
    radial-gradient(circle at top, rgba(255, 214, 123, 0.15), transparent 62%);
}

.builder-block[data-block-kind="heading"]::before,
.builder-block.builder-block-kind-heading::before {
  background: linear-gradient(90deg, rgba(255, 222, 141, 0.95), rgba(155, 124, 61, 0.65));
}

.builder-block[data-block-kind="paragraph"],
.builder-block.builder-block-kind-paragraph {
  border-color: #83616d;
  background:
    linear-gradient(180deg, rgba(44, 24, 30, 0.97), rgba(24, 14, 18, 0.99)),
    radial-gradient(circle at top, rgba(236, 155, 175, 0.16), transparent 60%);
}

.builder-block[data-block-kind="paragraph"]::before,
.builder-block.builder-block-kind-paragraph::before {
  background: linear-gradient(90deg, rgba(236, 155, 175, 0.96), rgba(138, 78, 94, 0.72));
}

.builder-block[data-block-kind="list"],
.builder-block.builder-block-kind-list {
  border-color: #8d6d84;
  background:
    linear-gradient(180deg, rgba(45, 29, 38, 0.985), rgba(21, 13, 17, 0.995)),
    radial-gradient(circle at top, rgba(193, 158, 183, 0.22), transparent 54%);
}

.builder-block[data-block-kind="list"]::before,
.builder-block.builder-block-kind-list::before {
  background: linear-gradient(90deg, rgba(193, 158, 183, 0.96), rgba(122, 86, 112, 0.76));
}

.builder-block[data-block-kind="choice"],
.builder-block.builder-block-kind-choice {
  border-color: #57788c;
  background:
    linear-gradient(180deg, rgba(21, 32, 40, 0.985), rgba(11, 17, 22, 0.995)),
    radial-gradient(circle at top, rgba(126, 187, 213, 0.16), transparent 56%);
}

.builder-block[data-block-kind="choice"]::before,
.builder-block.builder-block-kind-choice::before {
  background: linear-gradient(90deg, rgba(126, 187, 213, 0.96), rgba(73, 118, 139, 0.74));
}

.builder-block[data-block-kind="table"],
.builder-block.builder-block-kind-table {
  border-color: #9b714f;
  background:
    linear-gradient(180deg, rgba(58, 34, 20, 0.98), rgba(28, 17, 10, 0.99)),
    radial-gradient(circle at top, rgba(255, 176, 119, 0.14), transparent 60%);
}

.builder-block[data-block-kind="table"]::before,
.builder-block.builder-block-kind-table::before {
  background: linear-gradient(90deg, rgba(255, 176, 119, 0.96), rgba(162, 102, 58, 0.74));
}

.builder-block[data-block-kind="flowchart"],
.builder-block.builder-block-kind-flowchart {
  border-color: #748a63;
  background:
    linear-gradient(180deg, rgba(27, 33, 21, 0.99), rgba(14, 17, 11, 0.997)),
    radial-gradient(circle at top, rgba(175, 200, 152, 0.24), transparent 52%);
}

.builder-block[data-block-kind="flowchart"]::before,
.builder-block.builder-block-kind-flowchart::before {
  background: linear-gradient(90deg, rgba(175, 200, 152, 0.96), rgba(107, 124, 85, 0.76));
}

.builder-block[data-block-kind="popup"],
.builder-block.builder-block-kind-popup {
  border-color: #8f6d33;
  background:
    linear-gradient(180deg, rgba(60, 45, 22, 0.98), rgba(30, 22, 11, 0.99)),
    radial-gradient(circle at top, rgba(228, 186, 104, 0.18), transparent 60%);
}

.builder-block[data-block-kind="popup"]::before,
.builder-block.builder-block-kind-popup::before {
  background: linear-gradient(90deg, rgba(242, 215, 157, 0.98), rgba(205, 148, 62, 0.76));
}

.builder-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  row-gap: 6px;
  padding-bottom: 5px;
  border-bottom: 1px solid rgba(122, 99, 72, 0.24);
}

.builder-meta {
  min-width: 0;
  flex: 1 1 0;
  display: flex;
  align-items: center;
  min-height: 34px;
  overflow: hidden;
}

.builder-kind-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  max-width: 100%;
  padding: 0 11px;
  border-radius: 11px;
  border: 1px solid rgba(131, 109, 83, 0.28);
  background: rgba(19, 15, 12, 0.76);
  box-shadow: inset 0 1px 0 rgba(255, 240, 217, 0.04);
  color: #f1e9dc;
  font-size: var(--type-xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: none;
}

.builder-tool-right {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
}

.builder-tool-handle {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  cursor: grab;
}

.builder-tool-handle:active {
  cursor: grabbing;
}

.disabled-icon {
  opacity: 0.46;
}

.inline-editor-textarea {
  min-height: 18dvh;
}

.block-markdown-textarea {
  min-height: 14dvh;
}

.title-block-input {
  min-height: 42px;
  font-size: 1.02rem;
  font-weight: 600;
}

.builder-nested-stack {
  display: grid;
  gap: 8px;
}

.builder-inline-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.inline-palette-icon {
  min-width: 36px;
  min-height: 36px;
  width: 36px;
  height: 36px;
  font-size: 0.76rem;
}

.card-editor-button-config {
  display: grid;
  gap: 8px;
}

.card-editor-button-preview {
  padding-top: 2px;
}

.popup-builder-footer-preview {
  display: grid;
  justify-items: end;
}

.popup-builder-button-shell {
  width: 100%;
}

.button-config input:disabled,
.button-config textarea:disabled {
  opacity: 0.72;
}

.toggle-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.toggle-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.block-fixed {
  width: 100%;
  border-radius: 12px;
  border: 1px dashed rgba(136, 108, 76, 0.72);
  background: rgba(18, 14, 11, 0.48);
  padding: 10px;
}

.button-popup-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 34px;
  padding: 0 2px;
}

.button-popup-meta.disabled {
  opacity: 0.58;
}

.flowchart-editor-block,
.flowchart-editor-node-body,
.flowchart-editor-case-list {
  display: grid;
  gap: 10px;
}

.flowchart-editor-sequence {
  display: grid;
  gap: 8px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid rgba(148, 171, 129, 0.2);
  background: rgba(10, 13, 8, 0.35);
}

.flowchart-editor-sequence + .flowchart-editor-sequence {
  margin-top: 8px;
}

.flowchart-editor-sequence-head,
.flowchart-editor-case-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.flowchart-editor-sequence-controls {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.flowchart-editor-kind-select {
  min-width: 160px;
}

.flowchart-editor-node {
  margin-left: 8px;
}

.flowchart-editor-field,
.flowchart-editor-kind-row {
  display: grid;
  gap: 4px;
}

.flowchart-editor-field-label {
  font-size: var(--type-xs);
  color: var(--text-soft);
}

.flowchart-editor-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.flowchart-editor-case {
  display: grid;
  gap: 8px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(148, 171, 129, 0.16);
  background: rgba(0, 0, 0, 0.12);
}

.flowchart-editor-add-btn {
  white-space: nowrap;
}

.flowchart-editor-empty {
  min-height: auto;
}

@media (max-width: 420px) {
  .builder-layout,
  .inline-builder-layout {
    grid-template-columns: 50px 1fr;
    gap: 8px;
  }

  .palette-col,
  .inline-palette-col {
    padding: 4px;
  }

  .palette-icon {
    min-width: 40px;
    min-height: 40px;
  }
}

.microsequence-assist-panel {
  border: 1px solid rgba(86, 69, 51, 0.88);
  border-radius: 16px;
  background: rgba(22, 18, 14, 0.86);
  padding: 10px;
  display: grid;
  gap: 7px;
  min-width: 0;
  overflow-x: clip;
}

.microsequence-assist-panel.assist-action-panel {
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  box-shadow: none;
}

.assist-action-panel .assist-action-option {
  background: linear-gradient(180deg, rgba(34, 27, 20, 0.98), rgba(22, 17, 13, 0.99));
}

.assist-action-panel .assist-action-option:hover {
  background: linear-gradient(180deg, rgba(39, 31, 24, 0.98), rgba(28, 22, 16, 0.98));
}

.assist-action-panel .assist-action-option.is-selected {
  background: linear-gradient(180deg, rgba(39, 31, 24, 0.98), rgba(28, 22, 16, 0.98));
}

.assist-action-panel .assist-action-option.is-disabled,
.assist-action-panel .assist-action-option.is-disabled:hover {
  background: linear-gradient(180deg, rgba(34, 27, 20, 0.98), rgba(22, 17, 13, 0.99));
}

.dependency-strip {
  display: grid;
  gap: 6px;
  min-height: 140px;
  max-height: 140px;
  overflow: auto;
  align-content: start;
}

.dependency-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 86px;
  overflow-y: auto;
  overflow-x: clip;
  align-content: flex-start;
  padding: 6px 0 2px;
}

.assist-tag-picker {
  display: grid;
  grid-template-columns: 1fr 34px;
  gap: 8px;
  margin-top: 6px;
  min-width: 0;
}

.assist-toolbar,
.assist-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.assist-toolbar {
  justify-content: flex-end;
}

.assist-card-panel {
  gap: 4px;
}

.dependency-tag {
  min-height: 26px;
  border-radius: 12px;
  border: 1px solid rgba(111, 88, 62, 0.88);
  background: linear-gradient(180deg, rgba(34, 27, 20, 0.98), rgba(22, 17, 13, 0.99));
  color: var(--muted);
  padding: 5px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.74rem;
  text-align: left;
  cursor: pointer;
}

.dependency-tag.active {
  border-color: var(--accent);
  color: var(--text);
  box-shadow: 0 0 0 1px rgba(228, 186, 104, 0.32) inset;
}

.dependency-tag-slot {
  border-style: dashed;
  border-color: rgba(96, 77, 55, 0.72);
  background: rgba(15, 12, 9, 0.36);
  cursor: default;
  min-height: 26px;
}

.dependency-chip-button {
  min-height: 24px;
  padding-right: 8px;
  gap: 6px;
  background: linear-gradient(180deg, rgba(67, 53, 37, 0.98), rgba(44, 34, 24, 0.99));
  border-color: rgba(170, 134, 86, 0.72);
  color: #f5e6cb;
  cursor: pointer;
}

.dependency-chip-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dependency-chip-remove {
  flex: 0 0 auto;
  color: #f0d7a2;
  font-size: 0.76rem;
  line-height: 1;
}

.dependency-tag-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dependency-tag-remove {
  flex: 0 0 auto;
  color: #f0d7a2;
}

.assist-prompt {
  min-height: 88px;
}

.assist-objective-input {
  min-height: 40px;
}

.assist-card-caption,
.assist-last-request {
  line-height: 1.45;
}

.assist-card-caption,
.chip-muted {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.assist-card-caption {
  white-space: nowrap;
}

.assist-actions {
  display: grid;
  grid-template-columns: 34px 48px;
  width: 100%;
  justify-content: stretch;
  gap: 4px;
  align-items: center;
}

.generate-action-row.assist-actions-wide {
  grid-template-columns: 34px minmax(0, 1fr) 34px 34px 44px;
  width: 100%;
  gap: 5px;
}

.generate-action-row.assist-actions-wide.assist-request-actions {
  grid-template-columns: minmax(0, 1fr) 34px 34px 44px;
}

.generate-action-row.assist-actions-wide.assist-feedback-actions {
  grid-template-columns: minmax(0, 1fr) 34px 34px 44px;
}

.generate-action-row.assist-actions-wide .generate-model-field {
  width: 100%;
  min-width: 0;
}

.generate-action-row.assist-actions-wide .generate-icon-field {
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 6px;
}

.generate-action-row.assist-actions-wide .generate-icon-label {
  min-width: 34px;
  min-height: 38px;
  width: 34px;
  height: 38px;
  border-radius: 12px;
}

.generate-action-row.assist-actions-wide select {
  min-width: 0;
  min-height: 38px;
  width: 100%;
  padding: 0 12px;
  font-size: 0.88rem;
}

.generate-action-row.assist-actions-wide .generate-inline-icon {
  min-width: 34px;
  min-height: 38px;
  width: 34px;
  height: 38px;
}

.assist-feedback-edit-button {
  padding: 0;
  color: #d8c29d;
}

.assist-feedback-edit-button:disabled,
.assist-feedback-edit-button[aria-disabled="true"] {
  color: rgba(216, 194, 157, 0.36);
  opacity: 0.56;
  cursor: not-allowed;
}

.generate-action-row.assist-actions-wide .generate-submit {
  min-width: 44px;
  min-height: 44px;
  width: 44px;
  height: 44px;
}

.editor-step-nav-head {
  grid-template-columns: 36px minmax(0, 1fr) 36px;
  min-width: 0;
}

@media (max-width: 430px) {
  .overlay-shell {
    padding:
      max(var(--safe-top), 6px)
      calc(var(--safe-right) + 6px)
      calc(var(--safe-bottom-tappable) + 6px)
      calc(var(--safe-left) + 6px);
    align-items: flex-end;
    justify-content: center;
  }

  .overlay-panel,
  .overlay-panel-side,
  .generation-overlay-panel {
    width: 100%;
    max-width: 100%;
    max-height: min(
      calc(100dvh - var(--safe-top) - var(--safe-bottom-tappable) - 12px),
      860px
    );
    margin-left: 0;
    border-radius: 18px;
  }

  .generation-progress-popup {
    right: calc(var(--safe-right) + 12px);
    bottom: calc(var(--safe-bottom-tappable) + 12px);
    left: calc(var(--safe-left) + 12px);
    width: auto;
    padding: 14px;
  }

  .microsequence-generator-screen,
  .microsequence-assist-screen,
  .microsequence-assist-panel,
  .editor-step-nav,
  .context-band,
  .assist-tag-picker,
  .assist-actions {
    min-width: 0;
  }

  .generate-action-row.assist-actions-wide {
    grid-template-columns: 32px minmax(0, 1fr) 32px 32px 42px;
    gap: 4px;
  }

  .generate-action-row.assist-actions-wide.assist-request-actions {
    grid-template-columns: minmax(0, 1fr) 32px 32px 42px;
  }

  .generate-action-row.assist-actions-wide.assist-feedback-actions {
    grid-template-columns: minmax(0, 1fr) 32px 32px 42px;
  }

  .microsequence-generator-screen {
    padding-bottom: calc(var(--safe-bottom-tappable) + 20px);
  }

  .workbench-editor-panel {
    padding-bottom: calc(var(--safe-bottom-tappable) + 10px);
  }

  .bottomup-grid-double {
    grid-template-columns: minmax(0, 1fr);
  }

  .generate-action-row.assist-actions-wide .generate-icon-field {
    grid-template-columns: 32px minmax(0, 1fr);
    gap: 4px;
  }

  .generate-action-row.assist-actions-wide .generate-icon-label {
    min-width: 32px;
    min-height: 38px;
    width: 32px;
    height: 36px;
  }

  .generate-action-row.assist-actions-wide .generate-inline-icon {
    min-width: 32px;
    min-height: 38px;
    width: 32px;
    height: 36px;
  }

  .generate-action-row.assist-actions-wide .generate-submit {
    min-width: 42px;
    min-height: 42px;
    width: 42px;
    height: 42px;
  }

}

.workbench-editor-panel .assist-feedback-panel {
  box-sizing: border-box;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 7px;
  width: auto;
  flex: 1 0 auto;
  min-height: 0;
  max-height: none;
  border: 0;
  border-radius: 0 0 17px 17px;
  background:
    radial-gradient(circle at top right, rgba(181, 130, 57, 0.1), transparent 58%),
    linear-gradient(180deg, rgba(28, 20, 14, 0.98), rgba(18, 14, 10, 0.995)),
    rgba(15, 12, 9, 0.98);
  margin: 0 0 calc(-12px - max(var(--safe-bottom-tappable), 8px));
  padding:
    10px
    12px
    calc(10px + max(var(--safe-bottom-tappable), 8px))
    12px;
  overflow: hidden;
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 212, 0.05),
    inset 0 12px 22px rgba(0, 0, 0, 0.12);
}

.assist-feedback-panel.is-warning {
  border-color: rgba(174, 94, 58, 0.9);
  background:
    linear-gradient(180deg, rgba(26, 15, 11, 0.99), rgba(15, 11, 8, 0.995)),
    rgba(15, 11, 8, 0.99);
  box-shadow:
    inset 0 1px 0 rgba(255, 214, 184, 0.05),
    inset 0 12px 22px rgba(0, 0, 0, 0.12);
}

.assist-feedback-panel.is-attention {
  border-color: rgba(193, 146, 66, 0.92);
  background:
    linear-gradient(180deg, rgba(25, 18, 12, 0.99), rgba(15, 11, 8, 0.995)),
    rgba(15, 11, 8, 0.99);
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 212, 0.05),
    inset 0 12px 22px rgba(0, 0, 0, 0.12);
}

.assist-feedback-panel.is-muted {
  border-color: rgba(104, 91, 74, 0.88);
  background:
    linear-gradient(180deg, rgba(22, 19, 16, 0.99), rgba(14, 12, 10, 0.995)),
    rgba(14, 12, 10, 0.99);
}

.workbench-editor-panel .assist-feedback-panel .tiny {
  margin: 0;
}

.assist-feedback-heading {
  order: 1;
  display: grid;
  place-items: center;
  min-height: 22px;
  text-align: center;
}

.assist-feedback-field {
  flex: 0 0 132px;
  order: 2;
  width: 100%;
  display: grid;
  min-height: 0;
  max-height: none;
  align-items: stretch;
}

.assist-feedback-content {
  display: block;
  width: 100%;
}

.assist-feedback-actions {
  order: 3;
  flex: 0 0 auto;
  width: 100%;
  margin-top: -3px;
}

.assist-feedback-textarea[readonly] {
  opacity: 0.94;
  cursor: default;
}

.workbench-quick-actions-panel {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(86, 69, 51, 0.88);
  border-radius: 14px;
  background: rgba(22, 18, 14, 0.86);
  overflow: visible;
}

.workbench-quick-actions-panel .tiny {
  margin: 0;
  line-height: 1.25;
}

.workbench-quick-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.workbench-quick-actions .assist-quick-action {
  position: static;
  flex: 0 0 40px;
  min-width: 40px;
  min-height: 40px;
  width: 40px;
  height: 40px;
  margin: 0;
}

.home-tabbar {
  position: relative;
  display: flex;
  gap: 0;
  padding-top: 6px;
  padding-right: 10px;
  margin: 0;
}

.home-tabbar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 10px;
  bottom: 0;
  border-bottom: 1px solid rgba(111, 88, 62, 0.92);
}

.home-tab {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-width: 54px;
  min-height: 40px;
  margin-right: -1px;
  padding: 7px 15px 6px;
  border: 1px solid rgba(111, 88, 62, 0.88);
  border-bottom: 0;
  border-radius: 14px 14px 0 0;
  background: linear-gradient(180deg, rgba(39, 31, 24, 0.98), rgba(23, 18, 14, 0.98));
  color: #cdbba0;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 240, 217, 0.04);
}

.home-tab.active {
  z-index: 2;
  color: #f1c46d;
  border-color: rgba(211, 160, 69, 0.84);
  background: linear-gradient(180deg, rgba(73, 57, 33, 0.99), rgba(46, 35, 22, 0.99));
  box-shadow:
    inset 0 1px 0 rgba(255, 241, 214, 0.09),
    0 -1px 0 rgba(214, 174, 96, 0.14),
    0 0 0 1px rgba(246, 214, 150, 0.34);
}

.home-tab.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: rgba(46, 35, 22, 0.99);
}

.home-tab-icon {
  width: 17px;
  height: 17px;
  pointer-events: none;
}

.icon-ghost svg,
.open-main svg,
.open-mini svg {
  pointer-events: none;
}

.home-generate-pane {
  display: grid;
  gap: 0;
  width: 100%;
  max-height: min(
    calc(100dvh - var(--safe-top) - var(--safe-bottom-tappable) - 16px),
    860px
  );
  overflow-y: auto;
  overflow-x: hidden;
}

.generate-card {
  display: grid;
  gap: 9px;
  width: 100%;
  padding: 12px;
  border: 1px solid rgba(90, 73, 54, 0.92);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(73, 57, 33, 0.68), rgba(31, 24, 17, 0.98)),
    radial-gradient(circle at top, rgba(246, 214, 150, 0.1), transparent 62%);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.34);
}

.generate-main-stack {
  display: grid;
  gap: 9px;
}

.generate-card.is-planning-expanded .generate-main-stack {
  opacity: 0.52;
  filter: saturate(0.78);
}

.generate-card .field {
  display: grid;
  color: rgba(244, 224, 190, 0.76);
  font-size: 0.84rem;
}

.generate-plain-section {
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  box-shadow: none;
}

.generate-icon-field {
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 6px;
  align-items: center;
}

.generate-scope-field {
  align-items: stretch;
}

.generate-scope-button {
  width: 34px;
  min-width: 34px;
  min-height: 38px;
  border: 1px solid rgba(111, 88, 62, 0.78);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(34, 27, 20, 0.98), rgba(22, 17, 13, 0.99));
  color: #c9ab68;
  display: grid;
  place-items: center;
  padding: 0;
}

.generate-scope-button.is-pressed {
  border-color: rgba(214, 174, 96, 0.82);
  background: linear-gradient(180deg, rgba(91, 68, 34, 0.98), rgba(53, 38, 21, 0.99));
  color: #fff0cf;
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 213, 0.08),
    0 0 0 1px rgba(214, 174, 96, 0.18);
}

.generate-scope-button:disabled,
.generate-scope-button[aria-disabled="true"] {
  opacity: 0.38;
  cursor: not-allowed;
  box-shadow: none;
}

.generate-prompt-field {
  align-items: stretch;
}

.generate-prompt-layout {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
}

.generate-prompt-tools {
  display: grid;
  gap: 5px;
  align-content: start;
  justify-items: center;
}

.generate-prompt-content {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.assist-quick-action {
  flex: 0 0 auto;
  min-width: 40px;
  width: 40px;
  height: 40px;
}

.assist-quick-action-icon {
  width: 15px;
  height: 15px;
  display: block;
}

.generate-combobox-shell {
  min-width: 0;
}

.generate-icon-label {
  width: 34px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(111, 88, 62, 0.78);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(34, 27, 20, 0.98), rgba(22, 17, 13, 0.99));
  color: #efc15e;
}

.generate-field-icon {
  width: 17px;
  height: 17px;
}

.generate-card select,
.generate-card input,
.generate-card textarea {
  width: 100%;
  border: 1px solid rgba(172, 131, 67, 0.72);
  border-radius: 12px;
  background: rgba(15, 12, 9, 0.82);
  color: #fff8ec;
  font: inherit;
  font-weight: 400;
  letter-spacing: 0.01em;
}

.generate-card select {
  min-height: 38px;
  padding: 0 12px;
  font-size: 0.9rem;
  font-family: var(--font-ui);
}

.generate-card input {
  min-height: 38px;
  padding: 0 12px;
  font-size: 0.9rem;
  font-family: var(--font-ui);
}

.generate-card select option {
  font-weight: 400;
}

.generate-card textarea {
  min-height: 118px;
  padding: 10px 12px;
  font-size: 0.9rem;
  resize: vertical;
  line-height: 1.45;
}

.generate-card .generate-section-title {
  margin-bottom: 6px;
}

.generate-card .generate-section-title-text {
  color: rgba(244, 224, 190, 0.78);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: none;
}

.generate-divider {
  height: 1px;
  margin: 4px 0;
  background: rgba(151, 117, 68, 0.28);
}

.generate-assist-config-shell {
  display: grid;
  gap: 12px;
  padding: 12px 0 0;
  margin-top: 4px;
  border-top: 1px solid rgba(151, 117, 68, 0.24);
}

.generate-provider-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.generate-provider-field {
  min-width: 0;
}

.generate-provider-input {
  width: 100%;
}

.generate-action-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px 34px 44px;
  gap: 5px;
  width: 100%;
  align-items: center;
}

.generate-model-field {
  min-width: 0;
  width: 100%;
  max-width: none;
  justify-self: stretch;
}

.generate-inline-icon {
  min-width: 34px;
  min-height: 38px;
  width: 34px;
  height: 38px;
}

.generate-inline-icon.is-pressed {
  border-color: rgba(214, 174, 96, 0.82);
  background: linear-gradient(180deg, rgba(91, 68, 34, 0.98), rgba(53, 38, 21, 0.99));
  color: #fff0cf;
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 213, 0.08),
    0 0 0 1px rgba(214, 174, 96, 0.18);
}

.generate-submit {
  min-width: 44px;
  min-height: 44px;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  font-weight: 900;
  border-radius: 12px;
}

.generate-submit-icon {
  width: 18px;
  height: 18px;
}

.generate-submit:disabled,
.generate-submit[aria-disabled="true"] {
  opacity: 0.44;
  cursor: not-allowed;
  box-shadow: none;
}

.generate-action-preview {
  margin: 0;
  display: grid;
  gap: 5px;
}

.generate-action-preview-compact {
  gap: 0;
}

@media (max-width: 520px) {
  .assist-config-grid,
  .assist-config-local-grid,
  .assist-config-number-grid,
  .assist-config-rhythm-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .assist-config-toggle-row,
  .assist-config-local-actions {
    grid-template-columns: minmax(0, 1fr);
  }

  .assist-config-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .assist-config-footer-main,
  .assist-config-footer-actions {
    justify-content: space-between;
  }

  .assist-config-save-action {
    margin-left: auto;
    width: 32px;
    align-self: flex-end;
  }
}

.generate-action-caption {
  margin: 0;
}

.generate-action-summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: #d8c29d;
  font-size: var(--type-sm);
  line-height: 1.35;
}

.generate-action-summary-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.generate-action-summary-text {
  min-width: 0;
  overflow-wrap: anywhere;
}

.generate-feedback {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border: 1px solid rgba(111, 175, 94, 0.68);
  border-radius: 18px;
  background: rgba(19, 42, 20, 0.72);
}

.generate-feedback.is-warning {
  border-color: rgba(174, 94, 58, 0.9);
  background: rgba(52, 24, 18, 0.92);
}

.generate-feedback p {
  margin: 0;
  line-height: 1.4;
}

.generate-feedback button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 14px;
  background: #f2c66a;
  color: #23180f;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
}

.generate-feedback-action {
  flex: 0 0 auto;
}

#home-panel-courses {
  display: grid;
  gap: 8px;
  padding-top: 8px;
}
