:root {
  /* light = 晴れた競馬場（白基調・青空・芝の緑・黒） */
  --bg: #FAFCFB;
  --bg-grad: linear-gradient(112deg, #E4F1F6 0%, #FFFFFF 34%, #FFFFFF 70%, #E9F5EA 100%);
  --bg-panel: #FFFFFF;
  --ink: #1E1E1E;
  --muted: #6B6F6D;
  --line: #1E1E1E;
  --hair: #E8F0EC;
  --blue: #4FA8D8;
  --gold: #D89F52;
  --red: #D67D85;
  --green: #5CAE6A;
  --radar-accent: #EF8A93;
  --glass-panel: rgba(255, 255, 255, 0.3);
}

:root[data-theme="dark"] {
  /* dark = 締まった濃色 */
  --bg: #12151C;
  --bg-grad: linear-gradient(112deg, #15121A 0%, #1E1A26 28%, #1B1822 65%, #100E16 100%);
  --bg-panel: #1B2029;
  --ink: #E7EAF0;
  --muted: #A3ACB9;
  --line: #E7EAF0;
  --hair: #2D2833;
  --blue: #5A75CB;
  --gold: #C6893E;
  --red: #C25A63;
  --green: #388F6B;
  --active: #A8C24E;
  --radar-accent: #6EC9E8;
  --glass-panel: rgba(40, 34, 48, 0.3);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12151C;
    --bg-grad: linear-gradient(112deg, #15121A 0%, #1E1A26 28%, #1B1822 65%, #100E16 100%);
    --bg-panel: #1B2029;
    --ink: #E7EAF0;
    --muted: #A3ACB9;
    --line: #E7EAF0;
    --hair: #2D2833;
    --blue: #5A75CB;
    --gold: #C6893E;
    --red: #C25A63;
    --green: #388F6B;
    --active: #A8C24E;
    --radar-accent: #6EC9E8;
    --glass-panel: rgba(40, 34, 48, 0.3);
  }
}

* {
  box-sizing: border-box;
}

#fx-particles {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

body {
  margin: 0;
  background: var(--bg-grad);
  color: var(--ink);
  font-family: "Zen Kaku Gothic New", "Hiragino Sans", "Yu Gothic", sans-serif;
  line-height: 1.6;
  min-height: 100vh;
}

.mono,
.data-grid,
input[type="number"],
select {
  font-variant-numeric: tabular-nums;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---- masthead ---- */
header {
  background: var(--bg);
  padding: 18px 16px 14px;
  border-top: 5px solid var(--line);
  border-bottom: 2px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.wordmark {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.12em;
  font-family: "Staatliches", Impact, "Arial Narrow Bold", "Hiragino Sans", sans-serif;
  font-weight: 900;
  font-size: clamp(1.6em, 8vw, 2.6em);
  letter-spacing: 0.02em;
  color: var(--ink);
  line-height: 1;
  min-width: 0;
}

.wordmark .logo-icon {
  height: 1em;
  width: 1em;
  object-fit: contain;
  border-radius: 0.18em;
  flex-shrink: 0;
}

.wordmark span {
  color: var(--blue);
}

.header-sub-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
}

.column-progress {
  margin: 0;
  flex-shrink: 0;
  font-family: "Zen Kaku Gothic New", sans-serif;
  font-size: 0.78em;
  font-weight: 700;
  line-height: 1.5;
  text-align: right;
  color: color-mix(in srgb, var(--gold) 55%, var(--muted) 45%);
}

.progress-mark {
  display: inline-block;
  width: 0.6em;
  height: 0.6em;
  background: color-mix(in srgb, var(--gold) 55%, var(--muted) 45%);
  margin-right: 0.35em;
  vertical-align: middle;
}

.version-badge {
  display: inline-block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.22em;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--muted);
  vertical-align: super;
  margin-left: 6px;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.62em;
}

/* 詳細モーダルは下の文章が透けると読みにくいので不透明のまま */
.modal-content.panel {
  background: var(--bg-panel);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.usage-details {
  margin: 0 16px 18px;
  border: 1px solid var(--line);
  background: var(--bg-panel);
}

.usage-details summary {
  padding: 10px 14px;
  font-size: 0.85em;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.usage-details summary::-webkit-details-marker {
  display: none;
}

.usage-details summary::before {
  content: "▶ ";
  font-size: 0.8em;
  color: var(--muted);
}

.usage-details[open] summary::before {
  content: "▼ ";
}

.usage-details ol {
  margin: 0;
  padding: 0 14px 4px 32px;
  font-size: 0.82em;
  color: var(--muted);
  line-height: 1.7;
  border-top: 1px solid var(--hair);
}

.usage-details ol li {
  padding: 8px 0;
  border-bottom: 1px solid var(--hair);
}

.usage-details ol li:last-child {
  border-bottom: none;
}

/* ---- tab bar ---- */
.tab-bar {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 14px;
  display: flex;
  gap: 6px;
}

.tab-btn {
  flex: 1;
  padding: 10px 8px;
  font-family: inherit;
  font-size: 0.9em;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--bg);
  background: var(--muted);
  border: 1px solid var(--muted);
  border-bottom: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 0 100%);
  transition: background-color 150ms ease-out, color 150ms ease-out, transform 100ms ease-out;
}

.tab-btn:active {
  transform: scale(0.97);
}

.tab-btn.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

.tab-btn.active [data-i18n]::before {
  content: "✔ ";
}

.tab-badge {
  display: inline-block;
  min-width: 1.5em;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--radar-accent);
  color: #fff;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75em;
  line-height: 1.5em;
}

.horse-card.stable-card {
  grid-template-columns: 56px 1fr auto;
}

.stable-remove-btn {
  align-self: start;
  margin: 8px 8px 0 0;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  background: var(--ink);
  color: var(--bg);
  font-size: 1em;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.stable-remove-btn:hover {
  color: var(--red);
  border-color: var(--red);
}

.stable-toggle-btn {
  display: block;
  width: 100%;
  margin: 10px 0 4px;
  padding: 10px;
  border: 1px solid var(--line);
  background: var(--ink);
  color: var(--bg);
  font-family: inherit;
  font-weight: 700;
  font-size: 0.88em;
  letter-spacing: 0.04em;
  cursor: pointer;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 10px 100%, 0 calc(100% - 10px));
  transition: background-color 150ms ease-out, color 150ms ease-out, transform 100ms ease-out;
}

.stable-toggle-btn:active {
  transform: scale(0.97);
}

.stable-toggle-btn.in-stable {
  background: var(--muted);
  border-color: var(--muted);
  color: var(--bg);
}

.stable-toggle-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

main {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 14px 40px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* ---- panel: flat, hard-edged, printed-card feel ---- */
.panel {
  background: var(--glass-panel, var(--bg-panel));
  backdrop-filter: blur(2px) saturate(1.2);
  -webkit-backdrop-filter: blur(2px) saturate(1.2);
  border: 1px solid var(--line);
  padding: 16px;
  border-radius: 0;
}

.ticket-label {
  font-size: 0.68em;
  letter-spacing: 0.16em;
  color: var(--muted);
  text-transform: uppercase;
  margin: 0 0 10px;
  border-bottom: 1px solid var(--hair);
  padding-bottom: 6px;
}

.panel h2 {
  margin: 0 0 4px;
  font-size: 1.05em;
  letter-spacing: 0.01em;
}

.panel h3 {
  font-size: 0.82em;
  color: var(--muted);
  margin: 0 0 8px;
}

.field-row {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.field-row .field {
  margin-bottom: 0;
}

.field {
  flex: 1;
  min-width: 0;
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 0.72em;
  color: var(--muted);
  margin-bottom: 3px;
}

.required {
  color: var(--red);
  font-size: 0.85em;
  margin-left: 6px;
}

.field input,
.field select,
input[type="number"],
select {
  width: 100%;
  padding: 8px 9px;
  border: 1.5px solid var(--hair);
  border-radius: 0;
  background: var(--bg);
  color: var(--ink);
  font-size: 0.92em;
  font-family: "IBM Plex Mono", monospace;
}

/* ---- pennant-shaped chips, not pills ---- */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.chip {
  padding: 6px 10px 6px 16px;
  clip-path: polygon(12% 0, 100% 0, 100% 100%, 12% 100%, 0 50%);
  font-size: 0.76em;
  color: var(--muted);
  background: var(--hair);
  cursor: pointer;
  user-select: none;
  transition: background-color 150ms ease-out, color 150ms ease-out, transform 100ms ease-out;
}

.chip:active {
  transform: scale(0.97);
}

.chip.active {
  background: var(--active, var(--blue));
  color: #fff;
  font-weight: 700;
  text-shadow:
    -1px -1px 0 #000,
    1px -1px 0 #000,
    -1px 1px 0 #000,
    1px 1px 0 #000;
}

.search-btn {
  width: 100%;
  margin-top: 10px;
  padding: 13px;
  border: 1px solid var(--line);
  background: var(--ink);
  color: var(--bg);
  font-weight: 700;
  font-size: 0.98em;
  letter-spacing: 0.06em;
  cursor: pointer;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 14px 100%, 0 calc(100% - 14px));
  transition: background-color 150ms ease-out, color 150ms ease-out, transform 100ms ease-out;
}

.search-btn:active {
  opacity: 0.85;
  transform: scale(0.97);
}

.clear-search-btn {
  display: block;
  width: fit-content;
  margin: 10px 0 0 auto;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.8em;
  text-decoration: underline;
  cursor: pointer;
  padding: 4px 2px;
  font-family: inherit;
}

.clear-search-btn:active {
  color: var(--ink);
}

.results-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 2px;
}

.results-count {
  font-size: 0.85em;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
}

.hint {
  font-size: 0.72em;
  color: var(--muted);
  margin: 2px 0 12px;
}

.sort-row select {
  font-size: 0.8em;
  padding: 6px 8px;
  border: 1.5px solid var(--hair);
  background: var(--bg-panel);
  color: var(--ink);
  margin-bottom: 14px;
  font-family: "IBM Plex Mono", monospace;
}

.stat-radar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.stat-radar {
  width: 100%;
  max-width: 360px;
  overflow: visible;
  touch-action: none;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

.radar-base {
  fill: var(--hair);
  stroke: var(--muted);
  stroke-width: 1.5;
}

.radar-ring {
  fill: none;
  stroke: var(--muted);
  stroke-width: 0.8;
  opacity: 0.55;
}

.radar-spoke {
  stroke: var(--muted);
  stroke-width: 0.8;
  opacity: 0.4;
}

.radar-value {
  fill: var(--radar-accent);
  fill-opacity: 0.4;
  stroke: var(--radar-accent);
  stroke-width: 2;
  stroke-linejoin: round;
  pointer-events: none;
}

.radar-handle {
  fill: var(--radar-accent);
  stroke: var(--bg-panel);
  stroke-width: 1.5;
  pointer-events: none;
}

.radar-label {
  fill: var(--muted);
  font-size: 13px;
  font-family: "Zen Kaku Gothic New", "Hiragino Sans", "Yu Gothic", sans-serif;
  pointer-events: none;
}

.radar-label.is-set {
  fill: var(--ink);
  font-weight: 700;
}

.radar-label-tier {
  fill: var(--radar-accent);
  font-family: "IBM Plex Mono", monospace;
  font-weight: 700;
}

.detail-radar-wrap {
  display: flex;
  justify-content: center;
  margin: 8px 0;
}
.detail-radar {
  width: 210px;
  height: 210px;
}
.detail-radar .radar-label {
  font-size: 9px;
}

.stat-radar-hint {
  margin: 0;
  font-size: 0.78em;
  color: var(--muted);
  text-align: center;
}

.stat-radar-reset {
  padding: 6px 18px;
  font-size: 0.85em;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg-panel);
  color: var(--ink);
  cursor: pointer;
  font-family: inherit;
}

.stat-radar-reset:hover {
  background: var(--hair);
}

.card-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ---- horse card = tear-off betting stub ---- */
.horse-card {
  display: grid;
  grid-template-columns: 56px 1fr;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  position: relative;
  cursor: pointer;
  animation: fscFadeIn 320ms ease-out backwards;
}

@keyframes fscFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.horse-card:nth-child(1) { animation-delay: 0ms; }
.horse-card:nth-child(2) { animation-delay: 40ms; }
.horse-card:nth-child(3) { animation-delay: 80ms; }
.horse-card:nth-child(4) { animation-delay: 120ms; }
.horse-card:nth-child(5) { animation-delay: 160ms; }
.horse-card:nth-child(6) { animation-delay: 200ms; }
.horse-card:nth-child(7) { animation-delay: 240ms; }
.horse-card:nth-child(8) { animation-delay: 280ms; }
.horse-card:nth-child(n+9) { animation-delay: 320ms; }

.stub {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 10px 4px;
  color: #fff;
  border-right: 2px dashed rgba(255,255,255,0.55);
}

.stub .no-label {
  font-size: 0.55em;
  letter-spacing: 0.1em;
  opacity: 0.85;
}

.stub .num {
  font-family: "IBM Plex Mono", monospace;
  font-weight: 700;
  font-size: 1.5em;
  line-height: 1;
}

.stub-1 { background: var(--red); }
.stub-2 { background: var(--blue); }
.stub-3 { background: var(--green); }
.stub-4 { background: var(--gold); color: var(--ink); }

.card-body {
  min-width: 0;
  padding: 12px 14px;
}

.card-body h3 {
  margin: 0 0 6px;
  font-size: 1.02em;
  color: var(--ink);
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 8px;
}

.tag {
  font-size: 0.68em;
  padding: 2px 7px;
  background: var(--bg);
  border: 1px solid var(--hair);
  color: var(--muted);
  letter-spacing: 0.02em;
}

.tag.sub-tag {
  border-style: dashed;
  font-style: italic;
}

.data-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 12px;
  font-size: 0.8em;
  font-family: "IBM Plex Mono", monospace;
  border-top: 1px dashed var(--hair);
  padding-top: 6px;
}

