/* Shared styles for the sandbox pages (java.html, python.html). */
:root {
  --bg: #1b1e28; --panel: #232734; --panel2: #2a2f3f; --border: #363c50;
  --text: #e6e9f2; --dim: #9aa3bc; --accent: #7aa2f7; --green: #9ece6a; --red: #f7768e; --yellow: #e0af68;
  --term-bg: #14161e; --treew: 240px;
}
body.light {
  --bg: #ffffff; --panel: #f3f4f8; --panel2: #e7e9f2; --border: #d3d7e3;
  --text: #1c2030; --dim: #5c6377; --accent: #3f6bd6; --green: #3f8a2e; --red: #cc3b57; --yellow: #9a7d1e;
  --term-bg: #f7f8fc;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; height: 100vh; display: flex; flex-direction: column;
       font-family: system-ui, sans-serif; background: var(--bg); color: var(--text); }
header { display: flex; align-items: center; gap: 8px; padding: 8px 12px;
         background: var(--panel); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
header h1 { font-size: 15px; margin: 0; font-weight: 600; white-space: nowrap; }
#brand { font-weight: 800; font-size: 15px; letter-spacing: .3px; color: var(--text); text-decoration: none; white-space: nowrap; }
#brand:hover { color: var(--accent); }
#brand + h1::before { content: '›'; color: var(--dim); font-weight: 400; margin-right: 8px; }
#back { font-size: 13px; padding: 6px 11px; border-radius: 6px; border: 1px solid var(--border); background: var(--panel2);
        color: var(--text); text-decoration: none; white-space: nowrap; }
#back:hover { border-color: var(--accent); }
.mobile-only { display: none; }
header .spacer { flex: 1; }
header .hint { font-size: 12px; color: var(--dim); white-space: nowrap; }
@media (max-width: 1100px) { header .hint { display: none; } }
header .hint b { color: var(--text); font-weight: 600; }
button.icon .ci { font-size: 15px; }
header .sep { width: 1px; align-self: stretch; background: var(--border); margin: 2px; }
label.field { font-size: 12px; color: var(--dim); display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.info { position: relative; display: inline-flex; align-items: center; justify-content: center;
        width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--dim); color: var(--dim);
        font: italic 600 11px/1 Georgia, serif; cursor: help; user-select: none; }
.info:hover, .info:focus { color: var(--accent); border-color: var(--accent); outline: 0; }
.info .tip { display: none; position: absolute; top: 22px; left: 50%; transform: translateX(-50%);
             width: 280px; padding: 8px 10px; border-radius: 8px; z-index: 20; white-space: normal;
             font: 12px/1.45 system-ui, sans-serif; color: var(--text); background: var(--panel);
             border: 1px solid var(--border); box-shadow: 0 6px 24px rgba(0,0,0,.35); }
.info:hover .tip, .info:focus .tip { display: block; }
select, input.text { font: inherit; font-size: 13px; padding: 5px 8px; border-radius: 6px;
         border: 1px solid var(--border); background: var(--panel2); color: var(--text); }
input.text { min-width: 140px; }
button { font: inherit; font-size: 13px; padding: 6px 11px; border-radius: 6px;
         border: 1px solid var(--border); background: var(--panel2); color: var(--text); cursor: pointer; white-space: nowrap; }
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.danger:hover { border-color: var(--red); color: var(--red); }
button:disabled { opacity: .5; cursor: default; }
button.icon { padding: 6px 9px; }
button.on { border-color: var(--accent); color: var(--accent); }
#menu { display: none; }
main { flex: 1; display: flex; flex-direction: column; min-height: 0; }
#work { flex: 1; display: flex; min-height: 0; position: relative; }

#tree { width: var(--treew); background: var(--panel); border-right: 1px solid var(--border);
        padding: 8px; overflow: auto; font-size: 13px; display: flex; flex-direction: column; flex-shrink: 0; }
