:root {
  --canvas: #fff3d9;
  --surface: #fff6e3;
  --white: #ffffff;
  --ink: #78440a;
  --ink-muted: #936835;
  --primary: #f8981f;
  --primary-deep: #d48019;
  --positive: #3b6484;
  --attention: #9d3e00;
  --border: #dfcbaf;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
  min-height: 100vh;
}

button,
input {
  font: inherit;
}

.page {
  max-width: 1480px;
  margin: 0 auto;
  padding: 28px 28px 48px;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-end;
  padding: 10px 0 24px;
  border-bottom: 2px solid var(--border);
}

.eyebrow {
  font-size: 14px;
  letter-spacing: 0.16em;
  font-weight: 800;
  color: var(--positive);
  margin-bottom: 10px;
}

h1 {
  font-size: clamp(28px, 4vw, 52px);
  line-height: 1.1;
  margin: 0;
  color: var(--ink);
  letter-spacing: -0.03em;
}

.subtitle {
  font-size: 16px;
  color: var(--ink-muted);
  margin: 12px 0 0;
  line-height: 1.55;
  max-width: 42rem;
}

.hero-mark {
  width: 92px;
  height: 92px;
  position: relative;
  flex: none;
}

.hero-mark::before {
  content: "";
  position: absolute;
  inset: 10px 8px 16px;
  background: var(--primary);
  border: 2px solid var(--primary-deep);
  clip-path: polygon(50% 0, 94% 23%, 82% 87%, 50% 100%, 18% 87%, 6% 23%);
}

.hero-mark::after {
  content: "抽\A 签";
  white-space: pre;
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  font-weight: 900;
  font-size: 22px;
  line-height: 1.05;
  color: #000;
}

.status-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.status-main {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
}

.status-dot {
  width: 12px;
  height: 12px;
  background: var(--positive);
  border-radius: 50%;
  flex: none;
}

.status-dot.done {
  background: var(--attention);
}

.counter {
  font-variant-numeric: tabular-nums;
  color: var(--positive);
}

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

th {
  background: var(--primary);
  color: #000;
  font-size: 14px;
  position: sticky;
  top: 0;
  z-index: 1;
}

tbody tr {
  background: var(--surface);
  transition: background 0.2s;
}

tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.45);
}

tbody tr.assigned {
  background: #eaf3f8;
}

td:first-child {
  width: 72px;
  color: var(--ink-muted);
  font-weight: 800;
}

.name {
  font-weight: 900;
  font-size: 17px;
}

.school {
  color: var(--ink-muted);
  font-size: 14px;
  line-height: 1.45;
}

.ticket {
  display: inline-grid;
  place-items: center;
  min-width: 58px;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--border);
  background: var(--white);
  font-size: 22px;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

.ticket.assigned {
  background: var(--positive);
  border-color: var(--positive);
  color: #fff;
  animation: reveal 0.4s ease both;
}

.row-action {
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--ink);
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

.row-action:hover:not(:disabled) {
  border-color: var(--primary-deep);
  background: #fff0c7;
}

.row-action:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.row-action.loading {
  opacity: 0.65;
  cursor: wait;
}

.footer-note {
  padding-top: 16px;
  color: var(--ink-muted);
  font-size: 13px;
  line-height: 1.6;
}

.load-error {
  color: var(--attention);
  font-weight: 800;
  margin-top: 12px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 20px);
  background: var(--ink);
  color: #fff;
  padding: 13px 18px;
  border: 2px solid var(--primary);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  font-weight: 800;
  z-index: 5;
  max-width: calc(100vw - 32px);
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@keyframes reveal {
  0% {
    transform: scale(0.72) rotate(-7deg);
    opacity: 0.2;
  }
  70% {
    transform: scale(1.12) rotate(2deg);
  }
  100% {
    transform: scale(1) rotate(0);
    opacity: 1;
  }
}

@media (max-width: 800px) {
  .page {
    padding: 20px 14px 36px;
  }

  .hero {
    align-items: flex-start;
  }

  .hero-mark {
    width: 70px;
    height: 70px;
  }

  .hero-mark::after {
    font-size: 17px;
  }

  .status-strip {
    flex-direction: column;
    align-items: flex-start;
  }

  .table-wrap {
    overflow: visible;
    background: transparent;
    border: none;
  }

  table {
    display: block;
  }

  thead {
    display: none;
  }

  tbody {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  tbody tr {
    display: grid;
    grid-template-columns: 2.25rem 1fr auto;
    grid-template-areas:
      "seq name ticket"
      "school school school"
      "action action action";
    gap: 8px 10px;
    padding: 14px;
    border: 1px solid var(--border);
    background: var(--surface);
  }

  tbody tr:nth-child(even) {
    background: var(--surface);
  }

  tbody tr.assigned {
    background: #eaf3f8;
  }

  tbody td {
    display: block;
    padding: 0;
    border: none;
  }

  tbody td:nth-child(1) {
    grid-area: seq;
    align-self: center;
    width: auto;
    font-size: 13px;
  }

  tbody td:nth-child(2) {
    grid-area: name;
    align-self: center;
  }

  tbody td:nth-child(3) {
    grid-area: school;
  }

  tbody td:nth-child(4) {
    grid-area: ticket;
    justify-self: end;
    align-self: center;
  }

  tbody td:nth-child(5) {
    grid-area: action;
    padding-top: 4px;
  }

  .name {
    font-size: 17px;
  }

  .school {
    font-size: 13px;
  }

  .ticket {
    min-width: 52px;
    height: 38px;
    font-size: 20px;
  }

  .row-action {
    width: 100%;
    min-height: 48px;
    padding: 12px 16px;
    font-size: 15px;
    white-space: normal;
  }
}

@media (min-width: 801px) {
  .table-wrap {
    overflow: auto;
  }
}
