:root {
  color-scheme: light;
  --page-bg: linear-gradient(160deg, #fff8ef 0%, #eef4ff 100%);
  --page-overlay: radial-gradient(circle at top right, rgba(255, 145, 0, 0.24), transparent 34%),
    radial-gradient(circle at bottom left, rgba(31, 107, 255, 0.16), transparent 28%);
  --panel-bg: rgba(255, 255, 255, 0.86);
  --panel-border: rgba(11, 36, 71, 0.08);
  --panel-shadow: 0 24px 60px rgba(20, 37, 63, 0.12);
  --text-main: #15233b;
  --text-soft: #55657f;
  --brand: #ea580c;
  --brand-deep: #c2410c;
  --accent: #2563eb;
  --success: #0f9f6e;
  --danger: #d9485f;
  --chip-bg: rgba(37, 99, 235, 0.08);
  --chip-border: rgba(37, 99, 235, 0.18);
  --input-bg: rgba(255, 255, 255, 0.94);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --font-ui: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-ui);
  color: var(--text-main);
}

body {
  background: var(--page-overlay), var(--page-bg);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.office-shell {
  width: min(1360px, calc(100% - 24px));
  padding: 18px 0 24px;
}

.landing-shell {
  padding-top: 56px;
}

.hero-panel,
.panel {
  backdrop-filter: blur(16px);
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--panel-shadow);
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.8fr);
  gap: 28px;
  padding: 30px;
  margin-bottom: 22px;
}

.hero-panel-wide {
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
}

.office-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 24px;
  margin-bottom: 16px;
}

.classroom-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 24px;
  margin-bottom: 16px;
}

.office-brand {
  display: flex;
  align-items: baseline;
  gap: 16px;
  min-width: 0;
}

.classroom-brand {
  display: flex;
  align-items: baseline;
  gap: 16px;
  min-width: 0;
}

.office-brand h1 {
  font-size: clamp(1.8rem, 3vw, 3rem);
  white-space: nowrap;
}

.classroom-brand h1 {
  font-size: clamp(1.8rem, 3vw, 3rem);
  white-space: nowrap;
}

.office-brand p {
  color: var(--text-soft);
  line-height: 1.5;
}

.classroom-brand p {
  color: var(--text-soft);
  line-height: 1.5;
}

.office-status-strip {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.identity-chip {
  display: grid;
  gap: 4px;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(84, 108, 146, 0.14);
}

.identity-chip span {
  font-size: 0.85rem;
  color: var(--text-soft);
}

.identity-chip strong {
  font-size: 1.05rem;
}

.classroom-status-strip {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(37, 99, 235, 0.12);
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.9), rgba(244, 248, 255, 0.8));
}

.status-pill strong {
  font-size: 1.15rem;
}

.status-pill.good strong {
  color: var(--success);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 12px;
  background: rgba(234, 88, 12, 0.1);
  color: var(--brand-deep);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  margin-top: 0;
  font-size: clamp(2.1rem, 4vw, 3.6rem);
  line-height: 1.05;
}

h2 {
  font-size: 1.2rem;
}

.hero-copy {
  margin-top: 12px;
  max-width: 42ch;
  line-height: 1.65;
  color: var(--text-soft);
}

.hero-metrics {
  display: grid;
  gap: 16px;
}

.metric-card {
  display: grid;
  gap: 8px;
  padding: 18px 20px;
  border-radius: var(--radius-lg);
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.9), rgba(244, 248, 255, 0.8));
  border: 1px solid rgba(37, 99, 235, 0.12);
}

.metric-card strong {
  font-size: 1.4rem;
}

.metric-card.good strong {
  color: var(--success);
}

.content-grid {
  display: grid;
  gap: 22px;
  grid-template-columns: minmax(0, 1.3fr) minmax(300px, 0.8fr);
  margin-bottom: 22px;
}

.auth-shell {
  width: min(820px, calc(100% - 24px));
  padding-top: 48px;
}

.auth-card {
  padding: 32px;
}

.auth-card-wide {
  width: min(920px, 100%);
}

.auth-form {
  margin-top: 8px;
}

.office-content-grid {
  grid-template-columns: minmax(0, 1.45fr) minmax(340px, 0.85fr);
  margin-bottom: 0;
  align-items: start;
}

.classroom-grid {
  grid-template-columns: minmax(260px, 0.58fr) minmax(0, 1.42fr);
  align-items: start;
}

.classroom-bottom-grid {
  grid-template-columns: minmax(260px, 0.7fr) minmax(0, 1.3fr);
}

.panel {
  padding: 24px;
}

.office-body .panel {
  padding: 20px;
}

.office-body textarea {
  min-height: 160px;
}

.classroom-controls {
  display: grid;
  align-content: start;
}

