:root {
  --bg: #f7f2e7;
  --paper: #fffdf8;
  --paper-soft: #fbf7ee;
  --ink: #24342e;
  --muted: #728079;
  --line: #e9e1d3;
  --line-strong: #dcd3c2;
  --mint: #e2f4e8;
  --mint-soft: #f0faf4;
  --mint-strong: #438e73;
  --mint-deep: #2d6b56;
  --peach: #ffede4;
  --coral: #df8069;
  --coral-deep: #b95f4b;
  --lavender: #eeebfb;
  --lavender-deep: #7767b4;
  --sun: #f6d58a;
  --gold: #b9892f;
  --shadow: 0 18px 50px rgba(53, 72, 62, 0.08);
  --shadow-soft: 0 8px 24px rgba(53, 72, 62, 0.06);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --font: "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  height: 100%;
  background: var(--bg);
}

body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  background:
    radial-gradient(circle at 8% 0%, rgba(226, 244, 232, 0.9), transparent 28rem),
    radial-gradient(circle at 96% 8%, rgba(255, 237, 228, 0.85), transparent 26rem),
    radial-gradient(circle at 50% 100%, rgba(246, 213, 138, 0.14), transparent 36rem),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: radial-gradient(rgba(72, 103, 88, 0.09) 1px, transparent 1px);
  background-size: 22px 22px;
  content: "";
  opacity: 0.38;
  pointer-events: none;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button,
label {
  -webkit-tap-highlight-color: transparent;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  display: block;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

[hidden] {
  display: none !important;
}

::selection {
  color: var(--ink);
  background: var(--sun);
}

:focus-visible {
  outline: 3px solid rgba(67, 142, 115, 0.45);
  outline-offset: 3px;
}

.app-shell {
  display: flex;
  width: min(1520px, calc(100% - 48px));
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  flex-direction: column;
  padding: 14px 0 10px;
  overflow: hidden;
}

/* ---------- 顶部栏 ---------- */
.topbar {
  position: relative;
  z-index: 40;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 13px 16px 13px 20px;
  border: 1px solid rgba(255, 255, 255, 0.86);
  border-radius: 24px;
  background: rgba(255, 253, 248, 0.91);
  box-shadow: 0 12px 35px rgba(53, 72, 62, 0.08);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: max-content;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid rgba(67, 142, 115, 0.16);
  border-radius: 16px;
  color: var(--mint-strong);
  background:
    radial-gradient(circle at 30% 20%, #ffffff 0 16%, transparent 17%),
    linear-gradient(145deg, #eefaf2, #dcefe4);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transform: rotate(-2deg);
}

.brand-mark .icon {
  width: 30px;
  height: 30px;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.12;
}

.brand-copy strong {
  font-size: 25px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.brand-copy small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.22em;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.camera-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 37px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.68);
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #b5b9b5;
  box-shadow: 0 0 0 4px rgba(181, 185, 181, 0.14);
}

.camera-status[data-state="loading"] {
  color: var(--gold);
  border-color: #f2dfb5;
  background: #fffaf0;
}

.camera-status[data-state="loading"] .status-dot {
  background: var(--sun);
  animation: blink 1.2s ease-in-out infinite;
}

.camera-status[data-state="live"] {
  color: var(--mint-deep);
  border-color: #c9e7d6;
  background: var(--mint-soft);
}

.camera-status[data-state="live"] .status-dot {
  background: #53ad86;
  box-shadow: 0 0 0 4px rgba(83, 173, 134, 0.15);
}

.camera-status[data-state="error"] {
  color: var(--coral-deep);
  border-color: #f1cec3;
  background: #fff6f2;
}

.camera-status[data-state="error"] .status-dot {
  background: var(--coral);
  box-shadow: 0 0 0 4px rgba(223, 128, 105, 0.14);
}

.sound-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 37px;
  padding: 0 10px 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.68);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.sound-toggle:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}

.sound-toggle .icon {
  width: 17px;
  height: 17px;
}

.sound-label {
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.switch {
  position: relative;
  display: inline-flex;
  width: 33px;
  height: 19px;
  padding: 2px;
  border-radius: 999px;
  background: #d6d4ca;
  transition: background 180ms ease;
}

.switch > span {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(40, 50, 44, 0.24);
  transition: transform 180ms cubic-bezier(0.2, 0.7, 0.3, 1.3);
}

.sound-toggle[aria-pressed="true"] {
  color: var(--mint-deep);
  border-color: #c9e7d6;
  background: var(--mint-soft);
}

.sound-toggle[aria-pressed="true"] .switch {
  background: var(--mint-strong);
}

.sound-toggle[aria-pressed="true"] .switch > span {
  transform: translateX(14px);
}

.session-counter {
  display: flex;
  align-items: baseline;
  gap: 4px;
  min-height: 37px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.68);
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}

