:root {
  color-scheme: light;
  --primary: #a80014;
  --ink: #292429;
  --muted: #645d60;
  --border: #d2caca;
  font: 16px/1.55 system-ui,"Microsoft YaHei",sans-serif;
  background: #f8f6f3;
  color: var(--ink);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

header {
  background: #1b1b1b;
  color: white;
  border-bottom: 3px solid #a80014;
}

a {
  color: var(--primary);
}

.masthead {
  max-width: 76rem;
  margin: auto;
  min-height: 5.8rem;
  padding: 1.1rem clamp(1rem,4vw,3rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.masthead img {
  display: block;
  width: clamp(140px,29vw,215px);
  height: auto;
}

.home-link {
  color: white;
  text-underline-offset: .3em;
  font-size: .92rem;
  white-space: nowrap;
}

main {
  max-width: 42rem;
  margin: clamp(1.5rem,6vw,4rem) auto;
  padding: clamp(1.3rem,4vw,2.75rem);
  background: white;
  border: 1px solid #e1dad7;
  border-top: 4px solid var(--primary);
  border-radius: 3px;
}

h1,h2 {
  line-height: 1.28;
  margin: 0 0 1rem;
}

h1 {
  font-family: "Noto Serif CJK SC",SimSun,serif;
  font-size: clamp(1.7rem,4vw,2.3rem);
  letter-spacing: .03em;
}

h2 {
  font-size: 1.2rem;
}

.account-strip {
  margin: 0 0 1.5rem;
  display: grid;
  gap: 1.2rem;
  grid-template-columns: repeat(2,minmax(0,1fr));
  border-bottom: 1px solid var(--border);
  padding: 1rem 0 1.5rem;
}

.account-strip dt,.hint {
  color: var(--muted);
  font-size: .93rem;
}

.account-strip dd {
  margin: .3rem 0 0;
  font-size: 1.15rem;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.fields {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 1rem;
}

label {
  display: block;
  font-weight: 650;
  margin-bottom: .45rem;
}

input,select {
  font: inherit;
  color: inherit;
  width: 100%;
  background: white;
  border: 1px solid #a99c9f;
  border-radius: 4px;
  min-height: 2.9rem;
  padding: .55rem .75rem;
}

input#code {
  font-family: ui-monospace,"Microsoft YaHei",monospace;
}

.hint {
  margin: .55rem 0 1.25rem;
}

button {
  font: inherit;
  font-weight: 650;
  min-height: 2.8rem;
  padding: .55rem 1.1rem;
  border-radius: 4px;
  border: 1px solid var(--primary);
  background: var(--primary);
  color: white;
  cursor: pointer;
}

.secondary {
  background: white;
  color: var(--primary);
  margin: .4rem 0 .4rem .4rem;
}

button:hover:not(:disabled) {
  filter: brightness(.93);
}

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

input:focus-visible,select:focus-visible,button:focus-visible,a:focus-visible {
  outline: 3px solid #155b89;
  outline-offset: 3px;
}

header a:focus-visible {
  outline-color: white;
}

[hidden] {
  display: none!important;
}

.result {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.result:empty {
  display: none;
}

.error {
  color: #a02524;
}

.delivery {
  padding-top: 1.2rem;
  margin-top: 1.4rem;
  border-top: 1px solid var(--border);
}

.delivery p {
  overflow-wrap: anywhere;
}

#session-state {
  margin: 0 0 1rem;
  color: var(--muted);
}

@media(max-width:46rem) {
  main {
    margin: 1.2rem .9rem;
  }
}

@media(max-width:25rem) {
  .fields {
    grid-template-columns: 1fr;
  }
  .masthead {
    gap: .5rem;
  }
  .secondary {
    margin-left: 0;
  }
}

.history {
  margin-top: 2.3rem;
}

.history ul {
  padding: 0;
  list-style: none;
}

.history li {
  border-top: 1px solid var(--border);
  padding: .85rem 0;
  overflow-wrap: anywhere;
}

.history li>* {
  display: block;
}

.history li small {
  color: var(--muted);
  margin: .25rem 0;
  font-size: .87rem;
}

.history li button {
  background: white;
  color: var(--primary);
  border: 0;
  text-decoration: underline;
  text-underline-offset: .25em;
  padding: .2rem 0;
  min-height: 2.75rem;
  font-size: .9rem;
}
