/* Desktop workspace (≥ 960px): sidebar tree + pages. The phone layout in
 * app.css stays the App replica. */

.app.is-workspace {
  min-height: 100dvh;
}

.ws {
  --side: 272px;
  display: grid;
  grid-template-columns: var(--side) 0 minmax(0, 1fr);
  min-height: 100dvh;
  transition: grid-template-columns 240ms var(--ease);
}

.ws.is-resizing {
  transition: none;
  cursor: col-resize;
  user-select: none;
}

.ws.is-collapsed {
  grid-template-columns: 0 0 minmax(0, 1fr);
}

.ws-mini {
  width: 30px;
  height: 30px;
  border-radius: var(--r-2);
  color: var(--muted);
}

.ws-mini:hover {
  background: var(--hover);
  color: var(--ink);
}

/* ------------------------------------------------------------ sidebar */

.ws-side {
  position: sticky;
  top: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--side-bg);
  border-right: 1px solid var(--line);
  min-width: 0;
}

.ws.is-collapsed .ws-side {
  border-right: 0;
}

.ws-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  padding: 0 10px 0 18px;
  flex: none;
}

.ws-wordmark {
  font-family: var(--script);
  font-size: 28px;
  line-height: 1;
  color: var(--accent);
  white-space: nowrap;
  transform: translateY(2px);
}

.ws-side-toggle {
  opacity: 0;
  transition: opacity 140ms;
}

.ws-side:hover .ws-side-toggle,
.ws-side-toggle:focus-visible {
  opacity: 1;
}

.ws-find {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  margin: 4px 12px 10px;
  padding: 0 10px;
  border-radius: var(--r-2);
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--muted);
  font-size: 13px;
  flex: none;
}

.ws-find {
  justify-content: flex-start;
}

.ws-find > span:not(.ico) {
  flex: 1;
  text-align: left;
}

.ws-find kbd,
.ws-side kbd {
  font-family: var(--sans);
  font-size: 11px;
  color: var(--faint);
}

.ws-find:hover {
  box-shadow: inset 0 0 0 1px var(--accent);
}

.ws-links {
  display: flex;
  flex-direction: column;
  padding: 0 8px;
  flex: none;
}

.ws-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 32px;
  padding: 0 10px;
  border-radius: var(--r-2);
  color: var(--ink);
  font-size: 14px;
}

.ws-link .ico {
  color: var(--muted);
}

.ws-link small {
  margin-left: auto;
  color: var(--faint);
  font-size: 12px;
}

.ws-link:hover {
  background: var(--hover);
}

.ws-link.is-on {
  background: var(--accent-14);
  color: var(--ink);
  font-weight: 700;
}

.ws-link.is-on .ico {
  color: var(--accent);
}

.ws-dot {
  width: 7px;
  height: 7px;
  margin-left: auto;
  border-radius: 50%;
  background: var(--accent);
}

.ws-tree-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 18px 8px 4px;
  padding: 2px 4px 2px 10px;
  border-radius: var(--r-2);
  flex: none;
}

.ws-tree-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.ws-tree-title:hover {
  color: var(--accent);
}

