/* Shared custom CSS. Additional topic styles belong in the topic PHP page. */
:root{--primary:#00adee;--primary-dark:#007ba8;--white:#fff;--sidebar:#f5f7fa;--text:#334155;--muted:#64748b;--border:#e2e8f0;--blue-light:#e8f7ff;--green-light:#e8f8ef;--orange-light:#fff4df;--violet-light:#f2ecff;--red-light:#fdecec;--sidebar-width:290px;--header-height:72px;--radius:12px;font-family:Poppins,Arial,sans-serif;color:var(--text);background:#fff}
*{box-sizing:border-box}body{margin:0;width:100%;min-height:100vh;font-size:14px;line-height:1.65}a{color:inherit;text-decoration:none}button,input,select,textarea{font:inherit}button{cursor:pointer}button:focus-visible,a:focus-visible,input:focus-visible,summary:focus-visible{outline:3px solid var(--primary-dark);outline-offset:3px}[hidden]{display:none!important}.sr-only,.skip-link:not(:focus){position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}.skip-link:focus{position:fixed;top:5px;left:5px;z-index:99;background:#fff;padding:10px}
.site-header{height:var(--header-height);display:flex;position:sticky;top:0;z-index:30;background:#fff;border-bottom:2px solid var(--primary);width:100%}.brand{width:var(--sidebar-width);flex-shrink:0;display:flex;align-items:center;justify-content:center;padding:0 20px;border-right:1px solid var(--border)}.brand img{width:100%;max-width:245px;height:55px;object-fit:contain}.header-content{display:flex;align-items:center;gap:18px;flex:1;min-width:0;padding:0 62px 0 24px}.header-title{flex:1;text-align:center;font-weight:600;font-size:20px;line-height:1.4}.header-title small{display:block;font-size:12px;font-weight:400;color:var(--muted)}.icon-button{border:1px solid var(--border);background:#fff;border-radius:8px;width:38px;height:38px;flex-shrink:0;color:var(--text);font-size:20px}.app-layout{display:flex;width:100%;min-height:calc(100vh - var(--header-height))}.sidebar{width:var(--sidebar-width);flex-shrink:0;background:var(--sidebar);border-right:1px solid var(--border);position:sticky;top:var(--header-height);height:calc(100vh - var(--header-height));height:calc(100dvh - var(--header-height));overflow-y:auto;overscroll-behavior:contain;padding:18px 12px}.sidebar-tools{padding:0 8px 12px}.eyebrow{font-size:11px;font-weight:600;letter-spacing:1px;color:var(--primary-dark);margin:0 0 10px}.sidebar input{width:100%;min-width:0;background:#fff;border:1px solid var(--border);border-radius:8px;padding:10px 12px}.nav-link{display:block;padding:9px 12px;border-radius:7px;margin:2px 0;font-size:13px;font-weight:400}.nav-link:hover,.module-group summary:hover{background:var(--blue-light)}.nav-link.active,.nav-link.active:hover{background:var(--primary);color:#fff;font-weight:400}.module-group{border-bottom:1px solid var(--border);padding:6px 0}.module-group summary{cursor:pointer;padding:10px 24px 10px 12px;list-style:none;position:relative;font-weight:500;font-size:13px;border-radius:7px}.module-group summary::-webkit-details-marker{display:none}.module-group summary:after{content:'›';position:absolute;right:9px;top:20px;font-size:20px}.module-group[open] summary:after{transform:rotate(90deg)}.module-number{display:block;font-size:10px;color:var(--primary-dark);font-weight:600;letter-spacing:.8px}.module-links{padding-left:10px}.main-content{flex:1;min-width:0;width:100%;padding:clamp(16px,3vw,38px);min-height:calc(100vh - var(--header-height));overflow-wrap:anywhere}.sidebar-collapsed .sidebar{display:none}.welcome{background:var(--blue-light);border:1px solid #cfeefa;border-radius:var(--radius);padding:clamp(20px,3vw,40px);margin-bottom:30px}h1,h2,h3{line-height:1.4;color:var(--text);margin:0 0 14px}h1{font-size:clamp(23px,3vw,34px)}h2{font-size:25px}h3{font-size:19px}p{margin:0 0 14px}.stats{display:flex;flex-wrap:wrap;gap:16px}.stats span{background:#fff;border-radius:8px;padding:10px 18px}.stats strong{font-size:23px;color:var(--primary-dark);margin-right:6px}.topic-grid,.lesson-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,270px),1fr));gap:18px}.card,.simulation-panel,.code-panel,.solved-example,.formula-box{background:#fff;border:1px solid var(--border);border-radius:var(--radius);padding:20px}.module-card:hover,.topic-card:hover{border-color:var(--primary);box-shadow:0 4px 16px #00adee15}.card-link{color:var(--primary-dark);font-weight:600}.topic-card{display:flex;justify-content:space-between;gap:12px}.button,.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;border:1px solid var(--primary);border-radius:8px;padding:10px 16px;background:var(--primary);color:#fff;font-weight:500}.btn-secondary{background:#fff;border-color:var(--border);color:var(--text)}.controls,.tabs{display:flex;flex-wrap:wrap;gap:10px;margin:14px 0}.tab-button{background:var(--sidebar);border:1px solid var(--border);border-radius:8px;padding:10px 14px}.tab-button[aria-selected=true]{background:var(--primary);border-color:var(--primary);color:#fff}.main-content section{margin-block:26px}.main-content .welcome{margin-top:0}.main-content .solved-example{margin-block:16px}.simulation-panel svg,.simulation-panel canvas,main img{max-width:100%;height:auto}.formula-box{background:var(--blue-light);overflow-x:auto}.table-wrap{overflow-x:auto}table{width:100%;border-collapse:collapse}th,td{padding:12px;border:1px solid var(--border);text-align:left}th{background:var(--sidebar)}input[type=range]{accent-color:var(--primary);max-width:100%}input[type=number],select,textarea{max-width:100%;padding:8px;border:1px solid var(--border);border-radius:6px}pre{overflow:auto;white-space:pre;background:#f5f7fa;color:#334155;padding:16px;border-radius:8px;tab-size:4}code,pre,.code-editor{font-family:Consolas,monospace}.code-editor{width:100%;min-height:180px}.console-output{background:#172033;color:#e2e8f0;padding:16px;border-radius:8px;white-space:pre-wrap}.sidebar-overlay{display:none}.simulation-panel:fullscreen{background:#fff;overflow:auto;padding:24px}.muted{color:var(--muted)}
@media(max-width:850px){:root{--header-height:64px}.brand{width:min(32vw,155px);padding:0 10px;border:0}.brand img{width:100%;height:44px}.header-content{padding:0 10px;gap:10px}.header-title{font-size:16px;text-align:left}.header-title small{font-size:10px}.sidebar,.sidebar-collapsed .sidebar{display:block;position:fixed;top:var(--header-height);bottom:0;left:0;z-index:25;width:min(310px,86vw);transform:translateX(-105%);visibility:hidden;transition:transform .2s,visibility .2s}.sidebar-open .sidebar{transform:translateX(0);visibility:visible}.sidebar-open .sidebar-overlay{display:block;position:fixed;inset:var(--header-height) 0 0;background:#0f172a66;z-index:24}.main-content{padding:18px}.sidebar-open{overflow:hidden}}
@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important;transition:none!important}}@media print{.site-header,.sidebar,.controls,.tabs{display:none!important}.main-content{padding:0}.card{break-inside:avoid}}
