:root {
  --bg: #07090f;
  --bg-2: #101522;
  --card: rgba(18, 24, 38, 0.92);
  --line: rgba(212, 175, 55, 0.22);
  --gold: #e4c56b;
  --gold-2: #b8892e;
  --red: #e23b3b;
  --blue: #2b7cff;
  --text: #f4f1e8;
  --muted: #9aa3b5;
  --ok: #3ecf8e;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(226, 59, 59, 0.16), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(43, 124, 255, 0.14), transparent 50%),
    linear-gradient(180deg, #0b0f18 0%, #07090f 100%);
  color: var(--text);
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

body {
  padding: 24px 20px 48px;
}

.wrap {
  max-width: 1280px;
  margin: 0 auto;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 22px;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.kicker {
  color: var(--gold);
  letter-spacing: 0.28em;
  font-size: 12px;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.sub {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.badge {
  border: 1px solid var(--line);
  background: rgba(228, 197, 107, 0.08);
  color: var(--gold);
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
  white-space: nowrap;
}

.grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 18px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  backdrop-filter: blur(16px);
}

.machine {
  position: relative;
  overflow: hidden;
}

.machine::before {
  content: "";
  position: absolute;
  inset: -40% 20% auto;
  height: 180px;
  background: radial-gradient(circle, rgba(228, 197, 107, 0.18), transparent 70%);
  pointer-events: none;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

h2 {
  margin: 0;
  font-size: 18px;
}

.cage {
  height: 220px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.01)),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.03) 0 1px, transparent 1px 18px);
  position: relative;
  overflow: hidden;
  margin-bottom: 18px;
}

.cage.spinning .float-ball {
  animation-duration: 0.35s;
}

.float-ball {
  position: absolute;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  animation: float 2.8s ease-in-out infinite;
  box-shadow: inset -6px -8px 10px rgba(0,0,0,.28), 0 8px 14px rgba(0,0,0,.28);
}

.results {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  min-height: 88px;
  margin-bottom: 18px;
}

.slot {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 1px dashed rgba(255,255,255,0.18);
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
  background: rgba(255,255,255,0.02);
}

.plus {
  color: var(--gold);
  font-size: 22px;
  font-weight: 700;
}

.ball {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 24px;
  font-weight: 800;
  animation: pop 0.45s cubic-bezier(.2,1.4,.3,1) both;
}

.ball.red {
  background: radial-gradient(circle at 30% 28%, #ff8d86, #e23b3b 46%, #8d1212);
  box-shadow: inset -8px -10px 14px rgba(0,0,0,.3), 0 10px 18px rgba(226,59,59,.35);
}

.ball.blue {
  background: radial-gradient(circle at 30% 28%, #8cbcff, #2b7cff 46%, #0d3f93);
  box-shadow: inset -8px -10px 14px rgba(0,0,0,.3), 0 10px 18px rgba(43,124,255,.35);
}

.ball.sm {
  width: 42px;
  height: 42px;
  font-size: 15px;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

button, .file-btn {
  appearance: none;
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}

.primary {
  background: linear-gradient(180deg, #f0d78a, #c7983a);
  color: #2a1d05;
  box-shadow: 0 8px 20px rgba(201, 152, 58, 0.28);
}

.ghost {
  background: rgba(255,255,255,0.04);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.1);
}

.danger {
  background: rgba(226, 59, 59, 0.12);
  color: #ffb4b4;
  border: 1px solid rgba(226, 59, 59, 0.25);
}

button:hover, .file-btn:hover {
  filter: brightness(1.08);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.meta {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

textarea {
  width: 100%;
  min-height: 160px;
  resize: vertical;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.1);
  background: #0c111c;
  color: var(--text);
  padding: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
}

.hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  margin: 8px 0 12px;
}

.tickets {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ticket {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
}

.ticket-label {
  min-width: 72px;
  color: var(--gold);
  font-size: 12px;
}

.ticket-balls {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.copy-btn {
  padding: 8px 10px;
  font-size: 12px;
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 18px;
}

.bar-row {
  display: grid;
  grid-template-columns: 28px 1fr 36px;
  gap: 8px;
  align-items: center;
  margin: 4px 0;
  font-size: 12px;
  color: var(--muted);
}

.bar {
  height: 8px;
  background: rgba(255,255,255,0.06);
  border-radius: 99px;
  overflow: hidden;
}

.bar > span {
  display: block;
  height: 100%;
  border-radius: 99px;
}

.bar.red > span { background: linear-gradient(90deg, #ff7a73, #e23b3b); }
.bar.blue > span { background: linear-gradient(90deg, #7eb6ff, #2b7cff); }

.table-wrap {
  max-height: 240px;
  overflow: auto;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.06);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th, td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

th {
  color: var(--muted);
  font-weight: 600;
  position: sticky;
  top: 0;
  background: #121826;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: #162033;
  color: var(--text);
  border: 1px solid var(--line);
  padding: 12px 14px;
  border-radius: 12px;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: 0.25s ease;
}

.toast.show {
  opacity: 1;
  transform: none;
}

.note {
  margin-top: 16px;
  color: #c7b27a;
  font-size: 12px;
  line-height: 1.6;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes pop {
  from { transform: scale(0.4); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@media (max-width: 960px) {
  .grid, .stats {
    grid-template-columns: 1fr;
  }
  header {
    flex-direction: column;
    align-items: flex-start;
  }
  h1 {
    font-size: 28px;
  }
}
