:root {
  color-scheme: light;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  color: #202124;
  background: #f4f5f6;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, input, select, textarea { font: inherit; }
button { min-height: 40px; padding: 8px 16px; border: 1px solid #2459a6; border-radius: 4px; background: #2459a6; color: #fff; cursor: pointer; }
button:hover { background: #194783; }
button:disabled { opacity: .55; cursor: default; }
input, select, textarea { width: 100%; min-height: 40px; padding: 8px 10px; border: 1px solid #adb3ba; border-radius: 4px; background: #fff; color: #202124; }
textarea { resize: vertical; line-height: 1.5; }
label { display: grid; gap: 6px; font-size: 14px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 4px; font-size: 24px; }
h2 { margin-bottom: 18px; font-size: 19px; }
h3 { margin: 0; font-size: 16px; }
[hidden] { display: none !important; }

.page { width: min(100% - 32px, 960px); margin: 24px auto 48px; }
.page-header { margin-bottom: 18px; }
.page-header p { margin: 0; color: #5f6368; }
.panel { margin-bottom: 16px; padding: 20px; border: 1px solid #d5d8dc; border-radius: 6px; background: #fff; }
.narrow { max-width: 520px; }
.stack { display: grid; gap: 14px; }
.tabs { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.tab { border-color: #b6bdc6; background: #fff; color: #202124; }
.tab:hover, .tab.active { border-color: #2459a6; background: #e9f0fb; color: #174783; }
.quiet-button { min-height: 34px; padding: 5px 10px; border-color: #b6bdc6; background: #fff; color: #202124; }
.quiet-button:hover { background: #edf0f2; }
.danger-button { border-color: #b3261e; background: #b3261e; }
.danger-button:hover { background: #8e1d17; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 14px 0; }
.compact-form { grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: end; }
.compact-form button { grid-column: 1 / -1; justify-self: start; }
.checkbox-label { display: flex; align-items: center; gap: 8px; min-height: 40px; }
.checkbox-label input { width: 18px; min-height: 18px; }
.target-box { margin: 14px 0; padding: 12px; border: 1px solid #d5d8dc; border-radius: 4px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.student-choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 12px; margin-top: 12px; max-height: 260px; overflow: auto; }
.student-choice { display: flex; align-items: center; gap: 8px; padding: 5px 2px; }
.student-choice input { width: 18px; min-height: 18px; }
.help, .muted { color: #5f6368; font-size: 14px; line-height: 1.55; }
.help { margin: 6px 0 12px; }
.preview-block, .current-box { margin: 14px 0; padding: 12px; border: 1px solid #d5d8dc; border-radius: 4px; background: #fafbfc; }
.preview-block p, .current-box p { margin: 8px 0 0; line-height: 1.6; white-space: pre-wrap; }
.notice-text:empty { display: none; }
.notice-text { margin: 10px 0 0; color: #2459a6; }
.error-text { color: #b3261e; white-space: pre-wrap; }
.import-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; align-items: end; }
.import-preview { margin: 16px 0; padding: 12px; border: 1px solid #d5d8dc; border-radius: 4px; }
.table-scroll { margin-top: 14px; overflow: auto; }
table { width: 100%; border-collapse: collapse; background: #fff; font-size: 14px; }
th, td { padding: 8px; border: 1px solid #d5d8dc; text-align: left; vertical-align: middle; }
th { background: #f0f2f4; font-weight: 600; }
td input[type="text"] { min-width: 90px; min-height: 34px; padding: 5px 7px; }
td input[type="checkbox"] { width: 18px; min-height: 18px; }
.table-action { min-height: 32px; padding: 4px 9px; }
.roster-tools { max-width: 340px; margin-top: 18px; }
.group-tools { margin-top: 18px; padding: 12px; border: 1px solid #d5d8dc; border-radius: 4px; }
.group-tools .form-grid { margin-bottom: 10px; }
.search-label { margin-top: 12px; }
#save-roster { margin-top: 14px; }

.display-page { min-height: 100vh; padding: 24px; }
.display-screen { display: flex; flex-direction: column; min-height: calc(100vh - 48px); padding: clamp(18px, 3vw, 40px); border: 1px solid #aab1b8; border-radius: 8px; background: #fff; }
.display-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid #d5d8dc; font-size: 20px; font-weight: 600; }
.connection-status { color: #36734a; font-size: 15px; font-weight: 400; }
.connection-status.offline { color: #b3261e; }
.idle-message { display: grid; flex: 1; place-items: center; color: #646a70; font-size: clamp(30px, 5vw, 60px); }
.active-notice { display: grid; flex: 1; align-content: center; justify-items: center; gap: 16px; padding: 24px 4vw; text-align: center; }
.notice-label { margin: 0; color: #525960; font-size: clamp(20px, 2vw, 28px); }
.display-notice-text { max-width: 1200px; margin: 0; font-size: clamp(36px, 6vw, 84px); font-weight: 700; line-height: 1.45; overflow-wrap: anywhere; }
.has-notice .display-page, :fullscreen .display-page { padding: 0; }
.has-notice .display-screen, :fullscreen .display-screen { min-height: 100vh; border: 0; border-radius: 0; }
.has-notice .display-screen { background: #fff; }

@media (max-width: 680px) {
  .form-grid, .import-row, .compact-form { grid-template-columns: 1fr; }
  .student-choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tabs { flex-wrap: wrap; }
  .display-page { padding: 8px; }
  .display-screen { min-height: calc(100vh - 16px); padding: 16px; }
  .display-header { flex-wrap: wrap; }
}
