/* 跟着单老师学Python —— 小学生风格主题 */

:root {
  --ink: #2c3a55;
  --ink-2: #5d6c88;
  --ink-3: #97a4bd;
  --line: #dde7f5;
  --line-2: #cbd9ee;
  --card: #ffffff;
  --soft: #f4f8fe;

  --green: #22c55e;
  --green-soft: #e6f9ee;
  --blue: #3d8bfd;
  --blue-soft: #e8f1ff;
  --purple: #a259ff;
  --purple-soft: #f3ebff;
  --orange: #ff8f3d;
  --orange-soft: #fff2e4;
  --red: #ff5d73;
  --red-soft: #ffecef;
  --yellow: #ffd93d;

  --lv1: #22c55e;
  --lv2: #3d8bfd;
  --lv3: #a259ff;

  --r: 20px;
  --r-sm: 13px;
  --stick: 0 3px 0 rgba(44, 58, 85, .07), 0 10px 26px rgba(44, 58, 85, .07);
  --mono: "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: "HarmonyOS Sans SC", "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.7;
  color: var(--ink);
  background: #eaf4ff;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
}

/* 背景：蓝天 + 软软的云 */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 255, 255, .95) 0 42px, transparent 43px),
    radial-gradient(circle at 18% 20%, rgba(255, 255, 255, .95) 0 56px, transparent 57px),
    radial-gradient(circle at 25% 17%, rgba(255, 255, 255, .95) 0 38px, transparent 39px),
    radial-gradient(circle at 82% 12%, rgba(255, 255, 255, .9) 0 46px, transparent 47px),
    radial-gradient(circle at 88% 15%, rgba(255, 255, 255, .9) 0 34px, transparent 35px),
    linear-gradient(180deg, #d8ecff 0%, #eef6ff 42%, #f7fbff 100%);
}

button { font-family: inherit; }

