*, *::before, *::after { box-sizing: border-box; }

html {
  /* 底部有标签栏或操作条：滚动定位（聚焦、跳转）时给它们让出位置 */
  scroll-padding-bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom, 0px) + 48px);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--green-100);
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--t-md);
  line-height: 1.5;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, p, dl, dd, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { border: 0; background: none; padding: 0; cursor: pointer; }
a { color: inherit; }

:focus-visible {
  outline: 3px solid var(--role-teacher);
  outline-offset: 3px;
  border-radius: 4px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

/* 整个应用是一栏，电脑上居中 */
#app {
  position: relative;
  max-width: var(--col);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--green-50);
  overflow-x: clip;
}
@media (min-width: 520px) {
  #app { box-shadow: 0 0 0 1px var(--line); }
}

.screen { min-height: 100vh; min-height: 100dvh; }
.screen--tabs { padding-bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom, 0px) + var(--s-8)); }

/* 印刷颗粒：铺在大色块上，让它像丝网印，不像屏幕上的纯色 */
.grain { position: relative; isolation: isolate; }
.grain::after {
  content: "";
  position: absolute; inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 220px 220px;
  mix-blend-mode: multiply;
  opacity: 0.32;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