#treehandle { width: 5px; cursor: col-resize; background: transparent; flex-shrink: 0; margin-left: -3px; z-index: 2; }
#treehandle:hover { background: var(--accent); opacity: .5; }
#tree .xhead { display: flex; align-items: center; padding: 2px 4px 6px 6px; position: sticky; top: -8px; background: var(--panel); z-index: 1; }
#tree .xtitle { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); }
#tree .xacts { margin-left: auto; display: flex; gap: 2px; opacity: .55; }
#tree:hover .xacts { opacity: 1; }
.ci { font-family: codicon; font-size: 15px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; flex-shrink: 0; }
.ci.xact { cursor: pointer; border-radius: 4px; padding: 2px; width: 20px; height: 20px; color: var(--text); }
.ci.xact:hover { background: var(--panel2); color: var(--accent); }
#tree .dir, #tree .file { padding: 3px 4px 3px 0; border-radius: 4px; display: flex; align-items: center; gap: 2px; white-space: nowrap; }
#tree .dir { color: var(--text); cursor: pointer; user-select: none; }
#tree .dir .ci { color: var(--dim); }
#tree .file { cursor: pointer; }
#tree .file:hover, #tree .dir:hover { background: var(--panel2); }
#tree .file.active { background: var(--panel2); color: var(--accent); }
#tree .file.active2 { outline: 1px dashed var(--accent); outline-offset: -1px; }
#tree .name { overflow: hidden; text-overflow: ellipsis; display: inline-flex; align-items: center; }
#tree .ficon { width: 14px; height: 14px; margin-right: 5px; flex-shrink: 0; }
#tree .dir.dropping { outline: 1px dashed var(--accent); }
#tree .rows { flex: 1; min-height: 40px; }
.ctxmenu { position: fixed; z-index: 60; min-width: 190px; padding: 4px; background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
           box-shadow: 0 8px 28px rgba(0,0,0,.4); font-size: 13px; }
.ctxmenu .item { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 5px; cursor: pointer; color: var(--text); }
.ctxmenu .item:hover { background: var(--accent); color: #fff; }
.ctxmenu .item.danger:hover { background: var(--red); }
.ctxmenu .sep { height: 1px; background: var(--border); margin: 4px 6px; }
#tree input.inline { width: 100%; margin-top: 8px; font: 12px ui-monospace, monospace; padding: 5px 6px; border-radius: 4px;
                     border: 1px solid var(--border); background: var(--panel2); color: var(--text); }
body.dropping #work::after { content: 'Drop source files or a .zip here'; position: absolute; inset: 0; display: flex;
      align-items: center; justify-content: center; background: rgba(122,162,247,.15); border: 2px dashed var(--accent);
      font-size: 16px; z-index: 30; pointer-events: none; }

#editorwrap { flex: 1; display: flex; min-width: 0; }
.pane { flex: 1; min-width: 0; position: relative; display: flex; flex-direction: column; }
.pane .ptitle { font: 11px ui-monospace, monospace; color: var(--dim); padding: 3px 10px; background: var(--panel);
                border-bottom: 1px solid var(--border); display: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.split .pane .ptitle { display: block; }
.pane .pclose { display: none; position: absolute; top: 1px; right: 6px; font-family: codicon; font-size: 13px; color: var(--dim); cursor: pointer; padding: 2px; border-radius: 4px; }
body.split .pane .pclose { display: inline-flex; }
.pane .pclose:hover { color: var(--accent); background: var(--panel2); }
.pane.focused .ptitle { color: var(--accent); }
.pane .ed { flex: 1; min-height: 0; }
#panediv { width: 1px; background: var(--border); }
#editorwrap .monaco-editor, #editorwrap .monaco-editor .margin { background: var(--bg); }

#bottom { height: 220px; min-height: 90px; display: flex; flex-direction: column; border-top: 1px solid var(--border); flex-shrink: 0; }
#bottom.hidden { display: none; }
#bottom .bar { padding: 5px 10px; font-size: 12px; color: var(--dim); background: var(--panel); border-bottom: 1px solid var(--border);
               display: flex; align-items: center; gap: 6px; cursor: ns-resize; user-select: none; flex-wrap: wrap; }