.audio-switch-card {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(84, 108, 146, 0.16);
  background: rgba(255, 255, 255, 0.78);
  margin-bottom: 16px;
}

.audio-switch-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.audio-switch-label {
  font-weight: 700;
}

.audio-switch-hint {
  color: var(--text-soft);
  line-height: 1.5;
}

.audio-switch-card[data-state='on'] {
  border-color: rgba(15, 159, 110, 0.28);
  background: rgba(15, 159, 110, 0.08);
}

.audio-switch-card[data-state='on'] #audio-toggle-state {
  color: var(--success);
}

.audio-switch-card[data-state='off'] {
  border-color: rgba(217, 72, 95, 0.2);
  background: rgba(217, 72, 95, 0.08);
}

.audio-switch-card[data-state='off'] #audio-toggle-state {
  color: #8d1f33;
}

.audio-switch-card[data-state='pending'] {
  border-color: rgba(37, 99, 235, 0.16);
  background: rgba(37, 99, 235, 0.06);
}

.audio-switch-card[data-state='pending'] #audio-toggle-state {
  color: #20417d;
}

.panel-heading {
  display: grid;
  gap: 6px;
  margin-bottom: 18px;
}

.compact-heading {
  margin-bottom: 12px;
}

.panel-heading p {
  line-height: 1.6;
  color: var(--text-soft);
}

.stack-form {
  display: grid;
  gap: 18px;
}

.compact-form {
  gap: 14px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.field {
  display: grid;
  gap: 10px;
}

.field label {
  font-weight: 700;
}

.field small {
  color: var(--text-soft);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(84, 108, 146, 0.18);
  background: var(--input-bg);
  color: var(--text-main);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

textarea {
  resize: vertical;
  min-height: 130px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(37, 99, 235, 0.42);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.field-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-soft);
}

.compact-button-row {
  gap: 10px;
}

.chip-row,
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.chip-button,
.ghost-button,
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 12px 18px;
  border: 1px solid transparent;
  transition: transform 0.18s ease, background 0.18s ease;
}

.chip-button:hover,
.ghost-button:hover,
.primary-button:hover {
  transform: translateY(-1px);
}

.chip-button {
  background: var(--chip-bg);
  border-color: var(--chip-border);
  color: var(--accent);
}

.primary-button {
  background: linear-gradient(135deg, var(--brand) 0%, #ef7a29 100%);
  color: #fff;
  box-shadow: 0 12px 24px rgba(234, 88, 12, 0.24);
}

.ghost-button {
  background: rgba(255, 255, 255, 0.78);
  border-color: rgba(84, 108, 146, 0.14);
  color: var(--text-main);
}

.button-link {
  text-decoration: none;
}

.preview-card {
  display: grid;
  gap: 10px;
  padding: 18px 20px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(255, 245, 235, 0.92), rgba(238, 244, 255, 0.84));
  border: 1px solid rgba(234, 88, 12, 0.14);
}

.preview-card strong {
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.5;
}

.binding-card,
.binding-summary-card {
  display: grid;
  gap: 14px;
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(84, 108, 146, 0.12);
  background: rgba(255, 255, 255, 0.78);
}

.binding-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.binding-code-box {
  display: grid;
  gap: 6px;
  padding: 18px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(255, 245, 235, 0.92), rgba(238, 244, 255, 0.84));
  border: 1px dashed rgba(234, 88, 12, 0.28);
}

.binding-code-box strong {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  letter-spacing: 0.18em;
}

.office-sidebar-panel {
  display: grid;
  align-content: start;
  gap: 0;
}

.office-sidebar-section {
  display: grid;
  gap: 0;
}

.office-scroll-area {
  max-height: min(260px, 28vh);
  overflow: auto;
  padding-right: 4px;
}

.office-history-area {
  max-height: min(240px, 26vh);
}

.preview-label {
  color: var(--text-soft);
  font-size: 0.95rem;
}

.feedback {
  border-radius: var(--radius-md);
  padding: 14px 16px;
  line-height: 1.6;
}

.feedback.hidden,
.hidden {
  display: none;
}

.feedback.info {
  background: rgba(37, 99, 235, 0.08);
  color: #20417d;
}

.feedback.success {
  background: rgba(15, 159, 110, 0.1);
  color: #166449;
}

.feedback.error {
  background: rgba(217, 72, 95, 0.12);
  color: #8d1f33;
}

.status-list,
.history-list {
  display: grid;
  gap: 14px;
}

.compact-list {
  gap: 10px;
}

.panel-divider {
  height: 1px;
  margin: 22px 0;
  background: linear-gradient(90deg, rgba(84, 108, 146, 0.08), rgba(84, 108, 146, 0.22), rgba(84, 108, 146, 0.08));
}

.compact-divider {
  margin: 14px 0;
}

