@charset "UTF-8";
/* Optional directory layouts. Load after site.css; legacy themes are untouched. */

/* Shared contract: the body owns theme-*, portal-home contains the new sections. */
:is(.theme-nebula,.theme-sakura,.theme-terminal) {
  --button: var(--brand);
  font-size: 14px;
}
:is(.theme-nebula,.theme-sakura,.theme-terminal) .main-shell,
:is(.theme-nebula,.theme-sakura,.theme-terminal) main,
:is(.theme-nebula,.theme-sakura,.theme-terminal) .portal-home,
:is(.theme-nebula,.theme-sakura,.theme-terminal) .portal-group { min-width: 0; }
:is(.theme-nebula,.theme-sakura,.theme-terminal) .brand { letter-spacing: -.4px; }
:is(.theme-nebula,.theme-sakura,.theme-terminal) .brand>span:last-child { min-width: 0; overflow-wrap: anywhere; }
:is(.theme-nebula,.theme-sakura,.theme-terminal) .topbar { gap: 16px; }
:is(.theme-nebula,.theme-sakura,.theme-terminal) .eyebrow { flex: 1; min-width: 0; max-width: none; }
:is(.theme-nebula,.theme-sakura,.theme-terminal) .topbar-actions { flex: 0 0 auto; }
:is(.theme-nebula,.theme-sakura,.theme-terminal) .primary-nav>a,
:is(.theme-nebula,.theme-sakura,.theme-terminal) .language-menu nav a { min-height: 44px; display: flex; align-items: center; }
:is(.theme-nebula,.theme-sakura,.theme-terminal) .searchbox { background: var(--surface); }
:is(.theme-nebula,.theme-sakura,.theme-terminal) .searchbox input { min-height: 44px; font-size: 14px; }
:is(.theme-nebula,.theme-sakura,.theme-terminal) input::placeholder { color: var(--muted); opacity: 1; }
:is(.theme-nebula,.theme-sakura,.theme-terminal) .searchbox button,
:is(.theme-nebula,.theme-sakura,.theme-terminal) .button { min-height: 44px; background: var(--button); color: #fff; }
:is(.theme-nebula,.theme-sakura,.theme-terminal) .button.secondary { background: var(--surface); color: var(--brand); }
:is(.theme-nebula,.theme-sakura,.theme-terminal) .resource-filters :is(input,select,button),
:is(.theme-nebula,.theme-sakura,.theme-terminal) .public-panel :is(input,button) { min-height: 44px; }
:is(.theme-nebula,.theme-sakura,.theme-terminal) .resource-copy strong { overflow-wrap: anywhere; }
:is(.theme-nebula,.theme-sakura,.theme-terminal) .resource-copy>span { font-size: 12px; line-height: 1.65; }
:is(.theme-nebula,.theme-sakura,.theme-terminal) .resource-copy small { color: var(--muted); font-size: 11px; }
:is(.theme-nebula,.theme-sakura,.theme-terminal) .card-arrow { color: var(--muted); }
:is(.theme-nebula,.theme-sakura,.theme-terminal) .resource-card {
  background: var(--surface); color: var(--ink); border-color: var(--line);
  /* Theme text and surface must switch together; a fading surface can lose contrast. */
  transition: border-color .15s;
}
:is(.theme-nebula,.theme-sakura,.theme-terminal) .resource-mark { background: var(--tint); color: var(--brand); }
:is(.theme-nebula,.theme-sakura,.theme-terminal) .resource-card:hover { transform: none; border-color: var(--brand); background: var(--tint); }
:is(.theme-nebula,.theme-sakura,.theme-terminal) :is(a,button,summary,input,select,textarea):focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 4px;
}
:is(.theme-nebula,.theme-sakura,.theme-terminal) .primary-nav>a:focus-visible,
:is(.theme-nebula,.theme-sakura,.theme-terminal) .portal-shortcuts a:focus-visible,
.theme-terminal .portal-group-grid .resource-card:focus-visible { outline-offset: -3px; }
:is(.theme-nebula,.theme-sakura,.theme-terminal) .footer { font-size: 12px; align-items: center; }
:is(.theme-nebula,.theme-sakura,.theme-terminal) .footer nav { gap: 6px 18px; align-items: center; }
:is(.theme-nebula,.theme-sakura,.theme-terminal) .footer a,
:is(.theme-nebula,.theme-sakura,.theme-terminal) .pagination a,
:is(.theme-nebula,.theme-sakura,.theme-terminal) .tag-links a,
:is(.theme-nebula,.theme-sakura,.theme-terminal) .partner-links a { min-height: 44px; display: inline-flex; align-items: center; }
:is(.theme-nebula,.theme-sakura,.theme-terminal) .detail-content { max-width: 960px; }
:is(.theme-nebula,.theme-sakura,.theme-terminal) .portal-toolbar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px 18px;
  margin: 24px 0 18px; color: var(--muted); font-size: 12px;
}
:is(.theme-nebula,.theme-sakura,.theme-terminal) .portal-toolbar strong { color: var(--ink); }
:is(.theme-nebula,.theme-sakura,.theme-terminal) .portal-toolbar h2 { flex: 1; min-width: 0; font-size: 18px; line-height: 1.4; margin: 0; }
:is(.theme-nebula,.theme-sakura,.theme-terminal) .portal-toolbar a { color: var(--brand); min-height: 44px; display: inline-flex; align-items: center; }
:is(.theme-nebula,.theme-sakura,.theme-terminal) .portal-shortcuts { display: flex; flex-wrap: wrap; gap: 10px; margin: 22px 0; }
:is(.theme-nebula,.theme-sakura,.theme-terminal) .portal-shortcuts>span { flex: 1 0 100%; color: var(--muted); font-size: 11px; font-weight: 650; letter-spacing: .8px; }
:is(.theme-nebula,.theme-sakura,.theme-terminal) .portal-shortcuts a {
  min-height: 44px; min-width: 0; display: flex; align-items: center; gap: 10px;
  padding: 11px 16px; background: var(--surface); border: 1px solid var(--line);
  color: var(--ink); font-size: 13px; overflow-wrap: anywhere;
}
:is(.theme-nebula,.theme-sakura,.theme-terminal) .portal-shortcuts a:hover { background: var(--tint); border-color: var(--brand); }
:is(.theme-nebula,.theme-sakura,.theme-terminal) .portal-shortcuts :is(small,.shortcut-count) { color: var(--muted); font-size: 11px; }
:is(.theme-nebula,.theme-sakura,.theme-terminal) .portal-featured { margin: 28px 0; min-width: 0; }
:is(.theme-nebula,.theme-sakura,.theme-terminal) .portal-featured .section-heading { margin: 0 0 16px; }
:is(.theme-nebula,.theme-sakura,.theme-terminal) .portal-featured h2 { font-size: 20px; }
:is(.theme-nebula,.theme-sakura,.theme-terminal) .portal-featured .section-heading { flex-wrap: wrap; }
:is(.theme-nebula,.theme-sakura,.theme-terminal) .portal-featured .section-heading>span { max-width: 100%; font-size: 12px; }
:is(.theme-nebula,.theme-sakura,.theme-terminal) .portal-groups { display: grid; gap: 24px; margin: 26px 0; }
:is(.theme-nebula,.theme-sakura,.theme-terminal) .portal-group { scroll-margin-top: 24px; }
:is(.theme-nebula,.theme-sakura,.theme-terminal) .portal-group :is(.portal-group-heading,.section-heading),
:is(.theme-nebula,.theme-sakura,.theme-terminal) .portal-group>header {
  display: flex; align-items: center; gap: 12px; justify-content: space-between; margin: 0 0 18px;
}
:is(.theme-nebula,.theme-sakura,.theme-terminal) .portal-group :is(.portal-group-heading,.section-heading)>div,
:is(.theme-nebula,.theme-sakura,.theme-terminal) .portal-group>header>div { display: flex; align-items: center; gap: 10px; min-width: 0; }
:is(.theme-nebula,.theme-sakura,.theme-terminal) .portal-group :is(h2,h3) { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; margin: 0; font-size: 17px; line-height: 1.45; overflow-wrap: anywhere; }
:is(.theme-nebula,.theme-sakura,.theme-terminal) .pGroup-icon { display: inline-grid; place-items: center; width: 34px; height: 34px; flex: 0 0 auto; border-radius: 10px; background: var(--tint); color: var(--brand); font-size: 18px; }
:is(.theme-nebula,.theme-sakura,.theme-terminal) .portal-group :is(.pGroup-count,header small,.section-heading>span:not(.pGroup-icon)) { color: var(--muted); font-size: 11px; }
:is(.theme-nebula,.theme-sakura,.theme-terminal) .portal-group :is(.portal-group-heading,.section-heading) small { color: var(--muted); font-size: 11px; }
:is(.theme-nebula,.theme-sakura,.theme-terminal) .portal-group :is(.portal-group-heading,.section-heading)>a,
:is(.theme-nebula,.theme-sakura,.theme-terminal) .portal-group>header>a { min-height: 44px; display: inline-flex; align-items: center; flex: 0 0 auto; gap: 5px; font-size: 12px; color: var(--brand); }
:is(.theme-nebula,.theme-sakura,.theme-terminal) .portal-group-grid { display: grid; gap: 12px; grid-template-columns: repeat(3,minmax(0,1fr)); }

