:root {
  --ink: #1b3540;
  --nav: #193946;
  --teal: #137668;
  --muted: #536d77;
  --line: #cbd8d9;
  --paper: #f1f5f4;
  --white: #fff;
  --green: #18744e;
  --amber: #9c4c0c;
  --blue: #426279;
  font-family: "Instrument Sans","Noto Sans CJK SC","Microsoft YaHei",system-ui,sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-size: 24px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

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

button,select,input,textarea {
  border: 1px solid #b8c9cb;
  border-radius: 5px;
  background: white;
}

button {
  padding: 8px 13px;
  cursor: pointer;
  font-weight: 600;
  line-height: 1.4;
}

button:hover:not(:disabled) {
  border-color: var(--teal);
  background: #eaf4f0;
}

button:focus-visible,a:focus-visible,summary:focus-visible,select:focus-visible,input:focus-visible,textarea:focus-visible {
  outline: 3px solid #d69b29;
  outline-offset: 2px;
}

button:disabled {
  opacity: .46;
  cursor: default;
}

button.primary {
  color: white;
  background: var(--teal);
  border-color: var(--teal);
}

button.primary:hover:not(:disabled) {
  background: #0b5b50;
}

button.quiet {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}

button.small {
  font-size: .83rem;
  padding: 5px 9px;
}

input,select,textarea {
  padding: 8px 10px;
  min-width: 0;
  max-width: 100%;
}

textarea {
  resize: vertical;
  min-height: 55px;
  width: 100%;
}

input[type=checkbox] {
  accent-color: var(--teal);
  width: 1.05rem;
  height: 1.05rem;
}

a {
  color: #136a70;
  text-underline-offset: 3px;
}

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

h1 {
  font-size: clamp(1.45rem,4.6vw,2rem);
  letter-spacing: -.035em;
}

h2 {
  font-size: 1.15rem;
}

h3 {
  font-size: 1rem;
}

small,.muted {
  color: var(--muted);
}

.smalltext {
  font-size: .85rem;
}

.mono,kbd,.code,.counter {
  font-family: "Barlow","Noto Sans Mono",ui-monospace,monospace;
  font-variant-numeric: tabular-nums;
}

kbd {
  font-size: .76em;
  display: inline-block;
  min-width: 1.4em;
  border: 1px solid currentColor;
  border-radius: 3px;
  text-align: center;
  opacity: .78;
  margin-left: .25rem;
}

header#top {
  background: var(--nav);
  color: white;
  min-height: 62px;
  display: flex;
  align-items: center;
  gap: clamp(12px,1.5vw,24px);
  padding: 0 clamp(16px,3vw,54px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-size: 1.12rem;
  font-weight: 730;
  white-space: nowrap;
}

.brand small {
  font-weight: 450;
  color: #c6d8da;
  border-left: 1px solid #66808a;
  padding-left: 12px;
  font-size: .84rem;
}

.mark {
  width: 28px;
  height: 28px;
  border: 2px solid #96d8c9;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  transform: rotate(-32deg);
}

.mark:after {
  content: "";
  width: 16px;
  height: 8px;
  border: 2px solid #96d8c9;
  border-radius: 9px;
  box-shadow: 0 4px 0 -2px #193946,0 6px 0 -3px #96d8c9;
}

nav {
  display: flex;
  align-self: stretch;
  gap: 6px;
}

nav button,.account button {
  white-space: nowrap;
  color: #d3e1e2;
  background: transparent;
  border: 0;
  border-radius: 0;
  font-size: .92rem;
}

nav button.active {
  box-shadow: inset 0 -3px #83cfbc;
  color: #fff;
}

nav button:hover:not(:disabled),.account button:hover:not(:disabled) {
  background: #294b58;
  color: #fff;
}

.account {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
  font-size: .85rem;
}

.demo {
  color: #ffe2a6;
  font-size: .78rem;
}

.account button {
  padding: .35rem;
}

.wrap {
  max-width: 1780px;
  margin: auto;
  padding: 22px clamp(16px,2.5vw,46px) 24px;
}

.titlebar,.row,.actions,.line,.controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.titlebar,.between {
  justify-content: space-between;
}

.titlebar {
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.titlebar p {
  margin-top: .32rem;
}

.wraprow,.actions {
  flex-wrap: wrap;
}

.tag,.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 4px;
  font-size: .8rem;
  padding: .21rem .48rem;
  font-weight: 600;
  background: #e2ebeb;
  color: #385561;
}

.tag.warm {
  background: #fff0d7;
  color: #824b0d;
}

.board {
  display: grid;
  grid-template-columns: minmax(0,1.4fr) minmax(365px,1fr);
  gap: 17px;
  align-items: start;
}

.panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow: hidden;
}

