/* SRE Learning · component styles (plain CSS; Tailwind CDN handles utilities) */
:root {
  --ink-950: #0a0f1f; --ink-900: #0f1629; --ink-850: #131b33; --ink-800: #18223f; --ink-700: #223056; --ink-600: #2d3d6b;
  --brand: #4b76ff; --brand-300: #9db8ff; --accent: #ff8a3d;
  --line: rgba(255, 255, 255, 0.07);
  --ring-track: 34 48 86;
  color-scheme: dark;
}
html, body { background: var(--ink-950); }
code, pre, textarea { font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Consolas, monospace; }
:not(pre) > code { font-size: .85em; background: rgba(75, 118, 255, .12); color: #c9d6ff; padding: .08em .35em; border-radius: 4px; }
a { color: inherit; }
::selection { background: rgba(75, 118, 255, .35); }
* { scrollbar-width: thin; scrollbar-color: #2d3d6b transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: #2d3d6b; border-radius: 9px; border: 2px solid transparent; background-clip: padding-box; }

/* header */
.app-header { height: 56px; display: flex; align-items: center; gap: .75rem; padding: 0 1rem; background: rgba(15, 22, 41, .92); border-bottom: 1px solid var(--line); backdrop-filter: blur(8px); position: relative; z-index: 30; }
.logo { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; font-weight: 800; color: #fff; background: linear-gradient(135deg, #4b76ff, #ff8a3d); flex-shrink: 0; }
.mode-pill { display: inline-flex; align-items: center; gap: .4rem; font-size: 12px; font-weight: 600; padding: .35rem .7rem; border-radius: 999px; background: var(--ink-800); border: 1px solid var(--line); color: #e2e8f0; }
.mode-pill:hover { border-color: rgba(157, 184, 255, .4); }
.dot { width: 8px; height: 8px; border-radius: 999px; display: inline-block; flex-shrink: 0; }

/* buttons */
.btn-primary, .btn-ghost, .btn-run { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font-weight: 600; border-radius: 10px; transition: background .15s, border-color .15s, transform .05s; white-space: nowrap; }
.btn-primary { background: var(--brand); color: #fff; padding: .65rem 1.1rem; box-shadow: 0 6px 20px -8px rgba(75, 118, 255, .8); }
.btn-primary:hover { background: #3659e0; }
.btn-ghost { background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .12); color: #e2e8f0; padding: .6rem 1rem; }
.btn-ghost:hover { background: rgba(255, 255, 255, .08); }
.btn-sm { padding: .4rem .75rem; font-size: 13px; }
.btn-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; color: #cbd5e1; background: transparent; border: 1px solid transparent; flex-shrink: 0; }
.btn-icon:hover { background: rgba(255, 255, 255, .06); border-color: var(--line); color: #fff; }
.btn-run { background: #16a34a; color: #fff; padding: .45rem .9rem; font-size: 13px; }
.btn-run:hover { background: #15803d; }
.btn-run.btn-stop { background: #dc2626; }
.btn-primary:active, .btn-ghost:active, .btn-run:active { transform: translateY(1px); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--brand-300); outline-offset: 2px; }

/* sidebar */
.sidebar { width: 292px; flex-shrink: 0; overflow-y: auto; background: var(--ink-900); border-right: 1px solid var(--line); }
.side-label { font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #64748b; padding: 1rem .6rem .4rem; }
.side-link { display: flex; align-items: center; gap: .55rem; padding: .42rem .6rem; border-radius: 8px; font-size: 13.5px; color: #cbd5e1; }
.side-link:hover { background: rgba(255, 255, 255, .04); color: #fff; }
.side-link.active { background: rgba(75, 118, 255, .16); color: #fff; box-shadow: inset 2px 0 0 var(--brand); }
.side-link .ico { width: 18px; text-align: center; font-size: 12px; flex-shrink: 0; }
.side-mod { margin-bottom: 2px; }
.side-mod > summary { list-style: none; display: flex; align-items: flex-start; gap: .6rem; padding: .55rem .6rem; border-radius: 9px; cursor: pointer; font-size: 13.5px; font-weight: 600; color: #cbd5e1; }
.side-mod > summary::-webkit-details-marker { display: none; }
.side-mod > summary:hover { background: rgba(255, 255, 255, .04); }
.side-mod .num { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; font-size: 11px; font-weight: 800; background: var(--ink-700); color: #c9d6ff; flex-shrink: 0; margin-top: 1px; }
.side-mod .num-done { background: rgba(52, 211, 153, .18); color: #34d399; }
.side-steps { padding: .15rem 0 .5rem 1.1rem; margin-left: .7rem; border-left: 1px solid var(--line); }
.side-sub { padding-left: .9rem; margin: .1rem 0 .3rem .55rem; border-left: 1px dashed var(--line); }
.side-sub .side-link { font-size: 12.5px; padding: .3rem .5rem; }
.stream-chip { display: inline-flex; align-items: center; gap: .3rem; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: .12rem .5rem; border-radius: 999px; color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); border: 1px solid color-mix(in srgb, var(--c) 35%, transparent); }
.guide-body { flex: 1; overflow-y: auto; padding: .8rem; display: grid; grid-auto-rows: max-content; gap: .75rem; align-content: start; } /* max-content: cards keep their height and the pane scrolls, instead of cards being squashed */
.guide-card { border: 1px solid var(--line); border-radius: 12px; background: var(--ink-850); overflow: hidden; }
.guide-hdr { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .5rem .75rem; font-size: 12.5px; font-weight: 600; color: #e2e8f0; border-bottom: 1px solid var(--line); background: rgba(0, 0, 0, .15); }
.guide-num { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; background: rgba(75, 118, 255, .18); color: #9db8ff; font-size: 11px; font-weight: 800; margin-right: .3rem; }
.guide-card pre.whitespace-pre-wrap { white-space: pre-wrap; word-break: break-word; }
.sidebar-scrim { display: none; }
@media (max-width: 1023px) {
  .sidebar { position: absolute; inset: 0 auto 0 0; z-index: 40; transform: translateX(-100%); transition: transform .2s ease; box-shadow: 20px 0 40px rgba(0, 0, 0, .4); max-width: 86vw; }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .sidebar-scrim { display: block; position: absolute; inset: 0; z-index: 35; background: rgba(0, 0, 0, .5); }
}

/* cards / content */
.card { background: var(--ink-850); border: 1px solid var(--line); border-radius: 14px; }
.card-hover { transition: border-color .15s, transform .15s, background .15s; }
.card-hover:hover { border-color: rgba(157, 184, 255, .35); background: var(--ink-800); transform: translateY(-1px); }
.card-title { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: #94a3b8; }
.section-title { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #94a3b8; margin: 0 0 .75rem; }
.hero { background: radial-gradient(1200px 400px at 0% 0%, rgba(75, 118, 255, .22), transparent 60%), radial-gradient(600px 300px at 100% 100%, rgba(255, 138, 61, .14), transparent 60%), var(--ink-850); border: 1px solid var(--line); }
.concept-ex { display: block; margin-top: .6rem; font-size: 11.5px !important; background: var(--ink-950) !important; color: #9db8ff !important; padding: .45rem .55rem !important; border-radius: 7px !important; white-space: pre-wrap; word-break: break-word; border: 1px solid var(--line); }
.tag { display: inline-flex; align-items: center; gap: .25rem; font-size: 11px; font-weight: 600; padding: .15rem .5rem; border-radius: 999px; background: rgba(255, 255, 255, .05); border: 1px solid var(--line); color: #cbd5e1; }
.tag-accent { background: rgba(255, 138, 61, .12); border-color: rgba(255, 138, 61, .3); color: #ffc49a; }
.src-link { color: #9db8ff; font-size: 14px; }
.src-link:hover { color: #fff; text-decoration: underline; }
.step-dot { width: 26px; height: 26px; border-radius: 999px; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--ink-700); color: #c9d6ff; flex-shrink: 0; }
.step-done { background: rgba(52, 211, 153, .18); color: #34d399; }
.quiz-opt { text-align: left; font-size: 14px; padding: .55rem .75rem; border-radius: 9px; background: rgba(255, 255, 255, .03); border: 1px solid var(--line); color: #e2e8f0; }
.quiz-opt:hover { border-color: rgba(157, 184, 255, .4); }
.quiz-right { border-color: rgba(52, 211, 153, .6); background: rgba(52, 211, 153, .1); }
.quiz-wrong { border-color: rgba(248, 113, 113, .6); background: rgba(248, 113, 113, .08); }
.work-card { background: linear-gradient(180deg, rgba(255, 138, 61, .07), transparent), var(--ink-850); border-color: rgba(255, 138, 61, .2); }
.task-list { counter-reset: t; display: grid; gap: .55rem; }
.task-list li { counter-increment: t; position: relative; padding-left: 2rem; color: #e2e8f0; line-height: 1.55; font-size: 14.5px; }
.task-list li::before { content: counter(t); position: absolute; left: 0; top: 1px; width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; font-size: 11px; font-weight: 800; background: rgba(75, 118, 255, .18); color: #9db8ff; }
.check-row { display: flex; gap: .55rem; align-items: flex-start; font-size: 14px; line-height: 1.45; }
.ck { width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; font-size: 12px; font-weight: 800; flex-shrink: 0; margin-top: 1px; }
.ck-pass { background: rgba(52, 211, 153, .18); color: #34d399; }
.ck-fail { background: rgba(248, 113, 113, .16); color: #f87171; }
.ck-pend { background: rgba(255, 255, 255, .05); color: #64748b; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.file { background: var(--ink-850); border: 1px solid var(--line); border-radius: 12px; }
.file > summary { cursor: pointer; padding: .6rem .8rem; font-size: 13px; font-family: 'JetBrains Mono', monospace; color: #e2e8f0; list-style: none; }
.file > summary::-webkit-details-marker { display: none; }
.file[open] > summary span:first-child { display: inline-block; transform: rotate(90deg); }
.file pre { margin: 0; padding: .75rem .9rem; font-size: 11.5px; line-height: 1.55; max-height: 320px; overflow: auto; border-top: 1px solid var(--line); color: #cbd5e1; white-space: pre; }
.data-table { font-size: 12px; border-collapse: collapse; width: 100%; }
.data-table th, .data-table td { padding: .3rem .5rem; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.data-table th { color: #94a3b8; font-weight: 600; }
.data-table td.text-right, .data-table th.text-right { text-align: right; }
.notice { font-size: 12.5px; line-height: 1.5; color: #cbd5e1; background: rgba(75, 118, 255, .08); border: 1px solid rgba(75, 118, 255, .25); border-radius: 10px; padding: .7rem .8rem; }

/* lab split pane */
.lab-grid { height: 100%; display: grid; grid-template-columns: var(--left, 44%) 6px minmax(0, 1fr); }
.lab-left { overflow-y: auto; min-width: 0; background: var(--ink-950); }
.lab-handle { cursor: col-resize; background: var(--ink-900); border-left: 1px solid var(--line); border-right: 1px solid var(--line); touch-action: none; }
.lab-handle:hover, body.resizing .lab-handle { background: rgba(75, 118, 255, .35); }
body.resizing { user-select: none; cursor: col-resize; }
.lab-right { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--ink-900); }
.pill { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--ink-800); border: 1px solid var(--line); color: #94a3b8; }
.pill:hover { color: #fff; }
.pill-done { color: #34d399; border-color: rgba(52, 211, 153, .35); }
.pill-active { background: var(--brand); border-color: var(--brand); color: #fff; }
.pg-toolbar { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .5rem .6rem; border-bottom: 1px solid var(--line); background: var(--ink-850); flex-wrap: wrap; }
.tabs { display: flex; gap: 2px; background: var(--ink-950); padding: 3px; border-radius: 9px; border: 1px solid var(--line); }
.tab { font-size: 12.5px; font-weight: 600; padding: .3rem .65rem; border-radius: 7px; color: #94a3b8; }
.tab:hover { color: #fff; }
.tab-active { background: var(--ink-700); color: #fff; }
.pg-editor { flex: 1 1 46%; min-height: 180px; position: relative; display: flex; }
.pg-editor textarea, .pg-editor pre { flex: 1; margin: 0; width: 100%; resize: none; border: 0; outline: none; background: var(--ink-950); color: #dbe4ff; font-size: 12.5px; line-height: 1.6; padding: .9rem 1rem; tab-size: 2; overflow: auto; white-space: pre; }
.pg-editor textarea:focus-visible { outline: none; box-shadow: inset 0 0 0 1px rgba(157, 184, 255, .35); }
.pg-opts { display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; padding: .45rem .8rem; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--ink-850); font-size: 12.5px; }
.opt { display: inline-flex; align-items: center; gap: .4rem; color: #cbd5e1; cursor: pointer; }
.opt-warn { color: #fcd34d; }
.opt-mode { margin-left: auto; display: inline-flex; align-items: center; gap: .4rem; color: #94a3b8; font-size: 12px; }
.opt-mode:hover { color: #fff; }
.pg-out { flex: 1 1 54%; min-height: 200px; display: flex; flex-direction: column; min-width: 0; }
.pg-out-bar { display: flex; align-items: center; gap: .75rem; justify-content: space-between; padding: .45rem .6rem; }
.out-body { flex: 1; overflow-y: auto; padding: .3rem .8rem 1.2rem; min-height: 0; }
.empty { text-align: center; padding: 2.5rem 1rem; color: #64748b; }
.turn { border: 1px solid var(--line); border-radius: 12px; background: var(--ink-850); margin-bottom: .7rem; overflow: hidden; }
.turn-tools { background: rgba(52, 211, 153, .04); border-color: rgba(52, 211, 153, .18); }
.turn-hdr { display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; font-size: 11.5px; color: #94a3b8; padding: .45rem .75rem; border-bottom: 1px solid var(--line); background: rgba(0, 0, 0, .15); }
.turn > .md, .turn > .blk, .turn > details { margin: .6rem .75rem; }
.streaming { color: #fcd34d; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .45; } }
.blk { border-radius: 9px; border: 1px solid var(--line); background: rgba(0, 0, 0, .18); padding: .55rem .7rem; font-size: 13.5px; margin-bottom: .6rem; }
.blk pre { margin: .35rem 0 0; font-size: 11.5px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; color: #cbd5e1; max-height: 300px; overflow: auto; }
.blk-hdr { font-size: 12px; color: #cbd5e1; }
.blk-think { border-color: rgba(167, 139, 250, .3); background: rgba(167, 139, 250, .07); }
.blk-think > summary { cursor: pointer; font-size: 12.5px; font-weight: 600; color: #c4b5fd; }
.blk-think .md { margin-top: .4rem; color: #ddd6fe; }
.blk-tool { border-color: rgba(251, 191, 36, .3); background: rgba(251, 191, 36, .06); }
.blk-result { border-color: rgba(52, 211, 153, .25); background: rgba(52, 211, 153, .05); }
.blk-err { border-color: rgba(248, 113, 113, .45); background: rgba(248, 113, 113, .08); color: #fecaca; }
.notes { font-size: 12px; color: #9db8ff; background: rgba(75, 118, 255, .07); border: 1px solid rgba(75, 118, 255, .2); border-radius: 9px; padding: .45rem .65rem; margin-bottom: .6rem; display: grid; gap: .15rem; }
.raw { font-size: 11.5px; line-height: 1.5; color: #cbd5e1; white-space: pre-wrap; word-break: break-word; }
.cite { color: #9db8ff; cursor: help; font-weight: 700; margin-left: 1px; }
.cite-list { margin-top: .6rem; padding-top: .5rem; border-top: 1px dashed var(--line); font-size: 12px; color: #94a3b8; display: grid; gap: .2rem; }

/* markdown from the model */
.md { font-size: 14px; line-height: 1.65; color: #e2e8f0; overflow-wrap: anywhere; }
.md > * + * { margin-top: .6rem; }
.md h3, .md h4, .md h5, .md h6 { font-weight: 700; color: #fff; margin-top: .9rem; }
.md h3 { font-size: 1.05rem; } .md h4 { font-size: .98rem; }
.md ul { list-style: disc; padding-left: 1.3rem; } .md ol { list-style: decimal; padding-left: 1.4rem; }
.md li + li { margin-top: .2rem; }
.md strong { color: #fff; }
.md pre { background: var(--ink-950); border: 1px solid var(--line); border-radius: 9px; padding: .65rem .8rem; overflow-x: auto; font-size: 12px; line-height: 1.55; }
.md pre code { background: none; padding: 0; color: #dbe4ff; font-size: inherit; }
.md table { border-collapse: collapse; font-size: 13px; }
.md th, .md td { border: 1px solid var(--line); padding: .3rem .55rem; text-align: left; }
.md th { background: rgba(255, 255, 255, .04); }

/* deploy page */
.dep-step { display: flex; gap: .9rem; }
.dep-num { min-width: 30px; height: 30px; padding: 0 .4rem; border-radius: 9px; display: grid; place-items: center; font-size: 12px; font-weight: 800; background: rgba(75, 118, 255, .18); color: #9db8ff; flex-shrink: 0; }
.codeblock { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--ink-950); }
.codeblock-bar { display: flex; justify-content: space-between; align-items: center; padding: .3rem .4rem .3rem .75rem; font-size: 11px; color: #64748b; border-bottom: 1px solid var(--line); }
.codeblock pre { margin: 0; padding: .7rem .85rem; font-size: 12.5px; line-height: 1.6; color: #dbe4ff; overflow-x: auto; white-space: pre; }
.btn-copy { font-size: 11.5px; font-weight: 600; color: #cbd5e1; padding: .2rem .55rem; border-radius: 6px; border: 1px solid var(--line); }
.btn-copy:hover { color: #fff; background: rgba(255, 255, 255, .06); }

/* modal */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(4, 7, 16, .72); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 1rem; }
.modal[hidden] { display: none; }
.modal-card { width: 100%; max-width: 560px; max-height: calc(100vh - 2rem); overflow-y: auto; background: var(--ink-850); border: 1px solid rgba(255, 255, 255, .1); border-radius: 16px; padding: 1.25rem; box-shadow: 0 30px 80px rgba(0, 0, 0, .5); }
.field-label { display: block; font-size: 12.5px; font-weight: 600; color: #cbd5e1; margin-bottom: .35rem; }
.field { width: 100%; background: var(--ink-950); border: 1px solid rgba(255, 255, 255, .12); border-radius: 9px; padding: .55rem .7rem; font-size: 14px; color: #fff; }
.field:focus { border-color: var(--brand); outline: none; }

/* responsive lab: stack panes on small screens */
@media (max-width: 1023px) {
  .lab-grid { display: block; overflow-y: auto; }
  .lab-handle { display: none; }
  .lab-left { overflow: visible; }
  .lab-right { border-top: 1px solid var(--line); min-height: 100vh; }
  .pg-editor { min-height: 300px; flex: none; height: 44vh; }
  .pg-out { flex: none; min-height: 60vh; }
  .out-body { overflow: visible; }
}

/* handbook */
.handbook p { color: #cbd5e1; line-height: 1.7; margin: .6rem 0; font-size: 15px; }
.hb-sec { margin-bottom: 2.5rem; scroll-margin-top: 1rem; }
.hb-sec h2 { font-size: 1.3rem; font-weight: 800; color: #fff; margin-bottom: .75rem; padding-bottom: .4rem; border-bottom: 1px solid var(--line); }
.hb-fig { margin: 1.25rem 0; padding: 1rem; background: var(--ink-900); border: 1px solid var(--line); border-radius: 14px; overflow-x: auto; }
.hb-fig svg { min-width: 680px; font-family: Inter, system-ui, sans-serif; }
.hb-fig figcaption { font-size: 12px; color: #94a3b8; margin-top: .5rem; text-align: center; }
.hb-list { display: grid; gap: .5rem; color: #cbd5e1; font-size: 15px; line-height: 1.6; padding-left: 1.2rem; list-style: disc; }
.handbook .data-table td.whitespace-normal { white-space: normal; }
@media print {
  .app-header, .sidebar, .sidebar-scrim, .no-print, #toast { display: none !important; }
  html, body, #view, #scroller { height: auto !important; overflow: visible !important; background: #fff !important; }
  .handbook, .handbook p, .handbook li, .handbook td, .handbook th { color: #111 !important; }
  .handbook h1, .handbook h2, .handbook .text-white, .handbook b { color: #000 !important; }
  .handbook .card { background: #fff !important; border-color: #ccc !important; break-inside: avoid; }
  .hb-fig { background: #0f1629 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; break-inside: avoid; }
}

/* sign-in gate */
body.locked #shell { visibility: hidden; }
.gate { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 1rem; background: radial-gradient(900px 400px at 10% 0%, rgba(75,118,255,.18), transparent 60%), radial-gradient(600px 300px at 100% 100%, rgba(255,138,61,.12), transparent 60%), var(--ink-950); }
.gate[hidden] { display: none; }
.gate-card { width: 100%; max-width: 420px; background: var(--ink-850); border: 1px solid rgba(255,255,255,.1); border-radius: 18px; padding: 1.5rem; box-shadow: 0 30px 80px rgba(0,0,0,.5); }
.gate .tabs { display: grid; grid-template-columns: 1fr 1fr; }
.gate .tab { text-align: center; padding: .45rem; }
