* {
  box-sizing: border-box;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
:root {
  font-family: 'Source Sans 3', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  color: #233a34;
  background: #f3f3ec;
  color-scheme: light;
}
html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}
body {
  position: fixed;
  inset: 0;
  margin: 0;
}
[hidden] {
  display: none !important;
}
button,
input {
  font: inherit;
}
button {
  border: 1px solid #ced4c8;
  border-radius: 8px;
  background: #fbfcf6;
  color: #25483c;
  min-height: 40px;
  padding: 6px 13px;
  cursor: pointer;
}
button:disabled {
  opacity: 0.45;
  cursor: default;
}
button:focus-visible,
input:focus-visible {
  outline: 3px solid #558664;
  outline-offset: 2px;
}
button.primary,
button[aria-pressed='true']:not([data-color]) {
  background: #245644;
  color: white;
  border-color: #245644;
}
#login {
  min-height: 100dvh;
  display: grid;
  place-items: center;
}
form {
  background: #fbfcf6;
  border: 1px solid #cfd6c9;
  padding: clamp(24px, 6vw, 52px);
  border-radius: 16px;
  width: min(95vw, 420px);
}
form label,
form input,
form button {
  display: block;
  width: 100%;
  margin: 12px 0;
}
form #paste-token {
  margin: 0 0 10px;
  font-size: 14px;
}
form input {
  border: 1px solid #859a8a;
  border-radius: 5px;
  padding: 12px;
}
#classroom {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top);
}
header,
.question,
.paper-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px clamp(14px, 3vw, 48px);
}
header {
  border-bottom: 1px solid #c9d3c7;
}
.wordmark {
  font-family: Georgia, 'Songti SC', serif;
  font-weight: 700;
  color: #204d3e;
  letter-spacing: 0.13em;
  font-size: 21px;
}
#state {
  margin-left: auto;
  font-size: 13px;
  color: #53655b;
}
.question {
  padding-block: 15px;
}
.question small,
.paper-head {
  font-size: 13px;
  color: #586e60;
}
.question h1 {
  font:
    600 clamp(17px, 2.5vw, 27px) / 1.35 Georgia,
    'Songti SC',
    serif;
  margin: 6px 0 0;
}
.formula {
  display: inline-flex;
  align-items: center;
  font-weight: 400;
}
.formula sub {
  align-self: end;
  font-size: 0.46em;
}
.fraction {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  font-style: italic;
  font-size: 0.8em;
  margin-left: 5px;
}
.fraction span + span {
  border-top: 1px solid;
  width: 100%;
  text-align: center;
}
.actions,
.paper-head > div {
  display: flex;
  align-items: center;
  gap: 8px;
}
.paper-head {
  border-block: 1px solid #d2d8ca;
  padding-block: 6px;
}
.paper-head button {
  font-size: 13px;
  min-height: 28px;
}
#workspace {
  flex: 1;
  min-height: 0;
  position: relative;
}
#scroller {
  position: absolute;
  inset: 0;
  overflow: hidden auto;
  overscroll-behavior: none;
}
.paper {
  position: relative;
  background: #fffef9;
  background-image: radial-gradient(#cdd6ca 0.7px, transparent 0.85px);
  background-size: 19px 19px;
  aspect-ratio: 1024/1360;
  width: 100%;
}
.paper canvas,
.paper svg,
.paper img {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.paper svg {
  pointer-events: none;
}
aside {
  position: absolute;
  left: max(6px, env(safe-area-inset-left));
  top: 12px;
  border: 1px solid #c9d2c6;
  border-radius: 11px;
  background: #f6f8f1;
  box-shadow: 0 3px 12px #233a341d;
  padding: 4px;
}
aside button {
  min-width: 40px;
  height: 40px;
  font-size: 22px;
  border: none;
  padding: 1px;
  background: transparent;
}
#fold {
  width: 100%;
  height: 28px;
  min-height: 28px;
}
#tools,
.colors {
  display: grid;
  gap: 3px;
}
.colors {
  border-block: 1px solid #d4dacc;
  padding: 5px 0;
}
.colors button {
  height: 29px;
  min-height: 29px;
}
.colors button:after {
  content: '';
  display: inline-block;
  border-radius: 50%;
  width: 15px;
  height: 15px;
  background: var(--swatch);
}
.colors [aria-pressed='true']:after {
  outline: 2px solid var(--swatch);
  outline-offset: 3px;
}
[data-color='#263c38'] {
  --swatch: #263c38;
}
[data-color='#26634e'] {
  --swatch: #26634e;
}
[data-color='#426bb0'] {
  --swatch: #426bb0;
}
[data-color='#ac493d'] {
  --swatch: #ac493d;
}
#diag,
#message {
  position: fixed;
  right: 12px;
  z-index: 2;
  border: 1px solid #bdcabb;
  border-radius: 10px;
  background: #fafcf5;
  padding: 14px;
  max-width: min(90vw, 380px);
  box-shadow: 0 2px 12px #233a3420;
}
#diag {
  top: 60px;
}
dl {
  display: grid;
  grid-template-columns: auto auto;
  gap: 6px 14px;
  margin: 10px 0 0;
  font-size: 13px;
}
dd {
  margin: 0;
  text-align: right;
}
#message {
  bottom: 10px;
  font-size: 14px;
}
dialog {
  overflow: hidden;
  max-height: 92dvh;
  width: min(800px, 96vw);
  border: 1px solid #c7d1c5;
  border-radius: 12px;
  padding: 0;
}
dialog .paper {
  width: min(100%, calc(65dvh - 44px));
  margin-inline: auto;
}
dialog header {
  position: sticky;
  top: 0;
  background: #fbfcf6;
  z-index: 1;
}
dialog::backdrop {
  background: #19342966;
}
@media (max-width: 630px) {
  .question {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 6px;
  }
  .actions button {
    font-size: 13px;
    min-height: 32px;
  }
  .colors button {
    min-height: 28px;
  }
  .question h1 {
    margin-top: 3px;
  }
}
@media (max-height: 650px) {
  #tools,
  .colors {
    gap: 0;
  }
  aside button {
    height: 30px;
    min-height: 30px;
  }
  .colors button {
    min-height: 23px;
    height: 23px;
  }
}
