:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #193a61;
  background: #edf5fb;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  padding: 16px 24px;
  display: grid;
  grid-template-rows: 48px minmax(0, 1fr) 24px;
  gap: 12px;
  background: radial-gradient(ellipse at top, #fff, #edf5fb 75%);
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
button { font: inherit; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button:focus-visible { outline: 3px solid #1667c1; outline-offset: 2px; }
.toolbar { display: flex; align-items: center; gap: 20px; }
h1 { margin: 0; font-size: 20px; white-space: nowrap; }
.class-switch { display: flex; gap: 4px; padding: 4px; background: #dfeaf5; border-radius: 12px; }
.class-switch button { padding: 8px 20px; border: 0; border-radius: 8px; color: #49627e; background: transparent; font-weight: 700; }
.class-switch button[aria-pressed="true"] { background: #fff; color: #193a61; box-shadow: 0 2px 5px #193a6114; }
#reset { margin-left: auto; padding: 9px 14px; border: 1px solid #c8d8e8; border-radius: 10px; background: #ffffffb3; color: #49627e; white-space: nowrap; }
#board { min-width: 0; min-height: 0; display: grid; place-items: center; }
#grid { display: grid; gap: 6px; grid-template-columns: repeat(var(--columns, 9), var(--card-size, 0px)); }
.student-card {
  width: var(--card-size); height: var(--card-size);
  padding: 2px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: clamp(1px, calc(var(--card-size) * .04), 4px);
  border: 1px solid #c6dced; border-radius: clamp(5px, calc(var(--card-size) * .12), 12px);
  background: #deecf8; color: #193a61;
}
.student-card[aria-pressed="true"] { background: rgba(49, 185, 117, .24); border-color: #68b88e; color: #165d3c; }
.student-id { font-size: clamp(10px, calc(var(--card-size) * .17), 15px); line-height: 1.1; opacity: .78; font-variant-numeric: tabular-nums; }
.student-name { max-width: 100%; font-size: min(18px, calc(var(--card-size) * .23)); line-height: 1.3; font-weight: 650; white-space: nowrap; }
footer { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; color: #61788e; }
#status { color: #365877; font-variant-numeric: tabular-nums; }
@media (max-width: 600px), (max-height: 450px) {
  body { padding: 12px; grid-template-rows: 44px minmax(0, 1fr) 20px; gap: 8px; }
  .toolbar { gap: 10px; }
  h1 { font-size: 16px; }
  .class-switch button { padding: 7px 10px; font-size: 14px; }
  #reset { padding: 8px; font-size: 12px; }
  footer { font-size: 11px; }
}
@media (max-height: 450px) {
  body { padding: 8px 12px; grid-template-rows: 36px minmax(0, 1fr) 16px; gap: 6px; }
  .class-switch { padding: 2px; }
}