.viewpanel {
  background: #182c35;
  color: #eaf1f2;
}

.viewbar,.viewmeta,.panelhead,.panelfoot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .55rem;
  padding: 11px 15px;
  flex-wrap: wrap;
}

.controls,.meterline,.notebox .between,.login figcaption {
  flex-wrap: wrap;
}

.viewbar {
  background: #203c48;
}

.viewbar h2 {
  font-size: 1rem;
}

.viewbar button {
  color: #e8f2f1;
  border-color: #58727b;
  background: #274551;
  padding: 4px 9px;
}

.viewbar button:hover:not(:disabled) {
  background: #3c5d68;
}

.stage {
  height: clamp(290px,55vh,770px);
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #101f26;
  touch-action: none;
}

.stage img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  transform-origin: center;
  position: absolute;
  inset: 0;
}

.stage.zoom {
  cursor: grab;
}

.stage.zoom:active {
  cursor: grabbing;
}

.viewmeta {
  background: #203c48;
  font-size: .82rem;
  color: #cfe2e3;
  flex-wrap: wrap;
}

.viewmeta b {
  color: white;
}

.notebox {
  padding: 12px 15px;
}

.notebox label,.field {
  display: grid;
  gap: 6px;
  font-size: .88rem;
  font-weight: 600;
}

.notebox textarea {
  margin-top: 8px;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  font-size: .88rem;
}

.leftstack {
  display: grid;
  min-width: 0;
  gap: 12px;
}

.panelhead {
  border-bottom: 1px solid var(--line);
}

.classlist {
  overflow: auto;
  max-height: clamp(325px,72vh,830px);
  scrollbar-gutter: stable;
  font-size: 18px;
}

.classrow {
  padding: 7px 10px 6px;
  border-bottom: 1px solid #dce5e5;
}

.classrow:last-child {
  border: 0;
}

.classmain {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 8px;
  align-items: start;
}

.labelbtn {
  width: 100%;
  text-align: left;
  padding: 5px 7px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f3f5f5;
  border-color: #d4dbdc;
  color: #41545d;
}

.labelbtn strong {
  flex: 1;
  font-size: 20px;
}

.labelbtn span,.minibtn,.pool button {
  white-space: nowrap;
}

.code {
  font-weight: 750;
  min-width: 1.6rem;
  letter-spacing: .025em;
}

.yes,.labelbtn.yes,.pill.yes {
  color: #165e40;
  background: #dcefe3;
  border-color: #9ac9a8;
}

.add,.labelbtn.add {
  color: #86400b;
  background: #ffead4;
  border-color: #e6ae77;
}

.del,.labelbtn.del {
  color: #395c73;
  background: #dee9f0;
  border-color: #abc3d4;
}

.labelbtn:disabled {
  opacity: 1;
}

.classhint {
  font-size: 17px;
  color: #48616a;
  margin: .35rem 0 0;
  line-height: 1.48;
}

.minibtn {
  font-size: 17px;
  padding: 5px 7px;
}

.flag {
  color: #8b5815;
  background: #fff0d5;
}

.classrow details {
  margin-top: 4px;
  font-size: 17px;
}

