/* ============================================================
   EduLab · 건국대 「인공지능과디지털사고」 단원 허브 공통 스타일
   기준: writing/교재팩/edulab_demo_perceptron.html
   ============================================================ */
:root{
  --bg:#f8fafc; --card:#ffffff; --line:#cbd5e1; --soft:#e2e8f0;
  --ink:#0f172a; --ink2:#334155; --ink3:#64748b; --ink4:#94a3b8;
  --blue:#2563eb; --blue-d:#1d4ed8; --blue-soft:#eff6ff; --blue-line:#dbeafe;
  --indigo:#4f46e5; --teal:#0d9488; --teal-b:#2dd4bf; --amber:#f59e0b;
  --rose:#e11d48; --emerald:#059669;
  --mono:ui-monospace,SFMono-Regular,Menlo,Consolas,"Liberation Mono",monospace;
  --math:"Cambria Math","Latin Modern Math","Times New Roman",serif;
  --hubbar-h:46px;
}
*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  background:var(--bg); color:var(--ink); font-size:14px; line-height:1.5;
  font-family:"Pretendard","Apple SD Gothic Neo","Noto Sans KR","Malgun Gothic",system-ui,-apple-system,"Segoe UI",sans-serif;
  -webkit-font-smoothing:antialiased; text-rendering:optimizeLegibility;
}
::-webkit-scrollbar{width:6px;height:6px}
::-webkit-scrollbar-track{background:transparent}
::-webkit-scrollbar-thumb{background:#cbd5e1;border-radius:3px}
::-webkit-scrollbar-thumb:hover{background:#94a3b8}
a{color:var(--blue);text-decoration:none}

/* ---------------- 상단 단원 허브 바 ---------------- */
.hubbar{
  height:var(--hubbar-h); display:flex; align-items:center; gap:12px;
  padding:0 14px; background:rgba(255,255,255,.94); backdrop-filter:blur(10px);
  border-bottom:1px solid var(--line); position:sticky; top:0; z-index:50;
}
.hubbar-home{display:flex;align-items:center;gap:8px;min-width:0;color:var(--ink)}
.hubbar-logo{
  width:24px;height:24px;border-radius:7px;flex:none;
  background:linear-gradient(135deg,#1d4ed8,#0d9488); color:#fff;
  font-size:11px;font-weight:900;letter-spacing:.02em;
  display:flex;align-items:center;justify-content:center;box-shadow:0 1px 3px rgba(15,23,42,.22)
}
.hubbar-title{font-size:12px;font-weight:800;letter-spacing:-.01em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.hubbar-title .sep{color:var(--ink4);font-weight:700;margin:0 5px}
.hubbar-title .u{color:var(--ink3);font-weight:700}
.hubbar-meta{display:flex;gap:5px;align-items:center;margin-left:auto}
.hubbar-chip{
  font-family:var(--mono);font-size:10px;font-weight:700;color:#475569;
  background:#f1f5f9;border:1px solid #e2e8f0;border-radius:999px;padding:3px 8px;white-space:nowrap
}
.hubbar-chip.blue{color:#1d4ed8;background:var(--blue-soft);border-color:var(--blue-line)}
.hubbar-nav{display:flex;gap:5px;align-items:center;margin-left:6px}
.hbtn{
  display:inline-flex;align-items:center;gap:4px;height:28px;padding:0 10px;border-radius:8px;
  font-size:11.5px;font-weight:800;color:#334155;background:#fff;border:1px solid #e2e8f0;white-space:nowrap
}
.hbtn:hover{border-color:#bfdbfe;background:var(--blue-soft);color:#1d4ed8}
.hbtn.disabled{color:#cbd5e1;border-color:#eef2f7;background:#fbfdff;pointer-events:none}

/* ---------------- 3단 1화면 대시보드 ---------------- */
.app{
  display:grid; gap:12px; padding:12px; height:calc(100vh - var(--hubbar-h));
  grid-template-columns:320px 344px minmax(0,1fr);
  grid-template-rows:auto minmax(0,1fr);
  grid-template-areas:
    "head notes board"
    "console notes board";
}
.app.no-notes{
  grid-template-columns:340px minmax(0,1fr);
  grid-template-rows:auto minmax(0,1fr);
  grid-template-areas:"head board" "console board";
}
.card{background:var(--card);border:1px solid var(--line);border-radius:16px;box-shadow:0 1px 2px rgba(15,23,42,.05);min-width:0}

/* ---------- header ---------- */
.head{grid-area:head;padding:14px 16px 15px;position:relative;overflow:hidden}
.head::after{content:"";position:absolute;right:-30px;top:-40px;width:120px;height:120px;border-radius:50%;background:radial-gradient(circle,rgba(37,99,235,.10),rgba(37,99,235,0) 70%)}
.eyebrow{font-size:10px;font-weight:800;letter-spacing:.14em;color:var(--blue);text-transform:uppercase}
.head h1{font-size:18px;line-height:1.32;margin:5px 0 5px;letter-spacing:-.015em;color:#0b1220}
.head p{margin:0;font-size:11.5px;color:var(--ink3);line-height:1.55}

/* ---------- console ---------- */
.console{grid-area:console;padding:14px 16px 16px;overflow-y:auto;min-height:0}
.sec-label{display:flex;justify-content:space-between;align-items:baseline;font-size:11px;font-weight:800;color:var(--ink2);margin:0 0 7px}
.sec-label .sub{font-weight:600;color:var(--ink4);font-size:10px;letter-spacing:0}
.sec-label.mt{margin-top:14px}
.seg{display:grid;grid-template-columns:repeat(3,1fr);gap:3px;background:#f1f5f9;border:1px solid #e2e8f0;border-radius:9px;padding:3px}
.seg.two{grid-template-columns:repeat(2,1fr)}
.seg.four{grid-template-columns:repeat(4,1fr)}
.seg-btn{border:0;background:transparent;border-radius:7px;padding:6px 0;font-family:inherit;font-size:11.5px;font-weight:700;color:#64748b;cursor:pointer;transition:.15s}
.seg-btn:hover{color:#1d4ed8}
.seg-btn[aria-pressed="true"]{background:#fff;color:#1d4ed8;box-shadow:0 1px 2px rgba(15,23,42,.14)}

.ctl{margin-top:11px}
.ctl:first-of-type{margin-top:14px}
.ctl-top{display:flex;justify-content:space-between;align-items:center;margin-bottom:4px;gap:8px}
.ctl-top label{font-size:11.5px;font-weight:700;color:var(--ink2);display:flex;align-items:center;gap:4px;white-space:nowrap}
.ctl-top label .mv{font-family:var(--math);font-style:italic;font-size:13px}
.ctl-top output{
  font-family:var(--mono);font-size:11px;font-weight:700;color:#1d4ed8;background:var(--blue-soft);
  border:1px solid var(--blue-line);border-radius:6px;padding:1px 7px;min-width:54px;text-align:right;white-space:nowrap
}
input[type=range]{
  -webkit-appearance:none;appearance:none;width:100%;height:20px;background:transparent;margin:0;cursor:pointer;display:block
}
input[type=range]::-webkit-slider-runnable-track{height:6px;border-radius:999px;background:#e2e8f0;border:1px solid #dbe2ea}
input[type=range]::-webkit-slider-thumb{
  -webkit-appearance:none;appearance:none;width:16px;height:16px;border-radius:50%;background:var(--blue);
  border:2px solid #fff;box-shadow:0 1px 3px rgba(15,23,42,.35);margin-top:-6px;transition:transform .12s
}
input[type=range]:active::-webkit-slider-thumb{transform:scale(1.12)}
input[type=range]::-moz-range-track{height:6px;border-radius:999px;background:#e2e8f0;border:1px solid #dbe2ea}
input[type=range]::-moz-range-thumb{width:14px;height:14px;border-radius:50%;background:var(--blue);border:2px solid #fff;box-shadow:0 1px 3px rgba(15,23,42,.35)}
input[type=range]:focus-visible{outline:2px solid #93c5fd;outline-offset:4px;border-radius:8px}
input[type=checkbox]{accent-color:var(--blue);width:14px;height:14px;margin:0;cursor:pointer}

.actions{display:grid;grid-template-columns:1fr 1fr 36px;gap:6px;margin-top:15px}
.actions.two{grid-template-columns:1fr 1fr}
.actions.one{grid-template-columns:1fr}
.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:5px;height:36px;padding:0 8px;
  border-radius:9px;border:1px solid transparent;font-family:inherit;font-size:12px;font-weight:800;
  cursor:pointer;transition:.15s;white-space:nowrap
}
.btn svg{width:13px;height:13px;flex:none}
.btn-primary{background:var(--blue);color:#fff;box-shadow:0 1px 3px rgba(37,99,235,.35)}
.btn-primary:hover{background:var(--blue-d)}
.btn-primary:active{transform:translateY(1px)}
.btn-play{background:var(--blue-soft);color:#1d4ed8;border-color:#bfdbfe}
.btn-play:hover{background:#dbeafe}
.btn-play.is-playing{background:#0f766e;border-color:#0f766e;color:#fff;box-shadow:0 1px 3px rgba(13,148,136,.35)}
.btn-ghost{background:#fff;border-color:#e2e8f0;color:#64748b;padding:0}
.btn-ghost:hover{color:#334155;border-color:#cbd5e1;background:#f8fafc}
.btn:focus-visible{outline:2px solid #93c5fd;outline-offset:2px}
.btn:disabled{opacity:.5;cursor:not-allowed}

.kpis{display:grid;grid-template-columns:1.15fr 1fr .85fr;gap:6px;margin-top:14px}
.kpis.two{grid-template-columns:1fr 1fr}
.kpis.four{grid-template-columns:repeat(2,1fr)}
.kpi{background:#f8fafc;border:1px solid #e2e8f0;border-radius:9px;padding:7px 8px;min-width:0}
.kpi .k{font-size:9.5px;font-weight:700;color:var(--ink4);letter-spacing:.01em;white-space:nowrap}
.kpi .v{font-family:var(--mono);font-size:15px;font-weight:800;color:#0f172a;line-height:1.25;margin-top:1px;white-space:nowrap}
.kpi .v small{font-size:9.5px;font-weight:700;color:var(--ink4);margin-left:1px}
.kpi.loss .v{color:#be123c}
.kpi.acc .v{color:#0f766e}
.kpi.blue .v{color:#1d4ed8}

.eqbox{margin-top:11px;background:#f8fafc;border:1px solid #e2e8f0;border-radius:10px;padding:7px 10px 8px}
.eqbox .k{font-size:9.5px;font-weight:800;color:var(--ink4);letter-spacing:.03em;display:flex;justify-content:space-between;gap:6px}
.eqbox .k b{color:#0d9488;font-weight:800}
.eqbox .m{display:block;margin-top:2px;font-size:13px;color:#0f172a;white-space:nowrap;overflow-x:auto;overflow-y:hidden;line-height:1.7}

.sparkbox{margin-top:11px;border:1px solid #e2e8f0;border-radius:10px;padding:6px 9px 4px;background:#f8fafc}
.sparkbox .k{font-size:9.5px;font-weight:800;color:var(--ink4);display:flex;justify-content:space-between}
.sparkbox .k b{font-family:var(--mono);color:var(--ink3);font-weight:700}
.sparkbox canvas{display:block;width:100%;height:44px}

/* ---------- notes ---------- */
.notes{grid-area:notes;padding:14px 16px 12px;overflow-y:auto;min-height:0}
.notes-h{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:3px}
.notes-h h2{margin:0;font-size:15px;letter-spacing:-.01em;display:flex;align-items:center;gap:7px}
.notes-h h2 .bar{width:8px;height:8px;border-radius:50%;background:var(--indigo);box-shadow:0 0 0 3px rgba(79,70,229,.14)}
.badge{font-size:9.5px;font-weight:800;color:#4338ca;background:#eef2ff;border:1px solid #e0e7ff;border-radius:999px;padding:2px 8px;white-space:nowrap}
.badge.teal{color:#0f766e;background:#f0fdfa;border-color:#ccfbf1}
.notes > p.lead{margin:2px 0 10px;font-size:11px;color:var(--ink4);line-height:1.55}

.step{display:flex;gap:9px;margin-top:9px}
.step .num{flex:none;width:19px;height:19px;border-radius:50%;background:#eef2ff;color:#4338ca;font-family:var(--mono);font-size:10.5px;font-weight:800;line-height:19px;text-align:center;margin-top:1px}
.step .body{min-width:0;flex:1}
.step h3{margin:0 0 1px;font-size:12px;font-weight:800;color:#1e293b}
.step p{margin:0 0 5px;font-size:11px;color:var(--ink3);line-height:1.55}
.formula{background:#f8fafc;border:1px solid #e9eef5;border-radius:8px;padding:5px 9px;font-size:12.5px;color:#0f172a;overflow-x:auto;overflow-y:hidden}
.formula .m{white-space:nowrap;line-height:1.8}
.katex{font-size:1em !important}

.grad{margin-top:12px;border:1px solid var(--blue-line);background:linear-gradient(180deg,#f6faff,#f2f7ff);border-radius:11px;padding:9px 11px 8px}
.grad-h{display:flex;justify-content:space-between;align-items:center;font-size:10.5px;font-weight:800;color:#1e40af;margin-bottom:4px}
.grad-h .eta{font-family:var(--mono);font-weight:700;color:#1d4ed8;background:#fff;border:1px solid #dbeafe;border-radius:5px;padding:1px 6px;font-size:10px}
.grow{display:flex;justify-content:space-between;align-items:center;gap:8px;font-size:11px;color:#475569;padding:2.5px 0;border-bottom:1px dashed #dbeafe}
.grow:last-of-type{border-bottom:0}
.grow .lab{font-family:var(--math);font-size:12px;color:#334155;white-space:nowrap}
.grow b{font-family:var(--mono);font-size:11px;font-weight:800;color:#0f172a;white-space:nowrap}
.grow b.pos{color:#be123c}
.grow b.neg{color:#1d4ed8}
.gnext{margin-top:5px;font-family:var(--mono);font-size:9.8px;line-height:1.5;color:#64748b;word-break:keep-all}

.status{display:flex;gap:8px;align-items:flex-start;border-radius:10px;padding:8px 10px;font-size:11px;line-height:1.5;margin-top:8px;border:1px solid;transition:background .2s,border-color .2s,color .2s}
.status .dot{width:7px;height:7px;border-radius:50%;margin-top:5px;flex:none}
.status.info{background:#eff6ff;border-color:#dbeafe;color:#1e40af}
.status.info .dot{background:#3b82f6}
.status.ok{background:#ecfdf5;border-color:#a7f3d0;color:#065f46}
.status.ok .dot{background:#10b981}
.status.warn{background:#fffbeb;border-color:#fde68a;color:#92400e}
.status.warn .dot{background:#f59e0b}
.status.bad{background:#fff1f2;border-color:#fecdd3;color:#9f1239}
.status.bad .dot{background:#f43f5e}

/* ---------- board ---------- */
.board{grid-area:board;display:flex;flex-direction:column;padding:12px;overflow:hidden}
.board-head{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:2px 4px 10px;flex-shrink:0;flex-wrap:wrap}
.board-head h2{font-size:14px;margin:0;display:flex;align-items:center;gap:7px;letter-spacing:-.01em}
.dot-teal{width:8px;height:8px;border-radius:50%;background:#14b8a6;box-shadow:0 0 0 3px rgba(20,184,166,.18)}
.board-meta{display:flex;gap:4px;align-items:center;min-width:0;flex-wrap:wrap}
.chip{font-family:var(--mono);font-size:10px;font-weight:700;color:#475569;background:#f1f5f9;border:1px solid #e2e8f0;border-radius:999px;padding:3px 8px;white-space:nowrap}
.chip.teal{color:#0f766e;background:#f0fdfa;border-color:#ccfbf1}
.chip.blue{color:#1d4ed8;background:var(--blue-soft);border-color:var(--blue-line)}
.chip.rose{color:#be123c;background:#fff1f2;border-color:#fecdd3}
.board-stage{
  position:relative;flex:1;min-height:0;border-radius:12px;overflow:hidden;
  background:
    radial-gradient(1200px 500px at 50% 0%,rgba(30,64,175,.22),rgba(15,23,42,0) 62%),
    linear-gradient(180deg,#111c34 0%,#0f172a 55%,#0b1220 100%);
  box-shadow:inset 0 0 60px rgba(0,0,0,.45), inset 0 0 0 1px rgba(51,65,85,.5)
}
.board-stage canvas{position:absolute;inset:0;width:100%;height:100%;display:block;touch-action:manipulation}
.float{position:absolute;background:rgba(15,23,42,.82);border:1px solid rgba(71,85,105,.55);border-radius:9px;backdrop-filter:blur(6px);color:#e2e8f0;pointer-events:none;z-index:2}
.eq-float{top:10px;left:10px;padding:5px 9px 6px;max-width:calc(100% - 20px)}
.eq-float .k{font-size:8.5px;letter-spacing:.1em;color:#94a3b8;text-transform:uppercase;font-weight:700;margin-bottom:1px}
.eq-float .m{font-size:12px;white-space:nowrap;color:#f1f5f9;line-height:1.5}
.legend{position:absolute;bottom:10px;left:10px;padding:6px 9px;font-size:10px;line-height:1.55;color:#cbd5e1;display:flex;gap:4px 10px;flex-wrap:wrap;max-width:calc(100% - 20px)}
.legend span{white-space:nowrap;display:inline-flex;align-items:center}
.legend i{display:inline-block;width:7px;height:7px;border-radius:50%;margin-right:4px;flex:none}
.legend .ring{width:8px;height:8px;border-radius:50%;border:1.5px solid #fb7185;margin-right:3px}
.legend .arrow{color:#a78bfa;font-weight:800;margin-right:3px}
.hint{position:absolute;bottom:11px;right:11px;font-size:9.5px;color:#8ea0b8;letter-spacing:.01em;z-index:2;pointer-events:none}
.tipbox{margin-top:11px;font-size:10.5px;line-height:1.55;color:#64748b;background:#f8fafc;border:1px dashed #dbe2ea;border-radius:9px;padding:7px 9px}
.tipbox b{color:#334155;font-weight:800}

/* ---------- 공통 보조 패널 (보드 안 분할/리스트) ---------- */
.split2{position:absolute;inset:0;display:grid;grid-template-columns:1fr 1fr;gap:1px;background:rgba(51,65,85,.6)}
.split2 > figure{position:relative;margin:0;min-width:0;overflow:hidden;background:rgba(15,23,42,.35)}
.split2 figcaption{position:absolute;top:8px;left:10px;font-size:10px;font-weight:800;letter-spacing:.04em;color:#a5b4c8;z-index:2;pointer-events:none}
.panel{background:#fff;border:1px solid #e2e8f0;border-radius:10px;padding:9px 10px}
.panel-h{display:flex;justify-content:space-between;align-items:baseline;font-size:10.5px;font-weight:800;color:var(--ink2);margin-bottom:6px;gap:6px}
.panel-h .sub{font-weight:600;color:var(--ink4);font-size:9.5px}
.barrow{display:grid;grid-template-columns:78px 1fr 44px;gap:7px;align-items:center;margin-top:5px;font-size:11px}
.barrow .tk{font-weight:700;color:#334155;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.bartrack{height:14px;border-radius:5px;background:#f1f5f9;border:1px solid #e9eef5;overflow:hidden;position:relative}
.barfill{height:100%;border-radius:4px;background:linear-gradient(90deg,#60a5fa,#2563eb);transition:width .18s ease}
.barfill.cut{background:linear-gradient(90deg,#e2e8f0,#cbd5e1)}
.barfill.hot{background:linear-gradient(90deg,#fbbf24,#f59e0b)}
.barrow .pv{font-family:var(--mono);font-size:10px;font-weight:800;color:#1d4ed8;text-align:right;white-space:nowrap}
.barrow .pv.cut{color:#94a3b8}
.ragpreview{background:#0f172a;border-radius:10px;padding:9px 11px;color:#e2e8f0;font-family:var(--mono);font-size:10.5px;line-height:1.65;white-space:pre-wrap;word-break:keep-all;max-height:132px;overflow:auto}
.ragpreview .tag{color:#5eead4}
.ragpreview .num{color:#fbbf24}
.kvline{display:flex;justify-content:space-between;gap:8px;font-size:10.5px;color:#475569;padding:2.5px 0;border-bottom:1px dashed #e2e8f0}
.kvline:last-child{border-bottom:0}
.kvline b{font-family:var(--mono);font-weight:800;color:#0f172a}
.mininote{font-size:10px;color:var(--ink4);line-height:1.5;margin-top:6px}

/* ---------------- 모듈 하단 이동 (모바일에서만) ---------------- */
.pagefoot{display:none;gap:8px;padding:0 12px 14px}
.pagefoot a{
  flex:1;display:flex;flex-direction:column;gap:2px;padding:10px 12px;border-radius:11px;
  background:#fff;border:1px solid var(--line);color:var(--ink2);font-size:11px;font-weight:800
}
.pagefoot a .lab{font-size:9px;font-weight:700;color:var(--ink4);letter-spacing:.06em}
.pagefoot a:hover{border-color:#bfdbfe;background:var(--blue-soft)}

@media (max-width:1180px){
  .app{grid-template-columns:300px 320px minmax(0,1fr)}
  .head h1{font-size:17px}
}
@media (max-width:1080px){
  body{height:auto;overflow-y:auto}
  .app{
    height:auto;grid-template-columns:minmax(0,1fr);
    grid-template-rows:auto auto auto auto;
    grid-template-areas:"head" "board" "console" "notes";
  }
  .board{padding:10px}
  .board-stage{height:380px;flex:none}
  .console,.notes{overflow:visible}
  .head h1{font-size:18px}
  .pagefoot{display:flex}
  .hubbar-meta .hubbar-chip.opt{display:none}
}
@media (max-width:760px){
  .hubbar{gap:8px;padding:0 10px}
  .hubbar-meta{display:none}
  .hubbar-title .sep, .hubbar-title .u{display:none}
  .hbtn{padding:0 8px;font-size:11px}
  .split2{grid-template-columns:1fr;grid-template-rows:1fr 1fr}
}
@media (max-width:520px){
  .app{padding:9px;gap:9px}
  .head{padding:12px 14px}
  .head h1{font-size:16.5px}
  .console,.notes{padding:13px 14px}
  .board-stage{height:330px}
  .chip-quiet{display:none}
  .hint{display:none}
  .legend{font-size:9.5px;gap:2px 8px;padding:5px 8px}
  .eq-float{padding:4px 8px}
  .eq-float .m{font-size:11px}
  .actions{grid-template-columns:1fr 1fr 34px}
  .btn{font-size:11.5px;height:35px}
  .kpis{grid-template-columns:1.1fr 1fr .8fr}
  .kpi .v{font-size:14px}
  .barrow{grid-template-columns:64px 1fr 38px}
}
@media (prefers-reduced-motion:reduce){
  *{transition:none!important;animation:none!important}
}