.ws-tree {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 8px 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.tree-row {
  position: relative;
  display: flex;
  align-items: center;
  height: 30px;
  padding-left: calc(var(--depth) * 16px);
  border-radius: var(--r-2);
}

.tree-row:hover {
  background: var(--hover);
}

.tree-row.is-on {
  background: var(--accent-14);
}

.tree-row.is-on .tree-label {
  font-weight: 700;
  color: var(--ink);
}

.tree-twist {
  flex: none;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  color: var(--faint);
  transition: transform 160ms var(--ease);
}

.tree-twist:hover {
  background: var(--hover);
  color: var(--ink);
}

.tree-twist.is-open {
  transform: rotate(90deg);
}

.tree-twist.is-empty {
  visibility: hidden;
}

.tree-label {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  height: 100%;
  padding-right: 4px;
  font-size: 14px;
  color: var(--ink);
}

.tree-label .ico {
  color: var(--muted);
}

.tree-row.is-folder .tree-label .ico {
  color: var(--accent);
}

.tree-label span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-tools {
  display: none;
  align-items: center;
  padding-right: 2px;
}

.tree-tools .ws-mini {
  width: 24px;
  height: 24px;
}

.tree-row:hover .tree-tools,
.tree-row:focus-within .tree-tools {
  display: flex;
}

.tree-row.is-dragging {
  opacity: 0.4;
}

.is-drop-target {
  box-shadow: inset 0 0 0 1.5px var(--accent);
  background: var(--accent-08);
}

.ws-foot {
  flex: none;
  display: flex;
  flex-direction: column;
  padding: 8px;
  border-top: 1px solid var(--line);
}

.ws-foot-row {
  display: flex;
  gap: 4px;
  padding: 4px 6px 0;
}

.ws-resize {
  position: relative;
  z-index: 5;
  cursor: col-resize;
}

.ws-resize::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: -3px;
  width: 6px;
}

.ws-resize:hover::after {
  background: var(--accent-22);
}

.ws.is-collapsed .ws-resize {
  display: none;
}

/* ------------------------------------------------------------ top bar */

.ws-main {
  min-width: 0;
}

.ws-top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 4px;
  height: 52px;
  padding: 0 16px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.ws-opener {
  display: none;
}

.ws.is-collapsed .ws-opener {
  display: inline-grid;
}

.ws-crumbs {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 6px;
  font-size: 13px;
  color: var(--muted);
  overflow: hidden;
  white-space: nowrap;
}

.ws-crumb {
  padding: 3px 6px;
  border-radius: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
}

a.ws-crumb:hover {
  background: var(--hover);
  color: var(--ink);
}

.ws-crumb.is-current {
  color: var(--ink);
  font-weight: 600;
}

.ws-crumb-sep {
  color: var(--faint);
}

.ws-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ws-status {
  font-size: 12px;
  color: var(--muted);
  margin-right: 6px;
}

.ws-status .ed-status {
  font-size: 12px;
}

.ws-seg {
  display: inline-flex;
  padding: 2px;
  border-radius: 7px;
  background: var(--hover);
}

.ws-seg-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 10px;
  border-radius: 5px;
  font-size: 13px;
  color: var(--muted);
}

.ws-seg.is-icons .ws-seg-item {
  padding: 0 8px;
}

.ws-seg-item.is-on {
  background: var(--bg);
  color: var(--accent);
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 0 0 1px var(--line);
}

.ws-page {
  outline: none;
  padding-bottom: 96px;
}

.ws-empty {
  min-height: 60vh;
  display: grid;
  place-content: center;
  justify-items: center;
}

.ws-spacer {
  flex: 1;
}

/* ------------------------------------------------------------ banner */

.banner {
  position: relative;
  height: 230px;
  margin-top: -52px;
  background: var(--banner-bg);
  overflow: hidden;
}

.banner::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--line);
}

.banner.is-short {
  height: 180px;
}

.banner.is-none {
  height: 96px;
  background: transparent;
}

.banner.is-none::after {
  display: none;
}

.banner-gap {
  height: 32px;
}

.banner-art {
  position: absolute;
  inset: 52px 0 0 30%;
  background-repeat: no-repeat;
  background-size: auto 230%;
  opacity: 0.92;
  mask-image: linear-gradient(90deg, transparent 0%, #000 38%);
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 38%);
}

:root[data-theme='night'] .banner-photo.is-painting,
:root[data-theme='night'] .card-thumb.is-painting img,
:root[data-theme='night'] .banner-option-art.is-painting {
  filter: brightness(0.62) saturate(0.85);
}

:root[data-theme='night'] .banner-art,
:root[data-theme='night'] .card-art,
:root[data-theme='night'] .banner-option-art {
  opacity: 0.55;
  filter: invert(1) hue-rotate(180deg) saturate(0.7);
}