.data-grid .k { color: var(--muted); }
.data-grid .v { text-align: right; }

.carrot-row {
  margin-top: 8px;
  font-size: 0.88em;
  letter-spacing: 1px;
}

.no-results {
  color: var(--muted);
  padding: 20px;
  text-align: center;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 10;
}

.modal.hidden {
  display: none;
}

.modal-content {
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
}

.modal-content.detail-preview {
  opacity: 0;
  transform: scale(0.96);
  transition: opacity 180ms ease-out, transform 180ms ease-out;
}

.modal-content.detail-preview.is-visible {
  opacity: 1;
  transform: scale(1);
}

.modal-close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: none;
  border: none;
  color: var(--ink);
  font-size: 1.5em;
  cursor: pointer;
}

.detail-preview h3 {
  margin: 0 0 2px;
  font-size: 1.15em;
  color: var(--ink);
}

.detail-preview .price-line {
  font-size: 0.82em;
  color: var(--muted);
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--hair);
  font-family: "IBM Plex Mono", monospace;
}

.price-caveat {
  font-size: 0.72em;
  color: var(--muted);
  margin: -6px 0 10px;
}

.detail-preview h4 {
  margin: 12px 0 4px;
  font-size: 0.76em;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  border-left: 3px solid var(--blue);
  padding-left: 6px;
}

