.app { height: 100vh; display: flex; flex-direction: column; min-height: 0; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 20px; color: #fff;
  background: linear-gradient(110deg, var(--navy), var(--navy2) 60%, #1f4a7d); box-shadow: 0 2px 10px rgba(15,39,66,.25); z-index: 5; }
.brand { display: flex; align-items: center; gap: 12px; }
.logo { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(135deg, #3b82f6, #2563eb); box-shadow: 0 2px 8px rgba(37,99,235,.5); }
.logo .i { width: 20px; height: 20px; }
.b1 { font-size: 18px; font-weight: 800; letter-spacing: .2px; line-height: 1.1; }
.b2 { font-size: 12px; color: #a9bdd6; }
.top-right { display: flex; align-items: center; gap: 12px; }

.infobar { display: flex; align-items: flex-end; gap: 12px; padding: 12px 20px; background: var(--panel); border-bottom: 1px solid var(--line); }
.infobar .spacer { flex: 1; }
.w-may { width: 84px; } .w-name { width: 250px; } .w-lop { width: 96px; } .w-bai { width: 84px; }
.infobar .inp { width: 100%; }

.work { flex: 1; min-height: 0; display: grid; grid-template-columns: var(--split, 56%) 8px 1fr; padding: 14px 20px 12px; }
.pane { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; box-shadow: 0 1px 3px rgba(15,23,42,.05); }
.pane-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 14px; border-bottom: 1px solid var(--line); background: #fbfcfe; }
.pane-head .grow { flex: 1; }
.tab { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: #334155; }
.tab .i { color: var(--blue); }
.splitter { cursor: col-resize; position: relative; }
.splitter::after { content: ""; position: absolute; left: 3px; top: 50%; width: 2px; height: 48px; margin-top: -24px; border-radius: 2px; background: #c3cddc; transition: background .15s; }
.splitter:hover::after, .splitter.drag::after { background: var(--blue); }

.editor-wrap { flex: 1; min-height: 0; }
.banner { display: flex; align-items: center; gap: 9px; padding: 9px 14px; background: var(--amber-l); color: #92400e; font-weight: 600; border-bottom: 1px solid #fcd34d; }

.console { flex: 1; min-height: 0; overflow: auto; padding: 14px 16px; background: var(--cons); color: var(--cons-text); font-family: var(--mono); font-size: var(--code-fs, 15px); line-height: 1.55; white-space: pre-wrap; word-break: break-word; outline: none; }
.console .inline-input { color: #7dd3fc; background: transparent; border: 0; border-bottom: 1px dashed #3b82f6; outline: none; font: inherit; width: 24ch; min-width: 6ch; padding: 0 2px; caret-color: #7dd3fc; }
.hint { margin: 0; padding: 11px 16px; background: #0f3d3a; color: #99f6e4; border-top: 1px solid #115e59; line-height: 1.5; }
.hint b { color: #5eead4; }

.statusbar { display: flex; align-items: center; gap: 18px; padding: 0 20px; height: 28px; background: var(--navy); color: #b6c6dc; font-size: 12.5px; }
.statusbar .grow { flex: 1; }
.st-state { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; color: #e2e8f0; }
.st-state .dot { width: 8px; height: 8px; border-radius: 50%; background: #fbbf24; }
.st-state.ready .dot { background: #4ade80; } .st-state.running .dot { background: #60a5fa; animation: pulse 1s infinite; } .st-state.error .dot { background: #f87171; }
@keyframes pulse { 50% { opacity: .3; } }
.st-sub { color: #86efac; }

.statusbar span { white-space: nowrap; }
.credit { color: #8fb0d6; font-size: 12px; letter-spacing: .1px; }
@media (max-width: 1050px) { #stPos, #stSub { display: none; } .credit { font-size: 11px; } }
.ptab { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px; border: 0; border-radius: 7px; background: transparent; color: #64748b; font-weight: 700; cursor: pointer; position: relative; }
.ptab:hover { background: #eef2f7; color: #334155; }
.ptab.active { background: var(--blue-l); color: var(--blue-d); }
.gdot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); position: absolute; top: 5px; right: 5px; }
.gfx-wrap { flex: 1; min-height: 0; position: relative; background: #fff; }
.gfx-imgs { position: absolute; inset: 0; overflow: auto; background: #fff; padding: 14px; z-index: 2; }
.gfx-imgs img { display: block; max-width: 100%; height: auto; margin: 0 auto 16px; border: 1px solid var(--line); border-radius: 6px; }
.gfx-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

/* ngăn bài tập */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 360px; max-width: 92vw; background: #fff; box-shadow: -12px 0 32px rgba(15,23,42,.22); z-index: 50; display: flex; flex-direction: column; animation: sl .18s ease-out; }
@keyframes sl { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); font-size: 16px; }
.drawer-body { flex: 1; overflow: auto; padding: 8px; }
.drawer-foot { padding: 10px 16px; color: var(--muted); border-top: 1px solid var(--line); font-size: 12.5px; }
.file-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; color: inherit; text-decoration: none; }
.file-row:hover { background: #f1f6ff; }
.file-row .fi { width: 34px; height: 34px; border-radius: 8px; background: var(--blue-l); color: var(--blue); display: grid; place-items: center; }
.file-row .fn { flex: 1; min-width: 0; font-weight: 600; word-break: break-all; }
.file-row .fm { color: var(--muted); font-size: 12px; }
.empty { padding: 36px 16px; text-align: center; color: var(--muted); }

@media (max-width: 900px) {
  .work { grid-template-columns: 1fr; grid-template-rows: 1fr 8px 1fr; }
  .splitter { display: none; }
  .w-name { width: 160px; }
}