.banner-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.banner-change {
  position: absolute;
  right: 20px;
  bottom: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border-radius: var(--r-2);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  box-shadow: 0 0 0 1px var(--line);
  color: var(--muted);
  font-size: 12px;
  opacity: 0;
  transition: opacity 160ms;
}

.banner:hover .banner-change,
.banner-change:focus-visible,
.banner.is-none .banner-change {
  opacity: 1;
}

.banner.is-none .banner-change {
  left: max(24px, calc(50% - 520px));
  right: auto;
  bottom: 10px;
  opacity: 0;
}

.wiki:hover .banner.is-none .banner-change {
  opacity: 1;
}

.banner-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.banner-option {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px;
  border-radius: var(--r-2);
  font-size: 12px;
  color: var(--muted);
}

.banner-option:hover {
  background: var(--hover);
}

.banner-option.is-on {
  box-shadow: inset 0 0 0 1.5px var(--accent);
  color: var(--accent);
}

.banner-option-art {
  height: 64px;
  background-repeat: no-repeat;
  border-radius: 4px;
  background-color: var(--banner-bg);
  background-size: cover;
  background-position: center;
}

/* ------------------------------------------------------------ wiki entry */

.wiki-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-content: center;
  gap: 56px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 48px;
}

@media (min-width: 1360px) {
  .wiki-layout {
    grid-template-columns: minmax(0, 820px) 200px;
  }
}

.wiki-rail {
  display: none;
}

@media (min-width: 1360px) {
  .wiki-rail {
    display: block;
    position: sticky;
    top: 84px;
    align-self: start;
    padding-top: 44px;
  }
}

.wiki-main {
  min-width: 0;
  max-width: 820px;
  width: 100%;
  margin: 0 auto;
}

.wiki-article {
  padding-top: 48px;
}

.wiki-title {
  font-size: 38px;
  line-height: 1.15;
  font-weight: 900;
  letter-spacing: 0.01em;
  color: var(--ink);
  word-break: break-word;
}

.wiki-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 0;
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
}

.wiki-meta > * + *::before {
  content: '·';
  margin: 0 8px;
  color: var(--faint);
}

.wiki-meta span:first-child {
  font-weight: 800;
  color: var(--ink);
}

.wiki-meta a:hover {
  color: var(--accent);
}

.wiki-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}

.wiki-tag {
  padding: 2px 9px;
  border-radius: 4px;
  background: var(--accent-08);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

a.wiki-tag:hover {
  background: var(--accent-14);
}

.wiki-body {
  margin-top: 28px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}

.wiki-body::after {
  content: '';
  display: block;
  clear: both;
}

.wiki-content {
  font-size: 16px;
  line-height: 1.85;
}

.wiki-content > p:first-child {
  font-size: 17px;
  line-height: 1.9;
}

.wiki-content h2 {
  margin-top: 1.8em;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  font-size: 22px;
}

.wiki-content h1 {
  font-size: 26px;
}

.wiki-content h3 {
  font-size: 18px;
}

.wiki-content h2,
.wiki-content h3 {
  scroll-margin-top: 72px;
}

.wiki-empty {
  color: var(--muted);
  font-size: 15px;
}

/* the encyclopedia infobox: 配图 on top, then the facts */
.infobox {
  float: right;
  width: 300px;
  margin: 2px 0 24px 36px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-2);
  background: var(--card-bg);
  overflow: hidden;
  font-size: 14px;
}

.infobox-figure {
  margin: 0;
  background: var(--banner-bg);
}

.infobox-figure img {
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  object-position: center 30%;
}