#bottom .bar .actions { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
#bottom .bar button { padding: 2px 8px; font-size: 12px; }
#bottom .bar button.tb { display: inline-flex; align-items: center; gap: 4px; padding: 2px 6px; }
#bottom .bar button.tb .ci { font-size: 14px; }
#bottom .bar label { font-size: 11px; display: flex; align-items: center; gap: 3px; cursor: pointer; }
#term { flex: 1; margin: 0; padding: 12px 14px; overflow: auto; background: var(--term-bg);
        font: 13px/1.5 "JetBrains Mono", ui-monospace, monospace; white-space: pre-wrap; word-break: break-word; }
body.nowrap #term { white-space: pre; word-break: normal; }
#term .err { color: var(--red); } #term .sys { color: var(--dim); font-style: italic; } #term .ok { color: var(--green); }
#term .in { color: var(--accent); } #term .ts { color: var(--dim); opacity: .8; }
#term a.errlink { color: inherit; text-decoration: underline dotted; cursor: pointer; }
#term .b { font-weight: 700; } #term .u { text-decoration: underline; }
#term .hint { margin: 4px 0 8px; padding: 6px 10px; border-left: 3px solid var(--yellow); background: rgba(224,175,104,.08);
              color: var(--text); font: 12.5px/1.5 system-ui, sans-serif; white-space: normal; border-radius: 0 6px 6px 0; }
#term .hint .hl { color: var(--yellow); font-weight: 600; font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 12px; margin-bottom: 2px; }
#stdinpre { display: none; border-top: 1px solid var(--border); background: var(--term-bg); }
#stdinpre.show { display: flex; flex-direction: column; }
#stdinpre .lbl { font-size: 11px; color: var(--dim); padding: 4px 14px 0; }
#stdinpre textarea { border: 0; outline: 0; resize: none; height: 64px; padding: 4px 14px 8px; background: transparent;
                     color: var(--text); font: 13px/1.5 "JetBrains Mono", ui-monospace, monospace; }
#stdinrow { display: flex; align-items: center; gap: 8px; padding: 6px 14px; background: var(--term-bg);
            border-top: 1px solid var(--border); font: 13px/1.5 "JetBrains Mono", ui-monospace, monospace; }
#stdinrow.hidden { display: none; }
#stdinrow .prompt { color: var(--accent); }
#stdinrow input { flex: 1; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; }
#stdinrow button { padding: 2px 8px; font-size: 11px; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--panel); border: 1px solid var(--border);
         color: var(--text); padding: 8px 16px; border-radius: 8px; font-size: 13px; z-index: 40; box-shadow: 0 6px 24px rgba(0,0,0,.35);
         opacity: 0; transition: opacity .15s; pointer-events: none; }
.toast.show { opacity: 1; }
dialog#ask { border: 1px solid var(--border); border-radius: 10px; background: var(--panel); color: var(--text);
             padding: 16px 18px; max-width: 360px; font-size: 14px; box-shadow: 0 10px 40px rgba(0,0,0,.45); }
dialog#ask::backdrop { background: rgba(0,0,0,.4); }
dialog#ask .btns { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }

/* embed + focus modes */
body.embed .embed-hide, body.embed #tree .xhead { display: none !important; }
body.embed header { padding: 6px 10px; }
body.focus .focus-hide, body.focus #tree, body.focus #treehandle { display: none !important; }

/* mobile / tablet */
@media (max-width: 800px) {
  header { gap: 6px; padding: 6px 8px; }
  header h1, .mobile-hide, #treehandle { display: none !important; }
  .mobile-only { display: inline; }
  #menu { display: inline-block; }
  input.text { min-width: 90px; width: 110px; }
  #tree { position: absolute; left: 0; top: 0; bottom: 0; z-index: 25; width: min(280px, 85vw);
          transform: translateX(-105%); transition: transform .15s; box-shadow: 4px 0 24px rgba(0,0,0,.4); }
  #tree.open { transform: none; }
  #bottom { height: 38vh; }
  #bottom .bar .lbl-text { display: none; }
}
