/* Reference AIHOW look: directory + detail components (ported verbatim from the reference site). */

      :root { --sans: "GT Standard", "GT Standard L", "Geist", -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Noto Sans CJK SC", "Source Han Sans SC", "Microsoft YaHei", sans-serif; }
      .x-mono-font { font-family: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Noto Sans CJK SC", "Microsoft YaHei"; }
      html[lang^="zh"] .x-head h1 { letter-spacing: 0; }
      html[lang^="zh"] .x-tagline, html[lang^="zh"] .x-sum, html[lang^="zh"] .y-prose { line-break: strict; }

      /* Language switch (same x-seg component as the toolbar) */
      .x-topbar { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin-bottom: -6px; }
      .x-lang { flex: none; }
      .x-seg a {
        display: inline-flex; align-items: center; justify-content: center; min-height: 38px; padding: 6px 14px; border-radius: var(--r-pill);
        background: transparent; color: var(--text-secondary); font: var(--type-label); text-decoration: none; white-space: nowrap;
      }
      .x-seg a:hover { color: var(--text-primary); }
      .x-seg a[aria-pressed="true"] { background: var(--fill-primary-on); color: var(--text-primary); box-shadow: 0 1px 3px var(--stroke-primary); }
      .x-lang button, .x-lang a { min-height: 32px; padding: 4px 12px; }

      /* Header */
      .x-head { display: grid; gap: 10px; padding: 28px 0 8px; }
      .x-head h1 { font: var(--type-display); letter-spacing: -0.01em; }
      .x-tagline { font: var(--type-lede); color: var(--text-secondary); font-weight: var(--weight-regular); max-width: 60ch; }
      .x-statline { font: var(--type-small); color: var(--text-secondary); }
      .x-statline b { color: var(--text-primary); font-weight: var(--weight-medium); }

      /* Layout */
      .x-layout { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 32px; align-items: start; }
      .x-side { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; display: grid; gap: 24px; padding-right: 4px; scrollbar-width: thin; }
      .x-side h2 { font: var(--type-tag); color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.06em; margin: 0 0 8px 10px; }
      .x-facets { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
      .x-facet {
        width: 100%; display: flex; align-items: center; gap: 10px;
        min-height: 36px; padding: 6px 10px; border: 0; border-radius: var(--r-s);
        background: transparent; color: var(--text-primary); font: var(--type-small);
        text-align: left; cursor: pointer; transition: background var(--dur-quick) ease;
      }
      .x-facet:hover { background: var(--hover-wash); }
      .x-facet span.x-name { flex: 1; min-width: 0; }
      .x-facet .x-count { font: var(--type-caption); color: var(--text-secondary); font-variant-numeric: tabular-nums; }
      .x-facet[aria-pressed="true"] { background: var(--fill-primary); color: var(--text-primary-on); }
      .x-facet[aria-pressed="true"] .x-count { color: var(--text-secondary-on); }
      .x-facet[aria-pressed="true"] .x-badge { background: var(--fill-primary-on); color: var(--text-primary); }

      .x-badge {
        flex: none; display: inline-grid; place-items: center;
        width: 24px; height: 24px; border-radius: 7px;
        background: var(--fill-tertiary); color: var(--text-primary);
        font: var(--weight-bold) var(--size-caption)/1 var(--sans); letter-spacing: 0;
      }
      .x-badge--lg { width: 32px; height: 32px; border-radius: 9px; font-size: var(--size-caption); background: var(--fill-primary); color: var(--text-primary-on); }
      .x-badge { overflow: hidden; }
      .x-badge > * { grid-area: 1 / 1; }
      .x-badge img { width: 20px; height: 20px; border-radius: 5px; display: block; object-fit: contain; background: #fff; }
      .x-badge svg { width: 16px; height: 16px; display: none; }
      .x-badge.is-generic svg { display: block; }
      .x-badge.is-generic img { display: none; }

      /* Toolbar */
      .x-main { display: grid; gap: 20px; min-width: 0; }
      .x-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
      .x-search { position: relative; flex: 1 1 260px; }
      .x-search input {
        width: 100%; height: var(--tap); padding: 0 44px 0 16px;
        border: 1px solid var(--stroke-primary); border-radius: var(--r-pill);
        background: var(--fill-primary-on); color: var(--text-primary); font: var(--type-body);
      }
      .x-search input::placeholder { color: var(--text-secondary); }
      .x-search input:focus-visible { outline: 2px solid var(--fill-primary); outline-offset: 1px; }
      .x-search kbd {
        position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
        min-width: 20px; padding: 1px 6px; border: 1px solid var(--stroke-primary); border-radius: 6px;
        font: var(--type-caption); color: var(--text-secondary); text-align: center; pointer-events: none;
      }
      .x-seg { display: inline-flex; padding: 3px; border-radius: var(--r-pill); background: var(--fill-tertiary); }
      .x-seg button {
        min-height: 38px; padding: 6px 14px; border: 0; border-radius: var(--r-pill);
        background: transparent; color: var(--text-secondary); font: var(--type-label); cursor: pointer; white-space: nowrap;
      }
      .x-seg button:hover { color: var(--text-primary); }
      .x-seg button[aria-pressed="true"] { background: var(--fill-primary-on); color: var(--text-primary); box-shadow: 0 1px 3px var(--stroke-primary); }
      .x-seg .x-n { color: var(--text-secondary); font-weight: var(--weight-regular); margin-left: 4px; }

      .x-active { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
      .x-active:empty { display: none; }
      .x-fchip {
        display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 4px 8px 4px 12px;
        border: 0; border-radius: var(--r-pill); background: var(--fill-primary); color: var(--text-primary-on);
        font: var(--type-tag); cursor: pointer;
      }
      .x-fchip small { color: var(--text-secondary-on); font-size: var(--size-caption); }
      .x-fchip::after { content: "\00d7"; font-size: 15px; line-height: 1; color: var(--text-secondary-on); padding: 0 2px; }
      .x-clear { border: 0; background: none; padding: 4px 6px; min-height: 30px; font: var(--type-tag); color: var(--text-secondary); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
      .x-clear:hover { color: var(--text-primary); }
      .x-resultline { font: var(--type-small); color: var(--text-secondary); }

      /* Latest finds */
      .x-latest { padding: 20px 22px; border-radius: var(--r-m); background: var(--fill-tertiary); display: grid; gap: 12px; }
      .x-latest h2 { font: var(--type-heading); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
      .x-latest ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 0 24px; }
      .x-latest li { border-top: 1px solid var(--stroke-secondary); }
      .x-latest a { display: flex; align-items: center; gap: 10px; min-height: var(--tap); padding: 6px 0; text-decoration: none; font: var(--type-small); }
      .x-latest a:hover .x-lt { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--stroke-primary); }
      .x-latest .x-lt { flex: 1; min-width: 0; }
      .x-latest .x-lc { font: var(--type-caption); color: var(--text-secondary); white-space: nowrap; }

      /* Groups */
      .x-group { display: grid; gap: 12px; scroll-margin-top: 16px; }
      .x-ghead { display: flex; align-items: baseline; gap: 12px; padding: 12px 0 4px; border-bottom: 1px solid var(--stroke-secondary); }
      .x-ghead .x-gnum { font: var(--type-label); color: var(--text-secondary); font-variant-numeric: tabular-nums; }
      .x-ghead h2 { font: var(--type-heading); flex: 1; }
      .x-list { display: grid; gap: 12px; }

      /* Card */
      .x-card {
        display: grid; grid-template-columns: 184px minmax(0, 1fr); gap: 18px;
        padding: 14px; border-radius: var(--r-m); background: var(--fill-tertiary); scroll-margin-top: 16px;
      }
      .x-card:target { box-shadow: inset 0 0 0 1.5px var(--fill-primary); }
      .x-thumb { display: block; aspect-ratio: 16 / 9; border-radius: var(--r-s); overflow: hidden; background: var(--stroke-secondary); align-self: start; }
      .x-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--dur-quick) var(--ease-out); }
      .x-thumb:hover img { transform: scale(1.03); }
      .x-body { display: grid; gap: 8px; min-width: 0; align-content: start; }
      .x-title { display: flex; align-items: flex-start; gap: 10px; }
      .x-title h3 a { color: inherit; text-decoration: none; } .x-title h3 a:hover { text-decoration: underline; }
      .x-title h3 { font: var(--weight-bold) var(--size-body)/var(--lh) var(--sans); padding-top: 6px; }
      .x-sum { font: var(--type-small); color: var(--text-secondary); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
      .x-card.is-open .x-sum { display: block; }
      .x-tags { display: flex; flex-wrap: wrap; gap: 6px; }
      .x-tag {
        display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 3px; min-height: 26px;
        border: 1px solid var(--stroke-primary); border-radius: var(--r-pill); background: var(--fill-primary-on);
        color: var(--text-primary); font: var(--type-tag); cursor: pointer;
      }
      .x-tag .x-badge { width: 24px; height: 24px; border-radius: 50%; }
      .x-side > nav { min-width: 0; }
      .x-tag:hover { box-shadow: inset 0 0 0 100px var(--hover-wash); }
      .x-meta { font: var(--type-caption); color: var(--text-secondary); display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
      .x-meta button { border: 0; background: none; padding: 0; font: inherit; color: var(--text-primary); cursor: pointer; text-decoration: underline; text-decoration-color: var(--stroke-primary); text-underline-offset: 3px; }
      .x-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 2px; }
      button.btn { cursor: pointer; }
      .x-panel { display: grid; gap: 8px; padding: 12px; border-radius: var(--r-s); background: var(--fill-primary-on); border: 1px solid var(--stroke-secondary); }
      .x-panel[hidden] { display: none; }
      .x-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
      .x-panel-head span { font: var(--type-tag); color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.06em; }
      .x-panel pre { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: var(--size-meta); line-height: 1.55; color: var(--text-primary); }

      .x-empty { padding: 28px 24px; border: 1.5px dashed var(--stroke-primary); border-radius: var(--r-m); display: grid; gap: 10px; justify-items: start; }
      .x-empty h2 { font: var(--type-heading); }
      .x-empty p { color: var(--text-secondary); font: var(--type-small); }
      .x-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

      @media (max-width: 860px) {
        .x-layout { grid-template-columns: minmax(0, 1fr); gap: 20px; }
        .x-side { position: static; max-height: none; overflow: visible; gap: 12px; padding: 0; grid-template-columns: minmax(0, 1fr); min-width: 0; }
        .x-side h2 { margin: 0 0 6px 2px; }
        .x-facets { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter); }
        .x-facets::-webkit-scrollbar { display: none; }
        .x-facets li { flex: none; }
        .x-facet { width: auto; min-height: var(--tap); padding: 6px 14px 6px 8px; border-radius: var(--r-pill); background: var(--fill-tertiary); white-space: nowrap; gap: 8px; }
        .x-facet.x-nobadge { padding-left: 14px; }
      }
      @media (max-width: 599px) {
        .x-card { grid-template-columns: minmax(0, 1fr); gap: 12px; }
        .x-toolbar .x-seg { flex: 1 1 auto; }
        .x-seg button { flex: 1; min-height: var(--tap); }
        .x-lang button, .x-lang a { flex: none; min-height: var(--tap); }
        .x-tag, .x-fchip, .x-clear { min-height: var(--tap); }
        .x-meta button { min-height: var(--tap); }
      }
    
/* detail pages */

.y-crumbs{font:var(--type-small);color:var(--text-secondary);display:flex;flex-wrap:wrap;gap:6px;align-items:center}
.y-crumbs a{color:var(--text-primary);text-decoration:underline;text-decoration-color:var(--stroke-primary);text-underline-offset:3px}
.y-wrap{display:grid;gap:24px;padding-bottom:40px}
.y-sec{display:grid;gap:12px}
.y-sec>h2,.y-ghead h2{font:var(--type-heading)}
.y-hero{display:grid;grid-template-columns:minmax(0,1.3fr) minmax(0,1fr);gap:22px;padding:16px;border-radius:var(--r-m);background:var(--fill-tertiary);align-items:start}
.y-hero .x-thumb{position:relative}.y-play{position:absolute;left:12px;bottom:12px}
.y-steps{margin:0;padding-left:20px;display:grid;gap:6px;font:var(--type-body)}
.y-prose{font:var(--type-body);color:var(--text-primary);max-width:68ch}.y-guide{color:var(--text-secondary,inherit)}.y-faq{border-top:1px solid var(--stroke-tertiary,rgba(0,0,0,.08));padding:12px 0}.y-faq summary{cursor:pointer;font-weight:600}.y-faq p{margin-top:8px}.y-prose a{color:inherit}
.y-table{width:100%;border-collapse:collapse;font:var(--type-small)}.y-table th{font:var(--type-tag);color:var(--text-secondary);text-transform:uppercase;letter-spacing:.06em;text-align:left;padding:8px 10px;border-bottom:1px solid var(--stroke-primary)}
.y-table td{padding:12px 10px;border-bottom:1px solid var(--stroke-secondary);vertical-align:top}.y-table td:last-child{font-weight:var(--weight-bold);white-space:nowrap}
.y-chips{display:flex;flex-wrap:wrap;gap:6px}.y-chips .x-tag{padding:2px 12px 2px 3px}.y-chips .x-tag:not(:has(.x-badge)){padding:4px 12px}
.y-book{padding:20px 22px;border-radius:var(--r-m);background:var(--fill-tertiary);display:grid;gap:12px;justify-items:start}.y-book h2{font:var(--type-heading)}
.y-prose a{color:var(--text-primary);text-decoration:underline;text-underline-offset:3px}
.y-idx .x-latest a{text-decoration:none}a.x-tag{text-decoration:none}
.y-weeks{list-style:none;margin:0;padding:0;display:grid;gap:8px}.y-weeks a{display:flex;justify-content:space-between;gap:12px;flex-wrap:wrap;padding:12px 14px;border-radius:var(--r-m);background:var(--fill-tertiary);color:var(--text-primary);text-decoration:none;font:var(--type-body)}.y-weeks span{color:var(--text-secondary);font:var(--type-small)}
.y-pn{display:flex;flex-wrap:wrap;gap:8px}
.y-headrow{display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap}.y-headrow .y-crumbs{flex:1 1 auto}.y-adv{font-size:13px;color:var(--fg-2,#555);text-decoration:none;border:1px solid var(--line,#ddd);border-radius:999px;padding:4px 12px;white-space:nowrap}.y-adv:hover{color:var(--fg,#111);border-color:currentColor}
@media (max-width:760px){.y-hero{grid-template-columns:minmax(0,1fr)}.y-table thead{display:none}.y-table tr{display:grid;padding:10px 0;border-bottom:1px solid var(--stroke-secondary)}.y-table td{border:0;padding:2px 0}}
.y-dg{display:grid;gap:18px;padding:20px;border-radius:var(--r-m);background:var(--fill-tertiary)}.y-dg h3{font:var(--type-label);font-weight:var(--weight-bold);margin:0}
.y-dg-note{font:var(--type-caption);color:var(--text-tertiary)}.y-dg-tldr{font:var(--type-body);font-weight:var(--weight-medium);margin:0;max-width:72ch}
.y-dg-prob{font:var(--type-small);color:var(--text-secondary);margin:0;padding-left:12px;border-left:3px solid var(--stroke-primary)}
.y-flow{list-style:none;margin:0;padding:0;display:grid;gap:0}.y-flow li{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,.8fr);gap:12px;align-items:center;position:relative;padding-bottom:22px}
.y-flow li:last-child{padding-bottom:0}.y-flow li:not(:last-child)::after{content:"↓";position:absolute;left:calc((100% - 12px) * .2778);bottom:2px;transform:translateX(-50%);color:var(--text-tertiary);font-size:16px;line-height:18px}
.y-node{position:relative;padding:10px 14px;border-radius:12px;background:var(--bg,#fff);border:1px solid var(--stroke-secondary);border-left:5px solid #9aa4b2}.y-node b{display:block;font:var(--type-small);font-weight:var(--weight-bold)}.y-node span{display:block;font:var(--type-caption);color:var(--text-secondary)}
.y-node.k-data{border-left-color:#3b82f6}.y-node.k-code{border-left-color:#10b981}.y-node.k-model{border-left-color:#f59e0b}.y-node.k-out{border-left-color:#8b5cf6;background:#f5f3ff}
.y-drop{font:var(--type-caption);color:#b42318;display:flex;gap:6px;align-items:center}.y-drop::before{content:"→ ✕";white-space:pre;font-weight:700}
.y-legend{display:flex;flex-wrap:wrap;gap:12px;font:var(--type-caption);color:var(--text-secondary)}.y-legend i{display:inline-block;width:10px;height:10px;border-radius:3px;margin-right:5px;vertical-align:-1px}
.y-stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(130px,1fr));gap:10px}.y-stat{padding:12px 14px;border-radius:12px;background:var(--bg,#fff);border:1px solid var(--stroke-secondary)}.y-stat b{display:block;font-size:24px;line-height:1.2}.y-stat span{font:var(--type-caption);color:var(--text-secondary)}
.y-qs{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:10px;margin:0;padding:0;list-style:none;counter-reset:q}.y-qs li{counter-increment:q;padding:12px 14px;border-radius:12px;background:#fffbeb;border:1px solid #fde68a;font:var(--type-small)}.y-qs li::before{content:"Q" counter(q) "  ";font-weight:700;white-space:pre}
.y-stages{list-style:none;margin:0;padding:0;display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:8px;counter-reset:st}.y-stages li{counter-increment:st;padding:10px 12px;border-radius:12px;background:var(--bg,#fff);border:1px solid var(--stroke-secondary);font:var(--type-small)}.y-stages li::before{content:counter(st);display:inline-grid;place-items:center;width:22px;height:22px;border-radius:50%;background:var(--fill-primary);color:var(--fill-primary-on,#fff);font-size:12px;font-weight:700;margin-right:8px}
.y-lessons{margin:0;padding:0;list-style:none;display:grid;gap:8px}.y-lessons li{font:var(--type-small);padding-left:26px;position:relative}.y-lessons li::before{content:"✓";position:absolute;left:0;top:0;width:18px;height:18px;border-radius:50%;background:#10b981;color:#fff;font-size:11px;display:grid;place-items:center}
.y-chap{margin:0;padding:0;list-style:none;display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:6px}.y-chap a{display:flex;gap:10px;padding:8px 10px;border-radius:10px;background:var(--bg,#fff);border:1px solid var(--stroke-secondary);color:var(--text-primary);text-decoration:none;font:var(--type-small)}.y-chap code{font-weight:700;color:#b42318;min-width:38px}
.y-dg-row{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:18px}
@media (max-width:760px){.y-flow li{grid-template-columns:minmax(0,1fr);gap:4px}.y-flow li:not(:last-child)::after{left:50%}.y-drop{padding-left:14px}.y-dg-row{grid-template-columns:minmax(0,1fr)}.y-dg{padding:14px}}
