:root { color-scheme: dark; --bg: #0a0e1a; --surface: #10182a; --text: #d5dfef; --muted: #9baecb; --blue: #86b9ff; --line: #263a56; --mono: 'JetBrains Mono', monospace; }
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 92px; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.8 'Noto Sans', sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--blue); text-decoration: none; text-underline-offset: 5px; }
a:hover { color: #c1dbff; text-decoration: underline; }
button, input { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid #86b9ff; outline-offset: 5px; }
::selection { background: #284c7d; color: #fff; }
::placeholder { color: #9baecb; }
[hidden] { display: none !important; }
.skip-link { position: absolute; left: 20px; top: -100px; z-index: 10; background: var(--surface); padding: 8px 16px; }
.skip-link:focus { top: 8px; }
header { border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 5; }
nav { max-width: 1120px; padding: 16px 24px; margin: auto; display: flex; align-items: center; justify-content: space-between; gap: 24px; font: 13px/1.5 var(--mono); }
.brand { color: var(--text); display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.brand > span:first-child { color: var(--blue); }
.cursor { height: 14px; width: 7px; background: #60a5fa; }
.nav-links { display: flex; gap: 28px; align-items: center; }
.nav-links a { color: var(--muted); }
.nav-links [aria-current] { color: var(--blue); }
.language { color: var(--muted); font-size: 11px; border-left: 1px solid var(--line); padding-left: 22px; }
main { max-width: 1120px; margin: auto; padding: 0 24px 80px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(32px, 4.6vw, 54px); line-height: 1.24; letter-spacing: -.035em; font-weight: 600; color: #eef4ff; text-wrap: balance; }
.blog-heading { display: grid; grid-template-columns: minmax(0, 1fr) 260px; align-items: center; gap: 64px; padding: 80px 0 64px; }
.blog-heading h1 { font: 400 clamp(26px, 3.5vw, 44px)/1.45 'Silkscreen', monospace; letter-spacing: -.025em; }
.blog-heading h1 > span { color: var(--blue); }
.heading-dot { color: #22d3ee; }
.intro { font-size: 17px; color: var(--muted); line-height: 1.85; margin-top: 22px; max-width: 62ch; }
.source-link { display: inline-block; font-size: 12px; margin-top: 24px; }
.study-note { background: var(--surface); border: 1px solid var(--line); padding: 22px 24px; border-radius: 6px; }
.terminal-label { font: 11px var(--mono); color: var(--blue); }
.study-note p { margin: 20px 0; font-size: 18px; color: var(--muted); line-height: 1.7; }
.study-note strong { color: #edf4ff; font-weight: 500; }
.note-caption { font: 11px var(--mono); color: var(--muted); }
.library { border-top: 1px solid var(--line); padding-top: 32px; }
.library-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.library-heading h2 { font-size: 20px; font-weight: 500; }
#result-count { font: 12px var(--mono); color: var(--muted); white-space: nowrap; }
.search-form label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
input[type='search'] { width: 100%; border: 1px solid #3f5675; border-radius: 4px; color: var(--text); background: var(--surface); padding: 13px 16px; caret-color: var(--blue); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 18px 0 32px; }
.filters button, #reset-search { color: var(--muted); border: 1px solid var(--line); border-radius: 4px; background: transparent; padding: 9px 13px; font: 12px/1.7 var(--mono); min-height: 42px; }
.filters button:hover, #reset-search:hover { border-color: var(--blue); color: #eef4ff; }
.filters [aria-pressed='true'] { background: #1c3457; border-color: #649ee7; color: #d5e7ff; }
.post-row { display: grid; grid-template-columns: 132px minmax(0, 1fr) 44px; gap: 24px; padding: 30px 0; align-items: start; border-bottom: 1px solid var(--line); }
.post-topic { font: 12px/1.8 var(--mono); color: #8cc8db; padding-top: 4px; }
.post-row h2 { font-size: 22px; line-height: 1.45; font-weight: 500; text-wrap: balance; }
.post-row h2 a { color: #e6efff; }
.post-row h2 a:hover { color: var(--blue); }
.post-row p { color: var(--muted); font-size: 14px; margin-top: 9px; }
.post-meta { font-size: 11px; color: var(--muted); display: inline-block; margin-top: 14px; }
.read-link { display: flex; align-items: center; justify-content: center; min-height: 44px; }
#empty-state { text-align: center; padding: 48px 16px; border-bottom: 1px solid var(--line); }
#empty-state p { color: var(--muted); margin: 12px 0 24px; }
footer { max-width: 1072px; margin: auto; padding: 24px 0 36px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 16px; font: 11px/1.8 var(--mono); color: var(--muted); }
.breadcrumb { display: flex; gap: 14px; color: var(--muted); font: 12px var(--mono); padding-top: 36px; }
.article-heading { padding: 40px 0 48px; max-width: 850px; }
.article-meta { font: 12px/1.8 var(--mono); color: #8cc8db; margin-bottom: 20px; }
.reading-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 56px; align-items: start; }
.toc { position: sticky; top: 100px; border-top: 1px solid var(--line); padding-top: 20px; }
.toc > p { color: #e6efff; font-size: 13px; font-weight: 600; }
.toc ol { list-style: none; padding: 0; margin: 16px 0 0; }
.toc li { margin-bottom: 16px; line-height: 1.65; }
.toc li a { color: var(--muted); font-size: 13px; }
.toc .source-link { border-top: 1px solid var(--line); padding-top: 20px; }
.prose { max-width: 72ch; min-width: 0; }
.editor-note { color: var(--muted); font-size: 13px; border-bottom: 1px solid var(--line); padding-bottom: 26px; }
.answer { padding: 38px 0; border-bottom: 1px solid var(--line); }
.prose h2 { font-size: 25px; font-weight: 600; line-height: 1.5; letter-spacing: -.02em; color: #e6efff; text-wrap: balance; }
.prose h3 { font-size: 15px; color: #8cc8db; font-weight: 600; margin-top: 24px; }
.prose p { margin-top: 16px; }
.prose .editor-note { margin-top: 0; }
details { margin-top: 24px; background: var(--surface); border-radius: 4px; padding: 14px 18px; }
summary { cursor: pointer; color: var(--blue); font-size: 13px; padding: 4px 0; }
details p { font-size: 14px; }
.takeaway, .article-source { padding-top: 36px; }
.article-source p { color: var(--muted); font-size: 13px; }
.article-source h2 { font-size: 18px; }
.next-post { display: flex; flex-direction: column; gap: 8px; margin-top: 40px; border-top: 1px solid var(--line); padding-top: 24px; }
.next-post span { font-size: 12px; color: var(--muted); }
.next-post strong { font-size: 20px; font-weight: 500; }
@media (max-width: 760px) {
  .blog-heading { grid-template-columns: 1fr; gap: 28px; padding: 48px 0 40px; }
  .study-note { max-width: 100%; }
  .study-note p { margin: 12px 0; font-size: 16px; }
  .study-note p br { display: none; }
  .study-note strong { margin-right: 5px; }
  .reading-layout { grid-template-columns: 1fr; gap: 30px; }
  .toc { position: static; }
  .toc li { margin-bottom: 10px; }
  .toc .source-link { margin-top: 8px; }
  .article-heading { padding-bottom: 32px; }
  footer { margin: 0 24px; flex-direction: column; gap: 8px; }
}
@media (max-width: 480px) {
  nav { padding: 16px 20px; gap: 12px; }
  .nav-links { gap: 16px; }
  .language { display: none; }
  main { padding: 0 20px 56px; }
  .library-heading { align-items: start; gap: 12px; }
  .library-heading h2 { font-size: 18px; }
  .post-row { grid-template-columns: minmax(0,1fr) 32px; gap: 8px 12px; padding: 24px 0; }
  .post-topic { grid-column: 1/-1; }
  .post-row h2 { font-size: 20px; }
  .intro { font-size: 16px; }
  .prose h2 { font-size: 23px; }
  .article-meta { font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* Full upstream question bank */
.bank-context { color: var(--muted); max-width: 78ch; margin: 0 0 32px; font-size: 14px; }
.topic-picker { display: flex; align-items: center; gap: 16px; margin: 18px 0 32px; }
.topic-picker label { font-size: 13px; color: var(--muted); flex-shrink: 0; }
.topic-picker select { min-width: 0; max-width: 100%; padding: 12px; color: var(--text); background: var(--surface); border: 1px solid #3f5675; border-radius: 4px; font: inherit; }
.bank-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 40px; align-items: start; }
.bank-toc { max-height: calc(100dvh - 120px); overflow-y: auto; scrollbar-width: thin; scrollbar-color: #3f5675 var(--bg); padding-right: 8px; }
.bank-toc a { display: flex; gap: 8px; justify-content: space-between; }
.bank-toc a span { color: var(--blue); font-size: 11px; font-variant-numeric: tabular-nums; }
.question-bank { min-width: 0; }
.question-section { scroll-margin-top: 90px; padding-bottom: 48px; }
.question-section-heading { display: flex; gap: 16px; align-items: baseline; justify-content: space-between; padding: 18px 0; border-top: 1px solid var(--line); }
.question-section h2 { color: #e6efff; font-size: 24px; font-weight: 600; line-height: 1.45; text-wrap: balance; }
.section-count { flex-shrink: 0; color: var(--muted); font: 11px var(--mono); }
.section-note { font-size: 14px; color: var(--muted); margin-bottom: 18px; overflow-wrap: anywhere; }
.question-item { margin-top: 10px; padding: 0; scroll-margin-top: 90px; }
.question-item summary { display: grid; grid-template-columns: 28px minmax(0, 1fr) 14px; align-items: baseline; gap: 12px; padding: 17px 18px; font-size: 14px; line-height: 1.8; color: var(--text); list-style: none; overflow-wrap: anywhere; }
.question-item summary::-webkit-details-marker { display: none; }
.question-item summary::after { content: '+'; color: var(--blue); font: 18px var(--mono); }
.question-item[open] summary::after { content: '-'; }
.question-item summary:hover { color: var(--blue); }
.question-number { font: 11px var(--mono); color: #8cc8db; font-variant-numeric: tabular-nums; }
.question-resources { padding: 0 18px 18px 58px; font-size: 13px; overflow-wrap: anywhere; }
.question-resources p { margin: 0 0 12px; }
.missing-answer { color: var(--muted); }
.question-permalink { display: inline-block; font-size: 11px; padding: 5px 0; }
.section-source { display: inline-block; font-size: 12px; margin-top: 20px; }
@media (max-width: 760px) {
  .bank-layout { grid-template-columns: 1fr; gap: 24px; }
  .bank-toc { display: none; }
  .topic-picker { align-items: stretch; flex-direction: column; gap: 8px; }
  .topic-picker select { width: 100%; font-size: 14px; }
}
@media (max-width: 480px) {
  .question-section-heading { flex-direction: column; gap: 8px; }
  .question-section h2 { font-size: 22px; }
  .question-item summary { padding: 14px 12px; gap: 8px; grid-template-columns: 22px minmax(0,1fr) 12px; }
  .question-resources { padding: 0 12px 16px 42px; }
  #result-count { white-space: normal; text-align: right; }
}

.question-resources .quick-answer { color: var(--text); font-size: 15px; line-height: 1.9; margin-bottom: 20px; }
.answer-reading { border-top: 1px solid var(--line); padding-top: 14px; margin-bottom: 12px; }
.answer-reading h3 { color: var(--muted); font-size: 12px; font-weight: 500; margin: 0 0 8px; }
.answer-reading p { font-size: 12px; }

/* Language navigation stays visible on narrow screens. */
.language-switcher { display: flex; gap: 4px; align-items: center; }
.language-switcher a { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 10px; border: 1px solid transparent; border-radius: 4px; font: 12px/1.5 'Noto Sans', 'Noto Sans JP', sans-serif; color: var(--muted); }
.language-switcher [aria-current='page'] { color: var(--blue); border-color: var(--line); background: var(--surface); }
html[lang='ja'] body { font-family: 'Noto Sans JP', 'Noto Sans', sans-serif; line-break: strict; }
@media (max-width: 760px) {
  nav { flex-wrap: wrap; gap: 8px 16px; }
  nav > .nav-links { margin-left: auto; }
  .language-switcher { flex-basis: 100%; justify-content: flex-end; }
  .language-switcher a { padding: 8px 12px; }
}
