:root {
  color-scheme: light;
  --background: #e9e3d8;
  --paper: #f7f3eb;
  --text: #202a31;
  --muted: #778087;
  --rule: #c8c0b2;
  --ink: #254b60;
  --ink-soft: #dbe4e4;
  --rust: #a55f43;
  --focus: #254b60;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --background: #161b1f;
  --paper: #20282d;
  --text: #efe9df;
  --muted: #a5acae;
  --rule: #455158;
  --ink: #b8d0d4;
  --ink-soft: #304047;
  --rust: #d38a68;
  --focus: #e9d5bd;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --background: #161b1f;
    --paper: #20282d;
    --text: #efe9df;
    --muted: #a5acae;
    --rule: #455158;
    --ink: #b8d0d4;
    --ink-soft: #304047;
    --rust: #d38a68;
    --focus: #e9d5bd;
  }
}

* {
  box-sizing: border-box;
}
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family:
    "Iowan Old Style", "Palatino Linotype", "Book Antiqua", "Noto Serif SC",
    "Songti SC", serif;
  transition:
    background 180ms ease,
    color 180ms ease;
}
button,
input {
  font: inherit;
  color: inherit;
}

.app-shell {
  width: min(1240px, calc(100% - 48px));
  margin: 0 auto;
  padding: 42px 0 58px;
}
.topbar {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 24px;
  align-items: center;
  padding-bottom: 24px;
}
.brand,
.toolbar,
.top-nav,
.search-box,
.card-content {
  display: flex;
  align-items: center;
}
.brand {
  justify-content: center;
}
.brand-mark {
  display: block;
  width: 44px;
  height: 44px;
  padding: 4px;
  border: 1px solid var(--ink);
  border-radius: 50%;
  background: var(--paper);
  object-fit: contain;
}
.toolbar {
  min-width: 0;
  justify-content: flex-end;
  gap: 12px;
}
.search-box {
  min-width: 210px;
  flex: 1;
  gap: 12px;
  padding: 0 16px;
  border-bottom: 1px solid var(--ink);
  transition: box-shadow 180ms ease;
}
.search-box:focus-within {
  box-shadow: 0 4px 0 color-mix(in srgb, var(--ink) 22%, transparent);
}
.search-icon {
  position: relative;
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  margin-right: 10px;
  border: 1px solid var(--ink);
  border-radius: 50%;
}
.search-icon::after {
  position: absolute;
  right: -5px;
  bottom: -3px;
  width: 6px;
  height: 1px;
  background: var(--ink);
  content: "";
  transform: rotate(45deg);
}
.search-box input {
  width: 100%;
  min-width: 0;
  padding: 12px 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 0.98rem;
}
.search-box input::placeholder {
  color: var(--muted);
}
.clear-search {
  padding: 0 2px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.1rem;
}
.top-nav {
  gap: 4px;
  min-width: 0;
  overflow-x: auto;
}
.top-link {
  display: inline-flex;
  align-items: center;
  padding: 8px 10px;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.82rem;
  white-space: nowrap;
  transition:
    background 160ms ease,
    color 160ms ease;
}
.top-link:hover {
  background: var(--ink-soft);
  color: var(--text);
}
.top-link::after {
  content: "↗";
  margin-left: 6px;
  color: var(--rust);
  font-size: 0.72rem;
}
.content {
  padding-top: 30px;
}
.section {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 30px;
  padding: 18px 0;
}
.section:first-child {
  padding-top: 0;
}
.section:not(:last-child)::after {
  grid-column: 2;
  height: 1px;
  background: var(--rule);
  content: "";
}
.section-heading {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.section-icon {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  color: var(--rust);
}
.section-icon svg {
  width: 21px;
  height: 21px;
  stroke-width: 1.6;
}
.section-icon svg,
.item-icon svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.section-heading h2 {
  margin-top: 2px;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.section-count {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.76rem;
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  column-gap: 28px;
  row-gap: 16px;
}
.link-card {
  display: flex;
  min-width: 0;
  min-height: 30px;
  align-items: center;
  gap: 12px;
  padding: 4px 0;
  color: var(--text);
  text-decoration: none;
  transition:
    color 160ms ease,
    padding 160ms ease;
}
.link-card:hover {
  padding-left: 8px;
  color: var(--ink);
}
.item-icon {
  display: grid;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  place-items: center;
  overflow: hidden;
  color: var(--rust);
  font-size: 0.66rem;
  font-weight: 700;
}
.item-icon img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}
.item-icon svg {
  width: 17px;
  height: 17px;
  stroke-width: 1.7;
}
.card-content {
  min-width: 0;
  justify-content: space-between;
  gap: 8px;
  flex: 1;
}
.item-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.93rem;
  line-height: 1.4;
}
.item-arrow {
  color: var(--rust);
  font-size: 0.78rem;
  opacity: 0;
  transition: opacity 160ms ease;
}
.link-card:hover .item-arrow {
  opacity: 1;
}
.empty-state {
  padding: 54px 0;
  color: var(--muted);
  text-align: center;
}
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 4px;
}

@media (max-width: 980px) {
  .section {
    grid-template-columns: 170px minmax(0, 1fr);
    gap: 24px;
  }
  .card-grid {
    grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  }
}
@media (max-width: 740px) {
  .app-shell {
    width: min(100% - 26px, 620px);
    padding-top: 26px;
  }
  .topbar {
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 16px;
  }
  .toolbar {
    flex-wrap: wrap;
  }
  .search-box {
    flex-basis: 100%;
  }
  .top-nav {
    flex: 1;
  }
  .section {
    display: block;
  }
  .section-heading {
    margin-bottom: 16px;
  }
  .card-grid {
    grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
    row-gap: 16px;
  }
}
@media (max-width: 430px) {
  .top-nav {
    width: 100%;
    flex-basis: 100%;
  }
  .top-link {
    flex: 1;
    justify-content: center;
    padding-inline: 7px;
  }
  .card-grid {
    grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
