/* AshuLabs IDE — VS Code / IntelliJ-style layout. Own palette, so it can be dark while the site is light. */
.ide {
  --side-w: 38%; --panel-h: 34%;
  --i-bg: #0b1328; --i-bar: #101a33; --i-side: #121d38; --i-line: #22305a; --i-text: #d6def5; --i-muted: #8392b8;
  --i-accent: #ffb454; --i-brand: #3f7bff; --i-ok: #4fd18b; --i-bad: #ff6b6b; --i-warn: #f0c46a; --i-chip: #1b2950; --i-input: #0f1830;
  position: fixed; inset: 0; z-index: 30; display: grid; grid-template-rows: 46px 1fr 24px; background: var(--i-bg); color: var(--i-text);
  font: 14px/1.5 Inter, system-ui, sans-serif;
}
.ide[data-ide-theme="light"] {
  --i-bg: #f4f2ec; --i-bar: #fbfaf7; --i-side: #fbfaf7; --i-line: #e2ddd1; --i-text: #1d2433; --i-muted: #667085;
  --i-accent: #b4451f; --i-brand: #16264a; --i-ok: #1f8a4c; --i-bad: #c0392b; --i-warn: #9a6a00; --i-chip: #efebe2; --i-input: #fff;
}
.ide.dragging { cursor: grabbing; user-select: none; }
.ide.dragging .ide-editor { pointer-events: none; }