.classrow summary {
  color: #476b76;
  cursor: pointer;
}

.classrow details p,.example p {
  margin: .35rem 0;
  line-height: 1.5;
}

.examples {
  display: flex;
  gap: 7px;
  overflow: auto;
  padding: 6px 0;
}

.examples figure {
  margin: 0;
  min-width: 0;
  flex: 0 1 135px;
}

.examples img {
  width: 100%;
  border-radius: 3px;
  display: block;
}

.examples figcaption {
  margin-top: 3px;
  font-size: .76rem;
}

.panelfoot {
  background: #f7faf9;
  border-top: 1px solid var(--line);
  font-size: .82rem;
}

.footbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  padding: 12px 0;
  flex-wrap: wrap;
}

.saveinfo {
  font-size: .86rem;
  color: var(--muted);
}

.warn,.error {
  color: #8b411c;
}

.notice {
  background: #fff1d7;
  border: 1px solid #e6c58d;
  border-radius: 5px;
  padding: 9px 12px;
  font-size: .9rem;
  margin-bottom: 10px;
}

.filterline {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  font-size: .88rem;
}

.filterline select {
  max-width: 220px;
}

.progress {
  width: 120px;
  max-width: 20vw;
  height: 5px;
  background: #d4e1e1;
  overflow: hidden;
  border-radius: 4px;
}

.progress i {
  height: 100%;
  display: block;
  background: var(--teal);
}

.tablewrap {
  overflow: auto;
}

table {
  border-collapse: collapse;
  width: 100%;
  text-align: left;
  font-size: .91rem;
}

td,th {
  padding: 12px 13px;
  border-bottom: 1px solid #dce5e5;
  white-space: nowrap;
}

th {
  background: #eaf0f0;
  color: #4a646f;
  font-size: .82rem;
  font-weight: 600;
}

.empty {
  padding: 45px 20px;
  text-align: center;
  color: var(--muted);
}

.block {
  padding: 19px;
}

.block h2,.block>p {
  margin-bottom: 12px;
}

.gridform {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(min(100%,260px),1fr));
  gap: 12px;
  margin: 12px 0;
}

.pool {
  display: grid;
  grid-template-columns: repeat(auto-fill,minmax(min(100%,320px),1fr));
  gap: 4px;
  max-height: 300px;
  overflow: auto;
}

.pool label {
  min-width: 0;
  padding: 4px;
  overflow-wrap: anywhere;
}

.adminstack {
  display: grid;
  grid-template-columns: minmax(0,1fr);
  gap: 15px;
}

.login {
  max-width: 1000px;
  margin: clamp(32px,9vh,95px) auto;
  display: grid;
  grid-template-columns: minmax(0,1.12fr) minmax(0,1fr);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

.login figure {
  background: #203c48;
  color: #fff;
  margin: 0;
  display: flex;
  flex-direction: column;
}

.login figure img {
  width: 100%;
  height: 0;
  min-height: 235px;
  flex: 1;
  object-fit: cover;
}

.login figcaption {
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: .82rem;
}

.login form {
  display: grid;
  grid-template-columns: minmax(0,1fr);
  gap: 16px;
  padding: clamp(24px,4vw,52px);
  align-content: center;
}

.login form h1 {
  margin-bottom: 4px;
}

.login form input {
  width: 100%;
}

.login .demobox {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.demobox p {
  margin-bottom: 8px;
  font-size: .82rem;
  color: var(--muted);
}

dialog {
  border: 1px solid var(--line);
  border-radius: 9px;
  width:  min(720px,94vw);
  max-height: 86vh;
  padding: 20px;
  color: var(--ink);
}

dialog::backdrop {
  background: #142a37a6;
}

.dialogfoot {
  display: flex;
  justify-content: flex-end;
  margin-top: 15px;
}

dialog h2 {
  margin-bottom: 12px;
}

dialog p {
  margin: 7px 0;
  line-height: 1.55;
}

.dictgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(min(100%,420px),1fr));
  gap: 12px;
}

