:root {
  color-scheme: light;
  --bg: #f6f6f8;
  --panel: rgba(255, 255, 255, 0.74);
  --panel-solid: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: rgba(148, 163, 184, 0.28);
  --line-strong: rgba(148, 163, 184, 0.48);
  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --accent-soft: rgba(37, 99, 235, 0.1);
  --success: #10b981;
  --warning: #d97706;
  --danger: #e11d48;
  --danger-soft: rgba(225, 29, 72, 0.09);
  --shadow: 0 18px 48px rgba(15, 23, 42, 0.08);
  --soft-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  --blur: blur(18px);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
}

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

button {
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
  letter-spacing: 0;
  touch-action: manipulation;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(248, 250, 252, 0.9);
  color: var(--text);
  padding: 11px 13px;
  outline: none;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(37, 99, 235, 0.58);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.12;
  letter-spacing: 0;
}

h2 {
  font-size: 16px;
  letter-spacing: 0;
}

[hidden] {
  display: none !important;
}

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

.login-panel {
  width: min(430px, 100%);
  display: grid;
  gap: 26px;
  padding: 34px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}

.stack {
  display: grid;
  gap: 16px;
}

.eyebrow {
  color: var(--accent);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.primary,
.secondary,
.ghost,
.danger {
  min-height: 40px;
  padding: 0 15px;
  transition:
    transform 140ms ease,
    box-shadow 140ms ease,
    background 140ms ease,
    color 140ms ease;
}

.primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 12px 26px rgba(37, 99, 235, 0.22);
}

.primary:hover {
  background: var(--accent-strong);
  transform: translateY(-1px);
}

.secondary {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.secondary:hover {
  background: rgba(37, 99, 235, 0.16);
}

.ghost {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.56);
  color: #334155;
}

.ghost:hover {
  background: #ffffff;
  box-shadow: var(--soft-shadow);
}

.danger {
  border: 1px solid rgba(225, 29, 72, 0.22);
  background: var(--danger-soft);
  color: var(--danger);
}

.button-link {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 15px;
  border-radius: 12px;
  background: var(--accent);
  color: white;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 12px 26px rgba(37, 99, 235, 0.18);
}

.guest-link {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.6);
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.toolbar .secondary,
.toolbar .ghost,
.toolbar .button-link {
  min-height: 34px;
  padding: 0 11px;
  font-size: 13px;
}

.error {
  min-height: 20px;
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 178px minmax(0, 1fr);
  grid-template-rows: auto auto auto minmax(0, 1fr);
  grid-template-areas:
    "side topbar"
    "side stats"
    "side message"
    "side content";
  gap: 16px 18px;
  padding: 18px;
}

.guest-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 16px;
  padding: 18px;
}

.guest-topbar {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.46);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}

.guest-panel {
  min-height: calc(100vh - 160px);
}

.topbar {
  grid-area: topbar;
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.46);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}

.account {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-weight: 800;
}

.stats-grid {
  grid-area: stats;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.metric {
  min-height: 86px;
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--soft-shadow);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}

.metric span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.metric strong {
  font-size: 30px;
  line-height: 1;
  letter-spacing: 0;
}

.tabs {
  grid-area: side;
  min-height: calc(100vh - 36px);
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 0;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.58);
  box-shadow: var(--shadow);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}

.tabs::before {
  content: "Novel Admin";
  display: block;
  margin: 2px 0 2px;
  color: var(--text);
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0;
}

.tabs::after {
  content: "N";
  order: -1;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 10px;
  border-radius: 13px;
  background: var(--accent);
  color: white;
  font-size: 18px;
  font-weight: 900;
  box-shadow: 0 16px 32px rgba(37, 99, 235, 0.24);
}

.tab {
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 11px;
  border-radius: 13px;
  background: transparent;
  color: #475569;
  font-size: 14px;
  font-weight: 800;
  text-align: left;
}

.tab:hover {
  background: rgba(241, 245, 249, 0.92);
}

.tab.active {
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}

.message {
  grid-area: message;
  min-height: 30px;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 900;
}

.file-workspace,
.workspace,
.audit-panel {
  grid-area: content;
}

.file-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.list-panel,
.editor-panel,
.audit-panel,
.browser-panel {
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: var(--soft-shadow);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}

.browser-panel {
  position: relative;
  min-height: calc(100vh - 246px);
  overflow: hidden;
}

.browser-panel.dragging {
  outline: 3px solid rgba(37, 99, 235, 0.22);
  outline-offset: 3px;
}

