:root {
  --bg: #f4f7fb;
  --bg-2: #eef4f8;
  --card: #ffffff;
  --ink: #162235;
  --muted: #64748b;
  --line: #dbe5ee;
  --accent: #0f766e;
  --accent-2: #14b8a6;
  --accent-soft: #dff7f2;
  --orange: #f97316;
  --orange-soft: #fff1e7;
  --red: #dc2626;
  --red-soft: #fee2e2;
  --green: #15803d;
  --green-soft: #dcfce7;
  --blue: #2563eb;
  --blue-soft: #e8f0ff;
  --shadow: 0 18px 45px rgba(22, 34, 53, 0.08);
  --shadow-sm: 0 8px 22px rgba(22, 34, 53, 0.06);
  --radius: 22px;
  --radius-sm: 14px;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --sans: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 0%, rgba(20, 184, 166, 0.14), transparent 34rem),
    radial-gradient(circle at 88% 8%, rgba(249, 115, 22, 0.10), transparent 26rem),
    linear-gradient(180deg, #f8fbfd 0%, var(--bg) 45%, #f2f6fa 100%);
  min-height: 100vh;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
h1, h2, h3, p { margin-top: 0; }
code { font-family: var(--mono); background: #eef2f7; padding: 1px 5px; border-radius: 6px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }

.app-shell { width: min(1240px, calc(100% - 32px)); margin: 0 auto; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 18px 0 10px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 48px; height: 48px; border-radius: 15px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff;
  font-weight: 900; letter-spacing: -0.04em; box-shadow: 0 10px 22px rgba(15, 118, 110, 0.25);
}
.brand-copy { display: flex; flex-direction: column; line-height: 1.25; }
.brand-copy strong { font-size: 18px; }
.brand-copy small { color: var(--muted); font-size: 12px; margin-top: 3px; }
.top-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.profile-label { font-size: 12px; color: var(--muted); }
#profileSelect {
  border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 9px 10px;
  color: var(--ink); max-width: 150px;
}
.icon-btn {
  width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); font-weight: 800; font-size: 18px;
}
.icon-btn:hover { background: var(--accent-soft); border-color: #b9e7df; }
.header-exam {
  display: flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: 999px;
  background: #fff7ed; color: #9a3412; border: 1px solid #fed7aa; font-size: 12px;
}
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.14); }

