:root {
  --bg-start: #ffefc1;
  --bg-end: #ffd1d1;
  --primary: #e43f5a;
  --primary-dark: #c52941;
  --secondary: #3a86ff;
  --text: #2e2e2e;
  --card: #ffffff;
  --muted: #777;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top, var(--bg-start), var(--bg-end));
  min-height: 100vh;
}

canvas#fireworksCanvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.container {
  position: relative;
  z-index: 1;
  max-width: 2400px;
  margin: 0 auto;
  padding: 80px 80px 110px;
}

header {
  text-align: center;
  margin-bottom: 28px;
}

header h1 {
  margin: 0 0 12px;
  font-size: clamp(48px, 5vw, 72px);
  letter-spacing: 2px;
}

.nav-links {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  transition: all 0.3s ease;
}

.nav-links.collapsed {
  opacity: 0;
  transform: translateY(-10px) scale(0.98);
  pointer-events: none;
}

.nav-links a {
  text-decoration: none;
  color: var(--text);
  padding: 12px 24px;
  font-size: 20px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.8);
}

.nav-links a.active {
  background: var(--primary);
  color: #fff;
  border-color: transparent;
}

.nav-toggle {
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.7);
  color: var(--text);
  font-size: 16px;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.nav-toggle.active {
  transform: rotate(90deg);
  color: var(--primary);
  border-color: rgba(228, 63, 90, 0.6);
}

.edge-toggle {
  position: fixed;
  top: 0;
  bottom: 0;
  width: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: auto;
  transition: opacity 0.2s ease;
  z-index: 20;
}

.edge-toggle button {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}

.edge-toggle::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 6px;
  background: rgba(0, 0, 0, 0.08);
}

.edge-right {
  right: 0;
}

.edge-right::before {
  right: 0;
}

.edge-toggle:hover {
  opacity: 1;
}

.lottery-section {
  background: var(--card);
  border-radius: 24px;
  padding: 72px;
  box-shadow: var(--shadow);
}

.rolling-box {
  background: #fff6f6;
  border-radius: 16px;
  padding: 48px 24px;
  text-align: center;
  font-size: clamp(36px, 4vw, 64px);
  font-weight: 700;
  min-height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.control-buttons {
  margin: 32px 0;
  display: flex;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
}

.primary-btn,
.reset-btn,
.admin-toggle,
.button-group button {
  border: none;
  border-radius: 999px;
  padding: 18px 36px;
  font-size: 22px;
  cursor: pointer;
}

.admin-toggle {
  padding: 10px 20px;
  font-size: 16px;
}

.primary-btn {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 10px 20px rgba(228, 63, 90, 0.3);
}

.primary-btn:hover {
  background: var(--primary-dark);
}

.reset-btn {
  background: #f0f0f0;
  color: var(--text);
}

.rounds-box {
  margin-top: 20px;
}

.rounds-box h2 {
  margin: 0 0 12px;
  font-size: clamp(32px, 2.4vw, 46px);
  letter-spacing: 1px;
}

#roundsList,
#historyList {
  display: grid;
  gap: 12px;
}

.round-item {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(255, 246, 246, 0.92));
  border-radius: 18px;
  padding: 22px 26px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 1px solid rgba(228, 63, 90, 0.18);
  box-shadow: 0 18px 36px rgba(228, 63, 90, 0.08);
  font-size: clamp(20px, 1.6vw, 28px);
}

.round-item .badge {
  font-size: clamp(14px, 1vw, 18px);
  color: rgba(228, 63, 90, 0.7);
  font-weight: 600;
}

.round-item div:last-child {
  font-weight: 700;
  letter-spacing: 0.5px;
}

.admin-panel {
  margin-top: 28px;
  text-align: center;
}

.admin-toggle {
  background: var(--secondary);
  color: #fff;
}

.input-section {
  margin-top: 16px;
  display: grid;
  gap: 12px;
}

.input-section textarea {
  width: 100%;
  min-height: 120px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid #e0e0e0;
  font-size: 14px;
}

 .bob-api-panel {
   margin-top: 12px;
   padding: 12px;
   border-radius: 12px;
   border: 1px solid rgba(58, 134, 255, 0.25);
   background: rgba(58, 134, 255, 0.06);
   display: grid;
   gap: 10px;
 }

 .bob-api-title {
   font-size: 16px;
   font-weight: 700;
   color: rgba(46, 46, 46, 0.9);
 }

 .bob-api-grid {
   display: grid;
   grid-template-columns: 1fr;
   gap: 8px;
 }

 .bob-api-grid label {
   font-size: 14px;
   color: rgba(46, 46, 46, 0.75);
 }

 .bob-api-grid input {
   width: 100%;
   padding: 10px 12px;
   border-radius: 10px;
   border: 1px solid rgba(0, 0, 0, 0.12);
   font-size: 14px;
 }

 .bob-api-actions {
   display: flex;
   justify-content: center;
   gap: 10px;
   flex-wrap: wrap;
 }

 .bob-api-status {
   min-height: 18px;
   font-size: 13px;
   color: rgba(58, 134, 255, 0.95);
   word-break: break-word;
 }

 .bob-user-list {
   max-height: 220px;
   overflow: auto;
   border-radius: 12px;
   border: 1px solid rgba(0, 0, 0, 0.08);
   background: rgba(255, 255, 255, 0.8);
 }

 .bob-user-row {
   padding: 10px 12px;
   border-bottom: 1px solid rgba(0, 0, 0, 0.06);
 }

 .bob-user-row:last-child {
   border-bottom: none;
 }

 .bob-user-name {
   font-size: 14px;
   font-weight: 700;
 }

 .bob-user-meta {
   margin-top: 2px;
   font-size: 12px;
   color: rgba(46, 46, 46, 0.7);
   font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
   word-break: break-all;
 }

.button-group {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.button-group button {
  background: #f7f7f7;
}

footer {
  margin-top: 28px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  padding: 20px;
}

.modal-card {
  background: #fff;
  border-radius: 18px;
  padding: 28px 32px;
  max-width: 520px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow);
}

.modal-card h3 {
  margin: 0 0 12px;
  font-size: 26px;
}

.modal-card p {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 18px;
}

.modal-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
}

@media (max-width: 600px) {
  .lottery-section {
    padding: 20px;
  }

  .rolling-box {
    padding: 20px 12px;
  }
}
