/* ==========================================================================
   测绘 Python 刷题站
   ========================================================================== */
:root {
  --ink: #0f172a;
  --ink-soft: #334155;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --line: #e6eaf1;
  --line-strong: #d5dce8;
  --bg: #f4f7fb;
  --panel: #ffffff;
  --navy: #081426;
  --navy-2: #0d1f36;
  --blue: #2563eb;
  --blue-deep: #1d4ed8;
  --blue-soft: #eff6ff;
  --teal: #0d9488;
  --teal-soft: #ecfdf5;
  --green: #16a34a;
  --green-soft: #f0fdf4;
  --amber: #d97706;
  --amber-soft: #fffbeb;
  --red: #dc2626;
  --red-soft: #fef2f2;
  --violet: #7c3aed;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow-md: 0 10px 30px rgba(15, 23, 42, .08);
  --shadow-lg: 0 28px 70px rgba(2, 6, 23, .2);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro SC", "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --mono: "SFMono-Regular", "SF Mono", ui-monospace, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body.booting { overflow: hidden; }
button, input { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
svg.icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

::selection { background: #bfdbfe; color: #0f172a; }
:focus-visible { outline: 3px solid rgba(37, 99, 235, .25); outline-offset: 2px; }

/* ==========================================================================
   启动层
   ========================================================================== */
.boot-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: var(--navy);
  color: #cbd5e1;
  transition: opacity .35s ease, visibility .35s ease;
}
body:not(.booting) .boot-screen { opacity: 0; visibility: hidden; pointer-events: none; }
.boot-mark {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(94, 234, 212, .35);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(13, 148, 136, .18), rgba(37, 99, 235, .12));
  box-shadow: 0 0 60px rgba(13, 148, 136, .18);
}
.boot-mark span { color: #5eead4; font: 700 22px var(--mono); letter-spacing: -.06em; }
.boot-text { font-size: 13px; letter-spacing: .08em; color: #94a3b8; }
.loading-dots { display: inline-flex; gap: 4px; margin-left: 2px; }
.loading-dots i {
  width: 4px; height: 4px; border-radius: 50%; background: #5eead4;
  animation: dot 1.1s infinite ease-in-out;
}
.loading-dots i:nth-child(2) { animation-delay: .14s; }
.loading-dots i:nth-child(3) { animation-delay: .28s; }
@keyframes dot { 0%, 70%, 100% { opacity: .22; transform: translateY(0); } 35% { opacity: 1; transform: translateY(-3px); } }

/* ==========================================================================
   登录页
   ========================================================================== */
.login-shell {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(440px, .88fr);
  background: #f7f9fc;
}
.login-visual {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 13% 8%, rgba(13, 148, 136, .22), transparent 34%),
    radial-gradient(circle at 84% 78%, rgba(37, 99, 235, .18), transparent 38%),
    linear-gradient(145deg, #07111f 0%, #0a1a2e 54%, #0c2038 100%);
  color: #94a3b8;
  padding: clamp(34px, 5vw, 72px);
  display: flex;
}
.login-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(148, 163, 184, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, .045) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(circle at 50% 50%, #000, transparent 82%);
  pointer-events: none;
}
.contour {
  position: absolute;
  inset: auto -14% -26% auto;
  width: min(78vw, 900px);
  color: #5eead4;
  opacity: .22;
  pointer-events: none;
}
.login-visual-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 52px;
  animation: rise .7s cubic-bezier(.2,.8,.2,1) both;
}
.brand-line { display: flex; align-items: center; gap: 14px; }
.brand-symbol {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  color: #07111f;
  font: 800 17px var(--mono);
  letter-spacing: -.08em;
  background: linear-gradient(135deg, #5eead4, #38bdf8);
  box-shadow: 0 8px 24px rgba(56, 189, 248, .18);
}
.brand-symbol.small { width: 34px; height: 34px; border-radius: 10px; font-size: 13px; }
.brand-line strong { display: block; color: #f8fafc; font-size: 17px; letter-spacing: .02em; }
.brand-line small { display: block; margin-top: 3px; color: #7dd3fc; font-size: 11px; letter-spacing: .16em; }
.login-copy { max-width: 630px; }
.eyebrow {
  margin: 0 0 18px;
  color: #5eead4;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
}
.login-copy h1 {
  margin: 0;
  color: #f8fafc;
  font-size: clamp(42px, 5.2vw, 76px);
  line-height: 1.12;
  letter-spacing: -.045em;
  font-weight: 700;
}
.login-copy h1 em {
  font-style: normal;
  background: linear-gradient(100deg, #5eead4 0%, #7dd3fc 52%, #a5b4fc 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.login-copy .lead {
  max-width: 560px;
  margin: 26px 0 0;
  color: #a7b6c9;
  font-size: 15.5px;
  line-height: 1.9;
}
.login-stats {
  display: flex;
  gap: clamp(24px, 4vw, 56px);
  padding-top: 26px;
  border-top: 1px solid rgba(148, 163, 184, .16);
}
.login-stats > div { display: flex; flex-direction: column; gap: 4px; }
.login-stats strong { color: #f1f5f9; font: 600 28px/1 var(--mono); letter-spacing: -.04em; }
.login-stats span { color: #7f90a6; font-size: 12px; letter-spacing: .05em; }
.login-footnote { margin: 0; color: #607187; font-size: 11.5px; }
.login-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 36px clamp(24px, 5vw, 68px);
  background:
    radial-gradient(circle at 100% 0, rgba(37, 99, 235, .06), transparent 40%),
    #f7f9fc;
}
.login-card {
  width: 100%;
  max-width: 432px;
  padding: 38px;
  border-radius: 22px;
  background: rgba(255, 255, 255, .92);
  border: 1px solid rgba(226, 232, 240, .9);
  box-shadow: 0 30px 80px rgba(15, 23, 42, .09), 0 2px 6px rgba(15, 23, 42, .04);
  backdrop-filter: blur(10px);
  animation: rise .65s .08s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
.mini-label {
  display: block;
  color: var(--muted-2);
  font: 600 10px/1 var(--mono);
  letter-spacing: .18em;
}
.login-card-head h2 { margin: 12px 0 8px; font-size: 30px; letter-spacing: -.03em; }
.login-card-head p { margin: 0 0 28px; color: var(--muted); font-size: 13.5px; line-height: 1.7; }
.field { display: block; margin-bottom: 17px; }
.field > span:first-child { display: block; margin-bottom: 8px; color: var(--ink-soft); font-size: 12.5px; font-weight: 600; }
.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 50px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #fbfcfe;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
.input-wrap:focus-within {
  border-color: var(--blue);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .1);
}
.input-wrap .icon { color: #94a3b8; }
.input-wrap input {
  min-width: 0;
  flex: 1;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 14.5px;
  letter-spacing: .01em;
}
.input-wrap input::placeholder { color: #aab6c7; }
#student-id { font-family: var(--mono); letter-spacing: .02em; }
.form-error {
  min-height: 20px;
  margin: -4px 0 10px;
  color: var(--red);
  font-size: 12.5px;
  line-height: 1.5;
}
.form-error.show { animation: shake .35s ease; }
@keyframes shake { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }
.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: transform .16s, box-shadow .16s, background .16s, border-color .16s, color .16s;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  box-shadow: 0 7px 18px rgba(37, 99, 235, .22), inset 0 1px rgba(255,255,255,.15);
}
.btn-primary:hover:not(:disabled) { background: linear-gradient(135deg, #1d4ed8, #1e40af); box-shadow: 0 10px 24px rgba(37, 99, 235, .28); }
.btn-secondary {
  color: #1e3a8a;
  background: #fff;
  border-color: #c7d7f5;
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover:not(:disabled) { border-color: #93b4f0; background: #f8fbff; }
.btn-ghost { color: var(--ink-soft); background: transparent; border-color: transparent; }
.btn-ghost:hover:not(:disabled) { background: #eef2f8; color: var(--ink); }
.btn-login { width: 100%; height: 50px; border-radius: 12px; font-size: 14.5px; margin-top: 4px; }
.btn-login .icon { width: 17px; height: 17px; transition: transform .18s; }
.btn-login:hover .icon { transform: translateX(3px); }
.btn.loading .btn-label { opacity: .7; }
.btn.loading::after {
  content: "";
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.login-hint {
  display: flex;
  gap: 9px;
  margin-top: 22px;
  padding: 12px 13px;
  border-radius: 10px;
  background: #f4f7fb;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.65;
}
.login-hint .icon { width: 15px; height: 15px; margin-top: 1px; color: #7d8ea3; }
.teacher-link {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-top: 18px;
  color: #64748b;
  font-size: 12px;
  transition: color .16s;
}
.teacher-link:hover { color: var(--blue); }
.teacher-link .icon { width: 14px; height: 14px; }
.login-copyright { margin: 0; color: #9aa8b9; font-size: 10.5px; letter-spacing: .03em; }

/* ==========================================================================
   应用整体框架
   ========================================================================== */
.app-shell {
  height: 100dvh;
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr);
  grid-template-rows: 62px minmax(0, 1fr);
  grid-template-areas: "top top" "side main";
  overflow: hidden;
}
.topbar {
  grid-area: top;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 22px;
  background: rgba(255, 255, 255, .94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 14px; min-width: 0; }
.app-brand { display: flex; align-items: center; gap: 10px; }
.app-brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.app-brand-text strong { font-size: 13px; letter-spacing: -.01em; white-space: nowrap; }
.app-brand-text small { color: var(--muted-2); font-size: 9px; letter-spacing: .12em; margin-top: 2px; }
.topbar-sep { width: 1px; height: 22px; background: var(--line); }
.topbar-context { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.progress-chip { display: flex; align-items: center; gap: 7px; }
.progress-ring { width: 34px; height: 34px; transform: rotate(-90deg); }
.ring-track, .ring-value { fill: none; stroke-width: 3.4; }
.ring-track { stroke: #e8edf5; }
.ring-value {
  stroke: var(--blue);
  stroke-linecap: round;
  stroke-dasharray: 100.53;
  stroke-dashoffset: 100.53;
  transition: stroke-dashoffset .6s cubic-bezier(.2,.8,.2,1);
}
.progress-chip > span { display: flex; align-items: baseline; gap: 2px; }
.progress-chip b { font: 700 14px var(--mono); }
.progress-chip small { color: var(--muted-2); font: 500 10px var(--mono); }
.student-chip { display: flex; align-items: center; gap: 9px; }
.avatar {
  width: 33px; height: 33px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: #0f766e;
  background: linear-gradient(135deg, #ccfbf1, #e0f2fe);
  font-size: 14px;
  font-weight: 700;
  border: 1px solid #bae6fd;
}
.student-meta { display: flex; flex-direction: column; line-height: 1.2; }
.student-meta strong { font-size: 12.5px; }
.student-meta small { color: var(--muted-2); font: 500 9.5px var(--mono); margin-top: 2px; }
.icon-btn {
  width: 36px; height: 36px;
  display: inline-grid; place-items: center;
  border: 0; border-radius: 10px;
  background: transparent; color: #64748b;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: #f1f5f9; color: var(--ink); }
.mobile-only { display: none; }

/* ==========================================================================
   侧栏
   ========================================================================== */
.sidebar {
  grid-area: side;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #fbfcfe;
  border-right: 1px solid var(--line);
  padding: 20px 14px 12px;
  z-index: 20;
}
.sidebar-head { display: flex; align-items: flex-end; justify-content: space-between; padding: 0 8px 16px; }
.sidebar-head h2 { margin: 7px 0 0; font-size: 17px; letter-spacing: -.02em; }
.sidebar-progress {
  padding: 4px 8px;
  border-radius: 6px;
  background: #eef4ff;
  color: #3b5bdb;
  font: 600 10.5px var(--mono);
}
.search-box {
  display: flex; align-items: center; gap: 8px;
  height: 36px; margin: 0 2px 14px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--muted-2);
  transition: border-color .16s, box-shadow .16s;
}
.search-box:focus-within { border-color: #b7cdf5; box-shadow: 0 0 0 3px rgba(37,99,235,.07); }
.search-box .icon { width: 15px; height: 15px; }
.search-box input { min-width: 0; width: 100%; border: 0; outline: 0; background: transparent; font-size: 12px; color: var(--ink); }
.search-box input::placeholder { color: #a5b1c2; }
.chapter-list { flex: 1; min-height: 0; overflow-y: auto; padding: 0 2px 8px; scrollbar-width: thin; scrollbar-color: #d9e0ea transparent; }
.chapter-list::-webkit-scrollbar { width: 6px; }
.chapter-list::-webkit-scrollbar-thumb { background: #d9e0ea; border-radius: 3px; }
.chapter { margin-bottom: 5px; }
.chapter-head {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  padding: 9px 8px;
  border: 0; border-radius: 9px;
  background: transparent; text-align: left;
  transition: background .15s;
}
.chapter-head:hover { background: #f0f4fa; }
.chapter.open .chapter-head { background: #eef4ff; }
.chapter-index {
  width: 25px; height: 25px;
  display: grid; place-items: center;
  border-radius: 7px;
  background: #fff;
  border: 1px solid var(--line);
  color: #7c8da3;
  font: 600 9.5px var(--mono);
  flex: 0 0 auto;
}
.chapter.open .chapter-index { color: #1d4ed8; border-color: #bfd4fb; background: #fff; }
.chapter-meta { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.chapter-meta strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; font-weight: 650; }
.chapter-meta small { color: var(--muted-2); font-size: 9.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chapter-count { color: #94a3b8; font: 500 9.5px var(--mono); flex: 0 0 auto; }
.chapter.open .chapter-count { color: #2563eb; }
.chapter-chevron { width: 13px !important; height: 13px !important; color: #a4b1c2; transition: transform .2s; }
.chapter.open .chapter-chevron { transform: rotate(90deg); }
.chapter-progress { height: 2px; margin: 4px 10px 4px 43px; background: #e8eef7; border-radius: 2px; overflow: hidden; }
.chapter-progress i { display: block; height: 100%; background: linear-gradient(90deg, #38bdf8, #2563eb); border-radius: 2px; transition: width .4s; }
.chapter-questions { display: none; padding: 3px 0 6px 17px; }
.chapter.open .chapter-questions { display: block; animation: reveal .22s ease both; }
@keyframes reveal { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
.q-item {
  position: relative;
  width: 100%;
  display: flex; align-items: center; gap: 8px;
  padding: 7px 8px 7px 11px;
  border: 0; border-radius: 7px;
  background: transparent; text-align: left;
  color: #526278;
  transition: background .14s, color .14s;
}
.q-item::before {
  content: ""; position: absolute; left: 0; top: 50%;
  width: 2px; height: 0; border-radius: 2px; background: var(--blue);
  transform: translateY(-50%); transition: height .18s;
}
.q-item:hover { background: #f2f6fc; color: var(--ink); }
.q-item.active { background: #eaf2ff; color: #1e40af; font-weight: 600; }
.q-item.active::before { height: 16px; }
.q-status { width: 14px; height: 14px; display: grid; place-items: center; flex: 0 0 auto; }
.q-status .icon { width: 12px; height: 12px; }
.q-status.solved { color: var(--green); }
.q-status.attempted { color: #f59e0b; }
.q-status.attempted::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.q-status.todo::before { content: ""; width: 6px; height: 6px; border: 1px solid #c6d0dd; border-radius: 50%; }
.q-title { flex: 1; font-size: 11.5px; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-diff { font: 500 8px var(--mono); letter-spacing: .04em; color: #a0adbe; flex: 0 0 auto; }
.q-diff.d2 { color: #d97706; }
.q-diff.d3 { color: #dc2626; }
.no-results { padding: 20px 10px; color: var(--muted-2); font-size: 12px; text-align: center; }
.sidebar-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 12px 7px 0;
  border-top: 1px solid var(--line);
}
.sidebar-teacher-link { display: inline-flex; align-items: center; gap: 7px; color: #8090a4; font-size: 10.5px; }
.sidebar-teacher-link:hover { color: var(--blue); }
.sidebar-teacher-link .icon { width: 13px; height: 13px; }
.sidebar-version { color: #a8b3c2; font: 500 8.5px var(--mono); }
.sidebar-scrim { display: none; }

/* ==========================================================================
   主区域：题目 + 工作台
   ========================================================================== */
.main {
  grid-area: main;
  display: grid;
  grid-template-columns: minmax(360px, 43%) minmax(0, 1fr);
  min-height: 0;
  background: #fff;
}
.problem-pane { min-width: 0; min-height: 0; border-right: 1px solid var(--line); background: #fff; }
.problem-scroll { height: 100%; overflow-y: auto; padding: 30px clamp(24px, 3vw, 42px) 36px; scrollbar-width: thin; scrollbar-color: #dbe2ec transparent; }
.problem-scroll::-webkit-scrollbar { width: 7px; }
.problem-scroll::-webkit-scrollbar-thumb { background: #dbe2ec; border-radius: 4px; }
.problem-content { animation: fade .26s ease both; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.problem-topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.breadcrumb { display: flex; align-items: center; gap: 7px; min-width: 0; color: #7d8ca0; font-size: 10.5px; letter-spacing: .02em; }
.crumb-sep { color: #cbd5e1; }
.status-badge {
  flex: 0 0 auto;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .02em;
}
.status-badge.todo { color: #6b7b8f; background: #f1f5f9; }
.status-badge.attempted { color: #b45309; background: var(--amber-soft); }
.status-badge.solved { color: #15803d; background: var(--green-soft); }
.question-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 20px 0 10px; }
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 8px;
  border-radius: 6px;
  background: #f3f6fb;
  color: #64748b;
  font-size: 9.5px;
  font-weight: 550;
  letter-spacing: .01em;
}
.pill .icon { width: 11px; height: 11px; }
.pill.diff-1 { color: #15803d; background: #f0fdf4; }
.pill.diff-2 { color: #b45309; background: #fffbeb; }
.pill.diff-3 { color: #b91c1c; background: #fef2f2; }
.pill.tag { color: #475569; background: #f5f7fa; font-family: var(--mono); font-size: 8.5px; }
.question-content h1, .problem-content h1 {
  margin: 0;
  color: #0b1728;
  font-size: clamp(25px, 2.5vw, 32px);
  line-height: 1.28;
  letter-spacing: -.03em;
  font-weight: 700;
}
.question-summary { margin: 10px 0 0; color: #63748a; font-size: 13px; line-height: 1.75; }
.rich-text { margin-top: 22px; color: #3b4b60; font-size: 13px; line-height: 1.85; }
.rich-text p { margin: 0 0 11px; }
.rich-text p:last-child { margin-bottom: 0; }
.rich-text code {
  padding: 1.5px 5px;
  border-radius: 5px;
  background: #f1f5f9;
  color: #be185d;
  font: 500 .88em var(--mono);
  word-break: break-word;
}
.rich-text pre {
  margin: 12px 0;
  padding: 12px 14px;
  overflow-x: auto;
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  background: #f8fafc;
  color: #334155;
  font: 11.5px/1.7 var(--mono);
}
.rich-text pre code { padding: 0; background: none; color: inherit; }
.rich-text table { width: 100%; margin: 12px 0; border-collapse: collapse; font-size: 11.5px; }
.rich-text th, .rich-text td { padding: 7px 10px; border: 1px solid #e5eaf2; text-align: left; }
.rich-text th { background: #f6f8fc; color: #475569; font-weight: 600; }
.rich-text ul, .rich-text ol { margin: 8px 0 12px; padding-left: 22px; }
.rich-text li { margin: 4px 0; }
.rich-text strong { color: #1e293b; font-weight: 650; }
.content-section { margin-top: 28px; }
.section-heading { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.section-heading h3 { margin: 0; font-size: 12.5px; font-weight: 650; letter-spacing: .01em; }
.section-icon {
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border-radius: 7px;
  color: #2563eb;
  background: #eff6ff;
}
.section-icon .icon { width: 13px; height: 13px; }
.section-note { margin-left: auto; color: #93a1b3; font-size: 9.5px; }
.requirement-list { list-style: none; margin: 0; padding: 0; counter-reset: req; }
.requirement-list li {
  position: relative;
  counter-increment: req;
  margin: 0 0 8px;
  padding: 0 0 0 27px;
  color: #3f5065;
  font-size: 12.2px;
  line-height: 1.75;
}
.requirement-list li::before {
  content: counter(req, decimal-leading-zero);
  position: absolute; left: 0; top: 3px;
  width: 18px; height: 18px;
  display: grid; place-items: center;
  border-radius: 5px;
  background: #f1f5fb;
  color: #7c8da3;
  font: 600 8px var(--mono);
}
.examples { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.example-card {
  min-width: 0;
  border: 1px solid #e5eaf2;
  border-radius: 10px;
  overflow: hidden;
  background: #fbfcfe;
}
.example-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 10px;
  border-bottom: 1px solid #edf1f6;
  color: #7b8a9e;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .08em;
  background: #f7f9fc;
}
.example-head .dot { width: 5px; height: 5px; border-radius: 50%; background: #94a3b8; }
.example-body {
  margin: 0;
  padding: 11px 12px;
  min-height: 58px;
  max-height: 180px;
  overflow: auto;
  color: #334155;
  font: 11.5px/1.65 var(--mono);
  white-space: pre-wrap;
  word-break: break-word;
}
.example-body.empty { color: #a4b1c2; font-family: var(--font); font-size: 11px; }
.files-note {
  margin: 12px 0 0;
  padding: 8px 10px;
  border-radius: 7px;
  background: #f8fafc;
  color: #6b7c91;
  font-size: 10.5px;
  line-height: 1.65;
}
.file-preview { margin-top: 9px; border: 1px solid #e5eaf2; border-radius: 9px; background: #fbfcfe; overflow: hidden; }
.file-preview summary {
  padding: 9px 11px;
  color: #52657c;
  font-size: 10.5px;
  cursor: pointer;
  list-style: none;
  display: flex; align-items: center; gap: 6px;
}
.file-preview summary::-webkit-details-marker { display: none; }
.file-preview summary::before { content: "▸"; color: #94a3b8; font-size: 9px; transition: transform .18s; }
.file-preview[open] summary::before { transform: rotate(90deg); }
.file-preview pre { margin: 0; padding: 10px 12px; border-top: 1px solid #edf1f6; overflow: auto; max-height: 220px; font: 10.5px/1.6 var(--mono); color: #475569; }
.hint-box { margin-top: 26px; border: 1px solid #f1e6c8; border-radius: 11px; background: linear-gradient(135deg, #fffdf7, #fffaf0); }
.hint-box summary {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px;
  color: #92600b;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.hint-box summary::-webkit-details-marker { display: none; }
.hint-box summary > span { display: flex; align-items: center; gap: 7px; }
.hint-box summary .icon { width: 14px; height: 14px; }
.hint-box summary .chev { transition: transform .2s; color: #c99b45; }
.hint-box[open] summary .chev { transform: rotate(90deg); }
.hint-content { padding: 0 14px 14px 35px; color: #785a24; font-size: 11.5px; line-height: 1.8; }
.problem-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 32px; padding-top: 18px; border-top: 1px solid #edf1f6; }
.nav-position { color: #a1adbd; font: 500 9.5px var(--mono); }

/* 骨架屏 */
.problem-skeleton { padding-top: 10px; }
.skeleton-line {
  height: 13px; margin-bottom: 14px; border-radius: 6px;
  background: linear-gradient(90deg, #f1f5f9 25%, #e8eef6 37%, #f1f5f9 63%);
  background-size: 400% 100%;
  animation: shimmer 1.25s infinite;
}
.skeleton-line.tall { height: 34px; }
.w40 { width: 40%; } .w60 { width: 60%; } .w80 { width: 80%; } .w90 { width: 90%; } .w100 { width: 100%; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* ==========================================================================
   工作台
   ========================================================================== */
.workbench {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #f7f9fc;
}
.workbench-head {
  height: 43px;
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 13px 0 16px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfe;
}
.file-tab { display: flex; align-items: center; gap: 8px; color: #475569; font: 500 11px var(--mono); }
.file-tab .icon { width: 14px; height: 14px; color: #64748b; }
.file-dot { width: 5px; height: 5px; border-radius: 50%; background: #cbd5e1; transition: background .2s; }
.file-tab.dirty .file-dot { background: #f59e0b; }
.editor-tools { display: flex; align-items: center; gap: 13px; }
.save-status { display: inline-flex; align-items: center; gap: 5px; color: #97a4b6; font-size: 9.5px; }
.save-status i { width: 5px; height: 5px; border-radius: 50%; background: #cbd5e1; }
.save-status.saved i { background: #22c55e; }
.save-status.saving i { background: #f59e0b; animation: pulse 1s infinite; }
.save-status.error { color: #dc2626; }
.save-status.error i { background: #dc2626; }
@keyframes pulse { 50% { opacity: .35; } }
.text-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 6px;
  border: 0; border-radius: 6px;
  background: transparent; color: #8290a3;
  font-size: 10px;
  transition: background .15s, color .15s;
}
.text-btn .icon { width: 12px; height: 12px; }
.text-btn:hover { color: #334155; background: #eef2f8; }
.editor-holder { position: relative; flex: 1 1 auto; min-height: 180px; overflow: hidden; background: #fff; }
#code-editor { width: 100%; height: 100%; }
#code-editor.fallback {
  display: block; resize: none; border: 0; outline: 0;
  padding: 17px 20px; color: #1e293b; caret-color: #2563eb;
  background: #fff; font: 13.5px/1.7 var(--mono);
  tab-size: 4;
}
.editor-loading {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  color: #94a3b8; font-size: 11px;
  background: #fff;
}

/* CodeMirror 外观 */
.CodeMirror {
  height: 100% !important;
  background: #fff;
  color: #1e293b;
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.72;
  padding-top: 8px;
}
.CodeMirror-scroll { padding-bottom: 22px; }
.CodeMirror-lines { padding: 4px 0; }
.CodeMirror-gutters { background: #fbfcfe; border-right: 1px solid #f0f3f8; padding-right: 3px; }
.CodeMirror-linenumber { color: #b3bfce; font-size: 10px; padding: 0 8px 0 6px; }
.CodeMirror-cursor { border-left: 2px solid #2563eb; }
.CodeMirror-selected { background: #dbeafe !important; }
.CodeMirror-focused .CodeMirror-selected { background: #dbeafe !important; }
.CodeMirror-activeline-background { background: #f8fbff; }
.cm-s-default .cm-keyword { color: #7c3aed; font-weight: 600; }
.cm-s-default .cm-def { color: #1d4ed8; }
.cm-s-default .cm-variable { color: #1e293b; }
.cm-s-default .cm-variable-2 { color: #0f766e; }
.cm-s-default .cm-property { color: #0f766e; }
.cm-s-default .cm-operator { color: #64748b; }
.cm-s-default .cm-string { color: #15803d; }
.cm-s-default .cm-number { color: #c2410c; }
.cm-s-default .cm-comment { color: #94a3b8; font-style: italic; }
.cm-s-default .cm-builtin { color: #0369a1; }
.cm-s-default .cm-meta { color: #b45309; }
.cm-s-default .cm-error { color: #dc2626; }
.CodeMirror-matchingbracket { color: #1d4ed8 !important; background: #dbeafe; outline: 1px solid #93c5fd; }

.action-bar {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.shortcut-hint { display: flex; align-items: center; gap: 4px; color: #a0adbd; font-size: 9px; }
.shortcut-hint kbd {
  min-width: 17px; height: 17px;
  display: inline-grid; place-items: center;
  padding: 0 4px;
  border: 1px solid #e2e8f0;
  border-bottom-width: 2px;
  border-radius: 4px;
  background: #f8fafc;
  color: #8493a6;
  font: 500 8px var(--mono);
}
.shortcut-sep { width: 1px; height: 13px; background: #e5eaf2; margin: 0 5px; }
.action-btns { display: flex; gap: 8px; }
.action-btns .btn { height: 38px; font-size: 12px; padding: 0 16px; }
.action-btns .btn .icon { width: 14px; height: 14px; }

/* 控制台 */
.console {
  flex: 0 0 clamp(224px, 33vh, 330px);
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #fbfcfe;
}
.console-head {
  flex: 0 0 auto;
  height: 40px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid #edf1f6;
}
.console-tabs { display: flex; align-items: center; gap: 14px; height: 100%; }
.console-tab {
  position: relative;
  display: inline-flex; align-items: center; gap: 5px;
  color: #66768b;
  font-size: 10.5px;
  font-weight: 600;
}
.console-tab .icon { width: 13px; height: 13px; }
.console-tab.active { color: #1e3a8a; }
.console-tab.active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -11px;
  height: 2px; border-radius: 2px; background: #2563eb;
}
.result-meta { display: flex; align-items: center; gap: 8px; color: #93a1b3; font: 500 9px var(--mono); }
.result-pill { padding: 3px 7px; border-radius: 5px; font: 600 9px var(--mono); }
.result-pill.ok { color: #15803d; background: #eafaf0; }
.result-pill.bad { color: #b91c1c; background: #fef2f2; }
.result-pill.partial { color: #b45309; background: #fff7e6; }
.console-body { flex: 1; min-height: 0; overflow-y: auto; padding: 13px 16px 18px; scrollbar-width: thin; scrollbar-color: #dbe2ec transparent; }
.console-body::-webkit-scrollbar { width: 6px; }
.console-body::-webkit-scrollbar-thumb { background: #dbe2ec; border-radius: 4px; }
.console-empty { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; color: #97a5b7; }
.empty-orbit {
  position: relative;
  width: 48px; height: 48px;
  display: grid; place-items: center;
  margin-bottom: 4px;
  border: 1px dashed #cbd7e6;
  border-radius: 50%;
  color: #7c93ad;
}
.empty-orbit::after { content: ""; position: absolute; inset: 6px; border: 1px solid #e5edf7; border-radius: 50%; }
.empty-orbit .icon { width: 18px; height: 18px; z-index: 1; color: #5b7899; }
.empty-orbit span { position: absolute; top: -2px; right: 3px; width: 6px; height: 6px; border-radius: 50%; background: #5eead4; box-shadow: 0 0 0 4px rgba(94,234,212,.15); }
.console-empty strong { color: #66778c; font-size: 11.5px; font-weight: 600; }
.console-empty p { max-width: 300px; margin: 0; font-size: 10px; line-height: 1.65; }
.console-loading { display: flex; flex-direction: column; gap: 11px; padding: 4px 0; }
.scanning { height: 3px; border-radius: 3px; background: #e9eef6; overflow: hidden; }
.scanning::after { content: ""; display: block; width: 32%; height: 100%; border-radius: 3px; background: linear-gradient(90deg, #38bdf8, #2563eb); animation: scan 1.15s infinite ease-in-out; }
@keyframes scan { from { transform: translateX(-110%); } to { transform: translateX(330%); } }
.loading-copy { display: flex; align-items: center; gap: 8px; color: #6f8197; font-size: 10.5px; }
.loading-copy .icon { width: 14px; height: 14px; color: #2563eb; animation: spin 1.1s linear infinite; }
.result-summary {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 11px 12px;
  margin-bottom: 10px;
  border: 1px solid #e6ecf4;
  border-radius: 9px;
  background: #fff;
}
.result-summary.pass { border-color: #bbf7d0; background: linear-gradient(135deg, #f7fff9, #f0fdf4); }
.result-summary.fail { border-color: #fecaca; background: linear-gradient(135deg, #fffafa, #fef2f2); }
.result-title { display: flex; flex-direction: column; gap: 3px; }
.result-title strong { font-size: 12px; }
.result-title span { color: #7c8b9e; font-size: 9.5px; }
.result-score { font: 700 19px var(--mono); color: #1e293b; line-height: 1; }
.result-summary.pass .result-score { color: #15803d; }
.result-summary.fail .result-score { color: #b91c1c; }
.result-score small { font-size: 10px; color: #94a3b8; font-weight: 500; }
.test-list { display: flex; flex-direction: column; gap: 7px; }
.test-item { border: 1px solid #e8edf4; border-radius: 9px; background: #fff; overflow: hidden; }
.test-item.pass { border-color: #d9f2e2; }
.test-item.fail { border-color: #f6d5d5; }
.test-row {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 11px;
  min-height: 38px;
  color: #4a5b70;
}
.test-icon { width: 18px; height: 18px; display: grid; place-items: center; border-radius: 50%; flex: 0 0 auto; }
.test-icon .icon { width: 11px; height: 11px; }
.test-item.pass .test-icon { color: #15803d; background: #e9f9ef; }
.test-item.fail .test-icon { color: #b91c1c; background: #feecec; }
.test-name { font-size: 10.5px; font-weight: 600; }
.test-badge { padding: 2px 5px; border-radius: 4px; background: #f1f5f9; color: #94a3b8; font: 500 8px var(--mono); }
.test-time { margin-left: auto; color: #a4b0c0; font: 500 8.5px var(--mono); }
.test-detail-toggle { color: #8b9aac; font-size: 9px; }
.test-item.fail .test-detail-toggle { color: #b91c1c; }
.test-detail {
  border-top: 1px solid #edf1f6;
  padding: 10px 11px 12px;
  background: #fcfdff;
}
.test-detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.detail-block { min-width: 0; border: 1px solid #e9eef5; border-radius: 6px; overflow: hidden; background: #fff; }
.detail-block h4 { margin: 0; padding: 5px 7px; background: #f7f9fc; color: #8a99ab; font: 600 8px var(--mono); letter-spacing: .05em; }
.detail-block pre {
  margin: 0; padding: 7px 8px;
  min-height: 34px; max-height: 150px; overflow: auto;
  color: #3d4e63; font: 9.8px/1.55 var(--mono);
  white-space: pre-wrap; word-break: break-word;
}
.detail-block.expected pre { color: #15803d; background: #fbfefc; }
.detail-block.actual pre { color: #b45309; background: #fffdf8; }
.error-block {
  margin-top: 8px; padding: 8px 9px;
  border: 1px solid #f6d5d5; border-radius: 6px;
  background: #fff7f7; color: #b91c1c;
  font: 9.5px/1.6 var(--mono); white-space: pre-wrap; word-break: break-word;
  max-height: 160px; overflow: auto;
}
.detail-note { margin-top: 7px; color: #8a99ab; font-size: 9.5px; }
.file-check-row { display: flex; align-items: center; gap: 6px; margin-top: 7px; color: #6b7c91; font-size: 9.5px; }
.file-check-row .icon { width: 12px; height: 12px; color: #15803d; }
.celebration-note {
  display: flex; align-items: center; gap: 8px;
  margin-top: 9px; padding: 9px 11px;
  border: 1px solid #bbf7d0; border-radius: 8px;
  background: #f0fdf4; color: #15803d;
  font-size: 10.5px; font-weight: 600;
}
.celebration-note .icon { width: 15px; height: 15px; }
.hidden-hint { margin-top: 8px; color: #8a99ab; font-size: 9.5px; text-align: center; }

/* ==========================================================================
   对话框 / Toast
   ========================================================================== */
.confirm-dialog {
  width: min(400px, calc(100vw - 36px));
  padding: 26px;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: #fff;
  color: var(--ink);
  box-shadow: var(--shadow-lg);
}
.confirm-dialog::backdrop { background: rgba(8, 20, 38, .45); backdrop-filter: blur(3px); }
.dialog-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 11px; background: #fffbeb; color: #b45309; margin-bottom: 14px; }
.confirm-dialog h3 { margin: 0 0 7px; font-size: 17px; letter-spacing: -.02em; }
.confirm-dialog p { margin: 0 0 22px; color: #64748b; font-size: 12px; line-height: 1.7; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.toast {
  position: fixed;
  left: 50%; bottom: 26px;
  z-index: 80;
  transform: translate(-50%, 14px);
  padding: 10px 16px;
  border-radius: 9px;
  background: #0f172a;
  color: #f1f5f9;
  box-shadow: 0 12px 30px rgba(15, 23, 42, .25);
  font-size: 11.5px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s, transform .22s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.success { background: #14532d; }
.toast.error { background: #7f1d1d; }

/* ==========================================================================
   响应式
   ========================================================================== */
@media (max-width: 1240px) {
  .app-shell { grid-template-columns: 262px minmax(0, 1fr); }
  .main { grid-template-columns: minmax(330px, 40%) minmax(0, 1fr); }
  .topbar-context { display: none; }
  .topbar-sep:nth-of-type(2) { display: none; }
  .shortcut-hint { display: none; }
}
@media (max-width: 1060px) {
  .login-shell { grid-template-columns: minmax(0, 1fr) minmax(410px, .85fr); }
  .login-visual { padding: 40px; }
  .login-copy h1 { font-size: clamp(40px, 5vw, 58px); }
  .login-copy .lead { font-size: 14px; }
}
@media (max-width: 980px) {
  .mobile-only { display: inline-grid; }
  body { overflow: auto; }
  .app-shell {
    height: auto;
    min-height: 100dvh;
    display: block;
    overflow: visible;
  }
  .topbar { position: sticky; top: 0; height: 58px; padding: 0 14px; }
  .app-brand-text { display: none; }
  .student-meta { display: none; }
  .topbar-left, .topbar-right { gap: 9px; }
  .topbar-sep { display: none; }
  .sidebar {
    position: fixed;
    top: 0; bottom: 0; left: 0;
    width: min(318px, 88vw);
    z-index: 60;
    transform: translateX(-104%);
    transition: transform .26s cubic-bezier(.2,.8,.2,1);
    box-shadow: 0 0 50px rgba(15,23,42,.18);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-scrim {
    display: block;
    position: fixed; inset: 0;
    z-index: 55;
    background: rgba(8, 20, 38, .38);
    opacity: 0; visibility: hidden;
    transition: opacity .22s, visibility .22s;
  }
  .sidebar-scrim.show { opacity: 1; visibility: visible; }
  .main { display: block; }
  .problem-pane { border-right: 0; }
  .problem-scroll { height: auto; overflow: visible; padding: 24px 20px 30px; }
  .workbench { height: calc(100dvh - 58px); min-height: 620px; border-top: 1px solid var(--line); }
  .console { flex-basis: 34vh; }
  .examples { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .login-shell { display: block; min-height: 100dvh; }
  .login-visual { min-height: 340px; padding: 28px 24px 34px; }
  .login-visual-inner { gap: 28px; }
  .login-copy h1 { font-size: 38px; }
  .login-copy .lead { margin-top: 16px; font-size: 13px; line-height: 1.75; }
  .login-stats { padding-top: 20px; gap: 26px; }
  .login-stats strong { font-size: 22px; }
  .login-footnote { display: none; }
  .contour { width: 130vw; right: -40vw; bottom: -20%; opacity: .18; }
  .login-panel { padding: 24px 18px 32px; }
  .login-card { padding: 28px 22px; border-radius: 18px; }
  .login-card-head h2 { font-size: 26px; }
  .topbar { height: 54px; }
  .progress-chip { display: none; }
  .app-brand .brand-symbol { width: 30px; height: 30px; font-size: 11px; }
  .workbench { height: calc(100dvh - 54px); min-height: 590px; }
  .problem-scroll { padding: 22px 17px 26px; }
  .question-content h1, .problem-content h1 { font-size: 25px; }
  .rich-text { font-size: 12.5px; }
  .examples { grid-template-columns: 1fr; }
  .example-body { max-height: 130px; }
  .action-bar { padding: 9px 11px; }
  .action-btns { width: 100%; }
  .action-btns .btn { flex: 1; padding: 0 10px; }
  .editor-tools { gap: 7px; }
  .console { flex-basis: 38vh; }
  .test-detail-grid { grid-template-columns: 1fr; }
  .console-head { padding: 0 12px; }
  .console-body { padding: 11px 12px 15px; }
  .result-meta .result-time { display: none; }
  .breadcrumb { font-size: 9.5px; }
  .status-badge { font-size: 9px; }
  .problem-nav .btn { font-size: 11px; padding: 0 10px; }
  .toast { bottom: 16px; max-width: calc(100vw - 32px); text-align: center; }
}
@media (max-width: 420px) {
  .login-copy h1 { font-size: 32px; }
  .login-copy .lead { font-size: 12px; }
  .login-stats > div:nth-child(3) { display: none; }
  .topbar-right .icon-btn { width: 32px; }
  .action-btns .btn { font-size: 11px; }
  .file-tab span:nth-child(2) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* 结果补充状态 */
.file-check-row.bad { color: #b91c1c; }
.file-check-row.bad .icon { color: #b91c1c; }
.confetti {
  position: fixed;
  top: 42%;
  z-index: 70;
  width: 7px;
  height: 10px;
  border-radius: 1px;
  pointer-events: none;
  animation: confetti-fall 1.4s cubic-bezier(.15,.6,.45,1) forwards;
}
@keyframes confetti-fall {
  0% { opacity: 1; transform: translate3d(0, 0, 0) rotate(0); }
  100% { opacity: 0; transform: translate3d(var(--dx), 46vh, 0) rotate(var(--rot)); }
}

/* 标准输入抽屉 */
.stdin-drawer {
  position: relative;
  flex: 0 0 34px;
  z-index: 14;
  border-top: 1px solid var(--line);
  background: #fbfcfe;
}
.stdin-toggle {
  width: 100%; height: 34px;
  display: flex; align-items: center; gap: 9px;
  padding: 0 13px 0 16px;
  border: 0; background: transparent;
  color: #64748b; text-align: left;
}
.stdin-toggle:hover { background: #f4f8fe; }
.stdin-toggle-title {
  display: inline-flex; align-items: center; gap: 5px;
  color: #475569; font-size: 10px; font-weight: 600; white-space: nowrap;
}
.stdin-toggle-title .icon { width: 13px; height: 13px; color: #2563eb; }
.stdin-summary {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: #94a3b8; font: 500 9.5px var(--mono);
}
.stdin-chevron { width: 12px !important; height: 12px !important; color: #b0bccb; transition: transform .2s; }
.stdin-drawer.open .stdin-chevron { transform: rotate(90deg); }
.stdin-panel {
  position: absolute;
  left: 0; right: 0; bottom: 100%;
  z-index: 40;
  padding: 12px 14px 13px;
  border-top: 1px solid #dbe4f0;
  background: #fff;
  box-shadow: 0 -16px 32px rgba(15, 23, 42, .12);
}
.stdin-panel-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stdin-panel-top { margin-bottom: 7px; color: #64748b; font-size: 9.5px; }
.stdin-panel-top code { color: #1d4ed8; background: #eff6ff; padding: 1px 4px; border-radius: 3px; font: 500 9px var(--mono); }

/* 题目中的运行方式说明 */
.run-note {
  display: flex; align-items: flex-start; gap: 8px;
  margin-top: 11px; padding: 10px 12px;
  border: 1px solid #dbeafe; border-radius: 9px;
  background: #f8fbff; color: #475569;
  font-size: 10.5px; line-height: 1.65;
}
.run-note .icon { width: 14px; height: 14px; color: #2563eb; margin-top: 1px; }
.run-note strong { color: #1e3a8a; font-weight: 650; }
.run-note code { color: #1d4ed8; background: #eff6ff; padding: 1px 4px; border-radius: 3px; font: 500 9.5px var(--mono); }

/* 自定义试运行结果 */
.result-pill.custom { color: #475569; background: #eef2f7; }
.result-summary.custom { background: #f8fafc; border-color: #dfe7f1; }
.custom-output { display: flex; flex-direction: column; gap: 9px; margin-top: 10px; }
.custom-output .detail-block pre { max-height: 150px; overflow: auto; }
@media (max-width: 760px) {
  .stdin-panel { padding: 10px 12px 11px; }
  .stdin-panel-tip { display: none; }
}
.btn-secondary.loading::after {
  content: "";
  width: 13px; height: 13px;
  border: 2px solid rgba(37, 99, 235, .22);
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

/* 试运行输入弹窗 */
.btn-trial {
  color: #0f766e;
  background: #f0fdfa;
  border-color: #99f6e4;
}
.btn-trial:hover:not(:disabled) { background: #ccfbf1; border-color: #5eead4; color: #115e59; }
.btn-trial.loading::after {
  content: "";
  width: 13px; height: 13px;
  border: 2px solid rgba(15, 118, 110, .22);
  border-top-color: #0f766e;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.stdin-panel-tip { color: #9aa8b9; font-size: 8.5px; white-space: nowrap; }
.stdin-preview {
  margin: 0;
  max-height: 170px;
  overflow: auto;
  padding: 9px 11px;
  border: 1px solid #dbe4f0;
  border-radius: 7px;
  background: #fbfdff;
  color: #334155;
  font: 11px/1.7 var(--mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.input-dialog {
  width: min(580px, calc(100vw - 32px));
  max-height: min(760px, calc(100dvh - 36px));
  padding: 0;
  border: 1px solid #dbe4f0;
  border-radius: 17px;
  background: #fff;
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.input-dialog::backdrop { background: rgba(8, 20, 38, .48); backdrop-filter: blur(3px); }
.input-dialog form { display: flex; flex-direction: column; max-height: inherit; }
.input-dialog-head { padding: 24px 24px 14px; }
.input-dialog-head h2 { margin: 11px 0 7px; font-size: 20px; letter-spacing: -.025em; }
.input-dialog-head p { margin: 0; color: #64748b; font-size: 11.5px; line-height: 1.7; }
.input-dialog-head code { color: #1d4ed8; background: #eff6ff; padding: 1px 4px; border-radius: 3px; font: 500 10px var(--mono); }
.input-stdin-wrap { padding: 6px 24px 16px; }
.input-stdin {
  display: block;
  width: 100%; height: 200px; min-height: 150px; max-height: 320px;
  resize: vertical;
  padding: 11px 13px;
  border: 1px solid #dbe4f0; border-radius: 8px;
  outline: 0; background: #fbfdff; color: #1e293b;
  font: 12px/1.75 var(--mono);
  tab-size: 4;
}
.input-stdin::placeholder { color: #b6c2d2; font-family: var(--sans); }
.input-stdin:focus { border-color: #93b4f0; background: #fff; box-shadow: 0 0 0 3px rgba(37, 99, 235, .09); }
.input-dialog-foot {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 24px 17px;
  border-top: 1px solid #edf1f6;
  background: #fbfcfe;
}
.input-dialog-foot .btn { height: 34px; font-size: 11px; padding: 0 14px; border-radius: 8px; }
.input-dialog-foot .text-btn { font-size: 9.5px; }
.input-line-count { color: #94a3b8; font-size: 9px; white-space: nowrap; }
.input-dialog-spacer { flex: 1; }
@media (max-width: 560px) {
  .input-dialog-head { padding: 20px 18px 12px; }
  .input-stdin-wrap { padding: 5px 18px 13px; }
  .input-stdin { height: 160px; }
  .input-dialog-foot { padding: 11px 18px 14px; flex-wrap: wrap; }
  .input-dialog-foot .input-dialog-spacer { display: none; }
}