/* top bar */
.ide-top { display: flex; align-items: center; gap: 12px; padding: 0 10px; background: var(--i-bar); border-bottom: 1px solid var(--i-line); min-width: 0; }
.ide-brand { display: flex; align-items: center; gap: 7px; color: var(--i-text); text-decoration: none; flex: none; }
.ide-brand b { font: 700 15px/1 Inter, sans-serif; letter-spacing: -.01em; }
.ide-brand span { font: 700 10px/1 'JetBrains Mono', monospace; color: #fff; background: var(--i-brand); border-radius: 4px; padding: 3px 5px; letter-spacing: .06em; }
.ide-crumb { display: flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; color: var(--i-muted); font-size: 13px; white-space: nowrap; }
.ide-crumb span { overflow: hidden; text-overflow: ellipsis; }
.ide-crumb span:last-child { color: var(--i-text); font-weight: 600; }
.ide-crumb i { font-style: normal; opacity: .6; }
.ide-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; flex: none; }
.ide-lang { background: var(--i-input); color: var(--i-text); border: 1px solid var(--i-line); border-radius: 6px; padding: 5px 8px; font: 600 13px/1.2 Inter, sans-serif; }
.ide-btn { display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 6px; padding: 7px 12px; font: 600 13px/1 Inter, sans-serif; cursor: pointer; color: #fff; }
.ide-btn.run { background: #2b8a57; } .ide-btn.run:hover { background: #33a066; }
.ide-btn.submit { background: var(--i-brand); } .ide-btn.submit:hover { filter: brightness(1.12); }
.ide.running .ide-btn { opacity: .55; pointer-events: none; }
.ide-icon { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 6px; border: 0; background: transparent; color: var(--i-muted); cursor: pointer; }
.ide-icon:hover { background: var(--i-chip); color: var(--i-text); }

/* body: side | splitter | main */
.ide-body { display: grid; grid-template-columns: var(--side-w) 5px 1fr; min-height: 0; }
.ide-side { overflow: auto; background: var(--i-side); min-width: 0; }
.ide-vsplit, .ide-hsplit { background: var(--i-line); touch-action: none; }
.ide-vsplit { cursor: col-resize; } .ide-hsplit { cursor: row-resize; height: 5px; }
.ide-vsplit:hover, .ide-hsplit:hover { background: var(--i-brand); }
.ide-main { display: grid; grid-template-rows: 34px 1fr 5px var(--panel-h); min-width: 0; min-height: 0; }
.ide-files { grid-row: 1; } .ide-editor { grid-row: 2; } .ide-hsplit { grid-row: 3; } .ide-panel { grid-row: 4; }
.ide-files { display: flex; align-items: stretch; background: var(--i-bar); border-bottom: 1px solid var(--i-line); }
.ide-file { display: flex; align-items: center; gap: 7px; padding: 0 14px; font: 13px/1 'JetBrains Mono', monospace; color: var(--i-muted); border-right: 1px solid var(--i-line); }
.ide-file.on { background: var(--i-bg); color: var(--i-text); box-shadow: inset 0 2px 0 var(--i-accent); }
.ide-file b { font-weight: 400; }
.ide-dot { color: var(--i-accent); font-style: normal; font-size: 11px; }
.ide-hint { margin-left: auto; align-self: center; padding: 0 12px; color: var(--i-warn); font-size: 12px; }
.ide-editor { min-height: 0; position: relative; }
.ide-loading { padding: 24px; color: var(--i-muted); }

/* problem / playground panel */
.ide-doc { padding: 18px 20px 40px; }
.ide-doc h1 { font: 700 21px/1.25 Inter, sans-serif; margin: 10px 0 12px; }
.ide-doc h3 { font: 700 12px/1 Inter, sans-serif; text-transform: uppercase; letter-spacing: .07em; color: var(--i-muted); margin: 22px 0 8px; }
.ide-doc .prose { color: var(--i-text); font: 15px/1.6 Inter, sans-serif; }
.ide-doc .prose p { margin: 0 0 10px; }
.ide-doc code, .ide-sample code { font: 13px/1.5 'JetBrains Mono', monospace; background: var(--i-chip); color: var(--i-text); padding: 1px 5px; border-radius: 4px; overflow-wrap: anywhere; }
.ide-doc pre { background: var(--i-input); border: 1px solid var(--i-line); border-radius: 8px; padding: 10px; overflow: auto; }
.ide-doc pre code { background: none; padding: 0; }
.ide-doc ul { padding-left: 20px; margin: 0; }
.ide-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ide-chip { font: 600 12px/1 Inter, sans-serif; padding: 5px 9px; border-radius: 999px; background: var(--i-chip); color: var(--i-muted); }
.ide-chip.easy { color: var(--i-ok); } .ide-chip.medium { color: var(--i-warn); } .ide-chip.hard { color: var(--i-bad); }
.ide-sample { border-left: 3px solid var(--i-line); padding: 6px 0 6px 12px; margin: 12px 0; }
.ide-sample b { display: block; font-size: 13px; margin-bottom: 4px; }
.ide-sample div { display: flex; gap: 8px; align-items: baseline; margin: 3px 0; min-width: 0; }
.ide-sample span { color: var(--i-muted); font-size: 13px; width: 50px; flex: none; }
.ide-det { border: 1px solid var(--i-line); border-radius: 8px; margin: 8px 0; padding: 0 12px; }
.ide-det summary { cursor: pointer; padding: 10px 0; font-weight: 600; }
.ide-det[open] summary { border-bottom: 1px solid var(--i-line); margin-bottom: 10px; }
.ide-note { color: var(--i-muted); font-size: 13px; margin: 6px 0; }
.ide-stdin { width: 100%; box-sizing: border-box; background: var(--i-input); color: var(--i-text); border: 1px solid var(--i-line); border-radius: 8px; padding: 10px; font: 13px/1.5 'JetBrains Mono', monospace; resize: vertical; }
.ide-keys { list-style: none; padding: 0 !important; display: grid; gap: 6px; font-size: 13px; }
.ide kbd { font: 600 11px/1 'JetBrains Mono', monospace; border: 1px solid var(--i-line); border-bottom-width: 2px; border-radius: 4px; padding: 2px 5px; background: var(--i-input); }
.ide-doc .code-tabs-bar button { color: var(--i-muted); }

/* bottom panel */
.ide-panel { display: grid; grid-template-rows: 32px 1fr; min-height: 0; background: var(--i-bar); }
.ide-ptabs { display: flex; gap: 2px; padding: 0 8px; overflow-x: auto; scrollbar-width: none; white-space: nowrap; border-bottom: 1px solid var(--i-line); }
.ide-ptabs button { background: none; border: 0; color: var(--i-muted); font: 600 12px/1 Inter, sans-serif; text-transform: uppercase; letter-spacing: .05em; padding: 0 10px; cursor: pointer; }
.ide-ptabs button.on { color: var(--i-text); box-shadow: inset 0 -2px 0 var(--i-accent); }
.ide-pbody { overflow: auto; padding: 10px 14px 16px; min-height: 0; }
.ide-cases { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 10px; }
.ide-case { display: inline-flex; align-items: center; gap: 6px; background: var(--i-chip); color: var(--i-text); border: 1px solid transparent; border-radius: 6px; padding: 5px 10px; font: 600 12px/1 Inter, sans-serif; cursor: pointer; }
.ide-case.on { border-color: var(--i-muted); }
.ide-case.pass { color: var(--i-ok); } .ide-case.fail { color: var(--i-bad); }
.ide-case.add { padding: 5px 7px; }
.ide-case i { font-style: normal; opacity: .6; } .ide-case i:hover { opacity: 1; color: var(--i-bad); }
.ide-hidden { font: 600 12px/1 Inter, sans-serif; margin-left: 4px; } .ide-hidden.pass { color: var(--i-ok); } .ide-hidden.fail { color: var(--i-bad); }
.ide-arg { display: block; margin: 0 0 8px; }
.ide-arg span { display: block; font: 12px/1.6 'JetBrains Mono', monospace; color: var(--i-muted); }
.ide-arg textarea { width: 100%; box-sizing: border-box; resize: none; overflow: hidden; background: var(--i-input); color: var(--i-text); border: 1px solid var(--i-line); border-radius: 6px; padding: 7px 9px; font: 13px/1.45 'JetBrains Mono', monospace; }
.ide-arg textarea:focus, .ide-stdin:focus { outline: 1px solid var(--i-brand); }
.ide-verdict { font: 700 18px/1.2 Inter, sans-serif; margin: 2px 0 10px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; }
.ide-verdict small { font: 500 13px/1 Inter, sans-serif; color: var(--i-muted); }
.ide-verdict.ok { color: var(--i-ok); } .ide-verdict.bad { color: var(--i-bad); } .ide-verdict.info { color: var(--i-text); }
.ide-io > span { display: block; font: 600 12px/1 Inter, sans-serif; color: var(--i-muted); margin: 10px 0 5px; }
.ide-pre { margin: 0; background: var(--i-input); border: 1px solid var(--i-line); border-radius: 6px; padding: 8px 10px; font: 13px/1.5 'JetBrains Mono', monospace; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--i-text); }
.ide-pre.bad { color: var(--i-bad); } .ide-pre.ok { color: var(--i-ok); } .ide-pre.err { color: var(--i-bad); border-color: color-mix(in srgb, var(--i-bad) 40%, transparent); }
.ide-pre.log { color: var(--i-muted); }
.ide-hfail { margin-top: 12px; } .ide-hfail summary { cursor: pointer; color: var(--i-muted); font-size: 13px; }
.ide-empty { color: var(--i-muted); display: flex; align-items: center; gap: 10px; }
.ide-spin { width: 14px; height: 14px; border: 2px solid var(--i-line); border-top-color: var(--i-accent); border-radius: 50%; animation: ide-spin .8s linear infinite; }
@keyframes ide-spin { to { transform: rotate(360deg); } }

/* status bar */
.ide-status { display: flex; align-items: center; gap: 16px; padding: 0 10px; background: var(--i-brand); color: #fff; font: 12px/1 Inter, sans-serif; white-space: nowrap; overflow: hidden; }
.ide-sb-hint { margin-left: auto; opacity: .85; }
.ide-mtabs { display: none; }

/* phones and small tablets: one pane at a time */
@media (max-width: 899px) {
  .ide { grid-template-rows: 46px 1fr 44px; }
  .ide-status { display: none; }
  .ide-crumb { display: none; }
  .ide-brand b { display: none; }
  .ide-top { gap: 8px; padding: 0 8px; }
  .ide-btn { padding: 8px 10px; }
  .ide-btn span { display: none; }
  .ide-actions { gap: 4px; }
  .ide-icon { width: 30px; }
  .ide-body { grid-template-columns: 1fr; }
  .ide-vsplit, .ide-hsplit { display: none; }
  .ide-main { grid-template-rows: 34px 1fr 0 0; }
  .ide[data-mtab="problem"] .ide-main { display: none; }
  .ide[data-mtab="code"] .ide-side, .ide[data-mtab="panel"] .ide-side { display: none; }
  .ide[data-mtab="code"] .ide-panel { display: none; }
  .ide[data-mtab="panel"] .ide-main { grid-template-rows: 0 0 0 1fr; }
  .ide[data-mtab="panel"] .ide-files, .ide[data-mtab="panel"] .ide-editor { visibility: hidden; overflow: hidden; }
  .ide-mtabs { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--i-bar); border-top: 1px solid var(--i-line); }
  .ide-mtabs button { background: none; border: 0; color: var(--i-muted); font: 600 13px/1 Inter, sans-serif; }
  .ide-mtabs button.on { color: var(--i-text); box-shadow: inset 0 2px 0 var(--i-accent); }
  .ide-doc { padding: 14px 16px 30px; }
}
@media (max-width: 380px) { .ide-lang { max-width: 96px; } }
/* submissions */
.ide-subs { display: grid; gap: 6px; }
.ide-sub { border: 1px solid var(--i-line); border-radius: 8px; background: var(--i-side); }
.ide-sub summary { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 8px 12px; cursor: pointer; font-size: 13px; color: var(--i-muted); }
.ide-sub summary .v { font-weight: 700; } .ide-sub summary .v.ok { color: var(--i-ok); } .ide-sub summary .v.bad { color: var(--i-bad); }
.ide-sub summary time { margin-left: auto; }
.ide-sub .ide-pre { margin: 0 12px 8px; max-height: 260px; overflow: auto; }
.ide-subload { margin: 0 12px 10px; padding: 6px 12px; border-radius: 6px; border: 1px solid var(--i-line); background: var(--i-chip); color: var(--i-text); font: 600 12.5px/1.2 Inter, sans-serif; cursor: pointer; }
.ide-subload:hover { border-color: var(--i-accent); }
