:root {
  --bg: #08111f;
  --bg-soft: #101b30;
  --panel: rgba(16, 27, 48, 0.8);
  --panel-strong: rgba(19, 32, 56, 0.96);
  --text: #f8fafc;
  --text-soft: #cbd5e1;
  --text-faint: #94a3b8;
  --border: rgba(148, 163, 184, 0.18);
  --accent: #facc15;
  --accent-soft: rgba(250, 204, 21, 0.16);
  --success: #22c55e;
  --shadow: 0 24px 60px rgba(2, 8, 23, 0.45);
  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-sm: 16px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(250, 204, 21, 0.16), transparent 30%),
    radial-gradient(circle at top right, rgba(34, 197, 94, 0.12), transparent 26%),
    linear-gradient(180deg, #08111f 0%, #0b1324 45%, #070d18 100%);
  color: var(--text);
  font-family: "Segoe UI", "PingFang SC", "Hiragino Sans GB", sans-serif;
}

body {
  padding: 32px 20px 40px;
}

.page-shell {
  max-width: 1320px;
  margin: 0 auto;
  display: grid;
  gap: 28px;
}

.panel {
  position: relative;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 240px;
  height: 240px;
  background: radial-gradient(circle, rgba(250, 204, 21, 0.18), transparent 70%);
  pointer-events: none;
}

.hero-panel,
.message-panel {
  padding: 28px;
}

.material-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.material-period {
  margin-top: 10px;
  color: var(--text-soft);
  font-size: 15px;
  font-weight: 600;
}

.current-period-button {
  flex-shrink: 0;
  border: 1px solid rgba(250, 204, 21, 0.28);
  background: rgba(250, 204, 21, 0.12);
  color: #fde68a;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 700;
}

.current-period-button.is-hidden {
  display: none;
}

.hero-head,
.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.eyebrow {
  margin: 0 0 10px;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

h1,
h2 {
  margin: 0;
  line-height: 1.15;
}

h1 {
  font-size: clamp(30px, 5vw, 52px);
  max-width: 820px;
}

h2 {
  font-size: clamp(24px, 3vw, 34px);
}

.hero-copy,
.section-copy {
  margin: 14px 0 0;
  color: var(--text-soft);
  max-width: 740px;
  line-height: 1.7;
}

.live-pill,
.status-badge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.live-pill {
  border: 1px solid rgba(34, 197, 94, 0.28);
  background: rgba(34, 197, 94, 0.12);
  color: #dcfce7;
}

.live-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 8px rgba(34, 197, 94, 0.18);
  animation: pulse 1.4s infinite ease-in-out;
}

.macau-board {
  margin-top: 26px;
}

.macau-board-inner {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 18px;
  padding: 18px;
  background: #f8fafc;
  border-radius: 18px;
  border: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.18);
  overflow-x: auto;
}

.macau-issue {
  flex: 0 0 auto;
  font-size: 30px;
  font-weight: 800;
  color: #0f172a;
  white-space: nowrap;
}

.macau-numbers {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.macau-plus {
  flex: 0 0 auto;
  padding: 0 2px;
  color: #e11d48;
  font-size: 38px;
  font-weight: 800;
  line-height: 1;
}

.macau-ball {
  width: 66px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.7);
  background: #e5e7eb;
}

.macau-ball-number {
  padding: 8px 0 6px;
  text-align: center;
  font-size: 24px;
  font-weight: 800;
  color: #ffffff;
}

.macau-ball-zodiac {
  padding: 6px 0 7px;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: #374151;
  background: #e5e7eb;
}

.macau-ball--red .macau-ball-number {
  background: #ef4444;
}

.macau-ball--blue .macau-ball-number {
  background: #2563eb;
}

.macau-ball--green .macau-ball-number {
  background: #16a34a;
}

.macau-ball--neutral .macau-ball-number {
  background: #64748b;
}

.feed-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.message-count {
  color: var(--text-soft);
  font-size: 14px;
}

.status-connecting {
  color: #dbeafe;
  background: rgba(59, 130, 246, 0.16);
  border: 1px solid rgba(59, 130, 246, 0.24);
}

.status-live {
  color: #dcfce7;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.24);
}

.status-reconnecting {
  color: #fef3c7;
  background: rgba(245, 158, 11, 0.16);
  border: 1px solid rgba(245, 158, 11, 0.24);
}

.empty-state {
  margin-top: 22px;
  padding: 22px;
  border-radius: var(--radius-md);
  border: 1px dashed rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.48);
  color: var(--text-faint);
}

.empty-state.is-hidden {
  display: none;
}