.status-item,
.history-item {
  width: 100%;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(84, 108, 146, 0.12);
  background: rgba(255, 255, 255, 0.78);
  padding: 16px 18px;
}

.office-sidebar-panel .status-item,
.office-sidebar-panel .history-item {
  padding: 14px 16px;
}

.status-item {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  text-align: left;
}

.status-item > div:first-child {
  flex: 1;
  min-width: 0;
}

.history-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.history-item-header strong {
  flex: 1;
  line-height: 1.45;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.status-item.active {
  border-color: rgba(234, 88, 12, 0.34);
}

.history-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
  color: var(--text-soft);
  line-height: 1.6;
}

.status-item small {
  display: -webkit-box;
  margin-top: 10px;
  overflow: hidden;
  color: var(--text-soft);
  line-height: 1.6;
  overflow-wrap: anywhere;
  word-break: break-word;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.history-status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.9rem;
  font-weight: 700;
  white-space: nowrap;
}

.history-status.info {
  background: rgba(37, 99, 235, 0.1);
  color: #20417d;
}

.history-status.success {
  background: rgba(15, 159, 110, 0.12);
  color: #166449;
}

.history-status.error {
  background: rgba(217, 72, 95, 0.12);
  color: #8d1f33;
}

.history-status-text.success {
  color: #166449;
}

.history-status-text.error {
  color: #8d1f33;
}

.status-item-meta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1.05rem;
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
}

.status-dot.online {
  background: var(--success);
  box-shadow: 0 0 0 5px rgba(15, 159, 110, 0.12);
}

.status-dot.offline {
  background: #c7d0e0;
}

.announcement-stage {
  position: relative;
  overflow: hidden;
  min-height: 540px;
  display: grid;
  align-content: space-between;
  background:
    radial-gradient(circle at top right, rgba(255, 196, 94, 0.18), transparent 30%),
    linear-gradient(160deg, rgba(255, 255, 255, 0.9), rgba(245, 249, 255, 0.82));
}

.stage-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.stage-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 8px 14px;
  background: rgba(234, 88, 12, 0.1);
  color: var(--brand-deep);
  font-weight: 700;
}

.stage-classroom-name {
  color: var(--text-soft);
  font-weight: 700;
}

.stage-message-wrap {
  display: grid;
  place-items: center;
  padding: 22px 0;
}

.stage-message {
  max-width: 10ch;
  text-align: center;
  font-size: clamp(2.8rem, 8vw, 6.8rem);
  line-height: 1.1;
  letter-spacing: 0.01em;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.stage-message--long {
  max-width: 14ch;
  font-size: clamp(2.2rem, 6vw, 4.8rem);
  line-height: 1.2;
}

.stage-message--dense {
  max-width: 20ch;
  font-size: clamp(1.6rem, 4vw, 3rem);
  line-height: 1.3;
}

.stage-message--compact {
  max-width: 24ch;
  font-size: clamp(1.25rem, 3vw, 2.3rem);
  line-height: 1.45;
  max-height: 56vh;
  overflow: auto;
  padding-right: 8px;
}

.stage-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
  color: var(--text-soft);
  font-size: 1rem;
}

.announcement-stage.live {
  animation: glowPulse 2.8s ease;
}

.overlay-open {
  overflow: hidden;
}

.alert-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: clamp(18px, 4vw, 48px);
  background:
    radial-gradient(circle at top, rgba(255, 196, 94, 0.2), transparent 34%),
    rgba(10, 18, 32, 0.76);
  backdrop-filter: blur(14px);
}

.alert-overlay.hidden {
  display: none;
}

.alert-overlay-card {
  position: relative;
  width: min(1100px, 100%);
  min-height: min(76vh, 760px);
  display: grid;
  align-content: space-between;
  gap: 24px;
  padding: clamp(24px, 4vw, 46px);
  border-radius: 36px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background:
    radial-gradient(circle at top right, rgba(255, 196, 94, 0.18), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(245, 249, 255, 0.92));
  box-shadow: 0 36px 100px rgba(10, 18, 32, 0.3);
  animation: overlayIn 0.28s ease;
}

.alert-overlay-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.alert-overlay-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 8px 14px;
  background: rgba(234, 88, 12, 0.12);
  color: var(--brand-deep);
  font-weight: 700;
}

