/* Selected workshop layout. Load after styles.css; keep the data and engine separate. */
:root {
  --workshop-header: 76px;
  --workshop-rail: 192px;
  --workshop-bg: #191209;
  --workshop-panel: #241d13;
  --workshop-line: #4d402b;
  --workshop-ivory: #f1e5cb;
  --workshop-muted: #c0b39b;
  --workshop-gold: #e5c46c;
  --workshop-blue: #2898ed;
}

html { min-width: 0; }
body { background: var(--workshop-bg); }
body, .app-header, .app-main, .class-sidebar, dialog {
  font-family: 'Forever Alegreya', Georgia, 'Times New Roman', serif;
}
.app-header {
  min-height: var(--workshop-header);
  display: grid;
  grid-template-columns: minmax(0, 2fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 24px;
  padding: 12px 36px;
  border-bottom: 1px solid var(--workshop-line);
  background: #171007;
}
.app-header .brand {
  width: max-content;
  max-width: 100%;
  gap: 18px;
  color: var(--workshop-gold);
  font-family: 'Forever Alegreya', Georgia, serif;
  font-size: 32px;
  font-weight: 600;
  line-height: 1.1;
}
.app-header .brand-subtitle,
.app-header .brand .brand-subtitle {
  display: block;
  min-width: 0;
  padding-left: 18px;
  border-left: 1px solid #6a5533;
  color: var(--workshop-gold);
  font-family: 'Forever Alegreya', Georgia, serif;
  font-size: 22px;
  font-weight: 500;
  line-height: 1.25;
}
.main-nav { display: flex; align-items: stretch; gap: 20px; }
.main-nav button[data-view] {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 47px;
  padding: 7px 10px 10px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: #cbbb9e;
  font-size: 18px;
  font-weight: 500;
  white-space: nowrap;
}
.main-nav button[data-view]:hover { color: var(--workshop-ivory); }
.main-nav button[data-view].active,
.main-nav button[data-view][aria-current='page'],
.main-nav button[data-view][aria-selected='true'] {
  border-bottom-color: var(--workshop-gold);
  color: #f0d77c;
  font-weight: 700;
}
.main-nav .count, .main-nav .badge, #saved-count {
  min-width: 22px;
  padding: 0 5px;
  border: 1px solid #80643b;
  border-radius: 4px;
  color: var(--workshop-ivory);
  font-size: 14px;
  line-height: 20px;
  text-align: center;
}
.app-header .support-button {
  justify-self: end;
  min-height: 42px;
  padding: 8px 18px;
  gap: 9px;
  border-color: #f1d180;
  background: var(--workshop-gold);
  color: #241a08;
  font-size: 16px;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px #c49d4566;
  white-space: nowrap;
}
.support-button img, .support-button svg { width: 20px; height: 20px; }
.ui-icon {
  display: inline-block;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  object-fit: contain;
  vertical-align: middle;
  filter: brightness(0) saturate(100%) invert(83%) sepia(30%) saturate(659%) hue-rotate(351deg) brightness(96%) contrast(87%);
}
.button .ui-icon, .support-button .ui-icon { filter: brightness(0) opacity(.86); }
.class-button.active .ui-icon { filter: brightness(0) saturate(100%) invert(55%) sepia(77%) saturate(2250%) hue-rotate(181deg) brightness(104%) contrast(95%); }
.app-layout {
  display: grid;
  grid-template-columns: var(--workshop-rail) minmax(0, 1fr);
  min-height: calc(100dvh - var(--workshop-header));
}
.class-sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  align-self: start;
  height: calc(100dvh - var(--workshop-header));
  min-height: 620px;
  padding: 10px 0 14px;
  border-right: 1px solid var(--workshop-line);
  background: #1a130a;
}
.class-sidebar #class-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: visible;
}
.class-sidebar .class-button {
  position: relative;
  display: flex;
  flex-direction: row;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-start;
  gap: 15px;
  width: 100%;
  min-height: 60px;
  padding: 8px 16px 8px 24px;
  border: 0;
  border-left: 4px solid transparent;
  border-radius: 0;
  background: transparent;
  color: #e0ceb0;
  font-size: 17px;
  font-weight: 500;
  line-height: 1.2;
  text-align: left;
}
.class-sidebar .class-button:hover { background: #2a2116; }
.class-sidebar .class-button.active,
.class-sidebar .class-button[aria-pressed='true'],
.class-sidebar .class-button[aria-selected='true'] {
  border-left-color: var(--chip-color, var(--workshop-blue));
  background: #1b2a33;
  color: var(--chip-color, #41aafa);
  font-weight: 700;
}
.class-sidebar .class-icon {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border: 1px solid #9c8253;
  border-radius: 4px;
  object-fit: cover;
  box-shadow: 0 0 0 1px #080603;
}
.class-button label, .class-button .class-label { cursor: pointer; }
.class-button .class-chevron { margin-left: auto; width: 15px; height: 15px; }
.sidebar-footer {
  display: grid;
  gap: 12px;
  margin-top: auto;
  padding: 22px 20px 0 24px;
  color: var(--workshop-muted);
  font-size: 14px;
}
.sidebar-footer .level-label {
  display: grid;
  grid-template-columns: 1fr 58px;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 15px;
}
.sidebar-footer input {
  width: 58px;
  min-height: 34px;
  padding: 4px 5px;
  text-align: center;
}
.sidebar-footer a, .sidebar-footer button {
  padding: 0;
  border: 0;
  background: transparent;
  color: #c9b994;
  font-size: 14px;
  text-align: left;
  text-decoration: none;
}
.sidebar-footer a:hover, .sidebar-footer button:hover { color: var(--workshop-gold); }
.sidebar-links { display: flex; flex-wrap: wrap; gap: 12px; }
.all-classes {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: calc(100% - 32px);
  min-height: 34px;
  margin: 0 16px 7px;
  padding: 5px 10px;
  border: 1px solid #635033;
  border-radius: 4px;
  background: #2b2216;
  color: #dbc69c;
  font-size: 15px;
}
.all-classes:hover, .all-classes.active, .all-classes[aria-pressed='true'] { border-color: #a3854c; background: #3b2e1a; color: #f1d895; }
.local-label { color: #93866f; font-size: 12px; line-height: 1.3; }
.app-main { min-width: 0; padding: 26px 28px 40px; }
.app-main > section { min-width: 0; }
.app-main h1, .app-main h2, .app-main h3 {
  font-family: 'Forever Alegreya', Georgia, serif;
  color: var(--workshop-ivory);
}
.app-main h1 { font-size: 42px; font-weight: 650; line-height: 1.12; }
.library-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
  align-items: start;
  gap: 16px;
  width: 100%;
  min-width: 0;
}
.browser-panel, .inspector-wrap { min-width: 0; }
.view-heading { margin: 0 0 21px; padding: 0 2px; }
.view-heading p {
  margin-top: 6px;
  color: var(--workshop-muted);
  font-size: 19px;
  line-height: 1.35;
}
.app-main .section-tabs {
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin: 0 0 12px;
  padding: 0 0 0 1px;
  border-bottom: 1px solid var(--workshop-line);
  overflow-x: auto;
}
.section-tabs button {
  min-height: 46px;
  padding: 8px 21px 10px;
  border: 1px solid transparent;
  border-bottom: 4px solid transparent;
  border-radius: 5px 5px 0 0;
  background: transparent;
  color: #cbbb9e;
  font-size: 18px;
  font-weight: 500;
  white-space: nowrap;
}
.section-tabs button:hover { color: var(--workshop-ivory); background: #292116; }
.section-tabs button.active,
.section-tabs button[aria-selected='true'],
.section-tabs button[aria-pressed='true'] {
  border-color: #3e3323;
  border-bottom-color: var(--workshop-blue);
  background: #2c2418;
  color: #f1e0bd;
}
.browser-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 10px;
  color: var(--workshop-muted);
  font-size: 14px;
}
.browser-tools:empty { display: none; }
.browser-tools { justify-content: space-between; }
.browser-tools button { min-height: 30px; padding: 3px 9px; }
.browser-tools .text-button { display: inline-flex; align-items: center; gap: 6px; color: #bca783; }
.browser-tools .ui-icon { width: 16px; height: 16px; }
.browser-tools select { width: auto; max-width: 100%; min-height: 32px; padding: 3px 28px 3px 9px; }
.extra-filters {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: 12px 16px;
  margin: 0 0 14px;
  padding: 14px;
  border: 1px solid #53422b;
  border-radius: 5px;
  background: #231b11;
  color: #c9b995;
  font-size: 15px;
}
.extra-filters > label:not(.check) { display: grid; gap: 5px; }
.extra-filters select { min-height: 36px; padding-block: 5px; font-size: 15px; }
.extra-filters .check { align-self: end; min-height: 36px; line-height: 1.35; }
.extra-filters .text-button { justify-self: start; padding: 0; color: #d3b978; font-size: 14px; }
.list-footnote { margin: 16px 3px 0; color: #978972; font-size: 13px; line-height: 1.4; }
.macro-list { display: flex; flex-direction: column; gap: 0; min-width: 0; }
.macro-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 20px;
  width: 100%;
  min-width: 0;
  min-height: 85px;
  margin: 0;
  padding: 11px 15px;
  border: 1px solid transparent;
  border-bottom-color: var(--workshop-line);
  border-radius: 0;
  background: transparent;
  color: var(--workshop-ivory);
  text-align: left;
}
.macro-row:hover { background: #2a2217; }
.macro-row.active,
.macro-row.selected,
.macro-row[aria-selected='true'],
.macro-row[aria-pressed='true'] {
  z-index: 1;
  border-color: #4d8fbd;
  border-radius: 5px;
  background: #1d303d;
  box-shadow: inset 3px 0 0 var(--workshop-blue);
}
.macro-row-icon {
  display: block;
  width: 58px;
  height: 58px;
  flex: 0 0 58px;
  border: 1px solid #b6a88c;
  border-radius: 4px;
  object-fit: cover;
  box-shadow: 0 0 0 1px #050402;
}
.row-copy { display: flex; flex: 1 1 auto; flex-direction: column; min-width: 0; gap: 3px; }
.row-copy strong {
  color: var(--workshop-ivory);
  font-size: 21px;
  font-weight: 600;
  line-height: 1.12;
  overflow-wrap: anywhere;
}
.row-description {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  color: #c6bca9;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.row-chevron { width: 18px; height: 18px; flex: 0 0 18px; margin-left: auto; color: #d9bc72; }
.row-copy .game-test-badge { align-self: flex-start; margin-top: 3px; font-size: 10px; line-height: 1.3; }
.inspector-wrap > .search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 48px;
  margin: 0 0 24px;
  padding: 0 14px;
  border: 1px solid #5c4b30;
  border-radius: 5px;
  background: #1b140c;
}
.inspector-wrap > .search:focus-within { border-color: var(--workshop-gold); }
.search > img, .search > svg { width: 22px; height: 22px; flex: 0 0 22px; color: #b4a68c; }
.inspector-wrap > .search input {
  min-width: 0;
  min-height: 46px;
  padding: 7px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--workshop-ivory);
  font-size: 16px;
}
.search input::placeholder { color: #afa18b; opacity: 1; }
.detail-panel {
  min-width: 0;
  padding: 28px;
  border: 1px solid #58472f;
  border-radius: 7px;
  background: var(--workshop-panel);
  color: var(--workshop-ivory);
}
.detail-heading { display: flex; align-items: flex-start; gap: 24px; min-width: 0; margin-bottom: 18px; }
.detail-icon { width: 64px; height: 64px; flex: 0 0 64px; object-fit: cover; border: 1px solid #b5a585; border-radius: 5px; box-shadow: 0 0 0 1px #0b0804; }
.detail-heading > div { flex: 1 1 auto; min-width: 0; }
.detail-heading h2 { margin: -3px 0 6px; font-size: 30px; font-weight: 600; line-height: 1.12; overflow-wrap: anywhere; }
.detail-context { display: block; color: #d3bd8e; font-size: 16px; line-height: 1.35; }
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 41px;
  height: 41px;
  flex: 0 0 41px;
  padding: 9px;
  border: 1px solid #6e5734;
  border-radius: 5px;
  background: #2c2419;
  color: var(--workshop-gold);
}
.icon-button:hover { background: #3a2e1d; border-color: #ac8850; }
.icon-button[aria-pressed='true'] { border-color: var(--workshop-gold); background: #44351d; color: #ffe29b; }
.icon-button img, .icon-button svg { width: 22px; height: 22px; }
.detail-heading > .icon-button { margin-left: auto; }
.detail-description { margin: 0 0 26px; color: #d0c3ac; font-size: 18px; line-height: 1.5; }
.detail-description p + p { margin-top: 10px; }
.detail-tip { margin: 0 0 20px; color: #bfae8f; font-size: 16px; line-height: 1.45; }
.detail-tip strong { color: #ddc38e; font-weight: 600; }
.detail-panel .keymap {
  display: grid;
  gap: 10px;
  margin: 0 0 20px;
  padding-top: 19px;
  border-top: 1px solid var(--workshop-line);
  color: #d0c3ac;
  font-size: 17px;
  line-height: 1.35;
}
.keymap h3, .keymap > strong { margin-bottom: 0; color: var(--workshop-gold); font-size: 18px; font-weight: 600; }
.keymap > span, .keymap > div, .keymap .keymap-row { display: flex; align-items: flex-start; gap: 18px; min-width: 0; }
.keymap kbd {
  min-width: 68px;
  min-height: 32px;
  flex: 0 0 auto;
  margin: 0;
  padding: 5px 9px;
  border: 1px solid #a68a4d;
  border-bottom-width: 2px;
  border-radius: 4px;
  background: #2e271a;
  color: #f0dfb1;
  font: 600 14px/20px Consolas, 'Liberation Mono', monospace;
  text-align: center;
}
.keymap span > span, .keymap .keymap-row > span { flex: 1 1 auto; min-width: 0; padding-top: 4px; }
.detail-code-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 9px; }
.detail-code-head h3 { color: var(--workshop-gold); font-size: 18px; font-weight: 600; }
.detail-code-head button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 35px; padding: 5px 12px; border: 1px solid #665030; border-radius: 4px; background: #2a2217; color: #e7cd8a; font-size: 15px; }
.detail-code-head button img, .detail-code-head button svg { width: 16px; height: 16px; }
.detail-panel .recipe-code {
  min-height: 114px;
  margin: 0 0 27px;
  padding: 14px;
  border: 1px solid #56432a;
  border-radius: 5px;
  background: #171007;
  color: #f2eee3;
  font: 14px/1.55 Consolas, 'Liberation Mono', monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  tab-size: 2;
}
.detail-actions { display: flex; align-items: stretch; gap: 12px; margin-bottom: 24px; }
.detail-actions > .button { flex: 1.5 1 0; }
.detail-actions > .secondary, .detail-actions > .copy-button { flex: 1 1 0; }
.detail-actions > button, .detail-actions > a { min-width: 0; min-height: 48px; padding: 10px 14px; font-size: 18px; line-height: 1.2; }
.detail-actions .button { border-color: #efce79; background: var(--workshop-gold); color: #201606; font-weight: 700; }
.detail-actions .button:hover { background: #f2d78d; }
.detail-actions .secondary { border-color: #77603a; background: #2a2217; color: #eddbb2; font-weight: 500; }
.detail-actions .secondary:hover { background: #3b2e1c; }
.detail-actions img, .detail-actions svg { width: 20px; height: 20px; flex: 0 0 20px; }
.detail-status { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; margin: 0 0 25px; padding-top: 19px; border-top: 1px solid var(--workshop-line); color: var(--workshop-gold); font-size: 17px; }
.detail-status .game-test-badge { padding: 0; border: 0; background: transparent; color: #efce80; font-size: 17px; font-weight: 500; }
.detail-status > img, .detail-status > svg { width: 22px; height: 22px; }
.detail-status button { display: inline-flex; align-items: center; justify-content: center; min-width: 28px; min-height: 28px; padding: 3px; border: 0; background: transparent; color: #c8a456; }
.detail-panel .example-tests {
  margin: 0;
  padding: 0;
  border: 1px solid #58462b;
  border-radius: 5px;
  background: #1c150c;
  color: #c6b99e;
  font-size: 15px;
  line-height: 1.45;
}
.detail-panel .example-tests summary { min-height: 60px; padding: 17px 19px; color: #e6d5b1; font-size: 17px; line-height: 1.5; }
.example-tests summary img, .example-tests summary svg { width: 22px; height: 22px; vertical-align: middle; margin-right: 10px; }
.detail-panel .example-tests[open] { padding-bottom: 15px; }
.detail-panel .example-tests[open] summary { margin-bottom: 3px; border-bottom: 1px solid #42351f; }
.detail-panel .example-tests > :not(summary) { margin-left: 19px; margin-right: 19px; }
.detail-panel .example-tests ol, .detail-panel .example-tests ul { padding-left: 20px; }
.detail-panel .example-tests li + li { margin-top: 8px; }
.detail-panel .example-tests > strong { display: block; margin-top: 12px; color: var(--workshop-ivory); font-size: 16px; }
.detail-back { display: none; }
.empty-state { padding: 36px 24px; border: 1px solid var(--workshop-line); border-radius: 6px; background: #211a11; color: var(--workshop-muted); font-size: 18px; text-align: center; }
.empty-state h2, .empty-state h3 { margin-bottom: 10px; color: var(--workshop-ivory); }
.empty-state p + p, .empty-state p + button { margin-top: 14px; }

/* Saved macros use the same browse-and-inspect rhythm as examples. */
.saved-view-heading, .creator-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.saved-view-heading > div, .creator-heading > div { min-width: 0; }
.saved-view-heading > .button { flex: 0 0 auto; min-height: 42px; padding: 9px 16px; font-size: 17px; }
.creator-heading > .autosave { flex: 0 1 160px; text-align: right; }
.storage-note { display: flex; align-items: flex-start; gap: 9px; margin: 0 0 19px; color: #ae9f83; font-size: 15px; line-height: 1.4; }
.storage-note .ui-icon { width: 18px; height: 18px; margin-top: 1px; opacity: .8; }
.saved-undo { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 18px; margin: 0 0 16px; padding: 10px 14px; border: 1px solid #725a32; border-radius: 5px; background: #302516; color: #dfcda8; font-size: 16px; }
.saved-undo .text-button { min-height: 30px; padding: 2px 0; color: #efd187; font-size: 16px; }
.editing-note { margin: 0 0 20px; padding: 11px 14px; border-left: 2px solid #c2a05d; background: #2d2315; color: #ddc99f; font-size: 16px; line-height: 1.4; }
.editing-note .text-button { min-height: 30px; margin-left: 10px; padding: 2px 0; color: #efd187; font-size: 15px; }
.saved-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 0 0 18px; }
.saved-toolbar .search { display: flex; align-items: center; flex: 1 1 240px; gap: 9px; min-width: 0; min-height: 42px; padding: 0 11px; border: 1px solid #5c4b30; border-radius: 5px; background: #1b140c; }
.saved-toolbar .search input { min-width: 0; min-height: 40px; padding: 6px 0; border: 0; background: transparent; font-size: 16px; }
.saved-toolbar > select { flex: 0 1 150px; width: auto; min-width: 120px; }
.saved-toolbar > button { min-height: 40px; padding: 7px 11px; border: 1px solid #665032; border-radius: 5px; background: #2c2317; color: #e4d1a6; font-size: 15px; }
.saved-toolbar > button[aria-pressed='true'] { border-color: #b18d4d; background: #43341d; color: #f6dda2; }
.saved-toolbar > button img, .saved-toolbar > button svg { width: 17px; height: 17px; vertical-align: middle; }
.saved-metadata { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 14px; margin: 18px 0; color: var(--workshop-muted); font-size: 16px; }
.saved-metadata dt { color: #ddc798; }
.saved-metadata dd { min-width: 0; margin: 0; overflow-wrap: anywhere; }
.saved-tags { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin: 12px 0 20px; }
.saved-tags > span { padding: 2px 9px; border: 1px solid #655030; border-radius: 4px; color: #d9c79e; font-size: 14px; }
.saved-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--workshop-line); }
.saved-actions button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; padding: 7px 12px; border: 1px solid #705737; border-radius: 4px; background: #2e2518; color: #e8d6ae; font-size: 16px; }
.saved-actions button.danger { color: #efb0a0; border-color: #825144; }
.saved-actions button img, .saved-actions button svg { width: 17px; height: 17px; }
#saved-panel .inspector-wrap > .detail-panel { margin-top: 0; }

/* Keep the existing builder controls and dialogs within the workshop theme. */
#creator-panel > .view-heading { margin-bottom: 25px; }
#creator-panel .workspace { gap: 24px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
#creator-panel .step, #creator-panel .preview-card, #creator-panel .explanation-card, #creator-panel .scenario-card { padding: 22px; border-color: var(--workshop-line); background: var(--workshop-panel); }
#creator-panel .step h2, #creator-panel .preview-card h2 { font-size: 25px; }
#creator-panel .step h3, #creator-panel .explanation-card h3 { color: #e0c382; font-size: 20px; }
#creator-panel .field-note, #creator-panel .helper, #creator-panel .hint { color: var(--workshop-muted); font-size: 15px; }
#creator-panel label { font-size: 17px; }
#creator-panel .preview-column { top: 20px; }
#creator-panel pre, #creator-panel textarea { font-family: Consolas, 'Liberation Mono', monospace; font-size: 14px; line-height: 1.55; }
.app-main input, .app-main select, .app-main textarea { border-color: #5c4b32; }
.app-main input:focus-visible, .app-main select:focus-visible, .app-main textarea:focus-visible { outline: 2px solid #e5c46c; outline-offset: 2px; }
dialog { border-color: #7e633c; border-radius: 8px; font-size: 17px; }
dialog h2 { font-family: 'Forever Alegreya', Georgia, serif; font-size: 29px; }
dialog .dialog-heading h2 { font-size: 29px; }
dialog .dialog-heading { align-items: flex-start; }
dialog .close, dialog .dialog-close { min-width: 36px; min-height: 36px; }
dialog code, dialog pre { font-family: Consolas, 'Liberation Mono', monospace; }
.app-main .footer { margin-top: 30px; border-color: var(--workshop-line); }
.app-main .footer > div { align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.audit-footer { display: inline-flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; max-width: 100%; padding-left: 12px; border-left: 1px solid #55422a; color: #958870; font-size: 12px; line-height: 1.4; }
.audit-footer strong { color: #c3aa74; font-size: 13px; font-weight: 500; }
.dialog-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 22px; padding-top: 17px; border-top: 1px solid var(--workshop-line); }
.dialog-actions > button { min-height: 40px; padding: 8px 15px; font-size: 17px; }
.form-error { margin: 10px 0 0; color: #f0b3a2; font-size: 15px; line-height: 1.4; }
.form-error:empty { display: none; }
#save-dialog { width: 540px; }
#save-dialog label { display: block; margin: 16px 0 6px; color: #e4d3b2; font-size: 17px; }
#save-dialog label:first-child { margin-top: 0; }
#save-dialog label .subtle { margin-left: 5px; font-size: 13px; }
#save-dialog input { min-height: 42px; font-size: 17px; }
#save-dialog .field-note { margin: 9px 0 0; font-size: 14px; }
#tips-dialog article + article { margin-top: 21px; padding-top: 17px; border-top: 1px solid var(--workshop-line); }
#tips-dialog article h3 { margin-bottom: 5px; color: #e1c68b; font-size: 21px; }
#tips-dialog article p { color: #c3b497; line-height: 1.5; }

@media (max-width: 1260px) {
  .app-header { padding-inline: 25px; gap: 16px; }
  .app-header .brand { font-size: 29px; gap: 13px; }
  .app-header .brand-subtitle, .app-header .brand .brand-subtitle { max-width: 250px; padding-left: 13px; font-size: 20px; }
  .main-nav { gap: 9px; }
  .main-nav button[data-view] { padding-inline: 8px; font-size: 17px; }
  .app-header .support-button { padding-inline: 13px; font-size: 15px; }
  .app-main { padding-inline: 22px; }
  .macro-row { gap: 15px; padding-inline: 11px; }
  .macro-row-icon { width: 50px; height: 50px; flex-basis: 50px; }
  .row-copy strong { font-size: 20px; }
  .detail-panel { padding: 23px; }
  .detail-heading { gap: 17px; }
  .detail-heading h2 { font-size: 28px; }
}

@media (max-width: 1080px) {
  :root { --workshop-rail: 172px; }
  .app-header { grid-template-columns: minmax(0, 1fr) auto auto; padding-inline: 20px; }
  .app-header .brand-subtitle, .app-header .brand .brand-subtitle { max-width: 205px; white-space: normal; font-size: 18px; }
  .main-nav { gap: 2px; }
  .main-nav button[data-view] { font-size: 16px; padding-inline: 7px; }
  .class-sidebar .class-button { gap: 11px; padding-left: 17px; font-size: 16px; }
  .class-sidebar .class-icon { width: 36px; height: 36px; flex-basis: 36px; }
  .sidebar-footer { padding-inline: 20px 16px; }
  .app-main { padding: 24px 18px 32px; }
  .library-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
  .app-main h1 { font-size: 36px; }
  .view-heading p { font-size: 17px; }
  .section-tabs button { padding-inline: 12px; font-size: 16px; }
  .macro-row { gap: 11px; min-height: 88px; padding: 11px 8px; }
  .macro-row-icon { width: 44px; height: 44px; flex-basis: 44px; }
  .row-copy strong { font-size: 19px; }
  .row-description { font-size: 15px; }
  .row-chevron { width: 14px; height: 14px; flex-basis: 14px; }
  .detail-panel { padding: 20px; }
  .detail-heading { gap: 13px; }
  .detail-icon { width: 54px; height: 54px; flex-basis: 54px; }
  .detail-heading h2 { font-size: 26px; }
  .detail-context { font-size: 14px; }
  .detail-heading .icon-button { width: 35px; height: 35px; flex-basis: 35px; padding: 7px; }
  .detail-description { font-size: 17px; }
  .detail-panel .keymap { font-size: 16px; }
  .keymap > span, .keymap > div, .keymap .keymap-row { gap: 12px; }
  .detail-actions { gap: 8px; }
  .detail-actions > button, .detail-actions > a { padding-inline: 8px; font-size: 16px; }
}

@media (max-height: 760px) and (min-width: 701px) {
  .class-sidebar { min-height: 0; }
  .class-sidebar .class-button { min-height: 48px; padding-block: 6px; }
  .class-sidebar .class-icon { width: 30px; height: 30px; flex-basis: 30px; }
  .sidebar-footer { gap: 8px; padding-top: 14px; }
}

@media (max-width: 900px) {
  .app-header { gap: 12px; }
  .app-header .brand { font-size: 27px; }
  .app-header .brand-subtitle, .app-header .brand .brand-subtitle { max-width: 170px; font-size: 16px; }
  .app-header .support-button { min-height: 38px; padding-inline: 10px; font-size: 14px; }
  .support-button img, .support-button svg { width: 18px; height: 18px; }
  .main-nav button[data-view] { font-size: 15px; padding-inline: 5px; }
  .library-layout { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .inspector-wrap > .search { margin-bottom: 16px; }
  .macro-row { min-height: 86px; gap: 16px; padding: 12px; }
  .macro-row-icon { width: 52px; height: 52px; flex-basis: 52px; }
  .row-copy strong { font-size: 21px; }
  .row-description { font-size: 16px; }
  .detail-panel { padding: 25px; }
  .detail-heading h2 { font-size: 30px; }
  .detail-icon { width: 64px; height: 64px; flex-basis: 64px; }
  .detail-context { font-size: 16px; }
  .detail-description { font-size: 18px; }
  .detail-back { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; margin-bottom: 16px; padding: 4px 0; border: 0; background: transparent; color: var(--workshop-gold); font-size: 16px; }
  .detail-back img, .detail-back svg { width: 18px; height: 18px; }
  #creator-panel .workspace { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  #creator-panel .preview-column { position: static; }
}

@media (min-width: 701px) and (max-width: 900px) {
  .app-header .brand-subtitle, .app-header .brand .brand-subtitle { display: none; }
  .app-header { grid-template-columns: minmax(0, 1fr) auto auto; }
  .main-nav { gap: 8px; }
  .main-nav button[data-view] { padding-inline: 8px; font-size: 16px; }
}

@media (max-width: 700px) {
  :root { --workshop-header: 120px; }
  .app-header { grid-template-columns: minmax(0, 1fr) auto; gap: 7px 12px; padding: 14px 14px 0; }
  .app-header .brand { gap: 10px; font-size: 28px; }
  .app-header .brand-subtitle, .app-header .brand .brand-subtitle { max-width: 205px; padding-left: 10px; font-size: 16px; }
  .app-header .support-button { padding: 7px 10px; font-size: 14px; }
  .main-nav { grid-column: 1 / -1; justify-content: center; gap: 22px; }
  .main-nav button[data-view] { min-height: 43px; padding: 6px 7px 9px; font-size: 17px; }
  .app-layout { display: block; }
  .class-sidebar { position: static; display: block; width: 100%; height: auto; min-height: 0; padding: 7px 10px 10px; border-right: 0; border-bottom: 1px solid var(--workshop-line); }
  .all-classes { width: auto; min-height: 31px; margin: 0 5px 8px; padding: 4px 12px; font-size: 14px; }
  .class-sidebar #class-list { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 3px; }
  .class-sidebar .class-button { flex-direction: column; justify-content: center; gap: 5px; min-height: 63px; padding: 6px 2px; border: 1px solid transparent; border-bottom: 2px solid transparent; border-radius: 4px; font-size: 13px; text-align: center; }
  .class-sidebar .class-button.active, .class-sidebar .class-button[aria-pressed='true'], .class-sidebar .class-button[aria-selected='true'] { border-color: #37566b; border-bottom-color: var(--chip-color, var(--workshop-blue)); }
  .class-sidebar .class-icon { width: 30px; height: 30px; flex-basis: 30px; border-radius: 3px; }
  .class-button .class-chevron { display: none; }
  .sidebar-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 9px 18px; margin-top: 8px; padding: 8px 5px 0; border-top: 1px solid #3c3020; }
  .sidebar-footer .level-label { display: flex; gap: 8px; font-size: 14px; }
  .sidebar-footer input { width: 52px; min-height: 30px; padding-block: 2px; }
  .sidebar-footer a, .sidebar-footer button { font-size: 14px; }
  .sidebar-links { gap: 14px; }
  .local-label { font-size: 11px; }
  .app-main { padding: 20px 14px 32px; }
  .app-main h1 { font-size: 34px; }
  .view-heading { padding: 0; margin-bottom: 18px; }
  .view-heading p { margin-top: 7px; font-size: 17px; }
  .app-main .section-tabs { gap: 3px; margin-bottom: 10px; padding-left: 0; }
  .section-tabs button { flex: 1 0 auto; min-height: 44px; padding: 8px 10px; font-size: 16px; }
  .library-layout { gap: 20px; }
  .extra-filters { gap: 10px; padding: 12px; font-size: 14px; }
  .extra-filters .check { font-size: 14px; }
  .macro-row { min-height: 87px; gap: 12px; padding: 11px 9px; }
  .macro-row-icon { width: 45px; height: 45px; flex-basis: 45px; }
  .row-copy strong { font-size: 20px; }
  .row-description { font-size: 15px; line-height: 1.3; }
  .row-chevron { width: 14px; height: 14px; flex-basis: 14px; }
  .inspector-wrap > .search { min-height: 44px; margin-bottom: 14px; padding-inline: 11px; }
  .inspector-wrap > .search input { min-height: 42px; font-size: 15px; }
  .detail-panel { padding: 20px 17px; }
  .detail-heading { gap: 13px; margin-bottom: 17px; }
  .detail-icon { width: 52px; height: 52px; flex-basis: 52px; }
  .detail-heading h2 { margin-top: -2px; font-size: 27px; }
  .detail-context { font-size: 14px; }
  .detail-heading .icon-button { width: 34px; height: 34px; flex-basis: 34px; }
  .detail-description { margin-bottom: 21px; font-size: 17px; }
  .detail-panel .keymap { gap: 9px; padding-top: 17px; font-size: 16px; }
  .keymap > span, .keymap > div, .keymap .keymap-row { gap: 12px; }
  .keymap kbd { min-width: 61px; padding-inline: 6px; font-size: 13px; }
  .detail-panel .recipe-code { margin-bottom: 20px; padding: 12px 10px; font-size: 13px; line-height: 1.6; }
  .detail-actions { gap: 9px; margin-bottom: 21px; }
  .detail-actions > button, .detail-actions > a { min-height: 45px; padding-inline: 8px; font-size: 16px; }
  .detail-status { gap: 7px; margin-bottom: 20px; padding-top: 17px; }
  .detail-status .game-test-badge { font-size: 16px; }
  .detail-panel .example-tests summary { min-height: 54px; padding: 14px; font-size: 16px; }
  .detail-panel .example-tests > :not(summary) { margin-left: 14px; margin-right: 14px; }
  .saved-toolbar { gap: 8px; margin-bottom: 14px; }
  .saved-view-heading, .creator-heading { align-items: flex-start; flex-wrap: wrap; gap: 14px; }
  .saved-view-heading > .button { min-height: 38px; padding: 7px 12px; font-size: 16px; }
  .creator-heading > .autosave { flex-basis: 100%; text-align: left; }
  .storage-note { margin-bottom: 16px; font-size: 14px; }
  .saved-undo, .editing-note { font-size: 15px; }
  .saved-toolbar .search { flex-basis: 100%; }
  .saved-toolbar > select { flex: 1 1 120px; }
  .saved-toolbar > button { flex: 1 1 auto; }
  .saved-metadata { gap: 5px 10px; font-size: 15px; }
  .saved-actions button { flex: 1 1 auto; }
  #creator-panel .step, #creator-panel .preview-card, #creator-panel .explanation-card, #creator-panel .scenario-card { padding: 18px 16px; }
  #creator-panel .field-grid { grid-template-columns: minmax(0, 1fr); }
  dialog { max-width: calc(100vw - 24px); max-height: 88dvh; padding: 20px 16px; }
  dialog .dialog-heading h2 { font-size: 26px; }
  .dialog-actions { justify-content: stretch; }
  .dialog-actions > button { flex: 1 1 auto; }
  .audit-footer { padding-left: 0; border-left: 0; }
}

@media (max-width: 390px) {
  .app-header .brand { gap: 8px; font-size: 25px; }
  .app-header .brand-subtitle, .app-header .brand .brand-subtitle { max-width: 140px; padding-left: 8px; font-size: 14px; }
  .app-header .support-button { gap: 5px; padding-inline: 8px; font-size: 13px; }
  .main-nav { gap: 11px; }
  .main-nav button[data-view] { font-size: 16px; }
  .section-tabs button { padding-inline: 8px; font-size: 15px; }
  .detail-heading { gap: 10px; }
  .detail-heading h2 { font-size: 25px; }
  .detail-icon { width: 46px; height: 46px; flex-basis: 46px; }
  .detail-actions > button, .detail-actions > a { font-size: 15px; }
}

/* Put search before the list when the inspector stacks below it. */
@media (max-width: 900px) {
  #library-panel .library-layout { display: flex; flex-direction: column; gap: 0; }
  #library-panel .browser-panel, #library-panel .inspector-wrap { display: contents; }
  #library-panel .view-heading { order: 0; width: 100%; }
  #library-panel .search { order: 1; width: 100%; margin-bottom: 15px; }
  #library-panel .section-tabs { order: 2; width: 100%; }
  #library-panel .browser-tools { order: 3; width: 100%; }
  #library-panel .extra-filters { order: 4; width: 100%; }
  #library-panel .macro-list { order: 5; width: 100%; }
  #library-panel .list-footnote { order: 6; }
  #library-panel .detail-panel { order: 7; width: 100%; margin-top: 20px; }
}
@media (max-width: 700px) {
  .app-header .support-button { grid-column: 2; grid-row: 1; }
  .main-nav { grid-row: 2; }
  .app-main #section-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); overflow: visible; border: 0; gap: 4px; }
  #section-tabs button { justify-content: center; border: 1px solid var(--workshop-line); border-bottom: 2px solid var(--workshop-line); border-radius: 4px; }
  #section-tabs button.active { border-bottom-color: var(--workshop-blue); }
}
@media (max-width: 360px) {
  .app-header .brand .brand-subtitle { display: none; }
  .main-nav { gap: 3px; justify-content: space-between; }
  .main-nav button[data-view] { padding-inline: 3px; font-size: 15px; gap: 4px; min-height: 44px; }
}

.spellbook-tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; margin: 10px 0 16px; }
.spellbook-tools > div > label { margin: 0 !important; }
.spellbook-tools > p { grid-column: 1 / -1; margin: 0; line-height: 1.4; }
.spellbook-tools select { margin-top: 5px; }
#spell[size]:not([size='1']), #alternate-spell[size]:not([size='1']) { min-height: 96px; height: auto; padding: 5px; }
#spell[size]:not([size='1']) option, #alternate-spell[size]:not([size='1']) option { padding: 6px 8px; }
.spellbook-coverage { border-top: 1px solid var(--workshop-line); padding-top: 12px; }
@media (max-width: 700px) {
  .spellbook-tools { gap: 9px; }
  .spellbook-tools > div > label { font-size: 15px !important; }
  .spellbook-tools select { font-size: 14px; padding-inline: 7px; }
  #spell[size]:not([size='1']), #alternate-spell[size]:not([size='1']) { font-size: 14px; }
}

.spellbook-tools > div { min-width: 0; }
.spell-verification { margin-top: 16px; padding: 12px 14px; border: 1px solid #786037; border-radius: 5px; background: #302619; color: #d9c6a0; font-size: 15px; line-height: 1.4; }
.spell-verification > strong { display: block; margin-bottom: 5px; color: #efcc77; font-size: 17px; }
.spell-verification p + p { margin-top: 6px; }
.audit-link { padding: 8px 0; color: #e5c46c; font-size: 15px; text-decoration: underline; text-underline-offset: 3px; }
.game-test-notice { margin: 12px 0; padding: 9px 12px; border: 1px solid #6c5631; border-radius: 4px; background: #302619; color: #efcc77; font-size: 15px; line-height: 1.4; }
.alternate-spell-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 10px; }
.alternate-spell-heading > label { margin: 0 !important; }
.alternate-spell-heading > img { width: 32px; height: 32px; }
#audit-dialog, #spell-audit-dialog { width: min(1040px, calc(100vw - 32px)); max-width: calc(100vw - 32px); }
#spell-audit-dialog > .field-grid { margin: 20px 0; }
.audit-catalog-summary { color: #e5c88c; font-size: 18px; margin: 12px 0 20px; }
.audit-table-wrap { max-width: 100%; overflow-x: auto; border: 1px solid var(--workshop-line); border-radius: 5px; margin: 15px 0; }
.audit-table-wrap table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.4; }
.audit-table-wrap th, .audit-table-wrap td { padding: 11px 13px; border-bottom: 1px solid #493a25; text-align: left; vertical-align: top; }
.audit-table-wrap thead th { color: #e5c46c; background: #1c150d; font-weight: 600; white-space: nowrap; }
.audit-table-wrap tbody tr:last-child > * { border-bottom: 0; }
.audit-table-wrap .text-button { padding: 0; color: #e5c46c; text-decoration: underline; }
.class-audit-table { min-width: 600px; }
.rank-audit-table { min-width: 820px; }
.rank-audit-table th:nth-child(5) { min-width: 210px; }
.pending-cell { color: #edc778; }
.audit-icon-cell { min-width: 110px; }
.audit-icon-cell img { display: block; width: 36px; height: 36px; margin-bottom: 6px; }
.audit-icon-cell small { color: #c1b399; font-size: 13px; }
.spell-audit-heading { display: flex; align-items: center; gap: 13px; margin-top: 16px; }
.spell-audit-heading > img { width: 42px; height: 42px; }
.spell-audit-heading h3 { font-size: 24px; }
#spell-audit-warnings p + p { margin-top: 9px; }
#spell-audit-checklist { padding-left: 24px; }
#spell-audit-checklist li + li { margin-top: 7px; }
#spell-audit-dialog > h3, #audit-dialog > h3 { margin-top: 20px; }
@media (max-width: 700px) {
  #audit-dialog, #spell-audit-dialog { width: calc(100vw - 24px); }
  #spell-audit-dialog > .field-grid { grid-template-columns: minmax(0, 1fr); }
  .audit-catalog-summary { font-size: 17px; }
  .audit-table-wrap th, .audit-table-wrap td { padding: 10px; }
}

.site-back-link{display:inline-block;color:var(--muted,#b9ad98);font-size:13px;line-height:1.5;margin:8px 0;text-decoration:none}.site-back-link:hover,.site-back-link:focus-visible{color:var(--gold,#e9bb59);text-decoration:underline}
