:root {
  --bg: #f4f5fa;
  --card: #ffffff;
  --ink: #1d2433;
  --muted: #6b7385;
  --line: #e6e8f0;
  --accent: #4f46e5;
  --accent-2: #7c3aed;
  --accent-soft: #eef0ff;
  --hot: #f2665a;
  --cold: #dfe4ee;
  --cold-ink: #3a4559;
  --gold: #f5b700;
  --silver: #a3a9b5;
  --bronze: #c47a3a;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(20, 24, 40, .04), 0 6px 24px rgba(20, 24, 40, .06);
  font-family: "Hiragino Sans", "Yu Gothic UI", "Meiryo", "Noto Sans JP", "Noto Sans CJK JP", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); -webkit-text-size-adjust: 100%; }
body { padding-bottom: env(safe-area-inset-bottom); }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
h1, h2 { margin: 0; }
h2 { font-size: 16px; letter-spacing: .02em; margin-bottom: 14px; }
button { font: inherit; cursor: pointer; }
input, select { font: inherit; color: inherit; }

/* ヘッダー */
.top {
  position: sticky; top: 0; z-index: 10;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; padding-top: env(safe-area-inset-top);
  box-shadow: 0 4px 20px rgba(79, 70, 229, .25);
}
.top-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 14px; padding-bottom: 10px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo { width: 40px; height: 40px; border-radius: 10px; background: #fff; flex: none; }
.brand h1 { font-size: 19px; font-weight: 800; letter-spacing: .03em; white-space: nowrap; }
.sub { margin: 2px 0 0; font-size: 12px; opacity: .85; }
.data-status { display: flex; align-items: center; gap: 8px; font-size: 12px; white-space: nowrap; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid rgba(255,255,255,.4);
  background: rgba(255,255,255,.12); color: #fff; font-size: 18px; line-height: 1;
}
.icon-btn.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.tabs { display: flex; gap: 6px; padding-bottom: 12px; }
.tab {
  flex: 1; max-width: 160px; padding: 9px 0; border-radius: 999px; border: 0;
  background: rgba(255,255,255,.14); color: #fff; font-weight: 700; font-size: 14px;
}
.tab.active { background: #fff; color: var(--accent); }

/* レイアウト */
.grid { display: grid; gap: 16px; padding-top: 16px; padding-bottom: 16px; }
.col { display: grid; gap: 16px; align-content: start; min-width: 0; }
@media (min-width: 900px) { .grid { grid-template-columns: 1.15fr 1fr; } }
.card { scroll-margin-top: 140px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.card-head h2 { margin: 0; }

/* 入力 */
.field { display: block; margin-bottom: 12px; }
.label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
select, input[type="text"], input:not([type]), input[inputmode] {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fafbff;
}
select:focus, input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.desc { font-size: 13px; color: var(--muted); line-height: 1.7; background: var(--accent-soft); border-radius: 10px; padding: 10px 12px; margin: -2px 0 14px; }
.desc b { color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button { min-width: 48px; padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-weight: 700; }
.chips button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.more { margin: 4px 0 12px; }
.more summary { font-size: 13px; color: var(--accent); cursor: pointer; margin-bottom: 10px; font-weight: 600; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.btn { white-space: nowrap; flex: none; border-radius: 12px; padding: 12px 18px; font-weight: 700; border: 1px solid transparent; }
.btn.primary { background: var(--accent); color: #fff; box-shadow: 0 4px 14px rgba(79,70,229,.3); }
.btn.primary:active { transform: translateY(1px); }
.btn.ghost { background: #fff; border-color: var(--accent); color: var(--accent); }
.btn.small { padding: 6px 12px; font-size: 13px; border-radius: 10px; }
.btn:disabled { opacity: .5; }

/* 数字の玉 */
.balls { display: flex; flex-wrap: wrap; gap: 6px; }
.ball {
  position: relative; width: 36px; height: 36px; border-radius: 50%;
  display: inline-grid; place-items: center; font-weight: 800; font-size: 14px;
  background: radial-gradient(circle at 30% 28%, #8a83ff, var(--accent) 60%, #3a32c4);
  color: #fff; font-variant-numeric: tabular-nums; flex: none;
}
.ball.hot { background: radial-gradient(circle at 30% 28%, #ff9d93, var(--hot) 60%, #d9483d); }
.ball.cold { background: var(--cold); color: var(--cold-ink); }
.ball.bonus { background: #fff; color: #b7791f; box-shadow: inset 0 0 0 2px #f2c14e; }
.ball.hit { box-shadow: 0 0 0 3px #22c55e; }
.ball.sm { width: 30px; height: 30px; font-size: 12px; }
.crown { position: absolute; top: -15px; left: 50%; transform: translateX(-50%); width: 22px; height: 14px; }

.trend { display: grid; gap: 18px; }
.trend-row { display: grid; gap: 18px; }
.trend-label { font-size: 12px; color: var(--muted); font-weight: 700; }
.trend .balls { gap: 10px; padding-top: 8px; }

.sets { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-height: 560px; overflow: auto; }
.sets li { display: grid; grid-template-columns: 30px 1fr; align-items: center; gap: 8px; padding: 10px; border-radius: 12px; background: #fafbff; border: 1px solid var(--line); }
.sets .idx { font-size: 12px; color: var(--muted); text-align: right; }
.sets .meta { grid-column: 2; font-size: 12px; color: var(--muted); }
.sets .prize { color: #16a34a; font-weight: 800; margin-left: 6px; }

.draws { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.draws li { display: grid; gap: 6px; padding-bottom: 10px; border-bottom: 1px dashed var(--line); }
.draws li:last-child { border-bottom: 0; padding-bottom: 0; }
.draws .when { font-size: 12px; color: var(--muted); }
.draws .when b { color: var(--ink); }

.check-result { margin-top: 12px; font-size: 14px; line-height: 1.7; }
.check-result .big { font-size: 20px; font-weight: 800; color: #16a34a; }

/* 検証 */
.bt-bars { display: grid; gap: 10px; margin: 6px 0 12px; }
.bt-row { display: grid; grid-template-columns: 110px 1fr 46px; align-items: center; gap: 8px; font-size: 13px; }
.bt-track { height: 12px; border-radius: 999px; background: var(--accent-soft); overflow: hidden; }
.bt-fill { height: 100%; border-radius: 999px; background: var(--accent); }
.bt-fill.base { background: var(--silver); }
.bt-fill.theory { background: #c7cbe0; }
.bt-row .v { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.note { font-size: 12px; color: var(--muted); line-height: 1.7; margin: 8px 0 0; }

.links { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.links a { display: block; padding: 12px; border-radius: 12px; background: #fafbff; border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-weight: 600; }
.links a::after { content: " ›"; color: var(--accent); }
.pr, .ad-label { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
.ad-card { text-align: center; }
.ad-label { display: inline-block; margin-bottom: 8px; }

.notice ul { margin: 0; padding-left: 1.2em; font-size: 13px; color: var(--muted); line-height: 1.9; }
.foot { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; padding: 8px 16px 32px; font-size: 13px; color: var(--muted); }
.foot a { color: var(--muted); }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px);
  background: #1d2433; color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 13px;
  opacity: 0; pointer-events: none; transition: .25s; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%); }

/* 文書ページ */
.doc { max-width: 760px; margin: 0 auto; padding: 24px 16px 48px; line-height: 1.9; }
.doc h1 { font-size: 22px; margin-bottom: 16px; }
.doc h2 { font-size: 16px; margin: 24px 0 8px; }
.doc a.back { color: var(--accent); }

@media (max-width: 520px) {
  .sub, .data-status .cnt { display: none; }
  .top-inner { padding-top: 10px; padding-bottom: 8px; }
  .logo { width: 34px; height: 34px; }
  .chips { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
  .chips button { min-width: 0; padding: 8px 0; }
  .tab { padding: 8px 0; }
  .brand h1 { font-size: 17px; }
  .ball { width: 32px; height: 32px; font-size: 13px; }
  .bt-row { grid-template-columns: 90px 1fr 40px; }
}
