:root {
  --paper: #FFFFFF;
  --surface: #F5F6F8;
  --panel: #F9FAFB;
  --ink: #202122;
  --muted: #54595D;
  --line: #A2A9B1;
  --line-soft: #DADDE3;
  --accent: #3366CC;
  --accent-dark: #0645AD;
  --accent-soft: #EAECF0;
  --danger: #B32424;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--surface);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans SC", "Microsoft YaHei", Arial, sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  min-height: 2rem;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--paper);
  color: var(--ink);
  padding: 0.38rem 0.7rem;
  cursor: pointer;
}

button:hover,
button:focus-visible {
  border-color: var(--accent);
  color: var(--accent-dark);
}

button.active,
.filter-button.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-dark);
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--paper);
  color: var(--ink);
  padding: 0.5rem 0.6rem;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

textarea {
  min-height: 26rem;
  resize: vertical;
  line-height: 1.65;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  border: 1px solid var(--line);
  border-bottom: 0;
  background: var(--paper);
  padding: 0.45rem;
}

.editor-toolbar button {
  min-height: 1.7rem;
  padding: 0.22rem 0.5rem;
  font-size: 0.8rem;
}

.editor-toolbar span {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.editor-toolbar span.is-dirty {
  color: var(--danger);
}

.editor-toolbar + textarea {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

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

.hidden {
  display: none !important;
}

[hidden] {
  display: none !important;
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.form-message {
  min-height: 1.1rem;
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

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

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.access-card {
  width: min(28rem, 100%);
  display: grid;
  gap: 0.75rem;
  border: 1px solid var(--line);
  background: var(--paper);
  padding: 1.25rem;
  box-shadow: 0 2px 8px rgba(32, 33, 34, 0.08);
}

.access-index {
  width: 3.2rem;
  height: 3.2rem;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--paper);
  font-weight: 800;
}

.access-card h1 {
  margin: 0;
  font-size: 1.8rem;
  line-height: 1.15;
}

.access-card label,
.field,
.upload-box label,
.search-field {
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
}

.wiki-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 17rem minmax(0, 1fr);
  grid-template-rows: 3rem minmax(0, 1fr);
}

.site-header {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 17rem 1fr auto;
  align-items: stretch;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.brand-lockup {
  display: grid;
  grid-template-columns: 3rem 1fr;
  align-items: center;
  border-right: 1px solid var(--line-soft);
  color: var(--ink);
  text-decoration: none;
}

.brand-lockup span {
  height: 100%;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--paper);
  font-weight: 900;
}

.brand-lockup strong {
  padding: 0 0.8rem;
  font-size: 1.05rem;
}

.top-nav {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  padding: 0 0.8rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.site-header > button {
  align-self: stretch;
  border-width: 0 0 0 1px;
  border-radius: 0;
  min-width: 5.5rem;
}

.library-panel {
  min-width: 0;
  height: calc(100vh - 3rem);
  overflow: auto;
  border-right: 1px solid var(--line);
  background: var(--panel);
}

.library-tools {
  display: grid;
  gap: 0.65rem;
  padding: 0.8rem;
  border-bottom: 1px solid var(--line-soft);
}

.type-filter {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.35rem;
}

.filter-button {
  min-width: 0;
  padding-left: 0.4rem;
  padding-right: 0.4rem;
  font-size: 0.82rem;
}

.entry-list,
.entry-tree,
.entry-group-list {
  display: grid;
}

.entry-group {
  border-bottom: 1px solid var(--line-soft);
}

.entry-group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.65rem;
  background: var(--accent-soft);
  color: var(--ink);
  font-weight: 700;
  font-size: 0.84rem;
}

.entry-group-count {
  color: var(--muted);
  font-weight: 400;
  font-size: 0.76rem;
}

.entry-subgroup-title {
  padding: 0.35rem 0.65rem 0.35rem 1rem;
  border-top: 1px solid var(--line-soft);
  background: var(--panel);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.entry-item {
  width: 100%;
  display: grid;
  grid-template-columns: 2.8rem 1fr;
  align-items: stretch;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  border-radius: 0;
  background: transparent;
  text-align: left;
  padding: 0;
  color: var(--ink);
}

.entry-subgroup .entry-item {
  grid-template-columns: 3.2rem 1fr;
}

.entry-item:hover,
.entry-item.active {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.entry-number {
  display: grid;
  place-items: center;
  border-right: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 0.84rem;
  min-height: 3.8rem;
}

.entry-body {
  min-width: 0;
  padding: 0.55rem 0.65rem;
}

.entry-title {
  display: block;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.entry-subtitle {
  display: block;
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.entry-type {
  display: inline-block;
  margin-right: 0.35rem;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--accent-dark);
  padding: 0 0.25rem;
  font-size: 0.72rem;
}

.empty-state {
  margin: 0;
  padding: 0.8rem;
  color: var(--muted);
}

.wiki-main {
  min-width: 0;
  height: calc(100vh - 3rem);
  overflow: auto;
  background: var(--paper);
}

.view-modebar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: flex-end;
  gap: 0;
  max-width: none;
  margin: 0 auto;
  padding: 0.75rem 1rem 0;
  background: var(--paper);
}

.mode-button {
  min-width: 4.5rem;
  border-radius: 0;
}

.mode-button + .mode-button {
  border-left: 0;
}

.mode-button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--paper);
  font-weight: 700;
}

.view-panel {
  display: none;
}

.article-layout.view-panel.active {
  display: grid;
}

.workspace-panel.view-panel.active {
  display: block;
}

.article-layout {
  grid-template-columns: minmax(0, 1fr) 20rem;
  gap: 1.2rem;
  align-items: start;
  max-width: none;
  margin: 0 auto;
  padding: 1rem;
}

.article-page {
  min-width: 0;
  grid-column: 1;
}

.article-header {
  margin-bottom: 1.25rem;
}

.hero-banner {
  grid-column: 1 / -1;
  position: relative;
  min-height: clamp(30rem, 62vh, 48rem);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: clamp(1rem, 3vw, 2rem);
  background:
    linear-gradient(to bottom, rgba(20, 24, 31, 0.08) 0%, rgba(20, 24, 31, 0.74) 100%),
    linear-gradient(135deg, #202122 0%, #4F5865 48%, #7B463A 100%);
  background-size: cover;
  background-position: center;
}

.hero-banner.has-cover {
  background-size: cover;
  background-position: center;
}

.glass-panel {
  position: relative;
  z-index: 1;
  width: min(62rem, 100%);
  padding: clamp(1.2rem, 2.8vw, 2.2rem);
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 4px;
  background: rgba(20, 24, 31, 0.42);
  color: #FFFFFF;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.32);
}

.page-path {
  margin: 0 0 0.35rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.glass-panel .page-path {
  color: rgba(255, 255, 255, 0.78);
}

.hero-banner h1 {
  margin: 0 0 0.45rem;
  font-size: clamp(2.6rem, 5.4vw, 6.6rem);
  font-weight: 700;
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.article-summary {
  max-width: 72ch;
  margin: 0.25rem 0 0.65rem;
  color: var(--muted);
  line-height: 1.65;
}

.glass-panel .article-summary {
  color: rgba(255, 255, 255, 0.86);
  font-size: 1rem;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.tag {
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--panel);
  color: var(--accent-dark);
  padding: 0.12rem 0.38rem;
  font-size: 0.78rem;
}

.glass-panel .tag {
  border-color: rgba(255, 255, 255, 0.24);
  background: rgba(0, 0, 0, 0.28);
  color: #FFFFFF;
}

.article-content-wrapper {
  display: grid;
  grid-template-columns: 14rem minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
}

.toc-box {
  display: none;
  position: sticky;
  top: 4.25rem;
  margin: 0;
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 0.7rem 0.85rem;
}

.toc-box.has-items {
  display: block;
}

.toc-title {
  margin: 0 0 0.35rem;
  font-weight: 700;
}

.toc-box ol {
  margin: 0;
  padding-left: 1.3rem;
}

.toc-box a {
  text-decoration: none;
}

.toc-box a:hover {
  text-decoration: underline;
}

.manuscript {
  max-width: 88ch;
  line-height: 1.72;
  overflow-wrap: anywhere;
}

.manuscript h1,
.manuscript h2,
.manuscript h3 {
  line-height: 1.25;
  font-weight: 600;
}

.manuscript h1 {
  font-size: 1.75rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.25rem;
  margin: 0.8rem 0;
}

.manuscript h2 {
  font-size: 1.35rem;
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 0.2rem;
  margin: 1.35rem 0 0.65rem;
}

.manuscript h3 {
  font-size: 1.08rem;
  margin: 1rem 0 0.4rem;
}

.manuscript p,
.manuscript li {
  font-size: 1rem;
}

.manuscript blockquote {
  margin: 0.85rem 0;
  padding: 0.65rem 0.85rem;
  border-left: 4px solid var(--accent);
  background: var(--accent-soft);
}

.manuscript code {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  padding: 0.08rem 0.22rem;
}

.manuscript pre {
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 0.8rem;
}

.manuscript img,
.manuscript video {
  display: block;
  max-width: 100%;
  margin: 0.85rem 0;
  border: 1px solid var(--line);
  background: var(--panel);
}

.infobox {
  position: sticky;
  top: 1rem;
  min-width: 0;
  border: 1px solid var(--line-soft);
  background: rgba(249, 250, 251, 0.5);
  font-size: 0.86rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
}

.infobox-media {
  margin: 0;
  border-bottom: 0;
  background: transparent;
}

.infobox-media img,
.infobox-media video {
  width: 100%;
  display: block;
  height: auto;
  max-height: min(62vh, 42rem);
  object-fit: contain;
  border: 0;
  background: transparent;
}

.portrait-placeholder {
  min-height: 15rem;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 0.25rem;
  color: var(--muted);
  text-align: center;
  padding: 1rem;
}

.portrait-placeholder span {
  font-weight: 700;
}

.portrait-placeholder small {
  font-size: 0.76rem;
}

.profile-grid {
  display: grid;
  gap: 0;
}

.profile-section {
  border-top: 1px solid var(--line-soft);
}

.profile-section:first-child {
  border-top: 0;
}

.profile-section summary {
  min-height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.5rem 0.65rem;
  background: rgba(234, 236, 240, 0.68);
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}

.profile-section summary::after {
  content: "+";
  color: var(--muted);
  font-weight: 700;
}

.profile-section[open] summary::after {
  content: "-";
}

.profile-table {
  display: grid;
}

.profile-cell {
  display: grid;
  grid-template-columns: 6rem minmax(0, 1fr);
  border-bottom: 1px solid var(--line-soft);
}

.profile-cell:last-child {
  border-bottom: 0;
}

.profile-cell span {
  padding: 0.45rem 0.55rem;
  border-right: 1px solid var(--line-soft);
  background: var(--accent-soft);
  color: var(--ink);
  font-weight: 700;
}

.profile-cell strong {
  min-width: 0;
  padding: 0.45rem 0.55rem;
  font-weight: 400;
  overflow-wrap: anywhere;
}

.radar-chart {
  width: 100%;
  height: auto;
  display: block;
  padding: 0.75rem 0.45rem 0.35rem;
}

.radar-guide,
.radar-spoke {
  fill: none;
  stroke: var(--line-soft);
  stroke-width: 1;
}

.radar-value {
  fill: rgba(51, 102, 204, 0.2);
  stroke: var(--accent);
  stroke-width: 2;
}

.radar-dot {
  fill: var(--accent);
}

.radar-label {
  fill: var(--muted);
  font-size: 8px;
  text-anchor: middle;
  dominant-baseline: middle;
}

.radar-values {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem;
  padding: 0 0.65rem 0.65rem;
  color: var(--muted);
  font-size: 0.76rem;
}

.radar-values span {
  overflow-wrap: anywhere;
}

.profile-hint {
  margin: 0;
  padding: 0 0.65rem 0.75rem;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.45;
}

.workspace-panel {
  max-width: 1280px;
  margin: 0 auto 1.5rem;
  border-top: 1px solid var(--line);
  padding: 0 1rem 1rem;
}

.panel-tabs {
  display: flex;
  gap: 0;
  margin-top: 0.8rem;
  border-bottom: 1px solid var(--line);
}

.panel-tabs button {
  border-bottom: 0;
  border-radius: 2px 2px 0 0;
}

.tab-button.active {
  background: var(--paper);
  border-color: var(--line);
  color: var(--ink);
  font-weight: 700;
  transform: translateY(1px);
}

.panel {
  display: none;
  border: 1px solid var(--line);
  border-top: 0;
  background: var(--panel);
  padding: 1rem;
}

.panel.active {
  display: block;
}

.panel-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.8rem;
}

.panel-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

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

.danger-button:hover,
.danger-button:focus-visible,
.danger-button.confirming {
  background: var(--danger);
  border-color: var(--danger);
  color: var(--paper);
}

.ghost-button {
  border-color: transparent;
  background: transparent;
}

.entry-dialog {
  width: min(38rem, calc(100vw - 2rem));
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 18px 60px rgba(32, 33, 34, 0.24);
}

.entry-dialog::backdrop {
  background: rgba(32, 33, 34, 0.36);
}

.entry-dialog-card {
  display: grid;
  gap: 1rem;
  padding: 1rem;
}

.dialog-heading,
.dialog-actions {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
}

.dialog-heading h2 {
  margin: 0;
  font-size: 1.25rem;
}

.dialog-context {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.type-choice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.type-choice {
  display: grid;
  gap: 0.35rem;
  min-height: 6.2rem;
  align-content: start;
  text-align: left;
  background: var(--panel);
}

.type-choice strong {
  font-size: 1rem;
}

.type-choice span {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.type-choice.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

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

.panel-heading h2 {
  margin: 0;
  font-size: 1.15rem;
}

.field {
  margin-bottom: 0.75rem;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.field-wide {
  grid-column: 1 / -1;
}

.upload-box {
  display: grid;
  gap: 0.75rem;
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 1rem;
}

.ai-float-toggle {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 40;
  min-width: 3.2rem;
  min-height: 3.2rem;
  border-color: var(--accent);
  background: var(--accent);
  color: var(--paper);
  font-weight: 800;
  box-shadow: 0 8px 24px rgba(32, 33, 34, 0.18);
}

.ai-float {
  position: fixed;
  right: 1rem;
  bottom: 4.8rem;
  z-index: 39;
  width: min(31rem, calc(100vw - 2rem));
  max-height: min(82vh, 48rem);
  overflow: auto;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 18px 60px rgba(32, 33, 34, 0.22);
  padding: 0.85rem;
}

.ai-float-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 0.75rem;
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 0.7rem;
  margin-bottom: 0.75rem;
}

.ai-float-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.ai-settings-actions {
  justify-content: flex-start;
  margin-top: 0.25rem;
}

.ai-config-grid {
  display: grid;
  grid-template-columns: minmax(12rem, 0.8fr) minmax(14rem, 1.2fr);
  gap: 0.75rem;
}

.ai-provider-hint {
  margin: 0.4rem 0 0.8rem;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.ai-chat-log {
  min-height: 14rem;
  max-height: 22rem;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 0.7rem;
  border: 1px solid var(--line);
  background: var(--paper);
  padding: 0.75rem;
}

.ai-quote-box {
  display: grid;
  gap: 0.45rem;
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  padding: 0.65rem;
  margin: 0.75rem 0;
}

.ai-quote-box strong {
  font-size: 0.78rem;
}

.ai-quote-box p {
  max-height: 6rem;
  overflow: auto;
  margin: 0;
  color: var(--ink);
  font-size: 0.82rem;
  line-height: 1.55;
  white-space: pre-wrap;
}

.ai-quote-box button {
  justify-self: start;
}

.ai-message {
  max-width: min(48rem, 92%);
  border: 1px solid var(--line-soft);
  background: var(--panel);
  padding: 0.65rem 0.75rem;
}

.ai-message.user {
  justify-self: end;
  border-color: var(--accent);
  background: var(--accent-soft);
}

.ai-message strong {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.78rem;
}

.ai-message p {
  margin: 0;
  line-height: 1.65;
  white-space: normal;
}

.ai-chat-form {
  margin-top: 0.85rem;
}

#aiPromptInput {
  min-height: 7rem;
  font-family: inherit;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 0.75rem;
  padding-top: 1rem;
}

.media-card {
  border: 1px solid var(--line);
  background: var(--paper);
  padding: 0.5rem;
}

.media-card img,
.media-card video {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid var(--line-soft);
  background: var(--panel);
}

.media-card p {
  min-height: 2.5rem;
  margin: 0.5rem 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.media-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.4rem;
}

.media-actions button {
  width: 100%;
}

.media-actions .danger-button {
  min-width: 4.4rem;
}

@media (min-width: 1500px) {
  .wiki-shell {
    grid-template-columns: 19rem minmax(0, 1fr);
  }

  .site-header {
    grid-template-columns: 19rem 1fr auto;
  }

  .article-layout {
    grid-template-columns: minmax(0, 1fr) 22rem;
    max-width: none;
  }

  .workspace-panel {
    max-width: 1440px;
  }
}

@media (min-width: 1061px) and (max-width: 1400px) {
  .article-layout {
    grid-template-columns: minmax(0, 1fr) 16rem;
    gap: 0.85rem;
  }

  .article-content-wrapper {
    grid-template-columns: 10.5rem minmax(0, 1fr);
    gap: 1.15rem;
  }

  .toc-box {
    padding: 0.6rem 0.7rem;
  }

  .infobox {
    font-size: 0.82rem;
  }

  .profile-cell {
    grid-template-columns: 4.8rem minmax(0, 1fr);
  }
}

@media (max-width: 1060px) {
  .article-layout {
    grid-template-columns: 1fr;
  }

  .article-content-wrapper {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .toc-box {
    position: static;
  }

  .infobox {
    position: static;
    max-width: 28rem;
  }
}

@media (max-width: 820px) {
  .wiki-shell {
    display: block;
  }

  .site-header {
    grid-template-columns: 1fr auto;
  }

  .brand-lockup {
    grid-column: 1 / -1;
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
  }

  .top-nav {
    justify-content: flex-start;
    min-height: 2.75rem;
  }

  .library-panel,
  .wiki-main {
    height: auto;
  }

  .library-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .hero-banner {
    min-height: 28rem;
  }
}

@media (max-width: 560px) {
  body {
    font-size: 13px;
  }

  .site-header {
    grid-template-columns: 1fr;
  }

  .site-header > button {
    border-left: 0;
    border-top: 1px solid var(--line-soft);
  }

  .article-layout,
  .view-modebar,
  .workspace-panel {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .view-modebar {
    justify-content: stretch;
  }

  .mode-button {
    flex: 1;
  }

  .ai-float {
    left: 0.5rem;
    right: 0.5rem;
    bottom: 4.4rem;
    width: auto;
    max-height: 78vh;
  }

  .ai-float-toggle {
    right: 0.75rem;
    bottom: 0.75rem;
  }

  .ai-float-header {
    display: grid;
  }

  .hero-banner {
    min-height: 24rem;
    padding: 0.75rem;
  }

  .hero-banner h1 {
    font-size: 2rem;
  }

  .glass-panel {
    padding: 0.85rem;
  }

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

  .ai-config-grid {
    grid-template-columns: 1fr;
  }

  .profile-cell {
    grid-template-columns: 5rem minmax(0, 1fr);
  }
}
