
@import url("https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;600&display=swap");

/* Brand accent (Shibuya's blue scale, pulled toward the portal's #2563eb) */
:root[data-accent-color] { --accent-9: #2563eb; --accent-10: #1d4ed8; --accent-11: #1d4ed8; --accent-a10: #1d4ed8; }
html.dark[data-accent-color] { --accent-9: #3b82f6; --accent-10: #60a5fa; --accent-11: #93c5fd; --accent-a10: #93c5fd; }
:root { --sy-f-text: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
        --sy-f-heading: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
        --sy-f-mono: "JetBrains Mono", SFMono-Regular, Menlo, Consolas, monospace; }

/* Announcement bar */
.announcement { background: linear-gradient(90deg, #1e3a8a, #2563eb); color: #fff; font-size: .9rem; }
.announcement a { color: #fff; font-weight: 600; text-decoration: none; }
.announcement a:hover { text-decoration: underline; }

/* Header brand */
.sy-head-brand img { border-radius: 50%; }
.sy-head-brand strong { font-weight: 800; letter-spacing: -0.01em; }

/* Reading comfort */
.yue { font-size: 1.0625rem; line-height: 1.8; }
.yue p { margin: 0 0 1.15em; }
.yue li + li { margin-top: .4em; }
.yue h1 { font-weight: 800; letter-spacing: -0.02em; }
.yue h1::after { content: ""; display: block; width: 64px; height: 4px; margin-top: .7rem; border-radius: 4px;
  background: linear-gradient(90deg, #2563eb, #38bdf8); }
.yue h2 { font-weight: 700; margin-top: 2.6rem; }
.yue h3 { font-weight: 650; margin-top: 2rem; }
.yue img { border-radius: 10px; }
.yue div[class*="highlight-"] { margin: 1.3em 0 1.5em; }
.yue mark { border-radius: 4px; padding: 0 .2em; }

/* Course diagrams: inline SVG coloured from theme variables, so they follow light/dark mode */
figure.diagram { margin: 1.75rem 0; padding: 1rem; border-radius: 14px; border: 1px solid var(--sy-c-border);
  background: var(--sy-c-background); overflow-x: auto; }
figure.diagram svg { display: block; width: 100%; height: auto; min-width: 520px; margin: 0 auto; }
figure.diagram figcaption { margin-top: .6rem; font-size: .9rem; color: var(--sy-c-light); text-align: center; }
.dg text { fill: var(--sy-c-text); font-family: var(--sy-f-text); font-size: 15px; }
.dg text.small { font-size: 13px; fill: var(--sy-c-light); }
.dg text.bold { font-weight: 700; }
.dg text.code { font-family: var(--sy-f-mono); font-size: 14px; }
.dg text.title { font-size: 14px; font-weight: 700; letter-spacing: .04em; fill: var(--sy-c-light); }
.dg .box { fill: var(--sy-c-surface); stroke: var(--sy-c-border); stroke-width: 1.5; }
.dg .blue { fill: rgba(37, 99, 235, .10); stroke: #2563eb; stroke-width: 1.5; }
.dg .green { fill: rgba(16, 185, 129, .12); stroke: #10b981; stroke-width: 1.5; }
.dg .amber { fill: rgba(245, 158, 11, .14); stroke: #f59e0b; stroke-width: 1.5; }
.dg .red { fill: rgba(239, 68, 68, .10); stroke: #ef4444; stroke-width: 1.5; }
.dg .purple { fill: rgba(139, 92, 246, .12); stroke: #8b5cf6; stroke-width: 1.5; }
.dg .ghost { fill: none; stroke: var(--sy-c-border); stroke-width: 1.5; stroke-dasharray: 6 5; }
.dg .bar { fill: #2563eb; } .dg .bar.dim { fill: var(--sy-c-border); } .dg .bar.green { fill: #10b981; stroke: none; }
.dg .bar.amber { fill: #f59e0b; stroke: none; }
.dg .arrow { fill: none; stroke: var(--sy-c-light); stroke-width: 1.8; }
.dg .arrow.dashed { stroke-dasharray: 6 5; }
.dg .arrow.blue { stroke: #2563eb; fill: none; } .dg .arrow.green { stroke: #10b981; fill: none; }
.dg .arrow.red { stroke: #ef4444; fill: none; }
.dg .head { fill: var(--sy-c-light); } .dg .head.blue { fill: #2563eb; stroke: none; }
.dg .head.green { fill: #10b981; stroke: none; } .dg .head.red { fill: #ef4444; stroke: none; }
.dg .line { stroke: var(--sy-c-border); stroke-width: 1.5; } .dg .line.cut { stroke: #ef4444; stroke-width: 2; stroke-dasharray: 5 4; }
.dg .circle-a { fill: rgba(37, 99, 235, .12); stroke: #2563eb; stroke-width: 1.5; }
.dg .circle-b { fill: rgba(16, 185, 129, .12); stroke: #10b981; stroke-width: 1.5; }

/* Imported GitBook content: video embeds and collapsible solutions */
.video-embed { position: relative; aspect-ratio: 16 / 9; margin: 1.25rem 0; border-radius: 12px; overflow: hidden;
  background: #000; box-shadow: 0 10px 30px rgba(15, 27, 51, .18); }
.video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
details.solution { margin: .75rem 0 1.75rem; border: 1px solid var(--sy-c-border); border-radius: 10px; background: var(--sy-c-surface); }
details.solution > summary { cursor: pointer; padding: .6rem 1rem; font-weight: 600; color: var(--sy-c-link); }
details.solution > summary::before { content: "💡 Show "; }
details.solution[open] > summary::before { content: "💡 "; }
details.solution[open] > summary { border-bottom: 1px solid var(--sy-c-border); }
details.solution > :not(summary) { margin-left: 1rem; margin-right: 1rem; }
details.source { margin: .6rem 0; border: 1px solid var(--sy-c-border); border-radius: 10px; background: var(--sy-c-surface); }
details.source > summary { cursor: pointer; padding: .55rem 1rem; font-weight: 600; font-family: var(--sy-f-mono); font-size: .9rem;
  color: var(--sy-c-text); }
details.source > summary::before { content: "📄 "; }
details.source[open] > summary { border-bottom: 1px solid var(--sy-c-border); }
details.source > :not(summary) { margin: .5rem .75rem; }

/* Chapter completion (progress.js) */
.page-progress { margin: 2.5rem 0 1rem; padding: 1.1rem 1.25rem; border-radius: 14px; display: flex; align-items: center;
  justify-content: space-between; gap: 1rem; flex-wrap: wrap; border: 1px solid var(--sy-c-border); background: var(--sy-c-surface); }
.page-progress.is-done { border-color: rgba(16, 185, 129, .45); background: rgba(16, 185, 129, .08); }
.page-progress .pp-text strong { display: block; font-size: 1rem; color: var(--sy-c-heading); }
.page-progress .pp-text span { font-size: .88rem; color: var(--sy-c-light); }
.page-progress .pp-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.pp-btn { font: inherit; font-weight: 700; font-size: .92rem; cursor: pointer; padding: .55rem 1rem; border-radius: 10px; border: 0;
  background: linear-gradient(135deg, #2563eb, #1d4ed8); color: #fff !important; text-decoration: none !important; display: inline-block; }
.pp-btn:hover { filter: brightness(1.05); }
.pp-btn[disabled] { opacity: .6; cursor: wait; }
.pp-btn.ghost { background: transparent; color: var(--sy-c-light) !important; border: 1px solid var(--sy-c-border); font-weight: 600; }
.pp-btn.next { background: #10b981; }
.done-chip { display: inline-flex; align-items: center; gap: .35rem; margin: -.25rem .4rem 1rem 0; padding: .3rem .8rem; border-radius: 999px;
  font-size: .85rem; font-weight: 600; background: rgba(16, 185, 129, .12); color: #059669; border: 1px solid rgba(16, 185, 129, .35); }
.globaltoc a.reference.is-done::after { content: "✓"; margin-left: .4rem; font-weight: 800; color: #10b981; }
.sidebar-progress { margin: 0 0 1.25rem; padding: .75rem .9rem; border-radius: 12px; font-size: .82rem; font-weight: 600;
  color: var(--sy-c-text); background: var(--sy-c-surface); border: 1px solid var(--sy-c-border); }
.sidebar-progress .bar { height: 6px; border-radius: 999px; background: var(--sy-c-border); overflow: hidden; margin-top: .45rem; }
.sidebar-progress .bar span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #2563eb, #10b981); }

/* Quiz card injected by quiz.js */
.quiz-chip { display: inline-flex; align-items: center; gap: .4rem; margin: -.25rem 0 1rem; padding: .3rem .8rem; border-radius: 999px;
  font-size: .85rem; font-weight: 600; text-decoration: none !important; background: var(--accent-a3, rgba(37, 99, 235, .1));
  color: var(--sy-c-link); border: 1px solid var(--sy-c-border); }
.quiz-chip:hover { border-color: var(--sy-c-link); }
.quiz-card { margin: 2.5rem 0 1rem; padding: 1.4rem 1.5rem; border-radius: 16px; color: #fff;
  background: linear-gradient(120deg, #1e3a8a 0%, #2563eb 60%, #38bdf8 100%); box-shadow: 0 14px 40px rgba(30, 58, 138, .25); }
.quiz-card h2 { margin: 0 0 .25rem !important; padding: 0 !important; border: 0 !important; color: #fff !important; font-size: 1.3rem; }
.quiz-card > p { margin: 0 0 1rem; opacity: .9; }
.quiz-card .quiz-item { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: .8rem 1rem; border-radius: 12px; background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .2); }
.quiz-card .quiz-item + .quiz-item { margin-top: .6rem; }
.quiz-card .quiz-item strong { display: block; color: #fff; }
.quiz-card .quiz-item small { opacity: .85; }
.quiz-card .quiz-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.quiz-card a.quiz-btn { display: inline-block; padding: .5rem 1rem; border-radius: 10px; font-weight: 700; text-decoration: none;
  background: #fff; color: #1d4ed8 !important; }
.quiz-card a.quiz-btn.ghost { background: transparent; color: #fff !important; border: 1px solid rgba(255, 255, 255, .5); }
.quiz-card a.quiz-btn:hover { filter: brightness(.95); }
.quiz-card .quiz-all { display: inline-block; margin-top: .9rem; color: #fff !important; font-size: .9rem; opacity: .9; }

/* Private notes (notes.js) */
.pn-fab { position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 60; display: inline-flex; align-items: center; gap: .45rem;
  font: inherit; font-weight: 700; font-size: .92rem; padding: .65rem 1rem; border-radius: 999px; border: 0; cursor: pointer;
  color: #fff; background: linear-gradient(135deg, #2563eb, #1d4ed8); box-shadow: 0 10px 28px rgba(29, 78, 216, .35); }
.pn-fab:hover { filter: brightness(1.06); }
.pn-fab .pn-count { min-width: 1.4rem; padding: 0 .35rem; border-radius: 999px; background: #fff; color: #1d4ed8; font-size: .78rem; text-align: center; }
.pn-drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 70; width: min(420px, 100vw); display: flex; flex-direction: column;
  background: var(--sy-c-background); color: var(--sy-c-text); border-left: 1px solid var(--sy-c-border);
  box-shadow: -18px 0 50px rgba(15, 23, 42, .18); }
.pn-drawer[hidden] { display: none; }
.pn-head { display: flex; align-items: center; justify-content: space-between; padding: .9rem 1.1rem; border-bottom: 1px solid var(--sy-c-border); }
.pn-head strong { color: var(--sy-c-heading); }
.pn-close { font-size: 1.5rem; line-height: 1; background: none; border: 0; cursor: pointer; color: var(--sy-c-light); padding: .2rem .4rem; }
.pn-composer { padding: .9rem 1.1rem; border-bottom: 1px solid var(--sy-c-border); }
.pn-drawer textarea { width: 100%; box-sizing: border-box; font: inherit; font-size: .93rem; padding: .6rem .7rem; border-radius: 10px; resize: vertical;
  color: var(--sy-c-text); background: var(--sy-c-surface); border: 1px solid var(--sy-c-border); }
.pn-drawer textarea:focus { outline: 2px solid #2563eb; outline-offset: 1px; }
.pn-row { display: flex; align-items: center; justify-content: flex-end; gap: .6rem; margin-top: .5rem; flex-wrap: wrap; }
.pn-status { margin-right: auto; font-size: .82rem; color: var(--sy-c-light); }
.pn-btn { font: inherit; font-weight: 700; font-size: .88rem; padding: .45rem .9rem; border-radius: 9px; border: 0; cursor: pointer;
  color: #fff; background: linear-gradient(135deg, #2563eb, #1d4ed8); }
.pn-btn[disabled] { opacity: .6; cursor: wait; }
.pn-link { font: inherit; font-size: .8rem; background: none; border: 0; padding: 0; cursor: pointer; color: var(--sy-c-link); }
.pn-link.danger { color: #dc2626; }
.pn-quote-pending { margin-bottom: .6rem; }
.pn-quote-pending small { display: block; font-size: .78rem; color: var(--sy-c-light); margin: .25rem 0; }
.pn-drawer blockquote { margin: 0 0 .5rem; padding: .4rem .7rem; border-left: 3px solid #2563eb; border-radius: 0 8px 8px 0;
  background: rgba(37, 99, 235, .08); font-size: .86rem; white-space: pre-wrap; max-height: 9rem; overflow: auto; }
.pn-list { flex: 1; overflow-y: auto; padding: .9rem 1.1rem; display: flex; flex-direction: column; gap: .7rem; }
.pn-note { padding: .75rem .85rem; border-radius: 12px; border: 1px solid var(--sy-c-border); background: var(--sy-c-surface); transition: box-shadow .3s; }
.pn-note.pn-flash { box-shadow: 0 0 0 3px rgba(37, 99, 235, .45); }
.pn-body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .93rem; }
.pn-meta { display: flex; flex-wrap: wrap; gap: .3rem .8rem; align-items: center; margin-top: .5rem; font-size: .78rem; color: var(--sy-c-light); }
.pn-meta a { color: var(--sy-c-link); }
.pn-empty { font-size: .9rem; color: var(--sy-c-light); }
.pn-foot { padding: .75rem 1.1rem; border-top: 1px solid var(--sy-c-border); font-size: .88rem; font-weight: 600; }
.pn-select { position: absolute; z-index: 65; font: inherit; font-size: .82rem; font-weight: 700; padding: .35rem .7rem; border-radius: 999px;
  border: 0; cursor: pointer; color: #fff; background: #1d4ed8; box-shadow: 0 6px 18px rgba(29, 78, 216, .35); }
.pn-select[hidden] { display: none; }
.pn-marker { margin-left: .5rem; vertical-align: middle; font: inherit; font-size: .72rem; font-weight: 700; padding: .1rem .5rem;
  border-radius: 999px; cursor: pointer; color: var(--sy-c-link); background: rgba(37, 99, 235, .1); border: 1px solid rgba(37, 99, 235, .3); }
@media (max-width: 640px) {
  .pn-drawer { top: auto; height: 78vh; width: 100vw; border-left: 0; border-top: 1px solid var(--sy-c-border); border-radius: 16px 16px 0 0; }
  .pn-fab { right: .9rem; bottom: .9rem; }
}
@media print { .pn-fab, .pn-drawer, .pn-select, .pn-marker { display: none !important; } }

/* Footer social icons (inline SVG, no third-party icon service) */
.portal-socials { display: flex; gap: .75rem; align-items: center; }
.portal-socials a { color: var(--sy-c-foot-text, var(--sy-c-light)); display: inline-flex; }
.portal-socials a:hover { color: var(--sy-c-link); }
.portal-socials svg { width: 20px; height: 20px; }
