/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", sans-serif;
  background: #f5f6f7;
  color: #333;
  line-height: 1.5;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ===== Header ===== */
header {
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  padding: 16px 0;
}

header .container {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.site-logo-img {
  flex-shrink: 0;
  border-radius: 7px;
}

header h1 {
  font-size: 1.4rem;
  font-weight: 700;
  color: #111;
}

.site-title-group {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.site-subtitle {
  font-size: 0.75rem;
  color: #888;
  font-weight: 400;
  line-height: 1;
}

.match-day-label {
  font-size: 0.85rem;
  color: #888;
}

.nav-links {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-left: auto;
}

.stats-link {
  font-size: 0.85rem;
  font-weight: 600;
  color: #1a7c3a;
  text-decoration: none;
  white-space: nowrap;
  padding: 5px 12px;
  border-radius: 20px;
  border: 1.5px solid #1a7c3a;
  background: transparent;
}

.stats-link:hover { background: #f0fdf4; }

.history-link {
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  background: #1a7c3a;
  text-decoration: none;
  white-space: nowrap;
  padding: 5px 12px;
  border-radius: 20px;
  border: 1.5px solid #1a7c3a;
}

.history-link:hover {
  background: #155f2d;
  border-color: #155f2d;
}

.back-link {
  font-size: 0.85rem;
  color: #888;
  text-decoration: none;
  white-space: nowrap;
}

.back-link:hover { color: #333; }

/* ===== Date Selector ===== */
.date-selector {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  margin-top: 8px;
  background: #f0fdf4;
  border: 1.5px solid #86efac;
  border-radius: 10px;
}

.date-selector label {
  font-size: 0.95rem;
  font-weight: 600;
  color: #166534;
  white-space: nowrap;
}

.date-selector select {
  font-size: 0.95rem;
  padding: 6px 12px;
  border: 1.5px solid #4ade80;
  border-radius: 8px;
  background: #fff;
  color: #166534;
  cursor: pointer;
  font-weight: 500;
}

.history-label {
  margin: 12px 0 4px;
}

.site-desc {
  font-size: 0.82rem;
  color: #aaa;
  padding: 6px 0 2px;
  border-top: 1px solid #f3f4f6;
  margin-top: 4px;
}

/* ===== Stats ===== */
.stats {
  margin: 16px 0 12px;
  font-size: 0.9rem;
  color: #555;
}

/* ===== Result Stats ===== */
.result-stats {
  margin-top: 6px;
  font-size: 0.85rem;
  color: #555;
}

.result-correct { color: #16a34a; font-weight: 600; }
.result-wrong   { color: #6b7280; font-weight: 600; }
.result-red     { color: #dc2626; font-weight: 600; }
.result-black   { color: #374151; font-weight: 600; }

/* ===== Update Note ===== */
.update-note {
  margin-top: 8px;
  padding: 6px 12px;
  background: #fef2f2;
  border-left: 3px solid #ef4444;
  border-radius: 4px;
  font-size: 0.85rem;
  color: #b91c1c;
  font-weight: 500;
}

.update-notes {
  margin-top: 8px;
  padding: 6px 12px;
  background: #f8fafc;
  border-left: 3px solid #94a3b8;
  border-radius: 4px;
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.update-note-item { font-weight: 500; color: #64748b; }
.update-note-item.updated { color: #16a34a; }
.update-note-item.pending { color: #94a3b8; }

/* ===== Match List ===== */
.match-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 32px;
}

/* ===== Section Divider ===== */
.section-divider {
  font-size: 0.8rem;
  font-weight: 600;
  color: #888;
  padding: 4px 8px;
  background: #f3f4f6;
  border-radius: 4px;
  letter-spacing: 0.05em;
}

.live-divider {
  color: #16a34a;
  background: #f0fdf4;
}

/* ===== Match Card ===== */
.match-card {
  background: #fff;
  border-radius: 8px;
  border-top: 1px solid #e5e7eb;
  border-right: 1px solid #e5e7eb;
  border-bottom: 1px solid #e5e7eb;
  border-left: 4px solid transparent;
  padding: 14px 16px;
}

.match-card.recommended {
  border-left-color: #f97316;
  background: #fffbf7;
}

/* Card Header row */
.match-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.star {
  color: #f97316;
  font-size: 1rem;
  line-height: 1;
}

.league {
  font-size: 0.8rem;
  font-weight: 600;
  color: #555;
  background: #f3f4f6;
  padding: 2px 6px;
  border-radius: 4px;
}

.match-time {
  margin-left: auto;
  font-size: 0.85rem;
  color: #888;
}

/* Teams */
.teams {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: #111;
}

.vs {
  font-weight: 400;
  color: #aaa;
  margin: 0 6px;
  font-size: 0.9rem;
}

/* Odds row */
.odds {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 0.88rem;
  color: #444;
  margin-bottom: 4px;
}

.odds span { white-space: nowrap; }

/* Extra row (handicap / ou) */
.extra {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: #888;
  margin-bottom: 4px;
}

/* Comment */
.comment {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 8px 12px;
  background: #fff7ed;
  border-left: 3px solid #f97316;
  border-radius: 4px;
  font-size: 0.88rem;
  color: #92400e;
}

.comment-text {
  flex: 1;
  line-height: 1.6;
}

/* ===== Score ===== */
.score-ft {
  font-size: 1.1rem;
  font-weight: 700;
  color: #111;
  margin: 0 8px;
  letter-spacing: 0.05em;
}

.score-sub {
  font-size: 0.78rem;
  color: #666;
  font-weight: 400;
  margin-left: 10px;
}

/* ===== Stamps ===== */
.stamp-group {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.stamp {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2.5px solid;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 700;
  opacity: 0.82;
  flex-shrink: 0;
  letter-spacing: 0;
}

.stamp-red        { color: #dc2626; border-color: #dc2626; }
.stamp-black      { color: #374151; border-color: #374151; }
.stamp-gray       { color: #9ca3af; border-color: #9ca3af; }
.stamp-red-half   { color: #dc2626; border-color: #dc2626; border-style: dashed; opacity: 0.75; }
.stamp-black-half { color: #374151; border-color: #374151; border-style: dashed; opacity: 0.75; }

/* ===== Error ===== */
.error-msg {
  padding: 16px;
  color: #b91c1c;
  background: #fef2f2;
  border-radius: 8px;
  font-size: 0.9rem;
}

/* ===== QR FAB & Modal ===== */
.qr-fab {
  position: fixed;
  bottom: 24px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: #1a7c3a;
  color: #fff;
  border: none;
  border-radius: 24px;
  padding: 10px 16px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.18);
  z-index: 100;
  transition: background 0.15s;
}
.qr-fab:hover { background: #155f2d; }

.qr-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
.qr-modal[hidden] { display: none; }

.qr-modal-box {
  position: relative;
  background: #fff;
  border-radius: 12px;
  padding: 28px 24px 20px;
  max-width: 360px;
  width: calc(100% - 40px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.22);
  text-align: center;
}

.qr-modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  font-size: 1.4rem;
  color: #aaa;
  cursor: pointer;
  line-height: 1;
  padding: 2px 6px;
}
.qr-modal-close:hover { color: #555; }

.qr-modal-title {
  font-size: 1rem;
  font-weight: 600;
  color: #111;
  margin-bottom: 14px;
}

.qr-modal-img {
  width: 100%;
  max-width: 200px;
  border-radius: 8px;
  display: block;
  margin: 0 auto;
}

/* ===== Footer ===== */
footer {
  border-top: 1px solid #e5e7eb;
  padding: 16px 0;
  text-align: center;
  font-size: 0.8rem;
  color: #aaa;
}

/* ===== Stats Table Page ===== */
.stats-table-wrap {
  overflow-x: auto;
  margin-top: 16px;
  margin-bottom: 32px;
  border-radius: 10px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.08);
}

.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  white-space: nowrap;
  background: #fff;
}

.stats-table thead th {
  background: #1a7c3a;
  color: #fff;
  padding: 9px 12px;
  text-align: center;
  font-weight: 600;
  font-size: 0.82rem;
}

.stats-table td {
  padding: 7px 12px;
  text-align: center;
  border-bottom: 1px solid #f3f4f6;
}

.row-day:hover td { background: #f9fafb; }

.row-week-header td {
  background: #f0fdf4;
  color: #166534;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 5px 12px;
  text-align: left;
  letter-spacing: 0.03em;
}

.row-week td {
  background: #dcfce7;
  font-weight: 600;
  color: #166534;
  border-bottom: 2px solid #86efac;
}

.row-total td {
  background: #166534;
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  border-bottom: 2px solid #1a7c3a;
}

.pnl-pos { color: #16a34a; font-weight: 600; }
.pnl-neg { color: #dc2626; font-weight: 600; }
.pnl-zero { color: #9ca3af; }
.row-total .pnl-pos { color: #bbf7d0; }
.row-total .pnl-neg { color: #fca5a5; }
.row-total .pnl-zero { color: #d1d5db; }
.row-week .pnl-pos { color: #15803d; }
.row-week .pnl-neg { color: #b91c1c; }

/* ===== Responsive ===== */
@media (max-width: 480px) {
  header h1 { font-size: 1.2rem; }
  .teams { font-size: 0.98rem; }
  .odds { gap: 10px; font-size: 0.83rem; }
  .extra { gap: 10px; font-size: 0.8rem; }
}