.detail-preview p {
  margin: 0;
  font-size: 0.9em;
}

.detail-stats p {
  margin: 3px 0;
}

.detail-block {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--hair);
}

.detail-block h4 {
  margin-top: 0;
}

.achievement-line {
  margin: 2px 0;
}

.source-link {
  font-size: 0.8em;
  color: var(--muted);
  word-break: break-all;
}

footer {
  text-align: center;
  padding: 18px;
  font-size: 0.8rem;
  color: var(--muted);
  border-top: 2px solid var(--line);
}

footer .fnote {
  display: block;
  text-wrap: balance;
  margin: 0 auto 2px;
  max-width: 40em;
}

.footer-disclaimer {
  margin: 10px auto 12px;
  max-width: 40em;
}

.visit-counter {
  margin-top: 8px;
  opacity: 0.7;
}

.footer-disclaimer summary {
  cursor: pointer;
  display: inline-block;
  padding: 2px 10px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
}

.footer-disclaimer[open] summary {
  margin-bottom: 6px;
}

.disclaimer-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
  counter-reset: disclaimer-count;
}

.disclaimer-section {
  background: var(--bg-panel);
  border: 1px solid var(--hair);
  border-radius: 8px;
  padding: 10px 12px;
  animation: fscFadeIn 320ms ease-out backwards;
}

