/* ═══════════════════════════════════════════
   168开奖网 — Light Theme Stylesheet
   ═══════════════════════════════════════════ */

:root {
  --bg-primary:   #f0f2f5;
  --bg-secondary: #ffffff;
  --bg-card:      #ffffff;
  --bg-card-head: #f7f8fa;
  --bg-hover:     #f0f4ff;
  --border:       #e2e6ea;
  --accent:       #e6394a;
  --accent-glow:  rgba(230, 57, 74, .18);
  --blue:         #1677ff;
  --green:        #0aad5a;
  --yellow:       #d48806;
  --text:         #1d2129;
  --text-dim:     #6b7785;
  --text-muted:   #a0aab4;
  --radius:       10px;
  --radius-sm:    6px;
  --shadow:       0 4px 16px rgba(0,0,0,.08);
  --shadow-card:  0 1px 4px rgba(0,0,0,.06);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  background: var(--bg-primary);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
  width: 100%;
}

/* ─── Header ─── */
.header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-icon { width: 28px; height: 28px; color: var(--accent); flex-shrink: 0; }

.logo-text {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.5px;
}

.logo-text em {
  font-style: normal;
  color: var(--text);
  font-weight: 600;
}

.server-time {
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: .95rem;
  color: var(--text-dim);
  background: var(--bg-primary);
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
}

.notice-bar {
  background: linear-gradient(90deg, var(--accent) 0%, #b91c30 100%);
  color: #fff;
  font-size: .82rem;
  height: 28px;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.notice-bar .container { display: flex; align-items: center; gap: 8px; }

.notice-tag {
  background: rgba(255,255,255,.25);
  padding: 1px 8px;
  border-radius: 3px;
  font-weight: 600;
  flex-shrink: 0;
}

.notice-bar marquee { flex: 1; }

/* ─── Nav Tabs ─── */
.nav-tabs {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 84px;
  z-index: 99;
}

.tabs-inner {
  display: flex;
  gap: 4px;
  padding-top: 6px;
  padding-bottom: 6px;
  overflow-x: auto;
}

.tab {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-dim);
  font-size: .92rem;
  font-weight: 500;
  padding: 8px 20px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 5px;
}

.tab:hover {
  color: var(--text);
  background: var(--bg-primary);
}

.tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 2px 8px var(--accent-glow);
}

.tab-icon { width: 18px; height: 18px; flex-shrink: 0; }

/* ─── Main ─── */
.main-content {
  flex: 1;
  padding-top: 20px;
  padding-bottom: 40px;
}

.lottery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 16px;
}

/* ─── Lottery Card ─── */
.lottery-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .2s, box-shadow .2s;
  box-shadow: var(--shadow-card);
}

.lottery-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.card-header {
  background: var(--bg-card-head);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.card-lottery-name {
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.card-lottery-name .cat-icon { width: 20px; height: 20px; flex-shrink: 0; color: var(--accent); }

.card-issue {
  font-size: .78rem;
  color: var(--text-dim);
  background: var(--bg-primary);
  padding: 2px 10px;
  border-radius: 12px;
}

.card-body { padding: 14px 16px; }

.card-timer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.timer-label {
  font-size: .82rem;
  color: var(--text-dim);
}

.timer-value {
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--green);
  letter-spacing: 1px;
}

.timer-value.urgent { color: var(--accent); animation: blink 1s infinite; }

@keyframes blink { 50% { opacity: .5; } }

.drawing-badge {
  background: var(--accent);
  color: #fff;
  font-size: .72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: .6; }
}

/* ─── Balls ─── */
.balls-row {
  display: flex;
  gap: 4px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.ball {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .82rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,.3);
  box-shadow: inset 0 -2px 4px rgba(0,0,0,.2), 0 2px 6px rgba(0,0,0,.12);
  position: relative;
  transition: transform .15s;
}

.ball::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 6px;
  width: 10px;
  height: 6px;
  background: rgba(255,255,255,.4);
  border-radius: 50%;
}

.ball:hover { transform: scale(1.15); }