.infobox-figure figcaption {
  padding: 8px 14px 0;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

.infobox-title {
  margin: 12px 14px 4px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  text-align: center;
  font-size: 16px;
  font-weight: 900;
}

.infobox-facts {
  display: grid;
  grid-template-columns: auto 1fr;
  margin: 0;
  padding: 6px 14px 14px;
}

.infobox-facts dt,
.infobox-facts dd {
  margin: 0;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  line-height: 1.55;
}

.infobox-facts dt {
  padding-right: 14px;
  font-weight: 800;
  color: var(--muted);
  white-space: nowrap;
}

.infobox-facts dd a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.infobox-facts dt:nth-last-child(2),
.infobox-facts dd:last-child {
  border-bottom: 0;
}

.wiki-note {
  margin-top: 20px;
  color: var(--muted);
  font-size: 13px;
}

.wiki-side-head {
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.wiki-toc ol {
  list-style: none;
  margin: 0;
  padding: 0 0 0 12px;
  border-left: 1px solid var(--line);
}

.wiki-toc li {
  margin-bottom: 8px;
}

.wiki-toc li.is-l3 {
  padding-left: 12px;
}

.wiki-toc a {
  display: block;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

.wiki-toc a:hover,
.wiki-toc a.is-on {
  color: var(--accent);
}

.wiki-foot {
  clear: both;
  margin-top: 56px;
}

.wiki-backlinks {
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.wiki-backlink-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}

.wiki-backlink {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border-radius: var(--r-2);
  box-shadow: inset 0 0 0 1px var(--line);
}

.wiki-backlink:hover {
  box-shadow: inset 0 0 0 1px var(--accent);
}

.wiki-backlink-title {
  font-weight: 800;
}

.wiki-backlink-text {
  font-size: 12px;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.wiki-pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 28px;
}

.wiki-pager-link {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 16px;
  border-radius: var(--r-2);
  box-shadow: inset 0 0 0 1px var(--line);
}

.wiki-pager-link small {
  font-size: 12px;
  color: var(--muted);
}

.wiki-pager-link span {
  font-weight: 800;
}

.wiki-pager-link.is-next {
  text-align: right;
}

.wiki-pager-link:hover {
  box-shadow: inset 0 0 0 1px var(--accent);
}

/* ------------------------------------------------------------ editing */

.ws-edit {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 56px;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 48px;
}

@media (min-width: 1280px) {
  .ws-edit {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

.ws-write {
  min-width: 0;
  padding-top: 36px;
}

.ws-title-input.line-input {
  height: auto;
  padding: 0;
  border: 0;
  font-size: 38px;
  line-height: 1.2;
  font-weight: 900;
  box-shadow: none;
}

.ws-tags-input.line-input {
  height: 36px;
  margin-top: 8px;
  padding: 0;
  border: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  box-shadow: none;
}

.ws-tags-input::placeholder {
  color: var(--muted);
  font-weight: 400;
}

.ws-figure-slot {
  margin-top: 10px;
}

.ws-figure {
  position: relative;
  display: inline-block;
  max-width: 300px;
  border-radius: var(--r-2);
  overflow: hidden;
  box-shadow: 0 0 0 1px var(--line);
}

.ws-figure img {
  max-height: 180px;
  object-fit: cover;
}

.ws-figure-tools {
  position: absolute;
  left: 8px;
  bottom: 8px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 140ms;
}

.ws-figure-tools .text-btn {
  min-height: 28px;
  padding: 0 10px;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  font-size: 12px;
}

.ws-figure:hover .ws-figure-tools {
  opacity: 1;
}

.ws-figure-add {
  margin-left: -8px;
}

.ws-toolbar {
  position: sticky;
  top: 52px;
  z-index: 4;
  margin: 18px -8px 8px;
  padding: 4px 4px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.ws-toolbar .ed-tools {
  margin: 0;
}

.ws-area.ed-area {
  min-height: 60vh;
  height: auto;
  padding: 12px 0 40px;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 16px;
  line-height: 1.85;
  box-shadow: none;
  overflow: hidden;
}

.ws-area.ed-area:focus {
  box-shadow: none;
}

.ws-preview {
  display: none;
}

@media (min-width: 1280px) {
  .ws-preview {
    display: block;
    position: sticky;
    top: 68px;
    align-self: start;
    max-height: calc(100dvh - 84px);
    overflow: auto;
    margin-top: 48px;
    padding: 0 0 40px 40px;
    border-left: 1px solid var(--line);
    scrollbar-width: thin;
  }
}

.wiki-article.is-compact {
  padding-top: 40px;
}

.wiki-article.is-compact .wiki-title {
  font-size: 30px;
}

.wiki-article.is-compact .infobox {
  width: 240px;
  margin-left: 24px;
}

/* ------------------------------------------------------------ folder page */

.ws-folder-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 48px;
}

.ws-folder-head {
  padding-top: 32px;
}

.ws-folder-title {
  font-size: 36px;
  font-weight: 900;
  line-height: 1.2;
}

.ws-folder-meta {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.ws-folder-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 22px -8px 0;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.ws-section {
  margin-top: 34px;
}

.ws-section-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.ws-section-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
}

.ws-section-row .ws-section-title {
  margin-bottom: 0;
}

.ws-discovery .discovery-head {
  display: none;
}

.ws-section-title small {
  font-size: 12px;
  font-weight: 400;
  color: var(--faint);
}

.ws-sleeves {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 28px 28px;
  align-items: start;
}

.ws-sleeves .sleeve-face {
  padding-top: 52px;
}

.ws-sleeves .sleeve-foot {
  margin-top: 22px;
  padding-bottom: 40px;
}

/* entry gallery cards */
.ws-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
  gap: 18px;
}

.ws-cards.is-row {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

.card {
  position: relative;
  border-radius: var(--r-2);
  background: var(--card-bg);
  box-shadow: 0 0 0 1px var(--line);
  overflow: hidden;
  transition: box-shadow 160ms var(--ease), transform 160ms var(--ease);
}

.card:hover {
  box-shadow: 0 0 0 1px var(--line-strong), 0 12px 28px -18px rgba(87, 68, 57, 0.5);
  transform: translateY(-2px);
}

.card-main {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.card-thumb {
  position: relative;
  display: block;
  height: 116px;
  background: var(--banner-bg);
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}

.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-art {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-repeat: no-repeat;
  opacity: 0.85;
}


.card-text {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px 14px;
  flex: 1;
}

.card-path {
  font-size: 11px;
  color: var(--faint);
}

.card-title {
  font-size: 16px;
  font-weight: 800;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-excerpt {
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: calc(13px * 1.6 * 2);
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  padding-top: 4px;
  font-size: 11px;
  color: var(--faint);
}

.card-meta time {
  margin-left: auto;
}

.card-tag {
  padding: 1px 7px;
  border-radius: 3px;
  background: var(--accent-08);
  color: var(--accent);
  font-weight: 700;
}

.card-more {
  position: absolute;
  top: 8px;
  right: 8px;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  opacity: 0;
  transition: opacity 140ms;
}

.card:hover .card-more,
.card-more:focus-visible {
  opacity: 1;
}

/* list view */
.ws-table {
  display: flex;
  flex-direction: column;
}

.ws-table-head,
.ws-table-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 200px 120px 36px;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 0 8px;
  border-bottom: 1px solid var(--line);
}

.ws-table-head {
  min-height: 34px;
  font-size: 12px;
  color: var(--faint);
}

.ws-table-row:hover {
  background: var(--hover);
}

.ws-table-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  min-width: 0;
}

.ws-table-title .ico {
  color: var(--muted);
}

.ws-table-title span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ws-table-tags,
.ws-table-date {
  font-size: 13px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ------------------------------------------------------------ home / search */

.ws-home {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 48px;
}

.ws-home-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 11vh 0 26px;
}

.ws-home-mark {
  font-size: 64px;
}

.ws-search.search-field {
  width: min(620px, 100%);
  margin: 30px 0 0;
}

.ws-search .search-input {
  height: 56px;
  font-size: 16px;
}

.ws-home.has-query .ws-home-hero {
  flex-direction: row;
  align-items: center;
  gap: 28px;
  padding: 24px 0 8px;
  border-bottom: 1px solid var(--line);
}

.ws-home.has-query .ws-home-mark {
  font-size: 34px;
}

.ws-home.has-query .ws-search.search-field {
  margin: 0;
  border-bottom: 0;
  box-shadow: none;
}

.ws-home-body {
  padding-top: 8px;
}

.ws-discovery .tpl-stage {
  height: 260px;
}

.ws-starts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.ws-start,
.ws-start-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 0 16px;
  border-radius: var(--r-2);
  text-align: left;
  color: var(--ink);
}

.ws-start {
  box-shadow: inset 0 0 0 1px var(--line);
}

.ws-start .ico {
  color: var(--accent);
}

.ws-start:hover {
  box-shadow: inset 0 0 0 1px var(--accent);
  background: var(--accent-08);
}

.ws-start.is-saved {
  padding: 0 8px 0 0;
}

.ws-start-main {
  flex: 1;
  min-width: 0;
}

.ws-start-title {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* results, read like a search engine */
.ws-result-count {
  margin: 18px 0 10px;
  font-size: 13px;
  color: var(--muted);
}

.ws-result-folders {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.ws-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: 13px;
}

.ws-chip .ico {
  color: var(--accent);
}

.ws-chip:hover {
  box-shadow: inset 0 0 0 1px var(--accent);
}

.ws-chip mark,
.ws-result mark {
  background: transparent;
  color: inherit;
  font-weight: 800;
}

.ws-results {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 760px;
}

.ws-result {
  display: flex;
  gap: 24px;
  padding: 18px 0;
}

.ws-result + .ws-result {
  border-top: 1px solid var(--line);
}

.ws-result-text {
  flex: 1;
  min-width: 0;
}

.ws-result-path {
  font-size: 12px;
  color: var(--muted);
}

.ws-result-title {
  display: inline-block;
  margin-top: 4px;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--link);
}

.ws-result-title:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.ws-result-title mark {
  color: inherit;
}

.ws-result-snippet {
  margin-top: 6px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--muted);
}

.ws-result-snippet mark {
  color: var(--ink);
}

.ws-result-tags {
  display: flex;
  gap: 10px;
  margin-top: 6px;
  font-size: 12px;
}

.ws-result-tags a {
  color: var(--accent);
}

.ws-result-thumb {
  flex: none;
  width: 104px;
  height: 104px;
  border-radius: var(--r-2);
  overflow: hidden;
  box-shadow: 0 0 0 1px var(--line);
}

.ws-result-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ws-noresult {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

/* reused phone pages inside the workspace */
.is-workspace .ws-page > .page {
  padding-top: 32px;
}

.is-workspace .templates {
  max-width: 1040px;
}

@media (max-width: 1180px) {
  .wiki-layout,
  .ws-edit,
  .ws-folder-inner,
  .ws-home {
    padding: 0 32px;
  }
  .infobox {
    width: 260px;
    margin-left: 24px;
  }
}

.ws-title-btn {
  font: inherit;
  color: inherit;
  text-align: left;
  border-radius: var(--r-2);
  padding: 0 6px;
  margin-left: -6px;
}

.ws-title-btn:hover {
  background: var(--hover);
}

/* quiet Markdown colouring behind the textarea */
.ed-hl-wrap {
  position: relative;
}

.ed-hl-mirror,
.ed-hl-wrap .ws-area {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.85;
  letter-spacing: 0;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: normal;
  tab-size: 4;
}

.ed-hl-mirror {
  position: absolute;
  inset: 0;
  padding: 12px 0 40px;
  color: var(--ink);
  pointer-events: none;
}

.ed-hl-wrap .ws-area.is-highlighted {
  position: relative;
  color: transparent;
  caret-color: var(--ink);
  background: transparent;
}

.ed-hl-wrap .ws-area.is-highlighted::selection {
  background: var(--accent-22);
  color: transparent;
}

.hl-mark {
  color: var(--faint);
}

.hl-h {
  color: var(--ink);
  font-weight: 400;
  text-decoration: underline;
  text-decoration-color: var(--accent-22);
  text-decoration-thickness: 6px;
  text-underline-offset: -2px;
  text-decoration-skip-ink: none;
}

.hl-key {
  color: var(--accent);
}

.hl-link {
  color: var(--link);
}

.hl-em {
  color: var(--ink);
}

.hl-img {
  color: var(--faint);
}

/* ------------------------------------------------------------ motion */

@media (prefers-reduced-motion: no-preference) {
  .ws-page {
    view-transition-name: ws-page;
  }
  .ws-side {
    view-transition-name: ws-side;
  }
  .ws-top {
    view-transition-name: ws-top;
  }
  ::view-transition-group(root) {
    animation-duration: 280ms;
  }
  ::view-transition-old(ws-page) {
    animation: vt-lift 200ms cubic-bezier(0.4, 0, 1, 1) both;
  }
  ::view-transition-new(ws-page) {
    animation: vt-settle 420ms cubic-bezier(0.16, 1, 0.3, 1) 40ms both;
  }
  ::view-transition-old(ws-side),
  ::view-transition-new(ws-side),
  ::view-transition-old(ws-top),
  ::view-transition-new(ws-top) {
    animation-duration: 220ms;
  }
  ::view-transition-group(hero) {
    animation-duration: 480ms;
    animation-timing-function: cubic-bezier(0.2, 0.85, 0.25, 1);
    z-index: 5;
  }
  ::view-transition-old(hero),
  ::view-transition-new(hero) {
    animation-duration: 480ms;
    height: 100%;
    object-fit: cover;
    overflow: clip;
  }

  .is-arriving .card,
  .is-arriving .ws-sleeves .sleeve,
  .is-arriving .ws-result,
  .is-arriving .ws-start,
  .is-arriving .wiki-backlink,
  .is-arriving .tpl-card.is-full,
  .is-arriving .person {
    animation: vt-rise 520ms cubic-bezier(0.16, 1, 0.3, 1) both;
    animation-delay: calc(var(--n, 0) * 34ms + 80ms);
  }

  .tree-row.is-new {
    animation: tree-in 260ms cubic-bezier(0.16, 1, 0.3, 1) both;
    animation-delay: calc(var(--k, 0) * 22ms);
  }

  .tree-label .ico,
  .tree-twist {
    transition: transform 200ms var(--ease), color 140ms;
  }

  .ws-seg-item {
    transition: background-color 180ms var(--ease), color 180ms, box-shadow 180ms;
  }

  .ws-link,
  .tree-row {
    transition: background-color 140ms;
  }
}

@keyframes vt-lift {
  to {
    opacity: 0;
    transform: translateY(-8px);
  }
}

@keyframes vt-settle {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
}

@keyframes vt-rise {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }
}

@keyframes tree-in {
  from {
    opacity: 0;
    transform: translateX(-6px);
  }
}

.tree-rename {
  flex: 1;
  min-width: 0;
  height: 24px;
  padding: 0 6px;
  border: 0;
  border-radius: 4px;
  background: var(--bg);
  box-shadow: 0 0 0 1.5px var(--accent);
  font-size: 14px;
  outline: none;
}

/* link preview */
.peek {
  position: fixed;
  z-index: 70;
  display: flex;
  width: 340px;
  border-radius: var(--r-2);
  background: var(--dialog);
  box-shadow: 0 18px 44px -16px rgba(40, 30, 26, 0.45), 0 0 0 1px var(--line);
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 160ms var(--ease), transform 200ms var(--ease);
}

.peek.is-open {
  opacity: 1;
  transform: none;
}

.peek-img {
  flex: none;
  width: 96px;
  background: var(--banner-bg);
}

.peek-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.peek-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  min-width: 0;
}

.peek-path {
  font-size: 11px;
  color: var(--faint);
}

.peek-title {
  font-size: 15px;
  font-weight: 800;
}

.peek-body {
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card.is-dragging {
  opacity: 0.45;
  transform: scale(0.98);
}

/* 星空 takes the whole window */
#app[data-route='universe'] .ws-side,
#app[data-route='universe'] .ws-top,
#app[data-route='universe'] .ws-resize {
  visibility: hidden;
}

.ws-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--line);
  transition: background var(--t), box-shadow var(--t);
}

.ws-pill:hover {
  background: var(--accent-08);
  box-shadow: inset 0 0 0 1px var(--accent);
}
