/* 簡約移動端，參考 TipsKing mobile 層級，精簡導航 */
:root {
  --bg: #f4f5f7;
  --card: #fff;
  --text: #1a1a1a;
  --muted: #6b7280;
  --accent: #e85d04;
  --border: #e5e7eb;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  font-family: 'Noto Sans TC', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
}

a {
  color: inherit;
  text-decoration: none;
}

.page-container {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: var(--shadow);
}

.header-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
}

.back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  border-radius: 10px;
  cursor: pointer;
  color: var(--text);
}

.back-btn:active {
  background: var(--bg);
}

.app-title,
.page-title {
  flex: 1;
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
}

.page-title-sub {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 400;
  margin: 0.15rem 0 0;
}

.main-content {
  flex: 1;
  padding: 0.75rem 1rem 1.5rem;
}

.race-row {
  display: block;
  background: var(--card);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  margin-bottom: 0.5rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.race-row:active {
  transform: scale(0.995);
}

.race-row-no {
  display: inline-block;
  min-width: 2rem;
  font-weight: 700;
  color: var(--accent);
  margin-right: 0.5rem;
}

.race-row-detail {
  font-size: 0.95rem;
  line-height: 1.45;
}

/* 頁底風險提示：極小字、置中 */
.bottom-tips {
  text-align: center;
  padding: 0.45rem 0.65rem 0.65rem;
  margin: 0 auto;
  max-width: 100%;
  width: 100%;
  font-size: 10px;
  line-height: 1.4;
  font-weight: 400;
  color: #9ca3af;
}

/* 詳情頁：全場按鈕 */
.global-ai-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
  border: 1px dashed var(--accent);
  border-radius: var(--radius);
  background: #fff7ed;
  color: var(--accent);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.global-ai-btn:active {
  opacity: 0.9;
}

.horse-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

/* 兩行：號碼 | 第一行馬名+賠率+AI（AI 僅在第一行右側）；第二行灰字與馬名左對齊 */
.horse-row {
  display: grid;
  grid-template-columns: 1.35rem 1fr;
  align-items: start;
  gap: 0.25rem 0.45rem;
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 0.5rem 0.65rem;
  box-shadow: var(--shadow);
  font-size: 0.95rem;
  line-height: 1.35;
  color: var(--text);
}

.horse-col-no {
  grid-row: 1 / span 2;
  align-self: center;
  font-weight: 800;
  color: var(--accent);
  text-align: right;
  font-size: 1rem;
  line-height: 1.2;
}

.horse-col-body {
  min-width: 0;
}

.horse-line1 {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.45rem;
  min-width: 0;
}

.horse-name {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  font-size: 1rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.horse-odd {
  flex-shrink: 0;
  font-weight: 600;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
  min-width: 2.25rem;
  text-align: right;
  transition: color 0.2s ease;
}

/* 全場獨贏賠率最低（可並列） */
.horse-odd.horse-odd--fav {
  color: #dc2626;
  font-weight: 700;
}

.horse-line1 .ai-chip {
  flex-shrink: 0;
  margin-left: 0.1rem;
}

.horse-line2 {
  margin-top: 0.2rem;
  font-size: 0.74rem;
  line-height: 1.35;
  color: #868e96;
  font-weight: 400;
}

.ai-chip {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 0.22rem 0.4rem;
  border-radius: 6px;
  background: #1e293b;
  color: #fff;
  cursor: pointer;
  border: none;
  font-family: inherit;
}

.ai-chip:active {
  opacity: 0.85;
}

.empty-state {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%) translateY(120%);
  max-width: min(90vw, 360px);
  padding: 0.65rem 1rem;
  background: #1e293b;
  color: #fff;
  border-radius: 10px;
  font-size: 0.88rem;
  text-align: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s ease, opacity 0.25s ease;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.loading {
  padding: 2rem;
  text-align: center;
  color: var(--muted);
}
