:root {
  --primary: #156b76;
  --primary-dark: #0d4b55;
  --primary-soft: #e4f5f5;
  --accent: #d38a16;
  --accent-soft: #fff6dd;
  --bg: #eef4f6;
  --paper: #ffffff;
  --line: #ccdae0;
  --text: #17252d;
  --muted: #586b75;
  --ok: #137052;
  --ok-soft: #e8f7f0;
  --warn: #875b08;
  --warn-soft: #fff7df;
  --danger: #a13b33;
  --danger-soft: #fff0ee;
  --shadow: 0 10px 28px rgba(15, 48, 56, .10);
}

* { box-sizing: border-box; }
html { scroll-behavior: auto; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); font-family: "Segoe UI", Arial, sans-serif; font-size: 16px; line-height: 1.6; }
button, input, textarea { font: inherit; }
a { color: #075f70; }
a:hover { color: var(--primary-dark); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #f4ad2d; outline-offset: 3px; }

.site-header { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 20px; background: #125c68; color: #fff; box-shadow: 0 2px 12px rgba(8, 31, 37, .24); }
.site-header strong { font-size: .84rem; white-space: nowrap; }
.module-back, .pill-button { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid rgba(255,255,255,.4); border-radius: 999px; padding: 7px 11px; color: #fff; background: rgba(255,255,255,.12); text-decoration: none; font-size: .82rem; font-weight: 800; line-height: 1.2; }
.module-back:hover, .pill-button:hover { background: rgba(255,255,255,.22); color: #fff; }

.portal-main { width: min(1160px, calc(100% - 32px)); margin: 0 auto; padding: 36px 0 48px; }
.portal-heading { position: relative; overflow: hidden; padding: 28px 30px; border: 1px solid #bfd1d6; border-radius: 20px; background: linear-gradient(135deg, #fff 0%, #f3fbfb 64%, #fff6df 100%); box-shadow: var(--shadow); }
.portal-heading::after { content: "MbB"; position: absolute; right: 22px; bottom: 15px; color: rgba(21,107,118,.10); font-size: clamp(28px, 5vw, 62px); font-weight: 900; letter-spacing: -.08em; pointer-events: none; }
.eyebrow, .unit-name { display: inline-block; color: var(--primary-dark); font-size: .72rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.portal-heading h1 { position: relative; z-index: 1; max-width: 850px; margin: 7px 0 10px; color: var(--primary-dark); font-size: clamp(1.75rem, 3.6vw, 3rem); line-height: 1.08; letter-spacing: -.035em; }
.portal-heading p { position: relative; z-index: 1; max-width: 780px; margin: 0; color: #314b55; }

.module-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 22px; }
.module-card { min-width: 0; min-height: 245px; display: flex; flex-direction: column; padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); color: inherit; text-decoration: none; box-shadow: 0 6px 18px rgba(20,55,64,.07); }
.module-card.available { border-top: 5px solid var(--primary); transition: transform .16s ease, box-shadow .16s ease; }
.module-card.available:hover { transform: translateY(-3px); color: inherit; box-shadow: var(--shadow); }
.module-card.planned { background: #f8fafb; color: #63737a; }
.module-card h2 { margin: 14px 0 9px; color: var(--primary-dark); font-size: 1.2rem; line-height: 1.25; }
.module-card.planned h2 { color: #53666f; }
.module-card p { margin: 0; font-size: .9rem; line-height: 1.5; }
.status { align-self: flex-start; border: 1px solid #d2dce0; border-radius: 999px; padding: 4px 9px; background: #f1f4f5; color: #607078; font-size: .68rem; font-weight: 900; text-transform: uppercase; letter-spacing: .05em; }
.status.ready { border-color: #9bd4c0; background: var(--ok-soft); color: var(--ok); }
.card-action { margin-top: auto; padding-top: 16px; color: var(--primary); font-size: .84rem; font-weight: 900; }

.method-card { display: grid; grid-template-columns: .8fr 2.2fr; align-items: center; gap: 24px; margin-top: 20px; padding: 20px; border: 1px solid #bfd1d6; border-radius: 16px; background: #fff; }
.method-card h2 { margin: 4px 0 0; color: var(--primary-dark); font-size: 1.25rem; }
.method-flow { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; counter-reset: flow; }
.method-flow li { position: relative; min-height: 88px; padding: 13px; border: 1px solid #c9d9dc; border-radius: 12px; background: var(--primary-soft); }
.method-flow li:not(:last-child)::after { content: "→"; position: absolute; right: -10px; top: 33px; z-index: 2; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--primary); color: #fff; font-size: .72rem; }
.method-flow strong, .method-flow span { display: block; }
.method-flow strong { color: var(--primary-dark); }
.method-flow span { margin-top: 3px; color: #4e626a; font-size: .77rem; line-height: 1.35; }

.course-toolbar { position: sticky; top: 0; z-index: 30; min-height: 54px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 16px; background: #125c68; box-shadow: 0 2px 10px rgba(8,31,37,.23); }
.pill-button { cursor: pointer; }
.module-pill { color: #dff8f7; font-size: .8rem; font-weight: 800; }
.menu-toggle { border-color: rgba(255,255,255,.4); }
.menu-backdrop { position: fixed; inset: 0; z-index: 39; background: rgba(7,25,30,.55); }
.lesson-menu { position: fixed; top: 0; right: 0; z-index: 40; width: min(390px, 92vw); height: 100dvh; overflow-y: auto; padding: 14px; background: #f6fafb; box-shadow: -12px 0 30px rgba(7,25,30,.25); transform: translateX(105%); transition: transform .2s ease; }
.lesson-menu.open { transform: translateX(0); }
.drawer-heading { position: sticky; top: 0; z-index: 2; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 12px 11px 15px; border-bottom: 1px solid var(--line); background: #f6fafb; }
.drawer-heading strong, .drawer-heading span { display: block; }
.drawer-heading strong { color: var(--primary-dark); }
.drawer-heading span { color: var(--muted); font-size: .78rem; }
.drawer-close { min-width: 42px; min-height: 42px; border: 1px solid #abc4ca; border-radius: 50%; background: #fff; color: var(--primary-dark); font-size: 1.45rem; line-height: 1; cursor: pointer; }
.drawer-close:hover { background: var(--primary-soft); }
.menu-section { margin: 13px 7px 3px; padding: 8px 5px 5px; border-bottom: 1px solid #b8ccd1; color: var(--primary-dark); font-size: .69rem; font-weight: 900; letter-spacing: .045em; text-transform: uppercase; }
.menu-item { width: 100%; display: grid; grid-template-columns: 38px 1fr; align-items: center; gap: 9px; margin-top: 6px; padding: 9px; border: 1px solid transparent; border-radius: 10px; background: transparent; color: #284048; text-align: left; cursor: pointer; }
.menu-item:hover { background: #e7f3f4; }
.menu-item.active { border-color: #8dc1c6; background: var(--primary-soft); color: var(--primary-dark); font-weight: 800; }
.menu-number { display: grid; place-items: center; min-height: 32px; border-radius: 8px; background: #d9eaec; color: var(--primary-dark); font-size: .78rem; font-weight: 900; }
body.drawer-open { overflow: hidden; }

.content-area { width: min(960px, calc(100% - 28px)); margin: 0 auto; padding: 30px 0 48px; }
.lesson-heading { display: grid; grid-template-columns: 1.5fr .85fr; align-items: end; gap: 24px; margin-bottom: 16px; padding: 0 8px; }
.technical-title { margin-top: 3px; color: var(--accent); font-size: .78rem; font-weight: 800; }
.lesson-heading h1 { margin: 5px 0 0; color: var(--primary-dark); font-size: clamp(1.65rem, 4vw, 2.55rem); line-height: 1.08; letter-spacing: -.03em; }
.lesson-objective { margin: 0; padding-left: 14px; border-left: 4px solid var(--accent); color: #475d66; font-size: .9rem; line-height: 1.45; }
.lesson-content { overflow: hidden; padding: clamp(18px, 3.4vw, 36px); border: 1px solid var(--line); border-radius: 17px; background: var(--paper); box-shadow: var(--shadow); }
.lesson-content h2 { margin: 0 0 8px; color: var(--primary-dark); font-size: clamp(1.25rem, 2.7vw, 1.75rem); line-height: 1.2; }
.lesson-content h3 { margin: 26px 0 10px; color: var(--primary-dark); font-size: 1.15rem; line-height: 1.25; }
.lesson-content p { margin: 8px 0; }
.lesson-content ul, .lesson-content ol { padding-left: 1.35rem; }
.lesson-content li { margin: 6px 0; }
.lesson-content code { border-radius: 5px; padding: 1px 5px; background: #edf2f4; color: #0b5360; font: .88em Consolas, "Courier New", monospace; overflow-wrap: anywhere; }
.lesson-content kbd { border: 1px solid #aebfc4; border-bottom-width: 3px; border-radius: 5px; padding: 1px 6px; background: #f7fafb; color: #233a42; font: .82em Consolas, "Courier New", monospace; }

.story-opening { margin: 0 0 24px; padding: 20px; border-left: 5px solid var(--accent); border-radius: 4px 14px 14px 4px; background: linear-gradient(135deg, #fff8e6, #fff); }
.story-opening .eyebrow { color: #805509; }
.story-opening p { color: #374e57; }
.decision-box, .task-box, .evidence-box, .note-box, .danger-box, .bridge-box, .template-box, .checkpoint, .check-card { margin: 16px 0; padding: 16px; border: 1px solid var(--line); border-radius: 12px; }
.decision-box { border-color: #e4c46e; background: var(--accent-soft); }
.decision-box h3, .checkpoint h3 { margin-top: 0; }
.task-box { border-left: 5px solid var(--primary); background: #f6fbfb; }
.task-box > strong { color: var(--primary-dark); }
.evidence-box { border-color: #91cdb7; background: var(--ok-soft); }
.note-box { background: #f5f8f9; }
.danger-box { border-color: #e3aaa5; background: var(--danger-soft); color: #702d27; }
.bridge-box { border-color: #b8c7d9; background: #eef4fb; }
.bridge-box strong, .evidence-box strong, .note-box strong, .danger-box strong { color: var(--primary-dark); }
.choice-list label, .quiz-item label { display: block; margin: 7px 0; padding: 9px 10px; border: 1px solid #d4dee1; border-radius: 8px; background: #fff; cursor: pointer; }
.choice-list input, .quiz-item input, .check-card input { margin-right: 8px; accent-color: var(--primary); }
.action-button { display: inline-flex; justify-content: center; align-items: center; min-height: 42px; margin-top: 10px; padding: 9px 14px; border: 1px solid #6e9aa1; border-radius: 9px; background: #fff; color: var(--primary-dark); font-weight: 800; cursor: pointer; }
.action-button:hover { background: var(--primary-soft); }
.action-button.primary { border-color: var(--primary); background: var(--primary); color: #fff; }
.action-button.primary:hover { background: var(--primary-dark); }
.feedback { margin-top: 10px; padding: 10px 12px; border-radius: 8px; font-weight: 700; }
.feedback.ok { background: var(--ok-soft); color: var(--ok); }
.feedback.warn { background: #fff1cf; color: var(--warn); }
.reveal-panel { margin-top: 12px; padding: 13px; border: 1px solid #d9c480; border-radius: 9px; background: #fff; }

.table-wrap { max-width: 100%; overflow-x: auto; margin: 14px 0; border: 1px solid var(--line); border-radius: 11px; }
table { width: 100%; min-width: 620px; border-collapse: collapse; background: #fff; font-size: .84rem; }
th, td { padding: 11px 12px; border-bottom: 1px solid #dbe3e6; text-align: left; vertical-align: top; }
th { background: #e8f2f3; color: var(--primary-dark); }
tr:last-child td { border-bottom: 0; }
.artifact-grid, .format-grid, .rubric-grid, .comparison-grid, .two-col { display: grid; gap: 11px; margin: 15px 0; }
.artifact-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.format-grid, .rubric-grid, .comparison-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.comparison-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.artifact-card, .format-grid article, .rubric-grid article, .comparison-grid > div { padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.artifact-card strong, .format-grid strong, .rubric-grid strong, .comparison-grid strong, .artifact-card span { display: block; }
.artifact-card strong, .format-grid strong, .rubric-grid strong, .comparison-grid strong { color: var(--primary-dark); }
.artifact-card span { color: var(--muted); font-size: .8rem; }
.artifact-card p, .format-grid p, .rubric-grid p, .comparison-grid p { font-size: .84rem; }
.bad-card { border-color: #e4aaa5 !important; background: var(--danger-soft) !important; }
.good-card { border-color: #93cdb8 !important; background: var(--ok-soft) !important; }
.format-tag { display: inline-block; margin-bottom: 8px; border-radius: 999px; padding: 3px 8px; background: var(--primary-soft); color: var(--primary-dark); font-size: .68rem; font-weight: 900; text-transform: uppercase; }

.visual-lab { margin: 18px 0; overflow: hidden; border: 1px solid #abcbd0; border-radius: 13px; background: #f7fbfb; }
.visual-header { padding: 14px 16px; border-bottom: 1px solid #c7dce0; background: #eaf6f6; }
.visual-header span { color: var(--primary); font-size: .7rem; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; }
.visual-header h3 { margin: 4px 0 0; }
.file-flow { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 7px; padding: 16px; }
.file-flow div { position: relative; padding: 12px 9px; border: 1px solid #9abec4; border-radius: 9px; background: #fff; text-align: center; }
.file-flow div:not(:last-child)::after { content: "→"; position: absolute; right: -10px; top: 34%; z-index: 2; color: var(--primary); font-weight: 900; }
.file-flow strong, .file-flow span { display: block; }
.file-flow strong { color: var(--primary-dark); font-size: .78rem; }
.file-flow span { color: var(--muted); font-size: .68rem; }
.visual-question { margin: 0 16px 16px; padding: 11px; border-left: 4px solid var(--accent); background: #fff; }
.permission-map { padding: 16px; }
.folder-node { max-width: 390px; margin: 0 auto; padding: 12px; border: 2px solid var(--primary); border-radius: 10px; background: #fff; text-align: center; }
.folder-node strong, .folder-node span { display: block; }
.folder-node span { color: var(--muted); font-size: .76rem; }
.folder-children { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; margin-top: 18px; }
.folder-children span { padding: 10px; border-top: 3px solid var(--accent); border-radius: 8px; background: #fff; text-align: center; font-size: .8rem; font-weight: 800; }
.naming-formula { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 7px; margin: 15px 0; padding: 16px; border: 1px dashed #88b6bd; border-radius: 11px; background: #f2fafa; }
.naming-formula span { padding: 6px 9px; border-radius: 7px; background: #fff; color: var(--primary-dark); font: .78rem Consolas, monospace; font-weight: 800; }
.naming-formula b { color: var(--accent); }
.numbered-process { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 8px; margin: 15px 0; padding: 0 !important; list-style: none; counter-reset: step; }
.numbered-process li { position: relative; margin: 0; padding: 35px 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; counter-increment: step; }
.numbered-process li::before { content: counter(step); position: absolute; top: 9px; left: 10px; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--primary); color: #fff; font-size: .72rem; font-weight: 900; }
.numbered-process strong, .numbered-process span { display: block; }
.numbered-process strong { color: var(--primary-dark); font-size: .8rem; }
.numbered-process span { margin-top: 4px; color: var(--muted); font-size: .73rem; line-height: 1.4; }
.interface-strip, .table-anatomy, .delivery-chain { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding: 16px; }
.delivery-chain { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.interface-strip span, .table-anatomy span, .delivery-chain span { min-width: 0; padding: 12px 10px; border: 1px solid #abc8cd; border-radius: 9px; background: #fff; color: var(--muted); font-size: .76rem; line-height: 1.4; }
.interface-strip b, .table-anatomy b, .delivery-chain b { display: block; margin-bottom: 3px; color: var(--primary-dark); font-size: .8rem; }
.permission-simulator { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 16px; }
.permission-simulator label { color: var(--primary-dark); font-size: .78rem; font-weight: 800; }
.permission-simulator select { width: 100%; min-height: 42px; margin-top: 5px; border: 1px solid #819ca3; border-radius: 8px; padding: 7px; background: #fff; color: var(--text); }
.permission-simulator .action-button, .permission-simulator .feedback { grid-column: 1 / -1; }
.project-phase { margin: 14px 0; padding: 15px 17px; border: 1px solid #b9cdd2; border-left: 5px solid var(--primary); border-radius: 11px; background: #f7fbfb; }
.project-phase ol { margin: 0; }
.project-phase li { margin: 11px 0; }

.record-template { width: 100%; min-height: 190px; resize: vertical; margin: 9px 0 0; padding: 12px; border: 1px solid #738b94; border-radius: 8px; background: #14272d; color: #f2fbfb; font: .78rem/1.55 Consolas, "Courier New", monospace; }
.copy-status { margin-left: 9px; color: var(--ok); font-size: .78rem; font-weight: 800; }
.quiz-item { margin: 12px 0; padding: 12px; border: 1px solid #d6e0e3; border-radius: 9px; background: #fff; }
.quiz-item.is-correct { border-color: #74b89e; }
.quiz-item.is-wrong { border-color: #d18e87; }
.check-card ul { padding: 0; list-style: none; }
.check-card li { margin: 7px 0; }
.check-card label { display: block; padding: 9px; border: 1px solid #d9e2e5; border-radius: 8px; background: #fff; cursor: pointer; }
.check-progress { color: var(--primary-dark); font-weight: 900; }
.sources-box { margin-top: 24px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: .78rem; }
.sources-box summary { color: var(--primary-dark); font-weight: 800; cursor: pointer; }
.sources-box a { overflow-wrap: anywhere; }
.lesson-navigation { display: flex; justify-content: space-between; gap: 10px; margin-top: 30px; padding-top: 18px; border-top: 1px solid var(--line); }

@media (max-width: 900px) {
  .module-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .method-card, .lesson-heading { grid-template-columns: 1fr; align-items: start; }
  .artifact-grid, .comparison-grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .interface-strip, .table-anatomy, .delivery-chain { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .file-flow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .file-flow div::after { display: none; }
  .numbered-process { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 650px) {
  body { font-size: 16px; }
  .site-header { padding: 10px 11px; }
  .site-header strong { max-width: 47vw; overflow: hidden; text-overflow: ellipsis; }
  .portal-main { width: min(100% - 18px, 1160px); padding-top: 18px; }
  .portal-heading { padding: 20px 17px 42px; }
  .portal-heading::after { right: 12px; font-size: 30px; }
  .module-grid, .method-flow, .artifact-grid, .format-grid, .rubric-grid, .comparison-grid, .comparison-grid.four, .two-col, .file-flow, .folder-children, .numbered-process, .interface-strip, .table-anatomy, .delivery-chain, .permission-simulator { grid-template-columns: 1fr; }
  .module-card { min-height: auto; }
  .method-flow li:not(:last-child)::after { display: none; }
  .module-pill { display: none; }
  .course-toolbar { padding: 6px 9px; }
  .content-area { width: min(100% - 14px, 960px); padding-top: 18px; }
  .lesson-heading { gap: 10px; padding: 0 5px; }
  .lesson-objective { font-size: .84rem; }
  .lesson-content { padding: 16px 12px; border-radius: 13px; }
  .story-opening { padding: 16px 13px; }
  table { min-width: 580px; }
  .naming-formula { align-items: stretch; flex-direction: column; text-align: center; }
  .naming-formula b { display: none; }
  .lesson-navigation { display: grid; }
  .lesson-navigation .action-button { width: 100%; }
  .copy-status { display: block; margin: 6px 0 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

@media print {
  .site-header, .course-toolbar, .lesson-menu, .menu-backdrop, .lesson-navigation, .action-button { display: none !important; }
  body { background: #fff; color: #000; }
  .content-area, .lesson-content { width: 100%; margin: 0; padding: 0; border: 0; box-shadow: none; }
  .lesson-heading { display: block; }
  .lesson-objective { margin-top: 10px; }
  a { color: #000; }
}
