/* 導入現代 Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+HK:wght@200;300;400;500;600;700;800;900&display=swap');

/* 全域變數與主題色調 */
:root {
  --bg-dark: #080C14;
  --bg-card: rgba(17, 24, 39, 0.7);
  --border-color: rgba(255, 255, 255, 0.08);
  --text-main: #F3F4F6;
  --text-muted: #9CA3AF;
  
  /* 炫彩漸層與主色 */
  --primary-gradient: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
  --secondary-gradient: linear-gradient(135deg, #3B82F6 0%, #1D4ED8 100%);
  --success-gradient: linear-gradient(135deg, #10B981 0%, #047857 100%);
  --danger-gradient: linear-gradient(135deg, #EF4444 0%, #B91C1C 100%);
  
  --gold: #FFD700;
  --green: #10B981;
  --blue: #3B82F6;
  --red: #EF4444;
}

/* 基礎重設 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Noto Serif HK', 'Noto Sans TC', sans-serif;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-dark);
  color: var(--text-main);
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(59, 130, 246, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(245, 158, 11, 0.06) 0%, transparent 45%);
  background-attachment: fixed;
  line-height: 1.6;
  padding-bottom: 60px;
}

.lead-gate {
  order: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  margin: 20px auto 0;
  width: min(100%, 1200px);
}

.lead-gate-card {
  width: 100%;
  background: rgba(14, 21, 34, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  padding: 32px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.lead-gate-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 215, 0, 0.12);
  color: var(--gold);
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 16px;
}

.lead-gate-card h2 {
  font-size: 1.8rem;
  line-height: 1.3;
  margin-bottom: 12px;
  color: var(--text-main);
}

.lead-gate-copy {
  color: var(--text-muted);
  margin-bottom: 22px;
  font-size: 0.98rem;
}

.lead-gate-form {
  display: grid;
  gap: 12px;
}

.lead-gate-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
  margin-top: 4px;
}

.lead-gate-input {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  border-radius: 14px;
  padding: 14px 16px;
  font: inherit;
  outline: none;
}

.lead-gate-input:focus {
  border-color: rgba(255, 215, 0, 0.8);
  box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.14);
}

.lead-gate-consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
  margin-top: 6px;
}

.lead-gate-consent input {
  margin-top: 4px;
  accent-color: var(--gold);
}

.lead-gate-button {
  margin-top: 8px;
  border: none;
  border-radius: 14px;
  padding: 14px 18px;
  background: var(--primary-gradient);
  color: #111827;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.lead-gate-note {
  color: var(--text-muted);
  font-size: 0.82rem;
  text-align: center;
}

header {
  order: 1;
}

.container {
  order: 2;
}

/* 容器與佈局 */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* 頂部標題 */
header {
  text-align: center;
  padding: 40px 0 20px 0;
}

header h1 {
  font-family: 'Noto Serif HK', 'Noto Sans TC', sans-serif;
  font-size: 2.8rem;
  font-weight: 800;
  background: linear-gradient(135deg, #FFF 30%, #FFD700 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 10px;
  letter-spacing: 1px;
}

header p {
  color: var(--text-muted);
  font-size: 1.1rem;
  max-width: 600px;
  margin: 0 auto;
}

/* 玻璃擬物風卡片基礎樣式 */
.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 12px 40px 0 rgba(59, 130, 246, 0.15);
  transform: translateY(-2px);
}

.main-layout > .glass-card:first-child {
  position: sticky;
  top: 20px;
  max-height: calc(100vh - 40px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.main-layout > .glass-card:first-child > .match-list {
  overflow-y: auto;
  padding-right: 8px;
  margin-right: -8px;
}

.main-layout > .glass-card:first-child > .section-title,
.main-layout > .glass-card:first-child > p {
  flex: 0 0 auto;
}

/* 主要區段排版 */
.main-layout {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 24px;
  margin-top: 30px;
  align-items: start;
}

@media (max-width: 968px) {
  .main-layout {
    grid-template-columns: 1fr;
  }
}

/* 區段標題 */
.section-title {
  font-family: 'Noto Serif HK', 'Noto Sans TC', sans-serif;
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title i {
  color: var(--gold);
}

/* 賽事看板區 */
.match-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 215, 0, 0.45) rgba(255, 255, 255, 0.05);
}

.match-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.match-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 10px;
}

.match-tag {
  background: var(--primary-gradient);
  color: #000;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  text-transform: uppercase;
}

.match-time {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.teams-container {
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 10px 0;
}

.team {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 35%;
  text-align: center;
}

.team-flag {
  font-size: 2.2rem;
}

.team-name {
  font-weight: 600;
  font-size: 1rem;
}

.vs-badge {
  font-family: 'Noto Serif HK', 'Noto Sans TC', sans-serif;
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 6px 12px;
  border-radius: 50%;
}

/* 賠率表格區 */
.odds-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  font-size: 0.82rem;
}

.odds-table th, .odds-table td {
  padding: 8px 4px;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.odds-table th {
  color: var(--text-muted);
  font-weight: 500;
}

.odds-value {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 5px 4px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.odds-value:hover {
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.3);
  color: #fff;
}

/* 高亮最優賠率 */
.best-odds {
  background: rgba(16, 185, 129, 0.15) !important;
  border: 1px solid rgba(16, 185, 129, 0.4) !important;
  color: var(--green) !important;
}

/* 套利機會警示徽章 */
.arb-alert {
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid var(--green);
  color: var(--green);
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  width: fit-content;
}

/* 分析工具面板 */
.tab-container {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  background: rgba(0, 0, 0, 0.2);
  padding: 4px;
  border-radius: 10px;
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 12px;
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.tab-btn.active {
  background: var(--secondary-gradient);
  color: #fff;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.tool-panel {
  display: none;
}

.tool-panel.active {
  display: block;
  animation: fadeIn 0.3s ease-out;
}

.tool-panel {
  min-height: 0;
}

/* 輸入框與表單樣式 */
.input-group {
  margin-bottom: 18px;
}

.input-group label {
  display: block;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 500;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.input-control {
  width: 100%;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  color: #fff;
  padding: 12px 12px 12px 35px;
  border-radius: 10px;
  font-size: 1rem;
  transition: all 0.2s;
}

.input-control:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* 按鈕樣式 */
.btn-primary {
  width: 100%;
  background: var(--primary-gradient);
  color: #000;
  border: none;
  padding: 14px;
  font-size: 1rem;
  font-weight: 700;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4);
}

.btn-primary:active {
  transform: translateY(1px);
}

/* 分析結果區域 */
.result-card {
  margin-top: 24px;
  background: linear-gradient(180deg, rgba(17, 24, 39, 0.82), rgba(9, 14, 25, 0.9));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 22px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.result-card .result-header {
  font-size: 1.15rem;
}

.result-header {
  font-weight: 600;
  font-size: 1.1rem;
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 15px;
}

.result-item {
  background: rgba(0, 0, 0, 0.2);
  padding: 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.result-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.result-value {
  font-size: 1.3rem;
  font-weight: 700;
  margin-top: 4px;
  font-family: 'Noto Serif HK', 'Noto Sans TC', sans-serif;
}

.value-green { color: var(--green); }
.value-blue { color: var(--blue); }
.value-gold { color: var(--gold); }
.value-red { color: var(--red); }

.result-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 10px;
}

.terminal-box {
  background:
    radial-gradient(circle at top left, rgba(16, 185, 129, 0.08), transparent 28%),
    #020617;
  border: 1px solid rgba(52, 211, 153, 0.18);
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.6), 0 10px 30px rgba(0, 0, 0, 0.28);
}

.terminal-line {
  font-variant-numeric: tabular-nums;
}

.markdown-table {
  font-size: 0.82rem;
}

.markdown-table th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.knowledge-section {
  margin-top: 48px;
}

.accordion-item {
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.16);
}

.accordion-content {
  line-height: 1.75;
}

@media (max-width: 968px) {
  .main-layout > .glass-card:first-child {
    position: static;
    max-height: none;
    overflow: visible;
  }

  .main-layout > .glass-card:first-child > .match-list {
    overflow: visible;
    margin-right: 0;
    padding-right: 0;
  }
}

/* 學術知識庫區 */
.knowledge-section {
  margin-top: 40px;
}

.accordion-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  margin-bottom: 12px;
  overflow: hidden;
}

.accordion-header {
  padding: 18px 24px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
  transition: background 0.2s;
}

.accordion-header:hover {
  background: rgba(255, 255, 255, 0.02);
}

.accordion-header .arrow {
  transition: transform 0.3s;
}

.accordion-item.active .accordion-header .arrow {
  transform: rotate(180deg);
}

.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out, padding 0.3s ease-out;
  padding: 0 24px;
  border-top: 0px solid transparent;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.accordion-item.active .accordion-content {
  max-height: 500px;
  padding: 18px 24px;
  border-top: 1px solid var(--border-color);
}

.formula-box {
  background: rgba(0, 0, 0, 0.3);
  padding: 15px;
  border-radius: 8px;
  text-align: center;
  font-family: 'Noto Serif HK', 'Noto Sans TC', sans-serif;
  font-size: 1.2rem;
  color: var(--gold);
  margin: 15px 0;
  border-left: 4px solid var(--gold);
}

.accordion-content ul {
  padding-left: 20px;
  margin-top: 10px;
}

.accordion-content li {
  margin-bottom: 6px;
}

/* 淡入動畫 */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================
// 7. CrewAI 虛擬爬蟲控制台風格
// ========================================== */

/* Code Block 程式碼區塊樣式 */
.code-block-wrapper {
  margin: 15px 0;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.code-block-header {
  background: rgba(0, 0, 0, 0.4);
  padding: 8px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
}

.code-block-header span {
  font-family: monospace;
}

.code-block-content {
  background: rgba(2, 6, 23, 0.8);
  padding: 16px;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 0.8rem;
  color: #E2E8F0;
  overflow-x: auto;
  white-space: pre;
  line-height: 1.5;
}

/* 虛擬終端機樣式 */
.terminal-box {
  background: #020617;
  border: 1px solid #1E293B;
  border-radius: 10px;
  padding: 16px;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 0.82rem;
  color: #34D399; /* 亮翠綠色 */
  max-height: 250px;
  overflow-y: auto;
  margin-top: 15px;
  box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.9);
}

.terminal-line {
  margin-bottom: 6px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-all;
}

/* Markdown 表格樣式 */
.markdown-table {
  width: 100%;
  border-collapse: collapse;
  margin: 15px 0;
  font-size: 0.85rem;
}

.markdown-table th, .markdown-table td {
  border: 1px solid var(--border-color);
  padding: 8px 12px;
  text-align: left;
}

.markdown-table th {
  background: rgba(255, 255, 255, 0.05);
  font-weight: 600;
  color: var(--gold);
}

/* 一鍵帶入跨平台最優賠率按鈕 */
.btn-action-best {
  background: rgba(255, 215, 0, 0.06);
  border: 1px dashed var(--gold);
  color: var(--gold);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  width: 100%;
  justify-content: center;
  margin-top: 8px;
}

.btn-action-best:hover {
  background: var(--primary-gradient);
  color: #000;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(255, 215, 0, 0.35);
  transform: translateY(-1px);
}

.btn-action-best:active {
  transform: translateY(1px);
}

/* UI polish overrides */
.main-layout {
  align-items: start;
}

.main-layout > .glass-card:first-child {
  position: sticky;
  top: 20px;
  max-height: calc(100vh - 40px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.main-layout > .glass-card:first-child > .match-list {
  overflow-y: auto;
  padding-right: 8px;
  margin-right: -8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 215, 0, 0.45) rgba(255, 255, 255, 0.05);
}

.tool-panel {
  min-height: 0;
}

.result-card {
  background: linear-gradient(180deg, rgba(17, 24, 39, 0.82), rgba(9, 14, 25, 0.9));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 22px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.terminal-box {
  background:
    radial-gradient(circle at top left, rgba(16, 185, 129, 0.08), transparent 28%),
    #020617;
  border: 1px solid rgba(52, 211, 153, 0.18);
  border-radius: 14px;
  padding: 18px;
  box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.7), 0 10px 30px rgba(0, 0, 0, 0.25);
  max-height: 280px;
}

.terminal-line {
  font-variant-numeric: tabular-nums;
}

.markdown-table {
  font-size: 0.82rem;
}

.markdown-table th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.knowledge-section {
  margin-top: 48px;
}

.accordion-item {
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.16);
}

.accordion-content {
  line-height: 1.75;
}

@media (max-width: 968px) {
  .main-layout > .glass-card:first-child {
    position: static;
    max-height: none;
    overflow: visible;
  }

  .main-layout > .glass-card:first-child > .match-list {
    overflow: visible;
    margin-right: 0;
    padding-right: 0;
  }
}

/* 輸入框警告提示泡 */
.input-warning-tip {
  background: rgba(245, 158, 11, 0.08);
  border-left: 3px solid var(--gold);
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 0.82rem;
  color: var(--gold);
  margin-top: 10px;
  line-height: 1.45;
}
