* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0b0e14;
  --card: #161b29;
  --card2: #1d2333;
  --border: #293049;
  --text: #e8ecf5;
  --muted: #8b93ab;
  --accent: #7c5cff;
  --accent2: #3b82f6;
  --green: #22c55e;
  --red: #ef4444;
  --amber: #f59e0b;
  --radius: 16px;
}

html { color-scheme: dark; }

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15.5px;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(700px 420px at 12% -8%, rgba(124, 92, 255, 0.16), transparent 65%),
    radial-gradient(700px 420px at 95% 105%, rgba(59, 82, 246, 0.10), transparent 65%);
  z-index: 0;
}

.container { width: calc(100% - 48px); max-width: 1600px; margin: 0 auto; padding: 22px 0 70px; position: relative; z-index: 1; }

.topbar { display: flex; align-items: center; justify-content: space-between; padding: 6px 2px 22px; position: relative; }
.logo { font-size: 23px; font-weight: 800; letter-spacing: 0.3px; cursor: default;
  background: linear-gradient(92deg, #b3a4ff 10%, #6ea8ff 90%);
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.topbar-hint { color: var(--muted); font-size: 13px; }

.app-tabs { position: absolute; left: 50%; transform: translateX(-50%); display: flex; gap: 4px; padding: 4px; border: 1px solid var(--border);
  border-radius: 12px; background: rgba(29, 35, 51, 0.74); }
.app-tab { border: 0; border-radius: 9px; padding: 7px 19px; background: transparent; color: var(--muted);
  font-family: inherit; font-size: 13px; font-weight: 700; cursor: pointer; transition: background 0.15s, color 0.15s, transform 0.15s; }
.app-tab:hover { color: var(--text); }
.app-tab.active { background: #385bd7; color: #fff; box-shadow: 0 4px 14px rgba(59, 130, 246, 0.28); }

.screen { display: none; }
.screen.active { display: block; animation: fadeUp 0.32s ease; }
.screen.hidden { display: none !important; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

h1 { font-size: 26px; font-weight: 750; letter-spacing: 0.2px; }
h2 { font-size: 20px; font-weight: 650; line-height: 1.45; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 10px 18px; border-radius: 12px; border: 1px solid transparent;
  font-family: inherit; font-size: 14.5px; font-weight: 650; cursor: pointer;
  transition: transform 0.15s, filter 0.15s, background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.btn svg { flex: none; }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff;
  box-shadow: 0 6px 20px rgba(124, 92, 255, 0.3); }
.btn.primary:hover { transform: translateY(-1px); filter: brightness(1.1); }
.btn.ghost { background: var(--card2); border-color: var(--border); color: var(--text); }
.btn.ghost:hover { border-color: #3a4260; transform: translateY(-1px); }
.btn.danger { background: rgba(239, 68, 68, 0.1); border-color: rgba(239, 68, 68, 0.35); color: #f87171; }
.btn.danger:hover { background: rgba(239, 68, 68, 0.18); }
.btn.danger.armed { background: var(--red); border-color: var(--red); color: #fff; }
.btn.small { padding: 8px 14px; font-size: 13.5px; border-radius: 10px; }

.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.panel-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.panel-sub { color: var(--muted); font-size: 14px; margin-top: 6px; }

.test-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 18px; }

.test-card { display: flex; flex-direction: column; gap: 14px; animation: fadeUp 0.3s ease; transition: border-color 0.2s; }
.test-card:hover { border-color: #384064; }
.test-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.test-card-head h3 { font-size: 17px; font-weight: 700; line-height: 1.35; word-break: break-word; }
.test-meta { color: var(--muted); font-size: 13px; margin-top: 5px; }

.stat-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.chip { font-size: 12.5px; font-weight: 650; padding: 4px 10px; border-radius: 999px;
  background: var(--card2); border: 1px solid var(--border); color: var(--muted); }
.chip b { color: var(--text); }

.test-stats { display: flex; flex-direction: column; gap: 7px; background: var(--card2);
  border: 1px solid var(--border); border-radius: 13px; padding: 13px 14px; }
.attempt-row { display: grid; grid-template-columns: 76px 1fr 46px; align-items: center; gap: 10px; }
.attempt-name { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.attempt-bar { height: 9px; background: #121624; border-radius: 99px; overflow: hidden; }
.attempt-bar i { display: block; height: 100%; border-radius: 99px; transition: width 0.4s ease; }
.attempt-bar i.good { background: linear-gradient(90deg, #16a34a, #4ade80); }
.attempt-bar i.mid { background: linear-gradient(90deg, #d97706, #fbbf24); }
.attempt-bar i.bad { background: linear-gradient(90deg, #dc2626, #f87171); }
.attempt-pct { font-size: 13px; font-weight: 750; text-align: right; }
.attempt-pct.good { color: #4ade80; }
.attempt-pct.mid { color: var(--amber); }
.attempt-pct.bad { color: #f87171; }
.attempt-more { font-size: 12.5px; color: var(--muted); }
.no-attempts { font-size: 13px; color: var(--muted); font-style: italic; }

.test-actions { display: flex; gap: 8px; margin-top: auto; flex-wrap: wrap; }
.test-actions .btn { flex: 1; }

.empty-card { text-align: center; padding: 54px 24px; grid-column: 1 / -1; }
.empty-icon { width: 66px; height: 66px; margin: 0 auto 18px; border-radius: 20px;
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.15), rgba(59, 130, 246, 0.12));
  border: 1px solid rgba(124, 92, 255, 0.4); display: grid; place-items: center; color: #a99bff; }
.empty-card h3 { font-size: 19px; margin-bottom: 8px; }
.empty-card p { color: var(--muted); margin-bottom: 20px; }

.editor-grid { display: grid; grid-template-columns: 1.55fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 880px) { .editor-grid { grid-template-columns: 1fr; } }

.editor-label { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.6px; margin-bottom: 10px; display: block; }

textarea {
  width: 100%; min-height: 380px; resize: vertical; background: #10141f; color: var(--text);
  border: 1px solid var(--border); border-radius: 13px; padding: 14px;
  font-family: Consolas, "Cascadia Mono", monospace; font-size: 14.5px; line-height: 1.65;
  outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.15); }
textarea::placeholder { color: #55607c; }

.mode-pick { margin-top: 16px; }
.mode-option { display: flex; gap: 10px; align-items: center; cursor: pointer; padding: 11px 14px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--card2); margin-bottom: 8px;
  transition: border-color 0.15s, background 0.15s; }
.mode-option:hover { border-color: #3a4260; }
.mode-option input { display: none; }
.mode-dot { width: 17px; height: 17px; border-radius: 50%; border: 2px solid var(--muted); position: relative; flex: none;
  transition: border-color 0.15s; }
.mode-option input:checked ~ .mode-dot { border-color: var(--accent); }
.mode-option input:checked ~ .mode-dot::after { content: ""; position: absolute; inset: 2.5px; border-radius: 50%; background: var(--accent); }
.mode-option:has(input:checked) { border-color: rgba(124, 92, 255, 0.55); background: rgba(124, 92, 255, 0.08); }

#syntax-errors { margin-top: 14px; }
.error-box { background: rgba(239, 68, 68, 0.09); border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: 12px; padding: 13px 15px; }
.error-box-title { color: #f87171; font-weight: 750; font-size: 14px; margin-bottom: 7px; }
.error-box ul { list-style: none; }
.error-box li { color: #fca5a5; font-size: 13.5px; padding: 2.5px 0; }

.editor-actions { display: flex; gap: 10px; margin-top: 16px; }

.help-card h3 { font-size: 16px; font-weight: 700; margin-bottom: 12px; }
.help-card pre { background: #10141f; border: 1px solid var(--border); border-radius: 12px; padding: 14px;
  font-family: Consolas, "Cascadia Mono", monospace; font-size: 13.5px; line-height: 1.6;
  overflow-x: auto; color: #c7d2fe; margin-bottom: 14px; }
.help-card ul { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.help-card li { font-size: 13.5px; color: var(--muted); line-height: 1.5; padding-left: 14px; position: relative; }
.help-card li::before { content: ""; position: absolute; left: 0; top: 8px; width: 6px; height: 6px;
  border-radius: 50%; background: var(--accent); }
.help-card code { background: var(--card2); border: 1px solid var(--border); padding: 1px 7px;
  border-radius: 6px; font-family: Consolas, monospace; font-size: 12.5px; color: #c7d2fe; }

.run-top { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.run-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.run-title > span:first-child { font-weight: 700; font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mode-badge { font-size: 12px; font-weight: 650; padding: 3px 10px; border-radius: 999px; flex: none;
  background: rgba(124, 92, 255, 0.14); border: 1px solid rgba(124, 92, 255, 0.4); color: #b3a4ff; }

.progress { height: 9px; background: var(--card2); border: 1px solid var(--border); border-radius: 99px; overflow: hidden; }
#run-progress-bar { height: 100%; width: 0; border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width 0.35s ease; }

.run-counter { color: var(--muted); font-size: 13.5px; font-weight: 650; margin: 14px 2px; }

.run-card { max-width: 780px; margin: 0 auto; }
.run-card h2 { margin-bottom: 20px; }

.answer {
  display: flex; gap: 13px; align-items: center; width: 100%; text-align: left;
  padding: 14px 16px; margin-bottom: 10px; border-radius: 14px;
  background: var(--card2); border: 1px solid var(--border); color: var(--text);
  font-family: inherit; font-size: 15.5px; cursor: pointer;
  transition: border-color 0.15s, transform 0.15s, background 0.15s;
}
.answer:hover:not(:disabled) { border-color: var(--accent); transform: translateX(4px); }
.answer:disabled { cursor: default; }
.answer .letter { width: 31px; height: 31px; border-radius: 10px; flex: none; display: grid; place-items: center;
  background: rgba(124, 92, 255, 0.15); color: #b3a4ff; font-weight: 800; font-size: 14px; }
.answer.correct { border-color: var(--green); background: rgba(34, 197, 94, 0.12); }
.answer.correct .letter { background: var(--green); color: #04220f; }
.answer.wrong { border-color: var(--red); background: rgba(239, 68, 68, 0.12); }
.answer.wrong .letter { background: var(--red); color: #2a0606; }

.exact-row { display: flex; gap: 10px; }
.exact-row input {
  flex: 1; min-width: 0; background: #10141f; color: var(--text); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 16px; font-family: inherit; font-size: 16px; outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.exact-row input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.15); }
.exact-row input:disabled { opacity: 0.75; }
.exact-row.correct input { border-color: var(--green); background: rgba(34, 197, 94, 0.1); }
.exact-row.wrong input { border-color: var(--red); background: rgba(239, 68, 68, 0.1); }

@keyframes shake { 0%, 100% { transform: none; } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.shake { animation: shake 0.25s; border-color: var(--red) !important; }

.feedback { margin-top: 6px; padding: 12px 16px; border-radius: 12px; font-size: 14.5px; font-weight: 650; }
.feedback.good { background: rgba(34, 197, 94, 0.12); border: 1px solid rgba(34, 197, 94, 0.4); color: #6ee7a0; }
.feedback.bad { background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.4); color: #fca5a5; }
.run-next-wrap { margin-top: 14px; display: flex; justify-content: flex-end; }

.hidden { display: none !important; }

.result-card { max-width: 740px; margin: 0 auto; }
.result-top { display: flex; gap: 26px; align-items: center; margin-bottom: 22px; }
.ring-wrap { position: relative; width: 132px; height: 132px; flex: none; }
.ring-bg { stroke: #232a41; }
#ring-val { transition: stroke-dashoffset 0.9s cubic-bezier(0.3, 0.8, 0.3, 1); }
#result-percent { position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 27px; font-weight: 800; }
.result-info h2 { font-size: 23px; margin-bottom: 12px; }
.result-chips { display: flex; gap: 9px; flex-wrap: wrap; }
.rchip { font-size: 13px; font-weight: 650; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--card2); color: var(--muted); }
.rchip b { font-size: 14px; }
.rchip.good b { color: #4ade80; }
.rchip.bad b { color: #f87171; }

.errors-title { font-size: 15px; font-weight: 750; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.6px; margin-bottom: 12px; }
.error-item { background: var(--card2); border: 1px solid var(--border); border-left: 3px solid var(--red);
  border-radius: 12px; padding: 13px 16px; margin-bottom: 9px; }
.error-item.ok { border-left-color: var(--green); }
.error-q { font-weight: 650; font-size: 14.5px; margin-bottom: 8px; line-height: 1.4; }
.error-ans { display: flex; gap: 8px; flex-wrap: wrap; }
.tag { font-size: 12.5px; font-weight: 650; padding: 4px 10px; border-radius: 8px; }
.tag.bad { background: rgba(239, 68, 68, 0.12); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.3); }
.tag.good { background: rgba(34, 197, 94, 0.12); color: #6ee7a5; border: 1px solid rgba(34, 197, 94, 0.3); }

.allgood { background: rgba(34, 197, 94, 0.1); border: 1px solid rgba(34, 197, 94, 0.35); color: #6ee7a5;
  padding: 15px 18px; border-radius: 12px; font-weight: 650; font-size: 14.5px; }

.result-actions { display: flex; gap: 10px; margin-top: 22px; }

@media (max-width: 620px) {
  .result-top { flex-direction: column; text-align: center; }
  .result-chips { justify-content: center; }
}

.attempt-row.clickable { cursor: pointer; border-radius: 8px; padding: 3px 6px; margin: 0 -6px; transition: background 0.15s; }
.attempt-row.clickable:hover { background: rgba(124, 92, 255, 0.09); }
.attempt-row.clickable:hover .attempt-name { color: var(--text); }

.result-attempt { color: var(--muted); font-size: 13px; margin-top: 10px; }

.mode-option input[type="checkbox"] ~ .mode-dot { border-radius: 5px; }
.mode-option input[type="checkbox"]:checked ~ .mode-dot { border-color: var(--accent); background: var(--accent); }
.mode-option input[type="checkbox"]:checked ~ .mode-dot::after { content: ""; position: absolute; left: 4.5px; top: 1.5px;
  width: 4px; height: 8px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }

.answer-desc { margin: -4px 0 12px; padding: 10px 14px; font-size: 13.5px; line-height: 1.55; color: #b9c1d6;
  background: #121624; border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 10px;
  animation: fadeUp 0.25s ease; }
.answer-desc.good { border-left-color: var(--green); }
.answer-desc.bad { border-left-color: var(--red); }

.error-desc { margin-top: 9px; padding-top: 9px; border-top: 1px dashed var(--border); font-size: 13px;
  color: var(--muted); line-height: 1.5; }

.notes-screen { animation: fadeUp 0.28s ease; }
.notes-active { overflow: hidden; }
body.notes-active .container { padding-bottom: 0; }
.notes-topbar { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; margin-bottom: 8px; }
.notes-layout { display: grid; grid-template-columns: 310px minmax(0, 1fr); gap: 16px; height: calc(100vh - 185px); min-height: 0; }
.notes-explorer { padding: 14px 10px; min-width: 0; }
.notes-explorer-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 0 5px 11px;
  color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: 1px; }
.notes-selected-actions { display: flex; gap: 2px; }
.icon-btn { border: 0; color: var(--muted); background: transparent; border-radius: 7px; padding: 4px 6px; cursor: pointer; font-size: 15px; }
.icon-btn:hover { color: var(--text); background: var(--card2); }
.danger-icon:hover { color: #f87171; }
.notes-tree { overflow: auto; max-height: calc(100vh - 250px); min-height: 150px; padding-right: 3px; }
.tree-row { display: flex; align-items: center; min-width: 0; gap: 6px; padding: 7px 7px; margin: 1px 0; border-radius: 8px; color: var(--muted); cursor: pointer; font-size: 13.5px; }
.tree-row:hover, .tree-row.selected { background: rgba(124, 92, 255, 0.12); color: var(--text); }
.tree-row.drag-over { outline: 1px dashed #9d8cff; background: rgba(124, 92, 255, 0.2); }
.tree-row .tree-icon { width: 16px; flex: none; text-align: center; color: #8da2ff; }
.tree-row .tree-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-children { margin-left: 15px; border-left: 1px solid rgba(41, 48, 73, 0.65); padding-left: 4px; }
.notes-main { min-width: 0; padding: 0; overflow: hidden; min-height: 0; height: 100%; }
.notes-empty { display: grid; place-items: center; align-content: center; height: 100%; min-height: 0; padding: 30px; text-align: center; color: var(--muted); }
.notes-empty .empty-icon { margin-bottom: 15px; }
.notes-empty h2 { color: var(--text); margin-bottom: 7px; }
.notes-empty p { font-size: 14px; }
.notes-editor { height: 100%; min-height: 0; display: flex; flex-direction: column; }
.notes-filebar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--border); }
.notes-file-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 700; }
.notes-editor-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.notes-save-state { color: var(--muted); font-size: 11px; margin-right: 5px; }
.view-toggle { border: 1px solid var(--border); border-radius: 8px; padding: 6px 9px; color: var(--muted); background: var(--card2); font-size: 12px; cursor: pointer; }
.view-toggle.active { color: #fff; border-color: #536ddd; background: #385bd7; }
.notes-editor-body { flex: 1; min-height: 0; }
#notes-source, .notes-preview { width: 100%; height: 100%; min-height: 0; border: 0; border-radius: 0; resize: none; padding: 23px 25px; }
#notes-source { display: block; background: #10141f; font-size: 15px; line-height: 1.75; }
.notes-preview { overflow: auto; background: #131827; }
.markdown-body { color: #dfe5f4; line-height: 1.7; font-size: 15px; }
.markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4 { color: #f2f5ff; margin: 1.1em 0 .45em; }
.markdown-body h1 { font-size: 30px; } .markdown-body h2 { font-size: 24px; } .markdown-body h3 { font-size: 19px; }
.markdown-body p { margin: .75em 0; }
.markdown-body a { color: #8eabff; } .markdown-body img { max-width: 100%; border-radius: 10px; }
.markdown-body blockquote { margin: 12px 0; padding: 8px 15px; border-left: 3px solid var(--accent); background: rgba(124, 92, 255, .08); color: #bfc8de; }
.markdown-body ul, .markdown-body ol { padding-left: 25px; margin: .65em 0; }
.markdown-body li { margin: 3px 0; } .markdown-body input[type="checkbox"] { accent-color: var(--accent); margin-right: 7px; }
.markdown-body pre { overflow: auto; padding: 15px; border-radius: 10px; background: #0c1019; border: 1px solid var(--border); }
.markdown-body code { font-family: Consolas, "Cascadia Mono", monospace; background: rgba(124, 92, 255, .12); border-radius: 5px; padding: 2px 5px; }
.markdown-body pre code { background: none; padding: 0; } .markdown-body table { border-collapse: collapse; width: 100%; margin: 12px 0; }
.markdown-body th, .markdown-body td { border: 1px solid var(--border); padding: 7px 10px; text-align: left; }
.markdown-body th { background: var(--card2); } .markdown-body hr { border: 0; border-top: 1px solid var(--border); margin: 22px 0; }
.math-block { overflow-x: auto; padding: 10px 0; text-align: center; font-family: Georgia, serif; font-size: 18px; color: #d8c9ff; }
.math-inline { font-family: Georgia, serif; color: #d8c9ff; font-style: italic; }

.notes-context-menu { position: fixed; z-index: 50; width: 210px; padding: 6px; border: 1px solid #3b4668;
  border-radius: 11px; background: #171d2c; box-shadow: 0 15px 38px rgba(0, 0, 0, .45); }
.notes-context-menu button { display: block; width: 100%; border: 0; border-radius: 7px; padding: 9px 10px;
  background: transparent; color: var(--text); text-align: left; font-family: inherit; font-size: 13px; cursor: pointer; }
.notes-context-menu button:hover { background: rgba(124, 92, 255, .18); }
.notes-context-menu button:disabled { color: #59627b; cursor: default; background: transparent; }
.notes-context-menu button.context-danger { color: #f79a9a; }
.context-separator { height: 1px; margin: 5px 3px; background: var(--border); }

body.notes-focus-mode { overflow: hidden; }
body.notes-focus-mode .container { width: 100%; max-width: none; padding: 0; }
body.notes-focus-mode .topbar,
body.notes-focus-mode .notes-topbar,
body.notes-focus-mode .notes-explorer { display: none; }
body.notes-focus-mode .notes-screen { position: fixed; inset: 0; z-index: 30; padding: 0; background: var(--bg); }
body.notes-focus-mode .notes-layout { display: block; height: 100vh; }
body.notes-focus-mode .notes-main { height: 100vh; border: 0; border-radius: 0; }
body.notes-focus-mode .notes-editor { height: 100vh; }
body.notes-focus-mode .notes-filebar { padding: 12px 16px; }
body.notes-focus-mode #notes-source,
body.notes-focus-mode .notes-preview { height: calc(100vh - 57px); min-height: 0; }
body.notes-focus-mode #notes-source-mode { display: none; }

.dialog-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px;
  background: rgba(4, 6, 12, .72); backdrop-filter: blur(6px); }
.app-dialog { width: min(430px, 100%); padding: 22px; border: 1px solid #3b4668; border-radius: 17px;
  background: #171d2c; box-shadow: 0 22px 70px rgba(0, 0, 0, .55); animation: fadeUp .18s ease; }
.app-dialog h2 { font-size: 19px; margin-bottom: 8px; }
.app-dialog p { color: var(--muted); line-height: 1.5; white-space: pre-wrap; }
.dialog-input { width: 100%; margin-top: 16px; padding: 11px 13px; border: 1px solid var(--border); border-radius: 10px;
  outline: none; background: #10141f; color: var(--text); font-family: inherit; font-size: 15px; }
.dialog-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124,92,255,.16); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; }

@media (max-width: 700px) {
  body.notes-active { overflow: auto; }
  body.notes-active .container { padding-bottom: 50px; }
  .topbar { flex-wrap: wrap; gap: 12px; }
  .app-tabs { position: static; transform: none; order: 3; width: 100%; justify-content: center; }
  .app-tab { flex: 1; }
  .notes-topbar { align-items: flex-start; flex-direction: column; }
  .notes-layout { grid-template-columns: 1fr; height: auto; min-height: 0; }
  .notes-explorer { min-height: 190px; }
  .notes-tree { max-height: 190px; }
  .notes-main, .notes-editor { min-height: 520px; height: auto; }
  #notes-source, .notes-preview { height: auto; min-height: 455px; padding: 17px; }
}
@media (max-width: 480px) {
  .container { width: calc(100% - 24px); padding: 14px 0 50px; }
  .card { padding: 16px; }
  .topbar-hint { display: none; }
  .panel-head { flex-wrap: wrap; }
  h1 { font-size: 22px; }
  .editor-actions { flex-direction: column; }
  .editor-actions .btn { width: 100%; }
  .result-actions { flex-direction: column; }
  .result-actions .btn { width: 100%; }
  .test-actions .btn { padding: 9px 8px; font-size: 12.5px; }
  textarea { font-size: 16px; }
  .run-title .mode-badge { display: none; }
  .answer { font-size: 15px; }
}
