:root {
  --bupt-blue: #0b63ce;
  --bupt-red: #c1121f;
  --ink: #172033;
  --text: #263245;
  --muted: #64748b;
  --line: #dbe8f8;
  --soft: #eef6ff;
  --card: #ffffff;
  --bg: #f8fbff;
  --tech-blue: #2563eb;
  --tech-cyan: #06b6d4;
}

/* Dynamic entry experience */
body.entry-page,
body.entry-page * {
  letter-spacing: 0;
}

body.entry-page {
  position: relative;
  min-height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
  background:
    linear-gradient(120deg, #040a14 0%, #06111f 38%, #190711 100%);
  color: #eaf2ff;
  isolation: isolate;
}

body.entry-page::before {
  z-index: 0;
  background:
    linear-gradient(90deg, rgba(7, 17, 31, .9) 0%, rgba(7, 17, 31, .74) 42%, rgba(111, 16, 28, .42) 100%),
    linear-gradient(180deg, rgba(7, 17, 31, .12), rgba(7, 17, 31, .84)),
    url("../images/沙河 南门.png") center / cover no-repeat;
  opacity: 1;
  transform: scale(1.06);
  animation: entry-bg-drift 18s ease-in-out infinite alternate;
}

body.entry-page::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent 0 10%, rgba(56, 189, 248, .18) 10.08%, transparent 10.16% 49%, rgba(250, 204, 21, .18) 49.08%, transparent 49.18% 100%),
    linear-gradient(180deg, transparent 0 18%, rgba(193, 18, 31, .18) 18.08%, transparent 18.18% 72%, rgba(56, 189, 248, .16) 72.08%, transparent 72.16% 100%),
    linear-gradient(90deg, rgba(6, 182, 212, .12) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 255, 255, .08) 1px, transparent 1px),
    linear-gradient(120deg, transparent 0 48%, rgba(193, 18, 31, .16) 48% 48.3%, transparent 48.3% 100%);
  background-size: 42px 42px, 42px 42px, auto;
  mask-image: linear-gradient(90deg, rgba(0, 0, 0, .7), rgba(0, 0, 0, .18));
  animation: entry-scan-grid 7s linear infinite;
}

.entry-loader {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 1rem;
  background:
    linear-gradient(90deg, rgba(7, 17, 31, .96), rgba(9, 22, 43, .92)),
    linear-gradient(135deg, rgba(6, 182, 212, .16), rgba(193, 18, 31, .14));
  transition: opacity .46s ease, visibility .46s ease, transform .46s ease;
}

.entry-ready .entry-loader {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform: scale(1.015);
}

body.entry-page:not(.is-booting) .entry-loader {
  display: none;
}

.entry-loader-panel {
  width: min(100%, 25rem);
  border: 1px solid rgba(147, 197, 253, .52);
  border-radius: 8px;
  padding: 1.35rem;
  background:
    linear-gradient(90deg, rgba(37, 99, 235, .12) 1px, transparent 1px),
    linear-gradient(180deg, rgba(6, 182, 212, .1) 1px, transparent 1px),
    rgba(8, 18, 34, .92);
  background-size: 28px 28px, 28px 28px, auto;
  box-shadow: 0 28px 90px rgba(0, 0, 0, .42);
}

.entry-loader-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 5.4rem;
  height: 5.4rem;
  margin-bottom: 1rem;
}

.entry-loader-mark img {
  position: relative;
  z-index: 2;
  width: 3.2rem;
  height: 3.2rem;
  object-fit: contain;
}

.entry-loader-mark span {
  position: absolute;
  inset: 0;
  border: 2px solid rgba(6, 182, 212, .72);
  border-right-color: rgba(193, 18, 31, .84);
  border-radius: 50%;
  animation: entry-spin 1.1s linear infinite;
}

.entry-loader-kicker {
  margin: 0 0 .35rem;
  color: #7dd3fc;
  font-size: .78rem;
  font-weight: 900;
}

.entry-loader-panel strong {
  display: block;
  color: #fff;
  font-size: 1.34rem;
  line-height: 1.25;
}

.entry-loader-panel small {
  display: block;
  min-height: 1.35rem;
  margin-top: .45rem;
  color: #cbd5e1;
  font-weight: 800;
}

.entry-loader-progress {
  height: .52rem;
  margin-top: 1rem;
  overflow: hidden;
  border: 1px solid rgba(125, 211, 252, .36);
  border-radius: 999px;
  background: rgba(15, 23, 42, .78);
}

.entry-loader-progress b {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #c1121f, #38bdf8, #facc15);
  transition: width .32s ease;
}

.entry-loader-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .5rem;
  margin-top: .85rem;
}

.entry-loader-steps span {
  min-width: 0;
  border: 1px solid rgba(148, 163, 184, .24);
  border-radius: 8px;
  padding: .42rem .35rem;
  color: #dbeafe;
  font-size: .78rem;
  font-weight: 800;
  text-align: center;
  overflow-wrap: anywhere;
}

.entry-beam-field,
.entry-equation-field {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.entry-beam-field {
  z-index: 1;
}

.entry-equation-field {
  z-index: 2;
}

.entry-orbit-canvas {
  position: fixed;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: .82;
  mix-blend-mode: screen;
}

.entry-neural-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

.entry-neural-backdrop::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 78% 44%, rgba(34, 116, 202, .24), transparent 33rem),
    radial-gradient(ellipse at 54% 66%, rgba(20, 200, 255, .13), transparent 26rem),
    linear-gradient(90deg, rgba(1, 7, 17, .2), transparent 36%, rgba(4, 22, 43, .26));
  opacity: .92;
}

.entry-neural-backdrop::after {
  content: "";
  position: absolute;
  right: -18rem;
  bottom: -18rem;
  width: clamp(34rem, 48vw, 52rem);
  height: clamp(32rem, 46vw, 50rem);
  border-radius: 50%;
  background:
    repeating-radial-gradient(circle at 66% 68%, transparent 0 1.72rem, rgba(118, 197, 255, .16) 1.76rem 1.86rem),
    radial-gradient(circle at 66% 68%, rgba(64, 174, 255, .3), transparent 17rem);
  filter: blur(.2px);
  opacity: .62;
  transform: rotate(-7deg);
  mask-image: linear-gradient(135deg, transparent 0 22%, #000 42% 100%);
}

.entry-neural-backdrop span {
  position: absolute;
  display: block;
}

.entry-neural-backdrop .neural-raster {
  right: -1.5rem;
  bottom: 2.7rem;
  width: clamp(14rem, 18vw, 20rem);
  height: clamp(18rem, 27vw, 29rem);
  background:
    linear-gradient(90deg, transparent 0 22%, rgba(116, 197, 255, .28) 22.2% 22.6%, transparent 22.8% 36%, rgba(116, 197, 255, .2) 36.2% 36.6%, transparent 36.8%),
    repeating-linear-gradient(90deg, rgba(116, 197, 255, .13) 0 1px, transparent 1px 1.15rem),
    repeating-linear-gradient(180deg, rgba(116, 197, 255, .11) 0 1px, transparent 1px 1.15rem);
  opacity: .46;
  filter: drop-shadow(0 0 18px rgba(64, 174, 255, .3));
  transform: skewY(-9deg);
  mask-image: linear-gradient(180deg, transparent 0, #000 24%, #000 78%, transparent 100%);
}

.entry-neural-backdrop .neural-raster::before,
.entry-neural-backdrop .neural-raster::after {
  content: "";
  position: absolute;
  inset: auto 0 0 auto;
  width: 12rem;
  height: 12rem;
  border-radius: 50%;
  border: 1px solid rgba(116, 197, 255, .18);
  box-shadow:
    0 0 0 1.6rem rgba(116, 197, 255, .07),
    0 0 0 3.2rem rgba(116, 197, 255, .045),
    0 0 52px rgba(42, 153, 255, .22);
}

.entry-neural-backdrop .neural-raster::after {
  width: 7rem;
  height: 7rem;
  right: 2.3rem;
  bottom: 2.3rem;
}

.entry-neural-backdrop .neural-glow {
  right: 4vw;
  top: 12vh;
  width: clamp(14rem, 30vw, 36rem);
  height: clamp(20rem, 44vw, 44rem);
  border-radius: 50%;
  background:
    radial-gradient(circle at 74% 18%, rgba(122, 198, 255, .26), transparent 1.2rem),
    radial-gradient(circle at 24% 8%, rgba(122, 198, 255, .2), transparent 1rem),
    radial-gradient(ellipse at 62% 52%, rgba(54, 154, 243, .16), transparent 52%);
  opacity: .7;
  filter: blur(.25px);
}

.entry-campus-marks {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
  mix-blend-mode: screen;
}

.entry-campus-mark {
  position: absolute;
  display: block;
  object-fit: contain;
  user-select: none;
  filter:
    saturate(1.25)
    brightness(1.08)
    drop-shadow(0 0 28px rgba(42, 153, 255, .24));
}

.entry-campus-mark.campus-star {
  left: clamp(-8rem, -7vw, -4rem);
  top: clamp(10rem, 26vh, 18rem);
  width: clamp(24rem, 42vw, 42rem);
  opacity: .065;
  transform: rotate(-2deg);
}

.entry-campus-mark.campus-jiazi {
  left: clamp(38rem, 52vw, 58rem);
  bottom: clamp(3.5rem, 8vh, 6rem);
  width: clamp(8.5rem, 13vw, 14.5rem);
  opacity: .13;
  transform: rotate(-7deg);
}

.entry-campus-mark.campus-century {
  right: clamp(-9rem, -7vw, -3rem);
  top: clamp(3.5rem, 8vh, 5.5rem);
  height: clamp(30rem, 78vh, 50rem);
  opacity: .09;
  transform: rotate(.6deg);
}

.entry-cursor-light {
  --pointer-x: 50vw;
  --pointer-y: 50vh;
  position: fixed;
  left: var(--pointer-x);
  top: var(--pointer-y);
  z-index: 3;
  width: 12rem;
  height: 12rem;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -50%);
  background:
    linear-gradient(90deg, transparent calc(50% - 1px), rgba(250, 204, 21, .72) 50%, transparent calc(50% + 1px)),
    linear-gradient(180deg, transparent calc(50% - 1px), rgba(56, 189, 248, .72) 50%, transparent calc(50% + 1px));
  clip-path: polygon(50% 0, 58% 38%, 100% 50%, 58% 62%, 50% 100%, 42% 62%, 0 50%, 42% 38%);
  transition: opacity .18s ease;
}

.entry-cursor-light.is-active {
  opacity: .62;
}

.entry-hud-grid {
  position: fixed;
  inset: clamp(1rem, 3vw, 2.6rem);
  z-index: 3;
  pointer-events: none;
}

.entry-hud-grid span {
  position: absolute;
  width: clamp(5rem, 12vw, 10rem);
  height: clamp(4rem, 10vw, 8rem);
  border-color: rgba(125, 211, 252, .38);
  animation: entry-hud-breathe 4.8s ease-in-out infinite;
}

.entry-hud-grid span:nth-child(1) {
  left: 0;
  top: 0;
  border-top: 1px solid;
  border-left: 1px solid;
}

.entry-hud-grid span:nth-child(2) {
  right: 0;
  top: 0;
  border-top: 1px solid;
  border-right: 1px solid;
  animation-delay: .7s;
}

.entry-hud-grid span:nth-child(3) {
  left: 0;
  bottom: 0;
  border-bottom: 1px solid;
  border-left: 1px solid;
  animation-delay: 1.4s;
}

.entry-hud-grid span:nth-child(4) {
  right: 0;
  bottom: 0;
  border-right: 1px solid;
  border-bottom: 1px solid;
  animation-delay: 2.1s;
}

.entry-core {
  position: fixed;
  left: 56%;
  top: 50%;
  z-index: 3;
  display: grid;
  place-items: center;
  width: clamp(14rem, 24vw, 22rem);
  aspect-ratio: 1;
  pointer-events: none;
  transform: translate(-50%, -50%) perspective(900px) rotateX(58deg) rotateZ(-14deg);
  opacity: .9;
}

.entry-core-ring,
.entry-core-pulse,
.entry-core img {
  grid-area: 1 / 1;
}

.entry-core-ring {
  border: 1px solid rgba(125, 211, 252, .42);
  border-radius: 50%;
  box-shadow:
    inset 0 0 28px rgba(56, 189, 248, .08),
    0 0 26px rgba(56, 189, 248, .12);
}

.entry-core .ring-a {
  width: 100%;
  height: 100%;
  border-left-color: rgba(250, 204, 21, .9);
  animation: entry-core-spin 11s linear infinite;
}

.entry-core .ring-b {
  width: 72%;
  height: 72%;
  border-right-color: rgba(193, 18, 31, .82);
  border-bottom-color: rgba(250, 204, 21, .72);
  animation: entry-core-spin 7s linear infinite reverse;
}

.entry-core .ring-c {
  width: 44%;
  height: 44%;
  border-top-color: rgba(56, 189, 248, .92);
  animation: entry-core-spin 4.8s linear infinite;
}

.entry-core img {
  width: clamp(3.5rem, 6vw, 5rem);
  height: clamp(3.5rem, 6vw, 5rem);
  object-fit: contain;
  transform: rotateZ(14deg) rotateX(-58deg);
  filter: drop-shadow(0 0 22px rgba(125, 211, 252, .44));
}

.entry-core-pulse {
  width: .55rem;
  height: .55rem;
  background: #facc15;
  transform: translate(6.7rem, -4rem) rotate(45deg);
  box-shadow: 0 0 18px rgba(250, 204, 21, .82);
  animation: entry-core-pulse 1.4s ease-in-out infinite;
}

.entry-beam-field span {
  position: absolute;
  left: var(--x);
  top: -28vh;
  width: 2px;
  height: 32vh;
  background: linear-gradient(180deg, transparent, rgba(56, 189, 248, .72), rgba(193, 18, 31, .68), transparent);
  filter: drop-shadow(0 0 14px rgba(56, 189, 248, .38));
  transform: rotate(17deg);
  animation: entry-beam 4.8s linear infinite;
  animation-delay: var(--delay);
}

.entry-equation-field span {
  position: absolute;
  color: rgba(219, 234, 254, .95);
  --formula-idle-opacity: .035;
  --formula-rise-opacity: .18;
  --formula-peak-opacity: .32;
  --formula-fall-opacity: .17;
  font-family: "Times New Roman", Georgia, serif;
  font-size: clamp(1.18rem, 1.55vw, 1.95rem);
  font-weight: 700;
  font-style: italic;
  opacity: 0;
  white-space: nowrap;
  text-shadow: 0 0 22px rgba(88, 166, 255, .3);
  transform: rotate(var(--formula-rotate, 0deg));
  animation: equation-fade-float var(--formula-duration, 8s) ease-in-out infinite;
  animation-delay: var(--formula-delay, 0s);
}

.entry-equation-field span:nth-child(1) { left: 26%; top: 8%; --formula-delay: 0s; --formula-duration: 7.2s; --formula-rotate: -2deg; --formula-shift-x: .65rem; --formula-shift-y: -.9rem; }
.entry-equation-field span:nth-child(2) { left: 34%; top: 44%; --formula-delay: 1s; --formula-duration: 9s; --formula-rotate: 1deg; --formula-shift-x: -.45rem; --formula-shift-y: -1rem; }
.entry-equation-field span:nth-child(3) { left: 43%; top: 24%; --formula-delay: 2s; --formula-duration: 8s; --formula-rotate: -1deg; --formula-shift-x: .8rem; --formula-shift-y: -.72rem; }
.entry-equation-field span:nth-child(4) { left: 50%; top: 52%; --formula-delay: .5s; --formula-duration: 10s; --formula-rotate: 2deg; --formula-shift-x: -.62rem; --formula-shift-y: -1.05rem; }
.entry-equation-field span:nth-child(5) { left: 18%; bottom: 10%; --formula-delay: 1.5s; --formula-duration: 7.5s; --formula-rotate: -2deg; --formula-shift-x: .72rem; --formula-shift-y: -.85rem; }
.entry-equation-field span:nth-child(n + 6) {
  color: rgba(191, 219, 254, .86);
  font-size: clamp(1rem, 1.32vw, 1.62rem);
  letter-spacing: .01em;
}
.entry-equation-field span:nth-child(6) { left: 47%; top: 10%; --formula-delay: 2.5s; --formula-duration: 8.5s; --formula-rotate: 1deg; --formula-shift-x: .48rem; --formula-shift-y: -.95rem; }
.entry-equation-field span:nth-child(7) { right: 15%; top: 11%; --formula-delay: 3s; --formula-duration: 9.5s; --formula-rotate: -3deg; --formula-shift-x: -.76rem; --formula-shift-y: -.78rem; }
.entry-equation-field span:nth-child(8) { right: 9%; top: 27%; --formula-delay: .8s; --formula-duration: 8.2s; --formula-rotate: 2deg; --formula-shift-x: .6rem; --formula-shift-y: -1rem; }
.entry-equation-field span:nth-child(9) { left: 45%; bottom: 7%; --formula-delay: 1.8s; --formula-duration: 7.8s; --formula-rotate: -1deg; --formula-shift-x: -.5rem; --formula-shift-y: -.82rem; }
.entry-equation-field span:nth-child(10) { left: 11%; top: 13%; --formula-delay: 2.7s; --formula-duration: 9.4s; --formula-rotate: 1deg; --formula-shift-x: .42rem; --formula-shift-y: -.68rem; }
.entry-equation-field span:nth-child(11) { left: 35%; bottom: 18%; --formula-delay: 3.4s; --formula-duration: 8.6s; --formula-rotate: -2deg; --formula-shift-x: -.52rem; --formula-shift-y: -.72rem; }
.entry-equation-field span:nth-child(12) { right: 24%; top: 37%; --formula-delay: 1.6s; --formula-duration: 10.2s; --formula-rotate: 2deg; --formula-shift-x: .56rem; --formula-shift-y: -.8rem; }
.entry-equation-field span:nth-child(13) { left: 12%; top: 34%; --formula-delay: 3.1s; --formula-duration: 9.4s; --formula-rotate: 1deg; --formula-shift-x: .42rem; --formula-shift-y: -.68rem; }
.entry-equation-field span:nth-child(14) { left: 36%; bottom: 24%; --formula-delay: 3.8s; --formula-duration: 8.6s; --formula-rotate: -2deg; --formula-shift-x: -.52rem; --formula-shift-y: -.72rem; }
.entry-equation-field span:nth-child(15) { right: 29%; top: 28%; --formula-delay: 2.2s; --formula-duration: 10.2s; --formula-rotate: 2deg; --formula-shift-x: .56rem; --formula-shift-y: -.8rem; }

.entry-equation-field span.formula-secondary {
  color: rgba(205, 225, 248, .84);
  --formula-idle-opacity: .025;
  --formula-rise-opacity: .13;
  --formula-peak-opacity: .24;
  --formula-fall-opacity: .12;
  font-size: clamp(.9rem, 1.08vw, 1.35rem);
}

.entry-equation-field span.formula-legacy {
  color: rgba(168, 198, 234, .7);
  --formula-idle-opacity: .015;
  --formula-rise-opacity: .07;
  --formula-peak-opacity: .13;
  --formula-fall-opacity: .065;
  font-size: clamp(.76rem, .9vw, 1.08rem);
}

.entry-equation-field sub,
.entry-equation-field sup {
  font-size: .62em;
  line-height: 0;
}

body.entry-page .entry-photo-strip {
  z-index: 3;
  right: clamp(1rem, 4vw, 4.5rem);
  top: 9dvh;
  bottom: 9dvh;
  width: min(34rem, 36vw);
  gap: .75rem;
  opacity: .92;
  transform: perspective(1300px) rotateY(-8deg);
}

body.entry-page .entry-photo-strip img {
  border-radius: 8px !important;
  border: 1px solid rgba(255, 255, 255, .34);
  box-shadow: 0 26px 70px rgba(0, 0, 0, .34);
  animation: photo-float 7s ease-in-out infinite;
}

body.entry-page .entry-photo-strip img:nth-child(2) {
  animation-delay: .5s;
}

body.entry-page .entry-photo-strip img:nth-child(3) {
  animation-delay: 1s;
}

body.entry-page .entry-shell {
  position: relative;
  z-index: 4;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(22rem, 31rem);
  align-items: center;
  gap: clamp(2rem, 8vw, 9rem);
  width: min(100%, 90rem);
  min-height: 100dvh;
  margin: 0 auto;
  padding: 3rem clamp(1rem, 5vw, 5rem);
}

.entry-copy {
  max-width: 39rem;
  color: #f8fbff;
}

.entry-kicker {
  display: inline-flex;
  margin: 0 0 .9rem;
  border: 1px solid rgba(125, 211, 252, .38);
  border-radius: 999px;
  padding: .38rem .72rem;
  background: rgba(15, 23, 42, .36);
  color: #bae6fd;
  font-size: .86rem;
  font-weight: 900;
}

.entry-copy h1 {
  margin: 0;
  max-width: 12em;
  color: #fff;
  font-size: clamp(3.15rem, 6vw, 5.75rem);
  line-height: 1.08;
  text-shadow:
    0 0 1px #fff,
    0 18px 48px rgba(37, 99, 235, .32),
    0 0 38px rgba(193, 18, 31, .2);
  text-wrap: balance;
}

.entry-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .72rem;
  max-width: 34rem;
  margin-top: 1.45rem;
}

.entry-metrics span {
  min-width: 0;
  border: 1px solid rgba(148, 163, 184, .32);
  border-radius: 8px;
  padding: .78rem;
  background: rgba(15, 23, 42, .42);
  backdrop-filter: blur(10px);
}

.entry-metrics strong,
.entry-metrics small {
  display: block;
}

.entry-metrics strong {
  color: #fff;
  font-size: 1.16rem;
  line-height: 1.2;
}

.entry-metrics small {
  margin-top: .25rem;
  color: #bfdbfe;
  font-size: .82rem;
  font-weight: 800;
}

.entry-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .72rem;
  max-width: 34rem;
  margin-top: 1.25rem;
}

.entry-action-primary,
.entry-action-secondary {
  display: inline-grid;
  min-height: 3.2rem;
  min-width: 10.5rem;
  place-items: center;
  border-radius: 8px;
  padding: .72rem 1rem;
  color: #eaf2ff;
  font-weight: 900;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  overflow-wrap: anywhere;
  transition: transform .2s ease, border-color .2s ease, background .2s ease;
}

.entry-action-primary {
  border: 1px solid rgba(125, 211, 252, .72);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, .18) 0 1px, transparent 1px),
    linear-gradient(135deg, rgba(193, 18, 31, .94), rgba(37, 99, 235, .94) 58%, rgba(6, 182, 212, .9));
  background-size: 16px 100%, auto;
  box-shadow:
    0 18px 38px rgba(37, 99, 235, .22),
    inset 0 0 18px rgba(255, 255, 255, .12);
}

.entry-action-secondary {
  border: 1px solid rgba(219, 234, 254, .44);
  background: rgba(15, 23, 42, .42);
  backdrop-filter: blur(10px);
}

.entry-action-primary:hover,
.entry-action-secondary:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, .82);
}

.entry-toolchain {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .55rem;
  max-width: 34rem;
  margin-top: 1rem;
  color: #dbeafe;
  font-size: .86rem;
  font-weight: 900;
}

.entry-toolchain span {
  min-width: 0;
  border: 1px solid rgba(125, 211, 252, .28);
  border-radius: 999px;
  padding: .38rem .62rem;
  background: rgba(15, 23, 42, .36);
  overflow-wrap: anywhere;
}

.entry-toolchain i {
  width: 1.6rem;
  height: 1px;
  background: linear-gradient(90deg, rgba(125, 211, 252, .25), rgba(250, 204, 21, .72));
}

body.entry-page .entry-card {
  justify-self: end;
  width: min(100%, 31rem);
  padding: 1.55rem;
  border: 1px solid rgba(125, 211, 252, .44);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(125, 211, 252, .08) 1px, transparent 1px),
    linear-gradient(180deg, rgba(125, 211, 252, .06) 1px, transparent 1px),
    linear-gradient(135deg, rgba(8, 18, 34, .9), rgba(11, 23, 42, .82));
  background-size: 28px 28px, 28px 28px, auto;
  color: #eaf2ff;
  box-shadow:
    0 30px 90px rgba(0, 0, 0, .42),
    inset 0 1px 0 rgba(255, 255, 255, .08);
  backdrop-filter: blur(18px);
  animation: entry-card-in .7s ease both;
}

body.entry-page .entry-card::before,
body.entry-page .entry-card::after {
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 0;
}

body.entry-page .brand-line {
  gap: .85rem;
  margin-bottom: 1.05rem;
}

body.entry-page .brand-emblem {
  width: 3.05rem;
  height: 3.05rem;
}

body.entry-page .brand-school {
  margin: 0 0 .18rem;
  color: #7dd3fc;
  font-size: .78rem;
  font-weight: 900;
  text-transform: none;
}

body.entry-page .entry-card h2 {
  margin: 0;
  color: #f8fbff;
  font-size: 1.72rem;
  line-height: 1.18;
}

body.entry-page .entry-subtitle {
  max-width: none;
  margin-bottom: 1.25rem;
  color: #cbd5e1;
  line-height: 1.72;
}

body.entry-page .entry-auth-tabs {
  border-color: rgba(125, 211, 252, .32);
  background: rgba(15, 23, 42, .72);
  margin-bottom: .9rem;
}

body.entry-page .entry-auth-tabs button {
  color: #bfdbfe;
}

body.entry-page .entry-auth-tabs button.active {
  background: linear-gradient(135deg, #c1121f, #2563eb 54%, #06b6d4);
  color: #fff;
  box-shadow: 0 12px 28px rgba(37, 99, 235, .24);
}

body.entry-page .entry-input-group + .entry-input-group {
  margin-top: .82rem;
}

body.entry-page .entry-input-group label {
  margin-bottom: .42rem;
  color: #dbeafe;
}

body.entry-page .entry-input-group input {
  height: 3rem;
  border-color: rgba(125, 211, 252, .34);
  border-radius: 8px;
  background: rgba(2, 8, 23, .46);
  color: #f8fbff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06);
}

body.entry-page .entry-input-group input::placeholder {
  color: #94a3b8;
}

body.entry-page .entry-input-group input:focus {
  border-color: rgba(250, 204, 21, .82);
  box-shadow:
    0 0 0 4px rgba(250, 204, 21, .12),
    inset 0 1px 0 rgba(255, 255, 255, .08);
}

body.entry-page .entry-input-hint {
  min-height: 1.1rem;
  margin-top: .32rem;
  color: #9fb4ce;
  font-size: .78rem;
  line-height: 1.35;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-2px);
  transition: opacity .18s ease, transform .18s ease, visibility .18s ease;
}

body.entry-page .entry-input-group:hover .entry-input-hint,
body.entry-page .entry-input-group:focus-within .entry-input-hint {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

body.entry-page .entry-tip {
  min-height: 1.35rem;
  margin: .45rem 0 .85rem;
  color: #b6c8df;
  line-height: 1.5;
}

body.entry-page .entry-tip:empty {
  display: none;
}

body.entry-page .primary-button,
body.entry-page .ghost-entry-button {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 2.95rem;
  border-radius: 8px;
  overflow: hidden;
}

body.entry-page .primary-button {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, .2) 0 1px, transparent 1px),
    linear-gradient(135deg, #c1121f 0%, #1d4ed8 58%, #0891b2 100%);
  background-size: 18px 100%, auto;
  box-shadow:
    0 18px 40px rgba(37, 99, 235, .22),
    inset 0 0 18px rgba(255, 255, 255, .13);
}

body.entry-page .primary-button::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 0 34%, rgba(255, 255, 255, .34) 45%, transparent 56% 100%);
  transform: translateX(-120%);
  animation: entry-button-sweep 3.4s ease-in-out infinite;
}

body.entry-page .primary-button:disabled,
body.entry-page .ghost-entry-button:disabled {
  cursor: wait;
  opacity: .72;
}

body.entry-page.entry-launching .primary-button::after {
  content: "";
  position: absolute;
  right: 1rem;
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(255, 255, 255, .48);
  border-top-color: #fff;
  border-radius: 50%;
  animation: entry-spin .7s linear infinite;
}

body.entry-page .source-entry-button {
  text-align: center;
}

body.entry-page .ghost-entry-button {
  border-color: rgba(125, 211, 252, .32);
  background: rgba(15, 23, 42, .54);
  color: #dbeafe;
}

body.entry-page .ghost-entry-button:hover {
  background: rgba(30, 41, 59, .72);
  color: #fff;
}

body.entry-page .entry-features {
  margin-top: 1.1rem;
}

body.entry-page .entry-features span {
  border-color: rgba(125, 211, 252, .22);
  border-radius: 999px;
  background: rgba(14, 165, 233, .12);
  color: #dbeafe;
}

body.entry-page .entry-contact {
  border-color: rgba(125, 211, 252, .24);
  border-radius: 8px;
  background: rgba(2, 8, 23, .32);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05);
}

body.entry-page .entry-contact span {
  color: #7dd3fc;
}

body.entry-page .entry-contact a {
  color: #cbd5e1;
}

body.entry-page.page-leaving .entry-card,
body.entry-page.page-leaving .entry-copy {
  opacity: 0;
  transform: translateY(-12px);
}

body.entry-page .entry-copy {
  transition: opacity .34s ease, transform .34s ease;
}

@keyframes entry-bg-drift {
  from { transform: scale(1.06) translate3d(0, 0, 0); }
  to { transform: scale(1.1) translate3d(-1.2rem, .7rem, 0); }
}

@keyframes entry-spin {
  to { transform: rotate(360deg); }
}

@keyframes entry-scan-grid {
  from { background-position: 0 0, 0 0, 0 0, 0 0, 0 0; }
  to { background-position: 0 0, 0 0, 42px 42px, 42px 42px, 0 0; }
}

@keyframes entry-beam {
  0% { transform: translateY(0) rotate(17deg); opacity: 0; }
  12% { opacity: 1; }
  76% { opacity: .8; }
  100% { transform: translateY(140vh) rotate(17deg); opacity: 0; }
}

@keyframes equation-fade-float {
  0%, 100% {
    opacity: var(--formula-idle-opacity, .035);
    transform: translate3d(0, 0, 0) rotate(var(--formula-rotate, 0deg));
  }

  25% {
    opacity: var(--formula-rise-opacity, .18);
    transform: translate3d(calc(var(--formula-shift-x, .6rem) * .55), calc(var(--formula-shift-y, -.9rem) * .58), 0) rotate(var(--formula-rotate, 0deg));
  }

  50% {
    opacity: var(--formula-peak-opacity, .32);
    transform: translate3d(var(--formula-shift-x, .6rem), var(--formula-shift-y, -.9rem), 0) rotate(var(--formula-rotate, 0deg));
  }

  75% {
    opacity: var(--formula-fall-opacity, .17);
    transform: translate3d(calc(var(--formula-shift-x, .6rem) * .5), calc(var(--formula-shift-y, -.9rem) * .58), 0) rotate(var(--formula-rotate, 0deg));
  }
}

@keyframes photo-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-.65rem); }
}

@keyframes entry-hud-breathe {
  0%, 100% { opacity: .36; transform: scale(1); }
  50% { opacity: .78; transform: scale(1.025); }
}

@keyframes entry-core-spin {
  to { transform: rotate(360deg); }
}

@keyframes entry-core-pulse {
  0%, 100% { opacity: .42; transform: translate(6.7rem, -4rem) rotate(45deg) scale(.72); }
  50% { opacity: 1; transform: translate(6.7rem, -4rem) rotate(45deg) scale(1.18); }
}

@keyframes entry-card-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes entry-button-sweep {
  0%, 48% { transform: translateX(-120%); }
  72%, 100% { transform: translateX(120%); }
}

@media (max-width: 980px) {
  .entry-core {
    left: 72%;
    top: 28%;
    width: 13rem;
    opacity: .42;
  }

  .entry-campus-mark.campus-star {
    left: -12rem;
    top: 18vh;
    opacity: .045;
  }

  .entry-campus-mark.campus-jiazi {
    left: auto;
    right: 12rem;
    bottom: 4rem;
    opacity: .08;
  }

  .entry-campus-mark.campus-century {
    right: -12rem;
    opacity: .055;
  }

  body.entry-page .entry-photo-strip {
    inset: auto 1rem 1rem 1rem;
    width: auto;
    height: 7.5rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    opacity: .38;
    transform: none;
  }

  body.entry-page .entry-shell {
    grid-template-columns: 1fr;
    align-content: center;
    gap: 1.25rem;
    padding: 2rem 1rem 9.5rem;
  }

  .entry-copy {
    max-width: 42rem;
  }

  .entry-copy h1 {
    font-size: 2.5rem;
  }

  body.entry-page .entry-card {
    justify-self: stretch;
    width: min(100%, 34rem);
  }
}

@media (max-width: 560px) {
  .entry-core {
    display: none;
  }

  .entry-campus-marks {
    display: none;
  }

  .entry-loader-panel {
    padding: 1rem;
  }

  .entry-loader-steps,
  .entry-metrics {
    grid-template-columns: 1fr;
  }

  .entry-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .entry-action-primary,
  .entry-action-secondary {
    width: 100%;
  }

  .entry-toolchain i {
    display: none;
  }

  .entry-copy h1 {
    font-size: 2.05rem;
  }

  body.entry-page .entry-shell {
    padding: 1rem .75rem 8.5rem;
  }

  body.entry-page .entry-card {
    padding: 1rem;
  }

  body.entry-page .brand-line {
    align-items: flex-start;
  }

  body.entry-page .entry-contact {
    grid-template-columns: 1fr;
  }

}

@media (prefers-reduced-motion: reduce) {
  body.entry-page::before,
  .entry-loader-mark span,
  .entry-orbit-canvas,
  .entry-core,
  .entry-hud-grid span,
  .entry-beam-field span,
  .entry-equation-field span,
  body.entry-page .entry-photo-strip img,
  body.entry-page .entry-card,
  body.entry-page .primary-button::before {
    animation: none !important;
  }

  .entry-equation-field span {
    opacity: .12;
  }

  .entry-loader,
  body.entry-page .entry-card,
  body.entry-page .entry-copy {
    transition: none !important;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  color: var(--text);
}

button, input, select { font: inherit; }

.entry-page {
  min-height: 100vh;
  overflow: hidden;
  background: #10233f;
}

.entry-page::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(8, 24, 47, .88) 0%, rgba(8, 24, 47, .5) 48%, rgba(193, 18, 31, .35) 100%),
    url("../images/沙河 南门.png") center / cover no-repeat;
  transform: scale(1.04);
}

.entry-photo-strip {
  position: fixed;
  right: 4vw;
  top: 8vh;
  bottom: 8vh;
  width: min(36vw, 420px);
  display: grid;
  gap: 1rem;
  z-index: 1;
  pointer-events: none;
}

.entry-photo-strip img {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, .4);
  box-shadow: 0 22px 60px rgba(0, 0, 0, .26);
}

.entry-photo-strip img:nth-child(1) { border-radius: 1.4rem 1.4rem .35rem .35rem; }
.entry-photo-strip img:nth-child(2) { border-radius: .35rem; }
.entry-photo-strip img:nth-child(3) { border-radius: .35rem .35rem 1.4rem 1.4rem; }

.entry-shell {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 2rem 48vw 2rem 6vw;
}

.entry-card {
  width: min(92vw, 520px);
  padding: 2rem;
  border-radius: .5rem;
  background: rgba(255, 255, 255, .92);
  border: 1px solid rgba(255, 255, 255, .64);
  box-shadow: 0 24px 80px rgba(3, 18, 38, .32);
  transition: .45s ease;
}

.page-leaving .entry-card { transform: translateY(-10px); opacity: 0; }

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    linear-gradient(90deg, rgba(148, 163, 184, .08) 1px, transparent 1px),
    linear-gradient(180deg, rgba(148, 163, 184, .08) 1px, transparent 1px),
    rgba(15, 23, 42, .68);
  background-size: 44px 44px, 44px 44px, auto;
  backdrop-filter: blur(5px);
}

.loading-overlay.hide {
  opacity: 0;
  pointer-events: none;
  transition: opacity .28s ease;
}

.tech-loading-card {
  position: relative;
  width: min(92vw, 560px);
  max-height: calc(100vh - 2rem);
  overflow: hidden;
  border: 2px solid #93c5fd;
  border-radius: .5rem;
  background: #fff;
  padding: 1.15rem;
  box-shadow: 0 22px 64px rgba(15, 23, 42, .26);
  animation: tip-card-in .28s ease;
}

.tech-loading-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 0 33%, rgba(59, 130, 246, .14) 48%, transparent 64%);
  pointer-events: none;
  transform: translateX(-120%);
  animation: loading-scan 2.8s ease-in-out infinite;
}

.tech-loading-card::after {
  content: "";
  position: absolute;
  inset: .55rem;
  border: 1px solid rgba(37, 99, 235, .12);
  border-radius: .36rem;
  pointer-events: none;
}

.tech-loading-card > * {
  position: relative;
  z-index: 1;
}

.tech-loading-card .tech-loader {
  margin: 0 0 .75rem;
}

.tech-loader {
  display: grid;
  grid-template-columns: 5.4rem 1fr;
  align-items: center;
  gap: 1rem;
  margin: -.35rem 0 .8rem;
  padding: .75rem .85rem;
  border: 1px solid #bfdbfe;
  border-radius: .65rem;
  background:
    linear-gradient(90deg, rgba(37, 99, 235, .06) 1px, transparent 1px),
    linear-gradient(180deg, rgba(37, 99, 235, .04) 1px, transparent 1px),
    #f8fbff;
  background-size: 22px 22px, 22px 22px, auto;
}

.tech-loader-ring {
  position: relative;
  width: 4.8rem;
  height: 4.8rem;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #ffffff 0 42%, transparent 43%),
    conic-gradient(from 0deg, #2563eb, #06b6d4, #93c5fd, #2563eb);
  box-shadow: 0 0 0 1px #bfdbfe inset, 0 14px 26px rgba(37, 99, 235, .16);
  animation: tech-spin 1.45s linear infinite;
}

.tech-loader-ring::before,
.tech-loader-ring::after,
.tech-loader-ring span {
  content: "";
  position: absolute;
  border-radius: 50%;
}

.tech-loader-ring::before {
  inset: .9rem;
  border: 1px solid rgba(37, 99, 235, .24);
  background: rgba(255, 255, 255, .78);
}

.tech-loader-ring::after {
  inset: 2.1rem;
  background: #2563eb;
  box-shadow: 0 0 18px rgba(37, 99, 235, .58);
}

.tech-loader-ring span:nth-child(1) {
  inset: .28rem;
  border-top: 2px solid #fff;
  border-right: 2px solid transparent;
}

.tech-loader-ring span:nth-child(2) {
  inset: .65rem;
  border-left: 1px solid rgba(255, 255, 255, .9);
}

.tech-loader-ring span:nth-child(3) {
  inset: 1.35rem;
  border-bottom: 1px solid rgba(37, 99, 235, .35);
}

@keyframes tech-spin {
  to { transform: rotate(360deg); }
}

@keyframes loading-scan {
  0%, 18% { transform: translateX(-120%); opacity: 0; }
  38%, 64% { opacity: 1; }
  100% { transform: translateX(120%); opacity: 0; }
}

.tech-loader-copy {
  display: grid;
  gap: .35rem;
  min-width: 0;
}

.tech-loader-copy strong {
  color: #0f172a;
  font-size: 1rem;
  font-weight: 950;
}

.tech-loader-copy small {
  color: #475569;
  font-weight: 850;
}

.tech-loader-copy i {
  display: block;
  height: .5rem;
  border-radius: 999px;
  background: #dbeafe;
  overflow: hidden;
}

.tech-loader-copy i b {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2563eb, #06b6d4);
  transition: width .26s ease;
}

.loading-telemetry {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .45rem;
  margin-top: .32rem;
}

.loading-telemetry span {
  min-width: 0;
  border: 1px solid #dbeafe;
  border-radius: .42rem;
  background: rgba(255, 255, 255, .72);
  padding: .34rem .42rem;
  color: #1d4ed8;
  font-size: .72rem;
  font-weight: 900;
  text-align: center;
  white-space: nowrap;
}

.tip-close-button {
  display: block;
  margin: .1rem 0 0 auto;
  border: 0;
  border-radius: .5rem;
  padding: .56rem 1.15rem;
  background: linear-gradient(180deg, #3b82f6, #1d4ed8);
  color: #fff;
  cursor: pointer;
  font-weight: 900;
  box-shadow: 0 10px 20px rgba(37, 99, 235, .22);
}

.tip-close-button:disabled {
  cursor: wait;
  opacity: .68;
  transform: none;
}

.loading-overlay.ready .tech-loader-ring {
  animation-duration: 3.6s;
  background:
    radial-gradient(circle at center, #ffffff 0 42%, transparent 43%),
    conic-gradient(from 0deg, #22c55e, #06b6d4, #93c5fd, #22c55e);
}

@keyframes tip-card-in {
  0% { opacity: 0; transform: translateY(10px) scale(.98); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.brand-line {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.35rem;
}

.brand-emblem {
  width: 3.4rem;
  height: 3.4rem;
  object-fit: contain;
  flex: 0 0 auto;
}

.brand-emblem.small {
  width: 2.6rem;
  height: 2.6rem;
}

.brand-school {
  margin: 0 0 .2rem;
  font-size: .78rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--bupt-blue);
  font-weight: 800;
}

.entry-card h1 {
  margin: 0;
  font-size: clamp(1.65rem, 4vw, 2.35rem);
  color: var(--ink);
  letter-spacing: 0;
}

.entry-subtitle {
  color: #45546a;
  line-height: 1.8;
  margin: 0 0 2rem;
}

.entry-auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .5rem;
  margin-bottom: .95rem;
  padding: .35rem;
  border: 1px solid #dbeafe;
  border-radius: .55rem;
  background: #f8fbff;
}

.entry-auth-tabs button {
  border: 0;
  border-radius: .42rem;
  padding: .68rem;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  font-weight: 900;
}

.entry-auth-tabs button.active {
  background: linear-gradient(135deg, #2563eb, #0891b2);
  color: #fff;
  box-shadow: 0 10px 20px rgba(37, 99, 235, .18);
}

.entry-input-group label {
  display: block;
  margin-bottom: .5rem;
  color: #334155;
  font-weight: 800;
}

.entry-input-group input,
.toolbar input,
.toolbar select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: .5rem;
  padding: .9rem 1rem;
  outline: none;
  background: rgba(255, 255, 255, .95);
}

.entry-input-group input:focus,
.toolbar input:focus,
.toolbar select:focus {
  border-color: var(--bupt-blue);
  box-shadow: 0 0 0 4px rgba(0, 91, 172, .12);
}

.input-error { border-color: #ef4444 !important; animation: shake .25s linear 2; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.entry-tip {
  color: var(--muted);
  font-size: .86rem;
  margin: .55rem 0 1.2rem;
}

.primary-button,
.toolbar button {
  border: 0;
  border-radius: .5rem;
  padding: .95rem 1.2rem;
  cursor: pointer;
  color: white;
  font-weight: 900;
  background: linear-gradient(135deg, var(--bupt-red), var(--bupt-blue));
  box-shadow: 0 12px 26px rgba(0, 91, 172, .25);
}

.primary-button { width: 100%; }

.ghost-entry-button {
  width: 100%;
  margin-top: .75rem;
  border: 1px solid #bfdbfe;
  border-radius: .55rem;
  padding: .75rem 1rem;
  background: #fff;
  color: #1d4ed8;
  cursor: pointer;
  font-weight: 900;
}

.ghost-entry-button:hover {
  transform: translateY(-1px);
  background: #eff6ff;
}

.source-entry-button {
  display: block;
  text-align: center;
  text-decoration: none;
}

.entry-features {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
  margin-top: 1.3rem;
}

.entry-features span {
  background: #eef5fb;
  color: #174a82;
  border: 1px solid #d7e5f3;
  border-radius: 999px;
  padding: .35rem .7rem;
  font-size: .8rem;
  font-weight: 700;
}

.app-page {
  display: flex;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(244, 247, 251, .95), rgba(244, 247, 251, .98)),
    url("../images/西土城 科学会堂.png") center / cover fixed no-repeat;
}

.sidebar {
  width: 300px;
  padding: 1.25rem;
  background: rgba(255, 255, 255, .96);
  border-right: 1px solid var(--line);
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .8rem;
  margin-bottom: 1rem;
}

.sidebar-brand h1 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--ink);
}

.sidebar-brand p {
  margin: .15rem 0 0;
  color: var(--muted);
  font-size: .8rem;
}

.campus-card {
  border: 1px solid var(--line);
  border-radius: .5rem;
  overflow: hidden;
  background: #fff;
  margin-bottom: 1rem;
}

.campus-card img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #dce7f2;
}

.campus-card > div:not(.campus-switch) {
  padding: .85rem .9rem .55rem;
}

.campus-label {
  margin: 0 0 .2rem;
  color: var(--bupt-red);
  font-size: .72rem;
  font-weight: 900;
}

.campus-card h2 {
  margin: 0;
  font-size: 1rem;
  color: var(--ink);
}

.campus-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .45rem;
  padding: 0 .9rem .9rem;
}

.campus-switch button {
  border: 1px solid var(--line);
  background: #fff;
  color: #465469;
  border-radius: .45rem;
  padding: .55rem .4rem;
  cursor: pointer;
  font-weight: 800;
}

.campus-switch button.active {
  background: #eaf4ff;
  border-color: #b9d8f6;
  color: var(--bupt-blue);
}

.chapter-nav {
  display: grid;
  gap: .4rem;
}

.chapter-nav button {
  border: 0;
  background: transparent;
  text-align: left;
  padding: .78rem .85rem;
  border-radius: .45rem;
  cursor: pointer;
  color: #465469;
  font-weight: 800;
}

.chapter-nav button.active,
.chapter-nav button:hover {
  background: #eaf4ff;
  color: var(--bupt-blue);
}

.sync-panel {
  margin-top: auto;
  border: 1px solid var(--line);
  border-radius: .5rem;
  padding: 1rem;
  background: #f8fbfe;
}

.sync-panel p {
  margin: 0 0 .55rem;
  color: #475569;
  font-size: .86rem;
}

.sync-panel #sync-status span {
  display: inline-block;
  width: .55rem;
  height: .55rem;
  border-radius: 50%;
  background: #22c55e;
  margin-right: .3rem;
}

.sync-panel button {
  border: 0;
  background: transparent;
  color: var(--bupt-red);
  cursor: pointer;
  padding: 0;
  font-weight: 800;
}

.sync-guide-link {
  display: inline-flex;
  margin-left: .85rem;
  color: var(--bupt-blue);
  font-size: .86rem;
  font-weight: 850;
  text-decoration: none;
}

.sync-guide-link:hover {
  text-decoration: underline;
}

.content {
  flex: 1;
  padding: 1.5rem;
  max-width: 1220px;
  margin: 0 auto;
}

.content-header {
  position: relative;
  min-height: 270px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.7rem;
  border-radius: .8rem;
  overflow: hidden;
  background: linear-gradient(135deg, #ffffff 0%, #f8fbff 55%, #eef6ff 100%);
  border: 1px solid #d9e8fb;
  box-shadow: 0 14px 34px rgba(30, 64, 175, .1);
}

.content-header::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(circle at 78% 18%, rgba(37, 99, 235, .12), transparent 28%),
    linear-gradient(90deg, rgba(255, 255, 255, .96), rgba(255, 255, 255, .74) 58%, rgba(239, 246, 255, .48));
}

.hero-campus-image {
  position: absolute;
  top: 50%;
  right: 7%;
  z-index: 0;
  width: min(38vw, 420px);
  height: 112%;
  object-fit: contain;
  transform: translateY(-50%);
  opacity: .18;
  filter: saturate(1.25) contrast(1.08);
}

.header-copy,
.header-stats {
  position: relative;
  z-index: 2;
}

.school-name-img {
  display: none;
  width: min(320px, 54vw);
  height: auto;
  margin-bottom: .8rem;
  padding: .35rem .5rem;
  border-radius: .35rem;
  background: rgba(255, 255, 255, .92);
}

.eyebrow {
  margin: 0 0 .3rem;
  color: #1d4ed8;
  font-size: .78rem;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.content-header h2 {
  margin: 0;
  color: #0f172a;
  font-size: clamp(1.8rem, 4vw, 2.65rem);
  letter-spacing: 0;
}

.header-desc {
  margin: .65rem 0 0;
  color: #475569;
  max-width: 620px;
  line-height: 1.75;
}

.header-stats {
  display: flex;
  gap: .75rem;
  align-self: flex-end;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.header-stats div {
  min-width: 86px;
  border-radius: .5rem;
  background: rgba(255, 255, 255, .88);
  padding: .85rem;
  text-align: center;
  border: 1px solid #dbeafe;
  box-shadow: 0 10px 24px rgba(37, 99, 235, .1);
}

.header-stats strong {
  display: block;
  font-size: 1.45rem;
  color: var(--bupt-blue);
}

.header-stats span {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 800;
}

.study-overview {
  display: grid;
  grid-template-columns: 1.35fr 1fr 1fr 1fr;
  gap: .85rem;
  margin: 1.1rem 0 0;
}

.overview-card {
  position: relative;
  overflow: hidden;
  min-height: 6rem;
  padding: 1rem;
  border: 1px solid #d5e7fb;
  border-radius: .65rem;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 14px 34px rgba(37, 99, 235, .08);
}

.overview-card::after {
  content: "";
  position: absolute;
  inset: auto -20% -65% auto;
  width: 8rem;
  height: 8rem;
  border-radius: 50%;
  background: rgba(37, 99, 235, .08);
}

.overview-card span,
.overview-card small {
  display: block;
  color: #64748b;
  font-weight: 900;
  line-height: 1.4;
}

.overview-card span {
  font-size: .78rem;
}

.overview-card strong {
  display: block;
  margin: .35rem 0 .18rem;
  color: #0f172a;
  font-size: 1.45rem;
  line-height: 1.2;
}

.overview-card small {
  font-size: .78rem;
}

.overview-card i {
  display: block;
  height: .48rem;
  margin-top: .75rem;
  border-radius: 999px;
  background: #e8f1fc;
  overflow: hidden;
}

.overview-card i b {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2563eb, #06b6d4);
  transition: width .24s ease;
}

.mode-panel {
  margin: 1.1rem 0 0;
  border: 1px solid #d8e6f7;
  border-radius: .55rem;
  padding: .85rem;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 12px 28px rgba(15, 23, 42, .06);
}

.mode-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
}

.mode-button {
  display: grid;
  gap: .18rem;
  min-height: 4.3rem;
  border: 1px solid #e2e8f0;
  border-radius: .5rem;
  padding: .85rem .95rem;
  background: #fff;
  color: #172033;
  text-align: left;
  cursor: pointer;
}

.mode-button:hover {
  border-color: #93c5fd;
  transform: translateY(-1px);
}

.mode-button.active {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, .16);
}

.mode-button strong {
  font-size: 1rem;
  color: #0f172a;
}

.mode-button small {
  color: #64748b;
  line-height: 1.35;
  font-weight: 800;
}

.mode-status {
  margin-top: .75rem;
  color: #475569;
  font-weight: 800;
  line-height: 1.55;
}

.exam-panel {
  display: none;
  margin-top: .8rem;
}

.exam-panel.show {
  display: block;
}

.exam-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .9rem;
  border: 1px solid #fde68a;
  border-radius: .5rem;
  padding: .85rem;
  background: #fffbeb;
}

.exam-card div {
  display: grid;
  gap: .2rem;
}

.exam-card strong {
  color: #92400e;
}

.exam-card span {
  color: #78350f;
  font-weight: 800;
  line-height: 1.45;
}

.exam-actions {
  display: flex !important;
  grid-auto-flow: column;
  gap: .55rem !important;
}

.exam-filter-grid {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .55rem !important;
  margin-top: .65rem;
}

.exam-filter-field {
  display: grid;
  gap: .24rem;
  min-width: 0;
}

.exam-filter-field span {
  color: #92400e;
  font-size: .76rem;
  font-weight: 900;
}

.exam-filter-field select {
  width: 100%;
  min-width: 0;
  min-height: 2.45rem;
  border: 1px solid #facc15;
  border-radius: .5rem;
  padding: .45rem .55rem;
  background: #fff;
  color: #78350f;
  font-weight: 850;
  line-height: 1.25;
}

.library-panel {
  display: flex;
  align-items: stretch;
  gap: .5rem;
  margin: .95rem 0 0;
  overflow-x: auto;
  border: 1px solid #d5e7fb;
  border-radius: .72rem;
  padding: .42rem;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 10px 28px rgba(15, 23, 42, .06);
}

.library-entry {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  flex: 1 0 10.5rem;
  gap: .5rem;
  min-height: 3.4rem;
  border: 1px solid transparent;
  border-radius: .5rem;
  padding: .58rem .66rem;
  background: transparent;
  color: #172033;
  text-align: left;
  cursor: pointer;
  box-shadow: none;
}

.library-entry:hover {
  transform: translateY(-1px);
  border-color: #93c5fd;
  box-shadow: 0 16px 32px rgba(37, 99, 235, .12);
}

.library-entry.active {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: 0 8px 18px rgba(37, 99, 235, .1);
}

.library-icon {
  display: none;
}

.library-copy {
  display: grid;
  gap: .12rem;
  min-width: 0;
}

.library-copy strong {
  color: #0f172a;
  font-size: .92rem;
  line-height: 1.18;
}

.library-copy small {
  color: #64748b;
  font-size: .72rem;
  line-height: 1.25;
}

.library-entry em {
  display: grid;
  place-items: center;
  min-width: 2rem;
  height: 1.8rem;
  padding: 0 .4rem;
  border-radius: 999px;
  background: #f8fafc;
  color: #0f172a;
  font-style: normal;
  font-weight: 900;
  border: 1px solid #e2e8f0;
}

/* Legacy icon rules kept for older markup variants. */
.library-icon {
  border-radius: .5rem;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 1.28rem;
  font-weight: 900;
}

.library-icon.danger {
  background: #fee2e2;
  color: #dc2626;
}

.library-icon.warm {
  background: #fef3c7;
  color: #b45309;
}

.library-icon.adversarial {
  background: #fef2f2;
  color: #b91c1c;
  font-family: "Times New Roman", Georgia, serif;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 150px 120px 120px 112px 112px 112px;
  gap: .8rem;
  margin: 1.1rem 0;
}

.floating-timer {
  position: fixed;
  right: 1.4rem;
  bottom: 1.4rem;
  z-index: 900;
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: .75rem .85rem;
  border: 1px solid #cfe0f6;
  border-radius: .8rem;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 16px 38px rgba(30, 64, 175, .16);
  backdrop-filter: blur(10px);
}

.floating-timer img {
  width: 2.9rem;
  height: 2.9rem;
  object-fit: contain;
  opacity: .9;
  filter: saturate(1.2) contrast(1.08);
}

.floating-timer-copy {
  display: grid;
  gap: .1rem;
  min-width: 8.2rem;
}

.timer-label {
  color: #64748b;
  font-size: .82rem;
  font-weight: 900;
}

.floating-timer strong {
  color: #0f172a;
  font-variant-numeric: tabular-nums;
  font-size: 1.35rem;
  line-height: 1.1;
}

.floating-timer-actions {
  display: flex;
  gap: .55rem;
}

.floating-timer button {
  border: 1px solid #d7e5f4;
  border-radius: .55rem;
  padding: .58rem .82rem;
  background: #fff;
  color: #1f2937;
  cursor: pointer;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(15, 23, 42, .06);
}

.floating-timer button:hover {
  border-color: #93c5fd;
  color: #1d4ed8;
  transform: translateY(-1px);
}

.question-list {
  display: grid;
  gap: 1rem;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .8rem;
  padding: .6rem 0 1.2rem;
  color: var(--muted);
  font-weight: 800;
}

.pagination button {
  border: 1px solid var(--line);
  border-radius: .45rem;
  padding: .55rem .8rem;
  background: #fff;
  color: #334155;
  cursor: pointer;
  font-weight: 800;
}

.pagination button:hover:not(:disabled) {
  border-color: #b9d8f6;
  color: var(--bupt-blue);
}

.pagination button:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.question-card {
  position: relative;
  background: #fff;
  border: 1px solid #edf1f6;
  border-radius: .8rem;
  padding: 1.55rem 1.75rem 1.35rem;
  box-shadow: 0 10px 28px rgba(15, 23, 42, .09);
  overflow: hidden;
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.question-card:hover {
  border-color: #bfdbfe;
  box-shadow: 0 18px 42px rgba(37, 99, 235, .12);
  transform: translateY(-1px);
}

.question-card.is-correct {
  border-color: #86efac;
  box-shadow: 0 16px 34px rgba(34, 197, 94, .16);
}

.question-card.is-wrong {
  border-color: #fca5a5;
  box-shadow: 0 16px 34px rgba(239, 68, 68, .16);
  animation: card-alert .22s ease;
}

@keyframes card-alert {
  0%, 100% { transform: translateX(0); }
  35% { transform: translateX(-4px); }
  70% { transform: translateX(4px); }
}

.result-pop {
  position: absolute;
  top: 4.15rem;
  right: 1.5rem;
  z-index: 1;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 1.45rem;
  font-weight: 900;
  box-shadow: 0 14px 26px rgba(15, 23, 42, .18);
  animation: result-pop .34s cubic-bezier(.2, 1.5, .5, 1);
}

.result-pop.correct { background: #22c55e; }
.result-pop.wrong { background: #ef4444; }

@keyframes result-pop {
  0% { opacity: 0; transform: scale(.35) rotate(-12deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}

.question-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.05rem;
  align-items: center;
}

.question-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.2rem;
}

.badge {
  border-radius: 999px;
  padding: .36rem .7rem;
  background: #f6f8fb;
  color: #475569;
  font-size: .86rem;
  font-weight: 800;
  line-height: 1.1;
}

.badge.source {
  background: #fff1f2;
  color: #ef4444;
}

.badge.topic {
  background: transparent;
  color: #374151;
  padding-left: 0;
  padding-right: 0;
}

.badge.difficulty {
  background: #fff7ed;
  color: #f59e0b;
}

.badge.exam-badge {
  background: #eff6ff;
  color: #1d4ed8;
}

.card-icon-actions {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex: 0 0 auto;
}

.icon-btn {
  width: 1.9rem;
  height: 1.9rem;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: #9ca3af;
  cursor: pointer;
  font-size: 1.35rem;
  line-height: 1;
  padding: 0;
}

.icon-btn:hover,
.icon-btn.active {
  color: #2563eb;
}

.question-title {
  margin: 0 0 1.25rem;
  padding-right: 3.3rem;
  font-size: 1.18rem;
  line-height: 1.85;
  color: #1f2937;
  font-weight: 800;
}

.answer-label {
  display: block;
  margin-bottom: .55rem;
  color: #374151;
  font-weight: 900;
}

.answer-checker {
  display: block;
  margin: 0 0 1.1rem;
}

.answer-input {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 8.7rem;
  resize: vertical;
  border: 1px solid #d5dbe5;
  border-radius: .55rem;
  padding: .9rem 1rem;
  outline: none;
  background: #fbfcfe;
  color: #1f2937;
  line-height: 1.65;
  font-weight: 700;
}

.answer-input:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .1);
  background: #fff;
}

.answer-feedback {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin: .75rem 0 1rem;
  padding: .72rem .85rem;
  border-radius: .5rem;
  font-size: .9rem;
  animation: feedback-in .26s ease;
}

.answer-feedback.correct {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.answer-feedback.wrong {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.answer-feedback span:last-child {
  color: inherit;
  opacity: .82;
}

.feedback-icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 50%;
  color: #fff;
  font-weight: 900;
}

.answer-feedback.correct .feedback-icon { background: #22c55e; }
.answer-feedback.wrong .feedback-icon { background: #ef4444; }

.exam-note {
  margin-top: .35rem;
  color: #64748b;
  font-weight: 900;
  line-height: 1.5;
}

@keyframes feedback-in {
  0% { opacity: 0; transform: translateY(-6px); }
  100% { opacity: 1; transform: translateY(0); }
}

.question-actions {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-top: 1.15rem;
  flex-wrap: wrap;
}

.question-actions button,
.analysis-toggle {
  border: 1px solid transparent;
  border-radius: .55rem;
  padding: .72rem 1.25rem;
  cursor: pointer;
  color: #334155;
  font-weight: 800;
  box-shadow: none;
}

.primary-action {
  background: #1d4ed8;
  color: #fff !important;
  box-shadow: 0 10px 20px rgba(37, 99, 235, .2) !important;
}

.secondary-action {
  background: #f1f3f7;
  color: #374151;
}

.analysis-toggle:hover,
.question-actions button:hover {
  transform: translateY(-1px);
}

.primary-action:hover {
  background: #1e40af;
}

.secondary-action:hover {
  background: #e5e7eb;
  color: #1f2937;
}

.question-actions .subtle-action {
  border-color: #e2e8f0 !important;
  background: #fff;
  color: #64748b;
}

.question-actions .subtle-action:hover {
  border-color: #cbd5e1 !important;
  background: #f8fafc;
  color: #334155;
}

.analysis-box {
  display: none;
  margin-top: 1rem;
  padding: 1rem;
  border-radius: .5rem;
  background: #f8fbfe;
  color: #475569;
  line-height: 1.85;
  border-left: 4px solid var(--bupt-blue);
}

.analysis-box.open { display: block; }

.empty-state {
  display: grid;
  place-items: center;
  gap: .4rem;
  min-height: 13rem;
  padding: 2rem;
  border: 1px dashed #93c5fd;
  border-radius: .75rem;
  background: rgba(255, 255, 255, .86);
  text-align: center;
  color: #475569;
}

.empty-state strong {
  color: #0f172a;
  font-size: 1.1rem;
}

.empty-state span {
  max-width: 32rem;
  line-height: 1.65;
  font-weight: 800;
}

.empty-state-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .5rem;
  margin-top: .45rem;
}

.empty-state-actions button {
  min-height: 2.25rem;
  border: 1px solid #dbe3ef;
  border-radius: .48rem;
  padding: .42rem .72rem;
  background: #fff;
  color: #334155;
  font-size: .82rem;
  font-weight: 850;
  cursor: pointer;
}

.empty-state-actions button:hover,
.empty-state-actions button:focus-visible {
  border-color: #94a3b8;
  background: #f8fafc;
  color: #111827;
  outline: none;
}

.empty-state.is-error {
  border-color: #fecaca;
  background: #fff7ed;
  color: #9a3412;
}

.empty-state.is-error strong {
  color: #7f1d1d;
}

.adversarial-brief {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(16rem, .9fr);
  gap: 1rem;
  align-items: center;
  padding: 1rem 1.1rem;
  border: 1px solid #fecaca;
  border-left: 4px solid #dc2626;
  border-radius: .85rem;
  background:
    linear-gradient(90deg, rgba(220, 38, 38, .04) 1px, transparent 1px),
    #fffafa;
  background-size: 28px 28px, auto;
  box-shadow: 0 14px 34px rgba(220, 38, 38, .08);
}

.adversarial-brief span {
  display: block;
  color: #b91c1c;
  font-size: .78rem;
  font-weight: 950;
}

.adversarial-brief strong {
  display: block;
  margin-top: .18rem;
  color: #0f172a;
  font-size: 1.1rem;
}

.adversarial-brief p {
  margin: .35rem 0 0;
  color: #475569;
  line-height: 1.6;
  font-weight: 800;
}

.adversarial-brief ul {
  display: grid;
  gap: .45rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.adversarial-brief li {
  display: grid;
  gap: .12rem;
  padding: .55rem .65rem;
  border: 1px solid #fee2e2;
  border-radius: .62rem;
  background: rgba(255, 255, 255, .78);
}

.adversarial-brief li strong {
  margin: 0;
  font-size: .92rem;
}

.adversarial-brief li span {
  color: #64748b;
  font-size: .75rem;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(37, 99, 235, .22);
  outline-offset: 2px;
}

.app-page {
  background:
    linear-gradient(90deg, rgba(37, 99, 235, .045) 1px, transparent 1px),
    linear-gradient(180deg, rgba(37, 99, 235, .04) 1px, transparent 1px),
    linear-gradient(180deg, #ffffff 0%, #f8fbff 54%, #eef6ff 100%);
  background-size: 36px 36px, 36px 36px, auto;
}

.sidebar {
  background: rgba(255, 255, 255, .98);
  border-right-color: #d5e7fb;
  box-shadow: 12px 0 34px rgba(15, 23, 42, .045);
}

.content-header {
  background: linear-gradient(135deg, #ffffff 0%, #f9fcff 48%, #edf6ff 100%);
  border-color: #cfe3fb;
  box-shadow: 0 18px 42px rgba(37, 99, 235, .11);
}

.content-header::before {
  background:
    radial-gradient(circle at 78% 18%, rgba(6, 182, 212, .16), transparent 28%),
    linear-gradient(90deg, rgba(37, 99, 235, .06) 1px, transparent 1px),
    linear-gradient(180deg, rgba(37, 99, 235, .04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .96), rgba(255, 255, 255, .74) 58%, rgba(239, 246, 255, .48));
  background-size: auto, 42px 42px, 42px 42px, auto;
}

.mode-panel,
.library-entry,
.toolbar,
.question-card {
  border-color: #d5e7fb;
  box-shadow: 0 14px 34px rgba(37, 99, 235, .08);
}

.library-panel {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.reset-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: .9rem 0 0;
  padding: .85rem;
  border: 1px solid #d5e7fb;
  border-radius: .65rem;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 12px 28px rgba(37, 99, 235, .07);
}

.reset-panel strong {
  display: block;
  color: #0f172a;
  font-size: .98rem;
}

.reset-panel span {
  display: block;
  margin-top: .12rem;
  color: #64748b;
  font-size: .8rem;
  font-weight: 800;
}

.reset-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
  justify-content: flex-end;
}

.reset-actions button {
  border: 1px solid #bfdbfe;
  border-radius: .5rem;
  padding: .62rem .78rem;
  background: #fff;
  color: #1d4ed8;
  cursor: pointer;
  font-weight: 900;
}

.reset-actions button:hover {
  transform: translateY(-1px);
  border-color: #60a5fa;
  background: #eff6ff;
}

.reset-actions button[data-reset-action="done"] {
  border-color: #fecaca;
  color: #b91c1c;
}

.reset-actions button[data-reset-action="done"]:hover {
  background: #fff1f2;
  border-color: #fca5a5;
}

.toolbar {
  padding: .75rem;
  border: 1px solid #d5e7fb;
  border-radius: .65rem;
  background: rgba(255, 255, 255, .9);
  grid-template-columns: minmax(220px, 1fr) 150px 130px 120px 120px 120px;
}

.primary-action,
.toolbar button {
  background: linear-gradient(135deg, #2563eb, #0891b2);
}

.library-icon.ai {
  background: #e0f2fe;
  color: #0369a1;
  font-size: .92rem;
  letter-spacing: 0;
}

.ai-coach-container {
  display: none;
}

.ai-coach-container.open {
  display: block;
}

.ai-coach-box {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid #bfdbfe;
  border-radius: .6rem;
  background:
    linear-gradient(90deg, rgba(37, 99, 235, .06) 1px, transparent 1px),
    linear-gradient(180deg, rgba(37, 99, 235, .045) 1px, transparent 1px),
    #f8fbff;
  background-size: 28px 28px, 28px 28px, auto;
}

.ai-coach-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .8rem;
  margin-bottom: .8rem;
}

.ai-coach-head strong {
  color: #0f4fb8;
  font-size: 1rem;
}

.ai-coach-head span {
  color: #64748b;
  font-size: .8rem;
  font-weight: 900;
}

.ai-coach-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: .75rem;
}

.ai-coach-grid section {
  border: 1px solid #e0ecfb;
  border-radius: .5rem;
  padding: .8rem;
  background: rgba(255, 255, 255, .86);
}

.ai-coach-grid h4 {
  margin: 0 0 .45rem;
  color: #0f172a;
  font-size: .9rem;
}

.ai-coach-grid p,
.ai-coach-grid ul {
  margin: 0;
  color: #475569;
  line-height: 1.65;
  font-weight: 750;
}

.ai-coach-grid ul {
  padding-left: 1.1rem;
}

@media (max-width: 980px) {
  .entry-photo-strip { opacity: .28; inset: 0; width: auto; grid-template-columns: 1fr; }
  .entry-photo-strip img { border-radius: 0 !important; }
  .entry-shell { padding: 1rem; justify-content: center; }
  .app-page { display: block; }
  .sidebar { width: auto; height: auto; position: static; }
  .content { padding: 1rem; }
  .content-header { display: block; min-height: 360px; }
  .header-stats { justify-content: flex-start; margin-top: 1rem; }
  .study-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mode-switch { grid-template-columns: 1fr; }
  .exam-card { align-items: stretch; flex-direction: column; }
  .exam-card button { width: 100%; }
  .exam-filter-grid { grid-template-columns: 1fr; }
  .library-panel { grid-template-columns: 1fr; }
  .adversarial-brief { grid-template-columns: 1fr; }
  .reset-panel { align-items: stretch; flex-direction: column; }
  .reset-actions { justify-content: stretch; }
  .reset-actions button { flex: 1 1 150px; }
  .ai-coach-grid { grid-template-columns: 1fr; }
  .ai-coach-head { display: grid; }
  .toolbar { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .entry-card { padding: 1.35rem; }
  .brand-line { align-items: flex-start; }
  .loading-overlay { padding: .85rem; }
  .tech-loading-card {
    width: min(96vw, 520px);
    max-height: calc(100dvh - 1rem);
    padding: .72rem;
    overflow: hidden;
  }
  .tech-loader {
    grid-template-columns: 3.5rem 1fr;
    gap: .6rem;
    margin-bottom: .55rem;
    padding: .55rem;
  }
  .tech-loader-ring {
    width: 3.25rem;
    height: 3.25rem;
  }
  .tech-loader-ring::before { inset: .62rem; }
  .tech-loader-ring::after { inset: 1.42rem; }
  .tech-loader-ring span:nth-child(1) { inset: .22rem; }
  .tech-loader-ring span:nth-child(2) { inset: .45rem; }
  .tech-loader-ring span:nth-child(3) { inset: .92rem; }
  .tech-loader-copy strong { font-size: .85rem; }
  .tech-loader-copy small { font-size: .72rem; }
  .tech-loader-copy i { height: .38rem; }
  .tip-close-button {
    width: 100%;
    margin-top: .05rem;
    padding: .48rem .7rem;
  }
  .question-card {
    padding: 1.1rem;
    border-radius: .7rem;
  }
  .question-card-head {
    display: block;
  }
  .card-icon-actions {
    justify-content: flex-end;
    margin-top: .65rem;
  }
  .question-meta {
    gap: .45rem;
  }
  .question-title {
    padding-right: 0;
    font-size: 1.02rem;
  }
  .answer-input {
    min-height: 7.5rem;
  }
  .question-actions {
    gap: .55rem;
  }
  .primary-action,
  .secondary-action {
    flex: 1 1 120px;
  }
  .content-header { padding: 1rem; }
  .school-name-img { width: min(260px, 72vw); }
  .header-stats div { flex: 1; min-width: 78px; }
  .study-overview { grid-template-columns: 1fr; }
  .library-entry {
    grid-template-columns: 2.35rem 1fr auto;
    min-height: 4.8rem;
    padding: .75rem;
  }
  .library-icon {
    width: 2.35rem;
    height: 2.35rem;
  }
  .floating-timer {
    left: .85rem;
    right: .85rem;
    bottom: .85rem;
    justify-content: space-between;
    gap: .55rem;
    padding: .65rem;
  }
  .floating-timer img {
    width: 2.35rem;
    height: 2.35rem;
  }
  .floating-timer-copy {
    min-width: 0;
    flex: 1;
  }
  .floating-timer strong {
    font-size: 1.08rem;
  }
  .floating-timer-actions {
    gap: .4rem;
  }
  .floating-timer button {
    padding: .5rem .62rem;
  }
  .answer-checker { grid-template-columns: 1fr 1fr; }
  .answer-input { grid-column: 1 / -1; }
  .answer-checker .submit-answer { grid-column: 1 / -1; }
  .answer-feedback { align-items: flex-start; flex-wrap: wrap; }
}

/* UI polish layer */
.content {
  width: 100%;
  max-width: 1280px;
}

.sidebar {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .98), rgba(248, 251, 255, .98)),
    linear-gradient(90deg, rgba(37, 99, 235, .06), transparent 38%);
}

.sidebar-brand {
  padding: .7rem;
  border: 1px solid #dbeafe;
  border-radius: .75rem;
  background: rgba(255, 255, 255, .82);
  box-shadow: 0 12px 28px rgba(37, 99, 235, .07);
}

.campus-card,
.sync-panel {
  border-color: #d6e8fb;
  box-shadow: 0 12px 26px rgba(37, 99, 235, .06);
}

.chapter-nav button {
  position: relative;
  border: 1px solid transparent;
}

.chapter-nav button::before {
  content: "";
  position: absolute;
  left: .35rem;
  top: 50%;
  width: .22rem;
  height: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #2563eb, #06b6d4);
  transform: translateY(-50%);
  transition: height .18s ease;
}

.chapter-nav button.active,
.chapter-nav button:hover {
  border-color: #dbeafe;
  background: linear-gradient(90deg, #eff6ff, #ffffff);
  padding-left: 1rem;
}

.chapter-nav button.active::before,
.chapter-nav button:hover::before {
  height: 1.25rem;
}

.toolbar {
  position: sticky;
  top: .75rem;
  z-index: 80;
  backdrop-filter: blur(14px);
  box-shadow: 0 18px 42px rgba(37, 99, 235, .12);
}

.toolbar input,
.toolbar select {
  border-color: #cfe3fb;
  background: #fff;
  color: #0f172a;
  font-weight: 800;
}

.toolbar input::placeholder {
  color: #94a3b8;
}

.toolbar button,
.primary-button,
.primary-action {
  box-shadow: 0 14px 24px rgba(37, 99, 235, .22) !important;
}

.mode-panel,
.reset-panel,
.library-entry,
.overview-card,
.question-card {
  backdrop-filter: blur(10px);
}

.mode-button,
.library-entry,
.reset-actions button,
.secondary-action,
.pagination button {
  transition: transform .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.mode-button.active,
.library-entry.active {
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, .18), 0 16px 32px rgba(37, 99, 235, .12);
}

.library-entry.active::after,
.mode-button.active::after {
  content: "";
  position: absolute;
  inset: auto .8rem 0 .8rem;
  height: 3px;
  border-radius: 999px 999px 0 0;
  background: linear-gradient(90deg, #2563eb, #06b6d4);
}

.mode-button,
.library-entry {
  position: relative;
  overflow: hidden;
}

.overview-card {
  border-top: 3px solid #60a5fa;
}

.overview-card:nth-child(2) { border-top-color: #22c55e; }
.overview-card:nth-child(3) { border-top-color: #06b6d4; }
.overview-card:nth-child(4) { border-top-color: #f59e0b; }

.question-card {
  border-radius: .95rem;
  border-color: #dbeafe;
}

.question-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, #2563eb, #06b6d4);
  opacity: .9;
}

.question-card.is-correct::before {
  background: linear-gradient(180deg, #22c55e, #86efac);
}

.question-card.is-wrong::before {
  background: linear-gradient(180deg, #ef4444, #fca5a5);
}

.badge {
  border: 1px solid #e2e8f0;
  background: #fff;
}

.badge.source {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

.badge.topic {
  background: #f8fafc;
  padding-left: .7rem;
  padding-right: .7rem;
}

.badge.difficulty {
  border-color: #fde68a;
}

.icon-btn {
  border-radius: .5rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.icon-btn:hover,
.icon-btn.active {
  border-color: #93c5fd;
  background: #eff6ff;
  color: #1d4ed8;
}

.answer-input {
  border-color: #cfe3fb;
  background: #ffffff;
  box-shadow: inset 0 1px 0 rgba(15, 23, 42, .03);
}

.analysis-box,
.ai-coach-box {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .75);
}

@media (max-width: 980px) {
  .toolbar {
    position: static;
  }
}

@media (max-width: 560px) {
  .sidebar-brand {
    padding: .6rem;
  }

  .toolbar {
    padding: .65rem;
  }

  .question-card::before {
    width: 3px;
  }
}

/* Showcase polish layer */
.entry-page {
  background:
    linear-gradient(90deg, rgba(37, 99, 235, .08) 1px, transparent 1px),
    linear-gradient(180deg, rgba(37, 99, 235, .06) 1px, transparent 1px),
    linear-gradient(135deg, #f8fbff 0%, #ffffff 45%, #eaf5ff 100%);
  background-size: 42px 42px, 42px 42px, auto;
}

.entry-page::before {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, .94) 0%, rgba(255, 255, 255, .72) 54%, rgba(219, 234, 254, .56) 100%),
    url("../images/沙河 南门.png") center / cover no-repeat;
  opacity: .58;
}

.entry-photo-strip img {
  border-color: rgba(147, 197, 253, .75);
  box-shadow: 0 22px 54px rgba(37, 99, 235, .16);
}

.entry-card {
  position: relative;
  border-color: rgba(191, 219, 254, .95);
  background:
    linear-gradient(90deg, rgba(37, 99, 235, .045) 1px, transparent 1px),
    linear-gradient(180deg, rgba(37, 99, 235, .035) 1px, transparent 1px),
    rgba(255, 255, 255, .94);
  background-size: 30px 30px, 30px 30px, auto;
  box-shadow: 0 26px 70px rgba(37, 99, 235, .18);
}

.entry-card::before,
.entry-card::after,
.content-header::after {
  content: "";
  position: absolute;
  width: 3.4rem;
  height: 3.4rem;
  pointer-events: none;
}

.entry-card::before {
  top: .75rem;
  left: .75rem;
  border-top: 2px solid #60a5fa;
  border-left: 2px solid #60a5fa;
}

.entry-card::after {
  right: .75rem;
  bottom: .75rem;
  border-right: 2px solid #06b6d4;
  border-bottom: 2px solid #06b6d4;
}

.content-header::after {
  right: 1rem;
  top: 1rem;
  z-index: 2;
  border-top: 2px solid rgba(37, 99, 235, .5);
  border-right: 2px solid rgba(6, 182, 212, .6);
}

.hero-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
  margin-top: 1rem;
}

.hero-chips span {
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  padding: .38rem .72rem;
  background: rgba(255, 255, 255, .78);
  color: #1d4ed8;
  font-size: .78rem;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(37, 99, 235, .08);
}

.content-header {
  isolation: isolate;
}

.content-header h2 {
  text-wrap: balance;
}

.header-stats div,
.overview-card,
.mode-panel,
.reset-panel,
.library-entry,
.question-card {
  box-shadow: 0 18px 42px rgba(37, 99, 235, .09), inset 0 1px 0 rgba(255, 255, 255, .8);
}

.header-stats div:hover,
.overview-card:hover,
.library-entry:hover,
.mode-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 22px 46px rgba(37, 99, 235, .14), inset 0 1px 0 rgba(255, 255, 255, .9);
}

.header-stats div,
.overview-card {
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.mode-panel,
.reset-panel {
  position: relative;
  overflow: hidden;
}

.mode-panel::before,
.reset-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-top: 1px solid rgba(96, 165, 250, .42);
  pointer-events: none;
}

.library-entry {
  min-height: 5.7rem;
}

.library-copy strong {
  letter-spacing: 0;
}

.toolbar {
  transform: translateZ(0);
}

.toolbar::before {
  content: "";
  position: absolute;
  left: .75rem;
  right: .75rem;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(37, 99, 235, .38), transparent);
}

.question-list {
  padding-bottom: 1.5rem;
}

.question-card {
  background:
    linear-gradient(90deg, rgba(37, 99, 235, .025) 1px, transparent 1px),
    #ffffff;
  background-size: 34px 34px, auto;
}

.question-card-head {
  padding-bottom: .8rem;
  border-bottom: 1px solid #eef4fb;
}

.question-title {
  color: #172033;
}

.answer-label {
  color: #1d4ed8;
}

.question-actions {
  padding-top: .3rem;
}

.secondary-action {
  border-color: #dbeafe !important;
  background: #ffffff;
  color: #1d4ed8;
}

.secondary-action:hover {
  border-color: #93c5fd !important;
  background: #eff6ff;
}

.scroll-top-button {
  position: fixed;
  right: 1.35rem;
  bottom: 6.2rem;
  z-index: 950;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid #bfdbfe;
  border-radius: .7rem;
  background: rgba(255, 255, 255, .92);
  color: #1d4ed8;
  cursor: pointer;
  font-size: 1.25rem;
  font-weight: 900;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  box-shadow: 0 18px 38px rgba(37, 99, 235, .16);
  backdrop-filter: blur(10px);
  transition: opacity .18s ease, transform .18s ease, background .18s ease;
}

.scroll-top-button.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.scroll-top-button:hover {
  background: #eff6ff;
}

.author-card,
.entry-contact {
  font-style: normal;
}

.author-card {
  display: grid;
  gap: .38rem;
  margin-top: .9rem;
  padding: .95rem;
  border: 1px solid #cfe3fb;
  border-radius: .75rem;
  background:
    linear-gradient(90deg, rgba(37, 99, 235, .05) 1px, transparent 1px),
    linear-gradient(180deg, rgba(37, 99, 235, .04) 1px, transparent 1px),
    rgba(255, 255, 255, .92);
  background-size: 24px 24px, 24px 24px, auto;
  box-shadow: 0 14px 30px rgba(37, 99, 235, .08);
}

.author-card span,
.entry-contact span {
  color: #1d4ed8;
  font-size: .75rem;
  font-weight: 900;
  letter-spacing: .08em;
}

.author-card strong {
  color: #0f172a;
  font-size: .92rem;
}

.author-card a,
.entry-contact a {
  color: #475569;
  text-decoration: none;
  font-size: .82rem;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.author-card a:hover,
.entry-contact a:hover {
  color: #1d4ed8;
}

.entry-contact {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .38rem .75rem;
  align-items: center;
  margin-top: 1rem;
  padding: .75rem .85rem;
  border: 1px solid #dbeafe;
  border-radius: .65rem;
  background: rgba(255, 255, 255, .72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8);
}

.entry-contact span {
  grid-row: span 2;
  align-self: start;
}

.content-header,
.study-overview,
.mode-panel,
.library-panel,
.reset-panel,
.toolbar,
.question-list {
  animation: section-rise .28s ease both;
}

.study-overview { animation-delay: .03s; }
.mode-panel { animation-delay: .06s; }
.library-panel { animation-delay: .09s; }
.reset-panel { animation-delay: .12s; }
.toolbar { animation-delay: .15s; }
.question-list { animation-delay: .18s; }

@keyframes section-rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .content-header::after,
  .entry-card::before,
  .entry-card::after {
    animation: corner-pulse 3.2s ease-in-out infinite;
  }

  @keyframes corner-pulse {
    0%, 100% { opacity: .52; }
    50% { opacity: 1; }
  }
}

@media (max-width: 980px) {
  .scroll-top-button {
    bottom: 5.5rem;
  }

  .entry-contact {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .hero-chips {
    gap: .42rem;
  }

  .hero-chips span {
    font-size: .72rem;
  }

  .scroll-top-button {
    right: 1rem;
    bottom: 5.8rem;
    width: 2.45rem;
    height: 2.45rem;
  }

  .author-card {
    margin-top: .75rem;
  }
}

/* Premium blue-tech refinement */
:root {
  --surface: rgba(255, 255, 255, .94);
  --surface-strong: #ffffff;
  --line-strong: #c8ddf7;
  --shadow-soft: 0 18px 44px rgba(30, 64, 175, .1);
  --shadow-lift: 0 24px 58px rgba(30, 64, 175, .16);
  --ring-blue: 0 0 0 4px rgba(37, 99, 235, .12);
}

body {
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

button,
.library-entry,
.overview-card,
.question-card,
.mode-button {
  -webkit-tap-highlight-color: transparent;
}

.entry-page {
  background:
    linear-gradient(90deg, rgba(37, 99, 235, .07) 1px, transparent 1px),
    linear-gradient(180deg, rgba(14, 165, 233, .055) 1px, transparent 1px),
    linear-gradient(135deg, #f9fcff 0%, #ffffff 48%, #eaf6ff 100%);
  background-size: 34px 34px, 34px 34px, auto;
}

.entry-shell {
  padding-left: clamp(1rem, 5vw, 5rem);
}

.entry-card {
  border-radius: .85rem;
  border-color: #bfdbfe;
  box-shadow: var(--shadow-lift);
}

.entry-card h1 {
  line-height: 1.12;
  text-wrap: balance;
}

.entry-subtitle {
  max-width: 31rem;
}

.entry-input-group input {
  height: 3.1rem;
  border-color: #cfe3fb;
  box-shadow: inset 0 1px 0 rgba(15, 23, 42, .025);
}

.entry-auth-tabs,
.ghost-entry-button,
.entry-contact {
  border-color: #cfe3fb;
}

.entry-auth-tabs button,
.campus-switch button,
.chapter-nav button,
.library-entry,
.mode-button,
.toolbar button,
.reset-actions button,
.question-actions button,
.floating-timer button,
.scroll-top-button {
  transition: transform .18s ease, border-color .18s ease, background .18s ease, color .18s ease, box-shadow .18s ease;
}

.primary-button:hover,
.toolbar button:hover,
.primary-action:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 30px rgba(37, 99, 235, .26) !important;
}

.app-page {
  background:
    linear-gradient(90deg, rgba(37, 99, 235, .05) 1px, transparent 1px),
    linear-gradient(180deg, rgba(6, 182, 212, .04) 1px, transparent 1px),
    linear-gradient(180deg, #ffffff 0%, #f8fbff 46%, #edf7ff 100%);
  background-size: 32px 32px, 32px 32px, auto;
}

.sidebar {
  width: 292px;
  padding: 1rem;
  border-right-color: #cfe3fb;
  scrollbar-width: thin;
  scrollbar-color: #bfdbfe transparent;
}

.sidebar::-webkit-scrollbar {
  width: 8px;
}

.sidebar::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #bfdbfe;
}

.sidebar-brand {
  border-radius: .85rem;
  background: linear-gradient(135deg, #ffffff, #f4f9ff);
}

.campus-card {
  border-radius: .85rem;
}

.campus-card img {
  aspect-ratio: 16 / 8.6;
}

.campus-switch button.active,
.chapter-nav button.active {
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, .14);
}

.chapter-nav {
  gap: .32rem;
}

.chapter-nav button {
  min-height: 2.75rem;
  border-radius: .62rem;
}

.sync-panel,
.author-card {
  border-radius: .85rem;
}

.content {
  padding: 1.25rem;
}

.content-header {
  min-height: 245px;
  border-radius: 1rem;
  border-color: var(--line-strong);
  background:
    linear-gradient(90deg, rgba(37, 99, 235, .045) 1px, transparent 1px),
    linear-gradient(180deg, rgba(6, 182, 212, .035) 1px, transparent 1px),
    linear-gradient(135deg, rgba(255, 255, 255, .98), rgba(247, 251, 255, .94) 55%, rgba(232, 244, 255, .92));
  background-size: 36px 36px, 36px 36px, auto;
  box-shadow: var(--shadow-soft);
}

.content-header::before {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, .94), rgba(255, 255, 255, .76) 58%, rgba(239, 246, 255, .56)),
    linear-gradient(120deg, transparent 0 56%, rgba(37, 99, 235, .09) 56% 56.5%, transparent 56.5% 100%);
}

.hero-campus-image {
  right: 4%;
  width: min(34vw, 380px);
  opacity: .2;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .25rem .55rem;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  background: rgba(255, 255, 255, .72);
  letter-spacing: .08em;
}

.content-header h2 {
  margin-top: .55rem;
}

.header-desc {
  max-width: 560px;
}

.header-stats div {
  border-radius: .8rem;
  min-width: 92px;
}

.study-overview {
  gap: .72rem;
}

.overview-card {
  min-height: 5.75rem;
  border-radius: .85rem;
  background: var(--surface);
  border-color: #d5e7fb;
}

.overview-card::after {
  display: none;
}

.overview-card strong {
  font-size: 1.35rem;
}

.overview-card i {
  height: .42rem;
}

.mode-panel,
.reset-panel,
.toolbar {
  border-radius: .9rem;
  background: var(--surface);
  border-color: #d5e7fb;
}

.mode-button {
  border-radius: .78rem;
  background: #ffffff;
}

.mode-button.active {
  background:
    linear-gradient(90deg, rgba(37, 99, 235, .07) 1px, transparent 1px),
    linear-gradient(180deg, rgba(6, 182, 212, .045) 1px, transparent 1px),
    #f8fbff;
  background-size: 24px 24px, 24px 24px, auto;
}

.library-panel {
  gap: .72rem;
}

.library-entry {
  min-height: 5.35rem;
  border-radius: .86rem;
  background: var(--surface-strong);
}

.library-icon {
  border-radius: .72rem;
}

.library-entry em {
  height: 1.85rem;
  min-width: 2rem;
}

.reset-panel {
  padding: .78rem .85rem;
}

.toolbar {
  top: .65rem;
  padding: .7rem;
  grid-template-columns: minmax(220px, 1fr) 148px 128px 128px 118px 118px 118px;
}

.toolbar input,
.toolbar select {
  height: 2.85rem;
  border-radius: .68rem;
}

.toolbar button {
  min-height: 2.85rem;
  border-radius: .68rem;
}

.question-list {
  gap: .9rem;
}

.question-card {
  border-radius: 1rem;
  padding: 1.35rem 1.55rem 1.25rem;
  border-color: #d5e7fb;
  box-shadow: var(--shadow-soft);
}

.question-card:hover {
  box-shadow: var(--shadow-lift);
}

.question-card-head {
  gap: .8rem;
  margin-bottom: 1rem;
  padding-bottom: .75rem;
}

.question-meta {
  gap: .48rem;
}

.badge {
  padding: .34rem .62rem;
  font-size: .8rem;
  white-space: nowrap;
}

.question-title {
  margin-bottom: 1rem;
  padding-right: 2.8rem;
  font-size: 1.08rem;
  line-height: 1.78;
}

.icon-btn {
  width: 2.05rem;
  height: 2.05rem;
}

.answer-input {
  min-height: 7.8rem;
  border-radius: .8rem;
}

.answer-input:focus,
.entry-input-group input:focus,
.toolbar input:focus,
.toolbar select:focus {
  box-shadow: var(--ring-blue);
}

.answer-feedback,
.analysis-box,
.ai-coach-box {
  border-radius: .8rem;
}

.analysis-box {
  background:
    linear-gradient(90deg, rgba(37, 99, 235, .04) 1px, transparent 1px),
    #f8fbff;
  background-size: 26px 26px, auto;
}

.ai-coach-grid section {
  border-radius: .74rem;
}

.floating-timer {
  border-radius: .95rem;
  border-color: #bfdbfe;
}

.scroll-top-button {
  border-radius: .82rem;
}

@media (max-width: 1180px) {
  .library-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .toolbar {
    grid-template-columns: minmax(220px, 1fr) repeat(3, 132px);
  }

  .toolbar button {
    grid-column: span 1;
  }
}

@media (max-width: 980px) {
  .sidebar {
    width: auto;
    border-right: 0;
    border-bottom: 1px solid #d5e7fb;
  }

  .content {
    padding: .9rem;
  }

  .content-header {
    min-height: 320px;
  }

  .hero-campus-image {
    width: min(70vw, 380px);
    opacity: .16;
  }

  .toolbar {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .entry-shell,
  .content {
    padding: .75rem;
  }

  .entry-card {
    border-radius: .78rem;
  }

  .content-header {
    min-height: 300px;
    border-radius: .86rem;
  }

  .content-header h2 {
    font-size: clamp(1.45rem, 8vw, 2rem);
  }

  .header-desc {
    line-height: 1.62;
  }

  .library-panel {
    grid-template-columns: 1fr;
  }

  .question-card {
    padding: 1rem;
  }

  .question-title {
    padding-right: 0;
    line-height: 1.7;
  }

  .answer-checker {
    grid-template-columns: 1fr;
  }
}

/* Calm question-bank surface and AI chat drawer */
:root {
  --calm-bg: #f6f8fb;
  --calm-surface: #ffffff;
  --calm-line: #e5e7eb;
  --calm-text: #111827;
  --calm-muted: #6b7280;
  --calm-accent: #1d4ed8;
  --calm-danger: #b91c1c;
  --calm-shadow: 0 1px 2px rgba(15, 23, 42, .06);
  --drawer-shadow: -18px 0 42px rgba(15, 23, 42, .18);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-page {
  background: var(--calm-bg);
}

.content {
  max-width: 1180px;
  padding: 1rem 1.25rem 5.5rem;
}

.sidebar {
  width: 276px;
  padding: .85rem;
  background: var(--calm-surface);
  border-right-color: var(--calm-line);
  box-shadow: none;
}

.sidebar-brand,
.campus-card,
.sync-panel,
.author-card,
.mode-panel,
.reset-panel,
.toolbar,
.overview-card,
.library-entry,
.question-card {
  background: var(--calm-surface);
  border-color: var(--calm-line);
  border-radius: .55rem;
  box-shadow: var(--calm-shadow);
  backdrop-filter: none;
}

.sidebar-brand {
  padding: .6rem;
  margin-bottom: .75rem;
}

.sidebar-brand h1 {
  font-size: 1rem;
}

.campus-card {
  margin-bottom: .75rem;
}

.campus-card img {
  aspect-ratio: 16 / 7;
}

.campus-card > div:not(.campus-switch) {
  padding: .65rem .75rem .45rem;
}

.campus-switch {
  gap: .35rem;
  padding: 0 .75rem .75rem;
}

.campus-switch button,
.chapter-nav button,
.reset-actions button,
.pagination button,
.floating-timer button {
  box-shadow: none;
}

.chapter-nav {
  gap: .18rem;
}

.chapter-nav button {
  min-height: 2.35rem;
  padding: .52rem .65rem;
  border-radius: .42rem;
  font-size: .92rem;
}

.chapter-nav button::before,
.library-entry.active::after,
.mode-button.active::after,
.content-header::before,
.content-header::after,
.question-card::before,
.toolbar::before {
  display: none;
}

.chapter-nav button.active,
.chapter-nav button:hover {
  padding-left: .65rem;
  background: #f1f5f9;
  border-color: var(--calm-line);
  color: var(--calm-accent);
}

.sync-panel,
.author-card {
  padding: .78rem;
}

.content-header {
  min-height: 172px;
  padding: 1.15rem;
  border-radius: .65rem;
  background: var(--calm-surface);
  border-color: var(--calm-line);
  box-shadow: var(--calm-shadow);
}

.hero-campus-image {
  right: 2%;
  width: min(25vw, 280px);
  opacity: .07;
  filter: none;
}

.eyebrow {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--calm-muted);
  letter-spacing: .06em;
}

.content-header h2 {
  margin-top: .35rem;
  font-size: clamp(1.45rem, 2.4vw, 2rem);
}

.header-desc {
  margin-top: .45rem;
  line-height: 1.55;
}

.hero-chips {
  gap: .4rem;
  margin-top: .75rem;
}

.hero-chips span {
  border-color: var(--calm-line);
  background: #f8fafc;
  color: #334155;
  box-shadow: none;
}

.header-stats div {
  min-width: 76px;
  padding: .62rem .7rem;
  border-color: var(--calm-line);
  border-radius: .5rem;
  box-shadow: none;
}

.header-stats strong {
  font-size: 1.22rem;
}

.study-overview {
  grid-template-columns: 1.2fr repeat(3, minmax(0, 1fr));
  gap: .55rem;
  margin-top: .75rem;
}

.overview-card {
  min-height: 4.75rem;
  padding: .78rem;
  border-top: 0;
}

.overview-card:hover,
.header-stats div:hover,
.library-entry:hover,
.mode-button:hover {
  transform: none;
  box-shadow: var(--calm-shadow);
}

.overview-card span,
.overview-card small {
  font-weight: 760;
}

.overview-card strong {
  margin: .24rem 0 .08rem;
  font-size: 1.18rem;
}

.mode-panel,
.reset-panel {
  margin-top: .75rem;
  padding: .7rem;
}

.mode-panel::before,
.reset-panel::before {
  display: none;
}

.mode-switch {
  gap: .55rem;
}

.mode-button {
  min-height: 3.6rem;
  padding: .68rem .75rem;
  border-radius: .5rem;
  box-shadow: none;
}

.mode-button.active,
.library-entry.active {
  background: #f8fafc;
  border-color: #bfdbfe;
  box-shadow: inset 0 0 0 1px rgba(29, 78, 216, .08);
}

.mode-status {
  margin-top: .5rem;
  font-size: .9rem;
}

.library-panel {
  grid-template-columns: repeat(auto-fit, minmax(178px, 1fr));
  gap: .55rem;
  margin-top: .75rem;
}

.library-entry {
  min-height: 4.2rem;
  grid-template-columns: 2.15rem 1fr auto;
  gap: .6rem;
  padding: .62rem;
}

.library-icon {
  width: 2.05rem;
  height: 2.05rem;
  border-radius: .45rem;
  font-size: 1rem;
}

.library-copy strong {
  font-size: .92rem;
}

.library-copy small {
  font-size: .74rem;
}

.library-entry em {
  min-width: 1.8rem;
  height: 1.65rem;
  font-size: .78rem;
}

.reset-panel {
  align-items: center;
}

.reset-actions {
  gap: .4rem;
}

.reset-actions button {
  padding: .48rem .62rem;
  border-radius: .42rem;
}

.toolbar {
  top: .65rem;
  z-index: 70;
  grid-template-columns: minmax(240px, 1fr) 132px 108px 120px auto auto auto;
  gap: .48rem;
  margin: .75rem 0;
  padding: .52rem;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 8px 24px rgba(15, 23, 42, .06);
}

.toolbar input,
.toolbar select {
  height: 2.55rem;
  border-color: var(--calm-line);
  border-radius: .45rem;
  font-weight: 650;
}

.toolbar button,
.primary-action {
  min-height: 2.55rem;
  border-radius: .45rem;
  background: var(--calm-accent);
  box-shadow: none !important;
}

.toolbar button:hover,
.primary-action:hover {
  background: #1e40af;
  box-shadow: none !important;
}

.active-scope-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .9rem;
  margin: -.1rem 0 .85rem;
  padding: .82rem .9rem;
  border: 1px solid #d5e7fb;
  border-radius: .8rem;
  background: linear-gradient(135deg, rgba(255, 255, 255, .97), rgba(239, 246, 255, .94));
  box-shadow: 0 10px 28px rgba(37, 99, 235, .08);
}

.active-scope-main,
.active-scope-actions {
  min-width: 0;
}

.active-scope-main {
  display: grid;
  gap: .28rem;
  flex: 1 1 18rem;
}

.active-scope-kicker {
  color: #1d4ed8;
  font-size: .74rem;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.active-scope-main strong {
  color: #0f172a;
  font-size: 1rem;
  line-height: 1.35;
}

.active-scope-main p {
  margin: 0;
  color: #475569;
  font-size: .88rem;
  line-height: 1.55;
  font-weight: 700;
}

.active-scope-actions {
  display: grid;
  gap: .55rem;
  justify-items: end;
  flex: 1 1 24rem;
}

.ai-start-scope-button {
  min-height: 2.18rem;
  border: 1px solid #bfdbfe;
  border-radius: .38rem;
  padding: .42rem .72rem;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: .8rem;
  font-weight: 900;
  line-height: 1.2;
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, color .18s ease;
}

.ai-start-scope-button:hover,
.ai-start-scope-button:focus-visible {
  border-color: #2563eb;
  background: #dbeafe;
  color: #1e3a8a;
  outline: none;
}

.active-scope-pills {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  justify-content: flex-end;
}

.active-scope-pill,
.active-scope-reset {
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: rgba(255, 255, 255, .92);
  transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}

.active-scope-pill {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  max-width: 100%;
  padding: .45rem .7rem;
  color: #0f172a;
  font: inherit;
}

.active-scope-pill span {
  color: #64748b;
  font-size: .75rem;
  font-weight: 900;
  white-space: nowrap;
}

.active-scope-pill strong {
  min-width: 0;
  font-size: .8rem;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.active-scope-pill i {
  color: #1d4ed8;
  font-style: normal;
  font-weight: 900;
}

.active-scope-pill:hover,
.active-scope-reset:hover {
  border-color: #93c5fd;
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(37, 99, 235, .1);
}

.active-scope-empty {
  color: #64748b;
  font-size: .82rem;
  font-weight: 800;
  line-height: 1.5;
}

.active-scope-reset {
  padding: .5rem .9rem;
  color: #1e3a8a;
  font-size: .82rem;
  font-weight: 900;
}

.question-list {
  gap: .7rem;
  padding-bottom: 1rem;
}

.question-card {
  padding: 1rem 1.1rem;
  border-color: var(--calm-line);
  background: var(--calm-surface);
}

.question-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 8px 22px rgba(15, 23, 42, .08);
}

.question-card-head {
  margin-bottom: .75rem;
  padding-bottom: .55rem;
  border-bottom-color: var(--calm-line);
}

.question-meta {
  gap: .38rem;
}

.badge {
  padding: .28rem .52rem;
  border-color: var(--calm-line);
  background: #f8fafc;
  font-size: .76rem;
  font-weight: 720;
}

.question-title {
  margin-bottom: .8rem;
  padding-right: 2.2rem;
  font-size: 1rem;
  line-height: 1.7;
}

.answer-label {
  margin-bottom: .38rem;
}

.answer-input {
  min-height: 6.9rem;
  border-radius: .52rem;
}

.question-actions {
  gap: .5rem;
  margin-top: .8rem;
}

.question-actions button,
.analysis-toggle {
  padding: .56rem .9rem;
  border-radius: .45rem;
}

.analysis-box,
.ai-coach-box,
.ai-coach-grid section {
  border-radius: .52rem;
  background: #f8fafc;
}

.floating-timer {
  right: 1rem;
  bottom: 1rem;
  border-radius: .65rem;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .12);
}

.scroll-top-button {
  right: 1rem;
  bottom: 5.65rem;
  border-radius: .58rem;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .12);
}

.ai-chat-fab {
  position: fixed;
  right: 1rem;
  bottom: 8.85rem;
  z-index: 960;
  display: grid;
  place-items: center;
  width: 3.45rem;
  height: 3.45rem;
  border: 1px solid #cbd5e1;
  border-radius: 50%;
  background: #111827;
  color: #fff;
  text-decoration: none;
  box-shadow: 0 14px 32px rgba(15, 23, 42, .2);
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

.ai-chat-fab span {
  display: block;
  font-size: .95rem;
  font-weight: 950;
  line-height: 1;
}

.ai-chat-fab strong {
  display: block;
  margin-top: -.18rem;
  font-size: .68rem;
  font-weight: 850;
  line-height: 1;
}

.ai-chat-fab:hover {
  transform: translateY(-2px);
  background: #0f172a;
  box-shadow: 0 18px 38px rgba(15, 23, 42, .26);
}

.ai-chat-drawer {
  position: fixed;
  inset: 0;
  z-index: 1100;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .2s ease, visibility .2s ease;
}

.ai-chat-drawer:target,
.ai-chat-drawer.open,
.ai-chat-drawer.is-open,
.ai-chat-drawer[data-state="open"],
body.ai-chat-open .ai-chat-drawer {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.ai-chat-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .28);
  backdrop-filter: blur(2px);
}

.ai-chat-panel {
  position: absolute;
  inset: 0 0 0 auto;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  width: min(460px, 100vw);
  height: 100%;
  min-height: 0;
  background: #ffffff;
  color: var(--calm-text);
  box-shadow: var(--drawer-shadow);
  transform: translateX(100%);
  transition: transform .24s ease;
}

.ai-chat-drawer:target .ai-chat-panel,
.ai-chat-drawer.open .ai-chat-panel,
.ai-chat-drawer.is-open .ai-chat-panel,
.ai-chat-drawer[data-state="open"] .ai-chat-panel,
body.ai-chat-open .ai-chat-panel {
  transform: translateX(0);
}

.ai-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1rem .85rem;
  border-bottom: 1px solid var(--calm-line);
}

.ai-chat-kicker {
  display: block;
  margin-bottom: .16rem;
  color: var(--calm-muted);
  font-size: .72rem;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.ai-chat-header h2 {
  margin: 0;
  color: var(--calm-text);
  font-size: 1.15rem;
  line-height: 1.25;
}

.ai-chat-close {
  display: grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  border: 1px solid var(--calm-line);
  border-radius: .5rem;
  background: #fff;
  color: #475569;
  text-decoration: none;
  font-size: 1.2rem;
  font-weight: 800;
}

.ai-chat-close:hover {
  background: #f8fafc;
  color: var(--calm-text);
}

.ai-chat-settings {
  display: grid;
  gap: .7rem;
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--calm-line);
  background: #fbfdff;
}

.ai-chat-new-button,
.ai-chat-ghost-button,
.ai-chat-send-button,
.ai-chat-context-head button {
  border: 1px solid var(--calm-line);
  border-radius: .48rem;
  padding: .58rem .72rem;
  cursor: pointer;
  font-weight: 850;
}

.ai-chat-new-button {
  width: 100%;
  background: #111827;
  color: #fff;
  border-color: #111827;
}

.ai-chat-new-button:hover,
.ai-chat-send-button:hover {
  background: #0f172a;
}

.ai-chat-config-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .65rem;
}

.ai-chat-field {
  display: grid;
  gap: .3rem;
  min-width: 0;
}

.ai-chat-field span {
  color: #475569;
  font-size: .76rem;
  font-weight: 850;
}

.ai-chat-field select,
.ai-chat-field input {
  width: 100%;
  min-width: 0;
  height: 2.35rem;
  border: 1px solid var(--calm-line);
  border-radius: .45rem;
  padding: 0 .65rem;
  background: #fff;
  color: var(--calm-text);
  outline: none;
}

.ai-chat-field select:focus,
.ai-chat-field input:focus,
.ai-chat-composer textarea:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.ai-chat-key-field {
  grid-column: 1 / -1;
}

.ai-chat-key-field[hidden],
.ai-chat-keep-key[hidden] {
  display: none !important;
}

.ai-chat-key-field.server-key-ready input {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.ai-chat-key-field.server-key-ready::after {
  content: "站点默认可用";
  justify-self: start;
  border: 1px solid #bbf7d0;
  border-radius: 999px;
  padding: .16rem .5rem;
  background: #dcfce7;
  color: #166534;
  font-size: .72rem;
  font-weight: 820;
}

.ai-chat-base-url-field {
  grid-column: 1 / -1;
}

.ai-chat-field input:disabled {
  background: #f8fafc;
  color: #64748b;
  cursor: not-allowed;
}

.ai-chat-base-url-field.is-readonly input[readonly] {
  background: #f8fafc;
  color: #475569;
  cursor: default;
}

.ai-chat-context {
  display: grid;
  gap: .55rem;
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--calm-line);
}

.ai-chat-context[hidden] {
  display: none !important;
}

.ai-chat-context-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}

.ai-chat-context-actions {
  display: flex;
  align-items: center;
  gap: .38rem;
  flex: 0 0 auto;
}

.ai-chat-context h3 {
  margin: 0;
  color: var(--calm-text);
  font-size: .92rem;
}

.ai-chat-context-head button {
  padding: .36rem .56rem;
  background: #fff;
  color: #334155;
  font-size: .78rem;
}

.ai-chat-context-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
}

.ai-chat-context-chips span {
  max-width: 100%;
  border: 1px solid var(--calm-line);
  border-radius: 999px;
  padding: .25rem .5rem;
  background: #f8fafc;
  color: #334155;
  font-size: .74rem;
  font-weight: 780;
  overflow-wrap: anywhere;
}

.ai-chat-context p {
  margin: 0;
  color: var(--calm-muted);
  font-size: .82rem;
  line-height: 1.45;
}

.ai-chat-context-list {
  display: grid;
  gap: .32rem;
  max-height: 6.6rem;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.ai-chat-context-list li {
  display: grid;
  grid-template-columns: 3.25rem minmax(0, 1fr) auto;
  gap: .45rem;
  align-items: start;
  border: 1px solid var(--calm-line);
  border-radius: .45rem;
  padding: .42rem .5rem;
  background: #f8fafc;
}

.ai-chat-context-list strong {
  color: #1d4ed8;
  font-size: .76rem;
}

.ai-chat-context-list span {
  min-width: 0;
  color: #334155;
  font-size: .76rem;
  line-height: 1.38;
}

.ai-context-remove {
  align-self: center;
  min-height: 1.7rem;
  border: 1px solid #dbe3ef;
  border-radius: .38rem;
  padding: 0 .42rem;
  background: #fff;
  color: #64748b;
  cursor: pointer;
  font-size: .72rem;
  font-weight: 820;
}

.ai-context-remove:hover {
  border-color: #fecaca;
  background: #fff1f2;
  color: #b91c1c;
}

.ai-chat-status {
  margin: 0;
  color: var(--calm-muted);
  font-size: .82rem;
  line-height: 1.35;
}

.ai-chat-status[hidden] {
  display: none !important;
}

.ai-chat-status[data-tone="warning"] {
  color: #b45309;
}

.ai-chat-status[data-tone="danger"] {
  color: #b91c1c;
}

.ai-chat-messages {
  display: grid;
  align-content: start;
  gap: .85rem;
  min-height: 0;
  padding: 1rem;
  overflow-y: auto;
  background: #ffffff;
}

.ai-chat-message {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr);
  gap: .58rem;
  align-items: start;
}

.ai-chat-message.user {
  grid-template-columns: minmax(0, 1fr) 2rem;
}

.ai-chat-message.user .ai-chat-avatar {
  order: 2;
}

.ai-chat-message.user .ai-chat-bubble {
  justify-self: end;
  background: #111827;
  color: #fff;
}

.ai-chat-message.user.failed .ai-chat-bubble {
  border-color: #fecaca;
  background: #fff7ed;
  color: #9a3412;
}

.ai-chat-message.error .ai-chat-avatar {
  background: #fee2e2;
  color: #b91c1c;
  font-size: .62rem;
}

.ai-chat-message.error .ai-chat-bubble {
  border-color: #fecaca;
  background: #fff1f2;
  color: #991b1b;
}

.ai-chat-avatar {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: #e0f2fe;
  color: #0369a1;
  font-size: .72rem;
  font-weight: 950;
}

.ai-chat-bubble {
  max-width: 100%;
  border: 1px solid var(--calm-line);
  border-radius: .68rem;
  padding: .68rem .78rem;
  background: #f8fafc;
  overflow-wrap: anywhere;
}

.ai-chat-bubble strong {
  display: block;
  margin-bottom: .2rem;
  color: inherit;
  font-size: .9rem;
}

.ai-chat-bubble p {
  margin: 0;
  color: inherit;
  font-size: .9rem;
  line-height: 1.62;
}

.ai-thinking-bubble {
  display: inline-flex;
  align-items: center;
  gap: .32rem;
  min-height: 1.4rem;
  padding: .1rem .05rem;
}

.ai-thinking-bubble span {
  width: .36rem;
  height: .36rem;
  border-radius: 50%;
  background: #64748b;
  opacity: .42;
  animation: ai-thinking-pulse 1.05s ease-in-out infinite;
}

.ai-thinking-bubble span:nth-child(2) {
  animation-delay: .14s;
}

.ai-thinking-bubble span:nth-child(3) {
  animation-delay: .28s;
}

@keyframes ai-thinking-pulse {
  0%, 80%, 100% {
    opacity: .28;
    transform: translateY(0);
  }

  40% {
    opacity: .9;
    transform: translateY(-.18rem);
  }
}

body.app-motion-reduced .ai-thinking-bubble span {
  animation: none !important;
  opacity: .65;
}

.ai-empty-state {
  border: 1px dashed #cbd5e1;
  border-radius: .68rem;
  padding: 1rem;
  background: #f8fafc;
  color: #475569;
}

.ai-empty-state strong,
.ai-empty-state span {
  display: block;
}

.ai-empty-state strong {
  margin-bottom: .28rem;
  color: #111827;
}

.ai-empty-state span {
  line-height: 1.5;
  font-size: .9rem;
}

.ai-chat-composer {
  display: grid;
  gap: .65rem;
  padding: .85rem 1rem 1rem;
  border-top: 1px solid var(--calm-line);
  background: #fbfdff;
}

.ai-chat-composer textarea {
  display: block;
  width: 100%;
  min-height: 5.4rem;
  max-height: 13rem;
  resize: none;
  border: 1px solid var(--calm-line);
  border-radius: .65rem;
  padding: .78rem .85rem;
  background: #fff;
  color: var(--calm-text);
  line-height: 1.55;
  outline: none;
  overflow-y: hidden;
}

.ai-chat-composer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .55rem;
}

.ai-chat-ghost-button {
  background: #fff;
  color: #334155;
}

.ai-chat-send-button {
  min-width: 5.4rem;
  background: #111827;
  border-color: #111827;
  color: #fff;
}

@media (max-width: 1180px) {
  .toolbar {
    grid-template-columns: minmax(220px, 1fr) repeat(3, minmax(108px, 130px)) auto auto auto;
  }
}

@media (max-width: 980px) {
  .app-page {
    display: block;
  }

  .sidebar {
    width: auto;
    height: auto;
    position: static;
    border-right: 0;
    border-bottom: 1px solid var(--calm-line);
  }

  .campus-card img {
    max-height: 9rem;
  }

  .content {
    padding: .85rem .85rem 6rem;
  }

  .content-header {
    min-height: 210px;
  }

  .study-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .toolbar {
    position: static;
    grid-template-columns: 1fr 1fr;
  }

  .toolbar input {
    grid-column: 1 / -1;
  }

  .active-scope-bar {
    flex-direction: column;
  }

  .active-scope-actions {
    width: 100%;
    justify-items: start;
  }

  .active-scope-pills {
    justify-content: flex-start;
  }
}

@media (max-width: 720px) {
  .ai-chat-panel {
    inset: auto 0 0 0;
    width: 100%;
    height: min(88dvh, 720px);
    border-radius: .95rem .95rem 0 0;
    box-shadow: 0 -18px 42px rgba(15, 23, 42, .2);
    transform: translateY(100%);
  }

  .ai-chat-drawer:target .ai-chat-panel,
  .ai-chat-drawer.open .ai-chat-panel,
  .ai-chat-drawer.is-open .ai-chat-panel,
  .ai-chat-drawer[data-state="open"] .ai-chat-panel,
  body.ai-chat-open .ai-chat-panel {
    transform: translateY(0);
  }

  .ai-chat-config-grid {
    grid-template-columns: 1fr;
  }

.ai-chat-key-field {
  grid-column: auto;
}

  .ai-chat-base-url-field {
    grid-column: auto;
  }
}

@media (max-width: 560px) {
  .content {
    padding: .7rem .7rem 6.4rem;
  }

  .content-header {
    min-height: 220px;
    padding: .9rem;
  }

  .header-stats {
    gap: .45rem;
  }

  .study-overview,
  .toolbar {
    grid-template-columns: 1fr;
  }

  .active-scope-bar {
    padding: .75rem .78rem;
  }

  .active-scope-pill,
  .active-scope-reset {
    width: 100%;
    justify-content: center;
  }

  .library-panel {
    grid-template-columns: 1fr;
  }

  .question-card {
    padding: .85rem;
  }

  .question-title {
    padding-right: 0;
  }

  .floating-timer {
    left: .7rem;
    right: .7rem;
    bottom: .7rem;
  }

  .ai-chat-fab {
    right: .78rem;
    bottom: 5.55rem;
    width: 3.2rem;
    height: 3.2rem;
  }

  .scroll-top-button {
    right: 4.25rem;
    bottom: 5.55rem;
  }

  .ai-chat-header,
  .ai-chat-settings,
  .ai-chat-context,
  .ai-chat-messages,
  .ai-chat-composer {
    padding-left: .85rem;
    padding-right: .85rem;
  }

  .ai-chat-composer-actions {
    align-items: stretch;
  }

  .ai-chat-ghost-button,
  .ai-chat-send-button {
    flex: 1;
  }
}

/* DeepSeek-like AI chat drawer refinement */
.ai-chat-panel.ai-chat-shell {
  inset: 1.5rem 1.5rem 1.5rem auto;
  display: grid;
  grid-template-columns: 238px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  width: min(1120px, calc(100vw - 3rem));
  height: auto;
  min-height: 0;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  border-radius: .9rem;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, .22);
}

.ai-chat-rail {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  gap: .7rem;
  min-width: 0;
  min-height: 0;
  padding: .85rem;
  border-right: 1px solid var(--calm-line);
  background: #f8fafc;
}

.ai-chat-rail-head {
  display: flex;
  align-items: center;
  gap: .62rem;
  min-width: 0;
}

.ai-chat-logo {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid #dbe3ef;
  border-radius: .55rem;
  background: #fff;
  color: #111827;
  font-size: .76rem;
  font-weight: 950;
}

.ai-chat-rail-head strong {
  display: block;
  overflow: hidden;
  color: #111827;
  font-size: .95rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-chat-new-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  min-height: 2.45rem;
  width: 100%;
  border-color: #111827;
  border-radius: .52rem;
  background: #111827;
  color: #fff;
}

.ai-chat-new-button span {
  font-size: 1.05rem;
  line-height: 1;
}

.ai-chat-new-button strong {
  font-size: .88rem;
  line-height: 1;
}

.ai-chat-session-search {
  display: block;
  min-width: 0;
}

.ai-chat-session-search input {
  width: 100%;
  min-width: 0;
  height: 2.35rem;
  border: 1px solid #dbe3ef;
  border-radius: .5rem;
  padding: 0 .72rem;
  background: #fff;
  color: #111827;
  outline: none;
}

.ai-chat-session-search input:focus {
  border-color: #94a3b8;
  box-shadow: 0 0 0 3px rgba(148, 163, 184, .18);
}

.ai-chat-session-list {
  display: grid;
  align-content: start;
  gap: .38rem;
  min-height: 0;
  overflow-y: auto;
}

.ai-chat-session-item {
  display: grid;
  gap: 0;
  width: 100%;
  min-width: 0;
  border: 1px solid transparent;
  border-radius: .55rem;
  padding: .62rem .65rem;
  background: transparent;
  color: #334155;
  text-align: left;
  cursor: pointer;
}

.ai-chat-session-item:hover,
.ai-chat-session-item.active {
  border-color: #dbe3ef;
  background: #fff;
}

.ai-chat-session-item span,
.ai-chat-session-item small {
  display: none;
}

.ai-chat-session-item strong,
.ai-chat-session-item span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #111827;
  font-size: .86rem;
  font-weight: 820;
}

.ai-chat-session-item small {
  display: none !important;
  color: #64748b;
  font-size: .74rem;
  line-height: 1.2;
}

.ai-rail-footer,
.ai-chat-session-tools {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .45rem;
}

.ai-chat-ghost-button,
.ai-chat-icon-button,
.ai-chat-context-head button {
  min-height: 2.2rem;
  border: 1px solid #dbe3ef;
  border-radius: .48rem;
  background: #fff;
  color: #334155;
  box-shadow: none;
}

.ai-chat-ghost-button:hover,
.ai-chat-icon-button:hover,
.ai-chat-context-head button:hover {
  background: #f8fafc;
  color: #111827;
}

.ai-chat-ghost-button[aria-expanded="true"] {
  border-color: #0f9f9a;
  background: #ecfdfb;
  color: #0f766e;
}

.ai-chat-ghost-button.danger,
.ai-chat-icon-button.danger {
  color: var(--calm-danger);
}

.ai-chat-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 292px;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  background: #fff;
}

.ai-chat-header {
  grid-column: 1 / -1;
  min-width: 0;
  padding: .82rem .92rem;
  background: #fff;
}

.ai-chat-header h2 {
  font-size: 1.04rem;
}

.ai-chat-header-actions {
  display: flex;
  align-items: center;
  gap: .42rem;
  min-width: 0;
}

.ai-chat-icon-button {
  padding: 0 .68rem;
  font-size: .78rem;
  font-weight: 820;
}

.ai-chat-close {
  width: 2.2rem;
  height: 2.2rem;
  flex: 0 0 auto;
}

.ai-chat-settings.ai-chat-user-settings {
  grid-column: 2;
  grid-row: 2 / 5;
  align-content: start;
  gap: .72rem;
  min-height: 0;
  padding: .82rem;
  overflow-y: auto;
  border-left: 1px solid var(--calm-line);
  border-bottom: 0;
  background: #fbfdff;
}

.ai-settings-head {
  display: grid;
  gap: .24rem;
}

.ai-settings-head strong {
  color: #111827;
  font-size: .9rem;
}

.ai-settings-head span {
  color: #64748b;
  font-size: .76rem;
  line-height: 1.45;
}

.ai-chat-config-grid {
  grid-template-columns: 1fr;
  gap: .58rem;
}

.ai-chat-field span {
  color: #475569;
  font-size: .74rem;
}

.ai-chat-field select,
.ai-chat-field input {
  height: 2.28rem;
  border-color: #dbe3ef;
  border-radius: .48rem;
  font-size: .84rem;
}

.ai-chat-base-url-field,
.ai-chat-key-field {
  grid-column: auto;
}

.ai-preference-grid {
  display: grid;
  gap: .45rem;
  padding-top: .12rem;
}

.ai-preference-grid label {
  display: flex;
  align-items: center;
  gap: .42rem;
  min-width: 0;
  color: #475569;
  font-size: .78rem;
  line-height: 1.35;
}

.ai-preference-grid label.is-disabled {
  color: #64748b;
  cursor: not-allowed;
  opacity: .78;
}

.ai-chat-context {
  grid-column: 1;
  grid-row: 2;
  gap: .42rem;
  padding: .72rem .92rem;
  background: #fff;
}

.ai-chat-context-head button {
  padding: 0 .58rem;
  font-size: .76rem;
}

.ai-chat-context-list {
  max-height: 5.4rem;
}

.ai-chat-status {
  color: #64748b;
  font-size: .78rem;
}

.ai-chat-messages {
  grid-column: 1;
  grid-row: 3;
  padding: 1rem .92rem;
  background: #fff;
}

.ai-chat-bubble {
  border-radius: .7rem;
  background: #f8fafc;
}

.ai-chat-message.user .ai-chat-bubble {
  background: #111827;
}

.ai-chat-composer {
  grid-column: 1;
  grid-row: 4;
  gap: .58rem;
  padding: .78rem .92rem .86rem;
  background: #fff;
}

.ai-chat-composer textarea {
  min-height: 4.85rem;
  border-radius: .7rem;
}

.ai-chat-quick-prompts {
  display: flex;
  gap: .42rem;
  min-width: 0;
  overflow-x: auto;
  padding-bottom: .12rem;
  scrollbar-width: thin;
}

.ai-chat-quick-prompts button {
  display: grid;
  grid-template-columns: max-content max-content;
  align-items: center;
  gap: .35rem;
  min-height: 2.05rem;
  flex: 0 0 auto;
  border: 1px solid #dbe3ef;
  border-radius: .48rem;
  padding: .34rem .52rem;
  background: #f8fafc;
  color: #334155;
  cursor: pointer;
}

.ai-chat-quick-prompts button:hover,
.ai-chat-quick-prompts button:focus-visible {
  border-color: #94a3b8;
  background: #fff;
  color: #111827;
  outline: none;
}

.ai-chat-quick-prompts strong {
  color: inherit;
  font-size: .76rem;
  line-height: 1.1;
  white-space: nowrap;
}

.ai-chat-quick-prompts span {
  color: #64748b;
  font-size: .72rem;
  line-height: 1.1;
  white-space: nowrap;
}

.ai-chat-readiness {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .42rem;
  min-width: 0;
}

.ai-chat-readiness-chip {
  display: grid;
  gap: .12rem;
  min-width: 0;
  min-height: 2.35rem;
  border: 1px solid #dbe3ef;
  border-left: 3px solid #94a3b8;
  border-radius: .46rem;
  padding: .34rem .48rem;
  background: #f8fafc;
  color: #334155;
  transition: border-color .16s ease, background-color .16s ease, box-shadow .16s ease;
}

.ai-chat-readiness-chip.ready {
  border-left-color: #0f9f9a;
  background: #f5fbfb;
}

.ai-chat-readiness-chip.warning {
  border-left-color: #d97706;
  background: #fffaf0;
}

.ai-chat-readiness[data-has-warning="true"] .ai-chat-readiness-chip.warning {
  border-color: #f2c572;
  border-left-color: #d97706;
  box-shadow: 0 0 0 1px rgba(217, 119, 6, .08);
}

.ai-chat-readiness-chip.neutral {
  border-left-color: #94a3b8;
}

.ai-chat-readiness-chip strong,
.ai-chat-readiness-chip small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-chat-readiness-chip strong {
  color: #1f2937;
  font-size: .72rem;
  font-weight: 860;
  line-height: 1.08;
}

.ai-chat-readiness-chip small {
  color: #64748b;
  font-size: .68rem;
  font-weight: 760;
  line-height: 1.08;
}

@media (max-width: 720px) {
  .ai-chat-readiness {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.ai-chat-composer-actions {
  display: grid;
  grid-template-columns: max-content 1fr max-content;
  align-items: center;
}

.ai-chat-send-button {
  min-width: 4.8rem;
  min-height: 2.28rem;
  border-radius: .48rem;
}

.ai-chat-send-button:disabled {
  border-color: #dbe3ef;
  background: #e2e8f0;
  color: #64748b;
  cursor: not-allowed;
  box-shadow: none;
}

.ai-chat-start-dialog[hidden] {
  display: none;
}

.ai-chat-start-dialog {
  position: fixed;
  inset: 0;
  z-index: 1180;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.ai-chat-start-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(15, 23, 42, .42);
  cursor: pointer;
}

.ai-chat-start-shell {
  position: relative;
  display: grid;
  gap: .85rem;
  width: min(560px, 100%);
  max-height: min(680px, calc(100dvh - 2rem));
  overflow: auto;
  border: 1px solid #e2e8f0;
  border-radius: .5rem;
  padding: .95rem;
  background: #fff;
  box-shadow: 0 18px 48px rgba(15, 23, 42, .2);
}

body.ai-start-open .ai-chat-fab,
body.ai-start-open .floating-timer,
body.ai-start-open .scroll-top-button {
  opacity: 0;
  pointer-events: none;
}

.ai-chat-start-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  min-width: 0;
}

.ai-chat-start-header h2 {
  margin: 0;
  color: #111827;
  font-size: 1.05rem;
  line-height: 1.25;
}

.ai-chat-start-options {
  display: grid;
  gap: .55rem;
}

.ai-chat-start-options button {
  position: relative;
  display: grid;
  gap: .22rem;
  min-height: 4.25rem;
  border: 1px solid #dbe3ef;
  border-radius: .5rem;
  padding: .72rem 5.6rem .72rem .82rem;
  background: #fff;
  color: #334155;
  text-align: left;
  cursor: pointer;
}

.ai-chat-start-options button::after {
  content: attr(data-meta);
  position: absolute;
  top: .72rem;
  right: .78rem;
  max-width: 4.4rem;
  overflow: hidden;
  color: #64748b;
  font-size: .75rem;
  font-weight: 820;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-chat-start-options button:hover,
.ai-chat-start-options button:focus-visible {
  border-color: #94a3b8;
  background: #f8fafc;
  outline: none;
}

.ai-chat-start-options button:disabled {
  border-color: #e2e8f0;
  background: #f8fafc;
  cursor: not-allowed;
}

.ai-chat-start-options button:disabled::after,
.ai-chat-start-options button:disabled strong,
.ai-chat-start-options button:disabled span {
  color: #94a3b8;
}

.ai-chat-start-options strong {
  color: #111827;
  font-size: .94rem;
}

.ai-chat-start-options span {
  color: #64748b;
  font-size: .8rem;
  line-height: 1.42;
}

.ai-chat-start-options small {
  color: #334155;
  font-size: .76rem;
  font-weight: 820;
  line-height: 1.35;
}

.ai-chat-start-summary {
  margin: 0;
  border-top: 1px solid #e2e8f0;
  padding-top: .75rem;
  color: #64748b;
  font-size: .78rem;
  line-height: 1.48;
}

body:not(.ai-settings-open) .ai-chat-settings.ai-chat-user-settings {
  display: none;
}

body:not(.ai-settings-open) .ai-chat-main {
  grid-template-columns: minmax(0, 1fr);
}

@media (max-width: 1180px) {
  .ai-chat-panel.ai-chat-shell {
    grid-template-columns: 220px minmax(0, 1fr);
    width: calc(100vw - 2rem);
    inset: 1rem 1rem 1rem auto;
  }

  .ai-chat-main {
    grid-template-columns: minmax(0, 1fr) 268px;
  }
}

@media (max-width: 940px) {
  .ai-chat-panel.ai-chat-shell {
    inset: 0;
    width: 100%;
    border-radius: 0;
  }

  .ai-chat-main {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  }

  .ai-chat-settings.ai-chat-user-settings {
    grid-column: 1;
    grid-row: 3;
    max-height: 12rem;
    border-left: 0;
    border-bottom: 1px solid var(--calm-line);
  }

  .ai-chat-context {
    grid-row: 2;
  }

  .ai-chat-messages {
    grid-row: 4;
  }

  .ai-chat-composer {
    grid-row: 5;
  }
}

@media (max-width: 720px) {
  .ai-chat-panel.ai-chat-shell {
    inset: 0;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    width: 100%;
    height: 100dvh;
    border-radius: 0;
    transform: translateY(100%);
  }

  .ai-chat-drawer:target .ai-chat-panel.ai-chat-shell,
  .ai-chat-drawer.open .ai-chat-panel.ai-chat-shell,
  .ai-chat-drawer.is-open .ai-chat-panel.ai-chat-shell,
  .ai-chat-drawer[data-state="open"] .ai-chat-panel.ai-chat-shell,
  body.ai-chat-open .ai-chat-panel.ai-chat-shell {
    transform: translateY(0);
  }

  .ai-chat-rail {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto auto;
    gap: .5rem;
    padding: .65rem;
    border-right: 0;
    border-bottom: 1px solid var(--calm-line);
  }

  .ai-chat-rail-head {
    display: none;
  }

  .ai-chat-new-button {
    min-height: 2.28rem;
  }

  .ai-chat-session-list {
    display: flex;
    gap: .42rem;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: .08rem;
  }

  .ai-chat-session-item {
    min-width: 10.5rem;
  }

  .ai-rail-footer,
  .ai-chat-session-tools {
    grid-template-columns: 1fr 1fr;
  }

  .ai-chat-main {
    min-height: 0;
    overflow: hidden;
  }

  .ai-chat-header {
    padding: .68rem .75rem;
  }

  .ai-chat-header-actions {
    gap: .3rem;
  }

  .ai-chat-icon-button {
    padding: 0 .5rem;
  }

  .ai-chat-settings.ai-chat-user-settings {
    max-height: 10.5rem;
    padding: .68rem .75rem;
  }

  .ai-chat-config-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ai-chat-base-url-field,
  .ai-chat-key-field {
    grid-column: 1 / -1;
  }

  .ai-chat-context {
    padding: .68rem .75rem;
  }

  .ai-chat-context-list {
    max-height: 4.2rem;
  }

  .ai-chat-messages {
    padding: .78rem .75rem;
  }

  .ai-chat-composer {
    padding: .68rem .75rem .78rem;
  }

  .ai-chat-composer textarea {
    min-height: 4.2rem;
    max-height: 8rem;
  }
}

@media (max-width: 520px) {
  .ai-chat-header {
    align-items: start;
  }

  .ai-chat-header-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .ai-chat-config-grid {
    grid-template-columns: 1fr;
  }

  .ai-chat-base-url-field,
  .ai-chat-key-field {
    grid-column: auto;
  }

  .ai-chat-composer-actions {
    grid-template-columns: 1fr 1fr;
  }

  .ai-chat-ghost-button,
  .ai-chat-send-button {
    width: 100%;
  }

  .ai-chat-start-options button {
    padding-right: .82rem;
  }

  .ai-chat-start-options button::after {
    position: static;
    max-width: none;
    text-align: left;
  }
}

body.preview-open {
  overflow: hidden;
}

.preview-panel {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: none;
  align-items: stretch;
  justify-content: flex-end;
}

.preview-panel.open {
  display: flex;
}

.preview-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(15, 23, 42, .36);
  cursor: pointer;
}

.preview-shell {
  position: relative;
  z-index: 1;
  width: min(980px, calc(100vw - 4rem));
  height: calc(100vh - 2rem);
  margin: 1rem;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  border: 1px solid rgba(148, 163, 184, .28);
  border-radius: .8rem;
  background: #f8fafc;
  box-shadow: 0 28px 80px rgba(15, 23, 42, .28);
  overflow: hidden;
}

.preview-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.25rem .95rem;
  border-bottom: 1px solid #e2e8f0;
  background: #fff;
}

.preview-kicker {
  display: block;
  margin-bottom: .28rem;
  color: #2563eb;
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.preview-header h2 {
  margin: 0;
  color: #0f172a;
  font-size: 1.25rem;
  line-height: 1.25;
}

.preview-header p {
  margin: .38rem 0 0;
  color: #64748b;
  font-size: .92rem;
  font-weight: 700;
  line-height: 1.45;
}

.preview-close {
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid #e2e8f0;
  border-radius: .5rem;
  background: #fff;
  color: #475569;
  cursor: pointer;
  font-size: 1.35rem;
  line-height: 1;
}

.preview-close:hover {
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .75rem 1.25rem;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

.preview-count {
  color: #334155;
  font-weight: 900;
}

.preview-actions {
  display: flex;
  align-items: center;
  gap: .55rem;
}

.preview-body {
  min-height: 0;
  overflow: auto;
  padding: 1rem 1.25rem 1.35rem;
}

.preview-question {
  border: 1px solid #e2e8f0;
  border-radius: .65rem;
  background: #fff;
  padding: 1rem;
  box-shadow: 0 10px 28px rgba(15, 23, 42, .06);
}

.preview-question + .preview-question {
  margin-top: .85rem;
}

.preview-question-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .8rem;
  margin-bottom: .7rem;
}

.preview-question-head > div {
  display: flex;
  align-items: center;
  gap: .55rem;
  min-width: 0;
}

.preview-index {
  border-radius: 999px;
  padding: .22rem .55rem;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: .78rem;
  font-weight: 900;
}

.preview-question-ai {
  flex: 0 0 auto;
  border: 1px solid #dbeafe;
  border-radius: .45rem;
  padding: .42rem .68rem;
  background: #eff6ff;
  color: #1d4ed8;
  cursor: pointer;
  font-weight: 900;
}

.preview-question-ai:hover {
  border-color: #93c5fd;
  background: #dbeafe;
}

.preview-tags {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  margin-bottom: .72rem;
}

.preview-tags span {
  border-radius: 999px;
  padding: .24rem .55rem;
  background: #f1f5f9;
  color: #475569;
  font-size: .78rem;
  font-weight: 800;
}

.preview-tags .ok {
  background: #dcfce7;
  color: #166534;
}

.preview-tags .warn {
  background: #fee2e2;
  color: #991b1b;
}

.preview-question h3 {
  margin: 0 0 .85rem;
  color: #111827;
  font-size: 1rem;
  line-height: 1.75;
}

.preview-answer,
.preview-solution {
  margin-top: .75rem;
  padding: .78rem .85rem;
  border: 1px solid #e2e8f0;
  border-radius: .55rem;
  background: #f8fafc;
}

.preview-answer h4,
.preview-solution h4 {
  margin: 0 0 .38rem;
  color: #334155;
  font-size: .86rem;
}

.preview-answer p,
.preview-solution p {
  margin: 0;
  color: #1f2937;
  line-height: 1.65;
}

.preview-lock,
.preview-more,
.preview-empty {
  border: 1px solid #fde68a;
  border-radius: .55rem;
  margin: .8rem 0 0;
  padding: .75rem .85rem;
  background: #fffbeb;
  color: #92400e;
  font-weight: 800;
}

.preview-empty {
  margin: 0;
  border-color: #e2e8f0;
  background: #fff;
  color: #64748b;
}

.preview-btn.icon-btn {
  border: 1px solid #dbeafe;
  border-radius: .45rem;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: .82rem;
  font-weight: 900;
}

.preview-btn.icon-btn:hover {
  border-color: #93c5fd;
  background: #dbeafe;
}

@media (max-width: 720px) {
  .preview-shell {
    width: 100vw;
    height: 100vh;
    margin: 0;
    border-radius: 0;
  }

  .preview-header,
  .preview-toolbar,
  .preview-body {
    padding-left: .85rem;
    padding-right: .85rem;
  }

  .preview-toolbar,
  .preview-question-head {
    align-items: stretch;
    flex-direction: column;
  }

  .preview-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

@media print {
  body.preview-open .sidebar,
  body.preview-open .content,
  body.preview-open .floating-timer,
  body.preview-open .ai-chat-fab,
  body.preview-open .scroll-top-button,
  body.preview-open .preview-backdrop,
  body.preview-open .preview-close,
  body.preview-open .preview-toolbar {
    display: none !important;
  }

  body.preview-open .preview-panel,
  body.preview-open .preview-shell {
    position: static;
    display: block;
    width: auto;
    height: auto;
    margin: 0;
    border: 0;
    box-shadow: none;
    overflow: visible;
  }

  body.preview-open .preview-body {
    overflow: visible;
    padding: 0;
  }
}

/* Text resilience for browser zoom, Chinese labels, and expanded filters. */
.toolbar {
  grid-template-columns: repeat(auto-fit, minmax(8.75rem, 1fr));
  align-items: stretch;
}

.toolbar input {
  grid-column: span 2;
}

.toolbar button,
.toolbar select,
.toolbar input,
.mode-button,
.library-entry,
.question-actions button,
.preview-actions button,
.ai-chat-icon-button,
.ai-chat-ghost-button,
.ai-chat-send-button {
  min-width: 0;
  min-height: 2.55rem;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.toolbar select,
.toolbar input {
  text-overflow: ellipsis;
}

.question-title,
.preview-question h3,
.analysis-box,
.preview-answer p,
.preview-solution p,
.ai-chat-bubble,
.header-desc,
.overview-card,
.library-copy,
.mode-button small {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.question-title {
  padding-right: 0;
}

.badge,
.preview-tags span {
  max-width: 100%;
  line-height: 1.25;
  overflow-wrap: anywhere;
  white-space: normal;
}

.question-card-head,
.preview-question-head,
.ai-chat-header,
.ai-settings-head {
  min-width: 0;
}

.question-meta {
  min-width: 0;
  flex: 1 1 auto;
}

.card-icon-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.answer-feedback {
  flex-wrap: wrap;
  min-width: 0;
}

.answer-feedback span:last-child {
  min-width: 0;
  overflow-wrap: anywhere;
}

.exam-card,
.exam-card div {
  min-width: 0;
}

.exam-card {
  flex-wrap: wrap;
}

.question-card mjx-container,
.analysis-box mjx-container,
.preview-body mjx-container,
.ai-chat-bubble mjx-container {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

body.preview-open .floating-timer,
body.preview-open .ai-chat-fab,
body.preview-open .scroll-top-button {
  display: none;
}

.preview-shell,
.ai-chat-panel.ai-chat-shell {
  min-width: 0;
}

@media (max-width: 720px) {
  .toolbar input {
    grid-column: 1 / -1;
  }

  .toolbar {
    grid-template-columns: repeat(auto-fit, minmax(7.6rem, 1fr));
  }
}

@media (max-width: 520px) {
  .toolbar {
    grid-template-columns: 1fr;
  }

  .toolbar input,
  .toolbar select,
  .toolbar button {
    width: 100%;
  }

  .floating-timer {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .floating-timer img {
    display: none;
  }

  .floating-timer-copy {
    min-width: 0;
  }

  .floating-timer-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

/* Question bank toolbar layout fix */
.app-page .reset-panel {
  overflow: visible;
}

.app-page .reset-panel > div:first-child {
  min-width: 14rem;
}

.app-page .reset-actions button,
.app-page .toolbar button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  line-height: 1.2;
  text-align: center;
}

.app-page .toolbar {
  grid-template-columns: minmax(16rem, 2fr) repeat(3, minmax(9.5rem, 1fr));
  align-items: center;
  gap: .65rem;
}

.app-page .toolbar input,
.app-page .toolbar select {
  height: 3rem;
  min-height: 3rem;
  line-height: normal;
  white-space: nowrap;
  overflow-wrap: normal;
}

.app-page .toolbar input {
  grid-column: auto;
}

.app-page .toolbar select {
  padding: 0 2.25rem 0 .9rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 1180px) {
  .app-page .reset-panel {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .app-page .reset-actions {
    justify-content: flex-start;
  }

  .app-page .toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-page .toolbar input {
    grid-column: 1 / -1;
  }

  .app-page .toolbar #sync-button {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .app-page .reset-panel,
  .app-page .reset-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .app-page .toolbar {
    grid-template-columns: 1fr;
  }

  .app-page .toolbar input,
  .app-page .toolbar select,
  .app-page .toolbar button {
    grid-column: 1 / -1;
    width: 100%;
  }
}

/* Responsive polish for zoomed and narrow question-bank screens. */
.app-page {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

.app-page button,
.app-page input,
.app-page select,
.app-page textarea {
  max-width: 100%;
}

.app-page .reset-panel,
.app-page .reset-panel > div:first-child,
.app-page .reset-actions,
.app-page .toolbar,
.app-page .toolbar > * {
  min-width: 0;
}

.app-page .reset-panel > div:first-child {
  flex: 1 1 16rem;
}

.app-page .reset-actions button {
  white-space: normal;
  overflow-wrap: anywhere;
}

.app-page .toolbar {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 8.9rem), 1fr));
  align-items: stretch;
  gap: .55rem;
  padding: .58rem;
}

.app-page .toolbar input {
  grid-column: span 2;
  min-width: min(100%, 16rem);
}

.app-page .toolbar input,
.app-page .toolbar select {
  height: 2.78rem;
  min-height: 2.78rem;
  padding-top: 0;
  padding-bottom: 0;
}

.app-page .toolbar button {
  min-height: 2.78rem;
  height: auto;
  padding: .54rem .72rem;
  white-space: normal;
  overflow-wrap: anywhere;
}

.floating-timer {
  grid-template-columns: auto minmax(6.8rem, auto) auto;
  max-width: calc(100vw - 2rem);
  min-width: 0;
}

.floating-timer-copy,
.floating-timer-actions {
  min-width: 0;
}

.floating-timer strong {
  font-size: clamp(1.08rem, 1.7vw, 1.28rem);
  white-space: nowrap;
}

.floating-timer-actions {
  flex-wrap: wrap;
}

.floating-timer button {
  min-width: 2.75rem;
  line-height: 1.2;
  white-space: normal;
}

.preview-shell {
  max-width: calc(100vw - 2rem);
  height: min(860px, calc(100dvh - 2rem));
}

.preview-header > div,
.preview-toolbar,
.preview-count,
.preview-actions,
.preview-question,
.preview-question-head,
.preview-question-head > div {
  min-width: 0;
}

.preview-header h2,
.preview-header p,
.preview-count,
.preview-question h3,
.preview-answer p,
.preview-solution p,
.preview-lock,
.preview-more,
.preview-empty {
  overflow-wrap: anywhere;
}

.preview-close {
  flex: 0 0 auto;
}

.preview-toolbar,
.preview-actions,
.preview-question-head > div {
  flex-wrap: wrap;
}

.preview-actions {
  justify-content: flex-end;
}

.preview-actions button,
.preview-question-ai {
  max-width: 100%;
  min-height: 2.35rem;
  line-height: 1.25;
  white-space: normal;
  overflow-wrap: anywhere;
}

.preview-actions button {
  min-width: min(7rem, 100%);
}

.preview-question-ai {
  flex-shrink: 1;
}

.preview-body,
.preview-question,
.preview-answer,
.preview-solution {
  min-width: 0;
  overflow-x: hidden;
}

.preview-body mjx-container,
.preview-question mjx-container,
.preview-answer mjx-container,
.preview-solution mjx-container,
.ai-chat-bubble mjx-container {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

.ai-chat-panel.ai-chat-shell {
  max-width: calc(100vw - 3rem);
  max-height: calc(100dvh - 3rem);
}

.ai-chat-panel.ai-chat-shell,
.ai-chat-rail,
.ai-chat-main,
.ai-chat-header > div,
.ai-chat-header-actions,
.ai-chat-context,
.ai-chat-context-head,
.ai-chat-composer,
.ai-chat-composer-actions,
.ai-settings-head {
  min-width: 0;
}

.ai-chat-header > div {
  flex: 1 1 auto;
}

.ai-chat-header h2,
.ai-settings-head strong,
.ai-settings-head span,
.ai-chat-field span,
.ai-chat-context h3,
.ai-chat-context p,
.ai-chat-status,
.ai-preference-grid label,
.ai-chat-bubble,
.ai-chat-bubble p {
  overflow-wrap: anywhere;
}

.ai-chat-header-actions {
  flex: 0 1 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.ai-chat-new-button,
.ai-chat-ghost-button,
.ai-chat-icon-button,
.ai-chat-send-button,
.ai-chat-context-head button {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.2;
}

.ai-chat-composer-actions {
  grid-template-columns: minmax(0, 1fr) max-content;
}

.ai-preference-grid label input {
  flex: 0 0 auto;
}

.ai-chat-field select,
.ai-chat-field input,
.ai-chat-session-search input,
.ai-chat-composer textarea {
  min-width: 0;
}

.ai-chat-bubble {
  word-break: break-word;
}

@media (max-width: 1180px) {
  .app-page .toolbar {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 8.25rem), 1fr));
  }
}

@media (max-width: 940px) {
  .ai-chat-panel.ai-chat-shell {
    max-width: 100vw;
    max-height: 100dvh;
  }

  .ai-chat-settings.ai-chat-user-settings {
    max-height: clamp(8rem, 24dvh, 12rem);
  }
}

@media (max-width: 720px) {
  .app-page .toolbar input {
    grid-column: 1 / -1;
  }

  .preview-shell {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
  }

  .preview-header {
    gap: .65rem;
  }

  .preview-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .preview-actions button {
    width: 100%;
    min-width: 0;
  }

  .preview-question-head > div {
    align-items: flex-start;
  }

  .ai-chat-panel.ai-chat-shell {
    max-width: 100vw;
    max-height: 100dvh;
  }

  .ai-chat-rail {
    grid-template-columns: minmax(0, 1fr) minmax(8rem, 34vw);
    grid-template-rows: auto auto auto;
  }

  .ai-chat-new-button {
    grid-column: 1;
  }

  .ai-chat-session-search {
    grid-column: 2;
  }

  .ai-chat-session-list,
  .ai-rail-footer,
  .ai-chat-session-tools {
    grid-column: 1 / -1;
  }

  .ai-chat-main {
    grid-template-rows: auto minmax(0, auto) minmax(0, auto) minmax(0, 1fr) auto;
  }

  .ai-chat-settings.ai-chat-user-settings {
    max-height: clamp(7rem, 22dvh, 9.5rem);
  }

  .ai-chat-context-list {
    max-height: clamp(2.75rem, 12dvh, 4rem);
  }
}

@media (max-width: 640px) {
  .app-page .content {
    padding-bottom: 8.6rem;
  }

  .app-page .toolbar {
    grid-template-columns: 1fr;
  }

  .floating-timer {
    left: .72rem;
    right: .72rem;
    bottom: max(.72rem, env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(7rem, auto);
    gap: .55rem;
    padding: .6rem .66rem;
  }

  .floating-timer img {
    display: none;
  }

  .floating-timer-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .floating-timer button {
    padding: .48rem .5rem;
  }

  .ai-chat-fab,
  .scroll-top-button {
    bottom: calc(5.9rem + env(safe-area-inset-bottom));
  }
}

@media (max-width: 560px) {
  .ai-chat-rail {
    grid-template-columns: minmax(0, 1fr);
    gap: .38rem;
    padding: .5rem .55rem;
  }

  .ai-chat-session-search {
    display: none;
  }

  .ai-chat-new-button,
  .ai-chat-session-list,
  .ai-rail-footer,
  .ai-chat-session-tools {
    grid-column: 1;
  }

  .ai-chat-session-item {
    min-width: min(10.5rem, 72vw);
    min-height: 2.25rem;
    padding: .42rem .52rem;
  }

  .ai-chat-session-item small {
    display: none;
  }

  .ai-chat-settings.ai-chat-user-settings {
    max-height: clamp(5.35rem, 18dvh, 7rem);
    padding: .56rem .66rem;
  }

  .ai-chat-context {
    gap: .32rem;
    padding: .56rem .66rem;
  }

  .ai-chat-context-list {
    display: none;
  }

  .ai-chat-status {
    max-height: 2.4rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .ai-chat-composer {
    gap: .42rem;
    padding: .56rem .66rem .64rem;
  }

  .ai-chat-composer textarea {
    min-height: 3.35rem;
    max-height: 6.5rem;
  }

  .ai-chat-composer-actions {
    grid-template-columns: minmax(0, 1fr) minmax(4.4rem, auto);
  }

  .ai-chat-header {
    gap: .5rem;
  }

  .ai-chat-icon-button {
    padding: .38rem .48rem;
  }
}

@media (max-width: 420px) {
  .preview-actions {
    grid-template-columns: 1fr;
  }

  .floating-timer {
    grid-template-columns: 1fr;
  }

  .ai-chat-fab,
  .scroll-top-button {
    bottom: calc(7.75rem + env(safe-area-inset-bottom));
  }

  .scroll-top-button {
    right: 4.18rem;
  }
}

/* Readable question-bank filters and AI math output. */
.app-page .toolbar {
  grid-template-columns: minmax(18rem, 1.4fr) repeat(3, minmax(12rem, 1fr));
  gap: .72rem;
  padding: .78rem;
}

.app-page .toolbar #search-input {
  grid-column: span 2;
}

.app-page .toolbar #sync-button {
  grid-column: 1 / -1;
}

.app-page .toolbar select,
.app-page .toolbar input {
  height: 3.05rem;
  min-height: 3.05rem;
  font-size: .96rem;
  font-weight: 800;
  text-overflow: clip;
}

.app-page .toolbar select {
  min-width: 12rem;
  padding-inline: 1rem 2.35rem;
}

.ai-chat-context-list li {
  align-items: flex-start;
}

.ai-chat-context-list span {
  white-space: normal;
}

.ai-chat-context-list mjx-container {
  display: inline-block;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  vertical-align: middle;
}

.ai-chat-bubble p + p,
.ai-chat-bubble ul + p,
.ai-chat-bubble ol + p,
.ai-chat-bubble p + ul,
.ai-chat-bubble p + ol {
  margin-top: .56rem;
}

.ai-chat-bubble ul,
.ai-chat-bubble ol {
  margin: .28rem 0 0;
  padding-left: 1.25rem;
  color: inherit;
  font-size: .9rem;
  line-height: 1.62;
}

.ai-chat-bubble li + li {
  margin-top: .22rem;
}

.ai-chat-bubble code {
  border-radius: .28rem;
  padding: .08rem .26rem;
  background: rgba(15, 23, 42, .08);
  color: inherit;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: .86em;
}

.ai-chat-message.user .ai-chat-bubble code {
  background: rgba(255, 255, 255, .14);
}

.ai-chat-bubble pre {
  margin: .55rem 0 0;
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid #dbeafe;
  border-radius: .55rem;
  padding: .72rem;
  background: #0f172a;
  color: #e2e8f0;
}

.ai-chat-bubble pre code {
  display: block;
  padding: 0;
  background: transparent;
  white-space: pre;
}

.ai-chat-bubble mjx-container {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

.ai-chat-bubble mjx-container[display="true"] {
  margin: .65rem 0;
}

.ai-message-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .42rem;
  margin-top: .62rem;
}

.ai-message-actions button {
  min-height: 1.9rem;
  border: 1px solid #dbe3ef;
  border-radius: .42rem;
  padding: .28rem .58rem;
  background: #fff;
  color: #334155;
  font-size: .74rem;
  font-weight: 820;
  line-height: 1;
  cursor: pointer;
}

.ai-message-actions button:hover,
.ai-message-actions button:focus-visible {
  border-color: #94a3b8;
  background: #f8fafc;
  color: #111827;
  outline: none;
}

.ai-message-actions button:disabled {
  border-color: #e2e8f0;
  background: #f8fafc;
  color: #94a3b8;
  cursor: not-allowed;
}

.ai-chat-message.user .ai-message-actions button {
  border-color: rgba(255, 255, 255, .22);
  background: rgba(255, 255, 255, .08);
  color: #f8fafc;
}

.ai-chat-message.user .ai-message-actions button:hover,
.ai-chat-message.user .ai-message-actions button:focus-visible {
  border-color: rgba(255, 255, 255, .44);
  background: rgba(255, 255, 255, .16);
}

@media (max-width: 1280px) {
  .app-page .toolbar {
    grid-template-columns: repeat(3, minmax(12.5rem, 1fr));
  }

  .app-page .toolbar #search-input {
    grid-column: 1 / -1;
  }
}

@media (max-width: 900px) {
  .app-page .toolbar {
    grid-template-columns: repeat(2, minmax(11.5rem, 1fr));
  }
}

@media (max-width: 560px) {
  .app-page .toolbar {
    grid-template-columns: 1fr;
  }

  .app-page .toolbar #search-input,
  .app-page .toolbar #sync-button,
  .app-page .toolbar select,
  .app-page .toolbar button {
    grid-column: 1 / -1;
  }

  .app-page .toolbar select {
    min-width: 0;
  }
}

/* Compact mobile entry: keep the BUPT signal without blocking the learning tools. */
@media (max-width: 980px) {
  .app-page .sidebar {
    display: grid;
    grid-template-columns: 1fr;
    gap: .55rem;
    padding: .62rem;
  }

  .app-page .sidebar-brand,
  .app-page .campus-card {
    margin-bottom: 0;
  }

  .app-page .chapter-nav {
    display: flex;
    gap: .42rem;
    overflow-x: auto;
    padding-bottom: .08rem;
    scrollbar-width: thin;
  }

  .app-page .chapter-nav button {
    flex: 0 0 auto;
    min-height: 2.25rem;
    padding: .52rem .72rem;
    white-space: nowrap;
  }

  .app-page .sync-panel,
  .app-page .author-card {
    display: none;
  }
}

@media (max-width: 560px) {
  .app-page .sidebar {
    gap: .48rem;
    padding: .5rem;
  }

  .app-page .sidebar-brand {
    gap: .55rem;
    padding: .5rem .62rem;
    border-radius: .55rem;
  }

  .app-page .sidebar-brand .brand-emblem.small {
    width: 2.55rem;
    height: 2.55rem;
  }

  .app-page .sidebar-brand h1 {
    font-size: .98rem;
    line-height: 1.18;
  }

  .app-page .sidebar-brand p {
    margin-top: .08rem;
    font-size: .72rem;
  }

  .app-page .campus-card {
    display: grid;
    grid-template-columns: 8.4rem minmax(0, 1fr);
    align-items: stretch;
    min-height: 5.45rem;
    border-radius: .55rem;
  }

  .app-page .campus-card img {
    width: 100%;
    height: 100%;
    min-height: 5.45rem;
    max-height: none;
    aspect-ratio: auto;
    object-fit: cover;
  }

  .app-page .campus-card > div:not(.campus-switch) {
    display: grid;
    align-content: center;
    gap: .16rem;
    min-width: 0;
    padding: .52rem .6rem .12rem;
  }

  .app-page .campus-label {
    margin: 0;
    font-size: .68rem;
  }

  .app-page .campus-card h2 {
    overflow: hidden;
    font-size: .92rem;
    line-height: 1.28;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .app-page .campus-switch {
    grid-column: 2;
    grid-template-columns: 1fr 1fr;
    gap: .3rem;
    padding: .12rem .6rem .5rem;
  }

  .app-page .campus-switch button {
    min-height: 1.9rem;
    padding: .32rem .35rem;
    border-radius: .4rem;
    font-size: .76rem;
  }

  .app-page .chapter-nav {
    margin: 0 -.08rem;
  }

  .app-page .chapter-nav button {
    min-height: 2rem;
    padding: .42rem .62rem;
    font-size: .78rem;
  }

  .app-page .content {
    padding-top: .55rem;
  }

  .app-page .content-header {
    display: grid;
    gap: .58rem;
    min-height: 0;
    padding: .72rem;
  }

  .app-page .hero-campus-image,
  .app-page .school-name-img,
  .app-page .header-desc {
    display: none;
  }

  .app-page .eyebrow {
    margin-bottom: .18rem;
    font-size: .66rem;
  }

  .app-page .content-header h2 {
    margin-top: 0;
    font-size: 1.08rem;
    line-height: 1.24;
  }

  .app-page .hero-chips {
    display: flex;
    gap: .32rem;
    overflow-x: auto;
    margin-top: .48rem;
    padding-bottom: .04rem;
  }

  .app-page .hero-chips span {
    flex: 0 0 auto;
    padding: .24rem .45rem;
    font-size: .68rem;
  }

  .app-page .header-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .38rem;
    margin-top: 0;
  }

  .app-page .header-stats div {
    min-width: 0;
    padding: .46rem .35rem;
  }

  .app-page .header-stats strong {
    font-size: 1rem;
  }

  .app-page .header-stats span {
    font-size: .66rem;
  }

  .app-page .study-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .5rem;
  }

  .app-page .overview-card {
    min-height: 0;
    padding: .62rem;
  }

  .app-page .overview-card strong {
    font-size: 1rem;
  }

  .app-page .overview-card small,
  .app-page .overview-card span {
    font-size: .68rem;
  }
}

/* User preferences, data visibility, and interaction feedback. */
.user-preference-card,
.data-status-panel,
.interaction-toast {
  letter-spacing: 0;
}

.user-preference-card {
  display: grid;
  gap: .7rem;
  margin-top: 1rem;
  border: 1px solid #dbe8f8;
  border-radius: .62rem;
  padding: .85rem;
  background: #f8fbff;
}

.preference-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .65rem;
}

.preference-card-head span {
  color: #64748b;
  font-size: .74rem;
  font-weight: 900;
}

.preference-card-head strong {
  color: #0f172a;
  font-size: .9rem;
}

.theme-segment {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid #cbd5e1;
  border-radius: .5rem;
  background: #fff;
}

.theme-segment button {
  min-width: 0;
  border: 0;
  border-right: 1px solid #e2e8f0;
  padding: .5rem .35rem;
  background: transparent;
  color: #475569;
  cursor: pointer;
  font-size: .78rem;
  font-weight: 900;
}

.theme-segment button:last-child {
  border-right: 0;
}

.theme-segment button.active {
  background: #1d4ed8;
  color: #fff;
}

.motion-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  color: #334155;
  font-size: .82rem;
  font-weight: 850;
}

.motion-toggle input {
  width: 1rem;
  height: 1rem;
  accent-color: #2563eb;
}

.preference-card-note {
  margin: -.1rem 0 0;
  color: #64748b;
  font-size: .76rem;
  font-weight: 780;
  line-height: 1.45;
}

.data-status-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) repeat(2, auto);
  align-items: stretch;
  gap: .72rem;
  margin: 1.05rem 0 0;
  border: 1px solid #d5e7fb;
  border-radius: .72rem;
  padding: .75rem;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 10px 28px rgba(15, 23, 42, .06);
}

.data-status-panel article {
  display: grid;
  gap: .18rem;
  min-width: 0;
  border: 1px solid #e2e8f0;
  border-radius: .55rem;
  padding: .72rem .82rem;
  background: #f8fafc;
}

.data-status-panel span {
  color: #64748b;
  font-size: .74rem;
  font-weight: 900;
}

.data-status-panel strong {
  color: #0f172a;
  font-size: 1.02rem;
  line-height: 1.25;
}

.data-status-panel b {
  font: inherit;
}

.data-status-panel small {
  color: #64748b;
  font-size: .78rem;
  line-height: 1.38;
}

.data-status-panel a {
  display: grid;
  place-items: center;
  min-width: 7.4rem;
  border-radius: .52rem;
  background: #1d4ed8;
  color: #fff;
  font-weight: 900;
  text-decoration: none;
}

.interaction-toast {
  position: fixed;
  right: 1rem;
  bottom: 12.7rem;
  z-index: 1240;
  max-width: min(22rem, calc(100vw - 2rem));
  transform: translateY(.55rem);
  opacity: 0;
  pointer-events: none;
  border: 1px solid #bfdbfe;
  border-radius: .62rem;
  padding: .72rem .9rem;
  background: rgba(255, 255, 255, .96);
  color: #0f172a;
  box-shadow: 0 18px 44px rgba(15, 23, 42, .18);
  font-size: .9rem;
  font-weight: 900;
  transition: opacity .18s ease, transform .18s ease;
}

.interaction-toast.show {
  transform: translateY(0);
  opacity: 1;
}

.interaction-toast[data-type="success"] {
  border-color: #86efac;
  color: #166534;
}

.interaction-toast[data-type="warning"] {
  border-color: #fbbf24;
  color: #92400e;
}

.scope-feedback {
  animation: scope-feedback-pulse .76s ease;
}

.question-list-refresh .question-card {
  animation: question-card-enter .42s ease both;
}

.question-list-refresh .question-card:nth-of-type(2) { animation-delay: .03s; }
.question-list-refresh .question-card:nth-of-type(3) { animation-delay: .06s; }
.question-list-refresh .question-card:nth-of-type(4) { animation-delay: .09s; }
.question-list-refresh .question-card:nth-of-type(5) { animation-delay: .12s; }

.question-card.answer-feedback-correct {
  animation: answer-correct-pop .72s ease;
}

.question-card.answer-feedback-wrong {
  animation: answer-wrong-pop .72s ease;
}

@keyframes scope-feedback-pulse {
  0% { box-shadow: 0 10px 28px rgba(37, 99, 235, .08); }
  45% { box-shadow: 0 0 0 4px rgba(37, 99, 235, .12), 0 16px 32px rgba(37, 99, 235, .16); }
  100% { box-shadow: 0 10px 28px rgba(37, 99, 235, .08); }
}

@keyframes question-card-enter {
  0% { opacity: 0; transform: translateY(8px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes answer-correct-pop {
  0% { transform: scale(.992); }
  42% { transform: scale(1.012); box-shadow: 0 0 0 5px rgba(34, 197, 94, .12), 0 18px 40px rgba(34, 197, 94, .14); }
  100% { transform: scale(1); }
}

@keyframes answer-wrong-pop {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  50% { transform: translateX(4px); box-shadow: 0 0 0 5px rgba(239, 68, 68, .1), 0 18px 40px rgba(239, 68, 68, .14); }
  75% { transform: translateX(-2px); }
}

body.app-theme-dark.app-page {
  --ink: #e5edf8;
  --text: #dbeafe;
  --muted: #9fb0c6;
  --line: #26364d;
  --soft: #142033;
  --card: #101827;
  --bg: #080f1d;
  background:
    linear-gradient(180deg, rgba(8, 15, 29, .96), rgba(10, 17, 30, .98)),
    url("../images/瑗垮湡鍩?绉戝浼氬爞.png") center / cover fixed no-repeat;
  color: #dbeafe;
}

body.app-theme-dark .sidebar,
body.app-theme-dark .content-header,
body.app-theme-dark .mode-panel,
body.app-theme-dark .library-entry,
body.app-theme-dark .toolbar,
body.app-theme-dark .active-scope-bar,
body.app-theme-dark .question-card,
body.app-theme-dark .data-status-panel,
body.app-theme-dark .floating-timer,
body.app-theme-dark .interaction-toast,
body.app-theme-dark .user-preference-card {
  border-color: #26364d;
  background: rgba(15, 23, 42, .96);
  color: #dbeafe;
}

body.app-theme-dark .campus-card,
body.app-theme-dark .sync-panel,
body.app-theme-dark .data-status-panel article,
body.app-theme-dark .theme-segment,
body.app-theme-dark .answer-input,
body.app-theme-dark .analysis-box,
body.app-theme-dark .ai-coach-box,
body.app-theme-dark .ai-coach-grid section,
body.app-theme-dark .empty-state,
body.app-theme-dark .pagination button {
  border-color: #26364d;
  background: #101827;
  color: #dbeafe;
}

body.app-theme-dark .sidebar-brand h1,
body.app-theme-dark .campus-card h2,
body.app-theme-dark .content-header h2,
body.app-theme-dark .overview-card strong,
body.app-theme-dark .library-copy strong,
body.app-theme-dark .active-scope-main strong,
body.app-theme-dark .question-title,
body.app-theme-dark .preference-card-head strong,
body.app-theme-dark .data-status-panel strong,
body.app-theme-dark .floating-timer strong {
  color: #f8fafc;
}

body.app-theme-dark .sidebar-brand p,
body.app-theme-dark .header-desc,
body.app-theme-dark .overview-card span,
body.app-theme-dark .overview-card small,
body.app-theme-dark .library-copy small,
body.app-theme-dark .active-scope-main p,
body.app-theme-dark .active-scope-empty,
body.app-theme-dark .preference-card-head span,
body.app-theme-dark .preference-card-note,
body.app-theme-dark .motion-toggle,
body.app-theme-dark .data-status-panel span,
body.app-theme-dark .data-status-panel small,
body.app-theme-dark .timer-label {
  color: #9fb0c6;
}

body.app-theme-dark .toolbar input,
body.app-theme-dark .toolbar select,
body.app-theme-dark .toolbar button,
body.app-theme-dark .question-actions button,
body.app-theme-dark .icon-btn,
body.app-theme-dark .campus-switch button,
body.app-theme-dark .reset-actions button {
  border-color: #334155;
  background: #0f172a;
  color: #dbeafe;
}

body.app-theme-dark .toolbar input::placeholder,
body.app-theme-dark .answer-input::placeholder {
  color: #71809a;
}

body.app-theme-dark .library-entry.active,
body.app-theme-dark .chapter-nav button.active,
body.app-theme-dark .chapter-nav button:hover {
  background: #172554;
  color: #bfdbfe;
}

body.app-theme-dark .badge,
body.app-theme-dark .library-entry em,
body.app-theme-dark .active-scope-pill,
body.app-theme-dark .active-scope-reset {
  border-color: #334155;
  background: #111c2e;
  color: #dbeafe;
}

body.app-theme-dark .data-status-panel a,
body.app-theme-dark .theme-segment button.active {
  background: #3b82f6;
}

body.app-motion-reduced *,
body.app-motion-reduced *::before,
body.app-motion-reduced *::after {
  animation-duration: .001ms !important;
  animation-iteration-count: 1 !important;
  scroll-behavior: auto !important;
  transition-duration: .001ms !important;
}

@media (prefers-reduced-motion: reduce) {
  .scope-feedback,
  .question-list-refresh .question-card,
  .question-card.answer-feedback-correct,
  .question-card.answer-feedback-wrong {
    animation: none !important;
  }
}

@media (max-width: 900px) {
  .data-status-panel {
    grid-template-columns: 1fr;
  }

  .data-status-panel a {
    min-height: 2.75rem;
  }
}

/* Final compact question-set navigation override. */
.app-page .library-panel {
  display: flex;
  align-items: stretch;
  gap: .5rem;
  overflow-x: auto;
  grid-template-columns: none;
  margin: .95rem 0 0;
  border: 1px solid #d5e7fb;
  border-radius: .72rem;
  padding: .42rem;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 10px 28px rgba(15, 23, 42, .06);
}

.app-page .library-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  flex: 1 0 10.5rem;
  gap: .5rem;
  min-height: 3.4rem;
  border: 1px solid transparent;
  border-radius: .5rem;
  padding: .58rem .66rem;
  background: transparent;
  box-shadow: none;
}

.app-page .library-entry:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
  transform: none;
  box-shadow: none;
}

.app-page .library-entry.active {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: 0 8px 18px rgba(37, 99, 235, .1);
}

.app-page .library-icon {
  display: none;
}

.app-page .library-copy {
  gap: .12rem;
}

.app-page .library-copy strong {
  font-size: .92rem;
  line-height: 1.18;
}

.app-page .library-copy small {
  font-size: .72rem;
  line-height: 1.25;
}

.app-page .library-entry em {
  min-width: 2rem;
  height: 1.8rem;
  padding: 0 .4rem;
}

body.app-theme-dark .app-page .library-panel,
body.app-theme-dark.app-page .library-panel {
  border-color: #26364d;
  background: rgba(15, 23, 42, .96);
}

body.app-theme-dark .app-page .library-entry:hover,
body.app-theme-dark.app-page .library-entry:hover {
  border-color: #334155;
  background: #111c2e;
}

body.app-theme-dark.app-page {
  background:
    linear-gradient(90deg, rgba(148, 163, 184, .045) 1px, transparent 1px),
    linear-gradient(180deg, rgba(148, 163, 184, .04) 1px, transparent 1px),
    linear-gradient(180deg, #080f1d, #0b1220);
  background-size: 36px 36px, 36px 36px, auto;
}

.app-page .toolbar {
  position: relative !important;
  top: auto !important;
  z-index: auto !important;
}

.app-page .question-card {
  scroll-margin-top: 1rem;
}

/* Final dark-mode readability guardrail. Keep this at the end so late light-mode
   overrides cannot make text unreadable on dark surfaces. */
body.app-theme-dark.app-page {
  --ink: #f8fafc;
  --text: #e5edf8;
  --muted: #c2cce0;
  --line: #334155;
  --line-strong: #475569;
  --soft: #172033;
  --card: #111827;
  --bg: #080f1d;
  --surface: #111827;
  --surface-strong: #172033;
  --calm-bg: #080f1d;
  --calm-surface: #111827;
  --calm-line: #334155;
  --calm-text: #f8fafc;
  --calm-muted: #cbd5e1;
  color-scheme: dark;
  color: #e5edf8 !important;
}

body.app-theme-dark.app-page :where(
  .sidebar,
  .sidebar-brand,
  .campus-card,
  .sync-panel,
  .author-card,
  .content-header,
  .overview-card,
  .mode-panel,
  .mode-button,
  .exam-panel,
  .exam-card,
  .exam-filter-field,
  .library-panel,
  .library-entry,
  .reset-panel,
  .data-status-panel,
  .data-status-panel article,
  .toolbar,
  .active-scope-bar,
  .question-card,
  .analysis-box,
  .ai-coach-box,
  .ai-coach-grid section,
  .answer-feedback,
  .exam-note,
  .empty-state,
  .pagination,
  .floating-timer,
  .user-preference-card,
  .theme-segment,
  .interaction-toast,
  .preview-shell,
  .preview-header,
  .preview-toolbar,
  .preview-body,
  .preview-question,
  .preview-answer,
  .preview-solution,
  .ai-chat-panel,
  .ai-chat-rail,
  .ai-chat-main,
  .ai-chat-header,
  .ai-chat-settings,
  .ai-chat-context,
  .ai-chat-messages,
  .ai-chat-composer,
  .ai-chat-start-shell,
  .ai-chat-start-options button
) {
  border-color: #334155 !important;
  background-color: #111827 !important;
  color: #e5edf8 !important;
}

body.app-theme-dark.app-page :where(
  h1,
  h2,
  h3,
  h4,
  strong,
  label,
  .question-title,
  .preview-question h3,
  .preview-answer h4,
  .preview-solution h4,
  .library-copy strong,
  .overview-card strong,
  .mode-button strong,
  .active-scope-main strong,
  .data-status-panel strong,
  .ai-chat-title,
  .ai-chat-header h2,
  .ai-chat-rail-head strong,
  .ai-chat-bubble strong,
  .ai-chat-start-header h2,
  .ai-chat-start-options strong,
  .preference-card-head strong
) {
  color: #f8fafc !important;
}

body.app-theme-dark.app-page :where(
  p,
  span,
  small,
  li,
  em,
  address,
  .header-desc,
  .overview-card span,
  .overview-card small,
  .library-copy small,
  .mode-button small,
  .mode-status,
  .exam-card span,
  .exam-filter-field span,
  .active-scope-main p,
  .active-scope-kicker,
  .data-status-panel span,
  .data-status-panel small,
  .answer-label,
  .ai-coach-head span,
  .ai-coach-grid p,
  .ai-coach-grid ul,
  .preview-header p,
  .preview-count,
  .preview-answer p,
  .preview-solution p,
  .ai-chat-kicker,
  .ai-chat-field span,
  .ai-chat-context p,
  .ai-chat-status,
  .ai-chat-start-options span,
  .ai-chat-start-options small,
  .ai-chat-start-summary,
  .preference-card-head span,
  .motion-toggle
) {
  color: #cbd5e1 !important;
}

body.app-theme-dark.app-page :where(
  input,
  textarea,
  select,
  button,
  .icon-btn,
  .secondary-action,
  .primary-action,
  .theme-segment button,
  .campus-switch button,
  .chapter-nav button,
  .toolbar button,
  .question-actions button,
  .reset-actions button,
  .pagination button,
  .preview-close,
  .preview-question-ai,
  .preview-btn,
  .ai-chat-ghost-button,
  .ai-chat-icon-button,
  .ai-chat-close,
  .ai-context-remove
) {
  border-color: #475569 !important;
  background-color: #0f172a !important;
  color: #e5edf8 !important;
}

body.app-theme-dark.app-page :where(input, textarea, select)::placeholder {
  color: #94a3b8 !important;
}

body.app-theme-dark.app-page :where(
  .badge,
  .active-scope-pill,
  .active-scope-reset,
  .library-entry em,
  .preview-tags span,
  .ai-chat-context-chips span,
  .ai-session-item,
  .ai-chat-session-item,
  .ai-chat-context-list li,
  .ai-chat-bubble,
  .loading-telemetry span
) {
  border-color: #475569 !important;
  background-color: #172033 !important;
  color: #e5edf8 !important;
}

body.app-theme-dark.app-page :where(
  .library-entry:hover,
  .mode-button:hover,
  .question-actions button:hover,
  .toolbar button:hover,
  .preview-question-ai:hover,
  .ai-chat-session-item:hover,
  .ai-chat-ghost-button:hover
) {
  border-color: #60a5fa !important;
  background-color: #1e293b !important;
  color: #f8fafc !important;
}

body.app-theme-dark.app-page :where(.ai-chat-ghost-button[aria-expanded="true"]) {
  border-color: #14b8a6 !important;
  background-color: #0d2026 !important;
  color: #ccfbf1 !important;
}

body.app-theme-dark.app-page :where(
  .library-entry.active,
  .mode-button.active,
  .chapter-nav button.active,
  .theme-segment button.active,
  .ai-chat-session-item.active,
  .ai-session-item.active
) {
  border-color: #60a5fa !important;
  background-color: #1e3a8a !important;
  color: #f8fafc !important;
}

body.app-theme-dark.app-page :where(
  .primary-action,
  .ai-chat-new-button,
  .ai-chat-send-button,
  .data-status-panel a
) {
  border-color: #2563eb !important;
  background-color: #2563eb !important;
  color: #ffffff !important;
}

body.app-theme-dark.app-page :where(.analysis-box, .preview-answer, .preview-solution) {
  background-image: none !important;
}

body.app-theme-dark.app-page :where(.answer-feedback.correct, .preview-tags .ok) {
  border-color: #166534 !important;
  background-color: #052e16 !important;
  color: #bbf7d0 !important;
}

body.app-theme-dark.app-page :where(.answer-feedback.wrong, .preview-tags .warn) {
  border-color: #7f1d1d !important;
  background-color: #450a0a !important;
  color: #fecaca !important;
}

body.app-theme-dark.app-page :where(.preview-lock, .preview-more) {
  border-color: #854d0e !important;
  background-color: #422006 !important;
  color: #fde68a !important;
}

body.app-theme-dark.app-page :where(.ai-chat-message.user .ai-chat-bubble) {
  border-color: #2563eb !important;
  background-color: #1d4ed8 !important;
  color: #ffffff !important;
}

body.app-theme-dark.app-page :where(.ai-chat-message.error .ai-chat-bubble) {
  border-color: #7f1d1d !important;
  background-color: #450a0a !important;
  color: #fecaca !important;
}

body.app-theme-dark.app-page :where(.ai-chat-key-field.server-key-ready input) {
  border-color: #15803d !important;
  background-color: #052e16 !important;
  color: #dcfce7 !important;
}

body.app-theme-dark.app-page :where(.ai-chat-key-field.server-key-ready)::after {
  border-color: #15803d !important;
  background-color: #052e16 !important;
  color: #bbf7d0 !important;
}

body.app-theme-dark.app-page :where(.ai-chat-quick-prompts button) {
  border-color: #475569 !important;
  background-color: #172033 !important;
  color: #e5edf8 !important;
}

body.app-theme-dark.app-page :where(.ai-chat-quick-prompts button:hover, .ai-chat-quick-prompts button:focus-visible) {
  border-color: #60a5fa !important;
  background-color: #1e293b !important;
  color: #f8fafc !important;
}

body.app-theme-dark.app-page :where(.ai-chat-quick-prompts span) {
  color: #9ba8ba !important;
}

body.app-theme-dark.app-page :where(.ai-chat-readiness-chip) {
  border-color: #29384d !important;
  border-left-color: #64748b !important;
  background: #111a2a !important;
  color: #9ba8ba !important;
}

body.app-theme-dark.app-page :where(.ai-chat-readiness-chip.ready) {
  border-left-color: #14b8a6 !important;
  background: #0d2026 !important;
}

body.app-theme-dark.app-page :where(.ai-chat-readiness-chip.warning) {
  border-left-color: #d97706 !important;
  background: #231a0d !important;
}

body.app-theme-dark.app-page :where(.ai-chat-readiness[data-has-warning="true"] .ai-chat-readiness-chip.warning) {
  border-color: #6b461b !important;
  border-left-color: #d97706 !important;
  box-shadow: 0 0 0 1px rgba(217, 119, 6, .14) !important;
}

body.app-theme-dark.app-page :where(.ai-chat-readiness-chip strong) {
  color: #d7dfeb !important;
}

body.app-theme-dark.app-page :where(.ai-chat-readiness-chip small) {
  color: #8794a8 !important;
}

body.app-theme-dark.app-page :where(.empty-state.is-error) {
  border-color: #7f1d1d !important;
  background-color: #450a0a !important;
  color: #fecaca !important;
}

body.app-theme-dark.app-page :where(.empty-state.is-error strong) {
  color: #fecaca !important;
}

body.app-theme-dark.app-page :where(.tech-loading-card) {
  border-color: #475569 !important;
  background:
    linear-gradient(90deg, rgba(96, 165, 250, .08) 1px, transparent 1px),
    linear-gradient(180deg, rgba(96, 165, 250, .07) 1px, transparent 1px),
    #111827 !important;
  background-size: 28px 28px, 28px 28px, auto !important;
  color: #e5edf8 !important;
}

body.app-theme-dark.app-page :where(.tech-loader-copy strong) {
  color: #f8fafc !important;
}

body.app-theme-dark.app-page :where(.tech-loader) {
  border-color: #475569 !important;
  background:
    linear-gradient(90deg, rgba(96, 165, 250, .08) 1px, transparent 1px),
    linear-gradient(180deg, rgba(96, 165, 250, .07) 1px, transparent 1px),
    #0f172a !important;
  background-size: 22px 22px, 22px 22px, auto !important;
  color: #e5edf8 !important;
}

body.app-theme-dark.app-page :where(.tech-loader-copy small) {
  color: #cbd5e1 !important;
}

body.app-theme-dark.app-page :where(.tech-loader-copy i) {
  border-color: #334155 !important;
  background-color: #0f172a !important;
}

body.app-theme-dark.app-page :where(.tip-close-button) {
  border-color: #2563eb !important;
  background-color: #2563eb !important;
  color: #ffffff !important;
}

/* Final dark-mode tone calibration: keep contrast, remove the chalky white cast. */
body.app-theme-dark.app-page {
  --ink: #d7dfeb;
  --text: #acb8ca;
  --muted: #7f8ca3;
  --calm-text: #b5c0d0;
  --calm-muted: #8390a4;
  color: #acb8ca !important;
}

body.app-theme-dark.app-page :where(
  .sidebar,
  .sidebar-brand,
  .campus-card,
  .sync-panel,
  .author-card,
  .content-header,
  .overview-card,
  .mode-panel,
  .mode-button,
  .exam-panel,
  .exam-card,
  .exam-filter-field,
  .library-panel,
  .library-entry,
  .reset-panel,
  .data-status-panel,
  .data-status-panel article,
  .toolbar,
  .active-scope-bar,
  .question-card,
  .analysis-box,
  .ai-coach-box,
  .ai-coach-grid section,
  .answer-feedback,
  .exam-note,
  .empty-state,
  .pagination,
  .floating-timer,
  .user-preference-card,
  .theme-segment,
  .interaction-toast,
  .preview-shell,
  .preview-header,
  .preview-toolbar,
  .preview-body,
  .preview-question,
  .preview-answer,
  .preview-solution,
  .ai-chat-panel,
  .ai-chat-rail,
  .ai-chat-main,
  .ai-chat-header,
  .ai-chat-settings,
  .ai-chat-context,
  .ai-chat-messages,
  .ai-chat-composer,
  .ai-chat-start-shell,
  .ai-chat-start-options button
) {
  color: #acb8ca !important;
}

body.app-theme-dark.app-page :where(
  h1,
  h2,
  h3,
  h4,
  strong,
  label,
  .question-title,
  .preview-question h3,
  .preview-answer h4,
  .preview-solution h4,
  .library-copy strong,
  .overview-card strong,
  .mode-button strong,
  .active-scope-main strong,
  .data-status-panel strong,
  .ai-chat-title,
  .ai-chat-header h2,
  .ai-chat-rail-head strong,
  .ai-chat-bubble strong,
  .ai-chat-start-header h2,
  .ai-chat-start-options strong,
  .preference-card-head strong
) {
  color: #d7dfeb !important;
}

body.app-theme-dark.app-page :where(
  p,
  span,
  small,
  li,
  em,
  address,
  .header-desc,
  .overview-card span,
  .overview-card small,
  .library-copy small,
  .mode-button small,
  .mode-status,
  .exam-card span,
  .exam-filter-field span,
  .active-scope-main p,
  .active-scope-kicker,
  .data-status-panel span,
  .data-status-panel small,
  .answer-label,
  .ai-coach-head span,
  .ai-coach-grid p,
  .ai-coach-grid ul,
  .preview-header p,
  .preview-count,
  .preview-answer p,
  .preview-solution p,
  .ai-chat-kicker,
  .ai-chat-field span,
  .ai-chat-context p,
  .ai-chat-status,
  .ai-chat-start-options span,
  .ai-chat-start-options small,
  .ai-chat-start-summary,
  .preference-card-head span,
  .motion-toggle
) {
  color: #8794a8 !important;
}

body.app-theme-dark.app-page :where(
  input,
  textarea,
  select,
  button,
  .icon-btn,
  .secondary-action,
  .primary-action,
  .theme-segment button,
  .campus-switch button,
  .chapter-nav button,
  .toolbar button,
  .question-actions button,
  .reset-actions button,
  .pagination button,
  .preview-close,
  .preview-question-ai,
  .preview-btn,
  .ai-chat-ghost-button,
  .ai-chat-icon-button,
  .ai-chat-close,
  .ai-context-remove
) {
  color: #b4bfce !important;
}

body.app-theme-dark.app-page :where(input, textarea, select)::placeholder {
  color: #68758b !important;
}

body.app-theme-dark.app-page :where(
  .badge,
  .active-scope-pill,
  .active-scope-reset,
  .library-entry em,
  .preview-tags span,
  .ai-chat-context-chips span,
  .ai-session-item,
  .ai-chat-session-item,
  .ai-chat-context-list li,
  .ai-chat-bubble,
  .loading-telemetry span
) {
  color: #9ba8ba !important;
}

body.app-theme-dark.app-page :where(
  .library-entry:hover,
  .mode-button:hover,
  .question-actions button:hover,
  .toolbar button:hover,
  .preview-question-ai:hover,
  .ai-chat-session-item:hover,
  .ai-chat-ghost-button:hover
) {
  color: #c7d2e2 !important;
}

body.app-theme-dark.app-page :where(
  .library-entry.active,
  .mode-button.active,
  .chapter-nav button.active,
  .theme-segment button.active,
  .ai-chat-session-item.active,
  .ai-session-item.active
) {
  color: #d4e2f7 !important;
}

body.app-theme-dark.app-page :where(
  .primary-action,
  .ai-chat-new-button,
  .ai-chat-send-button,
  .data-status-panel a,
  .tip-close-button
) {
  color: #edf4ff !important;
}

body.app-theme-dark.app-page :where(.ai-chat-message.user .ai-chat-bubble) {
  color: #edf4ff !important;
}

body.app-theme-dark.app-page :where(.ai-chat-fab, .ai-chat-fab strong, .ai-chat-fab span) {
  color: #d4e2f7 !important;
}

body.app-theme-dark.app-page :where(.sync-guide-link) {
  color: #93c5fd !important;
}

body.app-theme-dark.app-page :where(.tech-loader-copy strong) {
  color: #d7dfeb !important;
}

body.app-theme-dark.app-page :where(.tech-loading-card, .tech-loader) {
  color: #acb8ca !important;
}

body.app-theme-dark.app-page :where(.tech-loader-copy small) {
  color: #8794a8 !important;
}

body.app-theme-dark.app-page :where(.hero-chips span) {
  border-color: #334155 !important;
  background: #172033 !important;
  color: #9ba8ba !important;
  box-shadow: none !important;
}

body.app-theme-dark.app-page :where(.header-stats div) {
  border-color: #334155 !important;
  background: #172033 !important;
  color: #acb8ca !important;
  box-shadow: none !important;
}

body.app-theme-dark.app-page :where(.header-stats strong) {
  color: #d7dfeb !important;
}

body.app-theme-dark.app-page :where(.header-stats span) {
  color: #8794a8 !important;
}

/* Final tag polish: compact metadata chips instead of loud pill badges. */
.app-page .badge,
.app-page .hero-chips span,
.app-page .preview-tags span,
.app-page .ai-chat-context-chips span,
.app-page .library-entry em {
  display: inline-flex;
  align-items: center;
  min-height: 1.48rem;
  max-width: 100%;
  border: 1px solid #d9e2ef;
  border-left-width: 3px;
  border-left-color: #94a3b8;
  border-radius: .38rem;
  padding: .2rem .5rem .2rem .42rem;
  background: #f8fafc;
  color: #42526a;
  box-shadow: none;
  font-size: .73rem;
  font-weight: 760;
  letter-spacing: 0;
  line-height: 1.16;
  overflow-wrap: anywhere;
  white-space: normal;
}

.app-page .question-meta {
  gap: .38rem;
  row-gap: .36rem;
}

.app-page .badge.subject,
.app-page .badge.course,
.app-page .badge.paper-type,
.app-page .badge.term {
  background: #f8fafc;
  color: #42526a;
  border-color: #d9e2ef;
  border-left-color: #94a3b8;
}

.app-page .badge.source,
.app-page .badge.exam-badge {
  background: #f4f8ff;
  color: #1e4f95;
  border-color: #bfd4f4;
  border-left-color: #2563eb;
}

.app-page .badge.topic,
.app-page .badge.type {
  background: #f4fbfb;
  color: #155e63;
  border-color: #bfe7e6;
  border-left-color: #0f9f9a;
}

.app-page .badge.difficulty {
  background: #fffaf0;
  color: #8a560d;
  border-color: #f2d58a;
  border-left-color: #d97706;
}

.app-page .preview-tags .ok {
  background: #f0fdf4;
  color: #166534;
  border-color: #bbf7d0;
  border-left-color: #16a34a;
}

.app-page .preview-tags .warn {
  background: #fff1f2;
  color: #9f1239;
  border-color: #fecdd3;
  border-left-color: #e11d48;
}

.app-page :where(.active-scope-pill, .active-scope-reset) {
  border-color: #d9e2ef;
  border-radius: .38rem;
  background: #f8fafc;
  box-shadow: none;
}

.app-page .active-scope-pill {
  gap: .36rem;
  padding: .34rem .52rem;
}

.app-page .active-scope-pill span {
  color: #6b778c;
  font-size: .68rem;
  font-weight: 820;
  letter-spacing: 0;
}

.app-page .active-scope-pill strong {
  color: #293548;
  font-size: .76rem;
  font-weight: 820;
}

.app-page .active-scope-pill i {
  color: #64748b;
}

.app-page .active-scope-reset {
  padding: .38rem .62rem;
  color: #42526a;
  font-size: .76rem;
}

.ai-selection-summary {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .38rem;
  justify-content: flex-end;
  max-width: 100%;
}

.ai-selection-summary[hidden] {
  display: none;
}

.ai-selection-summary span {
  border: 1px solid #c7d2fe;
  border-radius: .38rem;
  padding: .38rem .56rem;
  background: #eef2ff;
  color: #3730a3;
  font-size: .76rem;
  font-weight: 860;
}

.ai-selection-summary small {
  max-width: min(32rem, 100%);
  color: #475569;
  font-size: .74rem;
  font-weight: 760;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-selection-summary small[hidden] {
  display: none;
}

.ai-selection-summary button {
  min-height: 2rem;
  border: 1px solid #cbd5e1;
  border-radius: .38rem;
  padding: .34rem .58rem;
  background: #fff;
  color: #334155;
  font-size: .76rem;
  font-weight: 860;
}

.ai-selection-summary button:hover {
  border-color: #94a3b8;
  background: #f8fafc;
}

.toolbar button:disabled,
.ai-selection-summary button:disabled {
  cursor: not-allowed;
  opacity: .52;
  transform: none;
  box-shadow: none !important;
}

body.app-theme-dark.app-page .ai-start-scope-button {
  border-color: #244061 !important;
  background: #0f1b2f !important;
  color: #9bbce8 !important;
}

body.app-theme-dark.app-page .ai-start-scope-button:hover,
body.app-theme-dark.app-page .ai-start-scope-button:focus-visible {
  border-color: #3b82f6 !important;
  background: #172033 !important;
  color: #d4e2f7 !important;
}

.app-page .ai-select-context-btn.active {
  border-color: #a5b4fc !important;
  background: #eef2ff;
  color: #3730a3;
}

.app-page .active-scope-pill:hover,
.app-page .active-scope-reset:hover {
  border-color: #94a3b8;
  background: #f1f5f9;
  box-shadow: none;
  transform: none;
}

body.app-theme-dark.app-page :where(
  .badge,
  .hero-chips span,
  .preview-tags span,
  .ai-chat-context-chips span,
  .library-entry em
) {
  border-color: #29384d !important;
  border-left-color: #64748b !important;
  background: #111a2a !important;
  color: #96a3b6 !important;
  box-shadow: none !important;
}

body.app-theme-dark.app-page :where(.badge.subject, .badge.course, .badge.paper-type, .badge.term) {
  border-color: #29384d !important;
  border-left-color: #64748b !important;
  background: #111a2a !important;
  color: #96a3b6 !important;
}

body.app-theme-dark.app-page :where(.badge.source, .badge.exam-badge) {
  border-color: #244061 !important;
  border-left-color: #3b82f6 !important;
  background: #0f1b2f !important;
  color: #9bbce8 !important;
}

body.app-theme-dark.app-page :where(.badge.topic, .badge.type) {
  border-color: #1d4b50 !important;
  border-left-color: #14b8a6 !important;
  background: #0d2026 !important;
  color: #96c9c5 !important;
}

body.app-theme-dark.app-page :where(.badge.difficulty) {
  border-color: #4a3313 !important;
  border-left-color: #d97706 !important;
  background: #231a0d !important;
  color: #d4b06f !important;
}

body.app-theme-dark.app-page :where(.preview-tags .ok) {
  border-color: #14532d !important;
  border-left-color: #22c55e !important;
  background: #0b2117 !important;
  color: #98d7ad !important;
}

body.app-theme-dark.app-page :where(.preview-tags .warn) {
  border-color: #5b1b2a !important;
  border-left-color: #f43f5e !important;
  background: #251018 !important;
  color: #e6a2ad !important;
}

body.app-theme-dark.app-page :where(.active-scope-pill, .active-scope-reset) {
  border-color: #29384d !important;
  background: #111a2a !important;
  color: #96a3b6 !important;
  box-shadow: none !important;
}

body.app-theme-dark.app-page .ai-selection-summary span {
  border-color: #37306a !important;
  background: #171a35 !important;
  color: #c4c5ff !important;
}

body.app-theme-dark.app-page .ai-selection-summary button {
  border-color: #29384d !important;
  background: #111a2a !important;
  color: #b8c3d3 !important;
}

body.app-theme-dark.app-page .ai-selection-summary button:hover {
  border-color: #3f516d !important;
  background: #172033 !important;
}

body.app-theme-dark.app-page .ai-select-context-btn.active {
  border-color: #37306a !important;
  background: #171a35 !important;
  color: #c4c5ff !important;
}

body.app-theme-dark.app-page .active-scope-pill span {
  color: #7f8ca3 !important;
}

body.app-theme-dark.app-page .active-scope-pill strong {
  color: #b8c3d3 !important;
}

body.app-theme-dark.app-page .active-scope-pill i {
  color: #8fa1bc !important;
}

body.app-theme-dark.app-page :where(.active-scope-pill:hover, .active-scope-reset:hover) {
  border-color: #3f516d !important;
  background: #172033 !important;
  color: #b8c3d3 !important;
}

/* Entry reference blend: keep copy concise, borrow the clearer blue login composition. */
body.entry-page {
  --entry-blue: #2f7df6;
  --entry-cyan: #14c8ff;
  --entry-line: rgba(96, 165, 250, .42);
  --entry-panel: rgba(4, 18, 39, .82);
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 18% 56%, rgba(20, 200, 255, .12), transparent 25rem),
    radial-gradient(ellipse at 76% 18%, rgba(47, 125, 246, .2), transparent 31rem),
    radial-gradient(ellipse at 86% 78%, rgba(20, 200, 255, .16), transparent 24rem),
    linear-gradient(180deg, #020813 0%, #041326 48%, #061c36 100%);
}

body.entry-page::before {
  background:
    linear-gradient(90deg, rgba(2, 9, 21, .86) 0%, rgba(4, 21, 42, .68) 46%, rgba(3, 16, 34, .9) 100%),
    url("../images/沙河 南门.png") center / cover no-repeat;
  opacity: .7;
  filter: saturate(1.18) contrast(1.05);
}

body.entry-page::after {
  background:
    radial-gradient(ellipse at 83% 50%, rgba(77, 171, 255, .14), transparent 32rem),
    radial-gradient(ellipse at 51% 72%, rgba(20, 200, 255, .12), transparent 24rem),
    linear-gradient(90deg, rgba(20, 200, 255, .045) 1px, transparent 1px),
    linear-gradient(180deg, rgba(20, 200, 255, .03) 1px, transparent 1px);
  background-size: auto, auto, 48px 48px, 48px 48px;
  mask-image: linear-gradient(90deg, rgba(0, 0, 0, .22), rgba(0, 0, 0, .14));
}

body.entry-page .entry-photo-strip {
  opacity: .08;
  filter: saturate(1.25) hue-rotate(8deg);
}

body.entry-page .entry-shell {
  grid-template-columns: minmax(0, 1.08fr) minmax(24rem, 34rem);
  gap: clamp(2.8rem, 7vw, 10rem);
  width: min(calc(100% - clamp(4rem, 8vw, 9rem)), 110rem);
  height: calc(100dvh - 5.9rem);
  min-height: calc(100dvh - 5.9rem);
  padding: clamp(1rem, 2.2vh, 1.7rem) 0 clamp(.85rem, 1.7vh, 1.35rem);
}

body.entry-page .entry-copy {
  max-width: 48rem;
}

body.entry-page .entry-kicker {
  gap: .48rem;
  border-color: rgba(20, 200, 255, .5);
  padding: .5rem 1rem;
  background: rgba(4, 18, 39, .58);
  color: #d9edff;
  box-shadow: inset 0 0 20px rgba(20, 200, 255, .08);
}

body.entry-page .entry-kicker::before {
  content: "";
  width: .82rem;
  height: .82rem;
  border-radius: .18rem;
  background:
    linear-gradient(135deg, transparent 0 40%, #7dd3fc 42% 58%, transparent 60%),
    linear-gradient(135deg, #2f7df6, #14c8ff);
  transform: rotate(45deg);
  box-shadow: 0 0 16px rgba(20, 200, 255, .58);
}

body.entry-page .entry-copy h1 {
  max-width: 13em;
  font-size: clamp(3.2rem, 5.1vw, 5.25rem);
  text-shadow:
    0 0 2px rgba(255, 255, 255, .84),
    0 0 34px rgba(20, 200, 255, .2),
    0 22px 58px rgba(0, 0, 0, .5);
}

body.entry-page .entry-title-triad {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .04em .28em;
  max-width: 12.6em;
  color: transparent;
  letter-spacing: 0;
}

body.entry-page .entry-title-piece {
  display: inline-block;
  line-height: .98;
  white-space: nowrap;
}

body.entry-page .entry-title-piece.title-math {
  color: #8fc7ff;
  font-size: clamp(3.1rem, 4.65vw, 5.15rem);
  font-weight: 850;
  text-shadow:
    0 0 1px rgba(255, 255, 255, .72),
    0 0 22px rgba(46, 92, 138, .42),
    0 18px 46px rgba(0, 0, 0, .44);
}

body.entry-page .entry-title-piece.title-intelligent {
  color: #42a5ff;
  font-size: clamp(3.5rem, 5.45vw, 6rem);
  font-style: italic;
  font-weight: 950;
  transform: skewX(-4deg);
  text-shadow:
    0 0 2px rgba(255, 255, 255, .78),
    0 0 34px rgba(74, 144, 226, .46),
    0 24px 58px rgba(0, 0, 0, .5);
}

body.entry-page .entry-title-piece.title-bank {
  color: #ff745f;
  font-size: clamp(3rem, 4.25vw, 4.8rem);
  font-weight: 830;
  text-shadow:
    0 0 1px rgba(255, 255, 255, .62),
    0 0 26px rgba(216, 81, 64, .34),
    0 20px 50px rgba(0, 0, 0, .46);
}

body.entry-page .entry-metrics {
  gap: clamp(1rem, 2.4vw, 2.05rem);
  max-width: 43rem;
  margin-top: clamp(2.65rem, 5.1vh, 3.55rem);
}

body.entry-page .entry-metrics span {
  display: grid;
  grid-template-columns: 3.35rem minmax(0, 1fr);
  align-items: center;
  gap: .72rem;
  min-height: 3.35rem;
  padding: 0;
  border-color: transparent;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

body.entry-page .entry-metrics b {
  display: block;
  min-width: 0;
  font-style: normal;
}

body.entry-page .entry-metrics strong {
  color: #f3f8ff;
  font-size: clamp(.98rem, 1.04vw, 1.12rem);
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1.2;
  white-space: nowrap;
}

body.entry-page .entry-metrics small {
  margin-top: .16rem;
  color: #8fa8c7;
  font-size: clamp(.68rem, .76vw, .78rem);
  font-weight: 760;
  letter-spacing: 0;
  line-height: 1.25;
  white-space: nowrap;
}

body.entry-page .entry-symbol {
  position: relative;
  flex: 0 0 auto;
  width: 3rem;
  height: 3rem;
  border: 1px solid rgba(96, 165, 250, .64);
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(20, 200, 255, .22), transparent 62%),
    rgba(7, 24, 52, .84);
  box-shadow:
    0 0 18px rgba(20, 200, 255, .24),
    inset 0 0 18px rgba(47, 125, 246, .16);
}

body.entry-page .entry-symbol::before,
body.entry-page .entry-symbol::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

body.entry-page .entry-symbol-paper::before {
  width: 1.18rem;
  height: 1.24rem;
  border: 2px solid #60a5fa;
  border-top: 0;
  border-radius: 0 0 .56rem .56rem;
  transform: translate(-50%, -38%);
}

body.entry-page .entry-symbol-paper::after {
  width: 1.18rem;
  height: .42rem;
  border: 2px solid #93c5fd;
  border-radius: 50%;
  background: rgba(20, 200, 255, .1);
  box-shadow:
    0 .38rem 0 -1px rgba(7, 24, 52, .9),
    0 .38rem 0 0 #60a5fa,
    0 .76rem 0 -1px rgba(7, 24, 52, .9),
    0 .76rem 0 0 #60a5fa;
  transform: translate(-50%, -80%);
}

body.entry-page .entry-symbol-folder::before {
  width: 1.15rem;
  height: .82rem;
  border: 2px solid #60a5fa;
  border-radius: .14rem;
  background: rgba(20, 200, 255, .12);
}

body.entry-page .entry-symbol-folder::after {
  width: .48rem;
  height: .18rem;
  left: 44%;
  top: 36%;
  border-radius: .12rem .12rem 0 0;
  background: #60a5fa;
}

body.entry-page .entry-symbol-ai::before {
  width: 1.3rem;
  height: 1.3rem;
  border: 2px solid #60a5fa;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 32%, #bde8ff 0 1.6px, transparent 2.2px),
    radial-gradient(circle at 68% 32%, #bde8ff 0 1.6px, transparent 2.2px),
    radial-gradient(circle at 50% 68%, #bde8ff 0 1.6px, transparent 2.2px),
    rgba(20, 200, 255, .12);
}

body.entry-page .entry-symbol-ai::after {
  width: .88rem;
  height: .68rem;
  border-top: 2px solid #93c5fd;
  border-left: 2px solid #93c5fd;
  border-right: 2px solid #93c5fd;
  border-radius: .5rem .5rem .18rem .18rem;
  background: transparent;
}

body.entry-page .entry-actions {
  gap: 1rem;
  max-width: 39rem;
  margin-top: clamp(.9rem, 1.8vh, 1.25rem);
}

body.entry-page .entry-action-primary,
body.entry-page .entry-action-secondary {
  grid-template-columns: minmax(0, 1fr) 1.8rem;
  min-width: 0;
  width: min(100%, 11.4rem);
  min-height: 3.45rem;
  gap: .65rem;
  padding: .78rem .82rem .78rem 1rem;
  border-radius: 9px;
}

body.entry-page .entry-action-primary {
  background:
    linear-gradient(135deg, #2f65f4 0%, #1f90ff 54%, #12d5ee 100%);
  box-shadow:
    0 20px 45px rgba(47, 125, 246, .25),
    inset 0 1px 0 rgba(255, 255, 255, .2);
}

body.entry-page .entry-action-primary i,
body.entry-page .entry-action-secondary i {
  position: relative;
  width: 1.45rem;
  height: 1.45rem;
  border: 1px solid rgba(219, 234, 254, .62);
  border-radius: 50%;
}

body.entry-page .entry-action-primary i::before,
body.entry-page .entry-action-secondary i::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: .42rem;
  height: .42rem;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  transform: translate(-62%, -50%) rotate(45deg);
}

body.entry-page .entry-action-secondary {
  border-color: rgba(96, 165, 250, .42);
  background: rgba(4, 18, 39, .5);
}

body.entry-page .entry-card {
  width: min(100%, 34rem);
  max-height: calc(100dvh - 7.15rem);
  border-radius: 1.35rem;
  border-color: rgba(96, 165, 250, .54);
  padding: 1.38rem 1.5rem;
  background:
    linear-gradient(90deg, rgba(96, 165, 250, .08) 1px, transparent 1px),
    linear-gradient(180deg, rgba(96, 165, 250, .055) 1px, transparent 1px),
    linear-gradient(145deg, rgba(5, 20, 43, .92), rgba(4, 18, 39, .74));
  background-size: 28px 28px, 28px 28px, auto;
  box-shadow:
    0 0 0 1px rgba(20, 200, 255, .12),
    0 30px 90px rgba(0, 0, 0, .45),
    0 0 42px rgba(20, 200, 255, .12),
    inset 0 1px 0 rgba(255, 255, 255, .12);
}

body.entry-page .entry-card::before {
  display: none;
  content: none;
}

body.entry-page .entry-card::after {
  display: none;
  content: none;
}

body.entry-page .brand-line {
  position: relative;
  display: grid;
  grid-template-columns: 3.45rem minmax(0, 1fr);
  align-items: center;
  gap: .92rem;
  min-height: 4.1rem;
  margin: -.1rem 0 .82rem;
  padding: 0 0 .9rem;
  border-bottom: 1px solid rgba(96, 165, 250, .22);
}

body.entry-page .brand-line::after {
  content: "";
  position: absolute;
  left: 4.35rem;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, rgba(20, 200, 255, .65), transparent 72%);
}

body.entry-page .brand-line > div {
  display: grid;
  gap: .16rem;
  min-width: 0;
}

body.entry-page .brand-emblem {
  display: grid;
  place-items: center;
  width: 3.35rem;
  height: 3.35rem;
  border: 1px solid rgba(125, 211, 252, .34);
  border-radius: 50%;
  padding: .18rem;
  background:
    radial-gradient(circle at 35% 24%, rgba(219, 234, 254, .18), transparent 35%),
    rgba(7, 24, 52, .58);
  box-shadow:
    0 0 0 4px rgba(14, 165, 233, .07),
    0 0 28px rgba(56, 189, 248, .2);
}

body.entry-page .brand-sigma {
  position: relative;
  isolation: isolate;
  overflow: visible;
  border-color: rgba(147, 197, 253, .74);
  padding: 0;
  background:
    radial-gradient(circle at 50% 48%, rgba(30, 64, 175, .42), rgba(8, 22, 50, .92) 62%),
    rgba(4, 18, 39, .9);
  color: #f8fbff;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.72rem;
  font-weight: 900;
  line-height: 1;
  text-shadow:
    0 0 7px rgba(255, 255, 255, .7),
    0 0 18px rgba(96, 165, 250, .74);
  box-shadow:
    0 0 0 1px rgba(191, 219, 254, .18),
    0 0 0 4px rgba(59, 130, 246, .13),
    0 0 24px rgba(56, 189, 248, .38),
    0 0 38px rgba(168, 85, 247, .24),
    inset 0 0 18px rgba(96, 165, 250, .16);
}

body.entry-page .brand-sigma::before {
  content: "";
  position: absolute;
  inset: -.28rem;
  z-index: -1;
  border-radius: inherit;
  background:
    radial-gradient(circle at 68% 18%, rgba(168, 85, 247, .52), transparent 26%),
    radial-gradient(circle at 22% 68%, rgba(14, 165, 233, .46), transparent 30%);
  filter: blur(10px);
  opacity: .72;
}

body.entry-page .entry-card h2 {
  color: #f3f8ff;
  font-size: clamp(1.34rem, 1.9vw, 1.54rem);
  font-weight: 880;
  letter-spacing: 0;
  line-height: 1.12;
}

body.entry-page .brand-school {
  margin: 0;
  color: #83c5ff;
  font-size: .78rem;
  font-weight: 850;
  letter-spacing: .01em;
}

body.entry-page .entry-subtitle {
  margin: 0 0 .92rem;
  padding-bottom: .9rem;
  border-bottom: 1px solid rgba(96, 165, 250, .12);
  color: #c4d6eb;
  font-size: .9rem;
  line-height: 1.56;
}

body.entry-page .entry-auth-tabs {
  position: relative;
  gap: 0;
  border-color: rgba(96, 165, 250, .28);
  border-radius: 8px;
  padding: 0;
  background: rgba(4, 18, 39, .52);
  overflow: hidden;
  margin-bottom: .72rem;
}

body.entry-page .entry-auth-tabs button {
  position: relative;
  min-height: 2.86rem;
  border-radius: 0;
  color: #dbeafe;
}

body.entry-page .entry-auth-tabs button + button {
  border-left: 1px solid rgba(96, 165, 250, .16);
}

body.entry-page .entry-auth-tabs button.active {
  background: rgba(47, 125, 246, .08);
  box-shadow: inset 0 -2px 0 #67b7ff, inset 0 -10px 20px rgba(20, 200, 255, .1);
}

body.entry-page .entry-input-group {
  position: relative;
}

body.entry-page .entry-input-group + .entry-input-group {
  margin-top: .64rem;
}

body.entry-page .has-entry-icon::before {
  content: "";
  position: absolute;
  left: 1.02rem;
  top: 2.68rem;
  z-index: 1;
  width: 1.05rem;
  height: 1.05rem;
  opacity: .76;
  pointer-events: none;
}

body.entry-page .has-entry-icon.is-user::before {
  border-radius: 50% 50% 42% 42%;
  background:
    radial-gradient(circle at 50% 28%, #9db9d8 0 .24rem, transparent .25rem),
    radial-gradient(ellipse at 50% 82%, #9db9d8 0 .44rem, transparent .45rem);
}

body.entry-page .has-entry-icon.is-lock::before {
  border: 2px solid #9db9d8;
  border-top-width: .45rem;
  border-radius: .2rem;
  box-shadow: 0 -.42rem 0 -.16rem #06172f, 0 -.42rem 0 -.08rem #9db9d8;
}

body.entry-page .entry-input-group input {
  height: 2.95rem;
  padding-left: 3.05rem;
  border-color: rgba(96, 165, 250, .34);
  background: rgba(2, 10, 23, .44);
}

body.entry-page .entry-input-group input:focus {
  border-color: rgba(103, 183, 255, .9);
  box-shadow:
    0 0 0 3px rgba(20, 200, 255, .13),
    inset 0 1px 0 rgba(255, 255, 255, .08);
}

body.entry-page .entry-input-hint {
  min-height: .92rem;
  margin-top: .22rem;
  color: #a9bdd5;
}

body.entry-page .primary-button {
  min-height: 3.08rem;
  border: 1px solid rgba(20, 200, 255, .38);
  border-radius: 9px;
  background: linear-gradient(135deg, #315ff4 0%, #1d8eff 58%, #14c8ff 100%);
  box-shadow:
    0 20px 45px rgba(47, 125, 246, .26),
    inset 0 1px 0 rgba(255, 255, 255, .2);
}

body.entry-page .entry-divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: .82rem;
  margin: .82rem 0 .72rem;
  color: #a9bdd5;
  font-weight: 800;
}

body.entry-page .entry-divider::before,
body.entry-page .entry-divider::after {
  content: "";
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(148, 197, 253, .42));
}

body.entry-page .entry-divider::after {
  background: linear-gradient(90deg, rgba(148, 197, 253, .42), transparent);
}

body.entry-page .ghost-entry-button {
  min-height: 2.72rem;
  border-color: rgba(96, 165, 250, .32);
  border-radius: 8px;
  background: rgba(4, 18, 39, .42);
}

body.entry-page .ghost-entry-button:hover {
  border-color: rgba(125, 211, 252, .72);
  background: rgba(12, 35, 68, .68);
}

body.entry-page .entry-info-strip {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  isolation: isolate;
  display: grid;
  grid-template-columns: repeat(4, minmax(8rem, .78fr)) minmax(18rem, 1.34fr) minmax(17.8rem, 1.44fr);
  gap: clamp(.5rem, 1.1vw, 1rem);
  align-items: center;
  min-height: 5.9rem;
  padding: .82rem clamp(1rem, 2.5vw, 2rem) .86rem;
  border-top: 1px solid rgba(81, 148, 237, .2);
  border-bottom: 2px solid rgba(41, 174, 255, .82);
  background:
    linear-gradient(90deg, rgba(4, 18, 39, .96), rgba(5, 25, 49, .9) 42%, rgba(3, 16, 34, .97)),
    linear-gradient(180deg, rgba(38, 126, 235, .14), rgba(11, 42, 78, .16)),
    linear-gradient(90deg, rgba(91, 155, 235, .055) 1px, transparent 1px),
    linear-gradient(180deg, rgba(91, 155, 235, .04) 1px, transparent 1px);
  background-size: auto, auto, 48px 48px, 48px 48px;
  box-shadow:
    0 -24px 78px rgba(0, 0, 0, .3),
    inset 0 1px 0 rgba(147, 197, 253, .08),
    inset 0 -1px 0 rgba(125, 211, 252, .26);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

body.entry-page .entry-info-strip::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 8% 0%, rgba(34, 160, 255, .16), transparent 13rem),
    radial-gradient(circle at 86% 20%, rgba(42, 123, 239, .14), transparent 16rem);
  pointer-events: none;
}

body.entry-page .entry-info-item {
  position: relative;
  min-width: 0;
  display: grid;
  grid-template-columns: clamp(3.7rem, 4.2vw, 4.45rem) minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: .95rem;
  align-items: center;
  color: #dbeafe;
  text-decoration: none;
}

body.entry-page .entry-info-icon {
  position: relative;
  grid-row: 1 / 3;
  display: grid;
  place-items: center;
  width: clamp(2.8rem, 3.25vw, 3.35rem);
  height: clamp(2.8rem, 3.25vw, 3.35rem);
  border: 1px solid rgba(96, 165, 250, .66);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 42%, rgba(117, 199, 255, .2), transparent 58%),
    rgba(7, 28, 58, .72);
  box-shadow:
    0 0 0 1px rgba(28, 120, 235, .22),
    0 0 25px rgba(47, 125, 246, .2),
    inset 0 0 20px rgba(89, 152, 236, .16);
}

body.entry-page .entry-info-contact .entry-info-icon {
  width: clamp(2.75rem, 3.05vw, 3.15rem);
  height: clamp(2.75rem, 3.05vw, 3.15rem);
  border-radius: 1rem;
}

body.entry-page .entry-info-strip > a.entry-info-contact:first-of-type {
  padding-left: clamp(1rem, 1.5vw, 1.35rem);
}

body.entry-page .entry-info-strip > a.entry-info-contact:first-of-type::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 1px;
  height: 4.05rem;
  transform: translateY(-50%);
  background: linear-gradient(180deg, transparent, rgba(77, 157, 255, .56), transparent);
}

body.entry-page .entry-info-contact {
  grid-template-columns: clamp(3rem, 3.25vw, 3.35rem) minmax(0, 1fr);
  column-gap: .74rem;
}

body.entry-page .entry-info-icon::before,
body.entry-page .entry-info-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

body.entry-page .info-pin::before {
  width: 1.18rem;
  height: 1.18rem;
  border: 2px solid #bde8ff;
  border-radius: 50% 50% 50% 0;
  transform: translate(-50%, -58%) rotate(-45deg);
}

body.entry-page .info-pin::after {
  width: .32rem;
  height: .32rem;
  border-radius: 50%;
  background: #bde8ff;
  transform: translate(-50%, -72%);
}

body.entry-page .info-filter::before {
  width: 1.2rem;
  height: 1.08rem;
  border: 2px solid #bde8ff;
  border-bottom-left-radius: .42rem;
  border-bottom-right-radius: .42rem;
  border-top-left-radius: .16rem;
  border-top-right-radius: .16rem;
  transform: translate(-50%, -62%);
}

body.entry-page .info-filter::after {
  width: .78rem;
  height: .48rem;
  border-bottom: 2px solid #bde8ff;
  border-left: 2px solid #bde8ff;
  border-right: 2px solid #bde8ff;
  transform: translate(-50%, .35rem);
  box-shadow: 0 .34rem 0 -.12rem #bde8ff;
}

body.entry-page .info-bookmark::before {
  width: 1.06rem;
  height: 1.46rem;
  border: 2px solid #bde8ff;
  border-bottom: 0;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 72%, 0 100%);
}

body.entry-page .info-bookmark::after {
  width: .48rem;
  height: .48rem;
  background: #bde8ff;
  clip-path: polygon(50% 0, 62% 35%, 100% 35%, 69% 56%, 80% 92%, 50% 70%, 20% 92%, 31% 56%, 0 35%, 38% 35%);
  transform: translate(-50%, -58%);
}

body.entry-page .info-ai::before {
  width: 1.28rem;
  height: 1.28rem;
  border: 2px solid #bde8ff;
  border-radius: 46% 46% 42% 42%;
  background:
    radial-gradient(circle at 58% 35%, #bde8ff 0 .11rem, transparent .12rem),
    radial-gradient(circle at 44% 60%, #bde8ff 0 .1rem, transparent .11rem);
}

body.entry-page .info-ai::after {
  width: .62rem;
  height: .76rem;
  border-left: 2px solid #bde8ff;
  border-bottom: 2px solid #bde8ff;
  border-radius: 0 0 0 .34rem;
  transform: translate(-7%, -10%);
}

body.entry-page .info-phone::before {
  width: 1.25rem;
  height: 1.25rem;
  border-left: 5px solid #bde8ff;
  border-bottom: 5px solid #bde8ff;
  border-radius: .18rem 0 .52rem .22rem;
  transform: translate(-50%, -50%) rotate(-32deg);
}

body.entry-page .info-mail::before {
  width: 1.42rem;
  height: 1.02rem;
  border: 2px solid #bde8ff;
  border-radius: .18rem;
}

body.entry-page .info-mail::after {
  width: .9rem;
  height: .9rem;
  border-top: 2px solid #bde8ff;
  border-right: 2px solid #bde8ff;
  transform: translate(-50%, -66%) rotate(135deg);
}

body.entry-page .entry-info-item strong,
body.entry-page .entry-info-item small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.entry-page .entry-info-item strong {
  color: #eaf5ff;
  font-size: clamp(.92rem, 1.02vw, 1.08rem);
  font-weight: 900;
  letter-spacing: 0;
  text-shadow: 0 0 18px rgba(154, 207, 255, .12);
}

body.entry-page .entry-info-contact strong {
  font-size: clamp(.98rem, 1.05vw, 1.1rem);
}

body.entry-page .entry-info-contact[href^="tel:"] strong {
  overflow: visible;
  text-overflow: clip;
}

body.entry-page .entry-info-item small {
  margin-top: .12rem;
  color: #9eb6d2;
  font-size: clamp(.72rem, .82vw, .86rem);
  font-weight: 750;
  letter-spacing: 0;
}

@media (max-width: 1180px) {
  body.entry-page .entry-info-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  body.entry-page .entry-shell {
    padding-bottom: 12.5rem;
  }
}

@media (max-width: 980px) {
  body.entry-page {
    height: auto;
    overflow-x: hidden;
    overflow-y: auto;
  }

  body.entry-page .entry-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: auto;
    padding-bottom: 13rem;
  }

  body.entry-page .entry-title-triad {
    max-width: 100%;
    gap: .02em .22em;
  }

  body.entry-page .entry-title-piece.title-math {
    font-size: clamp(2.65rem, 8vw, 4.2rem);
  }

  body.entry-page .entry-title-piece.title-intelligent {
    font-size: clamp(3rem, 9vw, 4.85rem);
  }

  body.entry-page .entry-title-piece.title-bank {
    font-size: clamp(2.55rem, 7.4vw, 3.9rem);
  }

  body.entry-page .entry-card {
    justify-self: stretch;
    width: min(100%, 36rem);
  }
}

@media (max-width: 680px) {
  body.entry-page .entry-info-strip {
    position: relative;
    grid-template-columns: 1fr 1fr;
    padding: .9rem .85rem 1rem;
  }

  body.entry-page .entry-info-strip > a.entry-info-contact:first-of-type {
    padding-left: 0;
  }

  body.entry-page .entry-info-strip > a.entry-info-contact:first-of-type::before {
    display: none;
  }

  body.entry-page .entry-shell {
    min-height: auto;
    padding-bottom: 1.2rem;
  }

  body.entry-page .entry-title-triad {
    gap: .12rem .42rem;
  }

  body.entry-page .entry-title-piece.title-math {
    font-size: clamp(2.15rem, 12vw, 3.15rem);
  }

  body.entry-page .entry-title-piece.title-intelligent {
    font-size: clamp(2.45rem, 13.5vw, 3.55rem);
    transform: skewX(-3deg);
  }

  body.entry-page .entry-title-piece.title-bank {
    font-size: clamp(2.05rem, 10.5vw, 2.95rem);
  }

  body.entry-page .entry-card {
    width: 100%;
    max-width: calc(100vw - 1.7rem);
    padding: 1.2rem;
  }
}

@media (max-width: 520px) {
  body.entry-page .entry-metrics {
    grid-template-columns: 1fr;
  }

  body.entry-page .entry-info-strip {
    grid-template-columns: 1fr;
  }

  body.entry-page .entry-title-triad {
    gap: .05rem .36rem;
  }
}

/* Practice dashboard reference blend. */
body.app-page {
  --practice-bg: #030913;
  --practice-rail: #050a12;
  --practice-panel: rgba(9, 19, 32, .86);
  --practice-panel-strong: rgba(11, 25, 43, .94);
  --practice-line: rgba(76, 126, 190, .26);
  --practice-line-strong: rgba(76, 150, 255, .54);
  --practice-text: #edf5ff;
  --practice-muted: #8fa2ba;
  --practice-blue: #2f7df6;
  --practice-cyan: #18c7f7;
  --practice-green: #23bf6f;
  --practice-red: #ef5757;
  --practice-yellow: #f3c72f;
  --practice-purple: #7c5cff;
  position: relative;
  isolation: isolate;
  display: flex;
  min-height: 100dvh;
  overflow-x: hidden;
  background:
    linear-gradient(90deg, rgba(47, 125, 246, .055) 1px, transparent 1px),
    linear-gradient(180deg, rgba(47, 125, 246, .045) 1px, transparent 1px),
    radial-gradient(circle at 82% 22%, rgba(24, 199, 247, .16), transparent 26rem),
    radial-gradient(circle at 22% 70%, rgba(47, 125, 246, .13), transparent 28rem),
    linear-gradient(180deg, #020814 0%, #061326 58%, #020812 100%) !important;
  background-size: 36px 36px, 36px 36px, auto, auto, auto !important;
  color: var(--practice-text) !important;
  letter-spacing: 0;
}

body.app-page::before,
body.app-page::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body.app-page::before {
  z-index: -2;
  background:
    linear-gradient(90deg, rgba(2, 8, 20, .9), rgba(4, 15, 31, .72) 48%, rgba(2, 8, 20, .92)),
    url("../images/西土城 科学会堂.png") center / cover no-repeat;
  opacity: .22;
  filter: saturate(1.18) contrast(1.05);
}

body.app-page::after {
  z-index: -1;
  background:
    linear-gradient(135deg, transparent 0 37%, rgba(24, 199, 247, .14) 37.1%, transparent 37.24% 100%),
    linear-gradient(25deg, transparent 0 63%, rgba(47, 125, 246, .16) 63.1%, transparent 63.22% 100%),
    radial-gradient(circle at 72% 76%, rgba(47, 125, 246, .18), transparent 18rem);
  opacity: .85;
}

body.app-page > .sidebar,
body.app-page > .content,
body.app-page > .floating-timer {
  position: relative;
  z-index: 1;
}

body.app-page > .sidebar {
  flex: 0 0 14.2rem;
  width: 14.2rem;
  height: 100dvh;
  padding: 1.1rem .95rem;
  border-right: 1px solid rgba(78, 145, 235, .24) !important;
  background:
    linear-gradient(180deg, rgba(4, 11, 22, .98), rgba(2, 7, 15, .99)) !important;
  box-shadow: 14px 0 44px rgba(0, 0, 0, .28) !important;
  color: var(--practice-text) !important;
}

body.app-page .sidebar-brand {
  gap: .72rem;
  margin-bottom: 1.25rem;
}

body.app-page .sidebar-brand .brand-emblem {
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid rgba(76, 150, 255, .54);
  border-radius: 50%;
  padding: .16rem;
  background: rgba(8, 24, 50, .74);
  box-shadow: 0 0 22px rgba(47, 125, 246, .22);
}

body.app-page .sidebar-brand h1 {
  color: #f4f9ff !important;
  font-size: .95rem;
  line-height: 1.15;
}

body.app-page .sidebar-brand p {
  color: var(--practice-muted) !important;
  font-size: .76rem;
}

body.app-page .campus-card,
body.app-page .author-card {
  display: none !important;
}

body.app-page .chapter-nav {
  gap: .35rem;
  padding-top: .25rem;
}

body.app-page .chapter-nav button {
  position: relative;
  display: grid;
  grid-template-columns: 1.9rem minmax(0, 1fr) .8rem;
  align-items: center;
  min-height: 2.62rem;
  border: 1px solid transparent !important;
  border-radius: 8px;
  padding: .55rem .68rem;
  background: transparent !important;
  color: #91a4be !important;
  font-size: .86rem;
  font-weight: 780;
}

body.app-page .chapter-nav button::before {
  content: "∑";
  display: grid;
  place-items: center;
  width: 1.35rem;
  height: 1.35rem;
  color: #2f8bff;
  font-size: .98rem;
  line-height: 1;
}

body.app-page .chapter-nav button[data-chapter="all"]::before { content: "▦"; }
body.app-page .chapter-nav button[data-chapter="limit"]::before { content: "lim"; font-size: .62rem; font-weight: 900; }
body.app-page .chapter-nav button[data-chapter="derivative"]::before { content: "ƒ"; }
body.app-page .chapter-nav button[data-chapter="integral"]::before { content: "∫"; }
body.app-page .chapter-nav button[data-chapter="multi"]::before { content: "×"; }
body.app-page .chapter-nav button[data-chapter="series"]::before { content: "Σ"; }
body.app-page .chapter-nav button[data-chapter="ode"]::before { content: "y'"; font-size: .72rem; font-weight: 900; }

body.app-page .chapter-nav button::after {
  content: "›";
  color: rgba(185, 211, 246, .54);
  font-size: 1.1rem;
}

body.app-page .chapter-nav button.active,
body.app-page .chapter-nav button:hover {
  border-color: rgba(76, 150, 255, .22) !important;
  background: linear-gradient(90deg, rgba(47, 125, 246, .18), rgba(24, 199, 247, .04)) !important;
  color: #dbeafe !important;
}

body.app-page .sync-panel {
  position: relative;
  margin-top: auto;
  min-height: 6.6rem;
  border: 1px solid rgba(78, 145, 235, .18) !important;
  border-radius: 8px;
  padding: .9rem .86rem .88rem 4.1rem;
  background: linear-gradient(135deg, rgba(12, 27, 47, .96), rgba(5, 12, 23, .92)) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05) !important;
}

body.app-page .sync-panel::before {
  content: "";
  position: absolute;
  left: .92rem;
  top: .95rem;
  width: 2.55rem;
  height: 2.55rem;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 34%, #d8ebff 0 .34rem, transparent .36rem),
    radial-gradient(ellipse at 50% 80%, #d8ebff 0 .68rem, transparent .7rem),
    linear-gradient(135deg, #2f7df6, #18c7f7);
  box-shadow: 0 0 24px rgba(47, 125, 246, .4);
}

body.app-page .sync-panel::after {
  content: "";
  position: absolute;
  left: .9rem;
  right: .9rem;
  bottom: .78rem;
  height: .28rem;
  border-radius: 999px;
  background:
    linear-gradient(90deg, var(--practice-blue) 0 52%, rgba(73, 92, 118, .44) 52% 100%);
}

body.app-page .sync-panel p {
  color: #d9e7f8 !important;
  font-size: .78rem;
  font-weight: 800;
}

body.app-page .sync-panel p:first-child {
  margin-bottom: .38rem;
  color: #f4f9ff !important;
  font-weight: 900;
}

body.app-page .sync-panel button,
body.app-page .sync-guide-link {
  color: #8abfff !important;
  font-size: .76rem;
  text-decoration: none;
}

body.app-page > .content {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  width: calc(100% - 14.2rem);
  max-width: none;
  gap: 1rem;
  margin: 0;
  padding: 1.15rem 1.85rem 2rem;
}

body.app-page .toolbar {
  order: 1;
  display: grid !important;
  grid-template-columns: minmax(18rem, 1fr) minmax(6.8rem, .32fr) minmax(6.8rem, .32fr) minmax(6.8rem, .32fr) 4.7rem;
  align-items: center;
  gap: .62rem;
  width: min(100%, 56.5rem);
  margin: 0 9.2rem 0 0;
  padding: .72rem;
  border: 1px solid rgba(76, 150, 255, .22) !important;
  border-radius: 8px;
  background: rgba(8, 17, 29, .84) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), 0 18px 50px rgba(0, 0, 0, .2) !important;
  backdrop-filter: blur(14px);
}

body.app-page .toolbar #subject-filter,
body.app-page .toolbar #course-filter,
body.app-page .toolbar #source-kind-filter,
body.app-page .toolbar #paper-type-filter,
body.app-page .toolbar #type-filter,
body.app-page .toolbar #shuffle-button,
body.app-page .toolbar #preview-current-button,
body.app-page .toolbar #ai-selected-ask,
body.app-page .toolbar #ai-paper-ask,
body.app-page .toolbar #sync-button {
  display: none !important;
}

body.app-page .toolbar #search-input { order: 1; }
body.app-page .toolbar #difficulty-filter { order: 2; }
body.app-page .toolbar #term-filter { order: 3; }
body.app-page .toolbar #progress-filter { order: 4; }
body.app-page .toolbar #reset-filters-button { order: 5; }

body.app-page .toolbar input,
body.app-page .toolbar select,
body.app-page .toolbar button {
  height: 2.82rem;
  min-height: 2.82rem;
  border: 1px solid rgba(95, 132, 178, .32) !important;
  border-radius: 7px;
  background: rgba(5, 13, 24, .9) !important;
  color: #dcecff !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04) !important;
  font-size: .82rem;
  font-weight: 760;
}

body.app-page .toolbar input {
  padding-left: 3.1rem;
  background:
    radial-gradient(circle at 1.65rem 50%, transparent 0 .46rem, rgba(151, 172, 200, .78) .48rem .54rem, transparent .56rem),
    linear-gradient(45deg, transparent 0 54%, rgba(151, 172, 200, .78) 54% 62%, transparent 62%),
    rgba(5, 13, 24, .9) !important;
  background-size: 2.8rem 100%, .9rem .9rem, auto !important;
  background-position: 0 0, 2.1rem 1.75rem, 0 0 !important;
  background-repeat: no-repeat !important;
}

body.app-page .toolbar input::placeholder {
  color: #697b91 !important;
}

body.app-page .toolbar select {
  padding: 0 2rem 0 .85rem;
}

body.app-page .toolbar input:focus,
body.app-page .toolbar select:focus {
  border-color: rgba(76, 150, 255, .72) !important;
  box-shadow: 0 0 0 3px rgba(47, 125, 246, .16) !important;
}

body.app-page .toolbar #reset-filters-button {
  color: #e5f1ff !important;
}

body.app-page .content-header {
  order: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(24rem, .58fr);
  align-items: center;
  min-height: 9.4rem;
  padding: 1.45rem 1.55rem;
  border: 1px solid rgba(76, 150, 255, .2) !important;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(14, 28, 46, .88), rgba(8, 18, 31, .82)) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), 0 22px 56px rgba(0, 0, 0, .24) !important;
}

body.app-page .content-header::before {
  background:
    linear-gradient(90deg, rgba(76, 150, 255, .06) 1px, transparent 1px),
    linear-gradient(180deg, rgba(76, 150, 255, .045) 1px, transparent 1px),
    radial-gradient(circle at 80% 30%, rgba(24, 199, 247, .1), transparent 18rem) !important;
  background-size: 28px 28px, 28px 28px, auto !important;
}

body.app-page .hero-campus-image {
  right: 32%;
  width: 20rem;
  opacity: .07;
  filter: saturate(1.2) brightness(1.2);
}

body.app-page .eyebrow {
  color: #70bbff !important;
  letter-spacing: 0;
  text-transform: none;
}

body.app-page .content-header h2 {
  color: #f7fbff !important;
  font-size: 1.75rem;
  line-height: 1.16;
}

body.app-page .header-desc {
  max-width: 34rem;
  color: #9baec4 !important;
  font-size: .9rem;
  line-height: 1.72;
}

body.app-page .hero-chips {
  gap: .42rem;
  margin-top: .8rem;
}

body.app-page .hero-chips span {
  border-color: rgba(76, 150, 255, .28) !important;
  border-left-width: 1px;
  border-radius: 6px;
  background: rgba(13, 35, 68, .55) !important;
  color: #7fb9ff !important;
  font-size: .72rem;
}

body.app-page .header-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .9rem;
  align-self: center;
}

body.app-page .header-stats div {
  display: grid;
  grid-template-columns: 3.15rem minmax(0, 1fr);
  grid-template-rows: auto auto;
  min-width: 0;
  min-height: 5.2rem;
  align-items: center;
  column-gap: .85rem;
  border: 1px solid rgba(76, 150, 255, .2) !important;
  border-radius: 8px;
  padding: .92rem;
  background: rgba(7, 18, 33, .8) !important;
  text-align: left;
  box-shadow: none !important;
}

body.app-page .header-stats div::before {
  content: "";
  grid-row: 1 / 3;
  width: 2.55rem;
  height: 2.55rem;
  border-radius: 50%;
  background:
    linear-gradient(135deg, rgba(47, 125, 246, .36), rgba(24, 199, 247, .13)),
    rgba(12, 31, 62, .9);
  box-shadow: 0 0 22px rgba(47, 125, 246, .24);
}

body.app-page .header-stats div:nth-child(2)::before {
  background:
    linear-gradient(135deg, rgba(239, 87, 87, .42), rgba(239, 87, 87, .12)),
    rgba(49, 17, 22, .9);
  box-shadow: 0 0 22px rgba(239, 87, 87, .28);
}

body.app-page .header-stats div:nth-child(3)::before {
  background:
    linear-gradient(135deg, rgba(243, 199, 47, .46), rgba(243, 199, 47, .12)),
    rgba(47, 38, 14, .9);
  box-shadow: 0 0 22px rgba(243, 199, 47, .22);
}

body.app-page .header-stats strong {
  color: #f4f9ff !important;
  font-size: 1.45rem;
  line-height: 1;
}

body.app-page .header-stats span {
  color: #8699b0 !important;
  font-size: .76rem;
}

body.app-page .mode-panel {
  order: 3;
  margin: 0;
  padding: 0;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

body.app-page .mode-switch {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

body.app-page .mode-button {
  position: relative;
  display: grid;
  grid-template-columns: 4.6rem minmax(0, 1fr) 2.1rem;
  align-items: center;
  min-height: 6.2rem;
  border: 1px solid rgba(47, 125, 246, .38) !important;
  border-radius: 8px;
  padding: 1rem 1.15rem;
  background:
    linear-gradient(135deg, rgba(47, 125, 246, .14), rgba(9, 22, 38, .78)) !important;
  color: var(--practice-text) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05) !important;
}

body.app-page .mode-button:nth-child(2) {
  border-color: rgba(35, 191, 111, .36) !important;
  background:
    linear-gradient(135deg, rgba(35, 191, 111, .13), rgba(9, 22, 38, .78)) !important;
}

body.app-page .mode-button::before {
  content: "";
  grid-row: 1 / 3;
  width: 3.2rem;
  height: 3.2rem;
  border: 1px solid rgba(76, 150, 255, .48);
  border-radius: 8px;
  background:
    linear-gradient(180deg, #5da2ff 0 17%, transparent 17% 28%, #5da2ff 28% 41%, transparent 41% 52%, #5da2ff 52% 65%, transparent 65%),
    linear-gradient(135deg, rgba(47, 125, 246, .92), rgba(24, 199, 247, .22));
  box-shadow: 0 0 24px rgba(47, 125, 246, .28);
}

body.app-page .mode-button:nth-child(2)::before {
  border-color: rgba(35, 191, 111, .56);
  background:
    linear-gradient(180deg, #7cf3ad 0 17%, transparent 17% 28%, #7cf3ad 28% 41%, transparent 41% 52%, #7cf3ad 52% 65%, transparent 65%),
    linear-gradient(135deg, rgba(35, 191, 111, .94), rgba(35, 191, 111, .18));
  box-shadow: 0 0 24px rgba(35, 191, 111, .28);
}

body.app-page .mode-button::after {
  content: "›";
  display: grid;
  place-items: center;
  grid-row: 1 / 3;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: rgba(47, 125, 246, .14);
  color: #65b2ff;
  font-size: 1.45rem;
}

body.app-page .mode-button:nth-child(2)::after {
  background: rgba(35, 191, 111, .13);
  color: #66dc91;
}

body.app-page .mode-button strong {
  color: #f4f9ff !important;
  font-size: 1.02rem;
}

body.app-page .mode-button small,
body.app-page .mode-status {
  color: #91a4ba !important;
  font-size: .8rem;
}

body.app-page .mode-status:empty {
  display: none;
}

body.app-page .library-panel {
  order: 4;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: .9rem;
  margin: 0;
  padding: 0;
  border: 0 !important;
  overflow: visible;
  background: transparent !important;
  box-shadow: none !important;
}

body.app-page .library-entry {
  display: grid;
  grid-template-columns: 2.9rem minmax(0, 1fr) auto;
  gap: .85rem;
  min-height: 5rem;
  border: 1px solid rgba(76, 150, 255, .18) !important;
  border-radius: 8px;
  padding: .92rem;
  background: rgba(9, 19, 32, .74) !important;
  color: var(--practice-text) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04) !important;
}

body.app-page .library-entry.active,
body.app-page .library-entry:hover {
  border-color: rgba(76, 150, 255, .44) !important;
  background: rgba(13, 35, 68, .78) !important;
  transform: translateY(-1px);
}

body.app-page .library-icon {
  display: grid !important;
  place-items: center;
  width: 2.55rem;
  height: 2.55rem;
  border-radius: 50%;
  background: rgba(47, 125, 246, .18) !important;
  color: #74b9ff !important;
  box-shadow: 0 0 20px rgba(47, 125, 246, .18);
}

body.app-page .library-icon.danger {
  background: rgba(239, 87, 87, .16) !important;
  color: #ff8585 !important;
}

body.app-page .library-icon.warm {
  background: rgba(243, 199, 47, .15) !important;
  color: #f9d957 !important;
}

body.app-page .library-icon.ai {
  background: rgba(124, 92, 255, .15) !important;
  color: #b6a8ff !important;
}

body.app-page .library-icon.adversarial {
  background: rgba(35, 191, 111, .14) !important;
  color: #67dfa0 !important;
  font-family: inherit;
}

body.app-page .library-copy strong {
  color: #f1f7ff !important;
  font-size: .9rem;
}

body.app-page .library-copy small {
  color: #8194ab !important;
  font-size: .68rem;
}

body.app-page .library-entry em {
  min-width: 2rem;
  border: 0 !important;
  background: transparent !important;
  color: #d7e8ff !important;
  font-size: 1rem;
}

body.app-page .study-overview {
  order: 5;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin: 0;
}

body.app-page .study-overview .overview-card:nth-child(n + 3) {
  display: none !important;
}

body.app-page .overview-card {
  min-height: 6.6rem;
  border: 1px solid rgba(76, 150, 255, .16) !important;
  border-radius: 8px;
  padding: 1rem 1.1rem;
  background: rgba(9, 19, 32, .72) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04) !important;
}

body.app-page .overview-card::after {
  display: none;
}

body.app-page .overview-card span,
body.app-page .overview-card small {
  color: #899bb2 !important;
}

body.app-page .overview-card strong {
  color: #f4f9ff !important;
  font-size: 1.35rem;
}

body.app-page .overview-card i {
  height: .4rem;
  background: rgba(98, 122, 153, .28) !important;
}

body.app-page .overview-card i b {
  background: linear-gradient(90deg, #4d8dff, #23bf6f) !important;
}

body.app-page .data-status-panel {
  order: 6;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.4fr) auto auto;
  align-items: center;
  gap: .75rem;
  margin: 0;
  border: 1px solid rgba(76, 150, 255, .14) !important;
  border-radius: 8px;
  padding: 1rem;
  background: rgba(9, 19, 32, .7) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04) !important;
}

body.app-page .data-status-panel article {
  border: 0 !important;
  border-radius: 0;
  padding: 0;
  background: transparent !important;
}

body.app-page .data-status-panel span,
body.app-page .data-status-panel small {
  color: #899bb2 !important;
}

body.app-page .data-status-panel strong {
  color: #f4f9ff !important;
}

body.app-page .data-status-panel a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.62rem;
  border: 1px solid rgba(76, 150, 255, .46) !important;
  border-radius: 7px;
  padding: .62rem .95rem;
  background: linear-gradient(135deg, #2369f2, #18a6da) !important;
  color: #f8fbff !important;
  font-weight: 880;
  text-decoration: none;
  box-shadow: 0 14px 32px rgba(47, 125, 246, .22);
}

body.app-page .data-status-panel a + a {
  background: rgba(8, 17, 29, .76) !important;
  box-shadow: none;
}

body.app-page .reset-panel {
  order: 7;
  margin: 0;
  border: 1px solid rgba(76, 150, 255, .13) !important;
  border-radius: 8px;
  background: rgba(7, 16, 27, .54) !important;
}

body.app-page .reset-panel strong {
  color: #edf5ff !important;
}

body.app-page .reset-panel span {
  color: #8194ab !important;
}

body.app-page .reset-actions button {
  border-color: rgba(76, 150, 255, .24) !important;
  background: rgba(9, 19, 32, .78) !important;
  color: #b9d8ff !important;
}

body.app-page .active-scope-bar {
  order: 8;
  border-color: rgba(76, 150, 255, .14) !important;
  border-radius: 8px;
  background: rgba(9, 19, 32, .68) !important;
}

body.app-page .question-list {
  order: 9;
}

body.app-page .question-card,
body.app-page .empty-state,
body.app-page .pagination {
  border-color: rgba(76, 150, 255, .16) !important;
  border-radius: 8px;
  background: rgba(9, 19, 32, .78) !important;
  color: #d9e7f8 !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04), 0 18px 42px rgba(0, 0, 0, .18) !important;
}

body.app-page .question-card:hover {
  border-color: rgba(76, 150, 255, .42) !important;
}

body.app-page .question-title,
body.app-page .answer-label,
body.app-page .empty-state strong {
  color: #eff7ff !important;
}

body.app-page .answer-input,
body.app-page .analysis-box,
body.app-page .ai-coach-box,
body.app-page .ai-coach-grid section {
  border-color: rgba(76, 150, 255, .18) !important;
  background: rgba(5, 13, 24, .76) !important;
  color: #dcecff !important;
}

body.app-page .question-actions button,
body.app-page .secondary-action,
body.app-page .pagination button {
  border-color: rgba(76, 150, 255, .22) !important;
  background: rgba(12, 30, 55, .76) !important;
  color: #cde2ff !important;
}

body.app-page .primary-action,
body.app-page .ai-chat-send-button,
body.app-page .ai-chat-new-button {
  border-color: rgba(76, 150, 255, .52) !important;
  background: linear-gradient(135deg, #2369f2, #18a6da) !important;
  color: #ffffff !important;
}

body.app-page .badge,
body.app-page .active-scope-pill,
body.app-page .active-scope-reset,
body.app-page .preview-tags span,
body.app-page .ai-chat-context-chips span {
  border-color: rgba(76, 150, 255, .24) !important;
  border-left-color: rgba(76, 150, 255, .6) !important;
  background: rgba(12, 30, 55, .62) !important;
  color: #aecaed !important;
}

body.app-page > .floating-timer {
  position: fixed;
  top: 1.15rem;
  right: 1.55rem;
  bottom: auto;
  z-index: 30;
  gap: .55rem;
  padding: 0;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none;
}

body.app-page .floating-timer img,
body.app-page .floating-timer-copy,
body.app-page #timer-reset,
body.app-page .user-preference-card {
  display: none !important;
}

body.app-page .floating-timer-actions {
  display: flex;
}

body.app-page #timer-toggle {
  min-width: 6.8rem;
  min-height: 2.65rem;
  border: 1px solid rgba(76, 150, 255, .6) !important;
  border-radius: 7px;
  padding: .6rem 1rem;
  background: linear-gradient(135deg, #2369f2, #18a6da) !important;
  color: #ffffff !important;
  box-shadow: 0 14px 32px rgba(47, 125, 246, .34) !important;
}

body.app-page .ai-chat-fab,
body.app-page .scroll-top-button {
  right: 1.3rem;
  width: 3.1rem;
  height: 3.1rem;
  border: 1px solid rgba(76, 150, 255, .48) !important;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 26%, rgba(24, 199, 247, .3), rgba(35, 94, 222, .86)) !important;
  color: #eef7ff !important;
  box-shadow: 0 0 26px rgba(47, 125, 246, .38) !important;
}

body.app-page .ai-chat-fab {
  bottom: 7.1rem;
}

body.app-page .scroll-top-button {
  bottom: 3.35rem;
}

body.app-page .ai-chat-fab strong {
  display: none;
}

body.app-page .ai-chat-fab span {
  color: inherit !important;
}

body.app-page input::placeholder,
body.app-page textarea::placeholder {
  color: #687b91 !important;
}

body.app-page :where(button, a, input, select, textarea) {
  transition: border-color .2s ease, background .2s ease, color .2s ease, box-shadow .2s ease, transform .2s ease;
}

body.app-page :where(button, a):hover {
  transform: translateY(-1px);
}

@media (max-width: 1180px) {
  body.app-page > .content {
    padding-right: 1.15rem;
  }

  body.app-page .toolbar {
    width: 100%;
    margin-right: 0;
    grid-template-columns: minmax(16rem, 1fr) repeat(2, minmax(6.6rem, .34fr));
  }

  body.app-page .toolbar #progress-filter,
  body.app-page .toolbar #reset-filters-button {
    grid-column: auto;
  }

  body.app-page > .floating-timer {
    top: auto;
    right: 1.1rem;
    bottom: 1.1rem;
  }

  body.app-page .content-header {
    grid-template-columns: 1fr;
  }

  body.app-page .header-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }

  body.app-page .library-panel {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  body.app-page .data-status-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  body.app-page {
    display: block;
  }

  body.app-page > .sidebar {
    position: static;
    width: 100%;
    height: auto;
    padding: .95rem;
  }

  body.app-page .chapter-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.app-page .sync-panel {
    margin-top: .95rem;
  }

  body.app-page > .content {
    width: 100%;
    padding: 1rem;
  }

  body.app-page .toolbar,
  body.app-page .mode-switch,
  body.app-page .study-overview,
  body.app-page .data-status-panel {
    grid-template-columns: 1fr;
  }

  body.app-page .library-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  body.app-page .chapter-nav,
  body.app-page .header-stats,
  body.app-page .library-panel {
    grid-template-columns: 1fr;
  }

  body.app-page .toolbar {
    padding: .62rem;
  }

  body.app-page .content-header,
  body.app-page .question-card {
    padding: 1rem;
  }

  body.app-page .mode-button,
  body.app-page .library-entry {
    grid-template-columns: 2.8rem minmax(0, 1fr);
  }

  body.app-page .mode-button::after {
    display: none;
  }
}

/* Practice dashboard layout correction. */
body.app-page .sidebar-brand {
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

body.app-page .chapter-nav button {
  display: flex !important;
  gap: .62rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.app-page .chapter-nav button::before {
  position: static !important;
  flex: 0 0 1.35rem;
}

body.app-page .chapter-nav button::after {
  margin-left: auto;
  flex: 0 0 auto;
}

body.app-page .toolbar #search-input,
body.app-page .toolbar #difficulty-filter,
body.app-page .toolbar #term-filter,
body.app-page .toolbar #progress-filter,
body.app-page .toolbar #reset-filters-button {
  grid-column: auto !important;
}

body.app-page .toolbar #reset-filters-button {
  min-width: 4.7rem;
  padding-inline: .6rem;
  white-space: nowrap;
}

body.app-page .header-stats strong,
body.app-page .header-stats span {
  grid-column: 2;
  min-width: 0;
  white-space: nowrap;
}

body.app-page .header-stats strong {
  grid-row: 1;
}

body.app-page .header-stats span {
  grid-row: 2;
}

body.app-page .mode-button strong {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
}

body.app-page .mode-button small {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
  max-width: 22rem;
}

body.app-page .mode-button::after {
  grid-column: 3;
  grid-row: 1 / 3;
}

body.app-page .library-copy strong {
  white-space: nowrap;
}

body.app-page .library-copy small {
  max-width: 8.5rem;
}

@media (max-width: 1180px) {
  body.app-page .toolbar #reset-filters-button {
    grid-column: auto !important;
  }
}

@media (max-width: 900px) {
  body.app-page .chapter-nav {
    display: flex !important;
    gap: .65rem;
    overflow-x: auto;
    padding-bottom: .4rem;
    scrollbar-width: none;
  }

  body.app-page .chapter-nav::-webkit-scrollbar {
    display: none;
  }

  body.app-page .chapter-nav button {
    flex: 0 0 auto;
    min-width: 9.8rem;
  }

  body.app-page > .floating-timer {
    display: none !important;
  }
}

/* Practice dashboard icon system. */
body.app-page .lucide {
  width: 1.15rem;
  height: 1.15rem;
  stroke-width: 2.1;
}

body.app-page .chapter-nav {
  margin-bottom: 1.1rem;
}

body.app-page .chapter-nav button {
  display: grid !important;
  grid-template-columns: 1.65rem minmax(0, 1fr) 1rem;
  gap: .62rem;
}

body.app-page .chapter-nav button::before,
body.app-page .chapter-nav button::after {
  display: none !important;
  content: none !important;
}

body.app-page .chapter-nav button > .lucide:first-child {
  width: 1.25rem;
  height: 1.25rem;
  color: #2f8bff;
  filter: drop-shadow(0 0 10px rgba(47, 125, 246, .42));
}

body.app-page .chapter-nav button > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.app-page .chapter-nav button > .lucide:last-child {
  justify-self: end;
  width: .92rem;
  height: .92rem;
  color: #8ea1ba;
}

body.app-page .sidebar-quick {
  display: grid;
  gap: .36rem;
  margin-top: auto;
  margin-bottom: .9rem;
  border-top: 1px solid rgba(117, 145, 178, .16);
  padding-top: 1rem;
}

body.app-page .sidebar-quick button {
  display: grid;
  grid-template-columns: 1.65rem minmax(0, 1fr) auto;
  align-items: center;
  gap: .58rem;
  min-height: 2.35rem;
  border: 0;
  border-radius: 8px;
  padding: .42rem .55rem;
  background: transparent;
  color: #9caec4;
  text-align: left;
  cursor: pointer;
  font-weight: 790;
}

body.app-page .sidebar-quick button:hover {
  background: rgba(47, 125, 246, .1);
  color: #dbeafe;
}

body.app-page .sidebar-quick .lucide {
  width: 1.08rem;
  height: 1.08rem;
  color: #b5c4d8;
}

body.app-page .sidebar-quick em {
  display: grid;
  place-items: center;
  min-width: 1.65rem;
  height: 1.65rem;
  border-radius: 999px;
  background: rgba(143, 162, 186, .15);
  color: #c9d7e8;
  font-style: normal;
  font-size: .72rem;
  font-weight: 850;
}

body.app-page .header-stats div::before {
  display: none !important;
}

body.app-page .header-stats div {
  grid-template-columns: 3.65rem minmax(0, 1fr);
}

body.app-page .stat-icon-wrap {
  display: grid;
  grid-row: 1 / 3;
  grid-column: 1 !important;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(47, 125, 246, .34), rgba(47, 125, 246, .12) 58%, rgba(47, 125, 246, .04));
  color: #6ea8ff;
  box-shadow: 0 0 28px rgba(47, 125, 246, .22);
}

body.app-page .stat-icon-wrap .lucide {
  width: 1.42rem;
  height: 1.42rem;
}

body.app-page .stat-wrong .stat-icon-wrap {
  background: radial-gradient(circle, rgba(239, 87, 87, .4), rgba(239, 87, 87, .14) 58%, rgba(239, 87, 87, .04));
  color: #ff776f;
  box-shadow: 0 0 28px rgba(239, 87, 87, .22);
}

body.app-page .stat-fav .stat-icon-wrap {
  background: radial-gradient(circle, rgba(243, 199, 47, .38), rgba(243, 199, 47, .14) 58%, rgba(243, 199, 47, .04));
  color: #f7c62e;
  box-shadow: 0 0 28px rgba(243, 199, 47, .2);
}

body.app-page .stat-fav .stat-icon-wrap .lucide {
  fill: currentColor;
}

body.app-page .header-stats div > span:not(.stat-icon-wrap) {
  grid-column: 2 !important;
  grid-row: 2 !important;
}

body.app-page .mode-button::before {
  display: none !important;
  content: none !important;
}

body.app-page .mode-icon-wrap {
  display: grid;
  grid-row: 1 / 3;
  place-items: center;
  width: 3.25rem;
  height: 3.25rem;
  border: 1px solid rgba(76, 150, 255, .48);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(60, 136, 255, .94), rgba(37, 99, 235, .28));
  color: #beddff;
  box-shadow: 0 0 26px rgba(47, 125, 246, .28), inset 0 1px 0 rgba(255, 255, 255, .18);
}

body.app-page .mode-button:nth-child(2) .mode-icon-wrap {
  border-color: rgba(35, 191, 111, .56);
  background: linear-gradient(135deg, rgba(35, 191, 111, .94), rgba(35, 191, 111, .22));
  color: #c7ffd9;
  box-shadow: 0 0 26px rgba(35, 191, 111, .26), inset 0 1px 0 rgba(255, 255, 255, .16);
}

body.app-page .mode-icon-wrap .lucide {
  width: 1.85rem;
  height: 1.85rem;
}

body.app-page .library-icon .lucide {
  width: 1.18rem;
  height: 1.18rem;
}

body.app-page .library-icon.warm .lucide {
  fill: currentColor;
}

body.app-page .data-status-panel a {
  gap: .55rem;
}

body.app-page .data-status-panel a .lucide,
body.app-page #timer-toggle .lucide,
body.app-page .timer-calendar .lucide {
  width: 1.1rem;
  height: 1.1rem;
}

body.app-page .timer-calendar {
  display: grid;
  place-items: center;
  width: 2.62rem;
  height: 2.62rem;
  color: #c7d5e8;
}

body.app-page #timer-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .55rem;
}

@media (max-width: 900px) {
  body.app-page .sidebar-quick {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: .8rem;
  }

  body.app-page .chapter-nav button {
    min-width: 10.8rem;
  }
}

@media (max-width: 620px) {
  body.app-page .sidebar-quick {
    grid-template-columns: 1fr;
  }
}

/* Practice dashboard icon refinement pass. */
body.app-page .content-header {
  grid-template-columns: minmax(0, 1fr) minmax(30.8rem, .64fr);
}

body.app-page .header-stats {
  grid-template-columns: repeat(3, minmax(8.6rem, 1fr));
  gap: 1rem;
}

body.app-page .header-stats div {
  grid-template-columns: 3.8rem minmax(4.25rem, 1fr);
  min-height: 5.85rem;
  column-gap: 1rem;
  padding: 1rem 1.08rem;
  background:
    linear-gradient(140deg, rgba(16, 31, 51, .96), rgba(7, 17, 31, .86)) !important;
}

body.app-page .stat-icon-wrap {
  width: 3.32rem;
  height: 3.32rem;
  border: 1px solid rgba(105, 171, 255, .34);
  border-radius: 16px;
  background:
    radial-gradient(circle at 32% 24%, rgba(213, 234, 255, .34), transparent 32%),
    linear-gradient(145deg, rgba(69, 135, 255, .94), rgba(28, 75, 188, .32)) !important;
  color: #d8eaff;
  box-shadow:
    0 0 32px rgba(47, 125, 246, .3),
    inset 0 1px 0 rgba(255, 255, 255, .2),
    inset 0 -10px 22px rgba(8, 28, 78, .34);
}

body.app-page .stat-icon-wrap .lucide {
  width: 1.58rem;
  height: 1.58rem;
  stroke-width: 2.35;
  filter: drop-shadow(0 0 8px rgba(203, 228, 255, .35));
}

body.app-page .stat-total .stat-icon-wrap .lucide {
  fill: rgba(188, 220, 255, .18);
}

body.app-page .stat-wrong .stat-icon-wrap {
  border-color: rgba(255, 129, 112, .34);
  background:
    radial-gradient(circle at 32% 24%, rgba(255, 224, 219, .3), transparent 32%),
    linear-gradient(145deg, rgba(242, 82, 74, .95), rgba(126, 31, 36, .34)) !important;
  color: #fff4f0;
  box-shadow:
    0 0 32px rgba(239, 87, 87, .3),
    inset 0 1px 0 rgba(255, 255, 255, .18),
    inset 0 -10px 22px rgba(88, 17, 22, .36);
}

body.app-page .stat-fav .stat-icon-wrap {
  border-color: rgba(255, 217, 74, .36);
  background:
    radial-gradient(circle at 32% 24%, rgba(255, 243, 182, .34), transparent 32%),
    linear-gradient(145deg, rgba(246, 199, 40, .96), rgba(116, 83, 14, .34)) !important;
  color: #fff1a6;
  box-shadow:
    0 0 32px rgba(243, 199, 47, .26),
    inset 0 1px 0 rgba(255, 255, 255, .18),
    inset 0 -10px 22px rgba(79, 54, 8, .34);
}

body.app-page .header-stats strong {
  min-width: 0;
  color: #f8fbff !important;
  font-size: 1.72rem;
  font-weight: 950;
  letter-spacing: 0;
  white-space: nowrap;
}

body.app-page .header-stats div > span:not(.stat-icon-wrap) {
  color: #a9bad0 !important;
  font-size: .8rem;
  font-weight: 760;
}

body.app-page .mode-button {
  grid-template-columns: 4.95rem minmax(0, 1fr) 2.35rem;
}

body.app-page .mode-icon-wrap {
  width: 3.7rem;
  height: 3.7rem;
  border-radius: 13px;
  background:
    radial-gradient(circle at 28% 22%, rgba(223, 239, 255, .3), transparent 34%),
    linear-gradient(145deg, rgba(69, 137, 255, .98), rgba(25, 77, 195, .38)) !important;
  box-shadow:
    0 0 34px rgba(47, 125, 246, .34),
    inset 0 1px 0 rgba(255, 255, 255, .2),
    inset 0 -11px 22px rgba(8, 31, 96, .34);
}

body.app-page .mode-button:nth-child(2) .mode-icon-wrap {
  background:
    radial-gradient(circle at 28% 22%, rgba(220, 255, 232, .28), transparent 34%),
    linear-gradient(145deg, rgba(47, 200, 108, .98), rgba(17, 95, 58, .38)) !important;
  box-shadow:
    0 0 34px rgba(35, 191, 111, .32),
    inset 0 1px 0 rgba(255, 255, 255, .18),
    inset 0 -11px 22px rgba(11, 71, 41, .36);
}

body.app-page .mode-icon-wrap .lucide {
  width: 2.05rem;
  height: 2.05rem;
  stroke-width: 2.45;
  filter: drop-shadow(0 0 7px rgba(213, 237, 255, .32));
}

body.app-page .mode-button::after {
  width: 2.28rem;
  height: 2.28rem;
  background: rgba(47, 125, 246, .18) !important;
  color: #63adff;
  font-size: 1.62rem;
}

body.app-page .mode-button:nth-child(2)::after {
  background: rgba(35, 191, 111, .18) !important;
  color: #59d88a;
}

body.app-page .library-entry {
  grid-template-columns: 3.35rem minmax(0, 1fr) auto;
}

body.app-page .library-icon {
  width: 3rem;
  height: 3rem;
  border: 1px solid rgba(96, 161, 255, .25);
  border-radius: 16px;
  background:
    radial-gradient(circle at 30% 24%, rgba(207, 230, 255, .2), transparent 34%),
    linear-gradient(145deg, rgba(47, 125, 246, .38), rgba(15, 44, 94, .66)) !important;
  box-shadow:
    0 0 28px rgba(47, 125, 246, .2),
    inset 0 1px 0 rgba(255, 255, 255, .12);
}

body.app-page .library-icon .lucide {
  width: 1.4rem;
  height: 1.4rem;
  stroke-width: 2.45;
}

body.app-page .library-icon.danger {
  border-color: rgba(255, 118, 106, .24);
  background:
    radial-gradient(circle at 30% 24%, rgba(255, 218, 214, .2), transparent 34%),
    linear-gradient(145deg, rgba(235, 78, 70, .34), rgba(74, 20, 25, .68)) !important;
}

body.app-page .library-icon.warm {
  border-color: rgba(255, 214, 59, .25);
  background:
    radial-gradient(circle at 30% 24%, rgba(255, 242, 164, .22), transparent 34%),
    linear-gradient(145deg, rgba(243, 199, 47, .36), rgba(75, 56, 12, .68)) !important;
}

body.app-page .library-icon.ai {
  border-color: rgba(169, 139, 255, .25);
  background:
    radial-gradient(circle at 30% 24%, rgba(225, 216, 255, .22), transparent 34%),
    linear-gradient(145deg, rgba(124, 92, 255, .36), rgba(49, 31, 104, .68)) !important;
}

body.app-page .library-icon.adversarial {
  border-color: rgba(66, 218, 143, .24);
  background:
    radial-gradient(circle at 30% 24%, rgba(220, 255, 235, .2), transparent 34%),
    linear-gradient(145deg, rgba(35, 191, 111, .34), rgba(14, 72, 47, .68)) !important;
}

body.app-page .ai-chat-fab span {
  display: grid;
  place-items: center;
  color: #e8f3ff !important;
}

body.app-page .ai-chat-fab span .lucide {
  width: 1.35rem;
  height: 1.35rem;
  stroke-width: 2.4;
}

body.app-page .ai-chat-fab {
  display: grid;
  grid-template-rows: 1.5rem auto;
  place-items: center;
  align-content: center;
  gap: .08rem;
  width: 3.8rem;
  height: 3.8rem;
  bottom: 6.8rem;
}

body.app-page .ai-chat-fab strong {
  display: block;
  margin: 0;
  color: #f0f7ff !important;
  font-size: .66rem;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

body.app-page .ai-chat-fab span .lucide {
  width: 1.42rem;
  height: 1.42rem;
}

body.app-page .header-stats strong,
body.app-page .header-stats div > span:not(.stat-icon-wrap) {
  justify-self: start;
  text-align: left;
}

@media (max-width: 1280px) {
  body.app-page .content-header {
    grid-template-columns: minmax(0, 1fr);
  }

  body.app-page .header-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  body.app-page .ai-chat-fab {
    right: 1rem;
    bottom: 1rem;
    width: 3.45rem;
    height: 3.45rem;
    z-index: 75;
  }

  body.app-page .ai-chat-fab span .lucide {
    width: 1.28rem;
    height: 1.28rem;
  }

  body.app-page .ai-chat-fab strong {
    font-size: .6rem;
  }
}

/* Default user avatar for the practice dashboard branch. */
body.app-page {
  --practice-user-avatar: url("../images/nailong-avatar.png");
}

body.app-page .topbar-avatar {
  overflow: hidden;
  border: 1px solid rgba(255, 221, 128, .72);
  background:
    var(--practice-user-avatar) center / cover no-repeat,
    linear-gradient(135deg, #ffe58a, #f9a826) !important;
  color: transparent !important;
  box-shadow:
    0 0 0 3px rgba(255, 202, 77, .16),
    0 0 18px rgba(255, 191, 64, .24) !important;
}

body.app-page .sync-panel::before {
  background:
    var(--practice-user-avatar) center / cover no-repeat,
    linear-gradient(135deg, #ffe58a, #f9a826) !important;
  box-shadow:
    0 0 0 2px rgba(255, 231, 153, .38),
    0 0 24px rgba(255, 191, 64, .32) !important;
}

body.app-page .ai-chat-message.user .ai-chat-avatar {
  overflow: hidden;
  border: 1px solid rgba(255, 221, 128, .72);
  background:
    var(--practice-user-avatar) center / cover no-repeat,
    linear-gradient(135deg, #ffe58a, #f9a826) !important;
  color: transparent !important;
  font-size: 0 !important;
  box-shadow:
    0 0 0 2px rgba(255, 202, 77, .15),
    0 0 14px rgba(255, 191, 64, .22);
}

/* Question bank main interface aligned with the source library page. */
body.app-page {
  --qb-bg: #eef4fb;
  --qb-surface: rgba(255, 255, 255, .92);
  --qb-surface-strong: #ffffff;
  --qb-surface-soft: #f5f9ff;
  --qb-line: #d7e3f1;
  --qb-line-strong: #bfd3ee;
  --qb-text: #142033;
  --qb-muted: #61748b;
  --qb-accent: #1859c7;
  --qb-accent-soft: #e8f1ff;
  --qb-accent-warm: #d94763;
  --qb-green: #168454;
  --qb-warning: #b96f00;
  --qb-shadow: 0 22px 48px rgba(15, 23, 42, .08);
  display: block !important;
  min-height: 100dvh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, .88), transparent 28rem),
    radial-gradient(circle at 88% 8%, rgba(24, 89, 199, .14), transparent 20rem),
    linear-gradient(180deg, #f8fbff 0%, #eef4fb 54%, #e8eff8 100%) !important;
  color: var(--qb-text) !important;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Source Han Sans SC", sans-serif;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}

body.app-theme-dark.app-page {
  --qb-bg: #0d1623;
  --qb-surface: rgba(17, 27, 42, .94);
  --qb-surface-strong: #121d2d;
  --qb-surface-soft: #162437;
  --qb-line: rgba(142, 166, 197, .24);
  --qb-line-strong: rgba(157, 186, 224, .38);
  --qb-text: #e8f0fb;
  --qb-muted: #9aaec5;
  --qb-accent: #72aaff;
  --qb-accent-soft: rgba(114, 170, 255, .12);
  --qb-accent-warm: #ff7890;
  --qb-green: #5fd39a;
  --qb-warning: #f0bd62;
  --qb-shadow: 0 22px 48px rgba(0, 0, 0, .24);
  background:
    radial-gradient(circle at top left, rgba(57, 96, 150, .2), transparent 28rem),
    radial-gradient(circle at 88% 8%, rgba(114, 170, 255, .14), transparent 20rem),
    linear-gradient(180deg, #08111d 0%, #0d1623 58%, #070d15 100%) !important;
}

body.app-page::before,
body.app-page::after {
  opacity: 0 !important;
}

body.app-page .qb-topbar,
body.app-page .topbar {
  position: sticky;
  top: 0;
  z-index: 45;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid rgba(215, 227, 241, .9);
  background: rgba(255, 255, 255, .9);
  padding: .9rem clamp(1rem, 3vw, 2rem);
  backdrop-filter: blur(14px);
}

body.app-theme-dark.app-page .qb-topbar,
body.app-theme-dark.app-page .topbar {
  border-bottom-color: var(--qb-line);
  background: rgba(12, 20, 32, .9);
}

body.app-page .brand {
  display: inline-flex;
  align-items: center;
  gap: .72rem;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

body.app-page .brand img {
  width: 2.4rem;
  height: 2.4rem;
  object-fit: contain;
}

body.app-page .brand span {
  display: grid;
  gap: .06rem;
}

body.app-page .brand strong {
  color: var(--qb-text);
  font-size: 1rem;
  font-weight: 900;
  line-height: 1.1;
}

body.app-page .brand small,
body.app-page .topnav a,
body.app-page .sidebar-quick button,
body.app-page .chapter-nav button,
body.app-page .header-desc,
body.app-page .hero-chips span,
body.app-page .overview-card span,
body.app-page .overview-card small,
body.app-page .library-copy small,
body.app-page .mode-button small,
body.app-page .mode-status,
body.app-page .active-scope-main p,
body.app-page .active-scope-kicker,
body.app-page .data-status-panel span,
body.app-page .data-status-panel small,
body.app-page .reset-panel span,
body.app-page .empty-state span {
  color: var(--qb-muted) !important;
}

body.app-page .topnav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: .48rem;
}

body.app-page .topnav a,
body.app-page .toolbar button,
body.app-page .reset-actions button,
body.app-page .data-status-panel a,
body.app-page .question-actions button,
body.app-page .secondary-action,
body.app-page .pagination button,
body.app-page .library-action-secondary,
body.app-page .library-action-primary {
  border: 1px solid var(--qb-line) !important;
  border-radius: 999px !important;
  background: var(--qb-surface-strong) !important;
  color: var(--qb-text) !important;
  text-decoration: none;
  font-weight: 820;
  line-height: 1;
  box-shadow: none !important;
}

body.app-page .topnav a {
  padding: .62rem .82rem;
}

body.app-page > .sidebar {
  position: relative !important;
  z-index: 3;
  display: grid !important;
  width: min(1220px, calc(100% - 2rem)) !important;
  height: auto !important;
  margin: 1.1rem auto 0 !important;
  padding: .8rem !important;
  overflow: visible !important;
  border: 1px solid var(--qb-line) !important;
  border-radius: 1.35rem !important;
  background: var(--qb-surface) !important;
  box-shadow: var(--qb-shadow) !important;
  color: var(--qb-text) !important;
  backdrop-filter: blur(14px);
}

body.app-page > .sidebar .sidebar-brand,
body.app-page > .sidebar .campus-card,
body.app-page > .sidebar .sync-panel,
body.app-page > .sidebar .author-card {
  display: none !important;
}

body.app-page .chapter-nav {
  display: flex !important;
  gap: .52rem !important;
  margin: 0 0 .72rem !important;
  padding: 0 0 .72rem !important;
  overflow-x: auto;
  border-bottom: 1px solid var(--qb-line);
  scrollbar-width: none;
}

body.app-page .chapter-nav::-webkit-scrollbar {
  display: none;
}

body.app-page .chapter-nav button {
  flex: 0 0 auto;
  display: inline-flex !important;
  align-items: center;
  gap: .42rem;
  min-width: 0 !important;
  min-height: 2.55rem !important;
  border: 1px solid var(--qb-line) !important;
  border-radius: 999px !important;
  padding: 0 .8rem !important;
  background: var(--qb-surface-strong) !important;
  box-shadow: none !important;
  font-size: .84rem;
  font-weight: 850;
  white-space: nowrap;
}

body.app-page .chapter-nav button::before,
body.app-page .chapter-nav button::after {
  display: none !important;
  content: none !important;
}

body.app-page .chapter-nav button > .lucide:first-child,
body.app-page .chapter-nav button > .lucide:last-child {
  width: 1rem;
  height: 1rem;
  color: var(--qb-accent) !important;
  filter: none !important;
}

body.app-page .chapter-nav button.active,
body.app-page .chapter-nav button:hover,
body.app-page .sidebar-quick button:hover {
  border-color: rgba(24, 89, 199, .28) !important;
  background: var(--qb-accent-soft) !important;
  color: var(--qb-accent) !important;
  transform: none !important;
}

body.app-page .sidebar-quick {
  display: flex !important;
  flex-wrap: wrap;
  gap: .52rem !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
}

body.app-page .sidebar-quick button {
  display: inline-flex;
  align-items: center;
  gap: .48rem;
  min-height: 2.55rem;
  border: 1px solid var(--qb-line);
  border-radius: 999px;
  padding: 0 .78rem;
  background: var(--qb-surface-strong);
  font-size: .84rem;
  font-weight: 850;
}

body.app-page .sidebar-quick .lucide {
  width: 1rem;
  height: 1rem;
  color: var(--qb-accent) !important;
}

body.app-page .sidebar-quick em {
  display: grid;
  place-items: center;
  min-width: 1.55rem;
  height: 1.55rem;
  border-radius: 999px;
  background: var(--qb-accent-soft) !important;
  color: var(--qb-accent) !important;
  font-size: .72rem;
  font-style: normal;
  font-weight: 900;
}

body.app-page > .content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(1220px, calc(100% - 2rem)) !important;
  max-width: none;
  gap: 1rem;
  margin: 1rem auto 3rem !important;
  padding: 0 !important;
}

body.app-page .content-header {
  order: 1 !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1.1fr) minmax(20rem, 28rem) !important;
  gap: 1rem;
  align-items: start;
  min-height: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

body.app-page .content-header::before,
body.app-page .content-header::after,
body.app-page .hero-campus-image {
  display: none !important;
}

body.app-page .header-copy,
body.app-page .filter-panel,
body.app-page .toolbar,
body.app-page .mode-panel,
body.app-page .library-panel,
body.app-page .study-overview,
body.app-page .data-status-panel,
body.app-page .reset-panel,
body.app-page .active-scope-bar,
body.app-page .question-card,
body.app-page .empty-state,
body.app-page .pagination,
body.app-page .summary-card,
body.app-page .overview-card {
  border: 1px solid var(--qb-line) !important;
  border-radius: 1.35rem !important;
  background: var(--qb-surface) !important;
  box-shadow: var(--qb-shadow) !important;
  backdrop-filter: blur(14px);
}

body.app-page .header-copy {
  display: grid;
  gap: 1rem;
  min-height: 29.2rem;
  padding: 1.35rem !important;
}

body.app-page .school-name-img {
  display: none;
}

body.app-page .eyebrow {
  margin: 0;
  color: var(--qb-muted) !important;
  font-size: .82rem;
  font-weight: 900;
  letter-spacing: .02em !important;
  text-transform: none !important;
}

body.app-page .content-header h2 {
  max-width: 12ch;
  margin: 0;
  color: #0c1828 !important;
  font-size: 4.35rem !important;
  line-height: 1.04 !important;
  letter-spacing: 0;
}

body.app-theme-dark.app-page .content-header h2 {
  color: #f3f7ff !important;
}

body.app-page .header-desc {
  max-width: 39rem !important;
  margin: 0;
  font-size: 1rem !important;
  line-height: 1.75 !important;
}

body.app-page .hero-chips {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .72rem !important;
  margin-top: auto !important;
}

body.app-page .hero-chips span {
  display: grid;
  align-content: center;
  min-height: 4.6rem;
  border: 1px solid rgba(191, 211, 238, .92) !important;
  border-radius: 1.1rem !important;
  padding: .9rem;
  background: rgba(255, 255, 255, .88) !important;
  color: var(--qb-text) !important;
  font-size: .92rem !important;
  font-weight: 900;
  line-height: 1.45;
}

body.app-theme-dark.app-page .hero-chips span {
  background: rgba(18, 29, 45, .88) !important;
}

body.app-page .header-stats {
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: .72rem !important;
  align-self: stretch;
}

body.app-page .header-stats div {
  display: grid !important;
  grid-template-columns: 1fr !important;
  min-height: 6rem !important;
  border: 1px solid var(--qb-line) !important;
  border-radius: 1.1rem !important;
  padding: 1rem !important;
  background: var(--qb-surface) !important;
  box-shadow: var(--qb-shadow) !important;
  text-align: left;
}

body.app-page .header-stats div::before,
body.app-page .stat-icon-wrap {
  display: none !important;
}

body.app-page .header-stats strong {
  grid-column: auto !important;
  grid-row: 2 !important;
  color: var(--qb-text) !important;
  font-size: 2rem !important;
  font-weight: 950;
  line-height: 1.05;
}

body.app-page .header-stats div > span:not(.stat-icon-wrap) {
  grid-column: auto !important;
  grid-row: 1 !important;
  color: var(--qb-muted) !important;
  font-size: .78rem !important;
  font-weight: 900;
}

body.app-page .toolbar {
  order: 2 !important;
  display: grid !important;
  grid-template-columns: minmax(19rem, 1.25fr) repeat(4, minmax(8rem, .44fr)) !important;
  gap: .72rem !important;
  width: 100% !important;
  margin: 0 !important;
  padding: .95rem !important;
}

body.app-page .toolbar-field {
  display: grid;
  gap: .36rem;
  min-width: 0;
}

body.app-page .toolbar-field span {
  color: var(--qb-muted);
  font-size: .78rem;
  font-weight: 900;
}

body.app-page .toolbar-field.is-advanced {
  display: grid;
}

body.app-page .toolbar #search-input,
body.app-page .toolbar #course-filter,
body.app-page .toolbar #term-filter,
body.app-page .toolbar #difficulty-filter,
body.app-page .toolbar #progress-filter,
body.app-page .toolbar #subject-filter,
body.app-page .toolbar #source-kind-filter,
body.app-page .toolbar #paper-type-filter,
body.app-page .toolbar #type-filter {
  display: block !important;
}

body.app-page .toolbar input,
body.app-page .toolbar select,
body.app-page .answer-input,
body.app-page textarea {
  width: 100%;
  height: 3.05rem !important;
  min-height: 3.05rem !important;
  border: 1px solid var(--qb-line) !important;
  border-radius: 999px !important;
  background: var(--qb-surface-strong) !important;
  color: var(--qb-text) !important;
  box-shadow: none !important;
  font-size: .95rem;
  font-weight: 720;
}

body.app-page .toolbar input {
  padding-left: 1rem !important;
  background: var(--qb-surface-strong) !important;
}

body.app-page .toolbar input::placeholder,
body.app-page textarea::placeholder {
  color: rgba(97, 116, 139, .72) !important;
}

body.app-page .toolbar input:focus,
body.app-page .toolbar select:focus,
body.app-page .answer-input:focus,
body.app-page textarea:focus {
  border-color: rgba(24, 89, 199, .46) !important;
  box-shadow: 0 0 0 3px rgba(24, 89, 199, .12) !important;
}

body.app-page .toolbar-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: .52rem;
}

body.app-page .toolbar-actions button {
  min-height: 2.75rem !important;
  padding: 0 .95rem !important;
}

body.app-page #reset-filters-button,
body.app-page #shuffle-button,
body.app-page #preview-current-button,
body.app-page #ai-selected-ask,
body.app-page #ai-paper-ask,
body.app-page #sync-button {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
}

body.app-page #ai-paper-ask,
body.app-page #sync-button,
body.app-page .primary-action,
body.app-page .ai-chat-send-button,
body.app-page .ai-chat-new-button,
body.app-page .data-status-panel a:first-of-type {
  border-color: transparent !important;
  background: linear-gradient(135deg, var(--qb-accent) 0%, #2274d6 56%, var(--qb-accent-warm) 100%) !important;
  color: #fff !important;
  box-shadow: 0 18px 34px rgba(24, 89, 199, .18) !important;
}

body.app-page .library-panel {
  order: 3 !important;
  display: grid !important;
  grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  gap: .72rem !important;
  margin: 0 !important;
  padding: 1rem !important;
}

body.app-page .library-entry {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto;
  align-content: start;
  gap: .6rem;
  min-height: 7rem !important;
  border: 1px solid rgba(191, 211, 238, .92) !important;
  border-radius: 1.1rem !important;
  padding: .9rem !important;
  background: rgba(255, 255, 255, .88) !important;
  color: var(--qb-text) !important;
  box-shadow: none !important;
}

body.app-theme-dark.app-page .library-entry {
  background: rgba(18, 29, 45, .88) !important;
}

body.app-page .library-entry.active,
body.app-page .library-entry:hover {
  border-color: rgba(24, 89, 199, .28) !important;
  background: var(--qb-accent-soft) !important;
  transform: none !important;
}

body.app-page .library-icon {
  display: none !important;
}

body.app-page .library-copy {
  display: grid;
  gap: .32rem;
}

body.app-page .library-copy strong,
body.app-page .mode-button strong,
body.app-page .overview-card strong,
body.app-page .active-scope-main strong,
body.app-page .data-status-panel strong,
body.app-page .reset-panel strong,
body.app-page .question-title,
body.app-page .answer-label,
body.app-page .empty-state strong {
  color: var(--qb-text) !important;
}

body.app-page .library-copy strong {
  font-size: .95rem !important;
}

body.app-page .library-entry em {
  align-self: start;
  min-width: 2rem;
  border: 0 !important;
  background: transparent !important;
  color: var(--qb-accent) !important;
  font-size: 1.1rem;
  font-style: normal;
  font-weight: 950;
}

body.app-page .mode-panel {
  order: 4 !important;
  padding: 1rem !important;
}

body.app-page .mode-switch {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: .72rem !important;
}

body.app-page .mode-button {
  min-height: 5.8rem !important;
  border: 1px solid rgba(191, 211, 238, .92) !important;
  border-radius: 1.1rem !important;
  background: rgba(255, 255, 255, .88) !important;
  box-shadow: none !important;
  color: var(--qb-text) !important;
}

body.app-theme-dark.app-page .mode-button {
  background: rgba(18, 29, 45, .88) !important;
}

body.app-page .mode-button:nth-child(2) {
  border-color: rgba(191, 211, 238, .92) !important;
  background: rgba(255, 255, 255, .88) !important;
}

body.app-theme-dark.app-page .mode-button:nth-child(2) {
  background: rgba(18, 29, 45, .88) !important;
}

body.app-page .mode-button::before,
body.app-page .mode-button::after {
  display: none !important;
}

body.app-page .mode-icon-wrap {
  display: grid;
  place-items: center;
  border: 1px solid var(--qb-line) !important;
  border-radius: 1rem !important;
  background: var(--qb-accent-soft) !important;
  color: var(--qb-accent) !important;
  box-shadow: none !important;
}

body.app-page .mode-button:nth-child(2) .mode-icon-wrap {
  border-color: rgba(22, 132, 84, .24) !important;
  background: rgba(22, 132, 84, .1) !important;
  color: var(--qb-green) !important;
}

body.app-page .mode-button.active,
body.app-page .mode-button:hover {
  border-color: rgba(24, 89, 199, .28) !important;
  background: var(--qb-accent-soft) !important;
  transform: none !important;
}

body.app-page .study-overview {
  order: 5 !important;
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: .72rem !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

body.app-page .study-overview .overview-card:nth-child(n + 3) {
  display: block !important;
}

body.app-page .overview-card {
  min-height: 6rem !important;
  padding: 1rem !important;
}

body.app-page .overview-card::after {
  display: none !important;
}

body.app-page .overview-card i {
  height: .46rem;
  background: var(--qb-line) !important;
}

body.app-page .overview-card i b {
  background: linear-gradient(90deg, var(--qb-accent), var(--qb-green)) !important;
}

body.app-page .active-scope-bar {
  order: 6 !important;
  padding: 1rem !important;
}

body.app-page .question-list {
  order: 7 !important;
  gap: 1rem !important;
}

body.app-page .question-card,
body.app-page .empty-state,
body.app-page .pagination {
  padding: 1.05rem !important;
}

body.app-page .question-card {
  border-left: 4px solid transparent !important;
}

body.app-page .question-card:hover {
  border-color: var(--qb-line-strong) !important;
  border-left-color: var(--qb-accent) !important;
  transform: translateY(-1px);
}

body.app-page .question-card.is-correct,
body.app-page .question-card.answer-feedback-correct {
  border-left-color: var(--qb-green) !important;
}

body.app-page .question-card.is-wrong,
body.app-page .question-card.answer-feedback-wrong {
  border-left-color: var(--qb-accent-warm) !important;
}

body.app-page .analysis-box,
body.app-page .ai-coach-box,
body.app-page .ai-coach-grid section {
  border: 1px solid var(--qb-line) !important;
  border-radius: 1.1rem !important;
  background: var(--qb-surface-soft) !important;
  color: var(--qb-text) !important;
}

body.app-page .data-status-panel {
  order: 8 !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr) max-content max-content !important;
  align-items: center;
  gap: .72rem !important;
  margin: 0 !important;
  padding: 1rem !important;
}

body.app-page .data-status-panel article {
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

body.app-page .data-status-panel a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .48rem;
  min-height: 3rem;
  padding: 0 1rem;
}

body.app-page .data-status-panel a + a {
  background: var(--qb-surface-strong) !important;
  color: var(--qb-text) !important;
  box-shadow: none !important;
}

body.app-page .reset-panel {
  order: 9 !important;
  padding: 1rem !important;
}

body.app-page .reset-actions {
  gap: .52rem;
}

body.app-page .reset-actions button {
  min-height: 2.75rem !important;
  padding: 0 .9rem !important;
}

body.app-page > .floating-timer {
  position: fixed !important;
  right: 1rem !important;
  bottom: 1rem !important;
  top: auto !important;
  z-index: 50 !important;
  display: flex !important;
  align-items: center;
  gap: .52rem;
  border: 1px solid var(--qb-line) !important;
  border-radius: 999px !important;
  padding: .42rem !important;
  background: rgba(255, 255, 255, .92) !important;
  box-shadow: var(--qb-shadow) !important;
  backdrop-filter: blur(14px) !important;
}

body.app-theme-dark.app-page > .floating-timer {
  background: rgba(17, 27, 42, .92) !important;
}

body.app-page .floating-timer img,
body.app-page .timer-calendar,
body.app-page .user-preference-card {
  display: none !important;
}

body.app-page .floating-timer-copy {
  display: block !important;
  padding-left: .42rem;
}

body.app-page .floating-timer strong {
  color: var(--qb-text) !important;
  font-size: .92rem !important;
}

body.app-page .timer-label {
  color: var(--qb-muted) !important;
  font-size: .7rem !important;
}

body.app-page .floating-timer-actions {
  display: flex !important;
  gap: .36rem;
}

body.app-page .floating-timer button {
  min-height: 2.35rem !important;
  border: 1px solid var(--qb-line) !important;
  border-radius: 999px !important;
  padding: 0 .82rem !important;
  background: var(--qb-surface-strong) !important;
  color: var(--qb-text) !important;
  box-shadow: none !important;
}

body.app-page #timer-toggle {
  border-color: transparent !important;
  background: var(--qb-accent) !important;
  color: #fff !important;
}

body.app-page #timer-reset {
  display: inline-flex !important;
}

body.app-page .ai-chat-fab,
body.app-page .scroll-top-button {
  border: 1px solid var(--qb-line) !important;
  background: var(--qb-surface-strong) !important;
  color: var(--qb-accent) !important;
  box-shadow: var(--qb-shadow) !important;
}

body.app-page .ai-chat-fab strong,
body.app-page .ai-chat-fab span {
  color: var(--qb-accent) !important;
}

body.app-page .toolbar button:disabled,
body.app-page button:disabled {
  opacity: .48;
  cursor: not-allowed;
}

body.app-page :where(button, a, input, select, textarea) {
  transition: border-color .18s ease, background .18s ease, color .18s ease, box-shadow .18s ease, transform .18s ease;
}

body.app-page :where(button, a):hover {
  transform: none !important;
}

@media (max-width: 1180px) {
  body.app-page .content-header {
    grid-template-columns: 1fr !important;
  }

  body.app-page .content-header h2 {
    font-size: 3.75rem !important;
  }

  body.app-page .header-copy {
    min-height: auto;
  }

  body.app-page .header-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }

  body.app-page .toolbar {
    grid-template-columns: minmax(16rem, 1fr) repeat(2, minmax(8rem, .5fr)) !important;
  }

  body.app-page .library-panel {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }

  body.app-page .study-overview,
  body.app-page .data-status-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 760px) {
  body.app-page .qb-topbar,
  body.app-page .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  body.app-page > .sidebar,
  body.app-page > .content {
    width: min(100% - 1rem, 1220px) !important;
  }

  body.app-page .content-header h2 {
    font-size: 2.85rem !important;
    letter-spacing: 0;
  }

  body.app-page .hero-chips,
  body.app-page .header-stats,
  body.app-page .toolbar,
  body.app-page .library-panel,
  body.app-page .mode-switch,
  body.app-page .study-overview,
  body.app-page .data-status-panel {
    grid-template-columns: 1fr !important;
  }

  body.app-page .toolbar-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  body.app-page .toolbar-actions button {
    width: 100%;
  }

  body.app-page > .floating-timer {
    display: none !important;
  }
}

@media (max-width: 420px) {
  body.app-page .content-header h2 {
    font-size: 2.55rem !important;
  }
}

/* Alternating light and dark neon workspace for the question bank. */
body.app-page {
  --neo-rail-width: 4.35rem;
  --neo-bg: #eef6ff;
  --neo-panel: rgba(255, 255, 255, .82);
  --neo-panel-strong: rgba(255, 255, 255, .94);
  --neo-field: rgba(255, 255, 255, .9);
  --neo-line: rgba(148, 184, 232, .56);
  --neo-line-strong: rgba(79, 129, 255, .38);
  --neo-text: #14223a;
  --neo-muted: #6a7c95;
  --neo-blue: #1f68ff;
  --neo-cyan: #24b8ff;
  --neo-purple: #8b5cff;
  --neo-pink: #f05295;
  --neo-orange: #f07a2b;
  --neo-green: #20b982;
  --neo-shadow: 0 20px 55px rgba(42, 92, 155, .14);
  --neo-glow: 0 16px 38px rgba(31, 104, 255, .22);
  min-height: 100dvh;
  background:
    radial-gradient(circle at 4% 78%, rgba(139, 92, 255, .12), transparent 10rem),
    radial-gradient(circle at 92% 1%, rgba(31, 104, 255, .16), transparent 24rem),
    radial-gradient(circle at 82% 46%, rgba(36, 184, 255, .11), transparent 30rem),
    linear-gradient(180deg, #f8fbff 0%, var(--neo-bg) 52%, #e8f2ff 100%) !important;
  color: var(--neo-text) !important;
}

body.app-theme-dark.app-page {
  --neo-bg: #020814;
  --neo-panel: rgba(4, 13, 27, .78);
  --neo-panel-strong: rgba(7, 18, 35, .92);
  --neo-field: rgba(5, 15, 31, .94);
  --neo-line: rgba(87, 124, 184, .34);
  --neo-line-strong: rgba(82, 128, 255, .7);
  --neo-text: #f0f6ff;
  --neo-muted: #91a4be;
  --neo-blue: #2f7dff;
  --neo-cyan: #18c7ff;
  --neo-purple: #b05cff;
  --neo-pink: #ff5ea8;
  --neo-orange: #ff8b3d;
  --neo-green: #45d7a0;
  --neo-shadow: 0 24px 64px rgba(0, 0, 0, .34);
  --neo-glow: 0 0 28px rgba(47, 125, 255, .44);
  background:
    radial-gradient(circle at 4% 78%, rgba(76, 86, 255, .22), transparent 10rem),
    radial-gradient(circle at 92% 1%, rgba(47, 125, 255, .18), transparent 24rem),
    radial-gradient(circle at 82% 46%, rgba(24, 199, 255, .1), transparent 30rem),
    linear-gradient(180deg, #02050d 0%, #020814 48%, #020612 100%) !important;
}

body.app-page::before,
body.app-page::after {
  content: "" !important;
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body.app-page::before {
  z-index: 0;
  opacity: .75 !important;
  background:
    radial-gradient(circle at 97% 8%, rgba(31, 104, 255, .11) 0 .13rem, transparent .15rem),
    radial-gradient(circle at 2% 96%, rgba(139, 92, 255, .16) 0 .12rem, transparent .14rem);
  background-size: 1.15rem 1.15rem, 1.1rem 1.1rem;
  mask-image: linear-gradient(90deg, rgba(0, 0, 0, .45), transparent 28%, transparent 72%, rgba(0, 0, 0, .42));
}

body.app-theme-dark.app-page::before {
  opacity: .9 !important;
  background:
    radial-gradient(circle at 97% 8%, rgba(70, 120, 255, .16) 0 .13rem, transparent .15rem),
    radial-gradient(circle at 2% 96%, rgba(127, 82, 255, .18) 0 .12rem, transparent .14rem);
  background-size: 1.15rem 1.15rem, 1.1rem 1.1rem;
}

body.app-page::after {
  z-index: 0;
  opacity: .72 !important;
  background:
    radial-gradient(circle at 58% 7%, rgba(139, 92, 255, .16), transparent 2rem),
    linear-gradient(135deg, transparent 0 38%, rgba(31, 104, 255, .1) 38.1%, transparent 38.35% 100%);
}

body.app-theme-dark.app-page::after {
  background:
    radial-gradient(circle at 58% 7%, rgba(176, 92, 255, .26), transparent 2rem),
    linear-gradient(135deg, transparent 0 38%, rgba(47, 125, 255, .18) 38.1%, transparent 38.35% 100%);
}

body.app-page > :where(.app-rail, .qb-topbar, .sidebar, .content) {
  position: relative;
  z-index: 2;
}

body.app-page > :where(.floating-timer, .ai-chat-fab, .scroll-top-button) {
  z-index: 70;
}

body.app-page > .ai-chat-drawer {
  position: fixed;
  inset: 0;
  z-index: 1100;
}

body.app-page .app-rail {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .78rem;
  width: var(--neo-rail-width);
  padding: 3.3rem .55rem 1rem;
  border-right: 1px solid rgba(255, 255, 255, .24);
  background: linear-gradient(180deg, #2f78ff 0%, #4da1ff 54%, #cfe2ff 100%);
  box-shadow: 18px 0 50px rgba(31, 104, 255, .16);
}

body.app-theme-dark.app-page .app-rail {
  border-right-color: rgba(80, 125, 220, .26);
  background:
    linear-gradient(180deg, rgba(5, 14, 30, .98), rgba(4, 12, 26, .94)),
    linear-gradient(180deg, #153b83, #020814);
  box-shadow: 18px 0 50px rgba(0, 0, 0, .42), inset -1px 0 0 rgba(47, 125, 255, .24);
}

body.app-page .rail-button {
  display: grid;
  place-items: center;
  width: 2.7rem;
  height: 2.7rem;
  border: 1px solid transparent;
  border-radius: .78rem;
  color: rgba(255, 255, 255, .82);
  text-decoration: none;
}

body.app-page .rail-button.active,
body.app-page .rail-button:hover {
  border-color: rgba(255, 255, 255, .28);
  background: rgba(255, 255, 255, .18);
  color: #fff;
  box-shadow: 0 12px 28px rgba(14, 82, 220, .22);
}

body.app-theme-dark.app-page .rail-button.active,
body.app-theme-dark.app-page .rail-button:hover {
  border-color: rgba(47, 125, 255, .38);
  background: rgba(47, 125, 255, .2);
  box-shadow: 0 0 26px rgba(47, 125, 255, .34);
}

body.app-page .rail-button .lucide {
  width: 1.25rem;
  height: 1.25rem;
}

body.app-page .qb-topbar,
body.app-page > .sidebar,
body.app-page > .content {
  width: min(1440px, calc(100% - var(--neo-rail-width) - 3rem)) !important;
  margin-left: calc(var(--neo-rail-width) + 1rem) !important;
  margin-right: 1.1rem !important;
}

body.app-page .qb-topbar {
  position: sticky !important;
  top: 0;
  z-index: 50 !important;
  display: grid !important;
  grid-template-columns: minmax(12rem, 1fr) auto auto;
  gap: .8rem;
  align-items: center;
  min-height: 5.6rem;
  margin-top: 1.25rem !important;
  margin-bottom: 1.1rem !important;
  border: 1px solid var(--neo-line) !important;
  border-radius: 1.1rem !important;
  padding: .9rem 1rem !important;
  background: var(--neo-panel) !important;
  box-shadow: var(--neo-shadow) !important;
  backdrop-filter: blur(18px) saturate(135%);
}

body.app-theme-dark.app-page .qb-topbar {
  box-shadow: var(--neo-shadow), inset 0 0 0 1px rgba(47, 125, 255, .12) !important;
}

body.app-page .brand strong,
body.app-page .topbar-user-panel strong {
  color: var(--neo-text) !important;
}

body.app-page .brand small {
  color: var(--neo-muted) !important;
}

body.app-page .topnav {
  gap: .72rem;
}

body.app-page .topnav a {
  min-width: 5.9rem;
  min-height: 2.58rem;
  border-radius: .48rem !important;
  border-color: transparent !important;
  background: rgba(255, 255, 255, .82) !important;
  color: var(--neo-text) !important;
  box-shadow: 0 12px 26px rgba(54, 93, 151, .11) !important;
}

body.app-theme-dark.app-page .topnav a {
  border-color: rgba(98, 128, 180, .32) !important;
  background: rgba(12, 24, 43, .72) !important;
  color: #eaf2ff !important;
  box-shadow: 0 0 18px rgba(47, 125, 255, .12) !important;
}

body.app-page .topbar-user-panel {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: .48rem;
  min-width: 12rem;
}

body.app-page .topbar-avatar {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--neo-blue), var(--neo-green));
  color: #ffe447;
  font-weight: 950;
  box-shadow: 0 0 0 3px rgba(31, 104, 255, .16);
}

body.app-page .topbar-theme-toggle {
  display: inline-flex;
  border: 1px solid var(--neo-line);
  border-radius: 999px;
  padding: .18rem;
  background: var(--neo-field);
}

body.app-page .topbar-theme-toggle button {
  min-height: 1.72rem;
  border: 0;
  border-radius: 999px;
  padding: 0 .48rem;
  background: transparent;
  color: var(--neo-muted);
  font-size: .72rem;
  font-weight: 900;
}

body.app-page .topbar-theme-toggle button.active {
  background: var(--neo-blue);
  color: #fff;
}

body.app-page .topbar-settings-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .38rem;
  min-height: 2.18rem;
  border: 1px solid var(--neo-line);
  border-radius: 999px;
  padding: 0 .72rem;
  background: var(--neo-field);
  color: var(--neo-text);
  cursor: pointer;
  font-size: .76rem;
  font-weight: 900;
  white-space: nowrap;
  transition: background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
}

body.app-page .topbar-settings-button svg {
  width: 1rem;
  height: 1rem;
}

body.app-page .topbar-settings-button:hover,
body.app-page .topbar-settings-button:focus-visible,
body.app-page .topbar-settings-button[aria-expanded="true"] {
  border-color: var(--neo-blue);
  background: rgba(47, 125, 246, .12);
  color: var(--neo-blue);
}

body.app-theme-dark.app-page .topbar-settings-button {
  background: rgba(12, 24, 43, .72);
  color: #eaf2ff;
}

body.app-page > .sidebar {
  display: grid !important;
  gap: .82rem;
  margin-top: 0 !important;
  margin-bottom: 1rem !important;
  border: 1px solid var(--neo-line) !important;
  border-radius: 1.2rem !important;
  padding: .9rem !important;
  background: var(--neo-panel) !important;
  box-shadow: var(--neo-shadow) !important;
  backdrop-filter: blur(18px) saturate(135%);
}

body.app-theme-dark.app-page > .sidebar {
  box-shadow: var(--neo-shadow), 0 0 0 1px rgba(47, 125, 255, .08) !important;
}

body.app-page .chapter-nav {
  gap: .55rem !important;
  border-bottom-color: var(--neo-line) !important;
  padding-bottom: .8rem !important;
}

body.app-page .chapter-nav button,
body.app-page .sidebar-quick button,
body.app-page .topnav a,
body.app-page .toolbar button,
body.app-page .reset-actions button,
body.app-page .question-actions button,
body.app-page .secondary-action,
body.app-page .pagination button {
  border: 1px solid var(--neo-line) !important;
  background: var(--neo-field) !important;
  color: var(--neo-text) !important;
}

body.app-page .chapter-nav button.active,
body.app-page .chapter-nav button:hover,
body.app-page .sidebar-quick button:hover {
  border-color: rgba(31, 104, 255, .34) !important;
  background: rgba(31, 104, 255, .12) !important;
  color: var(--neo-blue) !important;
  box-shadow: 0 10px 24px rgba(31, 104, 255, .12) !important;
}

body.app-theme-dark.app-page .chapter-nav button.active,
body.app-theme-dark.app-page .chapter-nav button:hover,
body.app-theme-dark.app-page .sidebar-quick button:hover {
  border-color: rgba(47, 125, 255, .66) !important;
  background: rgba(47, 125, 255, .14) !important;
  color: #b8d6ff !important;
  box-shadow: 0 0 22px rgba(47, 125, 255, .24) !important;
}

body.app-page > .content {
  margin-top: 0 !important;
}

body.app-page .content-header {
  grid-template-columns: minmax(0, 1fr) minmax(21rem, .75fr) !important;
  gap: 1.45rem;
}

body.app-page .header-copy,
body.app-page .header-stats div,
body.app-page .toolbar,
body.app-page .library-panel,
body.app-page .mode-panel,
body.app-page .overview-card,
body.app-page .active-scope-bar,
body.app-page .data-status-panel,
body.app-page .reset-panel,
body.app-page .question-card,
body.app-page .empty-state,
body.app-page .pagination {
  border-color: var(--neo-line) !important;
  background: var(--neo-panel) !important;
  color: var(--neo-text) !important;
  box-shadow: var(--neo-shadow) !important;
  backdrop-filter: blur(18px) saturate(135%);
}

body.app-theme-dark.app-page :where(
  .header-copy,
  .header-stats div,
  .toolbar,
  .library-panel,
  .mode-panel,
  .overview-card,
  .active-scope-bar,
  .data-status-panel,
  .reset-panel,
  .question-card,
  .empty-state,
  .pagination
) {
  box-shadow: var(--neo-shadow), 0 0 0 1px rgba(47, 125, 255, .07), inset 0 1px 0 rgba(255, 255, 255, .04) !important;
}

body.app-page .header-copy {
  position: relative;
  overflow: hidden;
  min-height: 25rem;
  border-radius: 1.2rem !important;
}

body.app-page .header-copy::after {
  content: "";
  position: absolute;
  right: -1rem;
  bottom: -1rem;
  width: 15rem;
  height: 10rem;
  opacity: .82;
  pointer-events: none;
  background:
    radial-gradient(circle at 74% 32%, rgba(139, 92, 255, .16), transparent 1.5rem),
    radial-gradient(circle at 28% 62%, rgba(36, 184, 255, .16), transparent 1.4rem),
    linear-gradient(135deg, rgba(31, 104, 255, .28), rgba(139, 92, 255, .1));
  clip-path: polygon(8% 28%, 62% 4%, 98% 38%, 82% 94%, 22% 92%, 0 55%);
  filter: blur(.1px);
}

body.app-theme-dark.app-page .header-copy::after {
  opacity: .95;
  filter: drop-shadow(0 0 28px rgba(47, 125, 255, .32));
}

body.app-page .content-header h2 {
  max-width: 11ch;
  color: var(--neo-text) !important;
  font-size: 4.05rem !important;
  line-height: 1.05 !important;
}

body.app-page .eyebrow,
body.app-page .header-desc,
body.app-page .overview-card span,
body.app-page .overview-card small,
body.app-page .library-copy small,
body.app-page .mode-button small,
body.app-page .mode-status,
body.app-page .active-scope-main p,
body.app-page .active-scope-kicker,
body.app-page .data-status-panel span,
body.app-page .data-status-panel small,
body.app-page .reset-panel span,
body.app-page .empty-state span,
body.app-page .toolbar-field span {
  color: var(--neo-muted) !important;
}

body.app-page .hero-chips span,
body.app-page .library-entry,
body.app-page .mode-button {
  border: 1px solid var(--neo-line) !important;
  background: var(--neo-field) !important;
  color: var(--neo-text) !important;
}

body.app-theme-dark.app-page :where(.hero-chips span, .library-entry, .mode-button) {
  box-shadow: inset 0 0 0 1px rgba(47, 125, 255, .06) !important;
}

body.app-page .header-stats div {
  min-height: 7.55rem !important;
  border-radius: 1rem !important;
  padding: 1.25rem !important;
}

body.app-page .header-stats strong {
  color: var(--neo-text) !important;
}

body.app-page .header-stats div:first-child {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .9), rgba(239, 247, 255, .8)),
    radial-gradient(circle at 86% 88%, rgba(31, 104, 255, .12), transparent 8rem) !important;
}

body.app-page .header-stats div:nth-child(2) {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .9), rgba(245, 250, 255, .82)),
    radial-gradient(circle at 86% 88%, rgba(139, 92, 255, .12), transparent 8rem) !important;
}

body.app-page .header-stats div:nth-child(3) {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .9), rgba(255, 247, 250, .82)),
    radial-gradient(circle at 86% 88%, rgba(240, 82, 149, .12), transparent 8rem) !important;
}

body.app-theme-dark.app-page .header-stats div {
  background:
    linear-gradient(135deg, rgba(7, 18, 35, .92), rgba(4, 12, 24, .86)),
    radial-gradient(circle at 86% 88%, rgba(47, 125, 255, .12), transparent 8rem) !important;
}

body.app-page .toolbar {
  position: sticky !important;
  top: 6.95rem;
  z-index: 35;
  border-radius: 1rem !important;
  grid-template-columns: minmax(19rem, 1.35fr) repeat(4, minmax(8rem, .52fr)) !important;
}

body.app-page .toolbar input,
body.app-page .toolbar select,
body.app-page .answer-input,
body.app-page textarea {
  border-color: var(--neo-line) !important;
  background: var(--neo-field) !important;
  color: var(--neo-text) !important;
}

body.app-page .toolbar input:focus,
body.app-page .toolbar select:focus,
body.app-page .answer-input:focus,
body.app-page textarea:focus {
  border-color: rgba(31, 104, 255, .62) !important;
  box-shadow: 0 0 0 3px rgba(31, 104, 255, .15), 0 0 24px rgba(31, 104, 255, .16) !important;
}

body.app-theme-dark.app-page .toolbar input:focus,
body.app-theme-dark.app-page .toolbar select:focus,
body.app-theme-dark.app-page .answer-input:focus,
body.app-theme-dark.app-page textarea:focus {
  box-shadow: 0 0 0 2px rgba(47, 125, 255, .28), 0 0 24px rgba(47, 125, 255, .32) !important;
}

body.app-page #ai-paper-ask,
body.app-page #sync-button,
body.app-page .primary-action,
body.app-page .ai-chat-send-button,
body.app-page .ai-chat-new-button,
body.app-page .data-status-panel a:first-of-type {
  border-color: transparent !important;
  background: linear-gradient(135deg, var(--neo-blue), var(--neo-purple)) !important;
  color: #fff !important;
  box-shadow: 0 16px 30px rgba(31, 104, 255, .24) !important;
}

body.app-theme-dark.app-page :where(#ai-paper-ask, #sync-button, .primary-action, .ai-chat-send-button, .ai-chat-new-button, .data-status-panel a:first-of-type) {
  box-shadow: 0 0 28px rgba(47, 125, 255, .44), 0 0 18px rgba(176, 92, 255, .34) !important;
}

body.app-page .library-panel {
  border-radius: 1.05rem !important;
  padding: 1rem !important;
}

body.app-page .library-entry.active,
body.app-page .library-entry:hover,
body.app-page .mode-button.active,
body.app-page .mode-button:hover {
  border-color: rgba(31, 104, 255, .34) !important;
  background: rgba(31, 104, 255, .11) !important;
}

body.app-theme-dark.app-page :where(.library-entry.active, .library-entry:hover, .mode-button.active, .mode-button:hover) {
  border-color: rgba(47, 125, 255, .7) !important;
  background: rgba(47, 125, 255, .12) !important;
  box-shadow: 0 0 24px rgba(47, 125, 255, .22) !important;
}

body.app-page .library-entry em {
  color: var(--neo-blue) !important;
}

body.app-page .mode-icon-wrap {
  background: rgba(31, 104, 255, .12) !important;
  color: var(--neo-blue) !important;
}

body.app-page .mode-button:nth-child(2) .mode-icon-wrap {
  background: rgba(32, 185, 130, .12) !important;
  color: var(--neo-green) !important;
}

body.app-page .overview-card {
  border-radius: 1rem !important;
}

body.app-page .overview-card i {
  background: rgba(117, 146, 184, .18) !important;
}

body.app-page .overview-card i b {
  background: linear-gradient(90deg, var(--neo-blue), var(--neo-cyan), var(--neo-purple)) !important;
}

body.app-page .active-scope-bar {
  border-left: 3px solid var(--neo-purple) !important;
}

body.app-page .badge,
body.app-page .active-scope-pill,
body.app-page .active-scope-reset,
body.app-page .preview-tags span,
body.app-page .ai-chat-context-chips span {
  border-color: rgba(31, 104, 255, .22) !important;
  background: rgba(31, 104, 255, .09) !important;
  color: var(--neo-blue) !important;
}

body.app-theme-dark.app-page :where(.badge, .active-scope-pill, .active-scope-reset, .preview-tags span, .ai-chat-context-chips span) {
  border-color: rgba(87, 124, 184, .42) !important;
  background: rgba(13, 28, 52, .78) !important;
  color: #b8d6ff !important;
}

body.app-page .question-card {
  border-left: .36rem solid var(--neo-blue) !important;
  border-radius: .85rem !important;
}

body.app-page .question-card:nth-child(4n + 2) {
  border-left-color: var(--neo-green) !important;
}

body.app-page .question-card:nth-child(4n + 3) {
  border-left-color: var(--neo-purple) !important;
}

body.app-page .question-card:nth-child(4n + 4) {
  border-left-color: var(--neo-pink) !important;
}

body.app-page .question-card:hover {
  box-shadow: var(--neo-shadow), 0 0 0 1px rgba(31, 104, 255, .18) !important;
}

body.app-theme-dark.app-page .question-card:hover {
  box-shadow: var(--neo-shadow), 0 0 28px rgba(47, 125, 255, .18) !important;
}

body.app-page .analysis-box,
body.app-page .ai-coach-box,
body.app-page .ai-coach-grid section {
  border-color: var(--neo-line) !important;
  background: rgba(239, 247, 255, .72) !important;
  color: var(--neo-text) !important;
}

body.app-theme-dark.app-page :where(.analysis-box, .ai-coach-box, .ai-coach-grid section) {
  background: rgba(3, 11, 24, .84) !important;
}

body.app-page .data-status-panel a + a,
body.app-page .toolbar button,
body.app-page .reset-actions button,
body.app-page .question-actions button,
body.app-page .secondary-action,
body.app-page .pagination button {
  border-color: var(--neo-line) !important;
  background: var(--neo-field) !important;
  color: var(--neo-text) !important;
}

body.app-page > .floating-timer {
  right: 1.25rem !important;
  bottom: 1.25rem !important;
  border-color: var(--neo-line) !important;
  background: var(--neo-panel-strong) !important;
  box-shadow: var(--neo-shadow) !important;
}

body.app-theme-dark.app-page > .floating-timer {
  box-shadow: var(--neo-shadow), 0 0 24px rgba(47, 125, 255, .16) !important;
}

body.app-page #timer-toggle {
  background: linear-gradient(135deg, var(--neo-blue), var(--neo-purple)) !important;
  color: #fff !important;
}

body.app-page .ai-chat-fab {
  background: var(--neo-panel-strong) !important;
  color: var(--neo-blue) !important;
}

body.app-theme-dark.app-page .ai-chat-fab {
  box-shadow: 0 0 28px rgba(47, 125, 255, .3) !important;
}

@media (max-width: 620px) {
  body.app-page .ai-chat-fab {
    right: 1rem;
    bottom: 1rem;
  }

  body.app-page .scroll-top-button {
    right: 1.15rem;
    bottom: 5rem;
  }
}

body.app-page .interaction-toast {
  z-index: 100;
}

@media (max-width: 1180px) {
  body.app-page .qb-topbar,
  body.app-page > .sidebar,
  body.app-page > .content {
    width: calc(100% - var(--neo-rail-width) - 2rem) !important;
    margin-left: calc(var(--neo-rail-width) + .75rem) !important;
    margin-right: .75rem !important;
  }

  body.app-page .qb-topbar {
    grid-template-columns: 1fr;
  }

  body.app-page .topbar-user-panel {
    justify-content: flex-start;
  }

  body.app-page .content-header {
    grid-template-columns: 1fr !important;
  }

  body.app-page .toolbar {
    top: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 760px) {
  body.app-page {
    --neo-rail-width: 0rem;
  }

  body.app-page .app-rail {
    position: sticky;
    top: 0;
    z-index: 70;
    flex-direction: row;
    justify-content: center;
    width: 100%;
    height: auto;
    padding: .55rem;
  }

  body.app-page .qb-topbar,
  body.app-page > .sidebar,
  body.app-page > .content {
    width: calc(100% - 1rem) !important;
    margin-left: .5rem !important;
    margin-right: .5rem !important;
  }

  body.app-page .qb-topbar {
    margin-top: .65rem !important;
  }

  body.app-page .topnav {
    justify-content: flex-start;
  }

  body.app-page .topnav a {
    min-width: 0;
  }

  body.app-page .content-header h2 {
    font-size: 2.55rem !important;
  }

  body.app-page .hero-chips,
  body.app-page .header-stats,
  body.app-page .toolbar,
  body.app-page .library-panel,
  body.app-page .mode-switch,
  body.app-page .study-overview,
  body.app-page .data-status-panel {
    grid-template-columns: 1fr !important;
  }

  body.app-page .toolbar-actions {
    grid-template-columns: 1fr 1fr;
  }
}

/* Practice dashboard calm background refinement. */
body.app-theme-dark.app-page {
  background:
    radial-gradient(circle at 18% -8%, rgba(47, 125, 255, .1), transparent 28rem),
    radial-gradient(circle at 92% 4%, rgba(24, 199, 255, .07), transparent 24rem),
    linear-gradient(180deg, #020814 0%, #06101d 48%, #030812 100%) !important;
}

body.app-page::before,
body.app-page::after {
  opacity: 0 !important;
  background: none !important;
  animation: none !important;
  mask-image: none !important;
  -webkit-mask-image: none !important;
}

body.app-theme-dark.app-page::before,
body.app-theme-dark.app-page::after {
  opacity: 0 !important;
  background: none !important;
  animation: none !important;
  mask-image: none !important;
  -webkit-mask-image: none !important;
}

body.app-page .content-header::before,
body.app-page .content-header::after {
  opacity: 0 !important;
  background: none !important;
}

/* Question bank cockpit aligned to the dark source-library reference. */
body.app-page {
  --cockpit-max: 1380px;
  --cockpit-gap: 1rem;
  --cockpit-radius: .72rem;
  --cockpit-card-radius: .62rem;
  --cockpit-line: rgba(78, 116, 185, .42);
  --cockpit-glow-blue: 0 0 28px rgba(47, 125, 255, .32);
  --cockpit-glow-purple: 0 0 32px rgba(176, 92, 255, .26);
}

body.app-theme-dark.app-page {
  --neo-panel: rgba(3, 12, 25, .78);
  --neo-panel-strong: rgba(5, 15, 31, .92);
  --neo-field: rgba(5, 15, 31, .86);
  --neo-line: rgba(67, 104, 171, .48);
  --neo-line-strong: rgba(76, 121, 255, .76);
  --neo-shadow: 0 16px 42px rgba(0, 0, 0, .34);
}

body.app-page .qb-topbar,
body.app-page > .content {
  width: min(var(--cockpit-max), calc(100% - var(--neo-rail-width) - 2.2rem)) !important;
  margin-left: calc(var(--neo-rail-width) + .9rem) !important;
  margin-right: .9rem !important;
}

body.app-page > .sidebar {
  display: none !important;
}

body.app-page .qb-topbar {
  position: relative !important;
  top: auto !important;
  min-height: 4.6rem !important;
  margin-top: 1.6rem !important;
  margin-bottom: 1.35rem !important;
  border-radius: var(--cockpit-radius) !important;
  padding: .95rem 1.4rem !important;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .82), rgba(238, 247, 255, .64)),
    var(--neo-panel) !important;
}

body.app-theme-dark.app-page .qb-topbar {
  background:
    linear-gradient(135deg, rgba(12, 27, 52, .82), rgba(3, 10, 22, .72)),
    rgba(2, 8, 20, .72) !important;
  box-shadow: inset 0 0 0 1px rgba(72, 113, 185, .22), 0 18px 58px rgba(0, 0, 0, .32) !important;
}

body.app-page .topnav a {
  min-width: 5.75rem;
  min-height: 2.45rem;
  border-radius: .42rem !important;
  box-shadow: 0 10px 24px rgba(37, 89, 170, .1) !important;
}

body.app-theme-dark.app-page .topnav a {
  border-color: rgba(103, 134, 196, .38) !important;
  background: rgba(8, 18, 35, .78) !important;
  box-shadow: inset 0 0 0 1px rgba(117, 157, 230, .08), 0 0 18px rgba(47, 125, 255, .1) !important;
}

body.app-page > .content {
  display: flex !important;
  flex-direction: column;
  gap: var(--cockpit-gap);
  max-width: none !important;
  padding: 0 0 2.8rem !important;
}

body.app-page .content-header,
body.app-page .toolbar,
body.app-page .library-panel,
body.app-page .data-status-panel,
body.app-page .active-scope-bar,
body.app-page .question-list {
  margin: 0 !important;
}

body.app-page .content-header {
  order: 1 !important;
  display: block !important;
  min-height: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  overflow: visible !important;
}

body.app-page .hero-campus-image,
body.app-page .header-copy {
  display: none !important;
}

body.app-page .header-stats {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 1.45rem !important;
  width: 100%;
  margin: 0 !important;
}

body.app-page .header-stats div {
  position: relative;
  min-height: 8.35rem !important;
  display: grid !important;
  grid-template-columns: 4.25rem minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-content: center;
  align-items: center;
  column-gap: 1.15rem;
  border-radius: var(--cockpit-card-radius) !important;
  padding: 1.25rem 1.45rem !important;
  overflow: hidden;
}

body.app-page .header-stats div::after {
  content: "";
  position: absolute;
  right: -2.2rem;
  bottom: -3rem;
  width: 10rem;
  height: 10rem;
  border: 1px solid rgba(99, 148, 255, .16);
  border-radius: 50%;
  pointer-events: none;
}

body.app-page .header-stats .stat-icon-wrap {
  display: grid !important;
  place-items: center;
  grid-row: 1 / 3;
  grid-column: 1 !important;
  width: 3.85rem;
  height: 3.85rem;
  border-radius: .72rem;
  color: #fff;
  box-shadow: var(--cockpit-glow-blue);
}

body.app-page .header-stats .stat-total .stat-icon-wrap {
  background: linear-gradient(135deg, #7c4dff, #cfb3ff);
}

body.app-page .header-stats .stat-wrong .stat-icon-wrap {
  background: linear-gradient(135deg, #1377ff, #7cc8ff);
}

body.app-page .header-stats .stat-fav .stat-icon-wrap {
  background: linear-gradient(135deg, #ff5f74, #ffc0c7);
  box-shadow: 0 0 30px rgba(255, 96, 118, .28);
}

body.app-page .header-stats strong {
  align-self: end;
  font-size: 2rem !important;
  line-height: 1;
}

body.app-page .header-stats div > span:not(.stat-icon-wrap) {
  align-self: start;
  margin-top: .35rem;
}

body.app-theme-dark.app-page .header-stats div {
  border-color: rgba(79, 121, 190, .5) !important;
  background:
    linear-gradient(135deg, rgba(7, 20, 39, .9), rgba(2, 8, 20, .82)),
    radial-gradient(circle at 92% 95%, rgba(37, 99, 235, .16), transparent 8rem) !important;
}

body.app-theme-dark.app-page .header-stats div:nth-child(3) {
  border-color: rgba(255, 99, 128, .52) !important;
  background:
    linear-gradient(135deg, rgba(27, 12, 22, .88), rgba(2, 8, 20, .84)),
    radial-gradient(circle at 92% 95%, rgba(255, 95, 116, .18), transparent 8rem) !important;
}

body.app-page .toolbar {
  order: 2 !important;
  position: relative !important;
  top: auto !important;
  z-index: 10 !important;
  display: grid !important;
  grid-template-columns: minmax(18rem, 2.1fr) repeat(4, minmax(8.8rem, .76fr)) auto !important;
  align-items: end;
  gap: .9rem !important;
  border-radius: var(--cockpit-card-radius) !important;
  padding: 1rem 1.15rem !important;
}

body.app-page .toolbar-field[for="subject-filter"],
body.app-page .toolbar-field[for="source-kind-filter"],
body.app-page .toolbar-field[for="paper-type-filter"] {
  display: none !important;
}

body.app-page .toolbar-field[for="type-filter"] {
  display: grid !important;
}

body.app-page .toolbar-actions {
  grid-column: auto !important;
  display: flex !important;
  align-self: end;
  justify-content: flex-end;
  gap: .55rem !important;
}

body.app-page .toolbar-actions button:not(#reset-filters-button):not(#shuffle-button) {
  display: none !important;
}

body.app-page .toolbar-actions #reset-filters-button,
body.app-page .toolbar-actions #shuffle-button {
  min-width: 4.8rem;
  min-height: 2.95rem !important;
  border-radius: .48rem !important;
}

body.app-page .toolbar-actions #shuffle-button {
  border-color: transparent !important;
  background: linear-gradient(135deg, var(--neo-blue), #38a8ff) !important;
  color: #fff !important;
  box-shadow: 0 0 24px rgba(47, 125, 255, .28) !important;
}

body.app-theme-dark.app-page .toolbar {
  border-color: rgba(53, 104, 218, .72) !important;
  box-shadow: 0 0 0 1px rgba(47, 125, 255, .12), 0 0 28px rgba(47, 125, 255, .12) !important;
}

body.app-theme-dark.app-page .toolbar input,
body.app-theme-dark.app-page .toolbar select {
  border-color: rgba(78, 108, 157, .56) !important;
  background: rgba(3, 10, 22, .78) !important;
}

body.app-page .library-panel {
  order: 3 !important;
  position: relative;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 21rem !important;
  gap: .7rem !important;
  min-height: 18.4rem;
  border-radius: var(--cockpit-card-radius) !important;
  padding: 5.25rem 24rem 1.4rem 1.35rem !important;
  overflow: hidden;
}

body.app-page .library-panel::before {
  content: "\5FEB\901F\627E\9898";
  position: absolute;
  left: 1.35rem;
  top: 1.25rem;
  color: var(--neo-blue);
  font-size: 1.25rem;
  font-weight: 950;
}

body.app-page .library-panel::after {
  content: "";
  position: absolute;
  right: 3.4rem;
  bottom: 1.1rem;
  width: 18rem;
  height: 12.5rem;
  opacity: .95;
  background:
    radial-gradient(circle at 78% 17%, rgba(24, 199, 255, .32) 0 .72rem, transparent .76rem),
    radial-gradient(circle at 17% 20%, rgba(176, 92, 255, .28) 0 1.4rem, transparent 1.45rem),
    radial-gradient(ellipse at 56% 88%, rgba(47, 125, 255, .24), transparent 7rem),
    linear-gradient(135deg, transparent 0 38%, rgba(110, 149, 255, .34) 38.2% 60%, transparent 60.2%),
    linear-gradient(135deg, #1774ff 0 54%, #4a36e9 54% 100%);
  border-radius: 2rem 2rem 1.2rem 1.2rem;
  clip-path: polygon(14% 34%, 42% 34%, 48% 25%, 78% 25%, 84% 34%, 91% 34%, 91% 84%, 13% 84%);
  filter: drop-shadow(0 0 30px rgba(47, 125, 255, .42));
  pointer-events: none;
}

body.app-page .library-panel .library-entry {
  display: inline-grid !important;
  grid-template-columns: auto auto;
  justify-self: start;
  align-items: center;
  min-height: 2rem !important;
  margin: 0 .55rem .65rem 0;
  border-radius: .45rem !important;
  padding: .38rem .68rem !important;
  width: auto;
}

body.app-page .library-panel .library-icon {
  width: 1.25rem !important;
  height: 1.25rem !important;
  border-radius: .32rem !important;
}

body.app-page .library-panel .library-copy {
  display: contents;
}

body.app-page .library-panel .library-copy small {
  display: none !important;
}

body.app-page .library-panel .library-entry strong {
  font-size: .86rem;
  white-space: nowrap;
}

body.app-page .library-panel .library-entry em {
  margin-left: .35rem;
  font-style: normal;
}

body.app-page .mode-panel,
body.app-page .reset-panel {
  display: none !important;
}

body.app-page .study-overview {
  display: none !important;
}

body.app-page .data-status-panel {
  order: 4 !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto auto !important;
  align-items: center;
  gap: .85rem !important;
  min-height: 4.5rem;
  border-radius: var(--cockpit-card-radius) !important;
  padding: .95rem 1.15rem !important;
}

body.app-page .data-status-panel article:first-child {
  display: grid;
  gap: .08rem;
}

body.app-page .data-status-panel article:nth-child(2) {
  display: none !important;
}

body.app-page .data-status-panel a {
  min-height: 2.45rem !important;
  border-radius: .48rem !important;
  padding: 0 .95rem !important;
}

body.app-page .active-scope-bar {
  order: 5 !important;
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 1rem;
  min-height: 3.45rem;
  border-left: 0 !important;
  border-radius: var(--cockpit-card-radius) !important;
  padding: .75rem 1rem !important;
}

body.app-page .active-scope-main {
  display: flex;
  align-items: center;
  gap: .9rem;
}

body.app-page .active-scope-main p {
  display: none !important;
}

body.app-page .active-scope-kicker {
  color: var(--neo-text) !important;
  font-size: 1.05rem !important;
}

body.app-page .active-scope-actions {
  justify-content: space-between;
}

body.app-page #ai-start-scope {
  display: none !important;
}

body.app-page .question-list {
  order: 6 !important;
  display: grid;
  gap: .72rem;
}

body.app-page .question-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "meta actions"
    "title actions"
    "answer actions"
    "feedback feedback"
    "analysis analysis";
  align-items: center;
  gap: .28rem 1.4rem;
  min-height: 7.4rem;
  border-radius: var(--cockpit-card-radius) !important;
  padding: .85rem 1.35rem .9rem 1.25rem !important;
}

body.app-page .question-card-head {
  display: contents !important;
  padding: 0 !important;
  border: 0 !important;
}

body.app-page .question-meta {
  grid-area: meta;
  display: flex;
  flex-wrap: wrap;
  gap: .34rem;
  min-width: 0;
}

body.app-page .card-icon-actions {
  grid-area: actions;
  justify-content: flex-end;
}

body.app-page .question-title {
  grid-area: title;
  margin: .15rem 0 .08rem !important;
  font-size: 1.05rem !important;
  line-height: 1.55 !important;
}

body.app-page .answer-label {
  display: none !important;
}

body.app-page .answer-checker {
  grid-area: answer;
}

body.app-page .answer-input {
  min-height: 2.45rem !important;
  height: 2.45rem !important;
  resize: vertical;
}

body.app-page .question-actions {
  grid-area: actions;
  display: grid !important;
  grid-template-columns: 5rem 8.9rem;
  gap: .65rem !important;
  align-content: center;
  justify-items: stretch;
  min-width: 14.6rem;
}

body.app-page .question-actions button {
  min-height: 2.65rem !important;
  border-radius: .48rem !important;
  white-space: nowrap;
}

body.app-page .question-actions .submit-answer,
body.app-page .question-actions .analysis-toggle,
body.app-page .question-actions .ai-coach-toggle,
body.app-page .question-actions .ai-select-context-btn,
body.app-page .question-actions .ask-ai-new-btn {
  display: none !important;
}

body.app-page .question-actions .ask-ai-btn {
  border-color: transparent !important;
  background: linear-gradient(135deg, var(--neo-blue), var(--neo-purple)) !important;
  color: #fff !important;
  box-shadow: 0 0 24px rgba(47, 125, 255, .36), 0 0 20px rgba(176, 92, 255, .22) !important;
}

body.app-page .answer-feedback {
  grid-area: feedback;
}

body.app-page .analysis-box,
body.app-page .ai-coach-container {
  grid-area: analysis;
}

body.app-theme-dark.app-page .question-card {
  border-color: rgba(52, 82, 134, .55) !important;
  background:
    linear-gradient(135deg, rgba(5, 17, 33, .92), rgba(2, 8, 20, .88)),
    rgba(2, 8, 20, .82) !important;
}

body.app-theme-dark.app-page .question-actions .ask-ai-btn {
  box-shadow: 0 0 26px rgba(47, 125, 255, .48), 0 0 24px rgba(176, 92, 255, .38) !important;
}

@media (max-width: 1180px) {
  body.app-page .header-stats,
  body.app-page .toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  body.app-page .library-panel {
    grid-template-columns: 1fr !important;
    padding-right: 1.35rem !important;
  }

  body.app-page .library-panel::after {
    opacity: .16;
    right: 1rem;
  }

  body.app-page .question-card {
    grid-template-columns: 1fr;
    grid-template-areas:
      "meta"
      "title"
      "answer"
      "actions"
      "feedback"
      "analysis";
  }

  body.app-page .question-actions {
    grid-area: actions;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    min-width: 0;
  }
}

@media (max-width: 760px) {
  body.app-page .qb-topbar,
  body.app-page > .content {
    width: calc(100% - 1rem) !important;
    margin-left: .5rem !important;
    margin-right: .5rem !important;
  }

  body.app-page .header-stats,
  body.app-page .toolbar,
  body.app-page .data-status-panel,
  body.app-page .active-scope-bar {
    grid-template-columns: 1fr !important;
  }

  body.app-page .topnav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  body.app-page .topnav a {
    min-width: 0;
  }
}

/* Tight alignment pass for the reference screenshot rhythm. */
body.app-page .toolbar {
  grid-template-columns: minmax(17rem, 1.65fr) repeat(5, minmax(7.4rem, .72fr)) 5.25rem !important;
  padding: .9rem 1rem !important;
}

body.app-page .toolbar-actions {
  min-width: 0;
}

body.app-page .toolbar-actions button:not(.apply-filters-button) {
  display: none !important;
}

body.app-page .toolbar-actions .apply-filters-button {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 5rem;
  min-width: 5rem;
  min-height: 2.9rem !important;
  border-color: transparent !important;
  border-radius: .5rem !important;
  background: linear-gradient(135deg, var(--neo-blue), #31a7ff) !important;
  color: #fff !important;
  box-shadow: 0 0 24px rgba(47, 125, 255, .34) !important;
}

body.app-theme-dark.app-page .toolbar-actions .apply-filters-button {
  box-shadow: 0 0 28px rgba(47, 125, 255, .55) !important;
}

body.app-page .toolbar-actions #apply-filters-button {
  display: inline-flex !important;
}

body.app-page .toolbar-actions button#apply-filters-button.apply-filters-button:not(#reset-filters-button):not(#shuffle-button) {
  display: inline-flex !important;
}

body.app-page .toolbar-actions #reset-filters-button {
  display: none !important;
}

body.app-page .library-panel {
  display: flex !important;
  flex-wrap: wrap;
  align-content: flex-start;
  align-items: flex-start;
  min-height: 16.3rem;
  padding-top: 5rem !important;
  padding-bottom: 1.05rem !important;
}

body.app-page .library-panel .library-entry {
  flex: 0 0 auto;
  margin: 0 .62rem .72rem 0 !important;
}

body.app-page .question-card {
  min-height: 6.6rem;
  padding-top: .72rem !important;
  padding-bottom: .72rem !important;
}

body.app-page .question-title {
  font-size: 1rem !important;
  line-height: 1.45 !important;
}

body.app-page .answer-input {
  min-height: 2.1rem !important;
  height: 2.1rem !important;
  padding-top: .5rem !important;
  padding-bottom: .5rem !important;
}

body.app-page .question-actions {
  grid-template-columns: 5rem 7.65rem;
  min-width: 13.25rem;
}

body.app-page .question-actions button {
  min-height: 2.45rem !important;
}

@media (max-width: 1180px) {
  body.app-page .toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

body.app-page .hero-campus-image {
  opacity: .018 !important;
  filter: saturate(.72) brightness(.74) blur(.25px) !important;
}

body.app-page .header-copy::after {
  right: -3rem;
  bottom: -3rem;
  width: 19rem;
  height: 15rem;
  opacity: .14;
  clip-path: none;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(47, 125, 255, .18), transparent 68%) !important;
  filter: blur(18px);
}

body.app-theme-dark.app-page .header-copy::after {
  opacity: .12 !important;
  filter: blur(22px);
}

/* Resource-search homepage: question_bank.html is a source library entry screen, not an answer desk. */
body.resource-home {
  --source-max: 1380px;
  --source-rail: var(--neo-rail-width, 3.65rem);
  --source-text: #0b1a34;
  --source-muted: #6b7890;
  --source-panel: rgba(255, 255, 255, .82);
  --source-panel-strong: rgba(255, 255, 255, .94);
  --source-line: rgba(174, 199, 234, .72);
  --source-line-strong: rgba(74, 132, 255, .54);
  --source-shadow: 0 18px 42px rgba(42, 87, 152, .12);
  --source-blue: #2563eb;
  --source-cyan: #27a8ff;
  --source-purple: #9b54ff;
  --source-pink: #f45292;
  --source-green: #25b991;
  color: var(--source-text);
  background:
    radial-gradient(circle at 7% 86%, rgba(110, 156, 255, .18), transparent 9rem),
    radial-gradient(circle at 96% 3%, rgba(181, 210, 255, .2), transparent 16rem),
    linear-gradient(90deg, rgba(45, 129, 255, .7) 0 var(--source-rail), transparent var(--source-rail)),
    linear-gradient(180deg, #edf5ff 0%, #f8fbff 46%, #edf5ff 100%) !important;
}

body.resource-home.app-theme-dark {
  --source-text: #e9f1ff;
  --source-muted: #8b9ab6;
  --source-panel: rgba(3, 12, 25, .74);
  --source-panel-strong: rgba(5, 14, 30, .9);
  --source-line: rgba(66, 103, 168, .54);
  --source-line-strong: rgba(74, 132, 255, .74);
  --source-shadow: 0 18px 48px rgba(0, 0, 0, .36);
  background:
    radial-gradient(circle at 3% 86%, rgba(37, 99, 235, .22), transparent 7rem),
    radial-gradient(circle at 94% 0, rgba(126, 34, 206, .18), transparent 12rem),
    linear-gradient(90deg, rgba(5, 12, 25, .96) 0 var(--source-rail), transparent var(--source-rail)),
    #020814 !important;
}

body.resource-home .content-header,
body.resource-home .study-overview,
body.resource-home .mode-panel,
body.resource-home .library-panel,
body.resource-home .reset-panel,
body.resource-home .data-status-panel,
body.resource-home .toolbar,
body.resource-home #active-scope-bar,
body.resource-home #question-list,
body.resource-home .ai-chat-fab,
body.resource-home > .floating-timer {
  display: none !important;
}

body.resource-home .qb-topbar,
body.resource-home > .content {
  width: min(var(--source-max), calc(100% - var(--source-rail) - 2rem)) !important;
  max-width: none !important;
  margin-left: calc(var(--source-rail) + .8rem) !important;
  margin-right: .8rem !important;
}

body.resource-home > .content {
  display: flex !important;
  flex-direction: column;
  gap: .9rem;
  padding: 0 0 3rem !important;
}

body.resource-home .qb-topbar {
  margin-top: 1.55rem !important;
  margin-bottom: 1.35rem !important;
  border-radius: .7rem !important;
  border-color: rgba(192, 211, 238, .8) !important;
  background:
    radial-gradient(circle at 33% 50%, rgba(93, 137, 255, .14) 0 .92rem, transparent .98rem),
    radial-gradient(circle at 60% 55%, rgba(202, 96, 255, .11) 0 1.55rem, transparent 1.62rem),
    rgba(255, 255, 255, .72) !important;
  box-shadow: var(--source-shadow) !important;
}

body.resource-home.app-theme-dark .qb-topbar {
  border-color: rgba(67, 103, 167, .5) !important;
  background:
    radial-gradient(circle at 33% 50%, rgba(74, 132, 255, .22) 0 .92rem, transparent .98rem),
    radial-gradient(circle at 60% 55%, rgba(191, 71, 255, .2) 0 1.55rem, transparent 1.62rem),
    rgba(2, 8, 20, .74) !important;
  box-shadow: 0 0 0 1px rgba(47, 125, 255, .08), 0 20px 58px rgba(0, 0, 0, .34) !important;
}

body.resource-home .topnav a {
  min-width: 6rem;
  min-height: 2.45rem;
  border-radius: .42rem !important;
  background: rgba(255, 255, 255, .82) !important;
}

body.resource-home.app-theme-dark .topnav a {
  border-color: rgba(102, 134, 196, .44) !important;
  background: rgba(7, 17, 34, .82) !important;
  color: #e9f1ff !important;
  box-shadow: inset 0 0 0 1px rgba(117, 157, 230, .08), 0 0 18px rgba(47, 125, 255, .12) !important;
}

body.resource-home .qb-source-stats {
  order: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.35rem;
}

body.resource-home .qb-source-stat-card,
body.resource-home .qb-source-filter-panel,
body.resource-home .qb-source-quick-panel,
body.resource-home .qb-source-result-head,
body.resource-home .qb-source-active-filters,
body.resource-home .qb-resource-card,
body.resource-home .qb-source-empty {
  border: 1px solid var(--source-line);
  border-radius: .64rem;
  background: var(--source-panel);
  box-shadow: var(--source-shadow);
  backdrop-filter: blur(18px);
}

body.resource-home .qb-source-stat-card {
  position: relative;
  display: grid;
  grid-template-columns: 4.7rem minmax(0, 1fr);
  align-items: center;
  gap: 1rem;
  min-height: 8.25rem;
  padding: 1.35rem 1.45rem;
  overflow: hidden;
}

body.resource-home .qb-source-stat-card::after {
  content: "";
  position: absolute;
  right: -2.5rem;
  bottom: -3.2rem;
  width: 11rem;
  height: 11rem;
  border-radius: 50%;
  border: 1px solid rgba(93, 152, 255, .15);
  pointer-events: none;
}

body.resource-home .qb-source-stat-card.stat-import::before {
  content: "";
  position: absolute;
  right: 1.5rem;
  top: 1.5rem;
  width: 5.8rem;
  height: 4.6rem;
  opacity: .34;
  background-image: radial-gradient(circle, #ef5b76 1.2px, transparent 1.4px);
  background-size: .55rem .55rem;
}

body.resource-home .qb-source-stat-icon {
  display: grid;
  place-items: center;
  width: 4rem;
  height: 4rem;
  border-radius: .72rem;
  color: #fff;
}

body.resource-home .stat-resources .qb-source-stat-icon {
  background: linear-gradient(135deg, #7c4dff, #cdb8ff);
  box-shadow: 0 0 30px rgba(124, 77, 255, .26);
}

body.resource-home .stat-files .qb-source-stat-icon {
  background: linear-gradient(135deg, #1577ff, #89d0ff);
  box-shadow: 0 0 30px rgba(21, 119, 255, .24);
}

body.resource-home .stat-import .qb-source-stat-icon {
  background: linear-gradient(135deg, #ff586d, #ffc1c9);
  box-shadow: 0 0 30px rgba(255, 88, 109, .24);
}

body.resource-home .qb-source-stat-card span:not(.qb-source-stat-icon) {
  display: block;
  color: var(--source-muted);
  font-size: .86rem;
  font-weight: 850;
}

body.resource-home .qb-source-stat-card strong {
  display: block;
  margin-top: .16rem;
  color: var(--source-text);
  font-size: clamp(1.8rem, 3vw, 2.35rem);
  line-height: 1;
}

body.resource-home .qb-source-stat-card.stat-import strong {
  font-size: clamp(1.55rem, 2.15vw, 1.95rem);
  white-space: nowrap;
}

body.resource-home .qb-source-stat-card small {
  display: block;
  margin-top: .44rem;
  color: var(--source-muted);
  font-size: .84rem;
}

body.resource-home.app-theme-dark .qb-source-stat-card,
body.resource-home.app-theme-dark .qb-source-filter-panel,
body.resource-home.app-theme-dark .qb-source-result-head,
body.resource-home.app-theme-dark .qb-source-active-filters,
body.resource-home.app-theme-dark .qb-resource-card,
body.resource-home.app-theme-dark .qb-source-empty {
  border-color: var(--source-line);
  background:
    linear-gradient(135deg, rgba(5, 17, 33, .88), rgba(2, 8, 20, .83)),
    var(--source-panel);
}

body.resource-home .qb-source-filter-panel {
  order: 2;
  padding: .92rem 1rem;
}

body.resource-home #qb-source-filter-form {
  display: grid;
  grid-template-columns: minmax(18rem, 1.85fr) minmax(9rem, .9fr) minmax(8rem, .75fr) minmax(9rem, .74fr) minmax(9rem, .74fr) 5.4rem;
  gap: .85rem;
  align-items: end;
}

body.resource-home .qb-source-filter-field {
  display: grid;
  gap: .36rem;
  min-width: 0;
}

body.resource-home .qb-source-filter-field span,
body.resource-home .qb-source-quick-group > span {
  color: var(--source-muted);
  font-size: .78rem;
  font-weight: 900;
}

body.resource-home .qb-source-filter-field input,
body.resource-home .qb-source-filter-field select {
  width: 100%;
  height: 2.8rem;
  min-width: 0;
  border: 1px solid var(--source-line);
  border-radius: .52rem;
  padding: 0 .82rem;
  background: rgba(255, 255, 255, .9);
  color: var(--source-text);
  outline: none;
  font: inherit;
}

body.resource-home .qb-source-filter-field input:focus,
body.resource-home .qb-source-filter-field select:focus {
  border-color: var(--source-line-strong);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .14);
}

body.resource-home.app-theme-dark .qb-source-filter-field input,
body.resource-home.app-theme-dark .qb-source-filter-field select {
  border-color: rgba(83, 113, 166, .52);
  background: rgba(3, 10, 22, .76);
  color: #e9f1ff;
}

body.resource-home #qb-source-filter-button,
body.resource-home .qb-resource-ai-button {
  border-color: transparent !important;
  background: linear-gradient(135deg, var(--source-blue), var(--source-cyan)) !important;
  color: #fff !important;
  box-shadow: 0 0 24px rgba(37, 99, 235, .28) !important;
}

body.resource-home #qb-source-filter-button {
  min-height: 2.8rem;
  border-radius: .52rem !important;
}

body.resource-home.app-theme-dark #qb-source-filter-button,
body.resource-home.app-theme-dark .qb-resource-ai-button {
  box-shadow: 0 0 26px rgba(37, 99, 235, .5), 0 0 22px rgba(155, 84, 255, .26) !important;
}

body.resource-home .qb-source-quick-panel {
  order: 3;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .8rem 1rem;
  min-height: 16.9rem;
  padding: 1.25rem 22rem 1.25rem 1.35rem;
  overflow: hidden;
}

body.resource-home .qb-source-quick-panel {
  background:
    radial-gradient(circle at 86% 44%, rgba(57, 145, 255, .11), transparent 10rem),
    linear-gradient(135deg, rgba(255, 255, 255, .78), rgba(239, 247, 255, .72)),
    var(--source-panel);
}

body.resource-home.app-theme-dark .qb-source-quick-panel {
  border-color: rgba(93, 90, 255, .72);
  background:
    radial-gradient(circle at 86% 44%, rgba(57, 145, 255, .18), transparent 10rem),
    linear-gradient(135deg, rgba(4, 15, 31, .9), rgba(2, 8, 20, .84)),
    var(--source-panel);
  box-shadow: 0 0 0 1px rgba(118, 100, 255, .16), 0 0 32px rgba(67, 97, 238, .18);
}

body.resource-home .qb-source-quick-copy {
  display: grid;
  gap: .24rem;
}

body.resource-home .qb-source-quick-copy strong {
  color: var(--source-blue);
  font-size: 1.25rem;
  line-height: 1.15;
}

body.resource-home .qb-source-quick-copy span {
  color: var(--source-muted);
  line-height: 1.6;
}

body.resource-home .qb-source-ghost-button,
body.resource-home .qb-source-result-head button,
body.resource-home .qb-source-active-filters > button,
body.resource-home .qb-resource-open-button {
  min-height: 2.45rem;
  border: 1px solid var(--source-line);
  border-radius: .52rem;
  background: rgba(255, 255, 255, .72);
  color: var(--source-blue);
  padding: 0 .92rem;
  font-weight: 850;
}

body.resource-home .qb-source-quick-panel > .qb-source-ghost-button {
  position: absolute;
  top: 1.2rem;
  right: 3rem;
  z-index: 2;
}

body.resource-home.app-theme-dark .qb-source-ghost-button,
body.resource-home.app-theme-dark .qb-source-result-head button,
body.resource-home.app-theme-dark .qb-source-active-filters > button,
body.resource-home.app-theme-dark .qb-resource-open-button {
  border-color: rgba(94, 123, 182, .58);
  background: rgba(5, 16, 34, .78);
  color: #80b7ff;
}

body.resource-home .qb-source-quick-groups {
  grid-column: 1 / 2;
  display: grid;
  gap: .86rem;
  margin-top: .18rem;
}

body.resource-home .qb-source-quick-group {
  display: grid;
  gap: .48rem;
}

body.resource-home .qb-source-chip-list,
body.resource-home .qb-source-active-filter-list,
body.resource-home .qb-source-file-list,
body.resource-home .qb-resource-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .46rem;
}

body.resource-home .qb-source-chip,
body.resource-home .qb-source-active-pill,
body.resource-home .qb-resource-meta span {
  display: inline-flex;
  align-items: center;
  gap: .38rem;
  min-height: 2.1rem;
  border: 1px solid rgba(159, 187, 231, .72);
  border-radius: .42rem;
  background: rgba(255, 255, 255, .64);
  color: #3568b3;
  padding: 0 .68rem;
  font-weight: 850;
}

body.resource-home .qb-resource-meta .qb-resource-kind {
  border-color: rgba(37, 99, 235, .52);
  background: rgba(37, 99, 235, .08);
  color: var(--source-blue);
}

body.resource-home .qb-resource-meta .qb-resource-kind.book {
  border-color: rgba(37, 185, 145, .5);
  background: rgba(37, 185, 145, .1);
  color: var(--source-green);
}

body.resource-home .qb-resource-meta .qb-resource-kind.doc {
  border-color: rgba(249, 115, 22, .46);
  background: rgba(249, 115, 22, .1);
  color: #d06a1e;
}

body.resource-home .qb-source-chip:nth-child(2n) {
  color: #7e47cc;
  border-color: rgba(167, 122, 230, .52);
}

body.resource-home .qb-source-chip:nth-child(3n) {
  color: #d06a1e;
  border-color: rgba(250, 146, 68, .5);
}

body.resource-home .qb-source-chip:nth-child(4n) {
  color: #c94375;
  border-color: rgba(236, 93, 139, .45);
}

body.resource-home .qb-source-chip:nth-child(5n) {
  color: #159b87;
  border-color: rgba(32, 184, 160, .48);
}

body.resource-home .qb-source-chip.active {
  background: rgba(37, 99, 235, .12);
  border-color: rgba(37, 99, 235, .45);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .08);
}

body.resource-home.app-theme-dark .qb-source-chip,
body.resource-home.app-theme-dark .qb-source-active-pill,
body.resource-home.app-theme-dark .qb-resource-meta span {
  background: rgba(12, 26, 50, .76);
  border-color: rgba(70, 100, 154, .72);
  color: #7ab5ff;
}

body.resource-home.app-theme-dark .qb-source-chip:nth-child(2n) {
  color: #bd7cff;
}

body.resource-home.app-theme-dark .qb-source-chip:nth-child(3n) {
  color: #ff9d45;
}

body.resource-home.app-theme-dark .qb-source-chip:nth-child(4n) {
  color: #ff6c9f;
}

body.resource-home.app-theme-dark .qb-source-chip:nth-child(5n) {
  color: #4bd9cb;
}

body.resource-home .qb-source-chip small {
  opacity: .8;
}

body.resource-home .qb-source-illustration {
  position: absolute;
  right: 3.35rem;
  bottom: .85rem;
  width: 16.8rem;
  height: 12.8rem;
  pointer-events: none;
}

body.resource-home .qb-source-illustration::before,
body.resource-home .qb-source-illustration::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  opacity: .7;
}

body.resource-home .qb-source-illustration::before {
  right: .7rem;
  top: 1.3rem;
  width: 2rem;
  height: 2rem;
  background: rgba(88, 166, 255, .24);
}

body.resource-home .qb-source-illustration::after {
  left: 1.1rem;
  top: 1.1rem;
  width: 2.8rem;
  height: 1.2rem;
  transform: rotate(32deg);
  border: 2px solid rgba(178, 76, 255, .35);
}

body.resource-home .qb-source-illustration-folder {
  position: absolute;
  right: 3.1rem;
  bottom: 2.1rem;
  width: 7.8rem;
  height: 5.5rem;
  border-radius: .8rem .8rem 1rem 1rem;
  background: linear-gradient(135deg, #1783ff 0%, #2f64ff 54%, #6938ff 100%);
  box-shadow: 0 0 34px rgba(37, 99, 235, .38);
}

body.resource-home .qb-source-illustration-folder::before {
  content: "";
  position: absolute;
  left: 1.1rem;
  top: -2rem;
  width: 5.5rem;
  height: 4.2rem;
  border-radius: .52rem;
  background: linear-gradient(180deg, #edf5ff, #b8d0ff);
  transform: rotate(7deg);
  box-shadow: 0 12px 22px rgba(37, 99, 235, .22);
}

body.resource-home .qb-source-illustration-folder::after {
  content: "";
  position: absolute;
  left: .9rem;
  top: -1.05rem;
  width: 4rem;
  height: .4rem;
  border-radius: 999px;
  background: rgba(64, 113, 255, .38);
  box-shadow: 0 .9rem 0 rgba(64, 113, 255, .28);
}

body.resource-home .qb-source-illustration-lens {
  position: absolute;
  right: 2.15rem;
  bottom: 1.2rem;
  width: 3.45rem;
  height: 3.45rem;
  border: .55rem solid rgba(165, 226, 255, .86);
  border-radius: 50%;
  box-shadow: 0 0 22px rgba(80, 203, 255, .46);
}

body.resource-home .qb-source-illustration-lens::after {
  content: "";
  position: absolute;
  right: -1.25rem;
  bottom: -1.05rem;
  width: 2.35rem;
  height: .62rem;
  border-radius: 999px;
  background: #65c8ff;
  transform: rotate(45deg);
}

body.resource-home .qb-source-result-head {
  order: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4.1rem;
  padding: .82rem 1.1rem;
}

body.resource-home .qb-source-result-head div {
  display: grid;
  gap: .15rem;
}

body.resource-home .qb-source-result-head strong {
  color: var(--source-text);
  font-size: 1.05rem;
}

body.resource-home .qb-source-result-head span {
  color: var(--source-muted);
  font-size: .88rem;
}

body.resource-home .qb-source-result-head button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
}

body.resource-home .qb-source-active-filters {
  order: 5;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: .8rem;
  min-height: 3.35rem;
  padding: .72rem 1rem;
}

body.resource-home .qb-source-active-filters[hidden] {
  display: none !important;
}

body.resource-home .qb-source-active-filters > strong {
  color: var(--source-text);
  font-size: 1rem;
}

body.resource-home .qb-source-active-pill {
  min-height: 2rem;
  color: var(--source-blue);
}

body.resource-home .qb-source-active-pill button {
  display: inline-grid;
  place-items: center;
  width: 1.45rem;
  height: 1.45rem;
  min-height: 0;
  padding: 0;
  color: inherit;
}

body.resource-home .qb-resource-list {
  order: 6;
  display: grid;
  gap: .78rem;
}

body.resource-home .qb-resource-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .72rem 1.25rem;
  align-items: center;
  min-height: 6.45rem;
  padding: .72rem 1.15rem .78rem 1.3rem;
  overflow: hidden;
}

body.resource-home .qb-resource-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: .34rem;
  background: linear-gradient(180deg, var(--source-cyan), var(--source-blue));
}

body.resource-home .qb-resource-card.accent-2::before {
  background: linear-gradient(180deg, #45d8be, #25b991);
}

body.resource-home .qb-resource-card.accent-3::before {
  background: linear-gradient(180deg, #9567ff, #7c4dff);
}

body.resource-home .qb-resource-card.accent-4::before {
  background: linear-gradient(180deg, #ff688e, #f45292);
}

body.resource-home .qb-resource-card.accent-5::before {
  background: linear-gradient(180deg, #ff9d45, #f97316);
}

body.resource-home .qb-resource-main {
  display: grid;
  gap: .26rem;
  min-width: 0;
}

body.resource-home .qb-resource-card h2 {
  margin: .06rem 0 0;
  color: var(--source-text);
  font-size: .98rem;
  line-height: 1.38;
}

body.resource-home .qb-resource-source {
  margin: 0;
  color: var(--source-muted);
  font-size: .8rem;
  line-height: 1.42;
  overflow-wrap: anywhere;
}

body.resource-home .qb-resource-source a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .18rem;
}

body.resource-home .qb-source-file-list {
  margin-top: .12rem;
}

body.resource-home .qb-source-file-badge,
body.resource-home .qb-source-file-empty {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  min-height: 1.82rem;
  border: 1px solid rgba(215, 223, 237, .9);
  border-radius: .38rem;
  background: rgba(255, 255, 255, .74);
  color: var(--source-text);
  padding: 0 .58rem;
  font-size: .86rem;
  font-weight: 850;
}

button.qb-source-file-badge,
button.qb-resource-open-button {
  appearance: none;
  cursor: pointer;
  font: inherit;
}

body.resource-home .qb-source-file-badge strong {
  color: #ef334d;
  font-weight: 950;
}

body.resource-home .qb-source-file-badge.variant-html strong {
  color: var(--source-blue);
}

body.resource-home .qb-source-file-badge.variant-mdx strong,
body.resource-home .qb-source-file-badge.variant-md strong {
  color: var(--source-purple);
}

body.resource-home.app-theme-dark .qb-source-file-badge,
body.resource-home.app-theme-dark .qb-source-file-empty {
  border-color: rgba(70, 98, 152, .68);
  background: rgba(9, 22, 44, .74);
}

body.resource-home .qb-resource-actions {
  display: grid;
  grid-template-columns: minmax(5rem, auto) minmax(9.2rem, auto);
  align-items: center;
  gap: .72rem;
}

body.resource-home .qb-resource-type {
  display: none;
  justify-self: end;
  color: var(--source-blue);
  font-weight: 900;
}

body.resource-home .qb-resource-type.book {
  color: var(--source-green);
}

body.resource-home .qb-resource-type.doc {
  color: #d06a1e;
}

body.resource-home .qb-resource-open-button,
body.resource-home .qb-resource-ai-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .42rem;
  min-height: 2.45rem;
  border-radius: .48rem;
  padding: 0 1rem;
  white-space: nowrap;
}

body.resource-home .qb-resource-open-button {
  min-width: 4.9rem;
  color: var(--source-purple);
  border-color: rgba(155, 84, 255, .56);
  background: rgba(255, 255, 255, .7);
}

body.resource-home .qb-resource-ai-button {
  min-width: 9.4rem;
  background: linear-gradient(135deg, var(--source-blue), var(--source-purple)) !important;
}

body.resource-home .qb-source-empty {
  order: 6;
  min-height: 7rem;
  padding: 1.4rem;
  color: var(--source-muted);
  text-align: center;
}

body.resource-home .qb-source-empty.is-error {
  color: #d1435b;
}

body.resource-home.app-theme-dark .qb-source-empty.is-error {
  color: #ff7388;
}

body.resource-home .qb-source-empty-inline {
  color: var(--source-muted);
  font-size: .88rem;
}

@media (max-width: 1180px) {
  body.resource-home .qb-source-stats,
  body.resource-home #qb-source-filter-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.resource-home #qb-source-filter-button {
    grid-column: 1 / -1;
  }

  body.resource-home .qb-source-quick-panel {
    padding-right: 1.35rem;
  }

  body.resource-home .qb-source-quick-panel > .qb-source-ghost-button {
    position: static;
    justify-self: end;
  }

  body.resource-home .qb-source-illustration {
    opacity: .18;
    right: 1rem;
  }

  body.resource-home .qb-resource-card {
    grid-template-columns: 1fr;
  }

  body.resource-home .qb-resource-actions {
    justify-content: end;
  }
}

@media (max-width: 760px) {
  body.resource-home {
    background:
      radial-gradient(circle at 96% 3%, rgba(181, 210, 255, .2), transparent 12rem),
      linear-gradient(180deg, #edf5ff 0%, #f8fbff 55%, #edf5ff 100%) !important;
  }

  body.resource-home.app-theme-dark {
    background:
      radial-gradient(circle at 94% 0, rgba(126, 34, 206, .18), transparent 10rem),
      #020814 !important;
  }

  body.resource-home .app-rail {
    display: none !important;
  }

  body.resource-home .qb-topbar,
  body.resource-home > .content {
    width: calc(100% - 1rem) !important;
    margin-left: .5rem !important;
    margin-right: .5rem !important;
  }

  body.resource-home .qb-topbar {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: .68rem !important;
    margin-top: .5rem !important;
    margin-bottom: .85rem !important;
    padding: .78rem .85rem !important;
  }

  body.resource-home .qb-topbar .brand img {
    width: 2.1rem;
    height: 2.1rem;
  }

  body.resource-home .topnav {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: nowrap;
    width: 100%;
    gap: .48rem;
    overflow-x: auto;
    scrollbar-width: none;
  }

  body.resource-home .topnav::-webkit-scrollbar {
    display: none;
  }

  body.resource-home .topnav a {
    flex: 0 0 auto;
    min-width: 4.75rem;
    min-height: 2.25rem;
    padding: .5rem .52rem;
  }

  body.resource-home .topbar-user-panel {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    min-width: 0;
    min-height: 2.35rem;
    padding: .4rem .52rem;
    gap: .42rem;
  }

  body.resource-home .topbar-theme-toggle {
    display: none;
  }

  body.resource-home > .content {
    gap: .72rem;
  }

  body.resource-home .qb-source-stats,
  body.resource-home #qb-source-filter-form,
  body.resource-home .qb-source-active-filters {
    grid-template-columns: 1fr;
  }

  body.resource-home .qb-source-stats {
    gap: .7rem;
  }

  body.resource-home .qb-source-stat-card {
    grid-template-columns: 3.65rem minmax(0, 1fr);
    gap: .72rem;
    min-height: 5.85rem;
    padding: .92rem .98rem;
  }

  body.resource-home .qb-source-stat-icon {
    width: 3.1rem;
    height: 3.1rem;
  }

  body.resource-home .qb-source-stat-card.stat-import strong {
    white-space: normal;
  }

  body.resource-home .qb-source-filter-panel {
    padding: .78rem .85rem;
  }

  body.resource-home #qb-source-filter-form {
    gap: .62rem;
  }

  body.resource-home .qb-source-filter-field {
    gap: .24rem;
  }

  body.resource-home .qb-source-filter-field input,
  body.resource-home .qb-source-filter-field select {
    height: 2.5rem;
  }

  body.resource-home #qb-source-filter-button {
    min-height: 2.5rem;
  }

  body.resource-home .qb-source-quick-panel {
    min-height: 0;
    grid-template-columns: 1fr;
    gap: .5rem;
    padding: .82rem .9rem;
  }

  body.resource-home .qb-source-quick-copy {
    gap: .16rem;
  }

  body.resource-home .qb-source-quick-copy strong {
    font-size: 1.08rem;
  }

  body.resource-home .qb-source-quick-copy span {
    font-size: .82rem;
    line-height: 1.38;
  }

  body.resource-home .qb-source-quick-groups {
    gap: .5rem;
  }

  body.resource-home .qb-source-quick-group {
    gap: .3rem;
  }

  body.resource-home .qb-source-chip-list,
  body.resource-home .qb-resource-meta {
    gap: .34rem;
  }

  body.resource-home .qb-source-chip {
    min-height: 1.76rem;
    border-radius: .34rem;
    padding: 0 .48rem;
    font-size: .8rem;
  }

  body.resource-home .qb-source-quick-panel > .qb-source-ghost-button {
    min-height: 2.1rem;
    padding: 0 .72rem;
  }

  body.resource-home .qb-resource-meta span {
    min-height: 1.72rem;
    border-radius: .34rem;
    padding: 0 .48rem;
    font-size: .78rem;
  }

  body.resource-home .qb-source-illustration {
    display: none;
  }

  body.resource-home .qb-source-result-head {
    align-items: center;
    flex-direction: row;
    gap: .72rem;
    padding: .75rem .9rem;
  }

  body.resource-home .qb-source-result-head div {
    min-width: 0;
  }

  body.resource-home .qb-source-result-head button {
    min-height: 2.2rem;
    padding: 0 .72rem;
  }

  body.resource-home .qb-resource-actions {
    grid-template-columns: minmax(4.8rem, .78fr) minmax(8.5rem, 1.22fr);
    justify-content: stretch;
    gap: .5rem;
  }

  body.resource-home .qb-resource-card {
    gap: .58rem;
    padding: .8rem .95rem .9rem 1.05rem;
  }

  body.resource-home .qb-resource-card h2 {
    font-size: .94rem;
  }

  body.resource-home .qb-source-file-badge,
  body.resource-home .qb-source-file-empty {
    min-height: 1.68rem;
    padding: 0 .48rem;
    font-size: .8rem;
  }

  body.resource-home .qb-resource-open-button,
  body.resource-home .qb-resource-ai-button {
    min-height: 2.28rem;
    padding: 0 .6rem;
  }

  body.resource-home .qb-resource-ai-button {
    min-width: 0;
  }

  body.resource-home .qb-resource-type {
    justify-self: start;
  }
}

/* Practice dashboard main branch, clean dual-theme layout. */
body.app-page:not(.resource-home) {
  --practice-user-avatar: url("../images/nailong-avatar.png");
  --dash-sidebar-width: 19.25rem;
  --dash-radius: 14px;
  --dash-radius-sm: 10px;
  --dash-blue: #2f7df6;
  --dash-blue-strong: #1f67ea;
  --dash-green: #28b768;
  --dash-red: #ef5b4d;
  --dash-yellow: #f3b91c;
  --dash-purple: #7c4dff;
  --dash-teal: #12a88d;
  --dash-bg: #f5f8fc;
  --dash-sidebar: rgba(255, 255, 255, .96);
  --dash-panel: rgba(255, 255, 255, .9);
  --dash-panel-solid: #ffffff;
  --dash-field: rgba(255, 255, 255, .96);
  --dash-line: rgba(204, 215, 232, .92);
  --dash-line-strong: rgba(47, 125, 246, .36);
  --dash-text: #101828;
  --dash-muted: #667085;
  --dash-soft: #eef4ff;
  --dash-shadow: 0 16px 36px rgba(22, 45, 78, .09);
  --dash-shadow-soft: 0 10px 26px rgba(22, 45, 78, .07);
  display: grid !important;
  grid-template-columns: var(--dash-sidebar-width) minmax(0, 1fr) !important;
  min-height: 100dvh !important;
  overflow-x: hidden !important;
  background:
    radial-gradient(circle at 88% 4%, rgba(47, 125, 246, .08), transparent 28rem),
    linear-gradient(180deg, #fbfdff 0%, var(--dash-bg) 100%) !important;
  color: var(--dash-text) !important;
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", system-ui, sans-serif !important;
}

body.app-theme-dark.app-page:not(.resource-home) {
  --dash-bg: #07111d;
  --dash-sidebar: rgba(2, 8, 16, .96);
  --dash-panel: rgba(12, 22, 36, .78);
  --dash-panel-solid: #0c1624;
  --dash-field: rgba(8, 17, 29, .9);
  --dash-line: rgba(76, 91, 116, .66);
  --dash-line-strong: rgba(74, 132, 255, .52);
  --dash-text: #eef4ff;
  --dash-muted: #9aa9bd;
  --dash-soft: rgba(47, 125, 246, .12);
  --dash-shadow: 0 18px 44px rgba(0, 0, 0, .28);
  --dash-shadow-soft: 0 12px 32px rgba(0, 0, 0, .2);
  background:
    radial-gradient(circle at 84% 0%, rgba(47, 125, 246, .12), transparent 30rem),
    radial-gradient(circle at 0% 78%, rgba(18, 168, 141, .08), transparent 28rem),
    linear-gradient(180deg, #091523 0%, #07111d 46%, #050b13 100%) !important;
}

body.app-page:not(.resource-home)::before,
body.app-page:not(.resource-home)::after {
  display: none !important;
  content: none !important;
}

body.app-page:not(.resource-home) .app-rail,
body.app-page:not(.resource-home) .qb-topbar,
body.app-page:not(.resource-home) .qb-source-stats,
body.app-page:not(.resource-home) .qb-source-filter-panel,
body.app-page:not(.resource-home) .qb-source-quick-panel,
body.app-page:not(.resource-home) .qb-source-result-head,
body.app-page:not(.resource-home) .qb-source-active-filters,
body.app-page:not(.resource-home) .qb-resource-list,
body.app-page:not(.resource-home) .reset-panel,
body.app-page:not(.resource-home) .active-scope-bar,
body.app-page:not(.resource-home) .school-name-img,
body.app-page:not(.resource-home) .hero-campus-image {
  display: none !important;
}

body.app-page:not(.resource-home) svg.lucide,
body.app-page:not(.resource-home) i[data-lucide] {
  width: 1.18rem;
  height: 1.18rem;
  stroke-width: 2.1;
}

body.app-page:not(.resource-home) > .sidebar {
  position: sticky !important;
  top: 0 !important;
  z-index: 6 !important;
  grid-column: 1 !important;
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
  height: 100dvh !important;
  padding: 1.55rem .95rem 1.15rem !important;
  border-right: 1px solid var(--dash-line) !important;
  background: var(--dash-sidebar) !important;
  color: var(--dash-text) !important;
  box-shadow: 8px 0 32px rgba(22, 45, 78, .06) !important;
  overflow-y: auto !important;
}

body.app-theme-dark.app-page:not(.resource-home) > .sidebar {
  box-shadow: 12px 0 36px rgba(0, 0, 0, .22) !important;
}

body.app-page:not(.resource-home) .sidebar-brand {
  display: flex !important;
  align-items: center !important;
  gap: .8rem !important;
  margin: 0 0 1.9rem !important;
  padding: 0 .45rem !important;
}

body.app-page:not(.resource-home) .sidebar-brand > div {
  flex: 1 1 auto !important;
  min-width: 0 !important;
}

body.app-page:not(.resource-home) .sidebar-brand .brand-emblem {
  width: 4rem !important;
  height: 4rem !important;
  object-fit: cover !important;
  border-radius: 50% !important;
  border: 1px solid rgba(47, 125, 246, .3) !important;
  background: #07122a !important;
  box-shadow: none !important;
}

body.app-theme-dark.app-page:not(.resource-home) .sidebar-brand .brand-emblem {
  background: rgba(255, 255, 255, .04) !important;
}

body.app-page:not(.resource-home) .sidebar-brand h1 {
  margin: 0 !important;
  color: var(--dash-text) !important;
  font-size: 1.08rem !important;
  line-height: 1.2 !important;
  font-weight: 920 !important;
  letter-spacing: 0 !important;
  white-space: nowrap !important;
}

body.app-page:not(.resource-home) .sidebar-brand p {
  margin-top: .22rem !important;
  color: var(--dash-muted) !important;
  font-size: .84rem !important;
  letter-spacing: 0 !important;
}

body.app-page:not(.resource-home) .sidebar-settings-button {
  display: grid !important;
  place-items: center !important;
  flex: 0 0 auto !important;
  width: 2.45rem !important;
  height: 2.45rem !important;
  margin-left: auto !important;
  border: 1px solid var(--dash-line) !important;
  border-radius: var(--dash-radius-sm) !important;
  background: var(--dash-field) !important;
  color: var(--dash-muted) !important;
  cursor: pointer !important;
  box-shadow: var(--dash-shadow-soft) !important;
  transition: background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease !important;
}

body.app-page:not(.resource-home) .sidebar-settings-button:hover,
body.app-page:not(.resource-home) .sidebar-settings-button:focus-visible,
body.app-page:not(.resource-home) .sidebar-settings-button[aria-expanded="true"] {
  border-color: var(--dash-blue) !important;
  background: rgba(47, 125, 246, .12) !important;
  color: var(--dash-blue) !important;
}

body.app-page:not(.resource-home) .campus-card,
body.app-page:not(.resource-home) .author-card {
  display: none !important;
}

body.app-page:not(.resource-home) .chapter-nav,
body.app-page:not(.resource-home) .sidebar-quick {
  display: grid !important;
  gap: .46rem !important;
}

body.app-page:not(.resource-home) .chapter-nav {
  padding-bottom: 1.1rem !important;
  border-bottom: 1px solid var(--dash-line) !important;
}

body.app-page:not(.resource-home) .sidebar-quick {
  margin-top: 1rem !important;
}

body.app-page:not(.resource-home) .chapter-nav button,
body.app-page:not(.resource-home) .sidebar-quick button {
  display: grid !important;
  grid-template-columns: 1.75rem minmax(0, 1fr) auto !important;
  align-items: center !important;
  min-height: 3rem !important;
  border: 1px solid transparent !important;
  border-radius: var(--dash-radius-sm) !important;
  padding: .62rem .78rem !important;
  background: transparent !important;
  color: var(--dash-muted) !important;
  font-size: .95rem !important;
  font-weight: 720 !important;
  text-align: left !important;
  box-shadow: none !important;
}

body.app-page:not(.resource-home) .chapter-nav button::before,
body.app-page:not(.resource-home) .chapter-nav button::after,
body.app-page:not(.resource-home) .sidebar-quick button::before,
body.app-page:not(.resource-home) .sidebar-quick button::after {
  display: none !important;
  content: none !important;
}

body.app-page:not(.resource-home) .chapter-nav button svg:first-child,
body.app-page:not(.resource-home) .sidebar-quick button svg:first-child {
  color: var(--dash-blue) !important;
}

body.app-page:not(.resource-home) .chapter-nav button svg:last-child {
  justify-self: end !important;
  color: var(--dash-muted) !important;
}

body.app-page:not(.resource-home) .chapter-nav button.active,
body.app-page:not(.resource-home) .chapter-nav button:hover {
  border-color: rgba(47, 125, 246, .16) !important;
  background: linear-gradient(135deg, rgba(47, 125, 246, .1), rgba(47, 125, 246, .03)) !important;
  color: var(--dash-blue) !important;
}

body.app-theme-dark.app-page:not(.resource-home) .chapter-nav button.active,
body.app-theme-dark.app-page:not(.resource-home) .chapter-nav button:hover {
  border-color: rgba(74, 132, 255, .34) !important;
  background: linear-gradient(135deg, rgba(47, 125, 246, .16), rgba(47, 125, 246, .04)) !important;
}

body.app-page:not(.resource-home) .sidebar-quick button {
  min-height: 2.25rem !important;
  padding: .36rem .65rem !important;
}

body.app-page:not(.resource-home) .sidebar-quick em {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 1.58rem !important;
  height: 1.58rem !important;
  border-radius: 999px !important;
  background: rgba(93, 111, 136, .12) !important;
  color: var(--dash-muted) !important;
  font-style: normal !important;
  font-size: .76rem !important;
}

body.app-page:not(.resource-home) .sync-panel {
  position: relative !important;
  display: grid !important;
  grid-template-columns: 3.4rem minmax(0, 1fr) !important;
  align-items: center !important;
  gap: .65rem .85rem !important;
  min-height: 7.6rem !important;
  margin-top: auto !important;
  border: 1px solid var(--dash-line) !important;
  border-radius: var(--dash-radius) !important;
  padding: 1rem 1rem 1.35rem !important;
  background: var(--dash-panel) !important;
  box-shadow: var(--dash-shadow-soft) !important;
  overflow: hidden !important;
}

body.app-page:not(.resource-home) .sync-panel::before {
  content: "" !important;
  position: static !important;
  left: auto !important;
  top: auto !important;
  grid-row: 1 / 3 !important;
  width: 3.25rem !important;
  height: 3.25rem !important;
  border-radius: 50% !important;
  background:
    var(--practice-user-avatar) center / cover no-repeat,
    linear-gradient(135deg, #ffe27a, #ffb027) !important;
  box-shadow: 0 10px 22px rgba(47, 125, 246, .18) !important;
}

body.app-page:not(.resource-home) .sync-panel::after {
  content: "" !important;
  position: absolute !important;
  left: 1rem !important;
  right: 1rem !important;
  bottom: .9rem !important;
  height: .34rem !important;
  border-radius: 999px !important;
  background: linear-gradient(90deg, var(--dash-blue) 0 44%, rgba(112, 124, 143, .18) 44% 100%) !important;
}

body.app-page:not(.resource-home) .sync-panel p {
  margin: 0 !important;
  color: var(--dash-muted) !important;
  font-size: .82rem !important;
  font-weight: 720 !important;
}

body.app-page:not(.resource-home) .sync-panel p:first-child {
  color: var(--dash-text) !important;
  font-size: .94rem !important;
  font-weight: 920 !important;
}

body.app-page:not(.resource-home) .sync-panel #back-entry,
body.app-page:not(.resource-home) .sync-guide-link {
  display: none !important;
}

body.app-page:not(.resource-home) > .content {
  grid-column: 2 !important;
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 1.55rem 3rem 2.7rem 3.05rem !important;
  gap: 1.45rem !important;
  color: var(--dash-text) !important;
}

body.app-page:not(.resource-home) .toolbar {
  order: 1 !important;
  display: grid !important;
  grid-template-columns: minmax(22rem, 1fr) 10.2rem 9.7rem 9.7rem 7.2rem !important;
  align-items: center !important;
  gap: .7rem !important;
  width: min(100%, calc(100vw - var(--dash-sidebar-width) - 31rem)) !important;
  min-width: 52rem !important;
  margin: 0 19rem 0 0 !important;
  border: 1px solid var(--dash-line) !important;
  border-radius: var(--dash-radius) !important;
  padding: .92rem 1rem !important;
  background: var(--dash-panel) !important;
  box-shadow: var(--dash-shadow) !important;
  backdrop-filter: blur(14px) !important;
}

body.app-page:not(.resource-home) .toolbar-field span {
  display: none !important;
}

body.app-page:not(.resource-home) .toolbar label[for="course-filter"],
body.app-page:not(.resource-home) .toolbar label[for="subject-filter"],
body.app-page:not(.resource-home) .toolbar label[for="source-kind-filter"],
body.app-page:not(.resource-home) .toolbar label[for="paper-type-filter"],
body.app-page:not(.resource-home) .toolbar label[for="type-filter"] {
  display: none !important;
}

body.app-page:not(.resource-home) .toolbar-actions {
  display: contents !important;
}

body.app-page:not(.resource-home) .toolbar-actions button {
  display: none !important;
}

body.app-page:not(.resource-home) .toolbar #reset-filters-button {
  display: inline-flex !important;
}

body.app-page:not(.resource-home) .toolbar input,
body.app-page:not(.resource-home) .toolbar select,
body.app-page:not(.resource-home) .toolbar button {
  width: 100% !important;
  height: 3rem !important;
  min-height: 3rem !important;
  border: 1px solid var(--dash-line) !important;
  border-radius: var(--dash-radius-sm) !important;
  background: var(--dash-field) !important;
  color: var(--dash-text) !important;
  box-shadow: none !important;
  font-size: .9rem !important;
  font-weight: 720 !important;
}

body.app-page:not(.resource-home) .toolbar input {
  padding: 0 1rem 0 3.15rem !important;
  background:
    radial-gradient(circle at 1.55rem 50%, transparent 0 .42rem, var(--dash-muted) .44rem .52rem, transparent .54rem),
    linear-gradient(45deg, transparent 0 54%, var(--dash-muted) 54% 65%, transparent 65%),
    var(--dash-field) !important;
  background-size: 2.75rem 100%, .9rem .9rem, auto !important;
  background-position: 0 0, 2.08rem 1.78rem, 0 0 !important;
  background-repeat: no-repeat !important;
}

body.app-page:not(.resource-home) .toolbar input::placeholder {
  color: var(--dash-muted) !important;
}

body.app-page:not(.resource-home) .toolbar select {
  padding: 0 2rem 0 1rem !important;
}

body.app-page:not(.resource-home) .toolbar #reset-filters-button {
  align-items: center !important;
  justify-content: center !important;
  color: var(--dash-text) !important;
}

body.app-page:not(.resource-home) .toolbar input:focus,
body.app-page:not(.resource-home) .toolbar select:focus,
body.app-page:not(.resource-home) .toolbar button:focus-visible {
  outline: 0 !important;
  border-color: var(--dash-blue) !important;
  box-shadow: 0 0 0 3px rgba(47, 125, 246, .16) !important;
}

body.app-page:not(.resource-home) .content-header {
  order: 2 !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(34rem, .48fr) !important;
  align-items: center !important;
  gap: 2rem !important;
  min-height: 14.2rem !important;
  border: 1px solid var(--dash-line) !important;
  border-radius: var(--dash-radius) !important;
  padding: 2rem 2.1rem !important;
  background: var(--dash-panel) !important;
  box-shadow: var(--dash-shadow) !important;
  overflow: hidden !important;
}

body.app-page:not(.resource-home) .content-header::before,
body.app-page:not(.resource-home) .content-header::after {
  display: none !important;
  content: none !important;
}

body.app-page:not(.resource-home) .header-copy {
  display: grid !important;
  gap: .7rem !important;
  max-width: 44rem !important;
}

body.app-page:not(.resource-home) .eyebrow {
  display: none !important;
}

body.app-page:not(.resource-home) .content-header h2 {
  margin: 0 !important;
  color: var(--dash-text) !important;
  font-size: 2rem !important;
  line-height: 1.18 !important;
  font-weight: 940 !important;
  letter-spacing: 0 !important;
}

body.app-page:not(.resource-home) .header-desc {
  max-width: 31rem !important;
  margin: 0 !important;
  color: var(--dash-muted) !important;
  font-size: 1rem !important;
  line-height: 1.75 !important;
}

body.app-page:not(.resource-home) .hero-chips {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: .55rem !important;
  margin-top: .35rem !important;
}

body.app-page:not(.resource-home) .hero-chips span {
  min-height: 2rem !important;
  border: 1px solid rgba(47, 125, 246, .28) !important;
  border-radius: 7px !important;
  padding: .35rem .66rem !important;
  background: rgba(47, 125, 246, .07) !important;
  color: var(--dash-blue) !important;
  font-size: .78rem !important;
  font-weight: 760 !important;
  white-space: nowrap !important;
}

body.app-page:not(.resource-home) .header-stats {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 1.45rem !important;
}

body.app-page:not(.resource-home) .header-stats div {
  display: grid !important;
  grid-template-columns: 4rem minmax(0, 1fr) !important;
  grid-template-rows: auto auto !important;
  align-items: center !important;
  gap: .18rem 1rem !important;
  min-height: 8rem !important;
  border: 1px solid var(--dash-line) !important;
  border-radius: var(--dash-radius) !important;
  padding: 1.2rem 1.25rem !important;
  background: var(--dash-panel-solid) !important;
  box-shadow: var(--dash-shadow-soft) !important;
  text-align: left !important;
}

body.app-page:not(.resource-home) .header-stats div::before {
  display: none !important;
  content: none !important;
}

body.app-page:not(.resource-home) .stat-icon-wrap {
  grid-row: 1 / 3 !important;
  display: grid !important;
  place-items: center !important;
  width: 4rem !important;
  height: 4rem !important;
  border-radius: 50% !important;
  background: rgba(47, 125, 246, .12) !important;
  color: var(--dash-blue) !important;
}

body.app-page:not(.resource-home) .stat-wrong .stat-icon-wrap {
  background: rgba(239, 91, 77, .12) !important;
  color: var(--dash-red) !important;
}

body.app-page:not(.resource-home) .stat-fav .stat-icon-wrap {
  background: rgba(243, 185, 28, .16) !important;
  color: var(--dash-yellow) !important;
}

body.app-page:not(.resource-home) .stat-icon-wrap svg {
  width: 1.8rem !important;
  height: 1.8rem !important;
}

body.app-page:not(.resource-home) .header-stats strong {
  color: var(--dash-text) !important;
  font-size: 2.15rem !important;
  line-height: 1 !important;
  font-weight: 900 !important;
}

body.app-page:not(.resource-home) .header-stats span:not(.stat-icon-wrap) {
  color: var(--dash-muted) !important;
  font-size: 1rem !important;
  font-weight: 720 !important;
}

body.app-page:not(.resource-home) .mode-panel {
  order: 3 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

body.app-page:not(.resource-home) .mode-switch {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 1.6rem !important;
}

body.app-page:not(.resource-home) .mode-button {
  position: relative !important;
  display: grid !important;
  grid-template-columns: 4.8rem minmax(0, 1fr) 2.8rem !important;
  grid-template-rows: auto auto !important;
  align-items: center !important;
  gap: .25rem 1rem !important;
  min-height: 9.1rem !important;
  border: 1px solid rgba(47, 125, 246, .42) !important;
  border-radius: var(--dash-radius) !important;
  padding: 1.45rem 1.75rem !important;
  background: linear-gradient(135deg, rgba(47, 125, 246, .08), var(--dash-panel)) !important;
  color: var(--dash-text) !important;
  box-shadow: none !important;
}

body.app-page:not(.resource-home) .mode-button:nth-child(2) {
  border-color: rgba(40, 183, 104, .46) !important;
  background: linear-gradient(135deg, rgba(40, 183, 104, .08), var(--dash-panel)) !important;
}

body.app-page:not(.resource-home) .mode-button::before {
  display: none !important;
  content: none !important;
}

body.app-page:not(.resource-home) .mode-button::after {
  content: "›" !important;
  display: grid !important;
  place-items: center !important;
  grid-column: 3 !important;
  grid-row: 1 / 3 !important;
  width: 2.7rem !important;
  height: 2.7rem !important;
  border-radius: 50% !important;
  background: rgba(47, 125, 246, .08) !important;
  color: var(--dash-blue) !important;
  font-size: 2rem !important;
  line-height: 1 !important;
}

body.app-page:not(.resource-home) .mode-button:nth-child(2)::after {
  background: rgba(40, 183, 104, .1) !important;
  color: var(--dash-green) !important;
}

body.app-page:not(.resource-home) .mode-icon-wrap {
  grid-column: 1 !important;
  grid-row: 1 / 3 !important;
  display: grid !important;
  place-items: center !important;
  width: 4.25rem !important;
  height: 4.25rem !important;
  border-radius: 13px !important;
  background: linear-gradient(135deg, #5da2ff, var(--dash-blue-strong)) !important;
  color: #ffffff !important;
  box-shadow: 0 12px 24px rgba(47, 125, 246, .22) !important;
}

body.app-page:not(.resource-home) .mode-button:nth-child(2) .mode-icon-wrap {
  background: linear-gradient(135deg, #59d98c, #22a962) !important;
  box-shadow: 0 12px 24px rgba(40, 183, 104, .2) !important;
}

body.app-page:not(.resource-home) .mode-icon-wrap svg {
  width: 2.35rem !important;
  height: 2.35rem !important;
}

body.app-page:not(.resource-home) .mode-button strong {
  color: var(--dash-text) !important;
  font-size: 1.22rem !important;
  font-weight: 920 !important;
}

body.app-page:not(.resource-home) .mode-button small,
body.app-page:not(.resource-home) .mode-status {
  color: var(--dash-muted) !important;
  font-size: .94rem !important;
}

body.app-page:not(.resource-home) .mode-status:empty {
  display: none !important;
}

body.app-page:not(.resource-home) .library-panel {
  order: 4 !important;
  display: grid !important;
  grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  gap: 1.35rem !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  overflow: visible !important;
}

body.app-page:not(.resource-home) .library-panel::before,
body.app-page:not(.resource-home) .library-panel::after {
  display: none !important;
  content: none !important;
}

body.app-page:not(.resource-home) .library-entry {
  display: grid !important;
  grid-template-columns: 3rem minmax(0, 1fr) !important;
  grid-template-areas:
    "icon count"
    "icon copy" !important;
  align-items: center !important;
  gap: .25rem .75rem !important;
  min-height: 7.2rem !important;
  border: 1px solid var(--dash-line) !important;
  border-radius: var(--dash-radius) !important;
  padding: 1.18rem 1.05rem !important;
  background: var(--dash-panel) !important;
  color: var(--dash-text) !important;
  box-shadow: var(--dash-shadow-soft) !important;
}

body.app-page:not(.resource-home) .library-entry.active,
body.app-page:not(.resource-home) .library-entry:hover {
  border-color: var(--dash-line-strong) !important;
  transform: translateY(-1px) !important;
}

body.app-page:not(.resource-home) .library-icon {
  grid-area: icon !important;
  display: grid !important;
  place-items: center !important;
  width: 3rem !important;
  height: 3rem !important;
  border-radius: 50% !important;
  background: rgba(47, 125, 246, .11) !important;
  color: var(--dash-blue) !important;
  box-shadow: none !important;
}

body.app-page:not(.resource-home) .library-icon.danger {
  background: rgba(239, 91, 77, .12) !important;
  color: var(--dash-red) !important;
}

body.app-page:not(.resource-home) .library-icon.warm {
  background: rgba(243, 185, 28, .16) !important;
  color: var(--dash-yellow) !important;
}

body.app-page:not(.resource-home) .library-icon.ai {
  background: rgba(124, 77, 255, .12) !important;
  color: var(--dash-purple) !important;
}

body.app-page:not(.resource-home) .library-icon.adversarial {
  background: rgba(18, 168, 141, .12) !important;
  color: var(--dash-teal) !important;
}

body.app-page:not(.resource-home) .library-icon svg {
  width: 1.58rem !important;
  height: 1.58rem !important;
}

body.app-page:not(.resource-home) .library-copy {
  grid-area: copy !important;
  min-width: 0 !important;
}

body.app-page:not(.resource-home) .library-copy strong {
  color: var(--dash-text) !important;
  font-size: 1.02rem !important;
  font-weight: 900 !important;
}

body.app-page:not(.resource-home) .library-copy small {
  color: var(--dash-muted) !important;
  font-size: .78rem !important;
}

body.app-page:not(.resource-home) .library-entry em {
  grid-area: count !important;
  justify-self: end !important;
  min-width: 3.35rem !important;
  border: 0 !important;
  background: transparent !important;
  color: var(--dash-text) !important;
  font-size: clamp(1.12rem, 1.55vw, 1.45rem) !important;
  font-weight: 860 !important;
  font-style: normal !important;
  line-height: 1 !important;
  text-align: right !important;
}

body.app-page:not(.resource-home) .library-entry.active em {
  color: var(--dash-blue) !important;
}

body.app-page:not(.resource-home) .study-overview {
  order: 5 !important;
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 1.6rem !important;
  margin: 0 !important;
}

body.app-page:not(.resource-home) .study-overview .overview-card:nth-child(n + 3) {
  display: none !important;
}

body.app-page:not(.resource-home) .overview-card {
  position: relative !important;
  min-height: 9.2rem !important;
  border: 1px solid var(--dash-line) !important;
  border-radius: var(--dash-radius) !important;
  padding: 1.45rem 1.7rem !important;
  background: var(--dash-panel) !important;
  box-shadow: var(--dash-shadow-soft) !important;
}

body.app-page:not(.resource-home) .overview-card::after {
  display: none !important;
  content: none !important;
}

body.app-page:not(.resource-home) .overview-icon {
  position: absolute !important;
  top: 50% !important;
  right: 1.85rem !important;
  display: grid !important;
  place-items: center !important;
  width: 3.3rem !important;
  height: 3.3rem !important;
  border-radius: 50% !important;
  transform: translateY(-50%) !important;
  color: var(--dash-blue) !important;
}

body.app-page:not(.resource-home) .accuracy-card .overview-icon {
  color: var(--dash-green) !important;
}

body.app-page:not(.resource-home) .overview-icon svg {
  width: 2.15rem !important;
  height: 2.15rem !important;
  stroke-width: 2.4 !important;
}

body.app-page:not(.resource-home) .overview-card span:not(.overview-icon),
body.app-page:not(.resource-home) .overview-card small {
  color: var(--dash-muted) !important;
  font-size: .9rem !important;
}

body.app-page:not(.resource-home) .overview-card strong {
  margin-top: .5rem !important;
  color: var(--dash-text) !important;
  font-size: 1.65rem !important;
  font-weight: 900 !important;
}

body.app-page:not(.resource-home) .overview-card i {
  height: .42rem !important;
  margin-top: 1.1rem !important;
  border-radius: 999px !important;
  background: rgba(112, 124, 143, .18) !important;
}

body.app-page:not(.resource-home) .overview-card i b {
  background: var(--dash-blue) !important;
}

body.app-page:not(.resource-home) .data-status-panel {
  order: 6 !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  align-items: center !important;
  gap: 1rem !important;
  min-height: 10.4rem !important;
  margin: 0 !important;
  border: 1px solid var(--dash-line) !important;
  border-radius: var(--dash-radius) !important;
  padding: 1.45rem 1.85rem !important;
  background: var(--dash-panel) !important;
  box-shadow: var(--dash-shadow-soft) !important;
}

body.app-page:not(.resource-home) .data-status-panel article:first-child {
  display: none !important;
}

body.app-page:not(.resource-home) .data-status-panel article {
  border: 0 !important;
  border-radius: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

body.app-page:not(.resource-home) .data-status-panel span {
  color: var(--dash-text) !important;
  font-size: 1.28rem !important;
  font-weight: 920 !important;
}

body.app-page:not(.resource-home) .data-status-panel strong {
  margin-top: .3rem !important;
  color: var(--dash-text) !important;
  font-size: 1.02rem !important;
  font-weight: 860 !important;
}

body.app-page:not(.resource-home) .data-status-panel small {
  display: block !important;
  margin-top: .38rem !important;
  color: var(--dash-muted) !important;
  font-size: .88rem !important;
}

body.app-page:not(.resource-home) .data-status-panel a {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: .55rem !important;
  min-width: 10rem !important;
  min-height: 3.7rem !important;
  border: 1px solid var(--dash-line-strong) !important;
  border-radius: var(--dash-radius-sm) !important;
  padding: 0 1.35rem !important;
  background: linear-gradient(135deg, #2f72f3, #1f67ea) !important;
  color: #ffffff !important;
  font-weight: 880 !important;
  text-decoration: none !important;
  box-shadow: 0 14px 30px rgba(47, 125, 246, .24) !important;
}

body.app-page:not(.resource-home) .data-status-panel a + a {
  display: none !important;
}

body.app-page:not(.resource-home) .question-list {
  order: 7 !important;
}

body.app-page:not(.resource-home) .question-card,
body.app-page:not(.resource-home) .empty-state,
body.app-page:not(.resource-home) .pagination {
  border: 1px solid var(--dash-line) !important;
  border-radius: var(--dash-radius) !important;
  background: var(--dash-panel) !important;
  color: var(--dash-text) !important;
  box-shadow: var(--dash-shadow-soft) !important;
}

body.app-page:not(.resource-home) .question-title,
body.app-page:not(.resource-home) .answer-label,
body.app-page:not(.resource-home) .empty-state strong {
  color: var(--dash-text) !important;
}

body.app-page:not(.resource-home) .answer-input,
body.app-page:not(.resource-home) .analysis-box,
body.app-page:not(.resource-home) .ai-coach-box,
body.app-page:not(.resource-home) .ai-coach-grid section {
  border-color: var(--dash-line) !important;
  background: var(--dash-field) !important;
  color: var(--dash-text) !important;
}

body.app-page:not(.resource-home) > .floating-timer {
  position: fixed !important;
  top: 2rem !important;
  right: 3.05rem !important;
  bottom: auto !important;
  z-index: 20 !important;
  display: flex !important;
  align-items: center !important;
  gap: 1rem !important;
  border: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
}

body.app-page:not(.resource-home) .floating-timer img,
body.app-page:not(.resource-home) .floating-timer-copy,
body.app-page:not(.resource-home) #timer-reset,
body.app-page:not(.resource-home) .user-preference-card {
  display: none !important;
}

body.app-page:not(.resource-home) .timer-calendar {
  display: grid !important;
  place-items: center !important;
  width: 3.05rem !important;
  height: 3.05rem !important;
  border: 1px solid transparent !important;
  color: var(--dash-muted) !important;
}

body.app-page:not(.resource-home) .floating-timer-actions {
  display: flex !important;
}

body.app-page:not(.resource-home) #timer-toggle {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: .62rem !important;
  min-width: 10rem !important;
  min-height: 3.35rem !important;
  border: 1px solid rgba(47, 125, 246, .62) !important;
  border-radius: var(--dash-radius-sm) !important;
  padding: 0 1.25rem !important;
  background: linear-gradient(135deg, #2f72f3, #1f67ea) !important;
  color: #ffffff !important;
  font-size: .98rem !important;
  font-weight: 880 !important;
  box-shadow: 0 16px 34px rgba(47, 125, 246, .25) !important;
}

body.app-page:not(.resource-home) .ai-chat-fab,
body.app-page:not(.resource-home) .scroll-top-button {
  position: fixed !important;
  right: 2.35rem !important;
  z-index: 25 !important;
  display: inline-flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: .2rem !important;
  width: 4.6rem !important;
  height: 4.6rem !important;
  border: 1px solid rgba(47, 125, 246, .48) !important;
  border-radius: 50% !important;
  background: linear-gradient(135deg, #2f72f3, #1f67ea) !important;
  color: #ffffff !important;
  box-shadow: 0 16px 32px rgba(47, 125, 246, .28) !important;
  text-decoration: none !important;
}

body.app-page:not(.resource-home) .ai-chat-fab {
  bottom: 9.7rem !important;
}

body.app-page:not(.resource-home) .scroll-top-button {
  bottom: 4.35rem !important;
  font-size: 1.45rem !important;
}

body.app-page:not(.resource-home) .ai-chat-fab strong {
  display: block !important;
  color: #ffffff !important;
  font-size: .78rem !important;
  font-weight: 760 !important;
}

body.app-page:not(.resource-home) .ai-chat-fab span {
  display: grid !important;
  place-items: center !important;
  color: #ffffff !important;
}

body.app-page:not(.resource-home) :where(button, a, input, select, textarea) {
  transition: border-color .18s ease, background .18s ease, color .18s ease, box-shadow .18s ease, transform .18s ease !important;
}

body.app-page:not(.resource-home) :where(button, a):hover {
  transform: translateY(-1px) !important;
}

@media (max-width: 1480px) {
  body.app-page:not(.resource-home) {
    --dash-sidebar-width: 17rem;
  }

  body.app-page:not(.resource-home) > .content {
    padding-left: 2rem !important;
    padding-right: 2rem !important;
  }

  body.app-page:not(.resource-home) .toolbar {
    width: calc(100% - 16.6rem) !important;
    min-width: 0 !important;
    margin-right: 16.2rem !important;
  }

  body.app-page:not(.resource-home) .header-stats {
    gap: .9rem !important;
  }

  body.app-page:not(.resource-home) .library-panel {
    gap: .9rem !important;
  }

  body.app-page:not(.resource-home) > .floating-timer {
    right: 2rem !important;
  }
}

@media (max-width: 1180px) {
  body.app-page:not(.resource-home) {
    display: block !important;
  }

  body.app-page:not(.resource-home) > .sidebar {
    position: static !important;
    height: auto !important;
    width: 100% !important;
  }

  body.app-page:not(.resource-home) .chapter-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  body.app-page:not(.resource-home) > .content {
    width: 100% !important;
    padding: 1.2rem !important;
  }

  body.app-page:not(.resource-home) .toolbar {
    width: 100% !important;
    margin-right: 0 !important;
    grid-template-columns: minmax(18rem, 1fr) repeat(2, minmax(8rem, .4fr)) !important;
  }

  body.app-page:not(.resource-home) .content-header {
    grid-template-columns: 1fr !important;
  }

  body.app-page:not(.resource-home) .header-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }

  body.app-page:not(.resource-home) .library-panel {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }

  body.app-page:not(.resource-home) .data-status-panel {
    grid-template-columns: 1fr !important;
  }

  body.app-page:not(.resource-home) > .floating-timer {
    top: auto !important;
    right: 1.25rem !important;
    bottom: 1.25rem !important;
  }
}

@media (max-width: 760px) {
  body.app-page:not(.resource-home) .chapter-nav,
  body.app-page:not(.resource-home) .header-stats,
  body.app-page:not(.resource-home) .mode-switch,
  body.app-page:not(.resource-home) .library-panel,
  body.app-page:not(.resource-home) .study-overview,
  body.app-page:not(.resource-home) .toolbar {
    grid-template-columns: 1fr !important;
  }

  body.app-page:not(.resource-home) .content-header {
    min-height: 0 !important;
    padding: 1.35rem !important;
  }

  body.app-page:not(.resource-home) .content-header h2 {
    font-size: 1.65rem !important;
  }

  body.app-page:not(.resource-home) .mode-button {
    grid-template-columns: 4rem minmax(0, 1fr) !important;
    min-height: 7.2rem !important;
    padding: 1rem !important;
  }

  body.app-page:not(.resource-home) .mode-button::after {
    display: none !important;
  }

  body.app-page:not(.resource-home) .ai-chat-fab,
  body.app-page:not(.resource-home) .scroll-top-button {
    right: 1rem !important;
    width: 4rem !important;
    height: 4rem !important;
  }
}

/* Practice dashboard final small fixes. */
body.app-page:not(.resource-home) .toolbar label[for="search-input"] {
  order: 1 !important;
}

body.app-page:not(.resource-home) .toolbar label[for="difficulty-filter"] {
  order: 2 !important;
}

body.app-page:not(.resource-home) .toolbar label[for="term-filter"] {
  order: 3 !important;
}

body.app-page:not(.resource-home) .toolbar label[for="progress-filter"] {
  order: 4 !important;
}

body.app-page:not(.resource-home) .toolbar #reset-filters-button {
  order: 5 !important;
}

body.app-page:not(.resource-home) .toolbar #apply-filters-button,
body.app-page:not(.resource-home) .toolbar #shuffle-button,
body.app-page:not(.resource-home) .toolbar #preview-current-button,
body.app-page:not(.resource-home) .toolbar #ai-selected-ask,
body.app-page:not(.resource-home) .toolbar #ai-paper-ask,
body.app-page:not(.resource-home) .toolbar #sync-button {
  display: none !important;
}

body.app-page:not(.resource-home) .toolbar .toolbar-actions button#apply-filters-button.apply-filters-button:not(#reset-filters-button):not(#shuffle-button) {
  display: none !important;
}

body.app-page:not(.resource-home) .toolbar .toolbar-actions #reset-filters-button {
  display: inline-flex !important;
}

body.app-page:not(.resource-home) .header-copy {
  min-height: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  overflow: visible !important;
}

body.app-page:not(.resource-home) .header-copy::before,
body.app-page:not(.resource-home) .header-copy::after {
  display: none !important;
  content: none !important;
}

body.app-page:not(.resource-home) .header-stats {
  align-items: center !important;
}

body.app-page:not(.resource-home) .header-stats div {
  height: 8rem !important;
  align-self: center !important;
}

body.app-page:not(.resource-home) .mode-panel {
  display: block !important;
}

body.app-page:not(.resource-home) .mode-status {
  display: none !important;
}

body.app-page:not(.resource-home) .library-panel {
  min-height: 0 !important;
  height: auto !important;
  align-items: stretch !important;
}

body.app-page:not(.resource-home) .library-entry {
  margin: 0 !important;
}

body.app-page:not(.resource-home) > .sidebar {
  margin: 0 !important;
  border-radius: 0 !important;
  justify-self: stretch !important;
}

body.app-page:not(.resource-home) .data-status-panel a {
  grid-column: auto !important;
  justify-self: end !important;
  width: auto !important;
  max-width: max-content !important;
}

body.app-page:not(.resource-home) .data-status-panel article:nth-of-type(2) {
  display: grid !important;
  gap: .3rem !important;
}

body.app-page:not(.resource-home) .question-list {
  margin-top: 2.7rem !important;
}

/* Practice flow repair: readable question cards instead of compressed rows. */
body.app-page:not(.resource-home) .question-list {
  gap: 1.25rem !important;
  padding-right: 5.9rem !important;
  padding-bottom: 6rem !important;
}

body.app-page:not(.resource-home) .question-card {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  gap: .95rem !important;
  min-height: 0 !important;
  border: 1px solid var(--dash-line) !important;
  border-radius: var(--dash-radius) !important;
  padding: 1.35rem 1.45rem 1.3rem !important;
  background: var(--dash-panel-solid) !important;
  box-shadow: var(--dash-shadow-soft) !important;
  overflow: visible !important;
}

body.app-theme-dark.app-page:not(.resource-home) .question-card {
  background: var(--dash-panel) !important;
}

body.app-page:not(.resource-home) .question-card-head {
  display: block !important;
  margin: 0 !important;
}

body.app-page:not(.resource-home) .question-meta {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: .42rem !important;
  align-items: center !important;
  max-width: 100% !important;
}

body.app-page:not(.resource-home) .badge {
  min-height: 1.55rem !important;
  border: 1px solid rgba(47, 125, 246, .24) !important;
  border-radius: 6px !important;
  padding: .22rem .48rem !important;
  background: rgba(47, 125, 246, .08) !important;
  color: var(--dash-blue) !important;
  font-size: .72rem !important;
  font-weight: 780 !important;
  line-height: 1.15 !important;
}

body.app-theme-dark.app-page:not(.resource-home) .badge {
  background: rgba(47, 125, 246, .1) !important;
}

body.app-page:not(.resource-home) .badge.topic,
body.app-page:not(.resource-home) .badge.type,
body.app-page:not(.resource-home) .badge.difficulty {
  color: var(--dash-blue) !important;
  padding: .22rem .48rem !important;
}

body.app-page:not(.resource-home) .card-icon-actions {
  display: none !important;
}

body.app-page:not(.resource-home) .question-title {
  margin: .15rem 0 .1rem !important;
  padding: 0 !important;
  color: var(--dash-text) !important;
  font-size: 1.06rem !important;
  line-height: 1.9 !important;
  font-weight: 860 !important;
}

body.app-page:not(.resource-home) .question-title mjx-container {
  margin: 0 .08rem !important;
}

body.app-page:not(.resource-home) .answer-label {
  margin: .2rem 0 -.25rem !important;
  color: var(--dash-muted) !important;
  font-size: .82rem !important;
  font-weight: 820 !important;
}

body.app-page:not(.resource-home) .answer-checker {
  margin: 0 !important;
}

body.app-page:not(.resource-home) .answer-input {
  width: 100% !important;
  min-height: 7.2rem !important;
  border: 1px solid var(--dash-line) !important;
  border-radius: var(--dash-radius-sm) !important;
  padding: .95rem 1rem !important;
  background: var(--dash-field) !important;
  color: var(--dash-text) !important;
  font-size: .95rem !important;
  line-height: 1.72 !important;
  box-shadow: none !important;
}

body.app-page:not(.resource-home) .answer-input:focus {
  border-color: var(--dash-blue) !important;
  box-shadow: 0 0 0 3px rgba(47, 125, 246, .14) !important;
}

body.app-page:not(.resource-home) .question-actions {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: .62rem !important;
  width: 100% !important;
  min-width: 0 !important;
  margin: .1rem 0 0 !important;
  padding-top: .85rem !important;
  border-top: 1px solid rgba(112, 124, 143, .16) !important;
}

body.app-page:not(.resource-home) .question-actions button {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 5.8rem !important;
  min-height: 2.5rem !important;
  border: 1px solid var(--dash-line) !important;
  border-radius: 8px !important;
  padding: 0 .86rem !important;
  background: var(--dash-field) !important;
  color: var(--dash-text) !important;
  box-shadow: none !important;
  font-size: .86rem !important;
  font-weight: 820 !important;
  white-space: nowrap !important;
}

body.app-page:not(.resource-home) .question-actions .submit-answer {
  border-color: rgba(47, 125, 246, .62) !important;
  background: linear-gradient(135deg, #2f72f3, #1f67ea) !important;
  color: #ffffff !important;
}

body.app-page:not(.resource-home) .question-actions .ask-ai-btn {
  border-color: rgba(124, 77, 255, .42) !important;
  background: linear-gradient(135deg, rgba(47, 125, 246, .12), rgba(124, 77, 255, .14)) !important;
  color: var(--dash-blue) !important;
}

body.app-page:not(.resource-home) .question-actions .ai-coach-toggle,
body.app-page:not(.resource-home) .question-actions .ai-select-context-btn,
body.app-page:not(.resource-home) .question-actions .ask-ai-new-btn {
  display: none !important;
}

body.app-page:not(.resource-home) .analysis-box,
body.app-page:not(.resource-home) .ai-coach-box,
body.app-page:not(.resource-home) .ai-coach-grid section,
body.app-page:not(.resource-home) .preview-answer {
  border-color: var(--dash-line) !important;
  border-radius: var(--dash-radius-sm) !important;
  background: var(--dash-field) !important;
  color: var(--dash-text) !important;
}

body.app-page:not(.resource-home) .answer-feedback {
  margin: 0 !important;
  border-radius: var(--dash-radius-sm) !important;
}

body.app-page:not(.resource-home) .ai-chat-fab,
body.app-page:not(.resource-home) .settings-fab {
  right: 1.05rem !important;
  width: 3.8rem !important;
  height: 3.8rem !important;
}

body.app-page:not(.resource-home) .ai-chat-fab {
  bottom: 8.2rem !important;
}

body.app-page:not(.resource-home) .settings-fab {
  bottom: 3.7rem !important;
}

@media (max-width: 1180px) {
  body.app-page:not(.resource-home) .question-list {
    padding-right: 0 !important;
  }
}

/* Practice flow final override: keep each question as a top-to-bottom task. */
body.app-page:not(.resource-home) .question-card {
  grid-template-columns: minmax(0, 1fr) !important;
  grid-template-areas:
    "head"
    "title"
    "answer"
    "feedback"
    "analysis"
    "coach"
    "actions" !important;
  align-items: stretch !important;
  gap: .82rem !important;
}

body.app-page:not(.resource-home) .question-card-head {
  grid-area: head !important;
  display: block !important;
}

body.app-page:not(.resource-home) .question-title {
  grid-area: title !important;
}

body.app-page:not(.resource-home) .answer-label {
  display: none !important;
}

body.app-page:not(.resource-home) .answer-checker {
  grid-area: answer !important;
}

body.app-page:not(.resource-home) .answer-feedback {
  grid-area: feedback !important;
}

body.app-page:not(.resource-home) .analysis-box {
  grid-area: analysis !important;
}

body.app-page:not(.resource-home) .ai-coach-container {
  grid-area: coach !important;
}

body.app-page:not(.resource-home) .question-actions {
  grid-area: actions !important;
  position: static !important;
}

body.app-page:not(.resource-home) .sync-panel::before {
  grid-column: 1 !important;
  grid-row: 1 / 3 !important;
  align-self: center !important;
  justify-self: center !important;
}

body.app-page:not(.resource-home) .sync-panel p {
  grid-column: 2 !important;
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

/* Toolbar breathing room: avoid filter controls colliding on mid-width screens. */
body.app-page:not(.resource-home) .toolbar {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: stretch !important;
  gap: .72rem !important;
  width: min(100%, calc(100vw - var(--dash-sidebar-width) - 20.8rem)) !important;
  max-width: 78rem !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: .82rem !important;
}

body.app-page:not(.resource-home) .toolbar-field {
  flex: 0 1 9.6rem !important;
  min-width: 9.6rem !important;
}

body.app-page:not(.resource-home) .toolbar .search-field {
  order: 1 !important;
  flex: 1 1 26rem !important;
  min-width: min(100%, 18rem) !important;
}

body.app-page:not(.resource-home) .toolbar label[for="difficulty-filter"] {
  order: 2 !important;
}

body.app-page:not(.resource-home) .toolbar label[for="term-filter"] {
  order: 3 !important;
}

body.app-page:not(.resource-home) .toolbar label[for="progress-filter"] {
  order: 4 !important;
}

body.app-page:not(.resource-home) .toolbar-actions {
  display: flex !important;
  flex: 0 0 auto !important;
  min-width: 6.4rem !important;
  margin-left: auto !important;
  order: 5 !important;
}

body.app-page:not(.resource-home) .toolbar #reset-filters-button {
  order: 1 !important;
  width: 6.4rem !important;
  min-width: 6.4rem !important;
}

@media (max-width: 1100px) {
  body.app-page:not(.resource-home) .toolbar .search-field {
    flex-basis: 100% !important;
  }

  body.app-page:not(.resource-home) .toolbar-field {
    flex: 1 1 10rem !important;
  }
}

/* Mode entry cards: stable emoji rendering with the existing icon system. */
body.app-page:not(.resource-home) .mode-switch {
  gap: 1rem !important;
}

body.app-page:not(.resource-home) .mode-button {
  isolation: isolate !important;
  overflow: hidden !important;
  grid-template-columns: 5.2rem minmax(0, 1fr) !important;
  grid-template-rows: auto auto auto !important;
  align-items: center !important;
  min-height: 8rem !important;
  gap: .28rem 1.05rem !important;
  padding: 1.35rem 1.55rem !important;
}

body.app-page:not(.resource-home) .mode-button::before {
  content: "" !important;
  position: absolute !important;
  inset: auto -2.4rem -3.2rem auto !important;
  display: block !important;
  width: 12rem !important;
  height: 7rem !important;
  border-radius: 999px 0 0 0 !important;
  background: rgba(47, 125, 246, .08) !important;
  transform: rotate(-18deg) !important;
  z-index: -1 !important;
}

body.app-page:not(.resource-home) .mode-button:nth-child(2)::before {
  background: rgba(40, 183, 104, .1) !important;
}

body.app-page:not(.resource-home) .mode-icon-wrap {
  position: relative !important;
  grid-column: 1 !important;
  grid-row: 1 / 4 !important;
  width: 4.55rem !important;
  height: 4.55rem !important;
  border-radius: 16px !important;
  background: linear-gradient(135deg, rgba(47, 125, 246, .1), rgba(47, 125, 246, .18)) !important;
  color: var(--dash-blue) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .72), 0 14px 28px rgba(47, 125, 246, .13) !important;
}

body.app-page:not(.resource-home) .mode-button:nth-child(2) .mode-icon-wrap {
  background: linear-gradient(135deg, rgba(40, 183, 104, .1), rgba(40, 183, 104, .2)) !important;
  color: var(--dash-green) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .72), 0 14px 28px rgba(40, 183, 104, .12) !important;
}

body.app-page:not(.resource-home) .mode-icon-wrap svg {
  width: 2.45rem !important;
  height: 2.45rem !important;
  opacity: .34 !important;
}

body.app-page:not(.resource-home) .mode-icon-wrap::after {
  content: "\270F\FE0F" !important;
  position: absolute !important;
  right: .46rem !important;
  bottom: .42rem !important;
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif !important;
  font-size: 2.15rem !important;
  line-height: 1 !important;
  transform: rotate(-18deg) !important;
  filter: drop-shadow(0 5px 8px rgba(15, 23, 42, .18)) !important;
}

body.app-page:not(.resource-home) .mode-button:nth-child(2) .mode-icon-wrap::after {
  content: "\1F4CB" !important;
  right: .64rem !important;
  bottom: .52rem !important;
  font-size: 2.05rem !important;
  transform: rotate(-2deg) !important;
}

body.app-page:not(.resource-home) .mode-button strong {
  grid-column: 2 !important;
  grid-row: 1 !important;
  display: flex !important;
  align-items: center !important;
  gap: .42rem !important;
  margin: 0 !important;
  font-size: 1.18rem !important;
  line-height: 1.2 !important;
}

body.app-page:not(.resource-home) .mode-button strong::before {
  content: "\270D\FE0F" !important;
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif !important;
  font-size: 1.22rem !important;
  line-height: 1 !important;
}

body.app-page:not(.resource-home) .mode-button:nth-child(2) strong::before {
  content: "\1F4CB" !important;
}

body.app-page:not(.resource-home) .mode-button small {
  grid-column: 2 !important;
  grid-row: 2 !important;
  max-width: 17rem !important;
  line-height: 1.55 !important;
}

body.app-page:not(.resource-home) .mode-button::after {
  content: "\5f00\59cb\5237\9898\00a0\203a" !important;
  grid-column: 2 !important;
  grid-row: 3 !important;
  justify-self: start !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: auto !important;
  min-width: 6.9rem !important;
  height: 2.25rem !important;
  margin-top: .45rem !important;
  border-radius: 999px !important;
  padding: 0 1.05rem !important;
  background: linear-gradient(135deg, #2f72f3, #1f67ea) !important;
  color: #ffffff !important;
  font-size: .86rem !important;
  font-weight: 850 !important;
  line-height: 1 !important;
  box-shadow: 0 10px 20px rgba(47, 125, 246, .22) !important;
}

body.app-page:not(.resource-home) .mode-button:nth-child(2)::after {
  content: "\914d\7f6e\8003\8bd5\00a0\203a" !important;
  background: linear-gradient(135deg, #26b463, #169452) !important;
  color: #ffffff !important;
  box-shadow: 0 10px 20px rgba(40, 183, 104, .18) !important;
}

body.app-theme-dark.app-page:not(.resource-home) .mode-icon-wrap {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), 0 14px 28px rgba(47, 125, 246, .16) !important;
}

body.app-page:not(.resource-home) .mode-source-filter {
  display: inline-grid !important;
  grid-template-columns: auto minmax(10rem, 13rem) !important;
  align-items: center !important;
  gap: .6rem !important;
  width: fit-content !important;
  margin-top: .75rem !important;
  border: 1px solid rgba(47, 125, 246, .18) !important;
  border-radius: 8px !important;
  padding: .46rem .58rem !important;
  background: var(--dash-field, #ffffff) !important;
  color: var(--dash-text, #172033) !important;
}

body.app-page:not(.resource-home) .mode-source-filter span {
  color: var(--dash-muted, #64748b) !important;
  font-size: .78rem !important;
  font-weight: 860 !important;
  white-space: nowrap !important;
}

body.app-page:not(.resource-home) .mode-source-filter select {
  width: 100% !important;
  min-height: 2.15rem !important;
  border: 1px solid rgba(148, 163, 184, .26) !important;
  border-radius: 8px !important;
  padding: 0 .72rem !important;
  background: var(--dash-panel-solid, #ffffff) !important;
  color: var(--dash-text, #172033) !important;
  font-weight: 820 !important;
}

/* Exam mode must feel like a separate timed workflow, not another practice filter. */
body.app-page:not(.resource-home).exam-mode-active {
  --exam-accent: #f97316;
  --exam-accent-strong: #ea580c;
  --exam-soft: rgba(249, 115, 22, .11);
  --exam-soft-strong: rgba(249, 115, 22, .18);
  --exam-line: rgba(249, 115, 22, .46);
}

body.app-theme-dark.app-page:not(.resource-home).exam-mode-active {
  --exam-accent: #fb923c;
  --exam-accent-strong: #fdba74;
  --exam-soft: rgba(251, 146, 60, .13);
  --exam-soft-strong: rgba(251, 146, 60, .22);
  --exam-line: rgba(251, 146, 60, .5);
}

body.app-page:not(.resource-home).exam-mode-active .mode-panel {
  padding: 1rem !important;
  border: 1px solid var(--exam-line) !important;
  border-radius: var(--dash-radius) !important;
  background:
    radial-gradient(circle at 92% 6%, var(--exam-soft-strong), transparent 30%),
    linear-gradient(135deg, var(--exam-soft), var(--dash-panel)) !important;
  box-shadow: 0 18px 42px rgba(249, 115, 22, .12) !important;
}

body.app-page:not(.resource-home).exam-mode-active .mode-switch {
  gap: 1rem !important;
}

body.app-page:not(.resource-home).exam-mode-active .mode-button[data-mode="practice"] {
  opacity: .62 !important;
  filter: saturate(.82) !important;
}

body.app-page:not(.resource-home).exam-mode-active .mode-button[data-mode="exam"] {
  border-color: var(--exam-line) !important;
  background: linear-gradient(135deg, var(--exam-soft), var(--dash-panel)) !important;
  box-shadow: inset 0 0 0 1px rgba(249, 115, 22, .08), 0 16px 32px rgba(249, 115, 22, .1) !important;
}

body.app-page:not(.resource-home).exam-mode-active .mode-button[data-mode="exam"]::before {
  background: var(--exam-soft-strong) !important;
}

body.app-page:not(.resource-home).exam-mode-active .mode-button[data-mode="exam"] .mode-icon-wrap {
  background: linear-gradient(135deg, rgba(251, 146, 60, .18), rgba(234, 88, 12, .24)) !important;
  color: var(--exam-accent-strong) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4), 0 14px 28px rgba(249, 115, 22, .16) !important;
}

body.app-page:not(.resource-home).exam-mode-active .mode-button[data-mode="exam"]::after {
  content: "\8003\8bd5\8bbe\7f6e\00a0\203a" !important;
  background: linear-gradient(135deg, #fb923c, #ea580c) !important;
  box-shadow: 0 12px 24px rgba(249, 115, 22, .24) !important;
}

body.app-page:not(.resource-home).exam-mode-active .mode-status {
  display: block !important;
  margin-top: .75rem !important;
  color: var(--exam-accent-strong) !important;
  font-weight: 860 !important;
}

body.app-page:not(.resource-home).exam-mode-active .exam-panel.show {
  display: block !important;
  margin-top: 1rem !important;
}

body.app-page:not(.resource-home).exam-mode-active .exam-card {
  position: relative !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  align-items: center !important;
  gap: 1rem !important;
  border: 1px solid var(--exam-line) !important;
  border-radius: var(--dash-radius-sm) !important;
  padding: 1.15rem 1.25rem !important;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .36), transparent 46%),
    linear-gradient(135deg, var(--exam-soft), var(--dash-panel-solid)) !important;
  color: var(--dash-text) !important;
  box-shadow: var(--dash-shadow-soft) !important;
  overflow: hidden !important;
}

body.app-theme-dark.app-page:not(.resource-home).exam-mode-active .exam-card {
  background:
    radial-gradient(circle at 100% 0, rgba(251, 146, 60, .22), transparent 32%),
    linear-gradient(135deg, rgba(251, 146, 60, .12), var(--dash-panel-solid)) !important;
}

body.app-page:not(.resource-home).exam-mode-active .exam-card::before {
  content: "\8003\8bd5\6a21\5f0f" !important;
  position: absolute !important;
  top: .82rem !important;
  right: .9rem !important;
  border-radius: 999px !important;
  padding: .25rem .6rem !important;
  background: var(--exam-soft-strong) !important;
  color: var(--exam-accent-strong) !important;
  font-size: .75rem !important;
  font-weight: 900 !important;
}

body.app-page:not(.resource-home).exam-mode-active .exam-card strong {
  display: block !important;
  padding-right: 5.4rem !important;
  color: var(--dash-text) !important;
  font-size: 1.1rem !important;
  font-weight: 920 !important;
}

body.app-page:not(.resource-home).exam-mode-active .exam-card span {
  display: block !important;
  max-width: 58rem !important;
  margin-top: .4rem !important;
  color: var(--dash-muted) !important;
  font-size: .9rem !important;
  line-height: 1.65 !important;
}

body.app-page:not(.resource-home).exam-mode-active .exam-scope-constraints {
  display: grid !important;
  gap: .48rem !important;
  margin-top: .75rem !important;
  max-width: 60rem !important;
}

body.app-page:not(.resource-home).exam-mode-active .exam-scope-constraints strong {
  padding: 0 !important;
  color: var(--exam-accent-strong) !important;
  font-size: .82rem !important;
  font-weight: 900 !important;
}

body.app-page:not(.resource-home).exam-mode-active .exam-scope-constraints div {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: .42rem !important;
}

body.app-page:not(.resource-home).exam-mode-active .exam-scope-constraints span {
  display: inline-flex !important;
  align-items: center !important;
  gap: .32rem !important;
  margin: 0 !important;
  border: 1px solid rgba(249, 115, 22, .24) !important;
  border-radius: 999px !important;
  padding: .28rem .56rem !important;
  background: rgba(255, 247, 237, .78) !important;
  color: var(--dash-text, #172033) !important;
  font-size: .78rem !important;
  font-weight: 820 !important;
  line-height: 1.2 !important;
}

body.app-page:not(.resource-home).exam-mode-active .exam-scope-constraints b {
  color: var(--exam-accent-strong) !important;
  font-weight: 900 !important;
}

body.app-page:not(.resource-home).exam-mode-active .exam-filter-grid {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: .75rem !important;
  margin-top: .9rem !important;
}

body.app-page:not(.resource-home).exam-mode-active .exam-filter-field {
  display: grid !important;
  gap: .38rem !important;
  min-width: 0 !important;
}

body.app-page:not(.resource-home).exam-mode-active .exam-filter-field span {
  margin: 0 !important;
  color: var(--dash-muted) !important;
  font-size: .78rem !important;
  font-weight: 840 !important;
}

body.app-page:not(.resource-home).exam-mode-active .exam-filter-field select {
  width: 100% !important;
  min-width: 0 !important;
  min-height: 2.75rem !important;
  border: 1px solid var(--exam-line) !important;
  border-radius: 10px !important;
  padding: 0 .85rem !important;
  background: var(--dash-field) !important;
  color: var(--dash-text) !important;
}

body.app-page:not(.resource-home).exam-mode-active .exam-card .primary-action {
  min-width: 9.8rem !important;
  min-height: 3rem !important;
  border: 0 !important;
  border-radius: 12px !important;
  background: linear-gradient(135deg, #fb923c, #ea580c) !important;
  color: #ffffff !important;
  box-shadow: 0 14px 30px rgba(249, 115, 22, .28) !important;
}

body.app-page:not(.resource-home).exam-mode-active .exam-actions {
  display: flex !important;
  flex-wrap: wrap !important;
  justify-content: flex-end !important;
  gap: .7rem !important;
}

body.app-page:not(.resource-home).exam-mode-active .exam-actions .secondary-action {
  min-height: 3rem !important;
  border-color: var(--exam-line) !important;
  color: var(--exam-accent-strong) !important;
}

body.app-page:not(.resource-home).exam-mode-active:not(.exam-session-active):not(.exam-finished) .question-list {
  display: none !important;
}

body.app-page:not(.resource-home).exam-session-active .question-card {
  border-color: var(--exam-line) !important;
  box-shadow: 0 14px 34px rgba(249, 115, 22, .08) !important;
}

body.app-page:not(.resource-home).exam-session-active .question-card::before {
  background: linear-gradient(180deg, #fb923c, #ef4444) !important;
}

body.app-page:not(.resource-home).exam-session-active .answer-input {
  border-color: rgba(249, 115, 22, .34) !important;
  background: color-mix(in srgb, var(--dash-field) 88%, rgba(249, 115, 22, .12)) !important;
}

body.app-page:not(.resource-home).exam-session-active .answer-input:focus {
  border-color: var(--exam-accent) !important;
  box-shadow: 0 0 0 4px rgba(249, 115, 22, .14) !important;
}

body.app-page:not(.resource-home).exam-session-active .exam-note {
  display: block !important;
  border: 1px solid var(--exam-line) !important;
  border-radius: 12px !important;
  padding: .85rem 1rem !important;
  background: var(--exam-soft) !important;
  color: var(--exam-accent-strong) !important;
  font-weight: 760 !important;
}

body.app-page:not(.resource-home).exam-paused .question-card {
  border-color: rgba(249, 115, 22, .58) !important;
}

body.app-page:not(.resource-home).exam-paused .answer-input:disabled {
  opacity: .78 !important;
  cursor: not-allowed !important;
}

body.app-page:not(.resource-home).exam-paused .exam-note {
  background: rgba(255, 247, 237, .92) !important;
}

body.app-page:not(.resource-home).exam-finished .question-card {
  border-color: rgba(34, 197, 94, .34) !important;
}

/* === Exam focus view ===
   While an exam is running or being reviewed, strip the page down to the exam
   control card (timer / submit) and the questions. Every secondary panel that
   makes the practice page feel cluttered is hidden so the student can focus. */
body.app-page:not(.resource-home):is(.exam-session-active, .exam-finished) .qb-source-stats,
body.app-page:not(.resource-home):is(.exam-session-active, .exam-finished) .qb-source-filter-panel,
body.app-page:not(.resource-home):is(.exam-session-active, .exam-finished) .qb-source-quick-panel,
body.app-page:not(.resource-home):is(.exam-session-active, .exam-finished) .qb-source-result-head,
body.app-page:not(.resource-home):is(.exam-session-active, .exam-finished) #qb-source-active-filters,
body.app-page:not(.resource-home):is(.exam-session-active, .exam-finished) #qb-resource-list,
body.app-page:not(.resource-home):is(.exam-session-active, .exam-finished) .content-header,
body.app-page:not(.resource-home):is(.exam-session-active, .exam-finished) .study-overview,
body.app-page:not(.resource-home):is(.exam-session-active, .exam-finished) .mode-source-filters,
body.app-page:not(.resource-home):is(.exam-session-active, .exam-finished) .library-panel,
body.app-page:not(.resource-home):is(.exam-session-active, .exam-finished) .reset-panel,
body.app-page:not(.resource-home):is(.exam-session-active, .exam-finished) .data-status-panel,
body.app-page:not(.resource-home):is(.exam-session-active, .exam-finished) #active-scope-bar {
  display: none !important;
}

body.app-page:not(.resource-home) .content-header h2 {
  max-width: none !important;
  width: max-content !important;
  white-space: nowrap !important;
}

@media (max-width: 760px) {
  body.app-page:not(.resource-home) .content-header h2 {
    width: auto !important;
    white-space: normal !important;
  }
}

@media (max-width: 760px) {
  body.app-page:not(.resource-home).exam-mode-active .mode-panel {
    padding: .78rem !important;
  }

  body.app-page:not(.resource-home).exam-mode-active .exam-card {
    grid-template-columns: 1fr !important;
    align-items: stretch !important;
    padding: 1rem !important;
  }

  body.app-page:not(.resource-home).exam-mode-active .exam-card strong {
    padding-right: 4.8rem !important;
    font-size: 1rem !important;
  }

  body.app-page:not(.resource-home).exam-mode-active .exam-filter-grid {
    grid-template-columns: 1fr !important;
  }

  body.app-page:not(.resource-home).exam-mode-active .exam-card .primary-action,
  body.app-page:not(.resource-home).exam-mode-active .exam-actions {
    width: 100% !important;
  }

  body.app-page:not(.resource-home).exam-mode-active .exam-actions button {
    flex: 1 1 9rem !important;
  }
}

body.app-page:not(.resource-home) .settings-fab {
  position: fixed !important;
  right: 2.35rem !important;
  bottom: 4.35rem !important;
  z-index: 25 !important;
  display: inline-flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: .2rem !important;
  width: 4.6rem !important;
  height: 4.6rem !important;
  border: 1px solid rgba(47, 125, 246, .48) !important;
  border-radius: 50% !important;
  background: linear-gradient(135deg, #2f72f3, #1f67ea) !important;
  color: #ffffff !important;
  box-shadow: 0 16px 32px rgba(47, 125, 246, .28) !important;
}

body.app-page:not(.resource-home) .settings-fab strong {
  color: #ffffff !important;
  font-size: .78rem !important;
  font-weight: 760 !important;
}

body.app-page:not(.resource-home) .settings-fab span {
  display: grid !important;
  place-items: center !important;
}

body.app-page:not(.resource-home) .scroll-top-button {
  display: none !important;
}

body.app-page:not(.resource-home) .scroll-top-button.show {
  display: inline-flex !important;
  right: 2.35rem !important;
  bottom: 1.2rem !important;
  width: 3.25rem !important;
  height: 3.25rem !important;
  font-size: 1.25rem !important;
}

body.app-page:not(.resource-home).settings-open .user-preference-card {
  position: fixed !important;
  right: 7.6rem !important;
  bottom: 4.35rem !important;
  z-index: 40 !important;
  display: grid !important;
  gap: .75rem !important;
  width: 17rem !important;
  border: 1px solid var(--dash-line) !important;
  border-radius: var(--dash-radius) !important;
  padding: 1rem !important;
  background: var(--dash-panel-solid) !important;
  color: var(--dash-text) !important;
  box-shadow: var(--dash-shadow) !important;
}

body.app-page:not(.resource-home).settings-open .preference-card-head {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  color: var(--dash-text) !important;
}

body.app-page:not(.resource-home).settings-open .theme-segment {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: .4rem !important;
}

body.app-page:not(.resource-home).settings-open .theme-segment button {
  min-height: 2.25rem !important;
  border: 1px solid var(--dash-line) !important;
  border-radius: 8px !important;
  background: var(--dash-field) !important;
  color: var(--dash-text) !important;
}

body.app-page:not(.resource-home).settings-open .theme-segment button[aria-pressed="true"] {
  border-color: var(--dash-blue) !important;
  background: rgba(47, 125, 246, .12) !important;
  color: var(--dash-blue) !important;
}

body.app-page:not(.resource-home).settings-open .motion-toggle {
  display: flex !important;
  align-items: center !important;
  gap: .55rem !important;
  color: var(--dash-muted) !important;
}

@media (max-width: 760px) {
  body.app-page:not(.resource-home) > .sidebar {
    position: sticky !important;
    top: 0 !important;
    z-index: 18 !important;
    display: block !important;
    padding: .82rem 1rem !important;
    border-right: 0 !important;
    border-bottom: 1px solid var(--dash-line) !important;
    background: color-mix(in srgb, var(--dash-sidebar) 92%, transparent) !important;
    backdrop-filter: blur(16px) !important;
    overflow: visible !important;
  }

  body.app-page:not(.resource-home) .sidebar-brand {
    margin: 0 !important;
    padding: 0 !important;
  }

  body.app-page:not(.resource-home) .sidebar-brand .brand-emblem {
    width: 3rem !important;
    height: 3rem !important;
  }

  body.app-page:not(.resource-home) .sidebar-brand h1 {
    font-size: 1rem !important;
  }

  body.app-page:not(.resource-home) .sidebar-brand p {
    font-size: .76rem !important;
  }

  body.app-page:not(.resource-home) .chapter-nav,
  body.app-page:not(.resource-home) .sidebar-quick,
  body.app-page:not(.resource-home) .sync-panel {
    display: none !important;
  }

  body.app-page:not(.resource-home) > .content {
    padding-top: .95rem !important;
    padding-bottom: 7rem !important;
  }

  body.app-page:not(.resource-home) .toolbar {
    order: 1 !important;
  }

  body.app-page:not(.resource-home) .content-header {
    gap: 1rem !important;
    padding: 1.2rem !important;
  }

  body.app-page:not(.resource-home) .header-copy {
    gap: .55rem !important;
  }

  body.app-page:not(.resource-home) .hero-chips {
    gap: .45rem !important;
  }

  body.app-page:not(.resource-home) .header-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: .5rem !important;
    width: 100% !important;
  }

  body.app-page:not(.resource-home) .header-stats div {
    grid-template-columns: 1fr !important;
    grid-template-rows: auto auto auto !important;
    justify-items: center !important;
    min-height: 6.1rem !important;
    height: auto !important;
    padding: .72rem .35rem !important;
    text-align: center !important;
    gap: .22rem !important;
  }

  body.app-page:not(.resource-home) .stat-icon-wrap {
    grid-row: auto !important;
    width: 2.45rem !important;
    height: 2.45rem !important;
  }

  body.app-page:not(.resource-home) .stat-icon-wrap svg {
    width: 1.25rem !important;
    height: 1.25rem !important;
  }

  body.app-page:not(.resource-home) .header-stats strong {
    font-size: 1.45rem !important;
  }

  body.app-page:not(.resource-home) .header-stats span:not(.stat-icon-wrap) {
    font-size: .74rem !important;
  }

  body.app-page:not(.resource-home) .settings-fab {
    right: 1rem !important;
    bottom: 1rem !important;
    width: 3.25rem !important;
    height: 3.25rem !important;
    z-index: 35 !important;
  }

  body.app-page:not(.resource-home) .ai-chat-fab {
    right: 4.85rem !important;
    bottom: 1rem !important;
    width: 3.25rem !important;
    height: 3.25rem !important;
    z-index: 35 !important;
  }

  body.app-page:not(.resource-home) .ai-chat-fab strong,
  body.app-page:not(.resource-home) .settings-fab strong {
    display: none !important;
  }

  body.app-page:not(.resource-home) > .floating-timer {
    left: auto !important;
    right: 8.7rem !important;
    bottom: 1rem !important;
    z-index: 35 !important;
    gap: 0 !important;
    width: auto !important;
    min-width: 0 !important;
  }

  body.app-page:not(.resource-home) .timer-calendar {
    display: none !important;
  }

  body.app-page:not(.resource-home) .floating-timer-actions {
    width: auto !important;
    min-width: 0 !important;
  }

  body.app-page:not(.resource-home) #timer-toggle {
    width: 7.4rem !important;
    max-width: 7.4rem !important;
    min-width: 7.4rem !important;
    min-height: 3.25rem !important;
    border-radius: 999px !important;
    padding: 0 .85rem !important;
    font-size: .86rem !important;
  }

  body.app-page:not(.resource-home).settings-open .user-preference-card {
    right: 1rem !important;
    left: 1rem !important;
    bottom: 8.7rem !important;
    width: auto !important;
  }
}

/* Nailong practice mascot */
body.app-page:not(.resource-home) .nailong-mascot {
  position: static !important;
  z-index: 26 !important;
  display: grid !important;
  grid-template-columns: clamp(4.6rem, 5vw, 5.1rem) minmax(0, 9.8rem) !important;
  align-items: center !important;
  gap: .5rem !important;
  width: 100% !important;
  max-width: 100% !important;
  margin: .95rem 0 1rem !important;
  pointer-events: none !important;
  transition: opacity .2s ease, transform .2s ease !important;
}

body.app-page:not(.resource-home) .nailong-mascot-text {
  position: relative !important;
  grid-column: 2 !important;
  min-width: 0 !important;
  min-height: 2.7rem !important;
  margin: 0 !important;
  border: 1px solid rgba(47, 125, 246, .18) !important;
  border-radius: 8px !important;
  padding: .58rem .72rem !important;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .94), rgba(255, 247, 218, .96)) !important;
  color: #263245 !important;
  box-shadow: 0 16px 34px rgba(32, 51, 81, .16) !important;
  font-size: .82rem !important;
  font-weight: 820 !important;
  line-height: 1.45 !important;
  overflow-wrap: anywhere !important;
  pointer-events: auto !important;
}

body.app-page:not(.resource-home) .nailong-mascot-text::after {
  content: "" !important;
  position: absolute !important;
  left: -.38rem !important;
  right: auto !important;
  top: 50% !important;
  width: .78rem !important;
  height: .78rem !important;
  border-top: 1px solid rgba(47, 125, 246, .18) !important;
  border-left: 1px solid rgba(47, 125, 246, .18) !important;
  border-right: 0 !important;
  background: #fff7da !important;
  transform: translateY(-50%) rotate(-45deg) !important;
}

body.app-page:not(.resource-home) .nailong-mascot-button {
  position: relative !important;
  grid-column: 1 !important;
  grid-row: 1 !important;
  display: grid !important;
  place-items: center !important;
  width: 100% !important;
  aspect-ratio: 1 !important;
  border: 0 !important;
  border-radius: 50% !important;
  padding: 0 !important;
  background: #fff1bb !important;
  box-shadow:
    0 18px 36px rgba(238, 171, 29, .28),
    0 0 0 1px rgba(255, 255, 255, .82) !important;
  cursor: pointer !important;
  pointer-events: auto !important;
  transform-origin: 50% 92% !important;
  animation: nailong-float 4.4s ease-in-out infinite !important;
}

body.app-page:not(.resource-home) .nailong-mascot-button img {
  position: relative !important;
  z-index: 2 !important;
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  border-radius: 50% !important;
  object-fit: cover !important;
}

body.app-page:not(.resource-home) .nailong-mascot-button:hover img,
body.app-page:not(.resource-home) .nailong-mascot-button:focus-visible img {
  transform: scale(1.035) !important;
}

body.app-page:not(.resource-home) .nailong-mascot-button:focus-visible {
  outline: 3px solid rgba(47, 125, 246, .42) !important;
  outline-offset: 4px !important;
}

body.app-page:not(.resource-home) .nailong-mascot-halo {
  position: absolute !important;
  inset: -.55rem !important;
  z-index: 1 !important;
  border: 1px solid rgba(250, 204, 21, .62) !important;
  border-right-color: rgba(47, 125, 246, .44) !important;
  border-radius: 50% !important;
  animation: nailong-halo 2.8s linear infinite !important;
}

body.app-page:not(.resource-home) .nailong-mascot-spark {
  position: absolute !important;
  z-index: 3 !important;
  width: .62rem !important;
  aspect-ratio: 1 !important;
  border-radius: 50% 50% 50% 0 !important;
  background: #facc15 !important;
  box-shadow: 0 0 12px rgba(250, 204, 21, .7) !important;
  opacity: .88 !important;
  transform: rotate(-45deg) scale(.84) !important;
  animation: nailong-spark 1.8s ease-in-out infinite !important;
}

body.app-page:not(.resource-home) .nailong-mascot-spark.spark-a {
  left: .18rem !important;
  top: .45rem !important;
}

body.app-page:not(.resource-home) .nailong-mascot-spark.spark-b {
  right: .22rem !important;
  bottom: .72rem !important;
  background: #38bdf8 !important;
  box-shadow: 0 0 12px rgba(56, 189, 248, .56) !important;
  animation-delay: .7s !important;
}

body.app-page:not(.resource-home) .nailong-mascot[data-action="focus"] .nailong-mascot-button {
  animation: nailong-focus 1.7s ease-in-out infinite !important;
}

body.app-page:not(.resource-home) .nailong-mascot.is-acting[data-action="wave"] .nailong-mascot-button {
  animation: nailong-wave .9s ease both, nailong-float 4.4s ease-in-out .9s infinite !important;
}

body.app-page:not(.resource-home) .nailong-mascot.is-acting[data-action="peek"] .nailong-mascot-button {
  animation: nailong-peek .85s ease both, nailong-float 4.4s ease-in-out .85s infinite !important;
}

body.app-page:not(.resource-home) .nailong-mascot.is-acting[data-action="nod"] .nailong-mascot-button {
  animation: nailong-nod .7s ease both, nailong-float 4.4s ease-in-out .7s infinite !important;
}

body.app-page:not(.resource-home) .nailong-mascot.is-acting[data-action="dash"] .nailong-mascot-button {
  animation: nailong-dash .82s cubic-bezier(.25, .8, .35, 1) both, nailong-float 4.4s ease-in-out .82s infinite !important;
}

body.app-page:not(.resource-home) .nailong-mascot.is-acting[data-action="search"] .nailong-mascot-button {
  animation: nailong-search .95s ease both, nailong-float 4.4s ease-in-out .95s infinite !important;
}

body.app-page:not(.resource-home) .nailong-mascot.is-acting[data-action="celebrate"] .nailong-mascot-button {
  animation: nailong-celebrate 1s ease both, nailong-float 4.4s ease-in-out 1s infinite !important;
}

body.app-page:not(.resource-home) .nailong-mascot.is-acting[data-action="wobble"] .nailong-mascot-button {
  animation: nailong-wobble .9s ease both, nailong-float 4.4s ease-in-out .9s infinite !important;
}

body.app-page:not(.resource-home) .nailong-mascot.is-acting[data-action="think"] .nailong-mascot-button {
  animation: nailong-think 1.05s ease both, nailong-float 4.4s ease-in-out 1.05s infinite !important;
}

body.app-page:not(.resource-home) .nailong-mascot.is-acting .nailong-mascot-text {
  animation: nailong-bubble-pop .42s ease both !important;
}

body.app-page:not(.resource-home) .nailong-mascot.is-acting[data-action="celebrate"] .nailong-mascot-spark {
  animation: nailong-confetti .7s ease both !important;
}

body.app-page:not(.resource-home) .nailong-mascot.is-acting[data-action="think"] .nailong-mascot-halo,
body.app-page:not(.resource-home) .nailong-mascot.is-acting[data-action="search"] .nailong-mascot-halo {
  animation: nailong-scan-halo .82s ease both !important;
}

body.app-page:not(.resource-home) .nailong-mascot[data-mood="success"] .nailong-mascot-text {
  border-color: rgba(34, 197, 94, .38) !important;
  background: linear-gradient(135deg, rgba(240, 253, 244, .96), rgba(255, 247, 218, .96)) !important;
}

body.app-page:not(.resource-home) .nailong-mascot[data-mood="warning"] .nailong-mascot-text {
  border-color: rgba(245, 158, 11, .46) !important;
  background: linear-gradient(135deg, rgba(255, 251, 235, .98), rgba(254, 226, 226, .92)) !important;
}

body.app-page:not(.resource-home) .nailong-mascot[data-mood="exam"] .nailong-mascot-text {
  border-color: rgba(124, 77, 255, .34) !important;
  background: linear-gradient(135deg, rgba(245, 243, 255, .98), rgba(255, 247, 218, .94)) !important;
}

body.app-theme-dark.app-page:not(.resource-home) .nailong-mascot-text {
  border-color: rgba(125, 211, 252, .26) !important;
  background: linear-gradient(135deg, rgba(15, 23, 42, .94), rgba(45, 36, 19, .94)) !important;
  color: #eaf2ff !important;
  box-shadow: 0 18px 38px rgba(0, 0, 0, .28) !important;
}

body.app-theme-dark.app-page:not(.resource-home) .nailong-mascot-text::after {
  border-color: rgba(125, 211, 252, .26) !important;
  background: #2d2413 !important;
}

body.preview-open.app-page:not(.resource-home) .nailong-mascot {
  opacity: 0 !important;
  pointer-events: none !important;
  transform: translateY(.5rem) scale(.96) !important;
}

body.app-page:not(.resource-home) .ai-chat-fab {
  display: none !important;
  pointer-events: none !important;
}

@keyframes nailong-float {
  0%,
  100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-.55rem) rotate(2deg); }
}

@keyframes nailong-halo {
  from { transform: rotate(0deg) scale(1); opacity: .82; }
  50% { transform: rotate(180deg) scale(1.04); opacity: .5; }
  to { transform: rotate(360deg) scale(1); opacity: .82; }
}

@keyframes nailong-spark {
  0%,
  100% { opacity: .72; transform: rotate(-45deg) translateY(0) scale(.78); }
  50% { opacity: 1; transform: rotate(-45deg) translateY(-.28rem) scale(1); }
}

@keyframes nailong-wave {
  0% { transform: translateY(0) rotate(-2deg) scale(1); }
  25% { transform: translateY(-.12rem) rotate(-13deg) scale(1.03); }
  55% { transform: translateY(-.2rem) rotate(11deg) scale(1.03); }
  78% { transform: translateY(-.08rem) rotate(-8deg) scale(1.02); }
  100% { transform: translateY(0) rotate(-2deg) scale(1); }
}

@keyframes nailong-peek {
  0% { transform: translateX(0) rotate(-2deg) scale(1); }
  40% { transform: translateX(.35rem) rotate(8deg) scale(1.04); }
  70% { transform: translateX(.12rem) rotate(-6deg) scale(1.02); }
  100% { transform: translateX(0) rotate(-2deg) scale(1); }
}

@keyframes nailong-nod {
  0% { transform: translateY(0) rotate(-2deg) scale(1); }
  30% { transform: translateY(.2rem) rotate(1deg) scale(.98); }
  58% { transform: translateY(-.18rem) rotate(-3deg) scale(1.03); }
  100% { transform: translateY(0) rotate(-2deg) scale(1); }
}

@keyframes nailong-dash {
  0% { transform: translateX(0) rotate(-2deg) scale(1); }
  28% { transform: translateX(.7rem) rotate(7deg) scale(1.03); }
  52% { transform: translateX(-.4rem) rotate(-8deg) scale(1.04); }
  76% { transform: translateX(.22rem) rotate(3deg) scale(1.02); }
  100% { transform: translateX(0) rotate(-2deg) scale(1); }
}

@keyframes nailong-search {
  0% { transform: translateY(0) rotate(-2deg) scale(1); }
  25% { transform: translateY(-.18rem) rotate(-14deg) scale(1.02); }
  52% { transform: translateY(.08rem) rotate(14deg) scale(1.02); }
  78% { transform: translateY(-.1rem) rotate(-7deg) scale(1.01); }
  100% { transform: translateY(0) rotate(-2deg) scale(1); }
}

@keyframes nailong-celebrate {
  0% { transform: translateY(0) rotate(-2deg) scale(1); }
  32% { transform: translateY(-.7rem) rotate(-8deg) scale(1.05); }
  64% { transform: translateY(-.35rem) rotate(7deg) scale(1.03); }
  100% { transform: translateY(0) rotate(-2deg) scale(1); }
}

@keyframes nailong-wobble {
  0% { transform: translateX(0) rotate(-2deg) scale(1); }
  18% { transform: translateX(-.24rem) rotate(-10deg) scale(.99); }
  36% { transform: translateX(.24rem) rotate(10deg) scale(1.01); }
  54% { transform: translateX(-.16rem) rotate(-7deg) scale(1); }
  74% { transform: translateX(.1rem) rotate(5deg) scale(1); }
  100% { transform: translateX(0) rotate(-2deg) scale(1); }
}

@keyframes nailong-focus {
  0%,
  100% { transform: translateY(0) rotate(0deg) scale(1); filter: saturate(1); }
  50% { transform: translateY(-.2rem) rotate(0deg) scale(1.025); filter: saturate(1.12); }
}

@keyframes nailong-think {
  0% { transform: translateY(0) rotate(-2deg) scale(1); }
  24% { transform: translateY(-.2rem) rotate(7deg) scale(1.01); }
  48% { transform: translateY(.04rem) rotate(-5deg) scale(.99); }
  74% { transform: translateY(-.14rem) rotate(3deg) scale(1.02); }
  100% { transform: translateY(0) rotate(-2deg) scale(1); }
}

@keyframes nailong-bubble-pop {
  0% { transform: scale(.96); opacity: .72; }
  70% { transform: scale(1.025); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes nailong-confetti {
  0% { opacity: .8; transform: rotate(-45deg) translateY(0) scale(.72); }
  45% { opacity: 1; transform: rotate(-45deg) translateY(-.55rem) scale(1.28); }
  100% { opacity: .72; transform: rotate(-45deg) translateY(.1rem) scale(.78); }
}

@keyframes nailong-scan-halo {
  0% { transform: rotate(0deg) scale(.95); opacity: .45; }
  50% { transform: rotate(180deg) scale(1.14); opacity: .95; }
  100% { transform: rotate(360deg) scale(1); opacity: .72; }
}

@media (max-width: 1180px) {
  body.app-page:not(.resource-home) .nailong-mascot {
    position: static !important;
    z-index: 34 !important;
    grid-template-columns: 4.45rem minmax(0, 9.8rem) !important;
    width: min(100%, 16rem) !important;
    max-width: 100% !important;
    margin: .8rem 0 0 !important;
  }
}

@media (max-width: 760px) {
  body.app-page:not(.resource-home) .nailong-mascot {
    grid-template-columns: 4.25rem minmax(0, 9.8rem) !important;
    gap: .52rem !important;
  }

  body.app-page:not(.resource-home) .nailong-mascot-button {
    grid-column: 1 !important;
    grid-row: 1 !important;
  }

  body.app-page:not(.resource-home) .nailong-mascot-text {
    grid-column: 2 !important;
    grid-row: 1 !important;
    min-height: 2.45rem !important;
    padding: .5rem .62rem !important;
    font-size: .76rem !important;
  }

  body.app-page:not(.resource-home) .nailong-mascot-text::after {
    left: -.38rem !important;
    right: auto !important;
    border-right: 0 !important;
    border-left: 1px solid rgba(47, 125, 246, .18) !important;
    transform: translateY(-50%) rotate(-45deg) !important;
  }
}

body.app-motion-reduced.app-page:not(.resource-home) .nailong-mascot-button,
body.app-motion-reduced.app-page:not(.resource-home) .nailong-mascot-halo,
body.app-motion-reduced.app-page:not(.resource-home) .nailong-mascot-spark,
body.app-motion-reduced.app-page:not(.resource-home) .nailong-mascot.is-acting .nailong-mascot-button,
body.app-motion-reduced.app-page:not(.resource-home) .nailong-mascot.is-acting .nailong-mascot-text {
  animation: none !important;
}

/* University utility tone: keep the practice desk focused without hiding the AI mascot entry. */
body.app-page:not(.resource-home) .campus-card,
body.app-page:not(.resource-home) .author-card {
  display: none !important;
}

body.app-page:not(.resource-home) .sync-panel::after {
  display: none !important;
  content: none !important;
}

body.app-page:not(.resource-home) .sync-panel {
  min-height: 4.85rem !important;
  padding: .82rem 1rem !important;
}

/* Compact AI chat configuration pass. */
.ai-chat-settings.ai-chat-user-settings {
  width: min(22rem, 36vw);
}

.ai-settings-head {
  gap: .18rem !important;
}

.ai-chat-config-grid,
.ai-chat-advanced-grid {
  display: grid;
  gap: .52rem;
}

.ai-model-key-card,
.ai-provider-meta-grid {
  border: 1px solid #dbe3ef;
  border-radius: .55rem;
  background: #f8fbff;
}

.ai-model-key-card {
  display: grid;
  gap: .16rem;
  margin-top: .58rem;
  padding: .62rem .72rem;
}

.ai-model-key-card span,
.ai-provider-meta-grid b {
  color: #64748b;
  font-size: .68rem;
  font-weight: 900;
  text-transform: none;
}

.ai-model-key-card strong {
  min-width: 0;
  overflow: hidden;
  color: #0f172a;
  font-size: .94rem;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-model-key-card small {
  color: #64748b;
  font-size: .72rem;
  font-weight: 760;
}

.ai-provider-meta-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: .34rem;
  padding: .58rem .64rem;
}

.ai-provider-meta-grid span {
  display: grid;
  gap: .08rem;
  min-width: 0;
}

.ai-provider-meta-grid small {
  min-width: 0;
  overflow: hidden;
  color: #334155;
  font-size: .72rem;
  font-weight: 820;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-chat-field small {
  color: #64748b;
  font-size: .72rem;
  font-weight: 740;
  line-height: 1.35;
}

.ai-chat-checkline {
  display: flex;
  align-items: flex-start;
  gap: .46rem;
  min-width: 0;
  border: 1px solid #dbe3ef;
  border-radius: .48rem;
  padding: .48rem .55rem;
  background: #fff;
  color: #334155;
  font-size: .78rem;
  font-weight: 800;
  line-height: 1.35;
}

.ai-chat-checkline input {
  flex: 0 0 auto;
  margin-top: .12rem;
}

.ai-chat-advanced-settings {
  grid-column: 1 / -1;
  border-top: 1px solid #e2e8f0;
  padding-top: .42rem;
}

.ai-chat-advanced-settings summary {
  cursor: pointer;
  color: #334155;
  font-size: .78rem;
  font-weight: 900;
}

.ai-chat-advanced-settings[open] summary {
  margin-bottom: .48rem;
}

.ai-chat-composer {
  gap: .48rem !important;
  padding-top: .68rem !important;
}

.ai-chat-composer-top {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
  justify-content: flex-start;
  min-width: 0;
}

.ai-chat-config-button {
  min-height: 2.24rem;
  border: 1px solid #f2c572;
  border-radius: .55rem;
  padding: 0 .82rem;
  background: #fff;
  color: #9a3412;
  cursor: pointer;
  font-size: .8rem;
  font-weight: 900;
  white-space: nowrap;
}

.ai-chat-config-button:hover,
.ai-chat-config-button:focus-visible,
.ai-chat-config-button[aria-expanded="true"] {
  border-color: #f59e0b;
  background: #fff7ed;
  color: #9a3412;
  outline: none;
}

.ai-chat-config-button.is-configured {
  border-color: #0f9f9a;
  background: #ecfdfb;
  color: #0f766e;
}

.ai-chat-config-button.needs-attention,
body.ai-key-missing .ai-chat-config-button {
  border-color: #f2c572;
  background: #fff7ed;
  color: #9a3412;
}

.ai-chat-quick-prompts {
  padding-bottom: 0 !important;
}

.ai-chat-readiness {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: .34rem !important;
}

.ai-chat-readiness[hidden] {
  display: none !important;
}

.ai-chat-readiness-chip {
  min-height: 1.92rem !important;
  border-left-width: 2px !important;
  padding: .28rem .44rem !important;
}

.ai-chat-readiness-chip strong {
  font-size: .7rem !important;
}

.ai-chat-readiness-chip small {
  font-size: .66rem !important;
}

body.app-page .ai-chat-composer textarea {
  height: var(--ai-composer-height, 3.75rem) !important;
  min-height: 3.75rem !important;
  max-height: 9rem !important;
  border-radius: .8rem !important;
  line-height: 1.55 !important;
  resize: none !important;
}

.ai-chat-composer-actions {
  grid-template-columns: minmax(0, 1fr) max-content !important;
  gap: .5rem !important;
}

.ai-chat-composer-tools {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  min-width: 0;
}

.ai-chat-composer-tools .ai-chat-ghost-button {
  min-height: 2.28rem;
  padding: 0 .72rem;
}

@media (max-width: 940px) {
  .ai-chat-settings.ai-chat-user-settings {
    width: auto;
  }
}

@media (max-width: 720px) {
  .ai-chat-readiness {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .ai-chat-composer-top {
    grid-template-columns: 1fr;
  }

  .ai-chat-config-button {
    width: 100%;
  }
}

@media (max-width: 520px) {
  .ai-chat-readiness {
    grid-template-columns: 1fr !important;
  }

  .ai-chat-composer-actions {
    grid-template-columns: 1fr !important;
  }
}

body.app-theme-dark.app-page :where(.ai-model-key-card, .ai-provider-meta-grid, .ai-chat-checkline, .ai-chat-config-button) {
  border-color: #29384d !important;
  background: #111a2a !important;
  color: #d7dfeb !important;
}

body.app-theme-dark.app-page :where(.ai-model-key-card strong, .ai-provider-meta-grid small) {
  color: #e6edf7 !important;
}

body.app-theme-dark.app-page :where(.ai-chat-config-button:hover, .ai-chat-config-button:focus-visible, .ai-chat-config-button[aria-expanded="true"]) {
  border-color: #6b461b !important;
  background: #231a0d !important;
  color: #fbbf24 !important;
}

body.app-theme-dark.app-page :where(.ai-chat-config-button.is-configured),
body.app-theme-dark.app-page :where(.ai-chat-config-button.is-configured:hover, .ai-chat-config-button.is-configured:focus-visible, .ai-chat-config-button.is-configured[aria-expanded="true"]) {
  border-color: #14b8a6 !important;
  background: #0d2026 !important;
  color: #99f6e4 !important;
}

body.app-theme-dark.app-page :where(.ai-chat-config-button.needs-attention),
body.app-theme-dark.app-page.ai-key-missing :where(.ai-chat-config-button) {
  border-color: #6b461b !important;
  background: #231a0d !important;
  color: #fbbf24 !important;
}

body.app-theme-dark.app-page :where(.ai-model-key-card span, .ai-model-key-card small, .ai-provider-meta-grid b, .ai-chat-field small, .ai-chat-advanced-settings summary) {
  color: #8794a8 !important;
}

body.app-theme-dark.app-page :where(.ai-thinking-bubble span) {
  background: #cbd5e1;
}

.ai-settings-backdrop {
  display: none;
}

.ai-settings-close {
  min-height: 2rem;
  border: 1px solid #dbe3ef;
  border-radius: .48rem;
  padding: 0 .68rem;
  background: #fff;
  color: #334155;
  cursor: pointer;
  font-size: .78rem;
  font-weight: 900;
  white-space: nowrap;
}

.ai-settings-close:hover,
.ai-settings-close:focus-visible {
  border-color: #0f9f9a;
  background: #ecfdfb;
  color: #0f766e;
  outline: none;
}

body.ai-settings-open .ai-settings-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: block;
  background: rgba(15, 23, 42, .28);
  backdrop-filter: blur(3px);
}

body.ai-settings-open .ai-chat-main {
  grid-template-columns: minmax(0, 1fr) !important;
}

body.ai-settings-open .ai-chat-panel.ai-chat-shell {
  z-index: 1205;
}

body.ai-settings-open .ai-chat-settings.ai-chat-user-settings {
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  z-index: 1210 !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(18rem, .58fr);
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  grid-template-areas:
    "head head"
    "model app"
    "config app"
    "pref pref"
    "actions actions";
  grid-column: auto !important;
  grid-row: auto !important;
  gap: 1rem;
  width: min(64rem, calc(100vw - 3rem)) !important;
  height: min(42rem, calc(100dvh - 3rem)) !important;
  max-height: min(42rem, calc(100dvh - 3rem)) !important;
  border: 1px solid #dbe3ef !important;
  border-radius: 1rem !important;
  padding: 0 1.1rem 1.1rem !important;
  overflow: hidden !important;
  background: #fff !important;
  box-shadow: 0 26px 80px rgba(15, 23, 42, .24);
  transform: translate(-50%, -50%) !important;
}

body.ai-settings-open .ai-chat-settings.ai-chat-user-settings .ai-settings-head {
  grid-area: head;
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: .38rem 1rem !important;
  align-items: start;
  border-bottom: 1px solid #e2e8f0;
  margin: 0 -1.1rem;
  padding: 1.05rem 1.1rem .9rem;
}

body.ai-settings-open .ai-chat-settings.ai-chat-user-settings .ai-settings-head strong,
body.ai-settings-open .ai-chat-settings.ai-chat-user-settings .ai-settings-head span {
  min-width: 0;
}

body.ai-settings-open .ai-chat-settings.ai-chat-user-settings .ai-settings-head span {
  grid-column: 1;
}

body.ai-settings-open .ai-chat-settings.ai-chat-user-settings .ai-settings-close {
  grid-column: 2;
  grid-row: 1 / span 2;
}

body.app-page:not(.resource-home) .topbar-theme-toggle {
  display: none !important;
}

body.ai-settings-open .ai-chat-settings.ai-chat-user-settings .app-settings-card {
  grid-area: app;
  display: grid;
  gap: .7rem;
  align-self: stretch;
  margin: 0;
  border: 1px solid #dbe3ef;
  border-radius: .68rem;
  padding: 1rem;
  background: #f8fbff;
}

body.ai-settings-open .ai-chat-settings.ai-chat-user-settings .app-settings-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}

body.ai-settings-open .ai-chat-settings.ai-chat-user-settings .app-settings-card-head span {
  color: #2563eb;
  font-size: .75rem;
  font-weight: 900;
}

body.ai-settings-open .ai-chat-settings.ai-chat-user-settings .app-settings-card-head strong {
  color: #0f172a;
  font-size: .98rem;
  font-weight: 950;
}

body.ai-settings-open .ai-chat-settings.ai-chat-user-settings .app-settings-theme {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .45rem;
}

body.ai-settings-open .ai-chat-settings.ai-chat-user-settings .app-settings-theme button {
  min-height: 2.25rem;
  border: 1px solid #dbe3ef;
  border-radius: .5rem;
  background: #ffffff;
  color: #334155;
  cursor: pointer;
  font-weight: 900;
}

body.ai-settings-open .ai-chat-settings.ai-chat-user-settings .app-settings-theme button[aria-pressed="true"] {
  border-color: #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
}

body.ai-settings-open .ai-chat-settings.ai-chat-user-settings .app-settings-motion {
  justify-content: space-between;
  border: 1px solid #dbe3ef;
  border-radius: .5rem;
  padding: .62rem .7rem;
  background: #ffffff;
}

body.ai-settings-open .ai-chat-settings.ai-chat-user-settings .preference-card-note {
  margin: 0;
  color: #64748b;
  font-size: .78rem;
  font-weight: 800;
}

body.ai-settings-open .ai-chat-settings.ai-chat-user-settings .ai-model-key-card {
  grid-area: model;
  align-self: stretch;
  margin: 0;
  padding: 1rem;
}

body.ai-settings-open .ai-chat-settings.ai-chat-user-settings .ai-chat-config-grid {
  grid-area: config;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .72rem;
  min-height: 0;
  overflow-y: auto;
  padding: 0;
}

body.ai-settings-open .ai-chat-settings.ai-chat-user-settings .ai-chat-key-field,
body.ai-settings-open .ai-chat-settings.ai-chat-user-settings .ai-chat-advanced-settings {
  grid-column: 1 / -1;
}

body.ai-settings-open .ai-chat-settings.ai-chat-user-settings .ai-chat-default-model-field,
body.ai-settings-open .ai-chat-settings.ai-chat-user-settings .ai-chat-keep-key {
  grid-column: auto;
}

body.ai-settings-open .ai-chat-settings.ai-chat-user-settings .ai-provider-meta-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

body.ai-settings-open .ai-chat-settings.ai-chat-user-settings .ai-preference-grid {
  grid-area: pref;
  border-top: 1px solid #e2e8f0;
  margin: 0 -1.1rem;
  padding: .78rem 1.1rem .35rem;
}

body.ai-settings-open .ai-chat-settings.ai-chat-user-settings .ai-settings-actions {
  grid-area: actions;
  display: flex;
  justify-content: flex-end;
  gap: .65rem;
  border-top: 1px solid #e2e8f0;
  margin: 0 -1.1rem -1.1rem;
  padding: .82rem 1.1rem 1rem;
}

.ai-settings-primary {
  min-height: 2.5rem;
  border: 1px solid #0f766e;
  border-radius: .55rem;
  padding: 0 1.05rem;
  background: #0f766e;
  color: #ffffff;
  cursor: pointer;
  font-size: .88rem;
  font-weight: 950;
  white-space: nowrap;
  box-shadow: 0 12px 26px rgba(15, 118, 110, .2);
}

.ai-settings-primary:hover,
.ai-settings-primary:focus-visible {
  border-color: #0d9488;
  background: #0d9488;
  outline: none;
  transform: translateY(-1px);
}

@media (max-width: 720px) {
  body.ai-settings-open .ai-chat-settings.ai-chat-user-settings {
    width: calc(100vw - 1rem) !important;
    max-height: calc(100dvh - 1rem) !important;
    grid-template-columns: 1fr;
    grid-template-areas:
      "head"
      "model"
      "config"
      "app"
      "pref"
      "actions";
  }

  body.ai-settings-open .ai-chat-settings.ai-chat-user-settings .ai-settings-head,
  body.ai-settings-open .ai-chat-settings.ai-chat-user-settings .ai-chat-config-grid {
    grid-template-columns: 1fr;
  }

  body.ai-settings-open .ai-chat-settings.ai-chat-user-settings .ai-settings-close {
    grid-column: 1;
    grid-row: auto;
    justify-self: start;
  }

  body.ai-settings-open .ai-chat-settings.ai-chat-user-settings .ai-provider-meta-grid {
    grid-template-columns: 1fr;
  }

  body.ai-settings-open .ai-chat-settings.ai-chat-user-settings .ai-chat-default-model-field,
  body.ai-settings-open .ai-chat-settings.ai-chat-user-settings .ai-chat-keep-key {
    grid-column: 1 / -1;
  }

  body.ai-settings-open .ai-chat-settings.ai-chat-user-settings .ai-settings-actions {
    justify-content: stretch;
  }

  .ai-settings-primary {
    width: 100%;
  }
}

body.app-theme-dark.app-page.ai-settings-open .ai-settings-backdrop {
  background: rgba(2, 6, 23, .55);
}

body.app-theme-dark.app-page.ai-settings-open .ai-chat-settings.ai-chat-user-settings {
  border-color: #29384d !important;
  background: #0f1726 !important;
  box-shadow: 0 26px 80px rgba(0, 0, 0, .42);
}

body.app-theme-dark.app-page.ai-settings-open .ai-chat-settings.ai-chat-user-settings .ai-settings-head,
body.app-theme-dark.app-page.ai-settings-open .ai-chat-settings.ai-chat-user-settings .ai-preference-grid,
body.app-theme-dark.app-page.ai-settings-open .ai-chat-settings.ai-chat-user-settings .ai-settings-actions {
  border-color: #29384d;
}

body.app-theme-dark.app-page.ai-settings-open .ai-chat-settings.ai-chat-user-settings .app-settings-card,
body.app-theme-dark.app-page.ai-settings-open .ai-chat-settings.ai-chat-user-settings .app-settings-motion,
body.app-theme-dark.app-page.ai-settings-open .ai-chat-settings.ai-chat-user-settings .app-settings-theme button {
  border-color: #29384d;
  background: #111a2a;
  color: #d7dfeb;
}

body.app-theme-dark.app-page.ai-settings-open .ai-chat-settings.ai-chat-user-settings .app-settings-card-head strong {
  color: #e6edf7;
}

body.app-theme-dark.app-page.ai-settings-open .ai-chat-settings.ai-chat-user-settings .app-settings-card-head span,
body.app-theme-dark.app-page.ai-settings-open .ai-chat-settings.ai-chat-user-settings .preference-card-note {
  color: #93c5fd;
}

body.app-theme-dark.app-page.ai-settings-open .ai-chat-settings.ai-chat-user-settings .app-settings-theme button[aria-pressed="true"] {
  border-color: #60a5fa;
  background: rgba(37, 99, 235, .22);
  color: #dbeafe;
}

body.app-theme-dark.app-page :where(.ai-settings-close) {
  border-color: #29384d;
  background: #111a2a;
  color: #d7dfeb;
}

body.app-theme-dark.app-page :where(.ai-settings-close:hover, .ai-settings-close:focus-visible) {
  border-color: #14b8a6;
  background: #0d2026;
  color: #99f6e4;
}

body.app-theme-dark.app-page :where(.ai-settings-primary) {
  border-color: #14b8a6;
  background: #0f766e;
  color: #ecfeff;
}

/* Compact wrong/favorite library views */
body.app-page:not(.resource-home) .collection-view-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1.1rem;
  align-items: center;
  border: 1px solid #d8e2ef;
  border-radius: 18px;
  padding: 1.15rem 1.25rem;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 16px 38px rgba(15, 23, 42, .08);
}

body.app-page:not(.resource-home) .collection-view-head > div {
  display: grid;
  gap: .22rem;
  min-width: 0;
}

body.app-page:not(.resource-home) .collection-view-head span {
  color: #64748b;
  font-size: .86rem;
  font-weight: 800;
}

body.app-page:not(.resource-home) .collection-view-head strong {
  color: #0f172a;
  font-size: 1.48rem;
  font-weight: 950;
  letter-spacing: 0;
}

body.app-page:not(.resource-home) .collection-view-head dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(5.4rem, 1fr));
  gap: .7rem;
  margin: 0;
}

body.app-page:not(.resource-home) .collection-view-head dl > div {
  min-width: 0;
  border: 1px solid #dbe7f6;
  border-radius: 14px;
  padding: .7rem .85rem;
  background: #f8fbff;
}

body.app-page:not(.resource-home) .collection-view-head dt {
  margin: 0 0 .12rem;
  color: #64748b;
  font-size: .78rem;
  font-weight: 850;
}

body.app-page:not(.resource-home) .collection-view-head dd {
  margin: 0;
  color: #1d4ed8;
  font-size: 1.35rem;
  font-weight: 950;
}

body.app-page:not(.resource-home) .collection-question-list {
  display: grid;
  gap: .82rem;
}

body.app-page:not(.resource-home) .collection-question {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  border: 1px solid #dbe3ef;
  border-radius: 16px;
  padding: 1rem 1.08rem;
  background: rgba(255, 255, 255, .95);
  box-shadow: 0 12px 30px rgba(15, 23, 42, .06);
}

body.app-page:not(.resource-home) .collection-question-main {
  display: grid;
  gap: .45rem;
  min-width: 0;
}

body.app-page:not(.resource-home) .collection-question-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .38rem;
  align-items: center;
  min-width: 0;
}

body.app-page:not(.resource-home) .collection-question-meta span {
  max-width: 12rem;
  overflow: hidden;
  border: 1px solid #dbe7f6;
  border-radius: 999px;
  padding: .18rem .52rem;
  background: #f8fbff;
  color: #475569;
  font-size: .76rem;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.app-page:not(.resource-home) .collection-question-meta .collection-status {
  border-color: transparent;
}

body.app-page:not(.resource-home) .collection-status.ok {
  background: #ecfdf5;
  color: #047857;
}

body.app-page:not(.resource-home) .collection-status.warn {
  background: #fff7ed;
  color: #c2410c;
}

body.app-page:not(.resource-home) .collection-status.done {
  background: #eff6ff;
  color: #1d4ed8;
}

body.app-page:not(.resource-home) .collection-status.muted {
  background: #f1f5f9;
  color: #64748b;
}

body.app-page:not(.resource-home) .collection-question h3 {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  color: #0f172a;
  font-size: 1rem;
  font-weight: 900;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

body.app-page:not(.resource-home) .collection-question p {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  color: #64748b;
  font-size: .88rem;
  font-weight: 760;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}

body.app-page:not(.resource-home) .collection-question-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: .5rem;
  min-width: 16.8rem;
}

body.app-page:not(.resource-home) .collection-question-actions button {
  min-height: 2.24rem;
  border: 1px solid #cbd8ea;
  border-radius: 10px;
  padding: 0 .78rem;
  background: #fff;
  color: #1e3a8a;
  cursor: pointer;
  font-size: .82rem;
  font-weight: 900;
  white-space: nowrap;
}

body.app-page:not(.resource-home) .collection-question-actions button:hover,
body.app-page:not(.resource-home) .collection-question-actions button:focus-visible {
  border-color: #3b82f6;
  background: #eff6ff;
  color: #1d4ed8;
  outline: none;
}

body.app-page:not(.resource-home) .collection-question-actions .collection-toggle-button {
  min-width: 3.1rem;
  min-height: 2.08rem;
  padding: 0 .62rem;
  border-radius: 999px;
  background: #f8fafc;
  color: #64748b;
}

body.app-page:not(.resource-home) .collection-question-actions .collection-toggle-button.is-wrong.is-active {
  border-color: #f87171;
  background: #fef2f2;
  color: #991b1b;
}

body.app-page:not(.resource-home) .collection-question-actions .collection-toggle-button.is-fav.is-active {
  border-color: #facc15;
  background: #fffbeb;
  color: #92400e;
}

body.app-page:not(.resource-home) .collection-question-actions .collection-toggle-button:hover,
body.app-page:not(.resource-home) .collection-question-actions .collection-toggle-button:focus-visible {
  transform: translateY(-1px);
}

body.app-page:not(.resource-home) .collection-empty {
  min-height: 14rem;
}

body.app-theme-dark.app-page:not(.resource-home) .collection-view-head,
body.app-theme-dark.app-page:not(.resource-home) .collection-question {
  border-color: rgba(148, 163, 184, .2);
  background: rgba(9, 16, 28, .9);
  box-shadow: none;
}

body.app-theme-dark.app-page:not(.resource-home) .collection-view-head strong,
body.app-theme-dark.app-page:not(.resource-home) .collection-question h3 {
  color: #f8fafc;
}

body.app-theme-dark.app-page:not(.resource-home) .collection-view-head span,
body.app-theme-dark.app-page:not(.resource-home) .collection-view-head dt,
body.app-theme-dark.app-page:not(.resource-home) .collection-question p {
  color: #94a3b8;
}

body.app-theme-dark.app-page:not(.resource-home) .collection-view-head dl > div,
body.app-theme-dark.app-page:not(.resource-home) .collection-question-meta span,
body.app-theme-dark.app-page:not(.resource-home) .collection-question-actions button {
  border-color: rgba(148, 163, 184, .22);
  background: rgba(15, 23, 42, .72);
  color: #dbeafe;
}

body.app-theme-dark.app-page:not(.resource-home) .collection-question-actions button:hover,
body.app-theme-dark.app-page:not(.resource-home) .collection-question-actions button:focus-visible {
  border-color: #60a5fa;
  background: rgba(29, 78, 216, .2);
}

body.app-theme-dark.app-page:not(.resource-home) .collection-question-actions .collection-toggle-button {
  border-color: rgba(148, 163, 184, .22);
  background: rgba(15, 23, 42, .62);
  color: #94a3b8;
}

body.app-theme-dark.app-page:not(.resource-home) .collection-question-actions .collection-toggle-button.is-wrong.is-active {
  border-color: rgba(248, 113, 113, .34);
  background: rgba(127, 29, 29, .24);
  color: #fecaca;
}

body.app-theme-dark.app-page:not(.resource-home) .collection-question-actions .collection-toggle-button.is-fav.is-active {
  border-color: rgba(250, 204, 21, .42);
  background: rgba(113, 63, 18, .28);
  color: #fde68a;
}

@media (max-width: 1100px) {
  body.app-page:not(.resource-home) .collection-view-head,
  body.app-page:not(.resource-home) .collection-question {
    grid-template-columns: 1fr;
  }

  body.app-page:not(.resource-home) .collection-question-actions {
    justify-content: flex-start;
    min-width: 0;
  }
}

@media (max-width: 720px) {
  body.app-page:not(.resource-home) .collection-view-head dl {
    grid-template-columns: 1fr;
  }

  body.app-page:not(.resource-home) .collection-question-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  body.app-page:not(.resource-home) .collection-question-actions button {
    width: 100%;
  }
}

/* Inline question classify toggles */
body.app-page:not(.resource-home) .question-title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .8rem;
  align-items: start;
}

body.app-page:not(.resource-home) .question-title-row .question-title {
  min-width: 0;
  margin: 0;
}

body.app-page:not(.resource-home) .question-title-toggles {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: .4rem;
  min-width: 7rem;
}

body.app-page:not(.resource-home) .question-mini-toggle {
  min-height: 1.9rem;
  border: 1px solid #d5dfec;
  border-radius: 999px;
  padding: 0 .62rem;
  background: #f8fafc;
  color: #64748b;
  cursor: pointer;
  font-size: .76rem;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

body.app-page:not(.resource-home) .question-mini-toggle:hover,
body.app-page:not(.resource-home) .question-mini-toggle:focus-visible {
  border-color: #3b82f6;
  background: #eff6ff;
  color: #1d4ed8;
  outline: none;
}

body.app-page:not(.resource-home) .question-mini-toggle.wrong-btn.active {
  border-color: #f87171;
  background: #fef2f2;
  color: #991b1b;
}

body.app-page:not(.resource-home) .question-mini-toggle.fav-btn.active {
  border-color: #facc15;
  background: #fffbeb;
  color: #92400e;
}

body.app-theme-dark.app-page:not(.resource-home) .question-mini-toggle {
  border-color: rgba(148, 163, 184, .24);
  background: rgba(15, 23, 42, .68);
  color: #94a3b8;
}

body.app-theme-dark.app-page:not(.resource-home) .question-mini-toggle:hover,
body.app-theme-dark.app-page:not(.resource-home) .question-mini-toggle:focus-visible {
  border-color: #60a5fa;
  background: rgba(29, 78, 216, .2);
  color: #dbeafe;
}

body.app-theme-dark.app-page:not(.resource-home) .question-mini-toggle.wrong-btn.active {
  border-color: rgba(248, 113, 113, .4);
  background: rgba(127, 29, 29, .26);
  color: #fecaca;
}

body.app-theme-dark.app-page:not(.resource-home) .question-mini-toggle.fav-btn.active {
  border-color: rgba(250, 204, 21, .42);
  background: rgba(113, 63, 18, .28);
  color: #fde68a;
}

@media (max-width: 860px) {
  body.app-page:not(.resource-home) .question-title-row {
    grid-template-columns: 1fr;
  }

  body.app-page:not(.resource-home) .question-title-toggles {
    justify-content: flex-start;
    min-width: 0;
  }
}

/* Qbank top polish: one-line search, compact course overview. */
body.app-page:not(.resource-home) .toolbar {
  display: grid !important;
  grid-template-columns: minmax(18rem, 1fr) minmax(8.25rem, .24fr) minmax(8.25rem, .24fr) minmax(8.25rem, .24fr) 5.9rem !important;
  align-items: center !important;
  gap: .55rem !important;
  width: 100% !important;
  max-width: none !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: .58rem !important;
  border-radius: 16px !important;
}

body.app-page:not(.resource-home) .toolbar .toolbar-field {
  min-width: 0 !important;
  width: auto !important;
  flex: none !important;
}

body.app-page:not(.resource-home) .toolbar label[for="course-filter"],
body.app-page:not(.resource-home) .toolbar .toolbar-field.is-advanced {
  display: none !important;
}

body.app-page:not(.resource-home) .toolbar .search-field {
  grid-column: 1 !important;
  flex: none !important;
  min-width: 0 !important;
}

body.app-page:not(.resource-home) .toolbar label[for="difficulty-filter"] {
  grid-column: 2 !important;
}

body.app-page:not(.resource-home) .toolbar label[for="term-filter"] {
  grid-column: 3 !important;
}

body.app-page:not(.resource-home) .toolbar label[for="progress-filter"] {
  grid-column: 4 !important;
}

body.app-page:not(.resource-home) .toolbar .toolbar-actions {
  grid-column: 5 !important;
  display: block !important;
  min-width: 0 !important;
  width: 100% !important;
  margin: 0 !important;
}

body.app-page:not(.resource-home) .toolbar .toolbar-field > span {
  display: none !important;
}

body.app-page:not(.resource-home) .toolbar input,
body.app-page:not(.resource-home) .toolbar select,
body.app-page:not(.resource-home) .toolbar #reset-filters-button {
  width: 100% !important;
  min-width: 0 !important;
  height: 2.72rem !important;
  min-height: 2.72rem !important;
  border-radius: 12px !important;
  font-size: .9rem !important;
}

body.app-page:not(.resource-home) .toolbar #reset-filters-button {
  display: inline-flex !important;
  justify-content: center !important;
  padding: 0 .8rem !important;
}

body.app-page:not(.resource-home) .content-header {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(31rem, .8fr) !important;
  align-items: center !important;
  gap: 1rem !important;
  position: relative !important;
  min-height: 0 !important;
  height: auto !important;
  margin-top: .85rem !important;
  padding: 1rem 1.15rem !important;
  border-radius: 18px !important;
  overflow: hidden !important;
}

body.app-page:not(.resource-home) .content-header::before,
body.app-page:not(.resource-home) .content-header::after {
  display: none !important;
  content: none !important;
}

body.app-page:not(.resource-home) .hero-formula-field {
  position: absolute;
  inset: .35rem .65rem .35rem 34%;
  z-index: 0;
  pointer-events: none;
  color: rgba(37, 99, 235, .13);
  font-family: "Cambria Math", "Times New Roman", serif;
  font-size: clamp(.78rem, 1vw, 1rem);
  font-weight: 700;
  line-height: 1;
  opacity: .9;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 12%, #000 68%, transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0%, #000 12%, #000 68%, transparent 100%);
}

body.app-page:not(.resource-home) .hero-formula-field span {
  position: absolute;
  white-space: nowrap;
  text-shadow: 0 0 18px rgba(59, 130, 246, .12);
}

body.app-page:not(.resource-home) .hero-formula-field span:nth-child(1) { left: 8%; top: 8%; }
body.app-page:not(.resource-home) .hero-formula-field span:nth-child(2) { left: 36%; top: 16%; }
body.app-page:not(.resource-home) .hero-formula-field span:nth-child(3) { right: 6%; top: 10%; }
body.app-page:not(.resource-home) .hero-formula-field span:nth-child(4) { left: 18%; bottom: 14%; }
body.app-page:not(.resource-home) .hero-formula-field span:nth-child(5) { left: 48%; bottom: 8%; }
body.app-page:not(.resource-home) .hero-formula-field span:nth-child(6) { right: 12%; bottom: 24%; }

body.app-page:not(.resource-home) .header-copy,
body.app-page:not(.resource-home) .header-stats {
  position: relative !important;
  z-index: 1 !important;
}

body.app-theme-dark.app-page:not(.resource-home) .hero-formula-field {
  color: rgba(147, 197, 253, .16);
  text-shadow: 0 0 18px rgba(96, 165, 250, .18);
}

body.app-page:not(.resource-home) .content-header .hero-campus-image,
body.app-page:not(.resource-home) .content-header .school-name-img,
body.app-page:not(.resource-home) .content-header .eyebrow {
  display: none !important;
}

body.app-page:not(.resource-home) .header-copy {
  display: grid !important;
  gap: .34rem !important;
  min-width: 0 !important;
}

body.app-page:not(.resource-home) .content-header h2 {
  margin: 0 !important;
  font-size: clamp(1.55rem, 2.2vw, 2rem) !important;
  line-height: 1.08 !important;
  letter-spacing: 0 !important;
}

body.app-page:not(.resource-home) .header-desc {
  margin: 0 !important;
  color: var(--dash-muted) !important;
  font-size: .92rem !important;
  font-weight: 780 !important;
  line-height: 1.3 !important;
}

body.app-page:not(.resource-home) .hero-chips {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: .4rem !important;
  margin-top: .12rem !important;
}

body.app-page:not(.resource-home) .hero-chips span {
  min-height: 1.9rem !important;
  padding: 0 .58rem !important;
  border-radius: 8px !important;
  font-size: .76rem !important;
}

body.app-page:not(.resource-home) .header-stats {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  align-items: stretch !important;
  gap: .62rem !important;
  width: 100% !important;
  min-width: 0 !important;
}

body.app-page:not(.resource-home) .header-stats div {
  position: relative !important;
  display: grid !important;
  grid-template-columns: 2.45rem minmax(0, 1fr) !important;
  grid-template-rows: auto auto !important;
  align-items: center !important;
  justify-items: start !important;
  gap: .08rem .55rem !important;
  min-height: 4.6rem !important;
  height: auto !important;
  padding: .62rem .7rem !important;
  border-radius: 14px !important;
  overflow: hidden !important;
  text-align: left !important;
}

body.app-page:not(.resource-home) .header-stats [data-header-view] {
  cursor: pointer !important;
  user-select: none !important;
}

body.app-page:not(.resource-home) .header-stats [data-header-view]:hover {
  border-color: var(--dash-line-strong) !important;
  transform: translateY(-1px) !important;
}

body.app-page:not(.resource-home) .header-stats [data-header-view]:focus-visible {
  outline: 3px solid rgba(47, 125, 246, .28) !important;
  outline-offset: 3px !important;
}

body.app-page:not(.resource-home) .header-stats div::before,
body.app-page:not(.resource-home) .header-stats div::after {
  display: none !important;
  content: none !important;
}

body.app-page:not(.resource-home) .header-stats .stat-icon-wrap {
  grid-column: 1 !important;
  grid-row: 1 / 3 !important;
  width: 2.35rem !important;
  height: 2.35rem !important;
  border-radius: 12px !important;
}

body.app-page:not(.resource-home) .header-stats .stat-icon-wrap svg {
  width: 1.22rem !important;
  height: 1.22rem !important;
}

body.app-page:not(.resource-home) .header-stats strong {
  grid-column: 2 !important;
  grid-row: 2 !important;
  font-size: clamp(1.32rem, 2vw, 1.8rem) !important;
  line-height: 1 !important;
}

body.app-page:not(.resource-home) .header-stats div > span:not(.stat-icon-wrap) {
  grid-column: 2 !important;
  grid-row: 1 !important;
  color: var(--dash-muted) !important;
  font-size: .76rem !important;
  font-weight: 880 !important;
  line-height: 1.1 !important;
}

body.app-page:not(.resource-home) .mode-panel {
  margin-top: .85rem !important;
}

@media (max-width: 1180px) {
  body.app-page:not(.resource-home) .toolbar {
    grid-template-columns: minmax(0, 1fr) repeat(3, minmax(7.8rem, .32fr)) 5.7rem !important;
  }

  body.app-page:not(.resource-home) .content-header {
    grid-template-columns: 1fr !important;
  }

  body.app-page:not(.resource-home) .hero-formula-field {
    inset: .4rem .8rem auto 48%;
    height: 4rem;
    opacity: .65;
  }

  body.app-page:not(.resource-home) .hero-formula-field span:nth-child(n + 4) {
    display: none;
  }
}

@media (max-width: 760px) {
  body.app-page:not(.resource-home) .toolbar {
    grid-template-columns: 1fr 1fr !important;
    gap: .5rem !important;
    padding: .58rem !important;
  }

  body.app-page:not(.resource-home) .toolbar .search-field {
    grid-column: 1 / -1 !important;
  }

  body.app-page:not(.resource-home) .toolbar label[for="difficulty-filter"],
  body.app-page:not(.resource-home) .toolbar label[for="term-filter"],
  body.app-page:not(.resource-home) .toolbar label[for="progress-filter"],
  body.app-page:not(.resource-home) .toolbar .toolbar-actions {
    grid-column: auto !important;
  }

  body.app-page:not(.resource-home) .content-header {
    padding: .9rem !important;
  }

  body.app-page:not(.resource-home) .header-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }

  body.app-page:not(.resource-home) .header-stats div {
    grid-template-columns: 1fr !important;
    grid-template-rows: auto auto !important;
    justify-items: center !important;
    min-height: 4.9rem !important;
    padding: .52rem .3rem !important;
    text-align: center !important;
  }

  body.app-page:not(.resource-home) .header-stats .stat-icon-wrap {
    display: none !important;
  }

body.app-page:not(.resource-home) .header-stats strong,
  body.app-page:not(.resource-home) .header-stats div > span:not(.stat-icon-wrap) {
    grid-column: 1 !important;
  }
}

/* Resource-home result list polish: dense rows for fast scanning. */
body.resource-home .qb-resource-list {
  gap: .72rem !important;
}

body.resource-home .qb-resource-card {
  gap: .42rem 1.05rem !important;
  min-height: 6.15rem !important;
  padding: .72rem 1rem .76rem 1.28rem !important;
  border-radius: 1rem !important;
  box-shadow: 0 12px 30px rgba(15, 23, 42, .07) !important;
}

body.resource-home .qb-resource-main {
  gap: .24rem !important;
}

body.resource-home .qb-resource-meta {
  gap: .3rem !important;
}

body.resource-home .qb-resource-meta span {
  max-width: 12rem;
  min-height: 1.46rem !important;
  padding: 0 .48rem !important;
  border-radius: 999px !important;
  font-size: .68rem !important;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.resource-home .qb-resource-card h2 {
  margin: 0 !important;
  max-width: 72ch;
  font-size: 1rem !important;
  line-height: 1.34 !important;
}

body.resource-home .qb-resource-source {
  font-size: .78rem !important;
}

body.resource-home .qb-source-file-list {
  display: flex;
  flex-wrap: wrap;
  gap: .42rem;
  margin-top: .06rem !important;
}

body.resource-home .qb-source-file-badge,
body.resource-home .qb-source-file-empty {
  min-height: 1.72rem !important;
  border-radius: 999px !important;
  padding: 0 .62rem !important;
  font-size: .88rem !important;
  box-shadow: none !important;
}

body.resource-home .qb-resource-actions {
  grid-template-columns: auto auto !important;
  gap: .58rem !important;
}

body.resource-home .qb-resource-open-button,
body.resource-home .qb-resource-ai-button {
  min-height: 2.35rem !important;
  border-radius: .72rem !important;
  padding: 0 .92rem !important;
}

body.resource-home .qb-resource-open-button {
  min-width: 4.8rem !important;
  border-color: rgba(139, 92, 246, .5) !important;
  color: #6d35d6 !important;
}

body.resource-home .qb-resource-ai-button {
  min-width: 8.8rem !important;
  box-shadow: 0 12px 24px rgba(124, 58, 237, .24) !important;
}

body.resource-home.app-theme-dark .qb-resource-card {
  box-shadow: 0 18px 42px rgba(0, 0, 0, .25) !important;
}

@media (max-width: 900px) {
  body.resource-home .qb-resource-card {
    grid-template-columns: 1fr !important;
    min-height: 0 !important;
    padding: .78rem .86rem .9rem 1.08rem !important;
  }

  body.resource-home .qb-resource-actions {
    width: 100%;
    justify-content: stretch !important;
  }

  body.resource-home .qb-resource-open-button,
  body.resource-home .qb-resource-ai-button {
    flex: 1 1 0;
    min-width: 0 !important;
    padding-inline: .55rem !important;
  }
}

/* Question card layout repair: keep classify buttons visible without compressing the problem statement. */
body.app-page:not(.resource-home) .question-card {
  position: relative !important;
  grid-template-areas:
    "head"
    "title"
    "answer"
    "feedback"
    "analysis"
    "coach"
    "actions" !important;
  grid-template-columns: minmax(0, 1fr) !important;
  gap: 1rem !important;
  padding: 4rem 1.28rem 1.22rem !important;
}

body.app-page:not(.resource-home) .question-card-head {
  grid-area: head !important;
  display: block !important;
  min-width: 0 !important;
}

body.app-page:not(.resource-home) .question-meta {
  min-width: 0 !important;
  padding-right: 0 !important;
}

body.app-page:not(.resource-home) .card-icon-actions {
  grid-area: auto !important;
  position: absolute !important;
  top: .95rem !important;
  right: 1.05rem !important;
  z-index: 3 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: .45rem !important;
  min-width: max-content !important;
  padding: .18rem !important;
  border-radius: 999px !important;
  background: rgba(255, 255, 255, .74) !important;
  backdrop-filter: blur(10px) !important;
}

body.app-page:not(.resource-home) .icon-btn.wrong-btn,
body.app-page:not(.resource-home) .icon-btn.fav-btn {
  display: inline-grid !important;
  place-items: center !important;
  width: 2.35rem !important;
  height: 2.35rem !important;
  min-width: 2.35rem !important;
  min-height: 2.35rem !important;
  border-radius: 999px !important;
  padding: 0 !important;
  border: 1px solid rgba(148, 163, 184, .35) !important;
  background: rgba(248, 250, 252, .92) !important;
  color: #64748b !important;
  box-shadow: 0 8px 18px rgba(15, 23, 42, .06) !important;
  font-size: 1.08rem !important;
  font-weight: 950 !important;
  line-height: 1 !important;
}

body.app-page:not(.resource-home) .icon-btn.wrong-btn {
  border-color: rgba(244, 114, 182, .42) !important;
  color: #be185d !important;
  background: #fff1f7 !important;
}

body.app-page:not(.resource-home) .icon-btn.fav-btn {
  border-color: rgba(250, 204, 21, .5) !important;
  color: #b45309 !important;
  background: #fffbeb !important;
}

body.app-page:not(.resource-home) .icon-btn.wrong-btn.active {
  border-color: #f472b6 !important;
  background: linear-gradient(135deg, #fdf2f8, #fce7f3) !important;
  color: #9d174d !important;
  box-shadow: 0 0 0 3px rgba(244, 114, 182, .16), 0 12px 22px rgba(190, 24, 93, .16) !important;
}

body.app-page:not(.resource-home) .icon-btn.fav-btn.active {
  border-color: #facc15 !important;
  background: linear-gradient(135deg, #fffbeb, #fef3c7) !important;
  color: #92400e !important;
  box-shadow: 0 0 0 3px rgba(250, 204, 21, .18), 0 12px 22px rgba(180, 83, 9, .14) !important;
}

body.app-page:not(.resource-home) .icon-btn.wrong-btn:hover,
body.app-page:not(.resource-home) .icon-btn.wrong-btn:focus-visible,
body.app-page:not(.resource-home) .icon-btn.fav-btn:hover,
body.app-page:not(.resource-home) .icon-btn.fav-btn:focus-visible {
  transform: translateY(-1px) !important;
  outline: none !important;
}

body.app-page:not(.resource-home) .question-title-row {
  grid-area: title !important;
  display: block !important;
  min-width: 0 !important;
}

body.app-page:not(.resource-home) .question-title-row .question-title {
  display: block !important;
  width: 100% !important;
  min-width: 0 !important;
  margin: .05rem 0 0 !important;
  text-align: left !important;
}

body.app-page:not(.resource-home) .question-title-toggles,
body.app-page:not(.resource-home) .question-mini-toggle {
  display: none !important;
}

body.app-page:not(.resource-home) .answer-checker {
  grid-area: answer !important;
  width: 100% !important;
  min-width: 0 !important;
}

body.app-page:not(.resource-home) .answer-input {
  width: 100% !important;
  max-width: none !important;
}

body.app-theme-dark.app-page:not(.resource-home) .icon-btn.wrong-btn {
  border-color: rgba(244, 114, 182, .36) !important;
  background: rgba(131, 24, 67, .22) !important;
  color: #f9a8d4 !important;
}

body.app-theme-dark.app-page:not(.resource-home) .icon-btn.fav-btn {
  border-color: rgba(250, 204, 21, .38) !important;
  background: rgba(113, 63, 18, .25) !important;
  color: #fde68a !important;
}

@media (max-width: 720px) {
  body.app-page:not(.resource-home) .question-card-head {
    grid-template-columns: 1fr !important;
  }

  body.app-page:not(.resource-home) .card-icon-actions {
    top: .8rem !important;
    right: .82rem !important;
  }
}

/* Question bank tag cleanup: short semantic labels, not source-title dumps. */
body.app-page:not(.resource-home) .question-meta {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: .38rem !important;
  max-width: calc(100% - 5.8rem) !important;
}

body.app-page:not(.resource-home) .question-meta .badge,
body.app-page:not(.resource-home) .preview-tags .preview-tag {
  display: inline-flex !important;
  align-items: center !important;
  max-width: 8.8rem !important;
  min-height: 1.58rem !important;
  padding: 0 .62rem !important;
  border: 1px solid transparent !important;
  border-radius: 999px !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  font-size: .72rem !important;
  font-weight: 850 !important;
  line-height: 1 !important;
  box-shadow: none !important;
}

body.app-page:not(.resource-home) .question-meta .badge[data-tone="subject"],
body.app-page:not(.resource-home) .preview-tags .preview-tag[data-tone="subject"] {
  border-color: rgba(37, 99, 235, .24) !important;
  background: rgba(37, 99, 235, .09) !important;
  color: #1d4ed8 !important;
}

body.app-page:not(.resource-home) .question-meta .badge[data-tone="term"],
body.app-page:not(.resource-home) .preview-tags .preview-tag[data-tone="term"] {
  border-color: rgba(14, 165, 233, .26) !important;
  background: rgba(14, 165, 233, .1) !important;
  color: #0369a1 !important;
}

body.app-page:not(.resource-home) .question-meta .badge[data-tone="course"],
body.app-page:not(.resource-home) .preview-tags .preview-tag[data-tone="course"] {
  border-color: rgba(20, 184, 166, .26) !important;
  background: rgba(20, 184, 166, .1) !important;
  color: #0f766e !important;
}

body.app-page:not(.resource-home) .question-meta .badge[data-tone="year"],
body.app-page:not(.resource-home) .preview-tags .preview-tag[data-tone="year"] {
  border-color: rgba(99, 102, 241, .25) !important;
  background: rgba(99, 102, 241, .1) !important;
  color: #4f46e5 !important;
}

body.app-page:not(.resource-home) .question-meta .badge[data-tone="stage"],
body.app-page:not(.resource-home) .preview-tags .preview-tag[data-tone="stage"] {
  border-color: rgba(249, 115, 22, .3) !important;
  background: rgba(249, 115, 22, .11) !important;
  color: #c2410c !important;
}

body.app-page:not(.resource-home) .question-meta .badge[data-tone="type"],
body.app-page:not(.resource-home) .preview-tags .preview-tag[data-tone="type"] {
  border-color: rgba(147, 51, 234, .26) !important;
  background: rgba(147, 51, 234, .1) !important;
  color: #7e22ce !important;
}

body.app-page:not(.resource-home) .question-meta .badge[data-tone="difficulty"],
body.app-page:not(.resource-home) .preview-tags .preview-tag[data-tone="difficulty"] {
  border-color: rgba(22, 163, 74, .28) !important;
  background: rgba(22, 163, 74, .1) !important;
  color: #15803d !important;
}

body.app-page:not(.resource-home) .question-meta .badge[data-tone="source"],
body.app-page:not(.resource-home) .preview-tags .preview-tag[data-tone="source"] {
  border-color: rgba(100, 116, 139, .26) !important;
  background: rgba(100, 116, 139, .09) !important;
  color: #475569 !important;
}

body.app-theme-dark.app-page:not(.resource-home) .question-meta .badge,
body.app-theme-dark.app-page:not(.resource-home) .preview-tags .preview-tag {
  background: rgba(15, 23, 42, .78) !important;
}

body.app-theme-dark.app-page:not(.resource-home) .question-meta .badge[data-tone="subject"],
body.app-theme-dark.app-page:not(.resource-home) .preview-tags .preview-tag[data-tone="subject"] {
  border-color: rgba(96, 165, 250, .38) !important;
  background: rgba(37, 99, 235, .16) !important;
  color: #93c5fd !important;
}

body.app-theme-dark.app-page:not(.resource-home) .question-meta .badge[data-tone="term"],
body.app-theme-dark.app-page:not(.resource-home) .preview-tags .preview-tag[data-tone="term"] {
  border-color: rgba(56, 189, 248, .38) !important;
  background: rgba(14, 165, 233, .16) !important;
  color: #7dd3fc !important;
}

body.app-theme-dark.app-page:not(.resource-home) .question-meta .badge[data-tone="course"],
body.app-theme-dark.app-page:not(.resource-home) .preview-tags .preview-tag[data-tone="course"] {
  border-color: rgba(45, 212, 191, .35) !important;
  background: rgba(20, 184, 166, .14) !important;
  color: #5eead4 !important;
}

body.app-theme-dark.app-page:not(.resource-home) .question-meta .badge[data-tone="year"],
body.app-theme-dark.app-page:not(.resource-home) .preview-tags .preview-tag[data-tone="year"] {
  border-color: rgba(129, 140, 248, .38) !important;
  background: rgba(99, 102, 241, .16) !important;
  color: #c4b5fd !important;
}

body.app-theme-dark.app-page:not(.resource-home) .question-meta .badge[data-tone="stage"],
body.app-theme-dark.app-page:not(.resource-home) .preview-tags .preview-tag[data-tone="stage"] {
  border-color: rgba(251, 146, 60, .38) !important;
  background: rgba(249, 115, 22, .15) !important;
  color: #fdba74 !important;
}

body.app-theme-dark.app-page:not(.resource-home) .question-meta .badge[data-tone="type"],
body.app-theme-dark.app-page:not(.resource-home) .preview-tags .preview-tag[data-tone="type"] {
  border-color: rgba(192, 132, 252, .4) !important;
  background: rgba(147, 51, 234, .16) !important;
  color: #d8b4fe !important;
}

body.app-theme-dark.app-page:not(.resource-home) .question-meta .badge[data-tone="difficulty"],
body.app-theme-dark.app-page:not(.resource-home) .preview-tags .preview-tag[data-tone="difficulty"] {
  border-color: rgba(74, 222, 128, .38) !important;
  background: rgba(22, 163, 74, .15) !important;
  color: #86efac !important;
}

body.app-theme-dark.app-page:not(.resource-home) .question-meta .badge[data-tone="source"],
body.app-theme-dark.app-page:not(.resource-home) .preview-tags .preview-tag[data-tone="source"] {
  border-color: rgba(148, 163, 184, .34) !important;
  background: rgba(100, 116, 139, .14) !important;
  color: #cbd5e1 !important;
}

@media (max-width: 720px) {
  body.app-page:not(.resource-home) .question-meta {
    max-width: calc(100% - 5.2rem) !important;
    gap: .32rem !important;
  }

  body.app-page:not(.resource-home) .question-meta .badge {
    max-width: 7.2rem !important;
    min-height: 1.48rem !important;
    padding-inline: .5rem !important;
    font-size: .68rem !important;
  }
}

/* Study mode routing: make practice and exam feel like explicit workflows. */
body.app-page:not(.resource-home) .exam-panel.show {
  display: grid !important;
  gap: .8rem !important;
}

body.app-page:not(.resource-home) .study-route-card,
body.app-page:not(.resource-home) .question-jump-map {
  border: 1px solid rgba(47, 125, 246, .2) !important;
  border-radius: 8px !important;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .68), transparent 52%),
    var(--dash-panel-solid, #ffffff) !important;
  box-shadow: 0 14px 34px rgba(15, 23, 42, .07) !important;
}

body.app-page:not(.resource-home) .study-route-card {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  align-items: center !important;
  gap: 1rem !important;
  padding: 1rem 1.15rem !important;
}

body.app-page:not(.resource-home) .study-route-card strong,
body.app-page:not(.resource-home) .question-jump-head strong {
  display: block !important;
  color: var(--dash-text, #172033) !important;
  font-size: 1rem !important;
  font-weight: 920 !important;
  line-height: 1.25 !important;
}

body.app-page:not(.resource-home) .study-route-card span,
body.app-page:not(.resource-home) .question-jump-head small {
  display: block !important;
  margin-top: .3rem !important;
  color: var(--dash-muted, #64748b) !important;
  font-size: .88rem !important;
  font-weight: 760 !important;
  line-height: 1.55 !important;
}

body.app-page:not(.resource-home) .mode-route-actions {
  display: inline-flex !important;
  flex-wrap: wrap !important;
  justify-content: flex-end !important;
  gap: .55rem !important;
}

body.app-page:not(.resource-home) .question-jump-map {
  display: grid !important;
  gap: .82rem !important;
  margin-bottom: 1rem !important;
  padding: 1rem !important;
}

body.app-page:not(.resource-home) .question-jump-map.is-exam {
  border-color: var(--exam-line, rgba(249, 115, 22, .42)) !important;
  background:
    linear-gradient(135deg, rgba(255, 247, 237, .82), transparent 58%),
    var(--dash-panel-solid, #ffffff) !important;
}

body.app-page:not(.resource-home) .question-jump-head {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: .75rem !important;
}

body.app-page:not(.resource-home) .question-jump-head span {
  display: block !important;
  color: var(--dash-muted, #64748b) !important;
  font-size: .72rem !important;
  font-weight: 920 !important;
  letter-spacing: 0 !important;
  text-transform: uppercase !important;
}

body.app-page:not(.resource-home) .question-jump-actions {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: .5rem !important;
}

body.app-page:not(.resource-home) .question-jump-actions button,
body.app-page:not(.resource-home) .mode-route-actions button {
  min-height: 2.35rem !important;
  border: 1px solid rgba(47, 125, 246, .22) !important;
  border-radius: 8px !important;
  padding: 0 .82rem !important;
  background: var(--dash-field, #ffffff) !important;
  color: var(--dash-blue, #0b63ce) !important;
  font-weight: 880 !important;
}

body.app-page:not(.resource-home) .exam-page-controls {
  display: inline-flex !important;
  align-items: center !important;
  gap: .5rem !important;
  min-height: 2.35rem !important;
  border: 1px solid rgba(249, 115, 22, .34) !important;
  border-radius: 8px !important;
  padding: .25rem .35rem !important;
  background: rgba(255, 247, 237, .72) !important;
}

body.app-page:not(.resource-home) .exam-page-controls span {
  min-width: 6.2rem !important;
  color: var(--exam-accent-strong, #ea580c) !important;
  font-size: .82rem !important;
  font-weight: 900 !important;
  text-align: center !important;
}

body.app-page:not(.resource-home) .exam-page-controls .page-btn {
  min-height: 2rem !important;
  border-color: transparent !important;
  background: rgba(249, 115, 22, .12) !important;
  color: var(--exam-accent-strong, #ea580c) !important;
}

body.app-page:not(.resource-home) .mode-route-actions .primary-action {
  border-color: transparent !important;
  background: linear-gradient(135deg, #0b63ce, #1d4ed8) !important;
  color: #ffffff !important;
}

body.app-page:not(.resource-home) .question-jump-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(2.35rem, 2.35rem)) !important;
  gap: .45rem !important;
  align-items: center !important;
}

body.app-page:not(.resource-home) .question-jump-grid.is-compact {
  grid-template-columns: repeat(auto-fill, minmax(2.2rem, 2.2rem)) !important;
}

body.app-page:not(.resource-home) .question-jump-cell {
  width: 2.35rem !important;
  height: 2.35rem !important;
  border: 1px solid rgba(148, 163, 184, .38) !important;
  border-radius: 8px !important;
  padding: 0 !important;
  background: var(--dash-field, #ffffff) !important;
  color: var(--dash-muted, #64748b) !important;
  font-size: .86rem !important;
  font-weight: 920 !important;
  font-variant-numeric: tabular-nums !important;
  line-height: 1 !important;
}

body.app-page:not(.resource-home) .question-jump-cell.is-answered {
  border-color: rgba(47, 125, 246, .42) !important;
  background: rgba(47, 125, 246, .12) !important;
  color: var(--dash-blue, #0b63ce) !important;
}

body.app-page:not(.resource-home) .question-jump-cell.is-correct {
  border-color: rgba(34, 197, 94, .42) !important;
  background: rgba(34, 197, 94, .13) !important;
  color: #15803d !important;
}

body.app-page:not(.resource-home) .question-jump-cell.is-wrong {
  border-color: rgba(239, 68, 68, .42) !important;
  background: rgba(239, 68, 68, .12) !important;
  color: #b91c1c !important;
}

body.app-page:not(.resource-home) .question-jump-cell.is-current {
  border-color: var(--exam-accent, #f97316) !important;
  background: linear-gradient(135deg, #fb923c, #ea580c) !important;
  color: #ffffff !important;
  box-shadow: 0 10px 20px rgba(249, 115, 22, .2) !important;
}

body.app-page:not(.resource-home) .pagination.is-exam-pager {
  border-color: var(--exam-line, rgba(249, 115, 22, .42)) !important;
}

body.app-page:not(.resource-home) .question-jump-cell:hover,
body.app-page:not(.resource-home) .question-jump-cell:focus-visible,
body.app-page:not(.resource-home) .question-jump-actions button:hover,
body.app-page:not(.resource-home) .question-jump-actions button:focus-visible,
body.app-page:not(.resource-home) .mode-route-actions button:hover,
body.app-page:not(.resource-home) .mode-route-actions button:focus-visible {
  outline: none !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 10px 20px rgba(15, 23, 42, .1) !important;
}

body.app-page:not(.resource-home) .question-jump-legend {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: .55rem .9rem !important;
  color: var(--dash-muted, #64748b) !important;
  font-size: .78rem !important;
  font-weight: 850 !important;
}

body.app-page:not(.resource-home) .question-jump-legend span {
  display: inline-flex !important;
  align-items: center !important;
  gap: .35rem !important;
}

body.app-page:not(.resource-home) .question-jump-legend i {
  width: .72rem !important;
  height: .72rem !important;
  border: 1px solid rgba(148, 163, 184, .38) !important;
  border-radius: 3px !important;
  background: var(--dash-field, #ffffff) !important;
}

body.app-page:not(.resource-home) .question-jump-legend i.is-answered {
  border-color: rgba(47, 125, 246, .42) !important;
  background: rgba(47, 125, 246, .16) !important;
}

body.app-page:not(.resource-home) .question-jump-legend i.is-correct {
  border-color: rgba(34, 197, 94, .42) !important;
  background: rgba(34, 197, 94, .18) !important;
}

body.app-page:not(.resource-home) .question-jump-legend i.is-wrong {
  border-color: rgba(239, 68, 68, .42) !important;
  background: rgba(239, 68, 68, .16) !important;
}

body.app-page:not(.resource-home) .question-card.question-jump-target {
  animation: question-jump-target-pulse 1.1s ease !important;
}

@keyframes question-jump-target-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(47, 125, 246, .3), var(--dash-shadow-soft);
  }
  42% {
    box-shadow: 0 0 0 6px rgba(47, 125, 246, .16), 0 18px 42px rgba(47, 125, 246, .16);
  }
  100% {
    box-shadow: var(--dash-shadow-soft);
  }
}

body.app-theme-dark.app-page:not(.resource-home) .study-route-card,
body.app-theme-dark.app-page:not(.resource-home) .question-jump-map {
  background:
    linear-gradient(135deg, rgba(30, 41, 59, .7), transparent 56%),
    var(--dash-panel-solid) !important;
}

body.app-theme-dark.app-page:not(.resource-home) .question-jump-map.is-exam {
  background:
    linear-gradient(135deg, rgba(249, 115, 22, .14), transparent 58%),
    var(--dash-panel-solid) !important;
}

@media (max-width: 760px) {
  body.app-page:not(.resource-home) .study-route-card {
    grid-template-columns: 1fr !important;
    align-items: stretch !important;
  }

  body.app-page:not(.resource-home) .mode-route-actions,
  body.app-page:not(.resource-home) .question-jump-actions {
    justify-content: stretch !important;
  }

  body.app-page:not(.resource-home) .mode-route-actions button,
  body.app-page:not(.resource-home) .question-jump-actions button {
    flex: 1 1 8rem !important;
  }

  body.app-page:not(.resource-home) .question-jump-head {
    align-items: flex-start !important;
    flex-direction: column !important;
  }

  body.app-page:not(.resource-home) .question-jump-grid,
  body.app-page:not(.resource-home) .question-jump-grid.is-compact {
    grid-template-columns: repeat(auto-fill, minmax(2.15rem, 2.15rem)) !important;
  }

  body.app-page:not(.resource-home) .question-jump-cell {
    width: 2.15rem !important;
    height: 2.15rem !important;
  }
}

body.app-page:not(.resource-home) .question-title-row,
body.app-page:not(.resource-home) .question-title,
body.app-page:not(.resource-home) .analysis-box,
body.app-page:not(.resource-home) .ai-coach-container {
  max-width: 100% !important;
  min-width: 0 !important;
}

body.app-page:not(.resource-home) .question-title-row,
body.app-page:not(.resource-home) .question-title {
  overflow-x: auto !important;
  overflow-y: hidden !important;
}

body.app-page:not(.resource-home) .question-title-row mjx-container,
body.app-page:not(.resource-home) .question-title mjx-container,
body.app-page:not(.resource-home) .analysis-box mjx-container,
body.app-page:not(.resource-home) .ai-coach-container mjx-container {
  max-width: 100% !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
}

body.app-page:not(.resource-home) mjx-assistive-mml,
body.app-page:not(.resource-home) mjx-assistive-mml math {
  width: 1px !important;
  max-width: 1px !important;
  height: 1px !important;
  max-height: 1px !important;
  overflow: hidden !important;
  clip: rect(1px, 1px, 1px, 1px) !important;
}

body.resource-home .qb-source-filter-field input,
body.resource-home .qb-source-filter-field select {
  border-radius: 999px !important;
  border-color: rgba(186, 207, 236, 0.88) !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 250, 255, 0.94)) !important;
  color: var(--source-text) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.88),
    0 7px 16px rgba(35, 91, 160, 0.05) !important;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease !important;
}

body.resource-home .qb-source-filter-field input::placeholder {
  color: rgba(101, 118, 143, 0.72) !important;
}

body.resource-home .qb-source-filter-field select {
  appearance: none !important;
  cursor: pointer !important;
  padding-right: 2.15rem !important;
  background-image:
    linear-gradient(45deg, transparent 50%, #6b7d99 50%),
    linear-gradient(135deg, #6b7d99 50%, transparent 50%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 250, 255, 0.94)) !important;
  background-position:
    calc(100% - 1.08rem) 50%,
    calc(100% - 0.82rem) 50%,
    0 0 !important;
  background-size:
    0.28rem 0.28rem,
    0.28rem 0.28rem,
    100% 100% !important;
  background-repeat: no-repeat !important;
}

body.resource-home .qb-source-filter-field[for="qb-source-stage"] {
  min-width: 7rem !important;
}

body.resource-home #qb-source-stage {
  color: var(--source-blue) !important;
  font-weight: 900 !important;
}

body.resource-home .qb-source-filter-field input:hover,
body.resource-home .qb-source-filter-field select:hover {
  border-color: rgba(88, 143, 224, 0.76) !important;
}

body.resource-home .qb-source-filter-field input:focus,
body.resource-home .qb-source-filter-field select:focus {
  border-color: rgba(47, 113, 230, 0.78) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 0 0 3px rgba(47, 113, 230, 0.13),
    0 10px 22px rgba(35, 91, 160, 0.08) !important;
}

body.resource-home.app-theme-dark .qb-source-filter-field input,
body.resource-home.app-theme-dark .qb-source-filter-field select {
  border-color: rgba(78, 111, 174, 0.64) !important;
  background:
    linear-gradient(180deg, rgba(13, 25, 45, 0.94), rgba(5, 13, 27, 0.9)) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 8px 18px rgba(0, 0, 0, 0.18) !important;
}

body.resource-home.app-theme-dark .qb-source-filter-field select {
  background-image:
    linear-gradient(45deg, transparent 50%, #9db5df 50%),
    linear-gradient(135deg, #9db5df 50%, transparent 50%),
    linear-gradient(180deg, rgba(13, 25, 45, 0.94), rgba(5, 13, 27, 0.9)) !important;
}

body.resource-home #qb-source-filter-form {
  grid-template-columns: minmax(10rem, 1fr) minmax(8rem, .78fr) minmax(9rem, .82fr) minmax(7rem, .66fr) 5.4rem !important;
  gap: .72rem !important;
}

@media (max-width: 760px) {
  body.resource-home #qb-source-filter-form {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  body.resource-home #qb-source-filter-button {
    grid-column: 1 / -1 !important;
  }
}

@media (max-width: 520px) {
  body.resource-home #qb-source-filter-form {
    grid-template-columns: 1fr !important;
  }
}

/* Minimal AI chat mode: keep only the main actions visible. */
body.app-page .ai-chat-panel.ai-chat-shell {
  grid-template-columns: 172px minmax(0, 1fr);
  width: min(1040px, calc(100vw - 2.5rem));
}

body.app-page .ai-chat-rail {
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: .45rem;
  padding: .62rem;
}

body.app-page .ai-chat-rail-head,
body.app-page .ai-chat-session-search,
body.app-page .ai-chat-context,
body.app-page .ai-empty-state {
  display: none !important;
}

body.app-page .ai-chat-new-button {
  min-height: 2.18rem;
  border-radius: .48rem;
}

body.app-page .ai-chat-new-button strong {
  font-size: .82rem;
}

body.app-page .ai-chat-session-list {
  gap: .14rem;
}

body.app-page .ai-chat-session-item {
  min-height: 1.9rem;
  border-radius: .42rem;
  padding: .32rem .42rem;
}

body.app-page .ai-chat-session-item strong {
  font-size: .8rem;
  line-height: 1.1;
  visibility: visible !important;
  opacity: 1 !important;
}

body.app-page .ai-chat-session-item span,
body.app-page .ai-chat-session-item small {
  display: none !important;
}

body.app-page .ai-chat-header {
  min-height: 3.25rem;
  padding: .58rem .78rem;
}

body.app-page .ai-chat-header .ai-chat-kicker {
  display: none;
}

body.app-page .ai-chat-header h2 {
  font-size: 1rem;
}

body.app-page .ai-chat-icon-button {
  min-height: 2rem;
  padding: 0 .52rem;
  font-size: .74rem;
}

body.app-page .ai-chat-status[hidden] {
  display: none !important;
}

body.app-page .ai-chat-messages {
  grid-row: 2 !important;
  padding: .75rem .85rem;
}

body.app-page .ai-chat-main {
  grid-template-rows: auto minmax(0, 1fr) auto;
}

body.app-page .ai-chat-composer {
  grid-row: 3 !important;
}

body.app-page .ai-chat-settings.ai-chat-user-settings {
  grid-row: 2 / 4;
}

@media (max-width: 1180px) {
  body.app-page .ai-chat-panel.ai-chat-shell {
    grid-template-columns: 160px minmax(0, 1fr);
    width: calc(100vw - 2rem);
  }
}

@media (max-width: 720px) {
  body.app-page .ai-chat-panel.ai-chat-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  body.app-page .ai-chat-rail {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-rows: auto;
    align-items: center;
  }

  body.app-page .ai-chat-session-list {
    display: flex;
    min-width: 0;
    overflow-x: auto;
  }

  body.app-page .ai-chat-session-item {
    min-width: 7rem;
  }
}

/* Practice range statistics: align practice navigation with exam-mode tracking. */
body.app-page:not(.resource-home) .study-route-card.is-practice {
  grid-template-columns: minmax(0, 1fr) auto !important;
  align-items: stretch !important;
}

body.app-page:not(.resource-home) .study-route-copy {
  display: grid !important;
  min-width: 0 !important;
  gap: .55rem !important;
}

body.app-page:not(.resource-home) .question-scope-stats {
  display: grid !important;
  grid-template-columns: repeat(7, minmax(4.7rem, 1fr)) !important;
  gap: .45rem !important;
  width: 100% !important;
  min-width: 0 !important;
  margin: .12rem 0 0 !important;
}

body.app-page:not(.resource-home) .question-scope-stats.is-compact {
  grid-template-columns: repeat(auto-fit, minmax(4.45rem, 1fr)) !important;
  margin: 0 !important;
}

body.app-page:not(.resource-home) .question-scope-stats div {
  min-width: 0 !important;
  border: 1px solid rgba(47, 125, 246, .16) !important;
  border-radius: 8px !important;
  padding: .5rem .56rem !important;
  background: rgba(255, 255, 255, .5) !important;
}

body.app-page:not(.resource-home) .question-scope-stats dt {
  color: var(--dash-muted, #64748b) !important;
  font-size: .68rem !important;
  font-weight: 860 !important;
  letter-spacing: 0 !important;
  line-height: 1.15 !important;
  white-space: nowrap !important;
}

body.app-page:not(.resource-home) .question-scope-stats dd {
  margin: .2rem 0 0 !important;
  color: var(--dash-text, #172033) !important;
  font-size: 1rem !important;
  font-weight: 940 !important;
  line-height: 1.1 !important;
  font-variant-numeric: tabular-nums !important;
  white-space: nowrap !important;
}

body.app-page:not(.resource-home) .question-jump-summary {
  min-width: 0 !important;
}

body.app-page:not(.resource-home) .practice-page-controls {
  display: inline-flex !important;
  align-items: center !important;
  gap: .38rem !important;
  min-height: 2.35rem !important;
  border: 1px solid rgba(47, 125, 246, .22) !important;
  border-radius: 8px !important;
  padding: .24rem .32rem !important;
  background: rgba(47, 125, 246, .08) !important;
}

body.app-page:not(.resource-home) .practice-page-controls span {
  min-width: 5.9rem !important;
  color: var(--dash-blue, #0b63ce) !important;
  font-size: .8rem !important;
  font-weight: 900 !important;
  text-align: center !important;
  white-space: nowrap !important;
}

body.app-page:not(.resource-home) .practice-page-controls .page-btn {
  min-height: 1.95rem !important;
  border-color: transparent !important;
  background: rgba(47, 125, 246, .12) !important;
  color: var(--dash-blue, #0b63ce) !important;
}

body.app-page:not(.resource-home) .practice-page-controls .page-btn:disabled {
  opacity: .46 !important;
}

body.app-theme-dark.app-page:not(.resource-home) .question-scope-stats div {
  border-color: rgba(110, 168, 254, .22) !important;
  background: rgba(15, 23, 42, .56) !important;
}

body.app-theme-dark.app-page:not(.resource-home) .question-scope-stats dd {
  color: #eff6ff !important;
}

body.app-theme-dark.app-page:not(.resource-home) .practice-page-controls {
  border-color: rgba(110, 168, 254, .3) !important;
  background: rgba(47, 125, 246, .12) !important;
}

@media (max-width: 980px) {
  body.app-page:not(.resource-home) .study-route-card.is-practice {
    grid-template-columns: 1fr !important;
  }

  body.app-page:not(.resource-home) .question-scope-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }

  body.app-page:not(.resource-home) .practice-page-controls {
    flex: 1 1 100% !important;
    justify-content: center !important;
  }
}

@media (max-width: 560px) {
  body.app-page:not(.resource-home) .question-scope-stats,
  body.app-page:not(.resource-home) .question-scope-stats.is-compact {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

/* Detailed source filters for question bank range selection. */
body.app-page:not(.resource-home) .mode-source-filters {
  display: grid !important;
  grid-template-columns: minmax(8.5rem, .85fr) minmax(7.5rem, .72fr) minmax(7rem, .64fr) minmax(18rem, 1.8fr) !important;
  align-items: end !important;
  gap: .65rem !important;
  width: min(100%, 72rem) !important;
  margin-top: .78rem !important;
}

body.app-page:not(.resource-home) .source-filter-field {
  display: grid !important;
  gap: .32rem !important;
  min-width: 0 !important;
  border: 1px solid rgba(47, 125, 246, .18) !important;
  border-radius: 8px !important;
  padding: .52rem .58rem !important;
  background: var(--dash-field, #ffffff) !important;
  color: var(--dash-text, #172033) !important;
}

body.app-page:not(.resource-home) .source-filter-field span {
  color: var(--dash-muted, #64748b) !important;
  font-size: .72rem !important;
  font-weight: 880 !important;
  line-height: 1.1 !important;
  white-space: nowrap !important;
}

body.app-page:not(.resource-home) .source-filter-field select {
  width: 100% !important;
  min-width: 0 !important;
  min-height: 2.16rem !important;
  border: 1px solid rgba(148, 163, 184, .26) !important;
  border-radius: 8px !important;
  padding: 0 .7rem !important;
  background: var(--dash-panel-solid, #ffffff) !important;
  color: var(--dash-text, #172033) !important;
  font-weight: 840 !important;
}

body.app-page:not(.resource-home) .exam-filter-field.is-wide {
  grid-column: span 2 !important;
}

body.app-theme-dark.app-page:not(.resource-home) .source-filter-field {
  border-color: rgba(110, 168, 254, .22) !important;
  background: rgba(15, 23, 42, .66) !important;
}

body.app-theme-dark.app-page:not(.resource-home) .source-filter-field select {
  border-color: rgba(148, 163, 184, .24) !important;
  background: rgba(8, 16, 30, .86) !important;
  color: #eff6ff !important;
}

@media (max-width: 1180px) {
  body.app-page:not(.resource-home) .mode-source-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  body.app-page:not(.resource-home) .source-filter-field.is-wide {
    grid-column: 1 / -1 !important;
  }
}

@media (max-width: 620px) {
  body.app-page:not(.resource-home) .mode-source-filters {
    grid-template-columns: 1fr !important;
  }

  body.app-page:not(.resource-home) .exam-filter-field.is-wide {
    grid-column: auto !important;
  }
}

/* === Simplified AI question panel ===
   Asking AI about a specific question should only require choosing a model and
   the thinking depth. A default API key is provided server-side, so the key
   field stays (optional) but every other control is hidden, and the layout is
   reordered to: model -> thinking depth -> optional key. */
body.ai-settings-open .ai-chat-settings.ai-chat-user-settings .ai-model-key-card,
body.ai-settings-open .ai-chat-settings.ai-chat-user-settings .ai-chat-keep-key,
body.ai-settings-open .ai-chat-settings.ai-chat-user-settings .app-settings-card,
body.ai-settings-open .ai-chat-settings.ai-chat-user-settings .ai-preference-grid {
  display: none !important;
}

body.ai-settings-open .ai-chat-settings.ai-chat-user-settings .ai-chat-default-model-field {
  order: 1 !important;
  grid-column: 1 / -1 !important;
}

body.ai-settings-open .ai-chat-settings.ai-chat-user-settings .ai-chat-advanced-settings {
  order: 2 !important;
}

body.ai-settings-open .ai-chat-settings.ai-chat-user-settings .ai-chat-key-field {
  order: 3 !important;
}

/* === Declutter: remove the duplicate "library views" block ===
   全部 / 错题本 / 收藏夹 / 同类变形题 / 对抗训练 already live in the always-visible
   sidebar (.sidebar-quick) and the header stat cards. The large duplicate block
   in the main column is hidden to simplify the page. The DOM is intentionally
   kept (not deleted) so the existing count + active-state logic keeps working. */
body.app-page:not(.resource-home) .library-panel {
  display: none !important;
}

/* === Declutter: drop the duplicate settings button + redundant status strip ===
   Settings already lives in the top bar (labelled "设置"); the icon-only sidebar
   duplicate is hidden. The data-status strip repeats the question count shown in
   the header and the resource-library link already present in the top nav, so it
   is hidden too. (DOM kept so any count-writing logic keeps working.) */
body.app-page:not(.resource-home) .sidebar-settings-button {
  display: none !important;
}

body.app-page:not(.resource-home) .data-status-panel {
  display: none !important;
}

/* === Mode card alignment repair ===
   Keep practice/exam cards visually symmetric: title, subtitle, and action
   pill occupy the same rows in both cards regardless of active state. */
body.app-page:not(.resource-home) .mode-button {
  grid-template-columns: 5.2rem minmax(0, 1fr) !important;
  grid-template-rows: 1.55rem 1.5rem 2.25rem !important;
  align-content: center !important;
  align-items: center !important;
}

body.app-page:not(.resource-home) .mode-icon-wrap {
  align-self: center !important;
}

body.app-page:not(.resource-home) .mode-button strong {
  min-height: 1.55rem !important;
  align-self: end !important;
}

body.app-page:not(.resource-home) .mode-button small {
  min-height: 1.5rem !important;
  align-self: start !important;
}

body.app-page:not(.resource-home) .mode-button::after {
  display: none !important;
  content: none !important;
}

body.app-page:not(.resource-home) .mode-action-pill {
  grid-column: 2 !important;
  grid-row: 3 !important;
  justify-self: start !important;
  align-self: start !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-sizing: border-box !important;
  min-width: 6.9rem !important;
  height: 2.25rem !important;
  border-radius: 999px !important;
  padding: 0 1.05rem !important;
  background: linear-gradient(135deg, #2f72f3, #1f67ea) !important;
  color: #ffffff !important;
  font-size: .86rem !important;
  font-weight: 850 !important;
  line-height: 1 !important;
  box-shadow: 0 10px 20px rgba(47, 125, 246, .22) !important;
  white-space: nowrap !important;
}

body.app-page:not(.resource-home) .mode-button:nth-child(2) .mode-action-pill {
  background: linear-gradient(135deg, #26b463, #169452) !important;
  box-shadow: 0 10px 20px rgba(40, 183, 104, .18) !important;
}

/* === Exam result actions ===
   In the finished exam card, retaking the paper is the primary next step while
   returning to practice should read as a quieter escape hatch. */
body.app-page:not(.resource-home).exam-finished .exam-card {
  padding-top: 1.35rem !important;
}

body.app-page:not(.resource-home).exam-finished .exam-card::before {
  top: .75rem !important;
  right: 1.1rem !important;
  opacity: .72 !important;
  pointer-events: none !important;
}

body.app-page:not(.resource-home).exam-finished .exam-actions {
  align-items: center !important;
  gap: .6rem !important;
  padding-top: .6rem !important;
}

body.app-page:not(.resource-home).exam-finished .exam-actions button {
  box-sizing: border-box !important;
  min-width: 7.6rem !important;
  min-height: 2.65rem !important;
  border-radius: 999px !important;
  padding: 0 1.05rem !important;
  font-size: .9rem !important;
  font-weight: 880 !important;
  box-shadow: none !important;
}

body.app-page:not(.resource-home).exam-finished .exam-actions [data-exam-action="reset"] {
  border: 1px solid transparent !important;
  background: linear-gradient(135deg, #fb923c, #ea580c) !important;
  color: #ffffff !important;
  box-shadow: 0 10px 20px rgba(249, 115, 22, .2) !important;
}

body.app-page:not(.resource-home).exam-finished .exam-actions [data-exam-action="practice"] {
  border: 1px solid rgba(249, 115, 22, .28) !important;
  background: rgba(255, 247, 237, .82) !important;
  color: var(--exam-accent-strong, #ea580c) !important;
}

body.app-page:not(.resource-home).exam-finished .exam-actions [data-exam-action="reset"]:hover,
body.app-page:not(.resource-home).exam-finished .exam-actions [data-exam-action="practice"]:hover {
  transform: translateY(-1px) !important;
}

body.app-page:not(.resource-home).exam-mode-active.exam-finished .exam-card .exam-actions button {
  min-width: 7.6rem !important;
  min-height: 2.65rem !important;
  height: 2.65rem !important;
  border-radius: 999px !important;
}

body.app-page:not(.resource-home).exam-mode-active.exam-finished .exam-card .exam-actions [data-exam-action="reset"] {
  border: 1px solid transparent !important;
  background: linear-gradient(135deg, #fb923c, #ea580c) !important;
  color: #ffffff !important;
  box-shadow: 0 10px 20px rgba(249, 115, 22, .2) !important;
}

body.app-page:not(.resource-home).exam-mode-active.exam-finished .exam-card .exam-actions [data-exam-action="practice"] {
  border: 1px solid rgba(249, 115, 22, .28) !important;
  background: rgba(255, 247, 237, .82) !important;
  color: var(--exam-accent-strong, #ea580c) !important;
  box-shadow: none !important;
}

/* Top navigation module colors: distinguish the three entry points without
   turning the utility header into a marketing banner. */
body.app-page .topnav a[href="./question_bank.html"],
body.app-page .topnav a[href="./source_library.html"] {
  border-color: rgba(37, 99, 235, .22) !important;
  background: linear-gradient(180deg, #eff6ff, #dbeafe) !important;
  color: #1d4ed8 !important;
  box-shadow: 0 10px 22px rgba(37, 99, 235, .12) !important;
}

body.app-page .topnav a[href="./index.html"] {
  border-color: rgba(245, 158, 11, .28) !important;
  background: linear-gradient(180deg, #fffbeb, #fef3c7) !important;
  color: #92400e !important;
  box-shadow: 0 10px 22px rgba(180, 83, 9, .12) !important;
}

body.app-page .topnav a[href^="https://byrdocs.org"] {
  border-color: rgba(20, 184, 166, .28) !important;
  background: linear-gradient(180deg, #ecfdf5, #ccfbf1) !important;
  color: #0f766e !important;
  box-shadow: 0 10px 22px rgba(15, 118, 110, .12) !important;
}

body.app-page .topnav a[href="./question_bank.html"]:hover,
body.app-page .topnav a[href="./source_library.html"]:hover,
body.app-page .topnav a[href="./question_bank.html"]:focus-visible,
body.app-page .topnav a[href="./source_library.html"]:focus-visible {
  border-color: rgba(37, 99, 235, .42) !important;
  background: #2563eb !important;
  color: #ffffff !important;
  transform: translateY(-1px);
}

body.app-page .topnav a[href="./index.html"]:hover,
body.app-page .topnav a[href="./index.html"]:focus-visible {
  border-color: rgba(217, 119, 6, .44) !important;
  background: #d97706 !important;
  color: #ffffff !important;
  transform: translateY(-1px);
}

body.app-page .topnav a[href^="https://byrdocs.org"]:hover,
body.app-page .topnav a[href^="https://byrdocs.org"]:focus-visible {
  border-color: rgba(13, 148, 136, .44) !important;
  background: #0d9488 !important;
  color: #ffffff !important;
  transform: translateY(-1px);
}

body.app-theme-dark.app-page .topnav a[href="./question_bank.html"],
body.app-theme-dark.app-page .topnav a[href="./source_library.html"] {
  border-color: rgba(96, 165, 250, .34) !important;
  background: rgba(30, 64, 175, .34) !important;
  color: #bfdbfe !important;
  box-shadow: inset 0 0 0 1px rgba(147, 197, 253, .08), 0 10px 24px rgba(37, 99, 235, .18) !important;
}

body.app-theme-dark.app-page .topnav a[href="./index.html"] {
  border-color: rgba(251, 191, 36, .34) !important;
  background: rgba(146, 64, 14, .34) !important;
  color: #fde68a !important;
  box-shadow: inset 0 0 0 1px rgba(253, 230, 138, .08), 0 10px 24px rgba(180, 83, 9, .16) !important;
}

body.app-theme-dark.app-page .topnav a[href^="https://byrdocs.org"] {
  border-color: rgba(45, 212, 191, .32) !important;
  background: rgba(17, 94, 89, .34) !important;
  color: #99f6e4 !important;
  box-shadow: inset 0 0 0 1px rgba(153, 246, 228, .08), 0 10px 24px rgba(13, 148, 136, .16) !important;
}

/* === AI answer typography polish ===
   Make assistant answers easier to read: tidy spacing, styled code blocks,
   tables, headings and blockquotes. Visual only — pairs with the Markdown that
   formatAiContent / renderAiTextBlock produce. */
.ai-chat-message .ai-chat-bubble > :first-child { margin-top: 0; }
.ai-chat-message .ai-chat-bubble > :last-child { margin-bottom: 0; }

.ai-chat-message .ai-chat-bubble p { margin: .5rem 0; line-height: 1.7; }

.ai-chat-message .ai-chat-bubble ul,
.ai-chat-message .ai-chat-bubble ol { margin: .5rem 0; padding-left: 1.35rem; }
.ai-chat-message .ai-chat-bubble li { margin: .3rem 0; line-height: 1.65; }
.ai-chat-message .ai-chat-bubble li::marker { color: var(--dash-muted, #64748b); }

.ai-chat-message .ai-chat-bubble h1,
.ai-chat-message .ai-chat-bubble h2,
.ai-chat-message .ai-chat-bubble h3,
.ai-chat-message .ai-chat-bubble h4 {
  margin: .9rem 0 .45rem;
  line-height: 1.35;
  font-weight: 840;
}
.ai-chat-message .ai-chat-bubble h1 { font-size: 1.18rem; }
.ai-chat-message .ai-chat-bubble h2 { font-size: 1.1rem; }
.ai-chat-message .ai-chat-bubble h3 { font-size: 1.02rem; }
.ai-chat-message .ai-chat-bubble h4 { font-size: .95rem; }

.ai-chat-message .ai-chat-bubble code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .86em;
  padding: .1rem .34rem;
  border-radius: .35rem;
  background: var(--dash-field, rgba(148, 163, 184, .18));
}
.ai-chat-message .ai-chat-bubble pre {
  margin: .6rem 0;
  padding: .85rem 1rem;
  border-radius: .6rem;
  background: #0f172a;
  color: #e2e8f0;
  overflow-x: auto;
  line-height: 1.6;
}
.ai-chat-message .ai-chat-bubble pre code {
  padding: 0;
  background: transparent;
  color: inherit;
  font-size: .82rem;
}

.ai-chat-message .ai-chat-bubble blockquote {
  margin: .6rem 0;
  padding: .4rem .9rem;
  border-left: 3px solid var(--exam-accent, #6366f1);
  background: rgba(99, 102, 241, .08);
  color: var(--dash-muted, #475569);
  border-radius: .35rem;
}

.ai-chat-message .ai-chat-bubble table {
  width: 100%;
  margin: .6rem 0;
  border-collapse: collapse;
  font-size: .88rem;
}
.ai-chat-message .ai-chat-bubble th,
.ai-chat-message .ai-chat-bubble td {
  border: 1px solid var(--dash-line, #e2e8f0);
  padding: .45rem .65rem;
  text-align: left;
}
.ai-chat-message .ai-chat-bubble th {
  background: var(--dash-field, rgba(148, 163, 184, .16));
  font-weight: 820;
}
.ai-chat-message .ai-chat-bubble table tbody tr:nth-child(even) td {
  background: rgba(148, 163, 184, .08);
}
