:root {
  --ink: #202122;
  --muted: #54595d;
  --quiet: #72777d;
  --line: #a2a9b1;
  --line-soft: #c8ccd1;
  --paper: #ffffff;
  --canvas: #f8f9fa;
  --accent: #36c;
  --accent-hover: #3056a9;
  --notice: #eaecf0;
  --success: #14866d;
  --warning: #ac6600;
  --danger: #b32424;
  --sidebar: 12.75rem;
  --content: 84rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Lato, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* { box-sizing: border-box; }

html { min-width: 20rem; }

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    linear-gradient(180deg, #fff 0, #fff 5.1rem, transparent 5.1rem),
    var(--canvas);
  color: var(--ink);
}
body.mobile-nav-open { overflow: hidden; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }

.skip-link {
  position: fixed;
  left: 1rem;
  top: -5rem;
  z-index: 1000;
  padding: .65rem .9rem;
  background: var(--paper);
  border: 2px solid var(--accent);
}
.skip-link:focus { top: 1rem; }

.site-header {
  height: 5.1rem;
  display: grid;
  grid-template-columns: var(--sidebar) minmax(18rem, 46rem) 1fr;
  align-items: center;
  gap: 1.2rem;
  padding: .65rem 2.5rem .65rem 1.25rem;
  background: var(--paper);
}

.brand {
  display: grid;
  grid-template-columns: 2.7rem 1fr;
  align-items: center;
  gap: .55rem;
  color: var(--ink);
  text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 2.7rem;
  height: 2.7rem;
  border: 1px solid var(--ink);
  border-radius: 50%;
  font: 700 1.45rem/1 Georgia, serif;
  background: conic-gradient(from 45deg, #fff 0 20%, #eaecf0 20% 40%, #fff 40% 65%, #eaecf0 65% 85%, #fff 85%);
}
.brand-copy { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font: 1.45rem/1.05 Georgia, "Times New Roman", serif; letter-spacing: .02em; }
.brand-tagline { color: var(--muted); font-size: .68rem; letter-spacing: .05em; text-transform: uppercase; }

.search-form { display: flex; min-width: 0; }
.search-form input {
  flex: 1;
  min-width: 0;
  height: 2.35rem;
  padding: .45rem .7rem .45rem 2.15rem;
  border: 1px solid var(--line);
  border-right: 0;
  border-radius: 2px 0 0 2px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2354595d' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-4-4'/%3E%3C/svg%3E") .6rem center/1.1rem no-repeat;
}
.search-form button, .button {
  min-height: 2.35rem;
  padding: .42rem .85rem;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #f8f9fa;
  color: var(--ink);
  font-weight: 650;
}
.search-form button { border-radius: 0 2px 2px 0; }
.search-form button:hover, .button:hover { background: #fff; border-color: var(--quiet); text-decoration: none; }
.button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.button.primary:hover { background: var(--accent-hover); }
.button.danger { color: var(--danger); }
.button.linklike { border-color: transparent; background: transparent; color: var(--accent); }
.button:disabled { opacity: .52; cursor: not-allowed; }

.user-tools { justify-self: end; display: flex; align-items: center; gap: .7rem; font-size: .88rem; }
.user-tools .user-state { color: var(--muted); }
.mobile-menu-button { display: none; align-items: center; gap: .35rem; min-height: 2.35rem; padding: .42rem .7rem; border: 1px solid var(--line); border-radius: 2px; background: #fff; color: var(--ink); font-weight: 700; }
.mobile-sidebar-heading { display: none; }
.mobile-nav-backdrop { display: none; }
.mobile-nav-backdrop[hidden] { display: none; }

.site-grid {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  max-width: calc(var(--content) + var(--sidebar) + 3rem);
  margin: 0 auto;
  padding: 0 1.25rem 2rem;
}

.sidebar { padding: 1.2rem 1.25rem 2rem .3rem; font-size: .84rem; }
.sidebar-section { margin-bottom: 1.45rem; }
.sidebar h2 {
  margin: 0 0 .35rem;
  padding-bottom: .25rem;
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: .76rem;
  font-weight: 600;
  letter-spacing: .04em;
}
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar li { margin: .26rem 0; }
.sidebar-version { margin-top: 2rem; color: var(--quiet); font-size: .72rem; }

.workspace { min-width: 0; }
.page-tools {
  display: flex;
  justify-content: space-between;
  min-height: 2.55rem;
  border-bottom: 1px solid var(--line);
}
.tabs { display: flex; align-items: end; gap: .1rem; }
.tab {
  padding: .72rem .72rem .6rem;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--accent);
  font-size: .86rem;
}
.tab[aria-current="page"], .tab.active { border-bottom-color: var(--ink); color: var(--ink); }
.tab:hover { background: linear-gradient(0deg, #eaecf0, transparent 65%); text-decoration: none; }

.page-shell {
  min-height: calc(100vh - 8rem);
  padding: 1.55rem 2.4rem 3rem;
  border: 1px solid var(--line-soft);
  border-top: 0;
  background: var(--paper);
  box-shadow: 0 1px 2px rgb(0 0 0 / 4%);
}

.page-heading { margin-bottom: .65rem; border-bottom: 1px solid var(--line); }
.page-heading h1 { margin: 0 0 .22rem; font: 2rem/1.18 Georgia, "Times New Roman", serif; font-weight: 400; }
.page-subtitle { min-height: 1.25rem; margin: 0 0 .55rem; color: var(--muted); font-size: .78rem; }

.notice {
  margin: .8rem 0 1rem;
  padding: .72rem .9rem;
  border: 1px solid var(--line-soft);
  border-left: .28rem solid var(--accent);
  background: #f8f9fa;
  font-size: .88rem;
}
.notice.success { border-left-color: var(--success); }
.notice.warning { border-left-color: var(--warning); }
.notice.error { border-left-color: var(--danger); background: #fee7e6; }
.notice[hidden] { display: none; }

.admin-tools { display: grid; gap: 1rem; max-width: 52rem; }
.admin-tools > section { padding: 1rem 1.1rem; border: 1px solid var(--line-soft); background: #f8f9fa; }
.admin-tools h2 { margin: 0 0 .4rem; font: 400 1.3rem/1.2 Georgia, "Times New Roman", serif; }
.admin-tools p { margin: .35rem 0 .85rem; line-height: 1.55; }
.admin-tools .admin-danger { border-left: .28rem solid var(--danger); background: #fff5f4; }

.wiki-content { display: flow-root; max-width: 72rem; font: .95rem/1.65 Arial, Helvetica, sans-serif; overflow-wrap: anywhere; }
.wiki-content h2, .wiki-content h3, .wiki-content h4 { font-family: Georgia, "Times New Roman", serif; font-weight: 400; }
.wiki-content h2 { margin: 1.55rem 0 .55rem; border-bottom: 1px solid var(--line); font-size: 1.55rem; }
.wiki-content h3 { margin: 1.3rem 0 .4rem; font-size: 1.22rem; }
.wiki-content p { margin: .62rem 0; }
.wiki-content pre { overflow: auto; padding: 1rem; border: 1px solid var(--line-soft); background: #f8f9fa; }
.wiki-content code { padding: .08rem .25rem; border-radius: 2px; background: #eaecf0; font: .88em/1.4 ui-monospace, SFMono-Regular, Consolas, monospace; }
.wiki-content pre code { padding: 0; background: transparent; }
.wiki-content blockquote { margin: 1rem 0; padding: .15rem 1rem; border-left: 4px solid var(--line); color: var(--muted); }
.wiki-content table, .data-table { width: 100%; border-collapse: collapse; margin: 1rem 0; }
.wiki-content th, .wiki-content td, .data-table th, .data-table td { padding: .45rem .55rem; border: 1px solid var(--line-soft); text-align: left; vertical-align: top; }
.wiki-content th, .data-table th { background: #eaecf0; }
.wiki-content img { max-width: 100%; height: auto; }
.wiki-content hr { border: 0; border-top: 1px solid var(--line-soft); }

.wiki-component { --component-accent: var(--line); }
.component-title { margin: 0 !important; padding: .62rem .75rem; border: 0 !important; background: #eaecf0; font: 600 1rem/1.3 Arial, Helvetica, sans-serif !important; }
.component-warning { clear: both; margin: 1rem 0; padding: .75rem .9rem; border: 1px solid var(--line-soft); border-left: .28rem solid var(--warning); background: #fff4d6; }
.infobox { width: min(20rem, 42%); margin: .2rem 0 1rem 1.35rem; border: 1px solid var(--line); background: #f8f9fa; font-size: .82rem; line-height: 1.45; }
.infobox--left { float: left; margin: .2rem 1.35rem 1rem 0; }
.infobox--right { float: right; }
.infobox--blue { --component-accent: #36c; }
.infobox--green { --component-accent: #14866d; }
.infobox--amber { --component-accent: #ac6600; }
.infobox .component-title { border-top: .25rem solid var(--component-accent) !important; text-align: center; }
.infobox-media { margin: 0; padding: .75rem .75rem .4rem; text-align: center; }
.infobox-media img { display: block; width: 100%; max-height: 20rem; object-fit: contain; background: #fff; border: 1px solid var(--line-soft); }
.infobox-media figcaption { margin-top: .4rem; color: var(--muted); font-size: .75rem; }
.infobox dl { margin: 0; }
.infobox-row { display: grid; grid-template-columns: minmax(5rem, 38%) 1fr; border-top: 1px solid var(--line-soft); }
.infobox-row dt, .infobox-row dd { margin: 0; padding: .45rem .55rem; }
.infobox-row dt { background: #eaecf0; font-weight: 700; }
.infobox-links { margin: 0 !important; padding: .55rem .75rem .55rem 1.8rem !important; border-top: 1px solid var(--line-soft); }
.media-gallery { clear: both; margin: 1.4rem 0; border: 1px solid var(--line-soft); background: #f8f9fa; }
.gallery-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .7rem; padding: .8rem; }
.gallery-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.gallery-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.gallery-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.gallery-cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.gallery-item { display: grid; grid-template-rows: 9rem auto; min-width: 0; padding: 0; border: 1px solid var(--line-soft); background: #fff; color: var(--ink); text-align: left; }
.gallery-item:hover, .gallery-item:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 2px rgb(51 102 204 / 18%); }
.gallery-item img { width: 100%; height: 9rem; object-fit: cover; background: #eaecf0; }
.gallery-item span { padding: .45rem .55rem; font-size: .78rem; line-height: 1.35; }
.article-index { clear: both; margin: 1.4rem 0; border: 1px solid var(--line-soft); background: #f8f9fa; }
.article-index-intro { margin: .8rem .9rem .15rem; color: var(--muted); }
.article-index-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; padding: .9rem; }
.article-index-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.article-index-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.article-index-card { display: grid; grid-template-rows: 9rem auto; min-width: 0; border: 1px solid var(--line-soft); background: #fff; color: var(--ink); text-decoration: none; box-shadow: 0 1px 1px rgb(0 0 0 / 4%); }
.article-index-card:hover, .article-index-card:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 2px rgb(51 102 204 / 18%); text-decoration: none; }
.article-index-card img { width: 100%; height: 9rem; object-fit: cover; background: #eaecf0; }
.article-index-placeholder { display: grid; place-items: center; background: linear-gradient(145deg, #eaecf0, #c8ccd1); color: var(--muted); font: 700 1rem Georgia, serif; }
.article-index-copy { display: grid; gap: .25rem; padding: .65rem .7rem .75rem; }
.article-index-copy strong { color: var(--accent); font-size: .95rem; }
.article-index-copy span { color: var(--muted); font-size: .8rem; line-height: 1.35; }
.media-video { clear: both; max-width: 52rem; margin: 1.4rem 0; border: 1px solid var(--line-soft); background: #f8f9fa; }
.media-video video { display: block; width: 100%; max-height: 34rem; background: #111; }
.video-frame { position: relative; aspect-ratio: 16 / 9; background: #111; }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.media-video > figcaption { padding: .65rem .8rem; color: var(--muted); font-size: .82rem; }
.media-model { clear: both; max-width: 52rem; margin: 1.4rem 0; border: 1px solid var(--line-soft); background: #f8f9fa; }
.model-canvas-wrap { position: relative; padding: .8rem; background: #202122; }
.model-canvas { display: block; width: 100%; aspect-ratio: 16 / 9; outline: none; background: radial-gradient(circle at 50% 42%, #59656e, #20252a 68%); touch-action: none; }
.model-canvas:focus-visible { box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--accent); }
.model-controls { position: absolute; top: 1.2rem; right: 1.2rem; display: flex; gap: .3rem; }
.model-icon-button { display: grid; place-items: center; width: 2rem; height: 2rem; border: 1px solid #a2a9b1; border-radius: 2px; background: rgb(255 255 255 / 94%); color: var(--ink); font: 700 1.1rem/1 Arial, sans-serif; text-decoration: none; box-shadow: 0 1px 3px rgb(0 0 0 / 28%); }
.model-icon-button:hover, .model-icon-button:focus-visible { border-color: var(--accent); background: #fff; text-decoration: none; }
.model-status { margin: .65rem 0 0; color: #eaecf0; font-size: .8rem; }
.media-model > figcaption { padding: .65rem .8rem; color: var(--muted); font-size: .82rem; }
.media-chart, .media-table { clear: both; max-width: 56rem; margin: 1.4rem 0; border: 1px solid var(--line-soft); background: #f8f9fa; }
.chart-canvas { min-height: 21rem; padding: .4rem; background: #fff; }
.chart-canvas.chart-error { display: grid; place-items: center; min-height: 12rem; padding: 1rem; color: var(--danger); text-align: center; }
.chart-data { margin: .65rem .8rem; color: var(--muted); font-size: .82rem; }
.chart-data summary { cursor: pointer; color: var(--accent); }
.chart-data pre { max-height: 18rem; margin: .55rem 0 0; overflow: auto; padding: .65rem; border: 1px solid var(--line-soft); background: #fff; white-space: pre-wrap; }
.media-chart > figcaption { padding: .65rem .8rem; color: var(--muted); font-size: .82rem; }
.data-table-wrap { overflow-x: auto; padding: .8rem; background: #fff; }
.data-table-wrap table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.data-table-wrap th, .data-table-wrap td { padding: .45rem .55rem; border: 1px solid var(--line-soft); text-align: left; }
.data-table-wrap th { background: #eaecf0; }

.toc { display: inline-block; min-width: 18rem; margin: .8rem 0; padding: .65rem .9rem; border: 1px solid var(--line-soft); background: #f8f9fa; }
.toc strong { display: block; text-align: center; }
.toc ol { margin: .45rem 0 .1rem; padding-left: 1.4rem; }

.editor { display: grid; gap: .9rem; }
.template-toolbar { display: grid; gap: .65rem; padding: .8rem; border: 1px solid var(--line-soft); border-left: .28rem solid var(--accent); background: #f8f9fa; }
.template-toolbar > div:first-child { display: flex; flex-wrap: wrap; align-items: baseline; gap: .45rem .8rem; }
.template-toolbar > div:first-child span { color: var(--muted); font-size: .8rem; }
.template-controls, .component-buttons { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; }
.draft-preview-banner { display: flex; justify-content: space-between; align-items: center; gap: .8rem; margin: 0 0 1rem; padding: .7rem .8rem; border: 1px solid var(--line-soft); background: #f8f9fa; }
.draft-preview-banner > div { display: flex; align-items: center; gap: .55rem; }
.draft-preview-banner strong { color: var(--ink); }
.draft-preview-banner span { color: #b32424; font-size: .82rem; font-weight: 700; }
.draft-preview-page { max-width: 60rem; min-height: 28rem; padding: 1rem; border: 1px solid var(--line-soft); background: #fff; }
.template-controls select { min-height: 2.35rem; padding: .42rem .65rem; border: 1px solid var(--line); background: #fff; }
.component-buttons a { margin-left: .3rem; font-size: .82rem; }
.template-guide { max-width: 72rem; }
.template-guide pre { max-height: 24rem; }
.editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(18rem, 38%); gap: 1rem; }
.field { display: grid; gap: .3rem; }
.field label { font-size: .82rem; font-weight: 700; }
.field input, .field textarea, .field select {
  width: 100%;
  padding: .55rem .65rem;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #fff;
}
.field textarea { min-height: 28rem; resize: vertical; font: .9rem/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; }
.editor-preview { min-height: 28rem; padding: .8rem 1rem; border: 1px solid var(--line-soft); background: #fff; overflow: auto; }
.editor-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.editor-status { color: var(--muted); font-size: .82rem; }
.attachment-list { display: grid; gap: .35rem; margin-top: .55rem; padding-top: .55rem; border-top: 1px solid var(--line-soft); }
.attachment-list-title { font-size: .82rem; }
.attachment-list ul { display: grid; gap: .35rem; margin: 0; padding: 0; list-style: none; }
.attachment-list li { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .35rem .45rem; border: 1px solid var(--line-soft); background: #fff; font-size: .84rem; }
.attachment-list small { color: var(--muted); }
.attachment-list .button { min-height: 1.9rem; padding: .24rem .55rem; font-size: .78rem; }
.file-policy-types { display: grid; grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); gap: .42rem .7rem; padding: .75rem; border: 1px solid var(--line-soft); background: #fff; }
.file-policy-types label { display: flex; gap: .35rem; align-items: center; font-size: .86rem; }

.history-list, .result-list { list-style: none; margin: 1rem 0; padding: 0; }
.history-item, .result-item { display: grid; grid-template-columns: 10rem 1fr auto; gap: .8rem; padding: .75rem 0; border-bottom: 1px solid var(--line-soft); }
.history-meta, .result-meta { color: var(--muted); font-size: .8rem; }
.empty-state { padding: 2.2rem; border: 1px dashed var(--line); background: #f8f9fa; text-align: center; color: var(--muted); }
.loading { color: var(--muted); }

.footer { max-width: calc(var(--content) + var(--sidebar)); margin: 0 auto; padding: 0 2rem 2rem calc(var(--sidebar) + 2rem); color: var(--muted); font-size: .75rem; }

.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgb(32 33 34 / 58%);
}
.dialog-backdrop[hidden] { display: none; }
.dialog { width: min(34rem, 100%); max-height: calc(100vh - 2rem); overflow: auto; padding: 1.2rem; border: 1px solid var(--line); background: #fff; box-shadow: 0 8px 32px rgb(0 0 0 / 28%); }
.dialog h2 { margin: 0 0 .8rem; font: 1.5rem/1.2 Georgia, serif; }
.dialog-open { overflow: hidden; }
.gallery-backdrop { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 1rem; background: rgb(0 0 0 / 86%); }
.gallery-backdrop[hidden] { display: none; }
.gallery-dialog { position: relative; display: grid; grid-template-columns: 3rem minmax(0, 1fr) 3rem; align-items: center; width: min(78rem, 100%); max-height: calc(100vh - 2rem); }
.gallery-dialog figure { display: grid; place-items: center; min-width: 0; margin: 0; }
.gallery-dialog img { max-width: 100%; max-height: calc(100vh - 7rem); object-fit: contain; }
.gallery-dialog figcaption { width: 100%; padding: .55rem; color: #fff; text-align: center; }
.gallery-close, .gallery-previous, .gallery-next { border: 0; background: transparent; color: #fff; font-size: 2.6rem; line-height: 1; }
.gallery-close { position: absolute; z-index: 1; top: -.25rem; right: 0; width: 3rem; height: 3rem; }
.gallery-previous, .gallery-next { width: 3rem; height: 4rem; }

@media (max-width: 900px) {
  :root { --sidebar: 0rem; }
  body { background: #fff; }
  .site-header { height: auto; min-height: 4.4rem; grid-template-columns: minmax(0, 1fr) auto auto; padding: .55rem .8rem; }
  .brand { grid-template-columns: 2.4rem 1fr; }
  .brand-mark { width: 2.4rem; height: 2.4rem; }
  .mobile-menu-button { display: inline-flex; }
  .search-form { grid-column: 1 / -1; grid-row: 2; }
  .site-grid { grid-template-columns: 1fr; padding: 0; }
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 61; display: block; width: min(21rem, 88vw); overflow-y: auto; padding: 1rem 1.1rem 2rem; border-right: 1px solid var(--quiet); background: #fff; box-shadow: 8px 0 28px rgb(0 0 0 / 24%); transform: translateX(-105%); transition: transform .2s ease; }
  .sidebar.open { transform: translateX(0); }
  .sidebar li { margin: 0; }
  .sidebar a { display: block; padding: .42rem .3rem; }
  .mobile-sidebar-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: .8rem; padding-bottom: .65rem; border-bottom: 1px solid var(--line); font: 1.12rem Georgia, serif; }
  .mobile-sidebar-heading button { display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border: 1px solid var(--line); background: #fff; font-size: 1.6rem; line-height: 1; }
  .mobile-nav-backdrop { position: fixed; inset: 0; z-index: 60; display: block; border: 0; background: rgb(32 33 34 / 58%); }
  .page-shell { padding: 1.2rem 1rem 2.5rem; border-left: 0; border-right: 0; }
  .wiki-content table, .data-table { display: block; max-width: 100%; overflow-x: auto; }
  .page-tools { padding: 0 .4rem; overflow-x: auto; }
  .tab { white-space: nowrap; }
  .editor-grid { grid-template-columns: 1fr; }
  .infobox, .infobox--left, .infobox--right { float: none; width: 100%; margin: 1rem 0; }
  .gallery-grid, .gallery-cols-4, .gallery-cols-5, .gallery-cols-6, .article-index-grid, .article-index-cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .model-canvas { aspect-ratio: 4 / 3; }
  .chart-canvas { min-height: 17rem; }
  .footer { padding: 1rem; }
}

@media (max-width: 560px) {
  .site-header { grid-template-columns: minmax(0, 1fr) auto; }
  .brand-tagline, .user-state { display: none; }
  .user-tools { grid-column: 1 / -1; grid-row: 3; gap: .25rem; }
  .user-tools .button { padding-inline: .55rem; }
  .page-heading h1 { font-size: 1.7rem; }
  .history-item, .result-item { grid-template-columns: 1fr; gap: .18rem; }
  .gallery-grid, .gallery-cols-2, .gallery-cols-4, .gallery-cols-5, .gallery-cols-6, .article-index-grid, .article-index-cols-2, .article-index-cols-4 { grid-template-columns: 1fr; }
  .attachment-list li { align-items: flex-start; flex-direction: column; }
  .gallery-dialog { grid-template-columns: 2.4rem minmax(0, 1fr) 2.4rem; }
  .template-controls, .component-buttons, .editor-actions { align-items: stretch; }
  .template-controls > *, .component-buttons > * { width: 100%; margin-left: 0; }
  .model-controls .button { width: auto; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .sidebar { transition: none; }
}

@media print {
  .site-header, .sidebar, .page-tools, .footer, .notice, .gallery-backdrop, .mobile-nav-backdrop, .template-toolbar, .media-model { display: none !important; }
  .site-grid { display: block; max-width: none; padding: 0; }
  .page-shell { border: 0; box-shadow: none; padding: 0; }
  a { color: #000; }
}
