/**
 * セレクトセール販売馬 — 親ページ埋め込み用（モバイル優先カードUI）
 */
:root {
  --ss-border: #e2e8f0;
  --ss-text: #0f172a;
  --ss-muted: #475569;
  --ss-label: #64748b;
  --ss-accent: #1a5fb4;
  --ss-surface: #ffffff;
  --ss-bg: #f8fafc;
  --ss-highlight: #fff9c4;
  --ss-radius: 10px;
  --ss-gap: 10px;
}

.selectsale-widget {
  box-sizing: border-box;
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Segoe UI", Meiryo, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ss-text);
  background: var(--ss-bg);
  -webkit-text-size-adjust: 100%;
  padding: 10px;
}

.selectsale-widget *,
.selectsale-widget *::before,
.selectsale-widget *::after {
  box-sizing: border-box;
}

.selectsale-widget .toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.selectsale-widget .auto-refresh {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ss-muted);
  cursor: pointer;
  user-select: none;
}

.selectsale-widget .auto-refresh input {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.selectsale-widget .meta {
  font-size: 11px;
  color: var(--ss-muted);
  width: 100%;
  line-height: 1.4;
}

.selectsale-widget .selectsale-status-error {
  font-size: 12px;
  color: #b3261e;
  margin-bottom: 8px;
}

.selectsale-widget .empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--ss-muted);
  background: var(--ss-surface);
  border: 1px solid var(--ss-border);
  border-radius: var(--ss-radius);
}

/* —— カードリスト —— */
.selectsale-widget .ss-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--ss-gap);
}

.selectsale-widget .ss-card {
  background: var(--ss-surface);
  border: 1px solid var(--ss-border);
  border-radius: var(--ss-radius);
  padding: 14px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.selectsale-widget .ss-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.selectsale-widget .ss-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.selectsale-widget .ss-lot-no {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--ss-muted);
  white-space: nowrap;
}

.selectsale-widget .ss-sex {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ss-accent);
  background: #e8f0fa;
  border-radius: 4px;
  padding: 1px 7px;
  white-space: nowrap;
  line-height: 1.5;
}

.selectsale-widget .ss-price {
  flex-shrink: 0;
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ss-accent);
  text-align: right;
  white-space: nowrap;
  line-height: 1.3;
}

.selectsale-widget .ss-horse {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.selectsale-widget .ss-pedigree {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ss-text);
}

.selectsale-widget .ss-pedigree-item {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px;
  min-width: 0;
}

.selectsale-widget .ss-pedigree-sep {
  color: var(--ss-label);
  user-select: none;
}

.selectsale-widget .ss-buyer {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 6px;
  font-size: 13px;
  line-height: 1.45;
  padding-top: 2px;
  border-top: 1px solid var(--ss-border);
  margin-top: 2px;
}

.selectsale-widget .ss-label {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--ss-label);
  letter-spacing: 0.02em;
}

.selectsale-widget .ss-sire,
.selectsale-widget .ss-dam,
.selectsale-widget .ss-buyer-name {
  overflow-wrap: anywhere;
}

.selectsale-widget .ss-card.selectsale-row-new {
  animation: selectsale-highlight-fade 2.5s ease-out;
}

@keyframes selectsale-highlight-fade {
  0% {
    background-color: var(--ss-highlight);
  }
  100% {
    background-color: var(--ss-surface);
  }
}

/* —— 広い画面: 価格を右に寄せたスキャンしやすいレイアウト —— */
@media (min-width: 640px) {
  .selectsale-widget {
    padding: 12px;
  }

  .selectsale-widget .ss-card {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "meta price"
      "horse price"
      "pedigree pedigree"
      "buyer buyer";
    column-gap: 20px;
    row-gap: 4px;
    padding: 16px 18px;
    align-items: start;
  }

  .selectsale-widget .ss-card-top {
    display: contents;
  }

  .selectsale-widget .ss-card-meta {
    grid-area: meta;
  }

  .selectsale-widget .ss-price {
    grid-area: price;
    align-self: center;
    font-size: 18px;
  }

  .selectsale-widget .ss-horse {
    grid-area: horse;
    font-size: 17px;
  }

  .selectsale-widget .ss-pedigree {
    grid-area: pedigree;
  }

  .selectsale-widget .ss-buyer {
    grid-area: buyer;
  }
}
