:root {
  color-scheme: light;
  --surface: #fff;
  --page: #fafafa;
  --ink: #1f2027;
  --muted: #60616e;
  --line: #e6e6eb;
  --accent: #4c44ac;
  --selected: #efedff;
  --hover: #f5f5f8;
  --mono: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-family: system-ui, -apple-system, "PingFang SC", "Noto Sans SC", sans-serif;
  color: var(--ink);
  background: var(--page);
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--accent); text-underline-offset: .2em; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.shell { width: min(72rem, calc(100% - 3rem)); margin-inline: auto; }
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-inner, .topbar nav, .brand { display: flex; align-items: center; }
.topbar-inner { min-height: 3.75rem; justify-content: space-between; gap: .75rem; }
.topbar nav { gap: clamp(.8rem, 3vw, 1.75rem); }
.topbar a { color: var(--ink); text-decoration: none; }
.topbar nav a { color: var(--muted); font-size: .875rem; }
.topbar a:hover { color: var(--accent); }
.brand { gap: .55rem; font-weight: 680; white-space: nowrap; }
.brand img { border-radius: .45rem; }
.intro { padding: clamp(1.65rem, 4vw, 3rem) 0 1.3rem; }
h1 { margin: 0 0 .5rem; font-size: clamp(1.75rem, 4vw, 2.55rem); letter-spacing: -.04em; }
.intro p { margin: 0; color: var(--muted); line-height: 1.55; }
.explorer {
  height: max(28rem, calc(100dvh - 14rem));
  margin-bottom: 1.5rem;
  display: grid;
  grid-template-columns: minmax(15rem, 30%) minmax(0, 1fr);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: .8rem;
}
.sidebar { display: flex; flex-direction: column; min-width: 0; min-height: 0; border-right: 1px solid var(--line); }
.sidebar-head { padding: .95rem; border-bottom: 1px solid var(--line); }
.branch { display: flex; align-items: baseline; justify-content: space-between; gap: .3rem; margin-bottom: .65rem; }
.branch strong { overflow-wrap: anywhere; font-size: .95rem; }
.branch span { color: var(--muted); white-space: nowrap; font-size: .875rem; }
#search { width: 100%; min-width: 0; padding: .45rem .62rem; color: var(--ink); border: 1px solid var(--line); border-radius: .4rem; background: var(--page); font-size: .9rem; }
#back { margin: 0 0 .65rem; padding: .2rem .5rem; color: var(--accent); background: var(--surface); border: 1px solid var(--line); border-radius: .35rem; cursor: pointer; }
#back:hover { background: var(--selected); }
.entry-list { flex: 1; overflow: auto; padding: .4rem .5rem 1rem; margin: 0; list-style: none; }
.entry-row { display: flex; gap: .55rem; align-items: center; width: 100%; min-height: 2.35rem; padding: .4rem .55rem; text-align: left; color: var(--ink); border: 0; background: transparent; border-radius: .37rem; cursor: pointer; touch-action: manipulation; user-select: none; font: .875rem/1.35 var(--mono); overflow-wrap: anywhere; }
.entry-row:hover { background: var(--hover); }
.entry-row[aria-current="true"] { background: var(--selected); color: var(--accent); font-weight: 650; }
.entry-row svg, .entry-title svg { width: 1.1rem; height: 1.1rem; flex: none; stroke: currentColor; stroke-linejoin: round; stroke-linecap: round; stroke-width: 1.3; fill: none; }
.entry-row[data-directory="true"] svg { fill: #e6e2ff; stroke: var(--accent); }
.entry-list .empty { padding: .75rem; color: var(--muted); }
.entry-detail { min-width: 0; overflow: auto; padding: clamp(1.2rem, 3.5vw, 2.7rem); }
.entry-path { margin: 0 0 .65rem; color: var(--muted); font: .875rem/1.4 var(--mono); overflow-wrap: anywhere; }
.entry-title { display: flex; align-items: baseline; gap: .55rem; font: 650 clamp(1.35rem, 4vw, 2.2rem)/1.2 var(--mono); letter-spacing: -.045em; margin: 0 0 1rem; overflow-wrap: anywhere; }
.entry-title svg { align-self: center; color: var(--accent); width: 1.4rem; height: 1.4rem; }
.source-link { font-size: .875rem; }
.detail-section { margin-top: 1.45rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.detail-section h3 { margin: 0 0 .55rem; font-size: 1rem; }
.detail-section p { margin: 0; line-height: 1.75; max-width: 50rem; }
.priority { display: inline-block; margin-right: .6rem; padding: .07rem .44rem; border-radius: .28rem; color: var(--accent); background: var(--selected); font-size: .875rem; font-weight: 650; }
.structure { margin-top: .65rem; color: var(--muted); }
.structure summary { width: fit-content; cursor: pointer; font-size: .9rem; }
.structure ul { display: grid; gap: .3rem .9rem; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); margin: .75rem 0 0; padding: 0; list-style: none; }
.structure a { overflow-wrap: anywhere; font: .875rem/1.4 var(--mono); }
@media (max-width: 680px) {
  .shell { width: min(100% - 1.35rem, 72rem); }
  .explorer { display: flex; flex-direction: column; height: auto; min-height: 70dvh; }
  .sidebar { max-height: min(24rem, 44dvh); border-right: 0; border-bottom: 1px solid var(--line); }
  .entry-detail { min-height: 12rem; }
  .intro { padding-top: 1.25rem; }
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --surface: #1a1b21;
    --page: #14151a;
    --ink: #efeff5;
    --muted: #b6b6c4;
    --line: #353641;
    --accent: #c0b9ff;
    --selected: #302b4e;
    --hover: #262731;
  }
  .entry-row[data-directory="true"] svg { fill: #383159; }
}