.session-counter strong {
  color: var(--mint-deep);
  font-size: 19px;
  font-weight: 850;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.primary-btn,
.secondary-btn,
.text-btn,
.icon-btn {
  border: 0;
  cursor: pointer;
}

.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 19px;
  border-radius: 14px;
  color: #ffffff;
  background: linear-gradient(135deg, #4b9b7d, #397a62);
  box-shadow: 0 8px 18px rgba(57, 122, 98, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  font-size: 14px;
  font-weight: 750;
  letter-spacing: 0.02em;
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

.primary-btn:hover {
  filter: brightness(1.03);
  transform: translateY(-1px);
  box-shadow: 0 11px 24px rgba(57, 122, 98, 0.26);
}

.primary-btn:active {
  transform: translateY(0);
}

.primary-btn.is-running {
  color: #7c4437;
  background: linear-gradient(135deg, #ffd9cb, #ffc9b8);
  box-shadow: 0 8px 18px rgba(185, 95, 75, 0.13), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.primary-btn:disabled {
  cursor: wait;
  filter: grayscale(0.25);
  opacity: 0.7;
  transform: none;
}

.primary-btn .icon {
  width: 17px;
  height: 17px;
}

/* ---------- 提醒条 ---------- */
.alert-banner {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 12px;
  width: auto;
  margin: 0;
  padding: 13px 14px 13px 15px;
  border: 1px solid #cbe8d8;
  border-radius: 20px;
  background:
    radial-gradient(circle at 100% 0%, rgba(246, 213, 138, 0.28), transparent 14rem),
    rgba(243, 252, 246, 0.97);
  box-shadow: 0 18px 45px rgba(45, 107, 86, 0.17);
  backdrop-filter: blur(14px);
  will-change: transform;
  animation: bannerIn 380ms cubic-bezier(0.2, 0.75, 0.3, 1.1) both;
}

.alert-banner.is-leaving {
  animation: bannerOut 240ms ease both;
}

.alert-spark {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 13px;
  color: var(--mint-deep);
  background: #ffffff;
  box-shadow: 0 4px 12px rgba(45, 107, 86, 0.1);
}

.alert-spark .icon {
  width: 22px;
  height: 22px;
  color: var(--gold);
}

.alert-banner p {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.alert-banner strong {
  color: var(--mint-deep);
  font-size: 14px;
  font-weight: 800;
}

.alert-banner p span {
  color: #4e655b;
  font-size: 13px;
  line-height: 1.5;
}

.icon-btn {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: var(--muted);
  background: transparent;
}

.icon-btn:hover {
  color: var(--ink);
  background: rgba(67, 142, 115, 0.08);
}

.icon-btn .icon {
  width: 17px;
  height: 17px;
}

/* ---------- 主布局 ---------- */
.layout {
  display: grid;
  flex: 1 1 auto;
  grid-template-columns: minmax(0, 7fr) minmax(320px, 3fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 18px;
  min-height: 0;
  margin-top: 14px;
}

.panel {
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: var(--radius-xl);
  background: rgba(255, 253, 248, 0.88);
  box-shadow: var(--shadow);
}

.stage-panel {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  padding: 18px 20px;
  overflow: hidden;
}

.panel-heading,
.events-heading {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  margin-bottom: 4px;
  color: #98a29b;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.22em;
}

.panel-heading h1,
.events-heading h2 {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.24;
  letter-spacing: -0.02em;
}

.stage-tools {
  display: flex;
  align-items: center;
  gap: 13px;
}

.reading-entry {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px 0 9px;
  border: 1px solid #cfe7da;
  border-radius: 999px;
  color: var(--mint-deep);
  background: linear-gradient(135deg, #f4fcf7, #e8f6ee);
  font-size: 11px;
  font-weight: 750;
  cursor: pointer;
  transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
}

.reading-entry .icon {
  width: 15px;
  height: 15px;
}

.reading-entry:hover {
  border-color: #b7dcc8;
  transform: translateY(-1px);
}

.reading-entry[data-active="true"] {
  border-color: #f0cbbb;
  color: #8c4c39;
  background: linear-gradient(135deg, #fff2ea, #ffe4d7);
}

.check-control {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  cursor: pointer;
  user-select: none;
}

.check-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.check-box {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: #aeb7b1;
  background: var(--paper-soft);
  transition: all 160ms ease;
}

.check-box .icon {
  width: 15px;
  height: 15px;
}

.check-control input:checked + .check-box {
  color: var(--mint-deep);
  border-color: #c5e5d4;
  background: var(--mint);
}

.check-control input:focus-visible + .check-box {
  outline: 3px solid rgba(67, 142, 115, 0.4);
  outline-offset: 2px;
}

.soft-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border-radius: 999px;
  color: var(--mint-deep);
  background: var(--mint-soft);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.soft-badge .icon {
  width: 13px;
  height: 13px;
}

/* ---------- 视频舞台 ---------- */
.stage {
  position: relative;
  flex: 0 1 auto;
  /* 宽度必须保持确定值（100%），aspect-ratio 才能算出高度；
     桌面锁一屏模式下由 JS 内联覆盖成按摄像头比例的精确尺寸。 */
  width: 100%;
  max-width: 100%;
  min-height: 0;
  aspect-ratio: var(--camera-ar, 16 / 9);
  margin: 12px auto 0;
  overflow: hidden;
  border: 1px solid rgba(46, 67, 57, 0.12);
  border-radius: 23px;
  background:
    radial-gradient(circle at 20% 10%, rgba(119, 173, 147, 0.24), transparent 34%),
    linear-gradient(145deg, #263931, #17231e);
  isolation: isolate;
}

.stage::after {
  position: absolute;
  inset: 0;
  z-index: 4;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), inset 0 -50px 70px rgba(7, 15, 11, 0.18);
  content: "";
  pointer-events: none;
}

.stage-media {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 1;
  width: 100%;
  height: 100%;
  overflow: hidden;
  transform: translate(-50%, -50%);
}

#cameraVideo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transform: scaleX(-1);
  transition: opacity 300ms ease;
}

#overlayCanvas {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}

.stage.is-live #cameraVideo {
  opacity: 1;
}

.stage.is-live #overlayCanvas {
  opacity: 0.95;
}

.stage.is-live .camera-placeholder {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.camera-placeholder {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  padding: 24px;
  color: var(--ink);
  text-align: center;
  background:
    radial-gradient(circle at 50% 28%, rgba(255, 255, 255, 0.85), transparent 15rem),
    radial-gradient(circle at 15% 90%, rgba(246, 213, 138, 0.22), transparent 16rem),
    linear-gradient(160deg, #eef8f0, #f8f4e9 62%, #fff8ed);
  transition: opacity 260ms ease, visibility 260ms;
}

.camera-placeholder::before,
.camera-placeholder::after {
  position: absolute;
  width: 130px;
  height: 130px;
  border: 1px dashed rgba(67, 142, 115, 0.18);
  border-radius: 50%;
  content: "";
}

.camera-placeholder::before {
  top: -55px;
  left: -35px;
}

.camera-placeholder::after {
  right: -50px;
  bottom: -60px;
  width: 180px;
  height: 180px;
}

.mascot {
  position: relative;
}

.mascot-large {
  width: 96px;
  height: 96px;
  margin-bottom: 15px;
}

.mascot-face {
  position: absolute;
  inset: 11px 3px 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  border: 1px solid rgba(67, 142, 115, 0.22);
  border-radius: 48% 48% 45% 45%;
  background: linear-gradient(150deg, #fbfefb, #e4f4e9);
  box-shadow: inset 0 -8px 15px rgba(67, 142, 115, 0.08), 0 12px 25px rgba(67, 142, 115, 0.12);
  transform: rotate(-1deg);
}

.mascot-face i {
  width: 8px;
  height: 10px;
  border-radius: 50%;
  background: var(--ink);
  transform: translateY(2px);
}

.mascot-face b {
  position: absolute;
  bottom: 24px;
  left: 50%;
  width: 18px;
  height: 9px;
  border-bottom: 3px solid var(--mint-deep);
  border-radius: 0 0 50% 50%;
  transform: translateX(-50%);
}

.mascot-leaf {
  position: absolute;
  z-index: 2;
  width: 38px;
  height: 24px;
  border-radius: 100% 0 100% 0;
  background: linear-gradient(140deg, #90cbaa, #4b9779);
  box-shadow: inset 0 3px 8px rgba(255, 255, 255, 0.24);
}

.leaf-left {
  top: 0;
  left: 18px;
  transform: rotate(16deg);
}

.leaf-right {
  top: 5px;
  right: 10px;
  width: 32px;
  transform: rotate(112deg) scale(0.86);
  background: linear-gradient(140deg, #f3bf95, #dd936b);
}

.camera-placeholder h2 {
  font-size: clamp(20px, 2vw, 27px);
  font-weight: 850;
  letter-spacing: -0.02em;
}

.camera-placeholder p {
  max-width: 460px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.camera-placeholder small {
  margin-top: 12px;
  color: #9aa49e;
  font-size: 10px;
}

.secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  margin-top: 16px;
  padding: 0 16px;
  border: 1px solid #c6e4d4;
  border-radius: 13px;
  color: var(--mint-deep);
  background: rgba(255, 255, 255, 0.8);
  box-shadow: 0 4px 10px rgba(67, 142, 115, 0.08);
  font-size: 12px;
  font-weight: 750;
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.secondary-btn:hover {
  background: #ffffff;
  box-shadow: 0 8px 16px rgba(67, 142, 115, 0.12);
  transform: translateY(-1px);
}

.secondary-btn .icon {
  width: 16px;
  height: 16px;
}

.loading-overlay {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  padding: 24px;
  text-align: center;
  background: rgba(250, 253, 249, 0.93);
  backdrop-filter: blur(6px);
}

.loading-overlay p {
  margin-top: 13px;
  color: var(--mint-deep);
  font-size: 15px;
  font-weight: 800;
}

.loading-overlay small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.loader-sprout {
  position: relative;
  width: 52px;
  height: 52px;
  border: 3px dotted #a8d5bd;
  border-radius: 50%;
  animation: spin 2.4s linear infinite;
}

.loader-sprout span,
.loader-sprout i {
  position: absolute;
  border-radius: 100% 0 100% 0;
  background: var(--mint-strong);
}

.loader-sprout span {
  top: 8px;
  left: 20px;
  width: 20px;
  height: 13px;
  transform: rotate(15deg);
}

.loader-sprout i {
  top: 17px;
  left: 13px;
  width: 15px;
  height: 10px;
  background: #e6a477;
  transform: rotate(120deg);
}

.error-card {
  position: absolute;
  inset: 0;
  z-index: 9;
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  padding: 28px;
  text-align: center;
  background: rgba(255, 251, 247, 0.96);
  backdrop-filter: blur(8px);
}

.error-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 15px;
  color: var(--coral-deep);
  background: var(--peach);
  font-size: 23px;
  font-weight: 850;
}

.error-card h3 {
  margin-top: 10px;
  font-size: 18px;
  font-weight: 850;
}

.error-card p {
  max-width: 490px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.error-card .secondary-btn {
  margin-top: 13px;
}

.stage-hud {
  position: absolute;
  top: 13px;
  right: 13px;
  left: 13px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

.live-pill,
.quality-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 25px;
  padding: 0 9px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.8);
  background: rgba(18, 31, 25, 0.45);
  backdrop-filter: blur(7px);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.live-pill span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #a8b5ad;
}

.live-pill[data-live="true"] {
  color: #d6f6e5;
}

.live-pill[data-live="true"] span {
  background: #78d6a8;
  box-shadow: 0 0 0 3px rgba(120, 214, 168, 0.2);
  animation: blink 1.8s ease-in-out infinite;
}

.quality-pill {
  color: #64766c;
  border-color: rgba(255, 255, 255, 0.45);
  background: rgba(255, 253, 248, 0.82);
  letter-spacing: 0.02em;
}

.detection-toast {
  position: absolute;
  bottom: 14px;
  left: 50%;
  z-index: 7;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 30px);
  padding: 8px 13px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 999px;
  color: #ffffff;
  background: rgba(40, 61, 51, 0.77);
  box-shadow: 0 7px 20px rgba(13, 24, 18, 0.22);
  backdrop-filter: blur(10px);
  font-size: 11px;
  font-weight: 650;
  transform: translateX(-50%);
}

.toast-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--sun);
  animation: blink 1.4s ease-in-out infinite;
}

/* ---------- 专注力估算 ---------- */
.focus-strip {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: minmax(230px, auto) minmax(120px, 1fr) auto;
  align-items: center;
  gap: 13px;
  margin-top: 10px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: linear-gradient(100deg, #fbf8ef, #fffdf8);
  transition: border-color 200ms ease, background 200ms ease;
}

.focus-summary {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.focus-icon {
  display: grid;
  width: 33px;
  height: 33px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 11px;
  color: #7b8d84;
  background: #f0ece1;
  transition: color 200ms ease, background 200ms ease;
}

.focus-icon .icon {
  width: 19px;
  height: 19px;
}

.focus-copy {
  display: flex;
  align-items: baseline;
  gap: 7px;
  white-space: nowrap;
}

.focus-title {
  color: #5e6d65;
  font-size: 10px;
  font-weight: 750;
}

.focus-title em {
  margin-left: 2px;
  color: #9c9484;
  font-size: 8px;
  font-style: normal;
  font-weight: 650;
}

.focus-value {
  display: inline-flex;
  align-items: baseline;
  gap: 1px;
  color: #9ca69f;
  font-variant-numeric: tabular-nums;
}

.focus-value strong {
  font-size: 20px;
  font-weight: 850;
  line-height: 1;
}

.focus-value small {
  font-size: 8px;
  font-weight: 650;
}

.focus-level {
  padding: 2px 7px;
  border-radius: 999px;
  color: #8a958e;
  background: #f0ede5;
  font-size: 9px;
  font-weight: 750;
  white-space: nowrap;
}

.focus-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #ece7db;
}

.focus-track > span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: #b8c3bc;
  transition: width 400ms cubic-bezier(0.2, 0.7, 0.3, 1), background 200ms ease;
}

.focus-note {
  overflow: hidden;
  max-width: 230px;
  color: #a0a8a2;
  font-size: 8.5px;
  line-height: 1.4;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.focus-strip[data-level="focused"] {
  border-color: #cde8da;
  background: linear-gradient(100deg, #f1faf5, #fffdf8);
}

.focus-strip[data-level="focused"] .focus-icon {
  color: var(--mint-deep);
  background: var(--mint);
}

.focus-strip[data-level="focused"] .focus-level {
  color: var(--mint-deep);
  background: var(--mint);
}

.focus-strip[data-level="focused"] .focus-track > span {
  background: linear-gradient(90deg, #87c9a9, #4b9b7d);
}

.focus-strip[data-level="good"] .focus-icon {
  color: var(--mint-deep);
  background: var(--mint-soft);
}

.focus-strip[data-level="good"] .focus-level {
  color: var(--mint-deep);
  background: var(--mint-soft);
}

.focus-strip[data-level="good"] .focus-track > span {
  background: linear-gradient(90deg, #a5d4bc, #68ac8e);
}

.focus-strip[data-level="slight"] {
  border-color: #f1dfb8;
  background: linear-gradient(100deg, #fffaf0, #fffdf8);
}

.focus-strip[data-level="slight"] .focus-icon {
  color: var(--gold);
  background: #fff4d8;
}

.focus-strip[data-level="slight"] .focus-level {
  color: var(--gold);
  background: #fff4d8;
}

.focus-strip[data-level="slight"] .focus-track > span {
  background: linear-gradient(90deg, #f3d28c, #e1b354);
}

.focus-strip[data-level="distracted"] {
  border-color: #f1d0c5;
  background: linear-gradient(100deg, #fff5f0, #fffdf8);
}

.focus-strip[data-level="distracted"] .focus-icon {
  color: var(--coral-deep);
  background: var(--peach);
}

.focus-strip[data-level="distracted"] .focus-level {
  color: var(--coral-deep);
  background: var(--peach);
}

.focus-strip[data-level="distracted"] .focus-track > span {
  background: linear-gradient(90deg, #f1baa5, #df8069);
}

.focus-strip[data-level="away"] {
  border-style: dashed;
  background: #faf7ef;
}

.focus-strip[data-level="away"] .focus-level {
  color: #8f8b80;
  background: #f2eee4;
}

/* ---------- 检测状态条 ---------- */
.detector-strip {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.detector-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  min-height: 55px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--paper-soft);
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}

.chip-icon {
  display: grid;
  width: 33px;
  height: 33px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 11px;
  color: #8a988f;
  background: #efece2;
}

.chip-icon .icon {
  width: 19px;
  height: 19px;
}

.chip-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.chip-copy strong {
  overflow: hidden;
  font-size: 11px;
  font-weight: 750;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip-copy em {
  margin-left: 2px;
  color: #9d927e;
  font-size: 8px;
  font-style: normal;
  font-weight: 650;
}

.chip-copy small {
  overflow: hidden;
  margin-top: 1px;
  color: #9aa49e;
  font-size: 9px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detector-chip[data-state="watching"] {
  border-color: #cfe9db;
  background: var(--mint-soft);
}

.detector-chip[data-state="watching"] .chip-icon {
  color: var(--mint-deep);
  background: var(--mint);
}

.detector-chip[data-state="watching"] .chip-copy small {
  color: var(--mint-strong);
}

.detector-chip[data-state="warning"] {
  border-color: #f2d0c5;
  background: var(--peach);
  transform: translateY(-1px);
}

.detector-chip[data-state="warning"] .chip-icon {
  color: var(--coral-deep);
  background: #ffdcd0;
}

.detector-chip[data-state="warning"] .chip-copy small {
  color: var(--coral-deep);
  font-weight: 700;
}

.detector-chip[data-state="unavailable"] {
  border-style: dashed;
  background: #f7f4ed;
}

.detector-chip[data-state="unavailable"] .chip-copy small {
  color: #9c9588;
}

.stage-footer {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 10px;
  padding: 0 3px;
}

.tip {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 7px;
  color: var(--muted);
  font-size: 10px;
}

.tip > span:first-child {
  flex: 0 0 auto;
  padding: 2px 6px;
  border-radius: 6px;
  color: var(--gold);
  background: #fff5d9;
  font-size: 9px;
  font-weight: 750;
}

.camera-picker {
  display: inline-flex;
  flex: 0 1 auto;
  align-items: center;
  min-width: 0;
  margin-left: auto;
  gap: 5px;
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.camera-picker .icon {
  flex: 0 0 auto;
  width: 13px;
  height: 13px;
}

.camera-picker select {
  min-width: 0;
  max-width: 190px;
  height: 24px;
  padding: 0 7px;
  overflow: hidden;
  border: 1px solid rgba(46, 67, 57, 0.14);
  border-radius: 7px;
  color: #526157;
  background: rgba(255, 255, 255, 0.72);
  font: inherit;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.camera-picker select:disabled {
  color: #9ba49e;
  cursor: default;
}

.camera-picker select:focus-visible {
  outline: 2px solid rgba(83, 173, 134, 0.55);
  outline-offset: 2px;
}

.privacy-note {
  flex: 0 0 auto;
  color: #9ba49e;
  font-size: 9px;
  letter-spacing: 0.02em;
}

.privacy-note b {
  color: var(--mint-strong);
}

/* ---------- 事件记录 ---------- */
.events-panel {
  display: flex;
  min-height: 0;
  flex-direction: column;
  padding: 18px 18px 12px;
  overflow: hidden;
}

.events-heading {
  align-items: flex-start;
}

.count-badge {
  flex: 0 0 auto;
  padding: 4px 9px;
  border-radius: 999px;
  color: #7c897f;
  background: #f2eee4;
  font-size: 10px;
  font-weight: 750;
}

.events-subtitle {
  margin-top: 5px;
  color: #929d96;
  font-size: 10px;
}

.event-list {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  gap: 8px;
  margin: 12px -5px 8px 0;
  padding-right: 5px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: #d9d3c6 transparent;
  scrollbar-width: thin;
}

.event-list:empty {
  display: none;
}

.event-list::-webkit-scrollbar {
  width: 5px;
}

.event-list::-webkit-scrollbar-thumb {
  border-radius: 99px;
  background: #ddd6c9;
}

.event-item {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;
  padding: 11px 11px 11px 10px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fffefa;
  box-shadow: 0 4px 12px rgba(53, 72, 62, 0.035);
  animation: itemIn 330ms cubic-bezier(0.2, 0.75, 0.3, 1.1) both;
}

.event-item[data-type="head_down"] {
  border-left: 3px solid #8bc9aa;
}

.event-item[data-type="desk"] {
  border-left: 3px solid #e5a58e;
}

.event-item[data-type="hands"] {
  border-left: 3px solid #afa1dd;
}

.event-item[data-type="nail_bite"] {
  border-left: 3px solid #e5a2b8;
}

.event-item[data-type="focus_low"] {
  border-left: 3px solid #9ab8bf;
}

.event-item[data-type="kneel"] {
  border-left: 3px solid #e4c16b;
}

.event-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 11px;
  color: var(--mint-deep);
  background: var(--mint-soft);
}

.event-item[data-type="desk"] .event-icon {
  color: var(--coral-deep);
  background: var(--peach);
}

.event-item[data-type="hands"] .event-icon {
  color: var(--lavender-deep);
  background: var(--lavender);
}

.event-item[data-type="nail_bite"] .event-icon {
  color: #a95570;
  background: #ffeaf0;
}

.event-item[data-type="focus_low"] .event-icon {
  color: #4f7880;
  background: #e8f3f4;
}

.event-item[data-type="kneel"] .event-icon {
  color: #997229;
  background: #fff5d8;
}

.event-icon .icon {
  width: 20px;
  height: 20px;
}

.event-body {
  min-width: 0;
}

.event-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.event-type {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 5px;
  font-size: 11px;
  font-weight: 800;
}

.experimental-tag {
  padding: 1px 5px;
  border-radius: 4px;
  color: #8d8062;
  background: #f5efdf;
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.event-time {
  flex: 0 0 auto;
  color: #a1aaa4;
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}

.event-message {
  display: -webkit-box;
  overflow: hidden;
  margin-top: 2px;
  color: #5c6b63;
  font-size: 10.5px;
  line-height: 1.48;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.event-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 4px;
  color: #a2aaa5;
  font-size: 8.5px;
}

.event-meta span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.meta-dot {
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: #c4c9c5;
}

.empty-events {
  display: flex;
  flex: 1;
  align-items: center;
  min-height: 0;
  flex-direction: column;
  justify-content: center;
  padding: 18px 10px;
  overflow: hidden;
  text-align: center;
}

.empty-illustration {
  position: relative;
  width: 104px;
  height: 84px;
  margin-bottom: 12px;
  overflow: hidden;
  border-radius: 48% 48% 22px 22px;
  background: linear-gradient(180deg, #f5fbf6, #edf7f0);
}

.empty-sun {
  position: absolute;
  top: 12px;
  right: 17px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--sun);
  box-shadow: 0 0 0 6px rgba(246, 213, 138, 0.18);
}

.empty-hill {
  position: absolute;
  right: -15px;
  bottom: -28px;
  left: -15px;
  height: 64px;
  border-radius: 50% 50% 0 0;
  background: #d8eddf;
}

.empty-stem {
  position: absolute;
  bottom: 17px;
  left: 51px;
  width: 3px;
  height: 33px;
  border-radius: 99px;
  background: var(--mint-strong);
  transform: rotate(-3deg);
}

.empty-leaf {
  position: absolute;
  top: 26px;
  left: 41px;
  width: 27px;
  height: 16px;
  border-radius: 100% 0 100% 0;
  background: #8dc6a6;
  transform: rotate(12deg);
}

.empty-events h3 {
  font-size: 14px;
  font-weight: 800;
}

.empty-events p {
  margin-top: 2px;
  color: #97a19b;
  font-size: 10px;
}

.events-footer {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: #a0a8a3;
  font-size: 9px;
}

.text-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 2px;
  border-radius: 6px;
  color: var(--mint-strong);
  background: transparent;
  font-size: 9px;
  font-weight: 750;
}

.text-btn:hover {
  color: var(--mint-deep);
  background: var(--mint-soft);
}

.text-btn .icon {
  width: 12px;
  height: 12px;
}

/* ---------- 页脚与 toast ---------- */
.site-footer {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  padding: 10px 8px 0;
  color: #a2aaa4;
  font-size: 9px;
  letter-spacing: 0.01em;
}

.footer-dot {
  color: #c7cbc7;
}

.footer-spacer {
  flex: 1;
}

#serverState {
  color: #929c96;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 22px;
  z-index: 80;
  max-width: min(380px, calc(100% - 32px));
  padding: 10px 14px;
  border: 1px solid #e7dfd1;
  border-radius: 13px;
  color: #526159;
  background: rgba(255, 253, 248, 0.97);
  box-shadow: 0 12px 30px rgba(53, 72, 62, 0.16);
  font-size: 11px;
  line-height: 1.45;
  animation: toastIn 250ms ease both;
}

@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}

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

@keyframes bannerIn {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes bannerOut {
  to {
    opacity: 0;
    transform: translateY(-7px) scale(0.985);
  }
}

@keyframes itemIn {
  from {
    opacity: 0;
    transform: translateY(-7px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- 阅读小助手 ---------- */
.reading-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
}

.reading-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(29, 47, 40, 0.38);
  backdrop-filter: blur(4px);
  animation: readingFade 200ms ease both;
}

.reading-dialog {
  position: relative;
  width: min(620px, 100%);
  max-height: min(86vh, 760px);
  padding: 22px 24px 20px;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 26px;
  background: var(--paper);
  box-shadow: 0 30px 80px rgba(29, 47, 40, 0.28);
  outline: none;
  scrollbar-width: thin;
  animation: readingIn 240ms cubic-bezier(0.2, 0.75, 0.3, 1.1) both;
}

.reading-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.reading-head h2 {
  font-size: 23px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.reading-head .eyebrow {
  margin-bottom: 3px;
}

.reading-lead {
  margin-top: 12px;
  color: #5b6a62;
  font-size: 13px;
  line-height: 1.7;
}

.reading-label {
  display: block;
  margin-top: 16px;
  color: #44554c;
  font-size: 12px;
  font-weight: 750;
}

.reading-textarea {
  width: 100%;
  min-height: 148px;
  margin-top: 7px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--ink);
  background: var(--paper-soft);
  font: inherit;
  font-size: 13px;
  line-height: 1.75;
  resize: vertical;
}

.reading-textarea:focus-visible {
  border-color: #9fcdb7;
  outline: 3px solid rgba(67, 142, 115, 0.18);
  outline-offset: 1px;
}

.reading-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  color: #9aa39d;
  font-size: 10px;
}

.reading-meta-actions {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

.reading-optional {
  margin-top: 16px;
  padding-top: 13px;
  border-top: 1px dashed #e3dacb;
}

.reading-text-field {
  margin-top: 10px;
}

.reading-text-field .reading-label {
  margin-top: 0;
}

.reading-text-field .reading-textarea {
  min-height: 108px;
}

.reading-stats em {
  font-style: normal;
}

.reading-transcript {
  margin-top: 12px;
  color: #7b8a82;
  font-size: 10.5px;
}

.reading-transcript summary {
  color: var(--mint-deep);
  font-weight: 700;
  cursor: pointer;
}

.reading-transcript p {
  max-height: 140px;
  margin-top: 7px;
  padding: 10px 12px;
  overflow-y: auto;
  border-radius: 12px;
  color: #5f6f67;
  background: var(--paper-soft);
  font-size: 11px;
  line-height: 1.75;
  white-space: pre-wrap;
}

.reading-note {
  margin-top: 10px;
  padding: 9px 12px;
  border-radius: 12px;
  color: #8a8f88;
  background: #f6f2e8;
  font-size: 10px;
  line-height: 1.65;
}

.reading-note[data-tone="warning"] {
  color: #a15a45;
  background: #fff0e8;
}

.reading-error {
  margin-top: 10px;
  padding: 9px 12px;
  border-radius: 12px;
  color: #a8482f;
  background: #fff0e8;
  font-size: 11px;
  line-height: 1.6;
}

.reading-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.reading-live-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 16px;
  color: var(--mint-deep);
  background: var(--mint-soft);
}

.reading-live-head strong {
  flex: 1;
  font-size: 13px;
  font-weight: 750;
}

.reading-timer {
  color: #6b7d73;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.reading-live-text {
  min-height: 118px;
  max-height: 210px;
  margin-top: 12px;
  padding: 14px;
  overflow-y: auto;
  border: 1px dashed #ddd4c4;
  border-radius: 16px;
  color: #3c4f46;
  background: #fffdf8;
  font-size: 14px;
  line-height: 1.85;
}

.reading-live-text[data-empty="true"] {
  color: #b0b7b2;
  font-size: 12px;
}

.reading-live-stats {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 9px;
  color: #98a29b;
  font-size: 10px;
}

.reading-pulse {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #4b9b7d;
  animation: readingPulse 1.6s ease-out infinite;
}

.reading-score {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin-top: 18px;
}

.reading-score strong {
  color: var(--mint-deep);
  font-size: 44px;
  font-weight: 850;
  line-height: 1;
  letter-spacing: -0.03em;
}

.reading-score small {
  color: #8b978f;
  font-size: 11px;
  font-weight: 700;
}

.reading-verdict {
  margin-top: 6px;
  color: #4a5c53;
  font-size: 13px;
  line-height: 1.6;
}

.reading-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.reading-stats span {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px 11px;
  border-radius: 13px;
  color: #8d9891;
  background: var(--paper-soft);
  font-size: 9.5px;
}

.reading-stats b {
  color: #37483f;
  font-size: 16px;
  font-weight: 800;
}

.reading-detail {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 14px;
}

.reading-block h3 {
  color: #8a6a4f;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.reading-issue {
  margin-top: 7px;
  padding: 9px 12px;
  border-left: 3px solid #f0d7c6;
  border-radius: 0 12px 12px 0;
  background: #fff8f2;
}

.reading-issue-meta {
  color: #a2948a;
  font-size: 9.5px;
}

.reading-issue-body {
  margin-top: 2px;
  color: #5f4a3e;
  font-size: 12px;
}

.reading-success {
  padding: 12px 14px;
  border-radius: 14px;
  color: var(--mint-deep);
  background: var(--mint-soft);
  font-size: 12px;
}

.reading-footnote {
  margin-top: 8px;
  color: #9aa39d;
  font-size: 10px;
}

.reading-posture {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 13px;
  color: #8a7a5e;
  background: #fbf6ea;
  font-size: 10.5px;
  line-height: 1.65;
}

.reading-bar {
  position: fixed;
  bottom: 22px;
  left: 24px;
  z-index: 78;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100% - 32px);
  padding: 8px 10px 8px 8px;
  border: 1px solid #cbe8d8;
  border-radius: 18px;
  background: rgba(255, 253, 248, 0.97);
  box-shadow: 0 16px 40px rgba(45, 107, 86, 0.18);
  backdrop-filter: blur(12px);
  animation: toastIn 220ms ease both;
}

.reading-bar-main {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 3px 6px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.reading-bar-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.reading-bar-copy strong {
  color: var(--mint-deep);
  font-size: 11.5px;
  font-weight: 800;
}

.reading-bar-copy small {
  color: #8b9891;
  font-size: 9.5px;
}

.reading-bar-count {
  padding: 4px 9px;
  border-radius: 999px;
  color: var(--mint-deep);
  background: var(--mint);
  font-size: 10px;
  font-weight: 750;
  white-space: nowrap;
}

.reading-bar-stop {
  padding: 7px 12px;
  border: 0;
  border-radius: 11px;
  color: #9c533e;
  background: #ffe3d6;
  font-size: 10.5px;
  font-weight: 750;
  white-space: nowrap;
  cursor: pointer;
}

.reading-bar-stop:hover {
  filter: brightness(0.97);
}

@keyframes readingIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes readingFade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes readingPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(75, 155, 125, 0.45);
  }
  70% {
    box-shadow: 0 0 0 9px rgba(75, 155, 125, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(75, 155, 125, 0);
  }
}

/* ---------- 响应式 ---------- */
@media (max-width: 1250px) {
  .topbar {
    align-items: flex-start;
  }

  .topbar-actions {
    gap: 8px;
  }

  .camera-status {
    order: 5;
    flex: 1 0 100%;
    justify-content: center;
  }
}

/*
 * 宽屏且高度足够时，页面锁在一屏内：只有「小提醒记录」列表自己滚动。
 * 窗口窄到放不下双栏、或高度过小时退回正常文档流并允许页面滚动，
 * 否则内容会被裁掉。
 */
@media (max-width: 1020px), (max-height: 540px) {
  html {
    height: auto;
  }

  body {
    height: auto;
    overflow: auto;
  }

  .app-shell {
    display: block;
    height: auto;
    padding: 14px 0 18px;
    overflow: visible;
  }

  .layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
    flex: none;
  }

  .stage-panel {
    overflow: visible;
  }

  .stage {
    flex: none;
  }

  .events-panel {
    max-height: 520px;
  }
}

@media (max-width: 1020px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .events-panel {
    position: static;
    min-height: 390px;
    max-height: 520px;
  }

  .event-list {
    min-height: 180px;
  }

  .detector-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .focus-strip {
    grid-template-columns: auto minmax(120px, 1fr);
  }

  .focus-note {
    grid-column: 1 / -1;
    max-width: none;
    text-align: left;
  }
}

@media (min-width: 1021px) and (max-height: 620px) {
  .layout {
    grid-template-columns: minmax(0, 7fr) minmax(320px, 3fr);
  }
}

/* 高度偏紧时压缩固定区域，把更多高度留给画面 */
@media (min-width: 1021px) and (max-height: 780px) {
  .stage-panel {
    padding: 15px 17px;
  }

  .stage {
    margin-top: 10px;
  }

  .focus-strip {
    gap: 10px;
    margin-top: 8px;
    padding: 6px 10px;
  }

  .focus-icon {
    width: 29px;
    height: 29px;
  }

  .detector-strip {
    margin-top: 8px;
  }

  .detector-chip {
    min-height: 49px;
    padding: 6px 9px;
  }

  .chip-icon {
    width: 30px;
    height: 30px;
  }

  .stage-footer {
    margin-top: 8px;
  }

  .site-footer {
    padding-top: 6px;
  }

  .events-panel {
    padding: 15px 16px 10px;
  }

  .empty-illustration {
    width: 88px;
    height: 70px;
    margin-bottom: 8px;
  }

  .camera-placeholder .mascot-large {
    width: 68px;
    height: 68px;
    margin-bottom: 8px;
  }

  .camera-placeholder h2 {
    font-size: 20px;
  }

  .camera-placeholder p {
    margin-top: 3px;
    font-size: 12px;
  }

  .camera-placeholder small {
    display: none;
  }

  .camera-placeholder .secondary-btn {
    min-height: 36px;
    margin-top: 10px;
  }
}

/* 矮窗口：再收掉装饰性文字，保证画面和检测状态都还在 */
@media (min-width: 1021px) and (max-height: 640px) {
  .eyebrow {
    display: none;
  }

  .panel-heading h1,
  .events-heading h2 {
    font-size: 19px;
  }

  .camera-placeholder p {
    display: none;
  }

  .camera-placeholder .mascot-large {
    width: 56px;
    height: 56px;
    margin-bottom: 6px;
  }

  .camera-placeholder h2 {
    font-size: 18px;
  }

  .stage-footer .tip {
    display: none;
  }

  .stage-footer {
    justify-content: flex-end;
  }
}

@media (max-width: 760px) {
  .reading-modal {
    padding: 12px;
  }

  .reading-dialog {
    max-height: 90vh;
    padding: 18px 16px 16px;
  }

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

  .reading-bar {
    bottom: 16px;
    left: 16px;
  }

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

  .focus-strip {
    grid-template-columns: minmax(0, 1fr);
    gap: 7px;
  }

  .focus-note {
    display: none;
  }

  .app-shell {
    width: min(100% - 24px, 700px);
    padding-top: 10px;
  }

  .topbar {
    position: static;
    flex-wrap: wrap;
    gap: 12px;
    padding: 13px;
    border-radius: 20px;
  }

  .brand-copy strong {
    font-size: 22px;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
  }

  .topbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .camera-status {
    flex: 1 1 auto;
  }

  .sound-toggle,
  .session-counter {
    min-height: 35px;
  }

  .session-counter span:first-child {
    display: none;
  }

  .primary-btn {
    flex: 1 1 100%;
    min-height: 45px;
  }

  .alert-banner {
    border-radius: 16px;
  }

  .layout {
    margin-top: 12px;
  }

  .stage-panel,
  .events-panel {
    padding: 15px;
    border-radius: 23px;
  }

  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .stage-tools {
    width: 100%;
    justify-content: space-between;
  }

  .soft-badge {
    margin-left: auto;
  }

  .stage {
    margin-top: 11px;
    border-radius: 18px;
  }

  .camera-placeholder {
    padding: 18px;
  }

  .camera-placeholder p {
    font-size: 11px;
  }

  .mascot-large {
    width: 72px;
    height: 72px;
    margin-bottom: 10px;
  }

  .mascot-face {
    gap: 12px;
  }

  .mascot-face b {
    bottom: 16px;
  }

  .camera-placeholder small {
    display: none;
  }

  .stage-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .events-panel {
    max-height: none;
  }

  .event-list {
    max-height: 420px;
  }

  .site-footer {
    flex-wrap: wrap;
    padding: 12px 4px 0;
  }

  .footer-spacer {
    display: none;
  }
}

@media (max-width: 480px) {
  .app-shell {
    width: calc(100% - 16px);
  }

  /* 小屏工具栏放不下三件套：隐私说明在页脚仍有，这里先收起徽章。 */
  .soft-badge {
    display: none;
  }

  .reading-entry {
    height: 28px;
    padding: 0 10px 0 8px;
  }

  /* 小屏下舞台较矮，收起说明文字并缩小吉祥物，避免被裁切。 */
  .camera-placeholder {
    padding: 12px;
  }

  .camera-placeholder p {
    display: none;
  }

  .camera-placeholder h2 {
    font-size: 18px;
  }

  .mascot-large {
    width: 56px;
    height: 56px;
    margin-bottom: 6px;
  }

  .mascot-face {
    inset: 8px 2px 2px;
    gap: 10px;
  }

  .mascot-face i {
    width: 6px;
    height: 8px;
  }

  .mascot-face b {
    bottom: 11px;
    width: 14px;
    height: 7px;
    border-bottom-width: 2px;
  }

  .mascot-leaf {
    width: 27px;
    height: 17px;
  }

  .leaf-left {
    left: 10px;
  }

  .leaf-right {
    top: 3px;
    right: 4px;
    width: 23px;
  }

  .camera-placeholder .secondary-btn {
    min-height: 34px;
    margin-top: 8px;
    padding: 0 13px;
    font-size: 11px;
  }

  .brand-copy small {
    letter-spacing: 0.12em;
  }

  .sound-label {
    display: none;
  }

  .sound-toggle {
    padding: 0 8px;
  }

  .camera-status {
    font-size: 10.5px;
  }

  .session-counter {
    padding: 0 10px;
  }

  .panel-heading h1,
  .events-heading h2 {
    font-size: 20px;
  }

  .detector-chip {
    min-height: 49px;
    padding: 6px 8px;
  }

  .chip-icon {
    width: 28px;
    height: 28px;
  }

  .chip-copy strong {
    font-size: 10px;
  }

  .chip-copy small {
    font-size: 8px;
  }

  .alert-banner {
    align-items: flex-start;
  }

  .alert-spark {
    width: 32px;
    height: 32px;
  }
}

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