.hero {
  display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.55fr);
  gap: 22px; align-items: stretch; padding: 20px 0 22px;
}
.hero-copy {
  background: linear-gradient(135deg, rgba(255,255,255,0.92), rgba(255,255,255,0.76));
  border: 1px solid rgba(219, 229, 238, 0.9); border-radius: 30px; padding: clamp(24px, 4vw, 44px);
  box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.hero-copy::after {
  content: ""; position: absolute; width: 240px; height: 240px; right: -70px; bottom: -90px;
  background: radial-gradient(circle, rgba(20,184,166,0.22), transparent 68%); pointer-events: none;
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 800;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent);
  background: var(--accent-soft); border-radius: 999px; padding: 7px 11px;
}
.hero h1 { font-size: clamp(34px, 5vw, 56px); letter-spacing: -0.055em; line-height: 1.06; margin: 18px 0 16px; }
.hero h1 span { color: var(--accent); }
.hero p { max-width: 680px; color: var(--muted); line-height: 1.8; font-size: 15px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 24px; }
.hero-badges { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.hero-badges span { font-size: 12px; color: var(--muted); background: #f5f8fa; border: 1px solid var(--line); border-radius: 999px; padding: 6px 10px; }
.hero-panel {
  border-radius: 30px; background: linear-gradient(150deg, #0f766e, #115e59 62%, #134e4a);
  color: #ecfeff; padding: 24px; box-shadow: 0 22px 50px rgba(15, 118, 110, 0.22);
  display: flex; flex-direction: column; justify-content: space-between; min-height: 280px;
}
.hero-panel-head { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: #ccfbf1; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: #5eead4; box-shadow: 0 0 0 5px rgba(94, 234, 212, 0.16); }
.hero-number { font-size: 76px; line-height: 1; font-weight: 900; letter-spacing: -0.08em; margin-top: 20px; }
.hero-panel-body p { color: #ccfbf1; margin: 8px 0 18px; }
.hero-panel-body small { display: block; color: #99f6e4; line-height: 1.6; margin-top: 16px; }
.hero-meter { height: 9px; border-radius: 999px; background: rgba(255,255,255,0.18); overflow: hidden; }
.hero-meter span { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, #5eead4, #fbbf24); border-radius: inherit; transition: width .35s ease; }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 2px 0 12px; }
.stat-card { background: rgba(255,255,255,0.82); border: 1px solid var(--line); border-radius: 18px; padding: 16px 17px; box-shadow: var(--shadow-sm); }
.stat-card span { display: block; font-size: 12px; color: var(--muted); }
.stat-card strong { display: block; font-size: 28px; letter-spacing: -0.04em; margin: 6px 0 4px; }
.stat-card small { color: var(--muted); font-size: 11px; }
.stat-card.good { background: linear-gradient(145deg, #fff, var(--green-soft)); }
.stat-card.mid { background: linear-gradient(145deg, #fff, var(--orange-soft)); }
.stat-card.bad { background: linear-gradient(145deg, #fff, var(--red-soft)); }
.weak-line { font-size: 13px; color: var(--muted); margin: 0 0 14px; min-height: 22px; display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }

.tabs { display: flex; gap: 6px; background: rgba(255,255,255,0.78); border: 1px solid var(--line); border-radius: 16px; padding: 6px; margin: 8px 0 18px; overflow: auto; }
.tab-btn { border: 0; background: transparent; color: var(--muted); padding: 10px 17px; border-radius: 11px; font-weight: 700; white-space: nowrap; }
.tab-btn:hover { color: var(--ink); background: #f1f5f9; }
.tab-btn.active { color: #fff; background: var(--accent); box-shadow: 0 8px 18px rgba(15,118,110,0.18); }

.panel { padding-bottom: 32px; }
.practice-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 18px; align-items: start; }
.qnav { background: rgba(255,255,255,0.84); border: 1px solid var(--line); border-radius: 20px; padding: 15px; box-shadow: var(--shadow-sm); position: sticky; top: 14px; }
.qnav-head { display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 800; margin-bottom: 12px; }
.qnav-group + .qnav-group { margin-top: 15px; }
.qnav-group-title { font-size: 11px; color: var(--muted); font-weight: 800; letter-spacing: .08em; margin-bottom: 7px; }
.qnav-chips { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.qchip { height: 34px; border: 1px solid var(--line); background: #fff; border-radius: 9px; font-weight: 800; color: var(--muted); font-size: 12px; }
.qchip:hover { border-color: #99f6e4; color: var(--accent); }
.qchip.current { background: var(--ink); border-color: var(--ink); color: #fff; }
.qchip.ok { background: var(--green-soft); border-color: #bbf7d0; color: var(--green); }
.qchip.bad { background: var(--red-soft); border-color: #fecaca; color: var(--red); }
.qchip.selected { background: var(--blue-soft); border-color: #bfdbfe; color: var(--blue); }
.qchip.current.ok, .qchip.current.bad, .qchip.current.selected { color: #fff; }
.qchip.current.ok { background: var(--green); border-color: var(--green); }
.qchip.current.bad { background: var(--red); border-color: var(--red); }
.qchip.current.selected { background: var(--blue); border-color: var(--blue); }

.qcard { background: rgba(255,255,255,0.94); border: 1px solid var(--line); border-radius: 24px; padding: clamp(20px, 3vw, 34px); box-shadow: var(--shadow); }
.qcard-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 16px; }
.qmeta { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; border-radius: 999px; background: #f1f5f9; color: var(--muted); font-size: 11px; font-weight: 800; padding: 5px 9px; }
.topic-row { display: flex; gap: 5px; flex-wrap: wrap; }
.topic-chip { display: inline-flex; align-items: center; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 800; padding: 5px 9px; }
.topic-chip.weak { background: var(--red-soft); color: var(--red); }
.qcard h2 { font-size: clamp(18px, 2.2vw, 23px); line-height: 1.55; letter-spacing: -0.02em; margin: 0 0 16px; }
.code-block { background: #0f172a; color: #e2e8f0; border-radius: 15px; padding: 16px 18px; font-family: var(--mono); font-size: 13px; line-height: 1.65; overflow: auto; white-space: pre; margin: 0 0 18px; }
.options { display: grid; gap: 9px; margin-top: 18px; }
.option-btn { display: flex; align-items: flex-start; gap: 11px; text-align: left; width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 14px; padding: 13px 14px; color: var(--ink); transition: .15s ease; }
.option-btn:hover { border-color: #99f6e4; background: #fafffe; transform: translateY(-1px); }
.option-letter { flex: 0 0 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; background: #f1f5f9; color: var(--muted); font-weight: 900; font-size: 12px; }
.option-text { line-height: 1.6; font-size: 14px; }
.option-btn.selected { border-color: var(--blue); background: var(--blue-soft); }
.option-btn.selected .option-letter { background: var(--blue); color: #fff; }
.option-btn.correct { border-color: #86efac; background: var(--green-soft); }
.option-btn.correct .option-letter { background: var(--green); color: #fff; }
.option-btn.wrong { border-color: #fca5a5; background: var(--red-soft); }
.option-btn.wrong .option-letter { background: var(--red); color: #fff; }
.option-btn.locked { cursor: default; transform: none; }
.feedback { border-radius: 16px; padding: 16px 17px; margin-top: 18px; line-height: 1.75; font-size: 14px; }
.feedback.ok { background: var(--green-soft); border: 1px solid #bbf7d0; }
.feedback.bad { background: var(--red-soft); border: 1px solid #fecaca; }
.feedback p { margin: 8px 0 0; color: #334155; }
.feedback-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.qactions { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 20px; align-items: center; }

.btn { border: 1px solid var(--accent); background: var(--accent); color: #fff; border-radius: 12px; padding: 10px 16px; font-weight: 800; box-shadow: 0 8px 18px rgba(15,118,110,.14); transition: .15s ease; }
.btn:hover { filter: brightness(1.04); transform: translateY(-1px); }
.btn:disabled { opacity: .45; transform: none; box-shadow: none; }
.btn.ghost { background: #fff; color: var(--accent); border-color: #bfe7e1; box-shadow: none; }
.btn.ghost:hover { background: var(--accent-soft); }
.btn.danger { background: var(--red); border-color: var(--red); box-shadow: 0 8px 18px rgba(220,38,38,.14); }
.btn.small { padding: 7px 12px; font-size: 12px; border-radius: 10px; }
.btn.large { padding: 13px 22px; border-radius: 14px; font-size: 15px; }

.programming-card h2 { margin-bottom: 12px; }
.statement p { line-height: 1.8; color: #334155; margin-bottom: 10px; }
.io-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 18px 0; }
.io-grid h3 { font-size: 13px; margin-bottom: 7px; color: var(--accent); }
.io-grid p { color: #475569; line-height: 1.65; font-size: 13px; margin-bottom: 5px; }
.sample-card { background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 16px; padding: 14px; margin: 12px 0; }
.sample-title { font-size: 12px; color: var(--muted); font-weight: 800; margin-bottom: 8px; }
.sample-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sample-grid span { display: block; font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.sample-grid pre { margin: 0; background: #0f172a; color: #e2e8f0; padding: 10px 12px; border-radius: 10px; font-family: var(--mono); font-size: 12px; overflow: auto; }
.sample-note { margin: 9px 0 0; color: var(--muted); font-size: 12px; }
.constraints { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 16px 0; font-size: 12px; color: var(--muted); }
.constraints strong { color: var(--ink); }
.constraints span { background: #f1f5f9; border-radius: 999px; padding: 5px 9px; }
.editor-shell { border-radius: 16px; overflow: hidden; border: 1px solid #1e293b; background: #0f172a; margin-top: 16px; }
.editor-head { display: flex; align-items: center; justify-content: space-between; padding: 9px 12px; background: #172033; color: #cbd5e1; font-family: var(--mono); font-size: 12px; }
.code-editor { width: 100%; min-height: 430px; resize: vertical; border: 0; outline: none; background: #0f172a; color: #e2e8f0; padding: 16px; font-family: var(--mono); font-size: 13px; line-height: 1.65; tab-size: 4; }
.run-status { min-height: 20px; margin-top: 12px; color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.run-summary { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-radius: 12px; padding: 11px 13px; margin-top: 12px; font-size: 13px; font-weight: 800; }
.run-summary.ok { background: var(--green-soft); color: var(--green); }
.run-summary.bad { background: var(--red-soft); color: var(--red); }
.run-summary span { font-weight: 500; color: var(--muted); }
.test-list { display: grid; gap: 6px; margin-top: 8px; }
.test-row { display: flex; align-items: center; gap: 9px; padding: 9px 11px; border-radius: 10px; background: #f8fafc; border: 1px solid var(--line); font-size: 12px; flex-wrap: wrap; }
.test-row.ok { background: #f0fdf4; border-color: #bbf7d0; }
.test-row.bad { background: #fef2f2; border-color: #fecaca; }
.test-name { font-weight: 800; }
.test-status { margin-left: auto; font-weight: 800; }
.test-row.ok .test-status { color: var(--green); }
.test-row.bad .test-status { color: var(--red); }
.test-detail { flex-basis: 100%; white-space: pre-wrap; font-family: var(--mono); font-size: 11px; color: #7f1d1d; background: #fff; border-radius: 8px; padding: 8px; overflow: auto; }
.solution-box { margin-top: 18px; border: 1px solid var(--line); border-radius: 14px; padding: 12px 15px; background: #fbfdff; }
.solution-box summary { cursor: pointer; font-weight: 800; color: var(--accent); }
.solution-box p { color: #475569; line-height: 1.7; margin: 10px 0 0; }
.privacy-note { margin: 14px 0 0; font-size: 11px; color: var(--muted); line-height: 1.6; }
.spinner { width: 15px; height: 15px; border: 2px solid #cbd5e1; border-top-color: var(--accent); border-radius: 50%; display: inline-block; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.exam-bar { display: flex; align-items: center; gap: 12px; justify-content: space-between; flex-wrap: wrap; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 11px 15px; margin-bottom: 14px; box-shadow: var(--shadow-sm); }
.exam-clock { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #9a3412; font-weight: 700; }
.exam-clock strong { font-family: var(--mono); font-size: 18px; color: var(--orange); }
.exam-progress { font-size: 12px; color: var(--muted); }
.exam-intro { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(240px, .7fr); gap: 18px; background: #fff; border: 1px solid var(--line); border-radius: 26px; padding: clamp(22px, 4vw, 40px); box-shadow: var(--shadow); }
.exam-intro h1 { font-size: clamp(28px, 4vw, 42px); letter-spacing: -0.05em; margin: 16px 0 12px; }
.exam-intro p { color: var(--muted); line-height: 1.8; }
.exam-rules { display: flex; gap: 7px; flex-wrap: wrap; margin: 18px 0 22px; }
.exam-rules span { background: #f1f5f9; border-radius: 999px; padding: 6px 10px; font-size: 12px; color: var(--muted); }
.last-result { background: linear-gradient(145deg, #0f766e, #115e59); color: #ecfeff; border-radius: 22px; padding: 22px; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; min-height: 220px; }
.last-result span { font-size: 12px; color: #ccfbf1; }
.last-result strong { font-size: 58px; line-height: 1; letter-spacing: -0.06em; margin: 8px 0; }
.last-result small { color: #99f6e4; margin-bottom: 16px; }
.last-result .btn.ghost { color: #ecfeff; border-color: rgba(255,255,255,.35); background: rgba(255,255,255,.08); }

.result-card { background: #fff; border: 1px solid var(--line); border-radius: 26px; padding: clamp(22px, 4vw, 38px); box-shadow: var(--shadow); }
.result-head { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; }
.result-head h1 { font-size: clamp(48px, 8vw, 82px); letter-spacing: -0.07em; margin: 10px 0 4px; }
.result-head h1 small { font-size: 18px; color: var(--muted); letter-spacing: 0; }
.result-head p { color: var(--muted); margin: 0; }
.score-ring {
  --size: 154px;
  width: var(--size); height: var(--size); border-radius: 50%;
  display: grid; place-items: center; position: relative;
  background: conic-gradient(var(--accent) calc(var(--score) * 1%), #e2e8f0 0);
  font-size: 40px; font-weight: 900; color: var(--ink);
  isolation: isolate;
}
.score-ring::after {
  content: ""; position: absolute; inset: 12px; border-radius: 50%; background: #fff; z-index: 0;
}
.score-ring span { position: relative; z-index: 1; }
.result-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 24px 0; }
.result-grid > div { background: #f8fafc; border: 1px solid var(--line); border-radius: 15px; padding: 14px; }
.result-grid span { display: block; font-size: 11px; color: var(--muted); }
.result-grid strong { display: block; font-size: 22px; margin: 6px 0 3px; }
.result-grid small { color: var(--muted); font-size: 11px; }
.review-wrap { margin-top: 20px; }
.review-wrap > h2 { font-size: 18px; margin-bottom: 12px; }
.review-card { border: 1px solid var(--line); border-left: 4px solid var(--green); background: #fff; border-radius: 14px; padding: 14px 16px; margin-bottom: 9px; }
.review-card.bad { border-left-color: var(--red); }
.review-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.review-head span { color: var(--muted); font-size: 12px; }
.review-card p { color: #475569; line-height: 1.7; margin: 8px 0 0; font-size: 13px; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin: 8px 0 18px; }
.page-head h1 { font-size: clamp(28px, 4vw, 42px); letter-spacing: -0.05em; margin: 10px 0 5px; }
.page-head p { color: var(--muted); margin: 0; }
.section-title { font-size: 18px; margin: 24px 0 12px; }
.weak-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.weak-card { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 16px; box-shadow: var(--shadow-sm); }
.weak-head { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }
.weak-head span { color: var(--red); font-weight: 900; }
.bar { height: 8px; background: #eef2f7; border-radius: 999px; margin: 10px 0 7px; overflow: hidden; }
.bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--red), var(--orange)); border-radius: inherit; }
.weak-card small { color: var(--muted); }
.empty-inline { grid-column: 1 / -1; background: #fff; border: 1px dashed var(--line); border-radius: 16px; padding: 20px; color: var(--muted); }
.knowledge-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.knowledge-card { background: #fff; border: 1px solid var(--line); border-radius: 19px; padding: 18px; box-shadow: var(--shadow-sm); }
.knowledge-card.weak { border-color: #fecaca; background: linear-gradient(150deg, #fff, #fff7f7); }
.knowledge-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.knowledge-icon { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 900; font-family: var(--mono); }
.knowledge-head h3 { margin: 0; font-size: 15px; }
.knowledge-head small { color: var(--muted); font-size: 11px; }
.knowledge-card ul { margin: 0; padding-left: 18px; color: #475569; line-height: 1.7; font-size: 13px; }
.knowledge-card li + li { margin-top: 5px; }

.empty-state { background: #fff; border: 1px dashed var(--line); border-radius: 24px; padding: 50px 24px; text-align: center; box-shadow: var(--shadow-sm); }
.empty-icon { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; background: var(--green-soft); color: var(--green); font-size: 30px; font-weight: 900; margin: 0 auto 16px; }
.empty-state h2 { margin-bottom: 8px; }
.empty-state p { color: var(--muted); }
.wrong-card { background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 19px 20px; margin-bottom: 12px; box-shadow: var(--shadow-sm); }
.wrong-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.wrong-top .muted { margin-left: auto; font-size: 11px; }
.wrong-card h3 { font-size: 17px; line-height: 1.6; margin: 0 0 10px; }
.wrong-card .answer-line { font-size: 13px; color: #334155; margin: 8px 0; }
.wrong-card .explanation { font-size: 13px; color: #475569; line-height: 1.7; background: #f8fafc; border-radius: 12px; padding: 11px 13px; }
.wrong-card .btn { margin-top: 10px; }

.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.settings-card { background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 20px; box-shadow: var(--shadow-sm); }
.settings-card h2 { font-size: 16px; margin-bottom: 12px; }
.settings-card p { color: var(--muted); line-height: 1.7; font-size: 13px; }
.inline-form { display: flex; gap: 8px; }
.inline-form input { flex: 1; border: 1px solid var(--line); border-radius: 11px; padding: 10px 12px; min-width: 0; }
.file-btn { position: relative; overflow: hidden; display: inline-flex; align-items: center; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.plain-list { margin: 0; padding-left: 18px; color: #475569; line-height: 1.8; font-size: 13px; }
.danger-zone { border-color: #fecaca; background: linear-gradient(150deg, #fff, #fff7f7); }
.footer { border-top: 1px solid var(--line); padding: 22px 0 34px; display: flex; gap: 8px 18px; flex-wrap: wrap; color: var(--muted); font-size: 11px; }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 18px); background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 12px; font-size: 13px; opacity: 0; pointer-events: none; transition: .2s ease; z-index: 50; box-shadow: 0 16px 40px rgba(22,34,53,.22); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast[data-type="error"] { background: #991b1b; }
.toast[data-type="ok"] { background: #166534; }

@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; }
  .hero-panel { min-height: 200px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .practice-layout { grid-template-columns: 1fr; }
  .qnav { position: static; order: 2; }
  .qnav-chips { grid-template-columns: repeat(5, 1fr); }
  .knowledge-grid { grid-template-columns: repeat(2, 1fr); }
  .weak-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .result-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .app-shell { width: min(100% - 20px, 1240px); }
  .topbar { align-items: flex-start; }
  .brand-copy small { display: none; }
  .brand-mark { width: 42px; height: 42px; border-radius: 13px; }
  .top-actions { gap: 5px; }
  .profile-label { display: none; }
  #profileSelect { max-width: 118px; }
  .hero-copy { border-radius: 22px; padding: 22px 18px; }
  .hero-panel { border-radius: 22px; padding: 20px; }
  .hero h1 { font-size: 34px; }
  .hero-actions .btn { flex: 1; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .stat-card strong { font-size: 24px; }
  .tabs { border-radius: 14px; }
  .tab-btn { padding: 9px 13px; font-size: 13px; }
  .qnav-chips { grid-template-columns: repeat(5, 1fr); }
  .qchip { height: 32px; }
  .qcard { border-radius: 18px; padding: 18px 15px; }
  .io-grid, .sample-grid { grid-template-columns: 1fr; }
  .code-editor { min-height: 330px; font-size: 12px; }
  .knowledge-grid { grid-template-columns: 1fr; }
  .exam-intro { grid-template-columns: 1fr; padding: 20px; }
  .exam-bar { gap: 8px; }
  .exam-progress { order: 3; flex-basis: 100%; }
  .result-head { align-items: flex-start; }
  .score-ring { --size: 112px; font-size: 28px; }
  .footer { display: block; }
  .footer span { display: block; margin-top: 5px; }
}
