/**
 * Expect — 遷移先6画面スタイル
 */

.screen {
  padding: 8px var(--pad) 28px;
  display: grid;
  gap: 14px;
}

.screen-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: #fff;
}

.chip-row,
.tab-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  padding-bottom: 2px;
}

.chip-row::-webkit-scrollbar,
.tab-row::-webkit-scrollbar { display: none; }

.chip,
.tab-pill {
  flex: 0 0 auto;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(193, 162, 109, 0.45);
  color: var(--gold-soft);
  font-size: 12px;
  font-weight: 600;
  background: rgba(20, 24, 32, 0.8);
  white-space: nowrap;
}

.chip.is-active,
.tab-pill.is-active {
  background: linear-gradient(180deg, #e5c78f, #c1a26d 55%, #9f7e4a);
  color: #1a1204;
  border-color: transparent;
}

.date-tabs .tab-pill { min-width: 64px; text-align: center; }

/* —— レース一覧 —— */
/* 画面全体は動かさず、日付・会場を固定／カードだけスクロール */
body.page-races {
  height: 100%;
  max-height: 100dvh;
  overflow: hidden;
}

.page-races .app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}

.page-races .topbar {
  flex: 0 0 auto;
  position: relative;
  z-index: 25;
}

.page-races .screen {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
  padding-top: 8px;
  padding-bottom: 12px;
}

.page-races .race-filters {
  flex: 0 0 auto;
  position: sticky;
  top: 0;
  z-index: 22;
  display: grid;
  gap: 10px;
  margin: 0 calc(-1 * var(--pad));
  padding: 0 var(--pad) 8px;
  background:
    linear-gradient(180deg, rgba(11, 16, 24, 0.98) 70%, rgba(11, 16, 24, 0.88) 100%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.page-races .race-filters-note {
  margin: 0;
  font-size: 11px;
}

.race-list {
  display: grid;
  gap: 10px;
  min-height: 0;
}

/* カード領域のみ縦スクロール（日付・会場は上で固定） */
.page-races .race-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-right: 2px;
  padding-bottom: 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(193, 162, 109, 0.45) transparent;
}

.page-races .race-list::-webkit-scrollbar {
  width: 4px;
}

.page-races .race-list::-webkit-scrollbar-thumb {
  background: rgba(193, 162, 109, 0.45);
  border-radius: 999px;
}

.race-list-empty {
  margin: 0;
  padding: 28px 16px;
  text-align: center;
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
  border: 1px dashed rgba(193, 162, 109, 0.28);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.02);
}

.race-list-empty[hidden] {
  display: none !important;
}

/* レース検索（カレンダーアイコン） */
.race-search-root {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  align-items: end;
  justify-items: center;
}

.race-search-root[hidden] {
  display: none !important;
}

.race-search-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.race-search-sheet {
  position: relative;
  z-index: 1;
  width: min(430px, 100%);
  max-height: min(88dvh, 640px);
  overflow-y: auto;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  border-radius: 20px 20px 0 0;
  border: 1px solid rgba(193, 162, 109, 0.28);
  border-bottom: 0;
  background: linear-gradient(180deg, #151b26 0%, #0d121a 100%);
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.45);
  animation: race-search-up 0.28s ease both;
}

@keyframes race-search-up {
  from { transform: translateY(24px); opacity: 0.6; }
  to { transform: translateY(0); opacity: 1; }
}

.race-search-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.race-search-kicker {
  margin: 0 0 2px;
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--gold);
  font-weight: 700;
}

.race-search-head h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
}

.race-search-close {
  font-size: 16px;
  line-height: 1;
  opacity: 0.85;
}