.dictcard {
  padding: 15px;
}

.dictcard h3 {
  margin-bottom: 5px;
}

.dictcard .examples figure {
  max-width: 115px;
}

#message {
  position: fixed;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  max-width: 92vw;
  background: #193946;
  color: #fff;
  border-radius: 6px;
  box-shadow: 0 3px 16px #142a3730;
  padding: 10px 16px;
  pointer-events: none;
}

#message:empty {
  display: none;
}

button[hidden],[hidden] {
  display: none!important;
}

.danger {
  color: #92411c;
}

.history {
  border-left: 3px solid var(--line);
  padding: 4px 12px;
  margin: 12px 0;
}

.narrow {
  max-width: 640px;
}

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

.statusdot {
  display: inline-block;
  width: 7px;
  height: 7px;
  background: #5b9a86;
  border-radius: 50%;
  margin-right: 5px;
}

.meterline {
  display: flex;
  gap: 8px;
  align-items: center;
}

.row .grow {
  flex: 1;
}

.nowrap {
  white-space: nowrap;
}

.idtext {
  overflow-wrap: anywhere;
  min-width: 0;
}

body[data-busy=true] {
  cursor: progress;
}

@media(max-width:960px) {
  .board {
    grid-template-columns: minmax(0,1.1fr) minmax(325px,1fr);
  }
  .brand small {
    display: none;
  }
  header#top {
    gap: 11px;
  }
  .wrap {
    padding: 14px;
  }
  .viewbar,.viewmeta {
    padding: 9px;
  }
  .controls {
    gap: .3rem;
  }
}

@media(max-width:1360px) {
  header#top {
    flex-wrap: wrap;
    padding: 10px 12px 0;
    gap: 4px 12px;
  }
  .account {
    order: 1;
  }
  .brand {
    order: 0;
  }
  nav {
    order: 2;
    width: 100%;
    min-height: 37px;
    overflow: auto;
  }
  nav button {
    white-space: nowrap;
    padding: 6px 10px;
  }
}

@media(max-width:800px) {
  .board,.login {
    grid-template-columns: minmax(0,1fr);
  }
  .stage {
    height: 46vh;
    min-height: 220px;
  }
  .classlist {
    max-height: 60vh;
  }
  .login {
    margin: 20px auto;
  }
  .login figure img {
    height: 150px;
    min-height: 150px;
    flex: none;
  }
  .login form {
    padding: 22px;
  }
  .titlebar {
    gap: 10px;
  }
  .wrap {
    padding: 12px;
  }
  .board {
    gap: 12px;
  }
  .progress {
    width: 75px;
  }
}

@media(max-width:450px) {
  .labelbtn {
    display: grid;
    grid-template-columns: auto 1fr;
  }
  .labelbtn strong {
    grid-column: 1 / -1;
    grid-row: 2;
  }
  .labelbtn span {
    justify-self: end;
  }
}

.notebox .check {
  display: inline-flex;
}

.footbar {
  background: var(--paper);
  border-top: 1px solid var(--line);
}

@media(min-width:1000px) and (min-height:650px) {
  .footbar {
    position: sticky;
    bottom: 0;
    z-index: 2;
  }
}

.legend {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 7px 14px;
  border-bottom: 1px solid var(--line);
}

.pill.add {
  background: #ffead4;
  color: #86400b;
}

.pill.del {
  background: #dee9f0;
  color: #395c73;
}

.viewmeta .idtext {
  flex: 1;
}

dialog pre {
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 45vh;
}

#pool {
  margin: 12px 0;
}

@media(min-width:801px) {
  .stage {
    height: clamp(270px,calc(100dvh - 458px),770px);
  }
  .classlist {
    max-height: clamp(330px,calc(100dvh - 300px),850px);
  }
  .legend+.classlist {
    max-height: clamp(300px,calc(100dvh - 344px),800px);
  }
}