/* ---------------- 开场动画 ---------------- */
.boot {
  position: fixed; inset: 0; z-index: 95;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #dff0ff 0%, #fff6e4 60%, #e7fbef 100%);
  transition: opacity .4s ease, visibility .4s;
}
.boot.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.boot-card {
  background: #fff; border: 3px solid #fff; border-radius: 28px;
  padding: 32px 42px; width: min(430px, 88vw); text-align: center;
  box-shadow: 0 6px 0 rgba(44, 58, 85, .08), 0 24px 50px rgba(44, 58, 85, .12);
}
.boot-logo { font-size: 56px; line-height: 1; animation: bobbing 1.4s ease-in-out infinite; }
@keyframes bobbing { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-10px) rotate(4deg); } }
.boot-title { font-size: 22px; font-weight: 800; margin-top: 8px; letter-spacing: 1px; }
.boot-status { color: var(--ink-2); margin-top: 6px; font-size: 14px; }
.boot-bar { height: 12px; background: #eaf1fb; border-radius: 99px; margin: 18px 0 12px; overflow: hidden; }
.boot-bar i {
  display: block; height: 100%; width: 15%; border-radius: 99px;
  background: linear-gradient(90deg, #ffd93d, #4ade80, #3d8bfd);
  transition: width .55s ease;
}
.boot-tip { color: var(--ink-3); font-size: 12.5px; }

/* ---------------- 顶栏 ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  flex: 0 0 auto; min-height: 68px;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(8px);
  border-bottom: 3px solid #fff;
  box-shadow: 0 3px 0 rgba(44, 58, 85, .05);
  display: flex; align-items: center; gap: 16px; padding: 8px 18px; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 11px; flex: 0 0 auto; }
.logo {
  width: 44px; height: 44px; border-radius: 14px; flex: 0 0 auto; font-size: 24px;
  background: linear-gradient(135deg, #ffe27a, #7ee787 55%, #7cc4ff);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 0 rgba(44, 58, 85, .12);
  animation: bobbing 3.2s ease-in-out infinite;
}
.brand-name { font-weight: 800; font-size: 17px; line-height: 1.2; letter-spacing: .5px; }
.brand-sub { font-size: 11.5px; color: var(--ink-3); line-height: 1.2; }

.levels { display: flex; gap: 9px; flex: 1 1 auto; justify-content: center; flex-wrap: wrap; }
.lv-tab {
  border: 3px solid transparent; background: #fff; color: var(--ink-2);
  padding: 7px 16px; border-radius: 99px; cursor: pointer;
  font-size: 14px; font-weight: 700;
  display: flex; align-items: center; gap: 7px;
  box-shadow: 0 3px 0 rgba(44, 58, 85, .08);
  transition: transform .14s, box-shadow .14s, color .14s;
}
.lv-tab:hover { transform: translateY(-2px); box-shadow: 0 5px 0 rgba(44, 58, 85, .1); }
.lv-tab:active { transform: translateY(1px); box-shadow: 0 1px 0 rgba(44, 58, 85, .1); }
.lv-tab .lv-ico { font-size: 17px; }
.lv-tab .lv-count { font-size: 11.5px; opacity: .75; font-weight: 600; }
.lv-tab.lv1.active { border-color: var(--lv1); background: var(--green-soft); color: #15803d; }
.lv-tab.lv2.active { border-color: var(--lv2); background: var(--blue-soft); color: #1d4ed8; }
.lv-tab.lv3.active { border-color: var(--lv3); background: var(--purple-soft); color: #7e22ce; }

.top-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; }
.chip-progress {
  font-size: 13px; font-weight: 800; color: #b45309;
  background: linear-gradient(135deg, #fff3d1, #ffe6a7);
  border-radius: 99px; padding: 6px 14px; white-space: nowrap;
  box-shadow: 0 2px 0 rgba(180, 83, 9, .18);
}

.btn {
  border: 2px solid var(--line-2); background: #fff; color: var(--ink);
  border-radius: 13px; padding: 8px 16px; font-size: 14px; font-weight: 700;
  cursor: pointer; white-space: nowrap;
  box-shadow: 0 3px 0 rgba(44, 58, 85, .09);
  transition: transform .12s, box-shadow .12s, filter .12s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 5px 0 rgba(44, 58, 85, .11); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(44, 58, 85, .11); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.ghost { background: #fff; }
.btn.sm { padding: 5px 12px; font-size: 13px; border-radius: 11px; }
.btn.danger { color: var(--red); border-color: #ffd0d7; }
.btn.run { background: linear-gradient(135deg, #4ade80, #22c55e); border-color: #16a34a; color: #fff; }
.btn.submit { background: linear-gradient(135deg, #7cc4ff, #3d8bfd); border-color: #2563eb; color: #fff; }

/* ---------------- 布局 ---------------- */
.layout { flex: 1 1 auto; display: flex; min-height: 100vh; }

.sidebar {
  flex: 0 0 280px; background: rgba(255, 255, 255, .9);
  border-right: 3px solid #fff; box-shadow: 3px 0 0 rgba(44, 58, 85, .04);
  display: flex; flex-direction: column; min-height: 0;
}
.side-head { padding: 14px 16px 10px; }
.side-title { font-weight: 800; font-size: 15.5px; }
.side-sub { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.lesson-list { overflow-y: auto; padding: 6px 10px 14px; flex: 1 1 auto; }

.lesson-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px;
  border-radius: 14px; cursor: pointer; margin-bottom: 4px;
  border: 2px solid transparent; transition: background .14s, transform .12s;
}
.lesson-item:hover { background: #f2f7ff; transform: translateX(2px); }
.lesson-item.active { background: #fff8e6; border-color: var(--yellow); }
.lesson-idx {
  flex: 0 0 30px; height: 30px; border-radius: 11px; font-size: 13px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  background: #eef3fb; color: var(--ink-2);
}
.lesson-item.lv1 .lesson-idx { background: var(--green-soft); color: #15803d; }
.lesson-item.lv2 .lesson-idx { background: var(--blue-soft); color: #1d4ed8; }
.lesson-item.lv3 .lesson-idx { background: var(--purple-soft); color: #7e22ce; }
.lesson-item.finished .lesson-idx { background: linear-gradient(135deg, #ffe27a, #ffc93c); color: #8a5a00; }
.lesson-item.active .lesson-idx { box-shadow: 0 0 0 3px rgba(255, 217, 61, .35); }
.lesson-name { flex: 1 1 auto; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lesson-meta { flex: 0 0 auto; font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.content { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }

/* ---------------- 课程头部 ---------------- */
.lesson-head { padding: 14px 20px 0; flex: 0 0 auto; }
.lh-row { display: flex; align-items: center; gap: 10px; }
.lh-badge {
  font-size: 12.5px; font-weight: 800; padding: 3px 12px; border-radius: 99px; color: #fff;
  box-shadow: 0 2px 0 rgba(44, 58, 85, .15);
}
.lh-badge.lv1 { background: linear-gradient(135deg, #4ade80, #16a34a); }
.lh-badge.lv2 { background: linear-gradient(135deg, #7cc4ff, #2563eb); }
.lh-badge.lv3 { background: linear-gradient(135deg, #c99bff, #7c3aed); }
.lh-title { font-size: 21px; font-weight: 800; letter-spacing: .5px; }

.lh-goal { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.mascot { font-size: 30px; flex: 0 0 auto; animation: bobbing 2.6s ease-in-out infinite; }
.bubble {
  position: relative; background: #fff; border: 2px solid var(--line);
  border-radius: 16px; padding: 7px 14px; font-size: 13.5px; color: var(--ink-2);
  box-shadow: var(--stick);
}
.bubble::before {
  content: ""; position: absolute; left: -9px; top: 14px;
  width: 14px; height: 14px; background: #fff;
  border-left: 2px solid var(--line); border-bottom: 2px solid var(--line);
  transform: rotate(45deg); border-bottom-left-radius: 4px;
}

.lh-progress { display: flex; align-items: center; gap: 10px; margin-top: 9px; }
.stars { letter-spacing: 2px; font-size: 15px; }
.star { color: #dfe6f2; }
.star.on { color: #ffc93c; text-shadow: 0 1px 0 #e8a900; }
.lh-count { font-size: 12.5px; color: var(--ink-3); font-weight: 700; }

.lh-points { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pt {
  font-size: 12px; padding: 3px 11px; border-radius: 99px; color: var(--ink-2);
  background: #fff; border: 2px solid var(--line);
}

/* ---------------- 题目小关卡 ---------------- */
.ex-bar { display: flex; gap: 9px; padding: 14px 20px; overflow-x: auto; flex: 0 0 auto; }
.ex-chip {
  flex: 0 0 auto; background: #fff; border: 3px solid var(--line);
  border-radius: 16px; padding: 8px 13px; cursor: pointer; min-width: 108px;
  box-shadow: 0 3px 0 rgba(44, 58, 85, .07);
  transition: transform .14s, box-shadow .14s, border-color .14s;
}
.ex-chip:hover { transform: translateY(-3px); box-shadow: 0 6px 0 rgba(44, 58, 85, .1); }
.ex-chip.active { transform: translateY(-3px); }
.ex-chip.t1.active { border-color: var(--green); }
.ex-chip.t2.active { border-color: var(--orange); }
.ex-chip.t3.active { border-color: var(--red); }
.ex-chip.done { background: #f4fdf7; }
.ex-chip.done.active { background: #e9fbef; }
.ec-top { display: flex; align-items: center; justify-content: space-between; }
.ec-n {
  width: 22px; height: 22px; border-radius: 8px; font-size: 12px; font-weight: 800;
  background: #eef3fb; color: var(--ink-2); display: flex; align-items: center; justify-content: center;
}
.ex-chip.t1 .ec-n { background: var(--green-soft); color: #15803d; }
.ex-chip.t2 .ec-n { background: var(--orange-soft); color: #c2410c; }
.ex-chip.t3 .ec-n { background: var(--red-soft); color: #be123c; }
.ex-chip.t1.done .ec-n, .ex-chip.t2.done .ec-n, .ex-chip.t3.done .ec-n {
  background: linear-gradient(135deg, #ffe27a, #ffc93c); color: #8a5a00;
}
.ec-ok { color: var(--green); font-weight: 800; font-size: 13px; }
.ec-t {
  font-size: 13px; font-weight: 700; margin-top: 5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 118px;
}
.ec-tier { font-size: 11px; font-weight: 800; letter-spacing: .5px; }
.ex-chip.t1 .ec-tier { color: #15803d; }
.ex-chip.t2 .ec-tier { color: #c2410c; }
.ex-chip.t3 .ec-tier { color: #be123c; }

/* ---------------- 工作区 ---------------- */
.work { flex: 1 1 auto; display: flex; gap: 14px; padding: 0 20px 16px; min-height: 0; }
.panel {
  background: #fff; border: 3px solid #fff; border-radius: var(--r);
  box-shadow: var(--stick); display: flex; flex-direction: column; min-height: 0;
}
.problem-col { flex: 0 0 40%; min-width: 300px; }
/* 右侧代码区：窗口变矮时整体上下滚动，不会把编辑器或运行结果挤没了 */
.code-col { flex: 1 1 auto; min-width: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.code-col > * { flex-shrink: 0; }
.panel-inner { overflow-y: auto; padding: 16px 18px 22px; }

/* ---------------- 题目 ---------------- */
.pb-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.tier-tag {
  font-size: 12px; font-weight: 800; padding: 3px 12px; border-radius: 99px; color: #fff;
  box-shadow: 0 2px 0 rgba(44, 58, 85, .13);
}
.tier-tag.t1 { background: linear-gradient(135deg, #4ade80, #16a34a); }
.tier-tag.t2 { background: linear-gradient(135deg, #ffb057, #f97316); }
.tier-tag.t3 { background: linear-gradient(135deg, #ff8a9b, #e11d48); }
.pb-id { font-size: 11px; color: var(--ink-3); font-family: var(--mono); }
.pb-title { font-size: 19px; font-weight: 800; margin: 0 0 10px; }
.pb-desc { white-space: pre-wrap; font-size: 14.5px; color: #33415c; margin-bottom: 14px; }

.io-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.io-box { background: var(--soft); border: 2px dashed var(--line-2); border-radius: var(--r-sm); padding: 9px 12px; }
.io-box h4 { margin: 0 0 3px; font-size: 11.5px; color: var(--ink-3); font-weight: 800; letter-spacing: .5px; }
.io-box .v { font-size: 13px; word-break: break-word; }

.sample { margin-bottom: 12px; }
.sample h4 { margin: 0 0 6px; font-size: 13px; font-weight: 800; color: var(--ink-2); }
.sample pre {
  margin: 0 0 7px; background: #22304d; color: #dce9ff; border-radius: var(--r-sm);
  padding: 10px 13px; font-family: var(--mono); font-size: 13px;
  overflow-x: auto; white-space: pre-wrap;
}
.sample .lbl { display: block; font-size: 10.5px; color: #8ea4c8; margin-bottom: 2px; letter-spacing: .5px; }

details.help { border: 2px solid var(--line); border-radius: var(--r-sm); margin-bottom: 10px; overflow: hidden; background: #fff; }
details.help > summary {
  cursor: pointer; padding: 9px 13px; font-size: 13.5px; font-weight: 700; color: var(--ink-2);
  background: #fbfcff; list-style: none;
}
details.help > summary::-webkit-details-marker { display: none; }
details.help > summary::before { content: "▸ "; color: var(--blue); }
details.help[open] > summary::before { content: "▾ "; }
details.help .body { padding: 11px 13px; font-size: 13.5px; color: #33415c; border-top: 2px solid var(--line); }

/* 参考答案 */
.answer-box { border: 2px dashed var(--line-2); border-radius: var(--r-sm); padding: 12px; background: #fffdf7; }
.answer-btn {
  width: 100%; justify-content: center; display: flex; align-items: center; gap: 8px;
  background: linear-gradient(135deg, #ffe9b8, #ffd36e); border-color: #f0b429; color: #8a5a00;
  font-size: 14px; padding: 10px 14px;
}
.answer-btn:hover { filter: brightness(1.03); }
.answer-tip { font-size: 11.5px; color: var(--ink-3); text-align: center; margin-top: 7px; }
.answer-box.open { background: #fff; border-style: solid; border-color: var(--line-2); }
.answer-title { font-weight: 800; font-size: 13.5px; color: #15803d; margin-bottom: 8px; }
.answer-code {
  margin: 0 0 9px; background: #22304d; color: #dce9ff; border-radius: var(--r-sm);
  padding: 11px 13px; font-family: var(--mono); font-size: 13px; overflow-x: auto;
}
.hint-warn {
  font-size: 12.5px; color: #b45309; background: #fff7e6;
  border-radius: 10px; padding: 7px 11px; margin-bottom: 9px;
}

/* ---------------- 编辑器 ---------------- */
.code-head {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; border-bottom: 2px solid var(--line); background: #fbfcff;
  border-radius: calc(var(--r) - 3px) calc(var(--r) - 3px) 0 0;
}
.code-title { display: flex; align-items: center; gap: 6px; }
.code-title .dot { width: 12px; height: 12px; border-radius: 99px; background: #e6e9f0; }
.code-title .dot:nth-child(1) { background: #ff6b6b; }
.code-title .dot:nth-child(2) { background: #ffd93d; }
.code-title .dot:nth-child(3) { background: #4ade80; }
.code-file { font-family: var(--mono); font-size: 12.5px; color: var(--ink-3); margin-left: 8px; }
.code-actions { display: flex; gap: 8px; }

.editor-wrap { flex: 1 1 auto; min-height: 220px; position: relative; }
#editor { position: absolute; inset: 0; }
.editor-plain {
  position: absolute; inset: 0; width: 100%; height: 100%; border: 0; resize: none;
  padding: 12px 16px; font-family: var(--mono); font-size: 15px; line-height: 1.75;
  color: var(--ink); background: #fff; tab-size: 4; outline: none;
}
.ace_editor { border-radius: 0; }

.stdin-wrap {
  flex: 0 0 auto; border-top: 2px solid var(--line);
  padding: 8px 12px; background: #fbfcff;
}
.stdin-wrap label { display: block; font-size: 11.5px; font-weight: 800; color: var(--ink-3); margin-bottom: 4px; }
#stdin {
  width: 100%; border: 2px solid var(--line-2); border-radius: 11px; padding: 7px 11px;
  font-family: var(--mono); font-size: 13.5px; resize: vertical; outline: none;
  background: #fff; color: var(--ink);
}
#stdin:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(61, 139, 253, .15); }

.console {
  flex: 0 0 44%; min-height: 170px; display: flex; flex-direction: column;
  border-top: 2px solid var(--line);
}
.console-tabs {
  flex: 0 0 auto; display: flex; align-items: center; gap: 4px;
  padding: 7px 12px 0; border-bottom: 2px solid var(--line); background: #fbfcff;
}
.ctab {
  border: 0; background: transparent; padding: 7px 14px; font-size: 13px; font-weight: 800;
  color: var(--ink-3); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px;
}
.ctab.active { color: var(--blue); border-bottom-color: var(--blue); }
.ctab-badge { background: var(--red); color: #fff; border-radius: 99px; font-size: 10.5px; padding: 1px 7px; margin-left: 5px; }
.console-status { margin-left: auto; font-size: 12px; color: var(--ink-3); padding-bottom: 7px; }
.console-body { flex: 1 1 auto; overflow: auto; padding: 12px 16px; }
.out { margin: 0; font-family: var(--mono); font-size: 13.5px; line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
.muted { color: var(--ink-3); }
.out .err { color: var(--red); }
.out .ok { color: var(--green); }

.judge-sum {
  padding: 10px 15px; border-radius: 14px; font-size: 15px; font-weight: 800; margin-bottom: 11px;
}
.judge-sum.allpass { background: var(--green-soft); color: #15803d; border: 2px solid #a7f3c4; }
.judge-sum.notpass { background: var(--orange-soft); color: #c2410c; border: 2px solid #ffd9a8; }

.jr { border: 2px solid var(--line); border-radius: 14px; margin-bottom: 9px; overflow: hidden; }
.jr-head { display: flex; align-items: center; gap: 8px; padding: 8px 13px; font-size: 13px; font-weight: 800; }
.jr.pass .jr-head { background: var(--green-soft); color: #15803d; }
.jr.fail .jr-head { background: var(--red-soft); color: #be123c; }
.jr-body { padding: 10px 13px; font-size: 12.5px; background: #fbfcff; border-top: 2px solid var(--line); }
.jr-body .row { margin-bottom: 7px; }
.jr-body .row b { display: block; font-size: 11.5px; color: var(--ink-3); font-weight: 800; margin-bottom: 3px; }
.jr-body pre {
  margin: 0; background: #22304d; color: #dce9ff; border-radius: 9px; padding: 8px 11px;
  font-family: var(--mono); font-size: 12.5px; overflow-x: auto; white-space: pre-wrap;
}

/* ---------------- 密码弹窗 ---------------- */
.modal {
  position: fixed; inset: 0; z-index: 85; display: none;
  align-items: center; justify-content: center;
  background: rgba(30, 45, 75, .42); backdrop-filter: blur(3px);
}
.modal.show { display: flex; animation: fadeIn .18s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  background: #fff; border: 4px solid #fff; border-radius: 28px;
  padding: 26px 30px 24px; width: min(370px, 90vw); text-align: center;
  box-shadow: 0 8px 0 rgba(30, 45, 75, .14), 0 30px 60px rgba(30, 45, 75, .28);
}
.modal.show .modal-card { animation: popIn .28s cubic-bezier(.2, 1.4, .5, 1); }
@keyframes popIn { from { transform: scale(.85) translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal.shake .modal-card { animation: shake .4s ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-11px); }
  35% { transform: translateX(10px); }
  55% { transform: translateX(-7px); }
  75% { transform: translateX(5px); }
}
.modal-emoji { font-size: 46px; line-height: 1; }
.modal-title { font-size: 19px; font-weight: 800; margin-top: 8px; }
.modal-desc { font-size: 13.5px; color: var(--ink-2); margin: 6px 0 14px; }
.modal-input {
  width: 100%; border: 3px solid var(--line-2); border-radius: 14px;
  padding: 11px 14px; font-size: 16px; text-align: center; outline: none;
  font-family: inherit; color: var(--ink);
}
.modal-input:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(61, 139, 253, .16); }
.modal-err { min-height: 22px; font-size: 13px; color: var(--red); font-weight: 700; margin-top: 8px; }
.modal-btns { display: flex; gap: 10px; margin-top: 6px; }
.modal-btns .btn { flex: 1; justify-content: center; padding: 10px 14px; }

/* ---------------- 撒花 ---------------- */
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 70; }
.confetti i { position: absolute; top: -18px; width: 10px; height: 15px; animation: fall linear forwards; }
@keyframes fall {
  0% { transform: translateY(-24px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(106vh) rotate(760deg); opacity: .85; }
}

/* ---------------- Toast ---------------- */
.toast {
  position: fixed; left: 50%; bottom: 36px; transform: translate(-50%, 18px);
  background: #22304d; color: #fff; padding: 12px 24px; border-radius: 99px;
  font-size: 15px; font-weight: 700; opacity: 0; pointer-events: none;
  transition: all .28s cubic-bezier(.2, 1.3, .5, 1); z-index: 90;
  box-shadow: 0 8px 26px rgba(30, 45, 75, .3);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.good { background: linear-gradient(135deg, #4ade80, #16a34a); }
.toast.bad { background: linear-gradient(135deg, #ff8a9b, #e11d48); }

/* ---------------- 滚动条 ---------------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #cfdcee; border-radius: 99px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #b6c9e4; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1180px) {
  .work { flex-direction: column; overflow-y: auto; }
  .problem-col { flex: 0 0 auto; min-width: 0; max-height: 360px; }
  .code-col { flex: 0 0 auto; min-height: 640px; }
  .sidebar { flex-basis: 240px; }
}
@media (max-width: 820px) {
  body { overflow: auto; }
  .topbar { flex-wrap: wrap; gap: 10px; padding: 10px 12px; }
  .levels { order: 3; width: 100%; justify-content: flex-start; }
  .brand-sub { display: none; }
  .layout { flex-direction: column; }
  .sidebar { flex: 0 0 auto; border-right: 0; border-bottom: 3px solid #fff; }
  .lesson-list { max-height: 230px; }
  .work { padding: 0 12px 14px; }
  .lesson-head, .ex-bar { padding-left: 12px; padding-right: 12px; }
  .lh-title { font-size: 18px; }
}

/* ---------------- 海龟绘图题 ---------------- */
.turtle-goal {
  display: flex; align-items: flex-start; gap: 8px;
  background: linear-gradient(135deg, #e8fff3, #eaf6ff);
  border: 2px dashed #4fd1a5; border-radius: 16px;
  padding: 11px 14px; margin: 6px 0 12px; font-size: 14.5px; color: #245;
}
.turtle-goal .tg-ico { font-size: 20px; line-height: 1.2; }
.turtle-checks {
  background: #fff7e6; border: 2px solid #ffd591; border-radius: 14px;
  padding: 9px 14px; margin: 0 0 12px; font-size: 13.5px; color: #8a5a12;
}
.turtle-checks b { color: #b9760f; }
.turtle-stage { margin: 4px 0 14px; }
.turtle-canvas-wrap {
  border: 3px solid #fff; border-radius: 18px; overflow: hidden;
  box-shadow: 0 10px 26px rgba(80,120,200,.18); background: #fbfcff;
  max-width: 560px; margin: 0 auto;
}
#turtle-canvas { display: block; width: 100%; height: auto; background: #fbfcff; }
.turtle-hint {
  text-align: center; color: #6b7a99; font-size: 13px; margin-top: 8px;
  min-height: 18px;
}
.turtle-hint:empty { display: none; }
.turtle-feedback { list-style: none; padding: 0; margin: 8px 0; }
.turtle-feedback li {
  background: #f3f7ff; border-left: 4px solid #7aa7ff; border-radius: 10px;
  padding: 8px 12px; margin: 6px 0; font-size: 13.5px; color: #2c3e66;
}
.notpass + .turtle-feedback li { border-left-color: #ff9a76; }

/* ---------------- 底部备案号（悬挂在页面最底，始终可见） ---------------- */
.site-footer {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 16px 14px;
  background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(255,255,255,.97));
  border: 2px solid var(--line);
  border-radius: 12px;
  font-size: 12.5px;
  color: #66758c;
  padding: 9px 16px;
  box-shadow: 0 2px 10px rgba(44,58,85,.05);
}
.site-footer .beian { display: inline-flex; align-items: center; gap: 4px; }
.site-footer .beian a {
  color: #3d8bfd;
  text-decoration: none;
  font-weight: 700;
  transition: color .15s;
}
.site-footer .beian a:hover { color: #2f6fd6; text-decoration: underline; }