/* NEBULA: persistent purple rail, broad search banner and full-width directories. */
.theme-nebula {
  --bg:#f4f3fb; --surface:#fff; --ink:#29243d; --muted:#625b78; --line:#e1dced;
  --brand:#6940b6; --button:#6940b6; --tint:#f0e9fb; --radius:12px; --shadow:none;
}
.theme-nebula .site-shell { grid-template-columns: 228px minmax(0,1fr); }
.theme-nebula .sidebar { padding: 30px 18px; background: #21183e; color: #f6f1ff; border-right: 0; }
.theme-nebula .brand { font-size: 21px; }
.theme-nebula .brand-icon { color: #cfb6ff; }
.theme-nebula .brand small { color: #c6b9df; letter-spacing: 1px; }
.theme-nebula .primary-nav { margin-top: 35px; gap: 6px; }
.theme-nebula .primary-nav>a { color: #e3dbf2; border-radius: 8px; font-size: 13px; }
.theme-nebula .primary-nav>a:hover,.theme-nebula .primary-nav>a.active { background: #443065; color: #fff; }
.theme-nebula .nav-label,.theme-nebula .sidebar-foot { color: #c6b9df; }
.theme-nebula .sidebar :is(a,button):focus-visible { outline-color: #e0cfff; }
.theme-nebula .sidebar-foot a { display: inline-flex; align-items: center; min-height: 44px; }
.theme-nebula .topbar { background: var(--surface); height: 76px; padding: 0 32px; }
.theme-nebula .eyebrow { font-size: 12px; letter-spacing: .3px; }
.theme-nebula main { padding: 28px 32px 48px; max-width: 1520px; }
.theme-nebula .hero { border: 1px solid #675084; border-radius: 18px; min-height: 292px; background: linear-gradient(110deg,#31204e,#51336f); color: #fff; grid-template-columns: minmax(0,2.1fr) minmax(180px,1fr); }
.theme-nebula .hero-copy { padding: 30px 34px; }
.theme-nebula .hero .kicker { color: #e0c8ff; font-size: 11px; letter-spacing: 1.8px; }
.theme-nebula .hero h1 { font-size: clamp(29px,3vw,42px); letter-spacing: -1px; margin: 16px 0 12px; color: #fff; }
.theme-nebula .hero p { color: #e2d7ee; font-size: 13px; }
.theme-nebula .hero-stats { color: #e2d7ee; font-size: 11px; }
.theme-nebula .hero-stats strong { color: #fff; }
.theme-nebula .hero-art { border: 0; min-height: 290px; }
.theme-nebula .orbit { border-color: #b29ac7; left: 3px; top: 15px; width: 250px; height: 250px; }
.theme-nebula .orbit:before,.theme-nebula .orbit:after { border-color: #9377ad; }
.theme-nebula .art-glyph { color: #ead5ff; top: 52px; left: 35px; font-size: 148px; }
.theme-nebula .art-note { background: #ece0fa; color: #4d315f; border-color: #b99ad1; right: 20px; bottom: 48px; }
.theme-nebula .art-label { color: #e5d9f0; left: 20px; bottom: 20px; font-size: 9px; }
.theme-nebula .searchbox { max-width: 650px; border: 0; margin: 22px 0 18px; }
.theme-nebula .portal-shortcuts { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; }
.theme-nebula .portal-shortcuts>span { grid-column: 1 / -1; }
.theme-nebula .portal-shortcuts a { border-radius: 10px; padding: 15px; font-weight: 600; }
.theme-nebula .portal-shortcuts a small { margin-left: auto; font-weight: 400; }
.theme-nebula .portal-toolbar { border-bottom: 1px solid var(--line); padding-bottom: 18px; }
.theme-nebula .portal-toolbar>span { padding: 4px 9px; background: var(--surface); border-radius: 6px; }
.theme-nebula .portal-featured { background: var(--tint); border: 1px solid var(--line); border-radius: 14px; padding: 22px; }
.theme-nebula .portal-featured .resource-grid { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; }
.theme-nebula .portal-featured .resource-card { min-height: 132px; border-color: var(--line); }
.theme-nebula .portal-group { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px; }
.theme-nebula .portal-group-grid { grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; }
.theme-nebula .portal-group-grid .resource-card { padding: 17px 13px; min-height: 123px; gap: 10px; box-shadow: none; }
.theme-nebula .portal-group-grid .resource-mark { width: 34px; height: 34px; border-radius: 9px; }
.theme-nebula .portal-group-grid .resource-copy strong { font-size: 13px; margin: 0 0 5px; }
.theme-nebula .portal-group-grid .resource-copy>span { font-size: 11px; min-height: 36px; }
.theme-nebula .portal-group-grid .resource-copy small { font-size: 10px; margin-top: 7px; }
.theme-nebula .portal-group-grid .card-arrow { display: none; }
.theme-nebula .footer { padding: 22px 32px; }
html[data-color=dark] .theme-nebula { --bg:#11101b; --surface:#1b1929; --ink:#eeeafb; --muted:#b9b0ca; --line:#3b344e; --brand:#c7a5ff; --button:#7751ba; --tint:#30223f; }

/* SAKURA: a horizontal masthead, generous search stage and paired category boxes. */
.theme-sakura {
  --bg:#fff8fa; --surface:#fff; --ink:#412b36; --muted:#735b66; --line:#ecdce3;
  --brand:#b2396e; --button:#ad2e64; --tint:#fceaf1; --radius:18px; --shadow:0 6px 22px #7a315008;
}
.theme-sakura .site-shell { display: block; }
.theme-sakura .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 20px max(28px,calc((100vw - 1280px)/2)); flex-direction: row; align-items: center; gap: 36px; }
.theme-sakura .brand { flex: 0 0 auto; font-size: 22px; }
.theme-sakura .brand-icon { font-size: 37px; }
.theme-sakura .brand small { font-size: 10px; letter-spacing: 1px; }
.theme-sakura .primary-nav { flex: 1; min-width: 0; flex-direction: row; margin: 0; gap: 6px; overflow-x: auto; padding: 3px; white-space: nowrap; }
.theme-sakura .primary-nav>a { flex: 0 0 auto; font-size: 13px; color: var(--muted); padding: 10px 13px; border-radius: 99px; }
.theme-sakura .primary-nav>a:hover,.theme-sakura .primary-nav>a.active { color: var(--brand); background: var(--tint); }
.theme-sakura .nav-label,.theme-sakura .sidebar-foot,.theme-sakura .nav-dot { display: none; }
.theme-sakura .topbar { height: 66px; max-width: 1280px; margin: auto; padding: 0 28px; border: 0; }
.theme-sakura .eyebrow { font-size: 12px; letter-spacing: .3px; }
.theme-sakura main { padding: 12px 28px 48px; max-width: 1280px; }
.theme-sakura .hero { display: block; position: relative; min-height: 340px; background: linear-gradient(140deg,var(--tint),var(--surface)); border: 1px solid var(--line); border-radius: 30px; }
.theme-sakura .hero:before,.theme-sakura .hero:after { content: ""; position: absolute; width: 200px; height: 200px; border: 28px solid #dc8eae1a; border-radius: 50%; pointer-events: none; }
.theme-sakura .hero:before { left: -80px; bottom: -100px; }
.theme-sakura .hero:after { right: -80px; top: -95px; width: 260px; height: 260px; }
.theme-sakura .hero-copy { position: relative; z-index: 1; max-width: 860px; margin: auto; padding: 44px 28px 35px; text-align: center; }
.theme-sakura .hero .kicker { display: inline-block; font-size: 11px; letter-spacing: 2px; }
.theme-sakura .hero h1 { font-size: clamp(34px,3.8vw,50px); letter-spacing: -1.8px; max-width: 780px; margin: 19px auto 14px; }
.theme-sakura .hero p { font-size: 14px; max-width: 670px; margin: 14px auto; }
.theme-sakura .hero-art { display: none; }
.theme-sakura .searchbox { max-width: 670px; margin: 25px auto 18px; border-radius: 99px; padding: 6px; box-shadow: 0 6px 20px #8b345310; }
.theme-sakura .searchbox input { padding-left: 20px; }
.theme-sakura .searchbox button { border-radius: 99px; padding: 10px 25px; }
.theme-sakura .hero-stats { font-size: 12px; color: var(--muted); }
.theme-sakura .hero-stats strong { color: var(--ink); }
.theme-sakura .portal-shortcuts { justify-content: center; margin: 24px 0 12px; }
.theme-sakura .portal-shortcuts a { border-radius: 99px; padding: 10px 19px; background: var(--surface); }
.theme-sakura .portal-toolbar { justify-content: center; padding: 14px; margin: 12px 0 22px; text-align: center; }
.theme-sakura .portal-toolbar h2 { flex: 0 1 auto; }
.theme-sakura .portal-featured { margin: 20px 0 35px; }
.theme-sakura .portal-featured .section-heading { justify-content: center; gap: 18px; }
.theme-sakura .portal-featured .resource-grid { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 18px; }
.theme-sakura .portal-featured .resource-card { padding: 25px 21px; border-radius: 20px; border-color: var(--line); min-height: 156px; }
.theme-sakura .portal-featured .resource-mark { width: 48px; height: 48px; font-size: 24px; border-radius: 15px; }
.theme-sakura .portal-featured .resource-copy strong { font-size: 16px; }
.theme-sakura .portal-groups { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 22px; align-items: start; }
.theme-sakura .portal-group { border: 1px solid var(--line); background: var(--surface); border-radius: 20px; padding: 22px; box-shadow: var(--shadow); }
.theme-sakura .portal-group-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.theme-sakura .portal-group-grid .resource-card { padding: 16px 11px; gap: 10px; min-height: 130px; box-shadow: none; border-radius: 12px; background: var(--bg); }
.theme-sakura .portal-group-grid .resource-card:hover { background: var(--tint); }
.theme-sakura .portal-group-grid .resource-mark { width: 32px; height: 32px; font-size: 15px; border-radius: 10px; }
.theme-sakura .portal-group-grid .resource-copy strong { font-size: 13px; margin-top: 0; }
.theme-sakura .portal-group-grid .resource-copy>span { font-size: 11px; min-height: 36px; }
.theme-sakura .portal-group-grid .resource-copy small { font-size: 10px; }
.theme-sakura .portal-group-grid .card-arrow { display: none; }
.theme-sakura .footer { max-width: 1280px; margin: auto; padding: 25px 28px; }
html[data-color=dark] .theme-sakura { --bg:#21131c; --surface:#2d1c27; --ink:#faedf4; --muted:#d2b8c7; --line:#634355; --brand:#f6a4c8; --button:#a33062; --tint:#452638; --shadow:none; }

/* TERMINAL: blue masthead and search console, dense split directory lists. */
.theme-terminal {
  --bg:#edf2fa; --surface:#fff; --ink:#192d49; --muted:#52657e; --line:#d3dfed;
  --brand:#164f9b; --button:#1758b3; --tint:#e7effa; --radius:6px; --shadow:none;
}
.theme-terminal .site-shell { display: block; }
.theme-terminal .sidebar { height: auto; position: static; display: grid; grid-template-columns: 210px minmax(0,1fr); align-items: center; gap: 28px; border: 0; background: #0d1b30; color: #f3f7ff; padding: 18px max(28px,calc((100vw - 1340px)/2)); }
.theme-terminal .brand { font-size: 20px; }
.theme-terminal .brand-icon { border: 1px solid #41618d; border-radius: 8px; width: 38px; height: 38px; font-size: 30px; color: #afccff; }
.theme-terminal .brand small { color: #b7c9e2; letter-spacing: 1px; }
.theme-terminal .primary-nav { min-width: 0; display: flex; flex-direction: row; overflow-x: auto; margin: 0; padding: 4px; gap: 7px; white-space: nowrap; }
.theme-terminal .primary-nav>a { flex: 0 0 auto; color: #d3e0f3; font-size: 12px; padding: 10px 14px; border-radius: 5px; }
.theme-terminal .primary-nav>a:hover,.theme-terminal .primary-nav>a.active { color: #fff; background: #28446c; }
.theme-terminal .sidebar :is(a,button):focus-visible { outline-color: #c3daff; }
.theme-terminal .nav-label,.theme-terminal .sidebar-foot,.theme-terminal .nav-dot { display: none; }
.theme-terminal .topbar { background: var(--surface); height: 66px; padding: 0 max(28px,calc((100vw - 1340px)/2)); }
.theme-terminal .eyebrow { font-family: ui-monospace,SFMono-Regular,Consolas,monospace; font-size: 11px; letter-spacing: .3px; }
.theme-terminal .icon-button,.theme-terminal .language-menu summary { border-radius: 5px; }
.theme-terminal main { max-width: 1396px; padding: 26px 28px 48px; }
.theme-terminal .hero { display: block; min-height: 0; border: 1px solid #34547b; border-radius: 8px; background: #14294a; color: #fff; }
.theme-terminal .hero-copy { display: grid; grid-template-columns: minmax(0,1.15fr) minmax(280px,1fr); column-gap: 40px; padding: 28px 30px; }
.theme-terminal .hero .kicker { grid-column: 1; color: #b6ceff; font-family: ui-monospace,SFMono-Regular,Consolas,monospace; font-size: 11px; letter-spacing: 1px; }
.theme-terminal .hero h1 { grid-column: 1; color: #fff; font-size: clamp(27px,2.8vw,36px); letter-spacing: -.9px; margin: 12px 0; }
.theme-terminal .hero p { grid-column: 1; color: #d0dcef; font-size: 13px; margin: 0; }
.theme-terminal .hero .searchbox { grid-column: 2; grid-row: 1 / span 3; align-self: center; width: 100%; margin: 0; border: 1px solid var(--line); border-radius: 6px; padding: 5px; }
.theme-terminal .hero-stats { grid-column: 1; font-size: 11px; color: #d0dcef; margin-top: 18px; }
.theme-terminal .hero-stats strong { color: #fff; }
.theme-terminal .hero-art { display: none; }
.theme-terminal .portal-toolbar { margin: 18px 0; padding: 13px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; font-family: ui-monospace,SFMono-Regular,Consolas,monospace; font-size: 11px; }
.theme-terminal .portal-shortcuts { gap: 0; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--surface); margin: 18px 0; }
.theme-terminal .portal-shortcuts>span { padding: 9px 16px; border-bottom: 1px solid var(--line); background: var(--tint); }
.theme-terminal .portal-shortcuts a { border: 0; border-right: 1px solid var(--line); border-radius: 0; flex: 1 1 150px; padding: 12px 16px; justify-content: center; }
.theme-terminal .portal-featured { padding: 18px; border: 1px solid var(--line); border-top: 3px solid var(--brand); border-radius: 6px; background: var(--surface); margin: 24px 0; }
.theme-terminal .portal-featured h2 { font-size: 17px; }
.theme-terminal .portal-featured .resource-grid { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.theme-terminal .portal-featured .resource-card { min-height: 120px; padding: 18px 14px; background: var(--bg); }
.theme-terminal .portal-groups { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 20px; align-items: start; }
.theme-terminal .portal-group { border: 1px solid var(--line); background: var(--surface); border-radius: 6px; overflow: hidden; }
.theme-terminal .portal-group :is(.portal-group-heading,.section-heading),.theme-terminal .portal-group>header { margin: 0; padding: 11px 16px; border-bottom: 1px solid var(--line); background: var(--tint); }
.theme-terminal .portal-group :is(h2,h3) { font-size: 15px; }
.theme-terminal .pGroup-icon { border-radius: 5px; width: 28px; height: 28px; font-size: 16px; background: var(--surface); }
.theme-terminal .portal-group-grid { display: flex; flex-direction: column; gap: 0; }
.theme-terminal .portal-group-grid .resource-card { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; min-height: 88px; padding: 13px 16px; align-items: center; gap: 12px; box-shadow: none; }
.theme-terminal .portal-group-grid .resource-card:last-child { border-bottom: 0; }
.theme-terminal .portal-group-grid .resource-mark { width: 36px; height: 36px; border-radius: 6px; }
.theme-terminal .portal-group-grid .resource-copy strong { font-size: 14px; margin: 0 0 3px; }
.theme-terminal .portal-group-grid .resource-copy>span { -webkit-line-clamp: 1; min-height: 0; font-size: 12px; }
.theme-terminal .portal-group-grid .resource-copy small { font-family: ui-monospace,SFMono-Regular,Consolas,monospace; font-size: 10px; margin-top: 3px; }
.theme-terminal .resource-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
.theme-terminal .resource-card { box-shadow: none; border-radius: 6px; }
.theme-terminal .footer { padding: 22px max(28px,calc((100vw - 1340px)/2)); }
html[data-color=dark] .theme-terminal { --bg:#091320; --surface:#102239; --ink:#edf4ff; --muted:#b1c3dd; --line:#355170; --brand:#a6caff; --button:#245ba9; --tint:#182f4c; }

/* site.css contains legacy dark selectors; these scoped rules preserve each palette. */
html[data-color=dark] :is(.theme-nebula,.theme-sakura,.theme-terminal) .searchbox { background: var(--surface); border-color: var(--line); }
html[data-color=dark] :is(.theme-nebula,.theme-sakura,.theme-terminal) :is(.searchbox button,.button) { background: var(--button); color: #fff; }
html[data-color=dark] :is(.theme-nebula,.theme-sakura,.theme-terminal) .button.secondary { background: var(--surface); color: var(--brand); }
html[data-color=dark] :is(.theme-nebula,.theme-sakura,.theme-terminal) .resource-card:hover { background: var(--tint); }
html[data-color=dark] .theme-nebula .hero { background: linear-gradient(110deg,#31204e,#51336f); border-color: #675084; }
html[data-color=dark] .theme-nebula .hero p,html[data-color=dark] .theme-nebula .hero-stats { color: #e2d7ee; }
html[data-color=dark] .theme-nebula .primary-nav>a { color: #e3dbf2; }
html[data-color=dark] .theme-nebula .primary-nav>a:is(:hover,.active) { color: #fff; }
html[data-color=dark] body.theme-nebula .art-label { color: #e5d9f0; }
html[data-color=dark] .theme-sakura .hero { background: linear-gradient(140deg,var(--tint),var(--surface)); border-color: var(--line); }
html[data-color=dark] .theme-terminal .hero { background: #14294a; border-color: #34547b; }
html[data-color=dark] .theme-terminal .hero p,html[data-color=dark] .theme-terminal .hero-stats { color: #d0dcef; }
html[data-color=dark] .theme-terminal .primary-nav>a { color: #d3e0f3; }
html[data-color=dark] .theme-terminal .primary-nav>a:is(:hover,.active) { color: #fff; }

@media(max-width:1200px) {
  .theme-nebula .portal-group-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .theme-nebula .hero { grid-template-columns: 1fr; }
  .theme-nebula .hero-art { display: none; }
  .theme-sakura .sidebar { padding-inline: 24px; gap: 22px; }
  .theme-sakura .portal-group-grid { grid-template-columns: 1fr; }
}
@media(max-width:960px) {
  .theme-nebula .site-shell { grid-template-columns: 196px minmax(0,1fr); }
  .theme-nebula .sidebar { padding-inline: 14px; }
  .theme-nebula .brand { font-size: 18px; }
  .theme-nebula :is(main,.topbar) { padding-inline: 24px; }
  .theme-nebula .portal-shortcuts { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .theme-nebula .portal-group-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .theme-nebula .portal-featured .resource-grid { grid-template-columns: 1fr; }
  .theme-terminal .hero-copy { column-gap: 24px; grid-template-columns: minmax(0,1fr) minmax(230px,1fr); }
  .theme-terminal .sidebar { grid-template-columns: 180px minmax(0,1fr); gap: 16px; }
  .theme-terminal .portal-featured .resource-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media(max-width:680px) {
  :is(.theme-nebula,.theme-sakura,.theme-terminal) .site-shell { display: block; }
  :is(.theme-nebula,.theme-sakura,.theme-terminal) .sidebar { height: auto; position: static; padding: 20px 18px 14px; border-right: 0; }
  :is(.theme-nebula,.theme-sakura,.theme-terminal) .primary-nav { display: flex; flex-direction: row; gap: 5px; overflow-x: auto; white-space: nowrap; padding: 3px; margin-top: 16px; }
  :is(.theme-nebula,.theme-sakura,.theme-terminal) .primary-nav>a { flex: 0 0 auto; min-height: 44px; font-size: 12px; padding: 10px 12px; }
  :is(.theme-nebula,.theme-sakura,.theme-terminal) :is(.sidebar-foot,.nav-label) { display: none; }
  :is(.theme-nebula,.theme-sakura,.theme-terminal) .topbar { min-height: 66px; height: auto; padding: 11px 16px; }
  :is(.theme-nebula,.theme-sakura,.theme-terminal) .eyebrow { display: none; }
  :is(.theme-nebula,.theme-sakura,.theme-terminal) .topbar-actions { margin-left: auto; gap: 8px; }
  :is(.theme-nebula,.theme-sakura,.theme-terminal) .language-menu summary { font-size: 12px; }
  :is(.theme-nebula,.theme-sakura,.theme-terminal) main { padding: 18px 14px 36px; }
  :is(.theme-nebula,.theme-sakura,.theme-terminal) .searchbox input { font-size: 12px; padding: 10px 9px; }
  :is(.theme-nebula,.theme-sakura,.theme-terminal) .searchbox button { font-size: 12px; padding: 10px 15px; }
  :is(.theme-nebula,.theme-sakura,.theme-terminal) .portal-toolbar { font-size: 11px; gap: 7px 13px; }
  :is(.theme-nebula,.theme-sakura,.theme-terminal) .portal-featured .resource-grid,
  :is(.theme-nebula,.theme-sakura,.theme-terminal) .resource-grid,
  :is(.theme-nebula,.theme-sakura,.theme-terminal) .portal-groups,
  :is(.theme-nebula,.theme-sakura,.theme-terminal) .portal-group-grid { grid-template-columns: 1fr; }
  :is(.theme-nebula,.theme-sakura,.theme-terminal) .portal-group :is(h2,h3) { font-size: 16px; }
  :is(.theme-nebula,.theme-sakura,.theme-terminal) .portal-group :is(.portal-group-heading,.section-heading),
  :is(.theme-nebula,.theme-sakura,.theme-terminal) .portal-group>header { gap: 10px; flex-wrap: wrap; }
  :is(.theme-nebula,.theme-sakura,.theme-terminal) .portal-group :is(.portal-group-heading,.section-heading)>a,
  :is(.theme-nebula,.theme-sakura,.theme-terminal) .portal-group>header>a { margin-left: auto; }
  :is(.theme-nebula,.theme-sakura,.theme-terminal) .portal-group-heading.section-heading { display: grid; grid-template-columns: 34px minmax(0,1fr) auto; column-gap: 10px; row-gap: 3px; }
  :is(.theme-nebula,.theme-sakura,.theme-terminal) .portal-group-heading>.pGroup-icon { grid-row: 1 / span 2; }
  :is(.theme-nebula,.theme-sakura,.theme-terminal) .portal-group-heading>:is(h2,h3) { grid-column: 2; }
  :is(.theme-nebula,.theme-sakura,.theme-terminal) .portal-group-heading>small { grid-column: 2; }
  :is(.theme-nebula,.theme-sakura,.theme-terminal) .portal-group-heading>a { grid-column: 3; grid-row: 1 / span 2; }
  :is(.theme-nebula,.theme-sakura,.theme-terminal) .footer { padding: 20px 18px; align-items: flex-start; }
  .theme-nebula .hero { border-radius: 15px; min-height: 0; }
  .theme-nebula .hero-copy { padding: 26px 22px; }
  .theme-nebula .hero h1 { font-size: 31px; }
  .theme-nebula .hero-art { display: none; }
  .theme-nebula .portal-shortcuts { gap: 9px; }
  .theme-nebula .portal-shortcuts a { padding: 12px; font-size: 12px; }
  .theme-nebula .portal-group { padding: 17px; }
  .theme-nebula .portal-featured { padding: 18px; }
  .theme-nebula .portal-group-grid .resource-card { padding: 16px 13px; min-height: 112px; }
  .theme-sakura .sidebar { display: block; }
  .theme-sakura .brand { justify-content: center; font-size: 23px; }
  .theme-sakura .primary-nav { margin-top: 15px; }
  .theme-sakura .hero { border-radius: 23px; min-height: 0; }
  .theme-sakura .hero-copy { padding: 32px 18px 27px; }
  .theme-sakura .hero h1 { font-size: 35px; line-height: 1.25; letter-spacing: -1.2px; }
  .theme-sakura .hero p { font-size: 13px; }
  .theme-sakura .searchbox { border-radius: 13px; }
  .theme-sakura .searchbox button { border-radius: 9px; }
  .theme-sakura .portal-shortcuts { gap: 8px; }
  .theme-sakura .portal-shortcuts a { padding: 9px 14px; font-size: 12px; }
  .theme-sakura .portal-toolbar { padding: 5px 0; }
  .theme-sakura .portal-featured .resource-card { padding: 22px 18px; }
  .theme-sakura .portal-group { padding: 19px; }
  .theme-sakura .portal-group-grid .resource-card { min-height: 112px; padding: 17px 13px; }
  .theme-terminal .sidebar { display: block; }
  .theme-terminal .brand { font-size: 20px; }
  .theme-terminal .hero-copy { display: block; padding: 24px 20px; }
  .theme-terminal .hero h1 { font-size: 29px; line-height: 1.3; }
  .theme-terminal .hero .searchbox { margin: 22px 0 0; }
  .theme-terminal .hero-stats { margin-top: 17px; }
  .theme-terminal .portal-shortcuts a { flex-basis: 45%; font-size: 12px; padding: 11px; }
  .theme-terminal .portal-group-grid { display: flex; }
  .theme-terminal .portal-group-grid .resource-card { padding: 13px 14px; min-height: 90px; }
  .theme-terminal .portal-featured { padding: 17px; }
}
@media(prefers-reduced-motion:reduce) {
  :is(.theme-nebula,.theme-sakura,.theme-terminal) * { animation: none!important; transition: none!important; scroll-behavior: auto!important; }
}