.overlay-close-button {
  border: 0;
  border-radius: 999px;
  padding: 11px 18px;
  color: #fff;
  background: linear-gradient(135deg, #16243e 0%, #28456e 100%);
  box-shadow: 0 12px 24px rgba(21, 35, 59, 0.2);
}

.alert-overlay-classroom {
  justify-self: end;
  font-size: clamp(1.1rem, 2vw, 1.5rem);
  color: var(--text-soft);
  font-weight: 700;
}

.alert-overlay-message {
  display: grid;
  place-items: center;
  min-height: 42vh;
  text-align: center;
  font-size: clamp(3.8rem, 10vw, 9rem);
  line-height: 1.04;
  letter-spacing: 0.01em;
  overflow-wrap: anywhere;
  word-break: break-word;
  color: var(--text-main);
}

.alert-overlay-message--long {
  min-height: 38vh;
  font-size: clamp(2.8rem, 7vw, 5.8rem);
  line-height: 1.14;
}

.alert-overlay-message--dense {
  min-height: 34vh;
  font-size: clamp(2rem, 4.8vw, 3.8rem);
  line-height: 1.26;
}

.alert-overlay-message--compact {
  min-height: 30vh;
  font-size: clamp(1.45rem, 3.3vw, 2.8rem);
  line-height: 1.42;
  max-height: 54vh;
  overflow: auto;
  padding-right: 10px;
}

.alert-overlay-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 18px;
  color: var(--text-soft);
  font-size: clamp(1rem, 1.6vw, 1.2rem);
}

@keyframes glowPulse {
  0% {
    box-shadow: 0 24px 60px rgba(20, 37, 63, 0.12), 0 0 0 rgba(234, 88, 12, 0);
  }
  20% {
    box-shadow: 0 24px 60px rgba(20, 37, 63, 0.12), 0 0 0 12px rgba(234, 88, 12, 0.14);
  }
  100% {
    box-shadow: 0 24px 60px rgba(20, 37, 63, 0.12), 0 0 0 rgba(234, 88, 12, 0);
  }
}

@keyframes overlayIn {
  from {
    opacity: 0;
    transform: scale(0.97);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.nav-card {
  display: grid;
  gap: 10px;
  padding: 22px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(84, 108, 146, 0.12);
  background: rgba(255, 255, 255, 0.74);
}

.nav-card-tag {
  color: var(--brand-deep);
  font-weight: 700;
}

.classroom-body.is-fullscreen .app-shell {
  width: min(100vw - 24px, 100%);
  padding: 12px 0;
}

.classroom-body.is-fullscreen .classroom-topbar,
.classroom-body.is-fullscreen .classroom-controls {
  display: none;
}

.classroom-body.is-fullscreen .classroom-grid {
  grid-template-columns: 1fr;
  margin-bottom: 0;
}

.classroom-body.is-fullscreen .announcement-stage {
  min-height: calc(100vh - 24px);
  padding: 30px;
}

.classroom-body.is-fullscreen .stage-message {
  max-width: none;
  font-size: clamp(4.2rem, 10vw, 8.6rem);
}

.classroom-body.is-fullscreen .stage-message--long {
  font-size: clamp(3rem, 7vw, 6.2rem);
}

.classroom-body.is-fullscreen .stage-message--dense {
  font-size: clamp(2.1rem, 4.8vw, 4rem);
}

.classroom-body.is-fullscreen .stage-message--compact {
  font-size: clamp(1.5rem, 3.4vw, 3rem);
}

.plain-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 12px;
  line-height: 1.7;
  color: var(--text-soft);
}

.empty-state {
  color: var(--text-soft);
  margin: 0;
}

@media (max-width: 980px) {
  .hero-panel,
  .content-grid,
  .card-grid,
  .classroom-grid,
  .classroom-bottom-grid {
    grid-template-columns: 1fr;
  }

  .office-topbar,
  .classroom-topbar,
  .office-brand,
  .classroom-brand,
  .office-status-strip {
    flex-direction: column;
    align-items: stretch;
  }

  .classroom-status-strip {
    flex-direction: column;
    align-items: stretch;
  }

  .office-brand {
    gap: 6px;
  }

  .classroom-brand {
    gap: 6px;
  }

  .office-brand h1 {
    white-space: normal;
  }

  .classroom-brand h1 {
    white-space: normal;
  }

  .app-shell {
    width: min(100% - 20px, 1220px);
    padding-top: 18px;
    padding-bottom: 24px;
  }

  .office-shell {
    width: min(100% - 20px, 1360px);
  }

  .panel,
  .hero-panel,
  .classroom-topbar {
    padding: 20px;
  }

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

  .stage-message {
    max-width: none;
    font-size: clamp(2rem, 10vw, 4rem);
  }

  .alert-overlay-card {
    min-height: min(82vh, 760px);
  }

  .alert-overlay-message {
    min-height: 32vh;
    font-size: clamp(2.6rem, 10vw, 5.4rem);
  }

  .classroom-body.is-fullscreen .announcement-stage {
    min-height: calc(100vh - 20px);
  }
}

@media (max-width: 640px) {
  .button-row,
  .chip-row {
    flex-direction: column;
  }

  .primary-button,
  .ghost-button,
  .chip-button {
    width: 100%;
  }
}