.ball-1  { background: linear-gradient(135deg, #ffe44d, #d4a800); color: #4a3800; text-shadow: none; }
.ball-2  { background: linear-gradient(135deg, #5ba0f5, #1a6bd4); }
.ball-3  { background: linear-gradient(135deg, #6e6e6e, #3a3a3a); }
.ball-4  { background: linear-gradient(135deg, #ff9a3e, #e06000); }
.ball-5  { background: linear-gradient(135deg, #3ee0c8, #00a08a); }
.ball-6  { background: linear-gradient(135deg, #7b6bde, #4a3aad); }
.ball-7  { background: linear-gradient(135deg, #c8c8c8, #8a8a8a); color: #333; text-shadow: none; }
.ball-8  { background: linear-gradient(135deg, #ff5a5a, #d40000); }
.ball-9  { background: linear-gradient(135deg, #b04060, #7a0020); }
.ball-10 { background: linear-gradient(135deg, #50d870, #1a9a3a); }

.ball-placeholder {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-primary);
  border: 2px dashed var(--border);
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0%, 100% { opacity: .4; }
  50%      { opacity: .8; }
}

/* ─── Stats Row ─── */
.stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
  font-size: .78rem;
}

.stat-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.stat-badge .label { color: var(--text-dim); }
.stat-badge .value { font-weight: 700; }
.stat-badge .big    { color: var(--accent); }
.stat-badge .small  { color: var(--blue); }
.stat-badge .odd    { color: var(--accent); }
.stat-badge .even   { color: var(--blue); }
.stat-badge .dragon { color: var(--accent); }
.stat-badge .tiger  { color: var(--blue); }
.stat-badge .draw   { color: var(--yellow); }

/* ─── Dragon Tiger Row ─── */
.dt-row {
  display: flex;
  gap: 3px;
  justify-content: center;
  margin-bottom: 12px;
}

.dt-cell {
  flex: 1;
  text-align: center;
  padding: 3px 0;
  border-radius: var(--radius-sm);
  font-size: .72rem;
  font-weight: 700;
}

.dt-cell.dragon { background: rgba(230, 57, 74, .1); color: var(--accent); }
.dt-cell.tiger  { background: rgba(22, 119, 255, .1); color: var(--blue); }
.dt-cell.draw   { background: rgba(212, 136, 6, .1); color: var(--yellow); }

/* ─── Card Actions ─── */
.card-actions {
  display: flex;
  gap: 8px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.card-actions button {
  flex: 1;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: .82rem;
  padding: 7px 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all .2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.btn-icon { width: 15px; height: 15px; flex-shrink: 0; }

.card-actions button:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ─── Loading ─── */
.loading-state {
  text-align: center;
  padding: 60px 0;
  color: var(--text-dim);
  grid-column: 1 / -1;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin: 0 auto 12px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Modal ─── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s, visibility .25s;
}

.modal.open { opacity: 1; visibility: visible; }

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.35);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 92%;
  max-width: 720px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0,0,0,.12);
  animation: slideUp .3s ease-out;
}

.modal-wide { max-width: 960px; }

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 { font-size: 1.05rem; font-weight: 700; }

.modal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}

.modal-close:hover { color: var(--accent); }

.modal-toolbar {
  display: flex;
  gap: 10px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card-head);
}

.modal-toolbar select {
  background: var(--bg-secondary);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: .85rem;
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

/* ─── Trend Tabs ─── */
.trend-tabs {
  display: flex;
  gap: 0;
  padding: 0 20px;
  background: var(--bg-card-head);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  flex-shrink: 0;
}

.trend-tabs:empty { display: none; }

.trend-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-dim);
  font-size: .82rem;
  font-weight: 500;
  padding: 10px 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s;
}

.trend-tab:hover { color: var(--text); background: var(--bg-hover); }

.trend-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

@media (max-width: 480px) {
  .trend-tabs { padding: 0 10px; }
  .trend-tab { padding: 8px 10px; font-size: .78rem; }
}

/* ─── History Table ─── */
.history-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: .82rem;
}

.history-table thead th {
  position: sticky;
  top: 0;
  background: var(--bg-card-head);
  color: var(--text-dim);
  font-weight: 600;
  text-align: center;
  padding: 8px 6px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

.history-table tbody td {
  text-align: center;
  padding: 8px 6px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.history-table tbody tr:hover { background: var(--bg-hover); }

.history-table .balls-cell {
  display: flex;
  gap: 3px;
  justify-content: center;
}

.history-table .ball {
  width: 24px;
  height: 24px;
  font-size: .7rem;
}

.history-table .ball::before {
  top: 2px;
  left: 4px;
  width: 8px;
  height: 4px;
}

/* ─── Trend Table ─── */
.trend-section { margin-bottom: 24px; }

.trend-section h3 {
  font-size: .95rem;
  margin-bottom: 10px;
  color: var(--text);
  padding-left: 8px;
  border-left: 3px solid var(--accent);
}

.trend-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: .75rem;
}

.trend-table th {
  position: sticky;
  top: 0;
  background: var(--bg-card-head);
  color: var(--text-dim);
  font-weight: 600;
  text-align: center;
  padding: 6px 3px;
  border-bottom: 2px solid var(--border);
}

.trend-table td {
  text-align: center;
  padding: 4px 2px;
  border-bottom: 1px solid var(--border);
  min-width: 26px;
}

.trend-table tbody tr:hover { background: var(--bg-hover); }

.trend-hit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-weight: 700;
  color: #fff;
  font-size: .7rem;
}

.trend-miss { color: var(--text-muted); font-size: .7rem; }

.stat-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.stat-item {
  background: var(--bg-card-head);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  text-align: center;
  min-width: 80px;
}

.stat-item .num {
  font-size: 1.1rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.stat-item .desc {
  font-size: .72rem;
  color: var(--text-dim);
  margin-top: 2px;
}

.hot-tag { color: var(--accent); }
.cold-tag { color: var(--blue); }

/* ─── Sum Trend ─── */
.sum-chart {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-bottom: 16px;
}

.sum-cell {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-size: .7rem;
  font-weight: 700;
}

.sum-big  { background: rgba(230, 57, 74, .12); color: var(--accent); }
.sum-small { background: rgba(22, 119, 255, .12); color: var(--blue); }

/* ─── Footer ─── */
.footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  text-align: center;
  padding: 16px;
  color: var(--text-muted);
  font-size: .82rem;
  margin-top: auto;
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ─── Responsive ─── */
@media (max-width: 768px) {
  html { font-size: 13px; }

  .header-inner { height: 48px; }
  .logo-text { font-size: 1.25rem; }

  .nav-tabs { top: 76px; }

  .tabs-inner { gap: 2px; }
  .tab { padding: 6px 14px; font-size: .85rem; }

  .lottery-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .ball {
    width: 28px;
    height: 28px;
    font-size: .75rem;
  }

  .modal-content { width: 98%; max-height: 90vh; }
  .modal-body { padding: 12px; }

  .history-table .ball { width: 20px; height: 20px; font-size: .65rem; }
  .history-table .ball::before { display: none; }
}

@media (max-width: 480px) {
  .container { padding: 0 10px; }
  .balls-row { gap: 3px; }
  .ball { width: 26px; height: 26px; font-size: .7rem; }
  .stats-row { gap: 4px; }
  .stat-badge { padding: 2px 7px; font-size: .72rem; }
  .dt-cell { font-size: .65rem; }
}
