:root {
  --paper: #f2e2b8;
  --ink: #1c120c;
  --rule: rgba(156, 28, 22, 0.28);
  --stamp: #c22018;
  --busy: #8d8a82;
  --shadow: #6a2a16;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background:
    radial-gradient(circle at 20% 10%, #5a2418, transparent 42%),
    radial-gradient(circle at 90% 80%, #1a0d08, #2b140f 70%);
  color: var(--ink);
  font-family: "Noto Serif SC", serif;
  padding: 18px 12px 48px;
}

.sheet {
  max-width: 920px;
  margin: 0 auto;
  background:
    repeating-linear-gradient(90deg, transparent, transparent 18px, rgba(0,0,0,0.04) 18px, rgba(0,0,0,0.04) 19px),
    var(--paper);
  border: 2px solid #7a1f14;
  box-shadow: 12px 16px 0 var(--shadow);
  padding: 22px 18px 28px;
  position: relative;
}
.sheet::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 24px;
  bottom: 24px;
  width: 14px;
  background: radial-gradient(circle at 7px 10px, #2b140f 5px, transparent 6px);
  background-size: 14px 22px;
}

.mast { text-align: center; margin-bottom: 16px; }
.ticket {
  font-family: "Share Tech Mono", monospace;
  letter-spacing: 0.28em;
  color: var(--stamp);
  margin: 0 0 6px;
  font-size: 12px;
}
h1, h2 { font-family: "ZCOOL XiaoWei", serif; margin: 0 0 8px; letter-spacing: 0.08em; }
h1 { font-size: clamp(32px, 8vw, 48px); }
.lede, .hint { margin: 0 0 14px; line-height: 1.6; }
.hint { color: #5a4636; font-size: 14px; }

.steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 18px;
}
.steps button, .ghost, .primary, .file {
  font-family: "Share Tech Mono", monospace;
  border: 1.5px solid var(--ink);
  background: transparent;
  color: var(--ink);
  padding: 8px 6px;
  cursor: pointer;
}
.steps button.is-current { background: var(--stamp); color: var(--paper); border-color: var(--stamp); }
.steps button.is-locked { opacity: 0.38; }
.primary {
  background: var(--stamp);
  color: var(--paper);
  border-color: #7a1f14;
  padding: 12px 18px;
  font-size: 16px;
}
.primary:disabled, .ghost:disabled, .choice:disabled, .is-blocked {
  opacity: 0.38;
  cursor: not-allowed;
}
.choice-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin: 18px 0;
}
.choice {
  text-align: left;
  padding: 18px 16px;
  background: rgba(255,255,255,0.35);
  font-family: "Noto Serif SC", serif;
}
.choice strong {
  display: block;
  font-family: "ZCOOL XiaoWei", serif;
  font-size: 26px;
  margin-bottom: 8px;
}
.choice span { display: block; color: #5a4636; line-height: 1.5; }
@media (min-width: 720px) {
  .choice-row { grid-template-columns: 1fr 1fr; }
}
.ghost, .file { background: rgba(255,255,255,0.28); }
.file { display: inline-flex; align-items: center; gap: 8px; }
.file input { width: 148px; }

label { display: flex; flex-direction: column; gap: 8px; font-size: 15px; }
input[type="text"], input[type="password"], #student-id {
  font-family: "ZCOOL XiaoWei", serif;
  font-size: 28px;
  padding: 10px 12px;
  border: 0;
  border-bottom: 2px solid var(--stamp);
  background: transparent;
  color: var(--ink);
}
.actions, .tools, #id-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 14px 0; }
#id-form { flex-direction: column; align-items: stretch; }
#id-form .primary { width: 100%; }
.status {
  border: 1.5px dashed var(--stamp);
  padding: 10px 12px;
  margin-bottom: 12px;
  background: rgba(194, 32, 24, 0.08);
}
.status.error { color: #7a1f14; }

.grid-wrap {
  overflow-x: auto;
  border: 1.5px solid #7a1f14;
  background: #f7ead0;
}
.grid {
  display: grid;
  min-width: 640px;
  grid-template-columns: 54px repeat(7, 1fr);
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.grid span, .grid button {
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  min-height: 22px;
  font-family: "Share Tech Mono", monospace;
  font-size: 11px;
}
.head, .time {
  background: #ead7a4;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}
.cell {
  width: 100%;
  background: transparent;
  color: transparent;
  padding: 0;
  cursor: crosshair;
  touch-action: none;
  user-select: none;
}
.cell.busy { background: #9b9890; color: #9b9890; }
.cell.stamp {
  background: var(--stamp);
  color: #f2e2b8;
  box-shadow: inset 0 0 0 2px #f2e2b8;
}
.cell.preview { outline: 2px solid var(--stamp); outline-offset: -2px; }
.cell:disabled { cursor: not-allowed; opacity: 0.85; }

.counter {
  font-family: "Share Tech Mono", monospace;
  color: var(--stamp);
  letter-spacing: 0.08em;
}
.stamps { padding-left: 22px; }
.stamps li { margin: 8px 0; font-size: 20px; }

@media (max-width: 720px) {
  .sheet { padding: 18px 12px 24px; box-shadow: 6px 8px 0 var(--shadow); }
  .steps { grid-template-columns: repeat(2, 1fr); font-size: 12px; }
  .grid { min-width: 560px; }
  .cell, .grid span { min-height: 20px; }
}