.disclaimer-section:nth-child(1) { animation-delay: 0ms; }
.disclaimer-section:nth-child(2) { animation-delay: 40ms; }
.disclaimer-section:nth-child(3) { animation-delay: 80ms; }
.disclaimer-section:nth-child(4) { animation-delay: 120ms; }
.disclaimer-section:nth-child(5) { animation-delay: 160ms; }
.disclaimer-section:nth-child(6) { animation-delay: 200ms; }
.disclaimer-section:nth-child(7) { animation-delay: 240ms; }
.disclaimer-section:nth-child(8) { animation-delay: 280ms; }

.disclaimer-section h4 {
  margin: 0 0 6px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink);
  border-left: 3px solid var(--blue);
  padding-left: 8px;
  counter-increment: disclaimer-count;
}

.disclaimer-section h4::before {
  content: counter(disclaimer-count, decimal-leading-zero) " ";
  font-family: "IBM Plex Mono", monospace;
  color: var(--blue);
}

.disclaimer-section p {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.7;
  color: var(--muted);
}

footer a {
  color: var(--muted);
  text-decoration: underline;
}
.related-tools a {
  color: var(--ink);
  font-weight: 600;
}

.theme-toggle {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  background: var(--bg-panel);
  font-size: 1em;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.header-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.lang-toggle {
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: var(--bg-panel);
  font-size: 0.8em;
  font-weight: 700;
  letter-spacing: 0.03em;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  color: var(--ink);
}

.install-toggle {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  background: var(--bg-panel);
  font-size: 1em;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.install-guide p {
  margin: 0;
  font-size: 0.9em;
  color: var(--ink);
}

.install-guide .ticket-label {
  margin-bottom: 10px;
}

/* ---- 厩舎診断 ---- */
.diag-box {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--hair);
}

.diag-summary {
  cursor: pointer;
  list-style: none;
  font-size: 0.82em;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.diag-summary::-webkit-details-marker {
  display: none;
}

.diag-summary::before {
  content: "▶ ";
  font-size: 0.9em;
}

.diag-details[open] .diag-summary::before {
  content: "▼ ";
}

.diag-details[open] .diag-summary {
  margin-bottom: 10px;
}

.diag-section {
  margin-bottom: 14px;
}

.diag-label {
  font-size: 0.72em;
  color: var(--muted);
  margin: 0 0 6px;
}

.diag-band-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.diag-band-name {
  flex: 0 0 56px;
  font-size: 0.76em;
  color: var(--ink);
}

.diag-band-bar {
  flex: 1;
  height: 8px;
  background: var(--hair);
  position: relative;
}

.diag-band-fill {
  display: block;
  height: 100%;
  background: var(--blue);
}

.diag-band-count {
  flex: 0 0 20px;
  text-align: right;
  font-size: 0.76em;
  color: var(--ink);
}

.diag-band-row.is-zero .diag-band-name,
.diag-band-row.is-zero .diag-band-count {
  color: var(--muted);
  opacity: 0.6;
}

.diag-inline {
  display: flex;
  justify-content: space-between;
  font-size: 0.78em;
  color: var(--muted);
  padding: 8px 0;
  border-top: 1px solid var(--hair);
  border-bottom: 1px solid var(--hair);
}

.diag-comments {
  padding-top: 4px;
}

.diag-comment {
  font-size: 0.82em;
  color: var(--ink);
  margin: 0 0 6px;
  line-height: 1.5;
  text-wrap: pretty;
}

.diag-comment:last-child {
  margin-bottom: 0;
}

@keyframes fscSlideInRight {
  from { transform: translateX(50px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

@keyframes fscSlideInLeft {
  from { transform: translateX(-50px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.card-stack.slide-next {
  animation: fscSlideInRight 260ms ease-out;
}

.card-stack.slide-prev {
  animation: fscSlideInLeft 260ms ease-out;
}

.card-stack.slide-next .horse-card,
.card-stack.slide-prev .horse-card {
  animation: none;
}

@media (prefers-reduced-motion: reduce) {
  .tab-btn, .search-btn, .chip, .stable-toggle-btn, .modal-content.detail-preview, .horse-card, .disclaimer-section, .gallop-sprite, .card-stack.slide-next, .card-stack.slide-prev {
    transition: none !important;
    animation: none !important;
  }
}

.search-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 8px;
  transition: opacity 150ms ease-out;
}

.search-loading.hidden {
  display: none;
}

.gallop-sprite {
  width: 48px;
  height: 81px;
  background-image: url("images/horse-gallop.png");
  background-repeat: no-repeat;
  background-size: 384px 81px;
  background-position: 0 0;
  animation: fscGallop 680ms steps(8) infinite;
  margin-bottom: 2px;
}

@keyframes fscGallop {
  from { background-position-x: 0; }
  to { background-position-x: -384px; }
}

.loading-bar {
  width: 200px;
  height: 6px;
  border: 1px solid var(--line);
  background: var(--hair);
  margin-bottom: 8px;
  overflow: hidden;
}

.loading-bar-fill {
  width: 0%;
  height: 100%;
  background: var(--line);
}

.loading-status {
  font-size: 0.62em;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  margin: 0;
}

.pagination {
  display: none;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
}

.page-btn {
  min-width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  background: var(--bg-panel);
  color: var(--ink);
  font-family: inherit;
  font-size: 1em;
  cursor: pointer;
  transition: background-color 150ms ease-out, color 150ms ease-out, transform 100ms ease-out;
}

.page-btn:active {
  transform: scale(0.95);
}

.page-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.page-indicator {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.85em;
  color: var(--muted);
  min-width: 3.5em;
  text-align: center;
}