.drop-overlay {
  position: absolute;
  inset: 68px 14px 14px;
  z-index: 5;
  display: grid;
  place-items: center;
  border: 2px dashed var(--accent);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--accent-strong);
  font-size: 18px;
  font-weight: 900;
  pointer-events: none;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.breadcrumbs {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

.folder-note {
  display: grid;
  gap: 5px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(248, 250, 252, 0.56);
}

.folder-note strong {
  color: var(--accent-strong);
  font-size: 13px;
}

.folder-note p {
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.folder-note span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.selection-summary {
  min-height: 38px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(37, 99, 235, 0.08);
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crumb {
  min-height: 30px;
  padding: 0 9px;
  border-radius: 10px;
  background: transparent;
  color: var(--accent-strong);
}

.crumb:hover,
.crumb.active {
  background: var(--accent-soft);
}

.file-list {
  display: grid;
  gap: 6px;
  padding: 10px;
  max-height: calc(100vh - 442px);
  overflow: auto;
}

.chapter-tools {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto minmax(260px, auto);
  gap: 10px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.42);
}

.chapter-tools input,
.chapter-tools select {
  min-height: 38px;
  padding: 8px 11px;
  border-radius: 11px;
  font-size: 13px;
}

.page-size-control {
  display: flex;
  grid-auto-flow: column;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.page-size-control select {
  width: 76px;
}

.page-controls {
  display: grid;
  grid-template-columns: auto minmax(96px, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.page-controls .ghost,
.chapter-tools > .ghost {
  min-height: 38px;
  padding: 0 12px;
  font-size: 13px;
}

.page-controls span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
  white-space: nowrap;
}

.chapter-tools .active-sort {
  border-color: rgba(37, 99, 235, 0.24);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.file-list-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: 48px minmax(240px, 1.7fr) 156px 170px;
  gap: 12px;
  align-items: center;
  min-height: 34px;
  padding: 0 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.file-list.selecting .file-list-head {
  grid-template-columns: 34px 48px minmax(240px, 1.7fr) 156px 170px;
}

.file-row {
  width: 100%;
  display: grid;
  grid-template-columns: 48px minmax(240px, 1.7fr) 156px 170px;
  gap: 12px;
  align-items: center;
  min-height: 56px;
  padding: 9px 10px;
  border-radius: 14px;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.file-list.selecting .file-row {
  grid-template-columns: 34px 48px minmax(240px, 1.7fr) 156px 170px;
}

.file-row:hover,
.file-row.selected {
  background: rgba(241, 245, 249, 0.9);
}

.file-row.selected {
  box-shadow: inset 3px 0 0 var(--accent);
}

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

.file-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.file-row .file-title {
  display: grid;
  gap: 3px;
  color: var(--text);
  font-size: 14px;
  font-weight: 900;
}

.file-row .file-title strong {
  display: flex;
  align-items: center;
  gap: 8px;
}

.public-badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.1);
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 950;
  flex: 0 0 auto;
}

.public-badge.inherited {
  background: rgba(16, 185, 129, 0.12);
  color: #047857;
}

.file-title small {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-icon {
  position: relative;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  overflow: visible !important;
  color: white !important;
  letter-spacing: 0;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
}

.file-icon span {
  overflow: visible;
  color: inherit;
  font-size: 11px;
  font-weight: 950;
  line-height: 1;
  white-space: nowrap;
}

.folder-icon {
  background: linear-gradient(180deg, #f59e0b, #d97706);
}

.folder-icon::before {
  content: "";
  position: absolute;
  top: -4px;
  left: 6px;
  width: 18px;
  height: 8px;
  border-radius: 7px 7px 0 0;
  background: #fbbf24;
}

.md-icon {
  background: linear-gradient(180deg, #2563eb, #1d4ed8);
}

.txt-icon {
  background: linear-gradient(180deg, #10b981, #047857);
}

.image-icon {
  background: linear-gradient(180deg, #ec4899, #be185d);
}

.file-icon-generic {
  background: linear-gradient(180deg, #64748b, #334155);
}

.up-icon {
  background: linear-gradient(180deg, #8b5cf6, #6d28d9);
}

.guest-download {
  min-height: 34px;
  padding: 0 12px;
  justify-self: end;
  font-size: 13px;
}

.file-check {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
}

.preview-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  width: min(1120px, calc(100vw - 32px));
  height: min(820px, calc(100vh - 32px));
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 28px 90px rgba(15, 23, 42, 0.22);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}

.preview-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.preview-head {
  align-items: center;
}

.preview-head > div {
  min-width: 0;
}

.preview-head h2,
.preview-head .muted {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
}

.preview-actions .ghost,
.preview-actions .secondary,
.preview-actions .button-link {
  min-height: 42px;
  padding: 0 16px;
  font-size: 14px;
}

.preview-actions #copyContentButton {
  min-width: 112px;
}

.panel-head {
  min-height: 70px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.muted {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.preview-content {
  min-height: 0;
  overflow: auto;
  padding: 24px;
  background: rgba(248, 250, 252, 0.64);
  color: var(--text);
}

.preview-content.empty,
.empty-note {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.text-body {
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  line-height: 1.74;
}

.image-body {
  display: grid;
  place-items: center;
  padding: 18px;
}

.image-body img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 16px;
  object-fit: contain;
  box-shadow: var(--soft-shadow);
}

.markdown-body {
  line-height: 1.78;
}

.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
  margin: 0 0 12px;
  line-height: 1.35;
}

.markdown-body p,
.markdown-body ul,
.markdown-body blockquote,
.markdown-body pre {
  margin: 0 0 14px;
}

.markdown-body ul {
  padding-left: 22px;
}

.markdown-body blockquote {
  padding-left: 12px;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}

.markdown-body code {
  padding: 2px 5px;
  border-radius: 6px;
  background: rgba(226, 232, 240, 0.9);
}

.markdown-body pre {
  overflow: auto;
  padding: 14px;
  border-radius: 14px;
  background: #0f172a;
  color: white;
}

.list-panel {
  min-height: 540px;
  overflow: hidden;
}

.editor-panel,
.audit-panel {
  display: grid;
  gap: 18px;
  padding: 18px;
}

.editor-panel .panel-head,
.audit-panel .panel-head {
  min-height: auto;
  padding: 0 0 14px;
}

.item-list {
  display: grid;
  gap: 7px;
  padding: 10px;
}

.item-button {
  display: grid;
  gap: 5px;
  width: 100%;
  padding: 13px;
  border-radius: 14px;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.item-button:hover,
.item-button.active {
  background: rgba(241, 245, 249, 0.9);
}

.item-button.active {
  box-shadow: inset 3px 0 0 var(--accent);
}

.item-button strong {
  overflow-wrap: anywhere;
}

.item-button span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(226, 232, 240, 0.9);
  color: #475569;
  font-size: 12px;
  font-weight: 900;
}

.badge.green {
  background: rgba(16, 185, 129, 0.12);
  color: #047857;
}

.badge.orange {
  background: rgba(217, 119, 6, 0.12);
  color: var(--warning);
}

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

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

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

fieldset {
  min-width: 0;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(248, 250, 252, 0.42);
}

legend {
  color: var(--text);
  font-size: 14px;
  font-weight: 900;
  padding: 0 6px;
}

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

.check-grid.tall {
  max-height: 280px;
  overflow: auto;
  padding-right: 4px;
}

.check-line,
.switch {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.check-line input,
.switch input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

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

.audit-item {
  display: grid;
  gap: 5px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(248, 250, 252, 0.62);
}

.audit-item strong {
  font-size: 14px;
}

.audit-item span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto auto minmax(0, 1fr);
    grid-template-areas:
      "topbar"
      "side"
      "stats"
      "message"
      "content";
    padding: 14px;
  }

  .guest-shell {
    gap: 12px;
    padding: 14px;
  }

  .tabs {
    min-height: auto;
    flex-direction: row;
    overflow-x: auto;
  }

  .tabs::before,
  .tabs::after {
    display: none;
  }

  .tab {
    width: auto;
    min-width: 88px;
    justify-content: center;
  }

  .topbar,
  .guest-topbar,
  .account {
    align-items: flex-start;
  }

  .topbar,
  .guest-topbar,
  .file-workspace,
  .workspace,
  .split-block {
    grid-template-columns: 1fr;
  }

  .topbar,
  .guest-topbar {
    display: grid;
  }

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

  .list-panel,
  .browser-panel {
    min-height: 0;
  }

  .file-list {
    max-height: none;
  }
}

@media (max-width: 560px) {
  body {
    background: #f8fafc;
  }

  .login-panel {
    padding: 24px;
  }

  .app-shell {
    grid-template-rows: auto auto auto minmax(0, 1fr);
    grid-template-areas:
      "topbar"
      "side"
      "message"
      "content";
    gap: 8px;
    padding: 8px;
  }

  .guest-shell {
    gap: 8px;
    padding: 8px;
  }

  .topbar,
  .guest-topbar {
    min-height: 0;
    padding: 10px 12px;
    border-radius: 16px;
  }

  .topbar h1,
  .guest-topbar h1 {
    font-size: 18px;
    line-height: 1.2;
  }

  .account {
    width: 100%;
    justify-content: space-between;
    gap: 8px;
    font-size: 12px;
  }

  .stats-grid {
    display: none;
  }

  .tabs {
    position: sticky;
    top: 0;
    z-index: 10;
    gap: 4px;
    padding: 6px;
    border-radius: 16px;
  }

  .tab {
    min-width: 64px;
    min-height: 36px;
    padding: 0 10px;
    border-radius: 11px;
    font-size: 13px;
  }

  .message {
    min-height: 20px;
    font-size: 12px;
  }

  .browser-panel {
    min-height: calc(100dvh - 150px);
    border-radius: 16px;
  }

  .guest-panel {
    min-height: calc(100dvh - 108px);
  }

  .panel-head {
    min-height: 0;
    display: grid;
    gap: 10px;
    padding: 12px;
  }

  .browser-panel > .panel-head {
    background: rgba(255, 255, 255, 0.68);
  }

  .toolbar {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    justify-content: stretch;
    gap: 6px;
  }

  .toolbar .secondary,
  .toolbar .ghost,
  .toolbar .danger,
  .toolbar .button-link {
    min-height: 38px;
    padding: 0 8px;
    font-size: 12px;
  }

  .breadcrumbs {
    min-height: 38px;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 7px 10px;
  }

  .crumb {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .folder-note,
  .selection-summary {
    padding: 10px 12px;
  }

  .chapter-tools {
    grid-template-columns: 1fr 94px;
    gap: 7px;
    padding: 8px 10px;
  }

  .chapter-tools input {
    grid-column: 1 / -1;
  }

  .page-size-control {
    min-width: 0;
    gap: 5px;
    font-size: 11px;
  }

  .page-size-control select {
    width: 58px;
  }

  .chapter-tools > .ghost {
    width: 100%;
    min-height: 36px;
    padding: 0 8px;
    font-size: 12px;
  }

  .page-controls {
    grid-column: 1 / -1;
    grid-template-columns: 1fr minmax(80px, auto) 1fr;
    gap: 6px;
  }

  .page-controls .ghost {
    min-height: 36px;
    padding: 0 8px;
    font-size: 12px;
  }

  .selection-summary {
    white-space: normal;
    line-height: 1.45;
  }

  .file-list-head {
    display: none;
  }

  .file-list {
    gap: 5px;
    padding: 6px;
  }

  .file-row,
  .file-list.selecting .file-row {
    grid-template-columns: 38px minmax(0, 1fr);
    min-height: 62px;
    gap: 10px;
    padding: 10px 8px;
    border-radius: 12px;
  }

  .file-list.selecting .file-row {
    grid-template-columns: 28px 38px minmax(0, 1fr);
  }

  .guest-panel .file-row {
    grid-template-columns: 38px minmax(0, 1fr) auto;
  }

  .file-list:not(.selecting) .file-row span:nth-child(n + 3),
  .file-list.selecting .file-row span:nth-child(n + 4) {
    display: none;
  }

  .file-row .file-title {
    gap: 4px;
  }

  .file-row .file-title strong {
    font-size: 15px;
  }

  .public-badge {
    min-height: 18px;
    padding: 0 6px;
    font-size: 10px;
  }

  .file-title small {
    font-size: 11px;
  }

  .file-kind {
    height: 28px;
    border-radius: 9px;
    font-size: 11px;
  }

  .file-icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
  }

  .file-icon span {
    font-size: 10px;
  }

  .folder-icon::before {
    top: -3px;
    left: 5px;
    width: 15px;
    height: 7px;
  }

  .file-check {
    width: 20px;
    height: 20px;
  }

  .guest-download {
    min-height: 34px;
    padding: 0 10px;
    font-size: 12px;
  }

  .preview-modal {
    place-items: stretch;
    padding: 0;
    background: rgba(15, 23, 42, 0.18);
  }

  .preview-card {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    border: 0;
    border-radius: 0;
  }

  .preview-head {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    padding: 10px 12px;
  }

  .preview-head h2 {
    font-size: 16px;
    line-height: 1.25;
  }

  .preview-head .muted {
    max-width: 100%;
    font-size: 11px;
  }

  .preview-head #closePreviewButton {
    min-height: 34px;
    padding: 0 10px;
    font-size: 12px;
  }

  .preview-content {
    padding: 18px 16px 22px;
    font-size: 17px;
    line-height: 1.86;
    -webkit-overflow-scrolling: touch;
  }

  .markdown-body {
    line-height: 1.9;
  }

  .markdown-body p,
  .markdown-body ul,
  .markdown-body blockquote,
  .markdown-body pre {
    margin-bottom: 16px;
  }

  .preview-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.92);
  }

  .preview-actions .ghost,
  .preview-actions .secondary,
  .preview-actions .button-link {
    width: 100%;
    min-height: 46px;
    padding: 0 10px;
    font-size: 15px;
  }

  .preview-actions #copyContentButton,
  .preview-actions .button-link {
    grid-column: 1 / -1;
  }

  .preview-actions #copyContentButton {
    order: -1;
    font-weight: 900;
  }
}
