:root {
  --bg: #efe8db;
  --paper: rgba(255, 252, 245, 0.84);
  --paper-strong: #fffaf0;
  --ink: #16120e;
  --muted: #66584d;
  --line: rgba(33, 24, 15, 0.12);
  --accent: #b74f2d;
  --accent-deep: #7a2d18;
  --gold: #8f6b33;
  --shadow: 0 24px 80px rgba(59, 32, 13, 0.12);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family:
    "Avenir Next",
    "PingFang SC",
    "Hiragino Sans GB",
    "Microsoft YaHei",
    sans-serif;
  background:
    radial-gradient(circle at top left, rgba(183, 79, 45, 0.14), transparent 26%),
    radial-gradient(circle at 85% 8%, rgba(143, 107, 51, 0.12), transparent 22%),
    linear-gradient(180deg, #f6f0e6 0%, #efe7da 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(27, 18, 11, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(27, 18, 11, 0.03) 1px, transparent 1px);
  background-size: 30px 30px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.8), transparent 80%);
}

.page-shell {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  gap: 22px;
  width: min(calc(100% - 32px), 1480px);
  margin: 16px auto 28px;
}

.sidebar,
.masthead,
.featured-card,
.directory-section,
.workflow-board,
.owned-card {
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.sidebar {
  position: sticky;
  top: 16px;
  align-self: start;
  min-height: calc(100vh - 32px);
  padding: 24px 22px;
  border-radius: var(--radius-xl);
  background: rgba(255, 250, 242, 0.8);
}

.sidebar-brand {
  display: grid;
  gap: 18px;
}

.brand-badge,
.eyebrow,
.card-kicker,
.sidebar-kicker {
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand-badge {
  display: inline-flex;
  width: fit-content;
  padding: 8px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, #1e1712, #7c341d);
  color: #fff6ec;
  font-size: 0.72rem;
  font-weight: 800;
}

.sidebar-kicker,
.eyebrow,
.card-kicker {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 800;
}

.sidebar h1,
.masthead h2,
.section-head h2 {
  margin: 0;
  font-family:
    "Iowan Old Style",
    "Palatino Linotype",
    "Noto Serif SC",
    "Songti SC",
    serif;
  line-height: 0.98;
}

.sidebar h1 {
  font-size: clamp(2rem, 3vw, 3rem);
}

.masthead h2 {
  max-width: 13ch;
  font-size: clamp(2.5rem, 5vw, 4.8rem);
}

.section-head h2 {
  font-size: clamp(2rem, 3vw, 3rem);
}

.sidebar-copy,
.section-copy,
.featured-card p,
.tool-card p,
.list-card li,
.workflow-grid p,
.owned-card p,
.masthead-panel span {
  color: var(--muted);
  line-height: 1.72;
}

.sidebar-nav {
  display: grid;
  gap: 10px;
  margin-top: 28px;
}

.sidebar-nav a,
.inline-link,
.tool-card a {
  color: var(--ink);
  text-decoration: none;
}

.sidebar-nav a {
  padding: 12px 14px;
  border: 1px solid rgba(33, 24, 15, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.48);
  font-weight: 700;
  transition:
    transform 150ms ease,
    border-color 150ms ease,
    background 150ms ease;
}

.sidebar-nav a:hover {
  transform: translateX(4px);
  border-color: rgba(183, 79, 45, 0.3);
  background: rgba(255, 248, 240, 0.88);
}

.sidebar-note {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid rgba(33, 24, 15, 0.08);
}

.sidebar-note span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.88rem;
}

.sidebar-note strong {
  font-size: 1.04rem;
}

.content {
  display: grid;
  gap: 18px;
}

.masthead {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 28px 30px;
  border-radius: var(--radius-xl);
  background:
    linear-gradient(135deg, rgba(255, 249, 239, 0.9), rgba(246, 236, 221, 0.78)),
    radial-gradient(circle at right bottom, rgba(183, 79, 45, 0.16), transparent 24%);
}

.masthead-panel {
  min-width: 220px;
  padding: 18px;
  border-radius: var(--radius-lg);
  background: rgba(26, 20, 15, 0.94);
  color: #fff6ec;
}

.masthead-panel strong {
  display: block;
  margin: 10px 0 18px;
  font-size: 1.15rem;
}

.masthead-panel a,
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  border-radius: 999px;
  background: linear-gradient(135deg, #f1ceb2, #fff4e7);
  color: var(--accent-deep);
  font-weight: 800;
  text-decoration: none;
}

.featured-strip,
.directory-grid,
.workflow-grid,
.owned-grid {
  display: grid;
  gap: 16px;
}

.featured-strip {
  grid-template-columns: 1.3fr 1fr 1fr;
}

.featured-card,
.directory-section,
.workflow-board,
.owned-card,
.tool-card,
.list-card,
.workflow-grid article {
  border-radius: var(--radius-lg);
  background: var(--paper);
}

.featured-card {
  padding: 22px;
}

.featured-primary {
  background:
    linear-gradient(135deg, rgba(183, 79, 45, 0.14), rgba(255, 251, 244, 0.92)),
    var(--paper);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.chip-row span {
  padding: 8px 11px;
  border: 1px solid rgba(33, 24, 15, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.6);
  font-size: 0.76rem;
  font-weight: 800;
}

.directory-section,
.workflow-board {
  padding: 24px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  margin-bottom: 20px;
}

.section-copy {
  max-width: 36ch;
}

.directory-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.directory-grid.compact {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.tool-card,
.list-card,
.workflow-grid article,
.owned-card {
  padding: 20px;
  border: 1px solid rgba(33, 24, 15, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.tool-card:hover,
.list-card:hover,
.workflow-grid article:hover,
.owned-card:hover,
.featured-card:hover {
  transform: translateY(-3px);
  border-color: rgba(183, 79, 45, 0.24);
}

.tool-card h3,
.list-card h3,
.featured-card h3,
.workflow-grid h3,
.owned-card h3 {
  margin: 0;
  font-size: 1.18rem;
}

.tool-card a,
.inline-link {
  display: inline-flex;
  margin-top: 12px;
  color: var(--accent-deep);
  font-weight: 800;
  border-bottom: 1px solid rgba(122, 45, 24, 0.28);
}

.list-layout {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.list-card ul {
  margin: 14px 0 0;
  padding-left: 18px;
}

.list-card li + li {
  margin-top: 8px;
}

.workflow-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.workflow-grid article span {
  display: inline-flex;
  margin-bottom: 16px;
  color: var(--accent);
  font-family:
    "Iowan Old Style",
    "Palatino Linotype",
    "Noto Serif SC",
    "Songti SC",
    serif;
  font-size: 2.2rem;
}

.owned-grid {
  grid-template-columns: 1.1fr 1fr 1fr;
}

.owned-card.live {
  background:
    linear-gradient(135deg, rgba(255, 250, 241, 0.96), rgba(245, 232, 214, 0.8)),
    var(--paper);
}

.admin-body {
  min-height: 100vh;
}

.admin-shell {
  display: grid;
  gap: 18px;
  width: min(calc(100% - 24px), 1180px);
  margin: 18px auto 30px;
}

.admin-panel {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: rgba(255, 251, 244, 0.82);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.auth-grid,
.admin-actions,
.admin-header-row,
.editor-stack,
.tool-editor-stack {
  display: grid;
  gap: 14px;
}

.auth-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 18px;
}

.field,
.auth-grid label {
  display: grid;
  gap: 8px;
  font-size: 0.92rem;
  color: var(--muted);
}

.field input,
.auth-grid input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(33, 24, 15, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.76);
  font: inherit;
  color: var(--ink);
}

.admin-actions {
  grid-template-columns: repeat(2, max-content);
  margin-top: 18px;
}

.admin-actions button,
.small-button {
  padding: 12px 16px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #1e1712, #7c341d);
  color: #fff7ed;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.secondary-button {
  background: rgba(33, 24, 15, 0.12);
  color: var(--ink);
}

.editor-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid rgba(33, 24, 15, 0.08);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.58);
}

.editor-header,
.admin-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.tool-editor-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px dashed rgba(33, 24, 15, 0.14);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.48);
}

.status-text {
  margin: 14px 0 0;
  color: var(--accent-deep);
  font-weight: 700;
}

@media (max-width: 1200px) {
  .page-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    min-height: auto;
  }

  .featured-strip,
  .directory-grid,
  .directory-grid.compact,
  .workflow-grid,
  .owned-grid,
  .list-layout,
  .auth-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .page-shell {
    width: min(calc(100% - 18px), 1480px);
    margin-top: 10px;
  }

  .sidebar,
  .masthead,
  .featured-card,
  .directory-section,
  .workflow-board,
  .owned-card {
    padding: 18px;
  }

  .masthead,
  .section-head {
    flex-direction: column;
    align-items: start;
  }

  .featured-strip,
  .directory-grid,
  .directory-grid.compact,
  .workflow-grid,
  .owned-grid,
  .list-layout,
  .auth-grid,
  .admin-actions {
    grid-template-columns: 1fr;
  }

  .admin-header-row,
  .editor-header {
    flex-direction: column;
    align-items: start;
  }
}