.card-container {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px 2px 8px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.history-panel {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid rgba(148, 163, 184, 0.16);
}

.history-title {
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.history-list {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.history-item {
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.42);
  color: var(--text-soft);
  border-radius: 14px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
}

.history-item.is-active {
  border-color: rgba(250, 204, 21, 0.38);
  background: rgba(250, 204, 21, 0.12);
  color: #fde68a;
}

.history-empty {
  color: var(--text-faint);
  font-size: 14px;
}

.card-container::-webkit-scrollbar {
  width: 12px;
}

.card-container::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.54);
  border-radius: 999px;
}

.card-container::-webkit-scrollbar-thumb {
  background: linear-gradient(90deg, rgba(250, 204, 21, 0.72), rgba(34, 197, 94, 0.5));
  border-radius: 999px;
}

.message-card {
  width: 100%;
  max-width: 100%;
  flex: 1 1 auto;
  padding: 20px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.92), rgba(30, 41, 59, 0.88));
  box-shadow: 0 18px 34px rgba(2, 8, 23, 0.34);
  transition: transform 0.25s ease, border-color 0.25s ease;
}

.message-card:hover {
  transform: translateY(-4px);
  border-color: rgba(250, 204, 21, 0.42);
}

.message-card.is-new {
  animation: cardEnter 0.35s ease;
}

.message-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.sequence-badge {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: #fde68a;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.message-time {
  color: var(--text-faint);
  font-size: 13px;
}

.message-content {
  margin: 18px 0 0;
  color: var(--text);
  font-size: 17px;
  line-height: 1.8;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 118px;
}

@keyframes pulse {
  50% {
    opacity: 0.45;
  }
}

@keyframes cardEnter {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 900px) {
  body {
    padding: 20px 14px 28px;
  }

  .hero-panel,
  .message-panel {
    padding: 22px;
  }

  .hero-head,
  .section-head,
  .material-head {
    flex-direction: column;
  }

  .feed-meta {
    justify-content: flex-start;
  }

  .macau-board-inner {
    flex-direction: row;
    align-items: center;
  }

  .message-card {
    width: 100%;
    max-width: 100%;
    flex-basis: auto;
  }
}

@media (max-width: 760px) {
  .macau-board-inner {
    gap: clamp(6px, 1.4vw, 12px);
    padding: 14px 12px;
    overflow-x: hidden;
  }

  .macau-issue {
    flex: 0 1 auto;
    min-width: 0;
    font-size: clamp(12px, 3.8vw, 14px);
  }

  .macau-numbers {
    flex: 1 1 auto;
    min-width: 0;
    justify-content: flex-start;
    gap: clamp(3px, 0.8vw, 6px);
  }

  .macau-ball {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
  }

  .macau-ball-number {
    padding: 6px 0 4px;
    font-size: clamp(16px, 3.4vw, 20px);
  }

  .macau-ball-zodiac {
    padding: 4px 0 5px;
    font-size: clamp(10px, 1.8vw, 12px);
  }

  .macau-plus {
    flex: 0 0 auto;
    font-size: clamp(22px, 4.2vw, 28px);
  }
}

@media (max-width: 560px) {
  .macau-board-inner {
    gap: clamp(4px, 1.6vw, 8px);
    padding: 12px 10px;
    overflow-x: hidden;
  }

  .macau-issue {
    flex: 0 1 auto;
    min-width: 0;
    font-size: clamp(10px, 4vw, 14px);
  }

  .macau-numbers {
    flex: 1 1 auto;
    min-width: 0;
    justify-content: flex-start;
    gap: clamp(2px, 0.9vw, 4px);
  }

  .macau-ball {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
  }

  .macau-ball-number {
    padding: 4px 0 3px;
    font-size: clamp(12px, 4vw, 16px);
  }

  .macau-ball-zodiac {
    padding: 3px 0 4px;
    font-size: clamp(8px, 2.4vw, 10px);
  }

  .macau-plus {
    flex: 0 0 auto;
    font-size: clamp(18px, 5vw, 24px);
  }

  .card-container {
    gap: 14px;
  }

  .message-card {
    width: 100%;
    max-width: 100%;
    flex-basis: auto;
  }
}

@media (max-width: 390px) {
  .macau-board-inner {
    gap: 6px;
    padding: 10px 8px;
  }

  .macau-numbers {
    flex: 1 1 auto;
    gap: 3px;
  }

  .macau-ball-number {
    font-size: 15px;
  }

  .macau-ball-zodiac {
    font-size: 9px;
  }

  .macau-issue {
    font-size: clamp(10px, 3.8vw, 14px);
  }

  .macau-plus {
    font-size: 22px;
  }
}
