:root {
  --brand-green: #0b3d19;
  --brand-green-light: #eaffea;
  --brand-accent: #4caf50;
  --text-dark: #1a1a1a;
  --border: #d7e5d9;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #f4f7f4;
  color: var(--text-dark);
  padding-bottom: 40px;
}

.app-header {
  background: var(--brand-green);
  color: #fff;
  padding: 14px 16px 18px;
  position: sticky;
  top: 0;
  z-index: 10;
}

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

.logo {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: #fff;
}

.header-text { flex: 1; }
.header-text h1 { font-size: 18px; margin: 0; }
.header-text p { font-size: 12px; margin: 2px 0 0; opacity: 0.85; }

.icon-btn {
  background: rgba(255,255,255,0.15);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 18px;
  color: #fff;
  cursor: pointer;
}
.icon-btn.active { background: var(--brand-accent); }

.bet-now-btn {
  display: inline-block;
  background: var(--brand-accent);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  text-decoration: none;
  padding: 10px 16px;
  border-radius: 20px;
  white-space: nowrap;
}
.bet-now-btn:active { opacity: 0.85; }

.meeting-bet-btn {
  display: block;
  text-align: center;
  margin: 4px 8px 10px;
  padding: 11px 12px;
  background: var(--brand-green);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  text-decoration: none;
  border-radius: 8px;
}
.meeting-bet-btn:active { opacity: 0.85; }

.toolbar {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

#search-input, #filter-select {
  border: none;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
}

#search-input { flex: 1; }

.meetings-container {
  max-width: 720px;
  margin: 16px auto;
  padding: 0 12px;
}

.status-msg {
  text-align: center;
  color: #666;
  padding: 30px 0;
}

.event-tips {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 14px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.event-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--brand-green-light);
  border: none;
  padding: 14px 16px;
  text-align: left;
  cursor: pointer;
  font-size: 15px;
}

.event-toggle-title { font-weight: 600; flex: 1; }
.event-toggle-meta { font-size: 12px; color: #4a4a4a; }

.fav-btn {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #c9a227;
  line-height: 1;
}

.event-content {
  display: none;
  padding: 4px 8px 12px;
}
.event-tips.open .event-content { display: block; }
.event-tips.open .event-toggle { border-bottom: 1px solid var(--border); }

.racing-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.racing-table th {
  background: #f0f4f0;
  text-align: left;
  padding: 8px 6px;
  font-size: 12px;
  color: #444;
}

.racing-table td {
  padding: 8px 6px;
  border-top: 1px solid var(--border);
  vertical-align: top;
}

.risk-pill {
  display: inline-block;
  min-width: 22px;
  text-align: center;
  padding: 2px 6px;
  border-radius: 12px;
  font-weight: 600;
  color: #fff;
  font-size: 12px;
}
.risk-low { background: #4caf50; }
.risk-mid { background: #e0a800; }
.risk-high { background: #d9534f; }

.result-pill {
  font-size: 12px;
  font-weight: 600;
  color: #333;
}
.result-pending { color: #999; font-style: italic; font-weight: 400; }

.cell-label { display: none; }

/* Below ~640px a 5-column table is still too tight on a phone, so each
   race becomes its own compact card: Result surfaces right under the
   race number instead of being squeezed into a narrow last column, and
   the comment gets a full-width paragraph. */
@media (max-width: 640px) {
  .racing-table, .racing-table tbody { display: block; width: 100%; }
  .racing-table thead { display: none; }

  .racing-table tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "race result"
      "order risk"
      "comment comment";
    gap: 10px 12px;
    padding: 12px;
    margin: 0 0 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
  }
  .racing-table tr:last-child { margin-bottom: 2px; }

  .racing-table td { display: block; padding: 0; border: none; }

  .cell-race { grid-area: race; font-weight: 600; }
  .cell-result { grid-area: result; }
  .cell-order { grid-area: order; }
  .cell-risk { grid-area: risk; }
  .cell-comment {
    grid-area: comment;
    font-size: 13px;
    line-height: 1.5;
    color: #333;
    padding-top: 8px;
    border-top: 1px solid var(--border);
  }

  .cell-label {
    display: block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #7c8f7e;
    margin-bottom: 3px;
  }

  .cell-result .result-pill,
  .cell-result .result-pending {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    background: #eef3ee;
    font-size: 13px;
  }
}

.announcement {
  background: var(--brand-green-light);
  border: 1px solid var(--brand-accent);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 16px;
  font-size: 14px;
}

.app-footer {
  text-align: center;
  font-size: 12px;
  color: #666;
  margin-top: 24px;
  padding: 0 16px;
}
.app-footer a {
  color: var(--brand-green);
  font-weight: 600;
  text-decoration: none;
}
.disclaimer { margin-top: 6px; color: #999; }