.race-search-field {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

.race-search-field span,
.race-search-label {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

.race-search-field input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid rgba(193, 162, 109, 0.35);
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font-size: 14px;
  outline: none;
  box-sizing: border-box;
}

.race-search-field input:focus {
  border-color: rgba(212, 179, 125, 0.75);
  box-shadow: 0 0 0 3px rgba(193, 162, 109, 0.15);
}

.race-search-block {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.race-search-count {
  margin: 0 0 14px;
  font-size: 12px;
  color: var(--gold-soft);
}

.race-search-actions {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 10px;
}

.race-search-reset,
.race-search-apply {
  height: 44px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

.race-search-reset {
  border: 1px solid rgba(193, 162, 109, 0.4);
  color: var(--gold-soft);
  background: rgba(255, 255, 255, 0.03);
}

.race-search-apply {
  border: 0;
  color: #1a1204;
  background: linear-gradient(180deg, #e5c78f, #c1a26d 55%, #9f7e4a);
}

body.is-race-search {
  overflow: hidden;
}

/* レース並び替え */
.race-sort {
  position: relative;
}

.race-sort-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 55;
  min-width: 200px;
  padding: 8px 0;
  border-radius: 12px;
  border: 1px solid rgba(193, 162, 109, 0.28);
  background: rgba(14, 18, 26, 0.97);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.race-sort-panel[hidden] {
  display: none !important;
}

.race-sort-head {
  margin: 0 0 4px;
  padding: 4px 14px 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.race-sort-item {
  display: block;
  width: 100%;
  padding: 11px 14px;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  background: transparent;
}

.race-sort-item:hover,
.race-sort-item:focus-visible {
  background: rgba(193, 162, 109, 0.12);
  outline: none;
}

.race-sort-item.is-active {
  color: var(--gold-soft);
  background: rgba(193, 162, 109, 0.1);
}

.race-sort.is-open .icon-btn {
  color: var(--gold-soft);
}

.race-item {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(76px, 88px) auto;
  gap: 8px 10px;
  align-items: center;
  padding: 12px;
  padding-right: 12px;
  border-radius: var(--radius);
  background-color: #10141c;
  background-image: none;
  background-size: cover;
  background-position: center;
  border: 1px solid rgba(193, 162, 109, 0.18);
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  isolation: isolate;
  min-height: 96px;
}

.race-item--bg1 { background-image: url("./images/race-bg-1.png"); }
.race-item--bg2 { background-image: url("./images/race-bg-2.png"); }
.race-item--bg3 { background-image: url("./images/race-bg-3.png"); }
.race-item--bg4 { background-image: url("./images/race-bg-4.png"); }

.race-item::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(100deg, rgba(8, 10, 14, 0.88) 0%, rgba(8, 10, 14, 0.72) 48%, rgba(8, 10, 14, 0.48) 100%);
  pointer-events: none;
}

.race-item > * {
  position: relative;
  z-index: 1;
}

.race-item > div:first-of-type {
  min-width: 0;
  padding-right: 4px;
}

.race-item .fav-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
}

.race-item-side {
  display: contents;
}

.race-conf {
  justify-self: center;
  align-self: center;
  display: grid;
  justify-items: center;
  text-align: center;
  font-family: var(--display);
  font-size: 30px;
  font-weight: 700;
  color: #fff4cc;
  line-height: 1;
  min-width: 84px;
  padding: 8px 10px 7px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.72);
  border: 1px solid rgba(255, 231, 168, 0.55);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
  text-shadow: none;
}

.race-conf small {
  display: block;
  margin-top: 5px;
  font-family: var(--font);
  font-size: 11px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.02em;
  text-align: center;
  text-shadow: none;
}

.btn-detail {
  justify-self: end;
  align-self: end;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(193, 162, 109, 0.55);
  color: var(--gold-soft);
  font-size: 11px;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  white-space: nowrap;
}

.race-item-place {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}

.race-item-name {
  margin: 3px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.race-item-meta {
  margin: 6px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 11px;
  color: var(--muted);
}

.race-stars { color: var(--gold); letter-spacing: 1px; }

.fav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 36px;
  height: 34px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(193, 162, 109, 0.45);
  background: rgba(10, 12, 18, 0.55);
  color: var(--gold-soft);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.fav-btn .fav-star {
  font-size: 15px;
  line-height: 1;
  color: rgba(240, 215, 140, 0.55);
}

.fav-btn.is-active {
  border-color: rgba(212, 175, 55, 0.85);
  background: rgba(193, 162, 109, 0.18);
}

.fav-btn.is-active .fav-star {
  color: #f0d78c;
}

.fav-btn--icon {
  width: 36px;
  padding: 0;
}

.fav-btn--block {
  width: 100%;
  height: 44px;
  margin-top: 12px;
  font-size: 13px;
}

/* —— レース詳細 —— */
.detail-head h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.detail-head p {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.honmei-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, #1a1f2a, #12161e);
  border: 1px solid rgba(193, 162, 109, 0.28);
}

.honmei-num {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-size: 26px;
  font-weight: 700;
  color: #1a1204;
  background: linear-gradient(180deg, #e5c78f, #c1a26d);
}

.honmei-card h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.honmei-card p {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.radar-box {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, transparent 28%, rgba(193, 162, 109, 0.08) 29%),
    conic-gradient(
      from -90deg,
      #c1a26d 0 18%,
      rgba(193, 162, 109, 0.35) 18% 36%,
      #d4b37d 36% 55%,
      rgba(193, 162, 109, 0.45) 55% 72%,
      #c1a26d 72% 88%,
      rgba(193, 162, 109, 0.3) 88% 100%
    );
  position: relative;
  box-shadow: 0 0 0 1px rgba(193, 162, 109, 0.25);
}

.radar-box span {
  position: absolute;
  inset: 18px;
  border-radius: 50%;
  background: #12161e;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--gold);
  text-align: center;
  line-height: 1.2;
}

.pace-card {
  padding: 12px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid rgba(193, 162, 109, 0.16);
}

.pace-card h3 {
  margin: 0 0 8px;
  font-size: 13px;
  color: #fff;
}

.pace-card p {
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.pace-track {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding: 4px 0;
}

.pace-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  color: #1a1204;
  background: var(--gold-soft);
  flex: 0 0 auto;
}

.pace-dot.is-dim {
  background: #3a4250;
  color: #c8cdd6;
}

.pace-label {
  font-size: 10px;
  color: var(--muted);
  flex: 0 0 auto;
}

/* —— 買い目戦略（詳細分析） —— */
.strategy-hero {
  padding: 16px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(193, 162, 109, 0.28);
  background:
    radial-gradient(120% 80% at 100% 0%, rgba(193, 162, 109, 0.18), transparent 55%),
    linear-gradient(160deg, #1a2230 0%, #121820 100%);
}

.strategy-kicker {
  margin: 0 0 6px;
  font-size: 10px;
  letter-spacing: 0.14em;
  font-weight: 700;
  color: var(--gold);
}

.strategy-hero h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
}

.strategy-hero > p {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.strategy-hero-stats {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.strategy-hero-stats div {
  padding: 10px 8px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.28);
  text-align: center;
}

.strategy-hero-stats span {
  display: block;
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 4px;
}

.strategy-hero-stats b {
  font-size: 14px;
  color: var(--gold-soft);
}

.strategy-axis,
.strategy-rival {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 10px;
  align-items: center;
}

.strategy-axis {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.strategy-num {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(193, 162, 109, 0.25);
}

.strategy-num--axis {
  color: #1a1204;
  background: linear-gradient(180deg, #e5c78f, #c1a26d);
  border: 0;
}

.strategy-axis strong,
.strategy-rival strong {
  display: block;
  font-size: 14px;
  color: #fff;
}

.strategy-rival em {
  font-style: normal;
  color: var(--gold-soft);
  font-size: 11px;
  font-weight: 700;
}

.strategy-axis p,
.strategy-rival p {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

.strategy-rivals {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.strategy-tickets {
  display: grid;
  gap: 10px;
}

.strategy-ticket {
  padding: 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.strategy-ticket.is-main {
  border-color: rgba(193, 162, 109, 0.4);
  background: rgba(193, 162, 109, 0.08);
}

.strategy-ticket-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.strategy-ticket-top h4 {
  margin: 0;
  font-size: 13px;
  color: #fff;
}

.strategy-ticket-top b {
  color: var(--gold-soft);
  font-size: 13px;
}

.strategy-legs {
  margin: 8px 0 0;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.02em;
}

.strategy-ticket-meta {
  margin: 4px 0 0;
  font-size: 11px;
  color: var(--muted);
}

.strategy-scenarios {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 12px;
}

.strategy-scenarios strong {
  display: block;
  font-size: 13px;
  color: var(--gold-soft);
  margin-bottom: 4px;
}

.strategy-scenarios p {
  margin: 0;
  font-size: 12px;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.82);
}

.strategy-bank {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.strategy-bank div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.strategy-bank span { color: var(--muted); }
.strategy-bank b { color: var(--gold-soft); }

.strategy-risk {
  margin: 0;
  font-size: 12px;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.8);
}

.strategy-risk strong {
  color: #e0a06a;
}

.strategy-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding-bottom: 8px;
}

.strategy-btn {
  display: grid;
  place-items: center;
  width: 100%;
  height: 44px;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  padding: 0 10px;
  color: #1a1204;
  background: linear-gradient(180deg, #e5c78f, #c1a26d 55%, #9f7e4a);
  cursor: pointer;
}

.strategy-btn--ghost {
  color: var(--gold-soft);
  background: transparent;
  border: 1px solid rgba(193, 162, 109, 0.45);
}

/* レース詳細: 買い目戦略CTAは評価内訳の直下（通常フロー） */
.fab-bet {
  display: flex;
  justify-content: center;
  margin: 4px 0 8px;
  padding: 0;
  position: static;
  transform: none;
  pointer-events: auto;
}

.fab-bet a,
.fab-bet button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  height: 48px;
  line-height: 1.2;
  padding: 0 20px;
  border-radius: 999px;
  border: 0;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  color: #1a1204;
  background: linear-gradient(180deg, #e5c78f, #c1a26d 50%, #9f7e4a);
  box-shadow: 0 8px 20px rgba(193, 162, 109, 0.28);
}

/* —— 分析 —— */
.gauge-hero {
  display: grid;
  place-items: center;
  padding: 8px 0 4px;
}

.gauge-ring {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #0d121a 58%, transparent 59%),
    conic-gradient(#d4b37d 0 92%, rgba(255, 255, 255, 0.08) 92% 100%);
  display: grid;
  place-items: center;
  box-shadow: 0 0 0 1px rgba(193, 162, 109, 0.25);
}

.gauge-ring strong {
  font-family: var(--display);
  font-size: 36px;
  color: var(--gold-soft);
  line-height: 1;
}

.gauge-ring small {
  display: block;
  margin-top: 4px;
  text-align: center;
  font-size: 11px;
  color: var(--muted);
}

.score-list { display: grid; gap: 10px; }

.score-row {
  display: grid;
  grid-template-columns: 92px 1fr auto;
  gap: 8px;
  align-items: center;
  font-size: 12px;
}

.score-row span { color: var(--muted); }
.score-row b { color: var(--gold-soft); font-variant-numeric: tabular-nums; }

.score-bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.score-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #8c6e42, #d4b37d);
}

.chart-card {
  padding: 12px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid rgba(193, 162, 109, 0.16);
}

.chart-card h3 {
  margin: 0 0 10px;
  font-size: 13px;
  color: #fff;
}

.analysis-lead {
  margin: -4px 0 14px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

.pie-layout {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: center;
}

.pie-chart {
  position: relative;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(193, 162, 109, 0.22);
}

.pie-chart--lg {
  width: 148px;
  height: 148px;
}

.pie-chart--md {
  width: 112px;
  height: 112px;
}

.pie-chart--sm {
  width: 44px;
  height: 44px;
  margin-top: 8px;
}

.pie-chart::after {
  content: "";
  position: absolute;
  inset: 18%;
  border-radius: 50%;
  background: #141820;
  box-shadow: inset 0 0 0 1px rgba(193, 162, 109, 0.12);
}

.pie-chart--sm::after {
  inset: 28%;
}

.pie-chart-center {
  position: absolute;
  inset: 18%;
  z-index: 1;
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
}

.pie-chart-center strong {
  font-family: var(--display);
  font-size: 26px;
  font-weight: 700;
  color: #fff;
  line-height: 1;
}

.pie-chart--md .pie-chart-center strong {
  font-size: 22px;
}

.pie-chart-center small {
  margin-top: 4px;
  font-size: 10px;
  color: var(--muted);
  font-weight: 600;
}

.pie-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.pie-legend li {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  gap: 8px;
  align-items: center;
  font-size: 12px;
}

.pie-legend i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: block;
}

.pie-legend span {
  color: rgba(255, 255, 255, 0.85);
}

.pie-legend b {
  color: var(--gold-soft);
  font-variant-numeric: tabular-nums;
}

.pie-legend-empty {
  display: block !important;
  font-size: 12px;
  line-height: 1.55;
  color: var(--muted);
}

.pie-legend--compact {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  gap: 6px;
}

.pie-legend--compact li {
  font-size: 11px;
}

.fav-ai-grid {
  display: grid;
  gap: 12px;
}

.fav-ai-card {
  padding: 12px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(193, 162, 109, 0.14);
}

.fav-ai-card-top {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: center;
}

.fav-ai-meta h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}

.fav-ai-meta p {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.fav-ai-conf {
  margin: 6px 0 0 !important;
  font-size: 11px !important;
  color: var(--gold-soft) !important;
  font-weight: 700;
}

.fav-ai-meta a {
  display: inline-flex;
  margin-top: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--gold-soft);
}

.fav-ai-empty {
  padding: 18px 12px;
  text-align: center;
  border-radius: 12px;
  border: 1px dashed rgba(193, 162, 109, 0.28);
}

.fav-ai-empty p {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--muted);
}

.fav-ai-empty a {
  font-size: 13px;
  font-weight: 700;
  color: var(--gold-soft);
}

@media (max-width: 360px) {
  .pie-layout {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .pie-legend {
    width: 100%;
  }
}

.line-chart {
  width: 100%;
  height: 120px;
  display: block;
}

.bar-list { display: grid; gap: 8px; }

.bar-item {
  display: grid;
  grid-template-columns: 72px 1fr 36px;
  gap: 8px;
  align-items: center;
  font-size: 12px;
}

.bar-item .score-bar i { width: var(--w, 50%); }

/* —— 今日の運試し —— */
.fortune-hero {
  padding: 22px 16px 18px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(193, 162, 109, 0.32);
  text-align: center;
  background:
    radial-gradient(120% 90% at 50% -10%, rgba(212, 179, 125, 0.22), transparent 55%),
    linear-gradient(165deg, #1c2433 0%, #121820 100%);
}

.fortune-hero.is-reveal {
  animation: fortune-reveal 0.45s ease both;
}

@keyframes fortune-reveal {
  from { opacity: 0.55; transform: translateY(6px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.fortune-kicker {
  margin: 0;
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}

.fortune-result-row {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 14px;
  margin-top: 14px;
  text-align: left;
}

.fortune-emotion {
  flex: 0 0 auto;
  width: min(40vw, 136px);
  aspect-ratio: 1 / 1;
  border-radius: 18px;
  overflow: hidden;
  background: #0a0c10;
  border: 1px solid rgba(193, 162, 109, 0.28);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
}

.fortune-emotion img {
  display: block;
  width: 118%;
  height: 118%;
  max-width: none;
  object-fit: cover;
  /* キャラを左下寄せ（スタンプ内ラベルは切れてもOK） */
  object-position: 28% 100%;
  transform: translate(-6%, 10%);
  background: #0a0c10;
}

.page-fortune .mascot-ka0ba {
  bottom: calc(6.6rem + env(safe-area-inset-bottom, 0px));
}

.fortune-result-text {
  flex: 1 1 auto;
  min-width: 0;
}

.fortune-rank-label {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--gold);
  font-weight: 700;
}

.fortune-rank {
  margin: 6px 0 0;
  font-family: var(--display);
  font-size: clamp(40px, 12vw, 52px);
  font-weight: 700;
  line-height: 1;
  color: #ffe7a8;
  text-shadow: 0 0 24px rgba(212, 179, 125, 0.35);
}

.fortune-score {
  margin: 8px 0 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--gold-soft);
}

.fortune-emotion-label {
  margin: 8px 0 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: rgba(255, 231, 168, 0.72);
}

.fortune-message {
  margin: 14px 0 0;
  font-size: 13px;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.88);
  text-align: center;
}

.fortune-lucky {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0;
}

.fortune-lucky li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 13px;
}

.fortune-lucky li:first-child { border-top: 0; padding-top: 0; }
.fortune-lucky span { color: var(--muted); }
.fortune-lucky b { color: #ffe7a8; font-weight: 700; }

.fortune-advice {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.88);
}

.fortune-draw {
  width: 100%;
  height: 48px;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  color: #1a1204;
  background: linear-gradient(180deg, #e5c78f, #c1a26d 55%, #9f7e4a);
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(193, 162, 109, 0.28);
}

.fortune-note {
  margin: 0;
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.45;
}

/* —— 今月の成績 —— */
.balance-hero {
  padding: 18px 16px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(193, 162, 109, 0.28);
  background:
    radial-gradient(120% 80% at 100% 0%, rgba(193, 162, 109, 0.16), transparent 55%),
    linear-gradient(160deg, #1a2230 0%, #121820 100%);
}

.balance-hero-label {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.balance-hero-value {
  margin: 8px 0 6px;
  font-family: var(--display);
  font-size: clamp(40px, 12vw, 52px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.02em;
}

.balance-hero-sub {
  margin: 0;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.78);
}

.balance-hero-sub strong {
  color: var(--gold-soft);
}

.balance-week,
.balance-notes {
  padding: 14px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid rgba(193, 162, 109, 0.16);
}

.balance-week h3,
.balance-notes h3 {
  margin: 0 0 10px;
  font-size: 14px;
  color: #fff;
}

.balance-week-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0;
}

.balance-week-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 13px;
}

.balance-week-list li:first-child {
  border-top: 0;
  padding-top: 0;
}

.balance-week-list span {
  color: var(--muted);
}

.balance-week-list b,
.stat-cell b.is-plus,
.is-plus {
  color: #7dcea0;
}

.is-minus {
  color: #e07070;
}

.balance-notes p {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.82);
}

.balance-link {
  display: inline-flex;
  font-size: 13px;
  font-weight: 700;
  color: var(--gold-soft);
}

/* —— 保存レース（互換） —— */
.saved-list { display: grid; gap: 10px; }

.saved-item {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid rgba(193, 162, 109, 0.16);
  text-decoration: none;
  color: inherit;
}

.saved-thumb {
  width: 72px;
  height: 56px;
  border-radius: 10px;
  object-fit: cover;
  background: #1a2030;
}

.saved-item h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

.saved-item p {
  margin: 3px 0 0;
  font-size: 11px;
  color: var(--muted);
}

/* —— マイページ —— */
.profile-card {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border-radius: var(--radius-lg);
  background: var(--card);
  border: 1px solid rgba(193, 162, 109, 0.2);
}

.profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(193, 162, 109, 0.45);
  background: #1a2030;
}

.profile-card h2 {
  margin: 0;
  font-size: 16px;
}

.profile-card .meta {
  margin: 4px 0 0;
  font-size: 11px;
  color: var(--muted);
}

.badge-premium {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  color: #1a1204;
  background: linear-gradient(90deg, #e5c78f, #c1a26d);
}

.level-bar {
  margin-top: 8px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.level-bar i {
  display: block;
  width: 68%;
  height: 100%;
  background: linear-gradient(90deg, #8c6e42, #d4b37d);
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid rgba(193, 162, 109, 0.16);
}

.stats-grid h3 {
  grid-column: 1 / -1;
  margin: 0 0 4px;
  font-size: 13px;
}

.stat-cell {
  padding: 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
}

.stat-cell span {
  display: block;
  font-size: 11px;
  color: var(--muted);
}

.stat-cell b {
  display: block;
  margin-top: 4px;
  font-size: 18px;
  font-family: var(--display);
  color: var(--gold-soft);
}

.menu-list {
  display: grid;
  gap: 2px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid rgba(193, 162, 109, 0.16);
  background: var(--card);
}

.menu-list a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 12px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.menu-list a:last-child { border-bottom: 0; }
.menu-list a span { color: var(--gold); }

/* —— チャット —— */
.page-chat .app { padding-bottom: 0; }
.page-chat .bottom-nav { display: none; }

.chat-shell {
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - 72px);
  padding-bottom: 0;
}

.chat-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-head img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(193, 162, 109, 0.4);
}

.chat-head h1 {
  margin: 0;
  font-size: 16px;
}

.chat-log {
  flex: 1;
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 8px 0 12px;
  overflow-y: auto;
}

.msg {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  max-width: 92%;
}

.msg-ai { align-self: start; }
.msg-user {
  align-self: end;
  margin-left: auto;
  flex-direction: row-reverse;
}

.msg img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 auto;
}

.msg-bubble {
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.45;
}

.msg-ai .msg-bubble {
  background: #1a2030;
  border: 1px solid rgba(193, 162, 109, 0.18);
  color: #f0f2f5;
  border-bottom-left-radius: 4px;
}

.msg-user .msg-bubble {
  background: #2f6fed;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-composer {
  position: sticky;
  bottom: 0;
  padding: 8px 0 calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, transparent, #080c12 28%);
  display: grid;
  gap: 8px;
}

.chat-quick {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.chat-quick::-webkit-scrollbar { display: none; }

.chat-input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.chat-input-row input {
  height: 42px;
  border-radius: 999px;
  border: 1px solid rgba(193, 162, 109, 0.28);
  background: #141820;
  color: #fff;
  padding: 0 14px;
  font: inherit;
  outline: none;
}

.chat-input-row input::placeholder { color: #6e7685; }

.chat-send {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #1a1204;
  background: linear-gradient(180deg, #e5c78f, #c1a26d);
}

.topbar-title-only .brand-name { font-size: 22px; }
.topbar-title-only .brand-sub { display: none; }

.page-screen .home-chrome,
.page-screen .main:not(.is-visible) { display: none; }

.page-screen .mascot-ka0ba { z-index: 40; }
