:root {
  --bg: #fff8e7;
  --panel: #ffffff;
  --text: #2d3436;
  --primary: #ff6b35;
  --primary-dark: #e85d2a;
  --danger: #ff5252;
  --muted: #738089;
  --border: #ffe0cc;
  --ok: #16a34a;
  --numpad-bg: #fff0e6;
  --numpad-btn: #ffffff;
  --numpad-btn-active: #ffe0cc;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 20% 0%, #ffe5cc 0%, var(--bg) 55%);
}

.app-header {
  text-align: center;
  padding: 20px 16px 8px;
}

.app-header h1 {
  margin: 0;
  font-size: 2rem;
}

.app-header p {
  margin: 8px 0 0;
  color: var(--muted);
}

.layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 12px 12px 96px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 10px 28px rgba(255, 152, 0, 0.15);
}

.draw-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  position: relative;
  min-height: 68vh;
  padding-top: 22px;
  padding-bottom: 22px;
}

.label {
  align-self: flex-start;
  font-size: 0.95rem;
}

.input {
  width: 100%;
  max-width: 520px;
  padding: 14px 16px;
  font-size: 1.4rem;
  text-align: center;
  border-radius: 14px;
  border: 3px solid var(--border);
  background: var(--numpad-bg);
}

.input-student-id {
  font-weight: 800;
  letter-spacing: 1px;
}

.input:focus {
  outline: none;
  border-color: var(--primary);
}

.numpad-container {
  width: min(100%, 560px);
  display: grid;
  grid-template-columns: repeat(4, minmax(96px, 1fr));
  gap: 12px;
  padding: 14px;
  border-radius: 14px;
  background: var(--numpad-bg);
}

.student-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 600;
}

.numpad-btn {
  min-height: 84px;
  border: none;
  border-radius: 12px;
  background: var(--numpad-btn);
  color: var(--text);
  font-size: 1.6rem;
  font-weight: 900;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.12);
}

.numpad-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.12);
  background: var(--numpad-btn-active);
}

.numpad-action {
  font-size: 1.05rem;
  color: #ffffff;
  background: linear-gradient(180deg, #ff9b70 0%, var(--primary) 100%);
}

.numpad-zero {
  grid-column: 2 / span 2;
}

.rolling-display {
  width: min(100%, 700px);
  min-height: 112px;
  display: grid;
  place-items: center;
  text-align: center;
  border: 3px dashed #ffb58f;
  border-radius: 14px;
  background: #fff5f0;
  font-size: 1.5rem;
  font-weight: 700;
  padding: 10px;
}

.draw-action-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
  position: sticky;
  bottom: 18vh;
  z-index: 5;
  pointer-events: none;
}

.draw-button {
  width: min(100%, 560px);
  min-height: 116px;
  border: none;
  border-radius: 42px;
  font-size: 2.25rem;
  font-weight: 800;
  color: white;
  background: linear-gradient(180deg, #ffb380 0%, var(--primary) 100%);
  cursor: pointer;
  box-shadow: 0 14px 30px rgba(255, 107, 53, 0.42);
  transition: transform 0.14s ease, box-shadow 0.14s ease;
  pointer-events: auto;
}

.draw-button:hover {
  transform: translateY(-2px) scale(1.02);
}

.draw-button:active {
  transform: scale(0.99);
}

.draw-button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.result-card {
  width: min(100%, 700px);
  border: 2px solid #ffd3bd;
  border-radius: 12px;
  background: #fff7f2;
  padding: 12px;
}

.result-card h2 {
  margin: 0 0 8px;
}

.winner-prize {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--primary-dark);
}

.meta,
.hint {
  color: var(--muted);
  font-size: 0.9rem;
}

.toolbar {
  width: min(100%, 700px);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.post-draw-actions {
  width: min(100%, 700px);
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.post-draw-actions button {
  min-width: 168px;
}

button.secondary,
button.danger {
  border: none;
  border-radius: 8px;
  padding: 12px 14px;
  color: white;
  cursor: pointer;
  font-size: 1rem;
}

button.secondary {
  background: #2563eb;
}

button.danger {
  background: var(--danger);
}

.coupon-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  overflow: hidden;
  transition: max-height 0.28s ease;
}

.coupon-grid.collapsed {
  max-height: 240px;
}

.coupon-grid.expanded {
  max-height: 2400px;
}

.coupon-toggle {
  border: none;
  border-radius: 999px;
  background: #4caf50;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 8px 14px;
  margin-bottom: 10px;
}

.coupon-item {
  border: 2px solid #a5d6a7;
  background: #e8f5e9;
  border-radius: 12px;
  padding: 10px;
}

.coupon-item h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.coupon-item p {
  margin: 0;
  color: #584d79;
  font-size: 0.9rem;
}

.coupon-item.empty {
  opacity: 0.45;
  filter: grayscale(0.5);
}

.full-width {
  width: 100%;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  border-bottom: 1px solid #ede6ff;
  padding: 8px 10px;
  font-size: 0.92rem;
}

.hidden {
  display: none;
}

@media (min-width: 900px) {
  .draw-action-wrap {
    bottom: 14vh;
  }
}
