/* Jockeeeey — フェリシモ調：白×温かいグレージュ、チャコール文字、余白多め、やわらかい手描き感 */
:root {
  --bg: #ffffff; --paper: #f7f5f1; --greige: #edecea; --ink: #202020; --sub: #5f5d59;
  --muted: #92918e; --line: #e4e1dc;
  --terracotta: #c8735a; --mustard: #e0a948; --sage: #7fa39a; --dusty: #6f8fb3; --rose: #d48c9e;
  --turf: #5f8f5a; --dirt: #b07a3b; --jump: #8a6fb0;
  --round: "Zen Maru Gothic", "游ゴシック", "Yu Gothic", YuGothic, "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  --hand: "Caveat", "Zen Maru Gothic", cursive;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink); line-height: 1.7; letter-spacing: .02em;
  font-family: 游ゴシック, "Yu Gothic", YuGothic, "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
  font-weight: 500; -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
a { color: inherit; }
.muted { color: var(--muted); }

/* header */
.top {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 10px;
  padding: 8px 16px; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 6px; text-decoration: none; }
.brand span { font-family: var(--hand); font-weight: 700; font-size: 1.85rem; line-height: 1; letter-spacing: .01em; }
.shop {
  margin-left: auto; font-size: .76rem; text-decoration: none; white-space: nowrap;
  padding: 6px 14px; border-radius: 999px; border: 1px solid var(--ink); background: #fff;
}
.shop:hover { background: var(--ink); color: #fff; }
.asof-bar {
  background: var(--greige); text-align: center; font-size: .8rem; padding: 6px 16px;
  font-family: var(--round); font-weight: 700;
}
.asof-bar span { font-weight: 500; color: var(--sub); font-size: .72rem; }

/* hero */
.hero { text-align: center; padding: 26px 16px 6px; }
.hero-en { margin: 0; font-family: var(--hand); font-size: 1.3rem; color: var(--terracotta); }
.hero h1 { margin: 2px 0 8px; font-family: var(--round); font-size: 1.35rem; line-height: 1.6; letter-spacing: .06em; }
.hero-sub { margin: 0 auto; max-width: 30em; font-size: .8rem; color: var(--sub); }

/* ピッカー */
.picker { padding: 12px 16px 4px; max-width: 720px; margin: 0 auto; }
.picker input {
  width: 100%; padding: 10px 14px; font-size: .95rem; border-radius: 4px; font-family: inherit;
  border: 0; background: var(--greige); color: var(--ink);
}
.picker input::placeholder { color: var(--muted); }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 10px 0 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips a {
  flex: none; font-size: .78rem; text-decoration: none; padding: 4px 12px;
  border-radius: 999px; background: #fff; border: 1px solid var(--line); color: var(--sub);
}
.chips a.on { background: var(--ink); border-color: var(--ink); color: #fff; }

/* スワイプデッキ */
.deck {
  display: flex; align-items: flex-start; gap: 14px; overflow-x: auto;
  scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
  padding: 8px 16px 20px; scrollbar-width: none;
  overflow-y: hidden; box-sizing: border-box; /* 高さは app.js が表示中カードに合わせる */
}
.deck::-webkit-scrollbar { display: none; }
.deck .card { flex: 0 0 100%; scroll-snap-align: center; }
@media (min-width: 720px) {
  .deck { padding-left: calc(50vw - 260px); padding-right: calc(50vw - 260px); }
  .deck .card { flex-basis: 520px; }
}
.solo { max-width: 560px; margin: 16px auto 8px; padding: 0 16px; }

/* カード */
.card {
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  padding: 22px 18px 18px; min-width: 0;
}
.card-head { text-align: center; }
.face { width: 128px; height: 128px; margin: 0 auto 6px; }
.avatar { width: 100%; height: 100%; display: block; border-radius: 50%; object-fit: cover; }
.rank { font-family: var(--round); font-size: .78rem; color: var(--sub); }
.rank b { font-family: var(--hand); font-size: 1.7rem; color: var(--terracotta); margin: 0 1px 0 4px; line-height: 1; }
.rank span { font-size: .78rem; }
.card-head h2 { margin: 0 0 4px; font-family: var(--round); font-size: 1.55rem; letter-spacing: .08em; }
.meta { margin: 0; font-size: .8rem; color: var(--sub); }
.links { margin: 10px 0 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.links a {
  font-size: .72rem; text-decoration: none; padding: 3px 11px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--sub);
}
.tag {
  display: inline-block; font-size: .7rem; padding: 0 8px; border-radius: 999px;
  background: var(--greige); color: var(--sub);
}
.tag.east { background: #e4ebf3; color: #45648a; }
.tag.west { background: #f6e6df; color: #a55a43; }
.tag.minarai { background: #f8ecd2; color: #9a6c1c; }

.asof { text-align: center; margin: 16px 0 0; }
.asof span {
  display: inline-block; font-size: .72rem; font-family: var(--round); font-weight: 700;
  padding: 2px 12px; border-radius: 999px; background: var(--paper); color: var(--sub);
}
.kpi { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 8px 0 4px; }
.kpi div { background: var(--paper); border-radius: 8px; padding: 10px 4px 8px; text-align: center; }
.kpi span { display: block; font-size: .68rem; color: var(--sub); }
.kpi b { font-family: var(--round); font-size: 1.4rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi small { font-size: .68rem; margin-left: 1px; }
.kpi div:first-child b { color: var(--terracotta); }
.sub { margin: 6px 0 0; font-size: .72rem; color: var(--muted); text-align: center; }

.card section { margin-top: 26px; }
.card h3 {
  font-family: var(--round); font-size: .95rem; margin: 0 0 10px; padding-bottom: 6px;
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='6' viewBox='0 0 40 6'%3E%3Cpath d='M0 3 Q5 0 10 3 T20 3 T30 3 T40 3' fill='none' stroke='%23e0a948' stroke-width='1.6'/%3E%3C/svg%3E") left bottom / 40px 6px repeat-x;
}
.count { font-size: .74rem; color: var(--terracotta); }
.period { font-size: .68rem; color: var(--muted); font-weight: 500; }
.none, .hint { font-size: .76rem; color: var(--muted); margin: 6px 0 0; }

.rides, .events, .jusho, .insight ul { list-style: none; margin: 0; padding: 0; }
.rides li {
  display: grid; grid-template-columns: auto 1fr; gap: 0 10px; padding: 9px 0;
  border-bottom: 1px dashed var(--line); font-size: .84rem;
}
.rides .when { font-family: var(--round); font-weight: 700; white-space: nowrap; grid-row: span 2; }
.rides .horse { color: var(--sub); }
.rides small { margin-left: 4px; font-size: .7rem; }
.turf { color: var(--turf); } .dirt { color: var(--dirt); } .jump { color: var(--jump); }
.g {
  font-style: normal; font-size: .64rem; font-weight: 700; padding: 0 6px; margin-right: 4px;
  border-radius: 999px; color: #fff; background: var(--muted); vertical-align: 1px;
}
.g.g1 { background: var(--dusty); } .g.g2 { background: var(--terracotta); } .g.g3 { background: var(--sage); }
.events li, .jusho li { font-size: .82rem; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.events .when, .jusho small { color: var(--muted); font-size: .72rem; }

.insight { background: var(--paper); border-radius: 8px; padding: 14px 16px; }
.insight h3 { background: none; padding: 0; }
.insight h3::before { content: "memo"; font-family: var(--hand); font-size: 1.15rem; color: var(--terracotta); margin-right: 2px; }
.insight li { font-size: .84rem; padding: 2px 0 2px 1.2em; text-indent: -1.2em; }
.insight li::before { content: "✎ "; color: var(--mustard); }

/* 成績テーブル */
.rates { width: 100%; border-collapse: collapse; font-size: .8rem; font-variant-numeric: tabular-nums; }
.rates th, .rates td { padding: 6px 4px; text-align: right; border-bottom: 1px solid var(--line); }
.rates thead th { font-size: .66rem; color: var(--muted); font-weight: 500; }
.rates tbody th { text-align: left; font-family: var(--round); font-weight: 700; white-space: nowrap; }
.rates .num { font-weight: 700; }
.rates .barcell { width: 28%; padding-left: 8px; }
.rates tr.thin td, .rates tr.thin th { opacity: .4; }
.rates tr.empty { display: none; }
.bar { display: block; height: 7px; border-radius: 999px; background: var(--greige); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--sage); border-radius: 999px; }

.seg { display: inline-flex; gap: 4px; margin-bottom: 6px; }
.seg button {
  border: 1px solid var(--line); background: #fff; color: var(--sub); font: inherit; font-size: .74rem;
  padding: 2px 14px; border-radius: 999px; cursor: pointer;
}
.seg button.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.switchable .pane { display: none; }
.switchable[data-surf="all"] .pane[data-pane="all"],
.switchable[data-surf="芝"] .pane[data-pane="芝"],
.switchable[data-surf="ダート"] .pane[data-pane="ダート"] { display: block; }

/* 収益導線 */
.cta {
  display: block; margin-top: 24px; padding: 16px 18px; border-radius: 8px; text-decoration: none;
  background: var(--paper); border: 1px solid var(--line); color: var(--ink);
}
.cta b { display: block; font-family: var(--round); font-size: .95rem; }
.cta span { display: block; font-size: .78rem; color: var(--sub); margin-top: 2px; }
.cta i { display: block; font-style: normal; font-size: .78rem; margin-top: 8px; text-align: right; color: var(--terracotta); font-weight: 700; }
.cta.back { background: var(--ink); border-color: var(--ink); color: #fff; }
.cta.back i { color: var(--mustard); }
.share { text-align: center; font-size: .72rem; margin: 16px 0 0; }
.share a { color: var(--muted); }

/* 共有ボタン（フッターの上） */
.share-bar { padding: 4px 16px 28px; text-align: center; }
.share-bar p { font-family: var(--round); font-size: .78rem; color: var(--sub); margin: 0 0 10px; letter-spacing: .04em; }
.share-btns { display: flex; justify-content: center; gap: 12px; }
.share-btns a {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 18px; border-radius: 999px;
  font-family: var(--round); font-size: .82rem; font-weight: 700; text-decoration: none; color: #fff;
}
.share-btns a svg { width: 18px; height: 18px; fill: currentColor; flex: none; }
.share-btns .sx { background: #000; }
.share-btns .sl { background: #06c755; }
.share-btns a:hover { opacity: .85; }

/* 前後ボタン */
.nav-btns {
  position: fixed; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; padding: 5px 7px; z-index: 10;
  background: #fff; border: 1px solid var(--line); border-radius: 999px;
  box-shadow: 0 4px 14px rgba(32,32,32,.08);
}
.nav-btns button {
  width: 36px; height: 36px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--ink); color: #fff; font-size: 1.3rem; line-height: 1;
}
#pos { font-family: var(--round); font-size: .78rem; min-width: 64px; text-align: center; font-variant-numeric: tabular-nums; }

.foot {
  background: var(--greige); padding: 24px 16px 100px; font-size: .72rem; color: var(--sub);
}
/* 画面幅いっぱいに広げ、ヘッダーのロゴと同じ左端（16px）にそろえる。長い説明文だけ読みやすい幅で止める */
.foot > * { margin-left: 0; margin-right: 0; }
.foot > p:not(.copy):not(.foot-logo) { max-width: 46em; }
.foot > .cta { max-width: 560px; }
.foot-logo { display: flex; align-items: center; gap: 6px; font-family: var(--hand); font-size: 1.5rem; color: var(--ink); margin-top: 0; }
.single .foot { padding-bottom: 30px; }
.foot .copy { margin-top: 18px; padding-top: 14px; border-top: 1px solid rgba(32, 32, 32, .12); text-align: left; letter-spacing: .06em; }
.foot .copy small { font-size: .7rem; color: var(--sub); }
