:root {
  color-scheme: light;
  --ground: #f2f1ec;
  --panel: #ffffff;
  --panel-2: #f7f6f1;
  --line: #dcd9cf;
  --ink: #3a3631;
  --ink-dim: #77716a;
  --green: #2f7a35;
  --green-deep: #245f2a;
  --green-soft: #e7f1e3;
  --butter: #f3e3a2;
  --butter-soft: #fbf5dc;
  --board: #17321c;
  --led: #ffe58a;
  --led-2: #f4f7ef;
  --danger-soft: #f6e1df;
  --font-led: "DotGothic16", "MS Gothic", monospace;
  --font-body: "Zen Maru Gothic", "Hiragino Sans", "Yu Gothic", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--ground); color: var(--ink); font-family: var(--font-body); font-size: 15px; line-height: 1.6; font-variant-numeric: tabular-nums; }
.wrap { max-width: 1080px; margin: 0 auto; padding-block: 20px 48px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; }
a { color: var(--green-deep); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; cursor: pointer; }
button:disabled { opacity: .45; cursor: default; }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid var(--green-deep); outline-offset: 3px; }
.num { font-variant-numeric: tabular-nums; }
.top { background: var(--green-deep); color: var(--panel); border-radius: 8px; padding: 16px 20px; display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; }
.brand { font-size: 26px; font-weight: 700; color: var(--panel); }
.meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--panel); font-size: 13px; overflow-wrap: anywhere; }
main { display: grid; gap: 28px; min-width: 0; }
h2 { margin: 0; font-family: var(--font-body); font-size: 18px; font-weight: 700; border-left: 6px solid var(--green); padding-left: 10px; display: flex; align-items: center; gap: 10px; }
h3 { font-size: 15px; margin: 18px 0 8px; }
section { display: grid; gap: 14px; min-width: 0; }
.tabs, .day-nav { display: flex; flex-wrap: wrap; gap: 10px; }
.tabs a, .day-nav a, .cal-month button { padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--green-deep); }
.tabs a[aria-current] { border-color: var(--green); background: var(--panel); font-weight: 700; }
#notice:empty { display: none; }
#notice { margin: 0; color: var(--ink); }
details { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; min-width: 0; }
summary { cursor: pointer; overflow-wrap: anywhere; }
.guide summary { font-weight: 700; color: var(--green-deep); }
.guide ul { margin: 0; padding-left: 1.4em; }
.guide li + li { margin-top: 8px; }
details .checks { margin-top: 14px; }

/* Clear LED lettering, without a pixel overlay. */
.board { background: var(--board); border: 2px solid var(--green); border-radius: 8px; overflow: hidden; min-width: 0; }
.ticker { white-space: nowrap; overflow: hidden; margin-inline: 16px; padding-block: 14px; border-bottom: 1px solid var(--green); }
.ticker-track { display: inline-flex; align-items: center; width: max-content; min-width: 200%; animation: marquee 38s linear infinite; font-family: var(--font-led); font-size: 24px; color: var(--led); text-shadow: 0 0 4px var(--led); }
.ticker-group { display: flex; align-items: center; gap: 28px; padding-right: 28px; flex: 1 0 auto; }
.ticker-group > span { flex-shrink: 0; }
.ticker-separator { color: var(--led-2); text-shadow: 0 0 4px var(--led-2); }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.board-main { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px 24px; align-items: center; padding: 20px; font-family: var(--font-led); }
.board-label { font-size: 13px; letter-spacing: .12em; color: var(--led-2); margin-bottom: 8px; }
.board-race { font-size: clamp(32px, 5vw, 48px); line-height: 1.35; color: var(--led); text-shadow: 0 0 4px var(--led); overflow-wrap: anywhere; }
.board-time { display: block; font-size: 20px; color: var(--led); text-shadow: 0 0 4px var(--led); margin-top: 6px; }
.board-sub { font-size: 18px; color: var(--led); margin-top: 8px; text-shadow: 0 0 4px var(--led); }
.count { text-align: right; }
.count-num { font-family: var(--font-led); font-size: clamp(44px, 6vw, 64px); line-height: 1.2; color: var(--led); text-shadow: 0 0 4px var(--led); }
@media (max-width: 560px) {
  .board-main { grid-template-columns: minmax(0, 1fr); padding: 18px 16px; }
  .board-race { font-size: 32px; }
  .board-sub, .board-time { font-size: 16px; }
  .count { text-align: left; }
  .count-num { font-size: 44px; }
  .ticker-track { font-size: 20px; }
}

.race-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; }
.race-head .rn { font-size: 30px; font-weight: 700; }
.race-head .pt { color: var(--ink-dim); }
.checks { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 14px; }
.check { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px 16px; display: grid; gap: 12px; min-width: 0; }
.check-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.check-title { font-weight: 700; }
.check-title span { display: block; color: var(--ink-dim); font-weight: 400; font-size: 13px; margin-top: 4px; }
.pill { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); }
.pill.cand { color: var(--ink); background: var(--butter); border-color: var(--butter); }
.pill.buy { color: var(--panel); background: var(--green); border-color: var(--green); }
.pill.wait { color: var(--ink-dim); background: var(--panel); border-color: var(--line); }
.pill.skip { color: var(--ink); background: var(--danger-soft); }
.pill.nobuy { color: var(--ink-dim); background: var(--panel); }
.horse { display: grid; gap: 10px; padding: 12px; border-radius: 8px; background: var(--panel-2); }
.horse.is-buy { outline: 1px solid var(--green); background: var(--green-soft); }
.horse-name { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.uma { font-weight: 700; font-size: 18px; min-width: 2.2em; text-align: center; padding: 0 6px; border-radius: 8px; background: var(--panel); color: var(--ink); }
.bamei { font-size: 18px; font-weight: 700; overflow-wrap: anywhere; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 8px; }
.stat { display: grid; gap: 0; }
.stat dt { font-size: 11px; color: var(--ink-dim); }
.stat dd { margin: 0; font-size: 17px; font-weight: 700; }
.stat.border dd { color: var(--ink); background: var(--butter-soft); border-radius: 6px; padding-inline: 4px; width: fit-content; }
@media (max-width: 420px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.no-buy { background: var(--panel-2); color: var(--ink); border-radius: 8px; padding: 16px; }
.no-buy strong { font-size: 20px; }
.no-buy p { margin: 8px 0 0; overflow-wrap: anywhere; }
.race-summary { display: flex; flex-wrap: wrap; gap: 4px 8px; margin: 0; padding: 12px 14px; background: var(--panel-2); border-radius: 8px; font-weight: 700; }
.pending { display: grid; place-items: center; min-height: 150px; border: 1px dashed var(--line); border-radius: 8px; color: var(--ink-dim); text-align: center; padding: 12px; }
.pending .big { font-size: 24px; color: var(--green-deep); }
.seg { display: inline-flex; flex-wrap: wrap; width: fit-content; max-width: 100%; border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button { background: var(--panel); color: var(--ink-dim); border: 0; border-radius: 999px; padding: 5px 14px; font-size: 13px; }
.seg button[aria-pressed="true"] { background: var(--green-soft); color: var(--green-deep); font-weight: 700; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr)); gap: 10px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; display: grid; gap: 2px; min-width: 0; }
.tile .k { font-size: 12px; color: var(--ink-dim); }
.tile .v { font-size: 30px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.tile.roi .v { color: var(--green-deep); }
.tbl-wrap { overflow-x: auto; max-width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
table { width: 100%; border-collapse: collapse; min-width: 640px; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 12px; font-weight: 500; color: var(--panel); background: var(--green); }
tbody tr:nth-child(even) td, .day-races tr.race-row:nth-child(4n+3) td { background: var(--panel-2); }
td.r, th.r { text-align: right; }
tbody tr:last-child td { border-bottom: 0; }
tr.won td, tbody tr.won:nth-child(even) td, .day-races tr.race-row.won td { background: var(--butter-soft); }
.fin { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; font-weight: 700; border: 1px solid var(--ink-dim); color: var(--ink); }
.fin.f1 { background: var(--butter); border-color: var(--butter); }
.fin.f2, .fin.f3 { background: none; border-color: var(--ink-dim); }
.buyst { font-size: 12px; }
.buyst.ok { color: var(--green-deep); }
.buyst.ng { color: var(--ink); }
.muted { color: var(--ink-dim); }
.cal-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 16px; }
@media (max-width: 760px) { .cal-grid { grid-template-columns: minmax(0, 1fr); } }
.cal { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px; display: grid; gap: 8px; min-width: 0; }
.cal-month { display: flex; justify-content: space-between; gap: 6px; align-items: center; }
.cal-month b { font-size: 18px; }
.cal-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; text-align: center; }
.cal-days .dow { font-size: 11px; color: var(--ink-dim); padding-bottom: 2px; }
.cal-days .d { aspect-ratio: 1; max-width: 100%; display: grid; place-content: center; border-radius: 8px; font-size: 14px; color: var(--ink-dim); }
.cal-days a.d { color: var(--ink); background: var(--panel-2); border: 1px solid var(--line); line-height: 1.2; position: relative; }
.cal-days a.d small { font-size: 10px; }
.cal-days a.d.up { border-color: var(--green); background: var(--green-soft); }
.cal-days a.d.up small { color: var(--green-deep); }
.model-mark { color: var(--green-deep); position: absolute; top: 0; right: 3px; font-size: 10px; }
.period { display: grid; gap: 12px; align-content: start; min-width: 0; }
.note { font-size: 12px; color: var(--ink-dim); line-height: 1.7; }
footer { border-top: 1px solid var(--line); padding-top: 14px; }
.flash { border-color: var(--green); }
.check-note { border-top: 1px solid var(--line); padding-top: 10px; margin: 0; align-self: end; }
.race-row { cursor: pointer; }
.race-row:hover td { background: var(--green-soft); }
.race-toggle { border: 0; background: none; padding: 0; color: var(--green-deep); text-decoration: underline; }
.race-horse, .race-result { min-height: 32px; display: flex; align-items: center; }
.race-result { justify-content: center; }
.race-table td.r .race-result { justify-content: flex-end; }
.race-detail > td { white-space: normal; padding: 16px; }
.race-detail[hidden] { display: none; }
.race-detail .checks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (prefers-reduced-motion: reduce) {
  *, *::before { animation: none !important; }
  .ticker { overflow-x: auto; }
  .ticker-track { min-width: 100%; }
  .ticker-group[aria-hidden="true"] { display: none; }
}

.slump { margin-top: 12px; }
.slump-plot { position: relative; min-width: 0; background: var(--panel); border-radius: 8px; }
.slump-svg { display: block; width: 100%; height: 280px; overflow: hidden; }
.slump-svg text { fill: var(--ink-dim); font-size: 11px; }
.slump-svg polyline { fill: none; stroke-width: 2; stroke-linejoin: round; }
.slump-grid, .slump-boundary { stroke: var(--line); stroke-width: 1; }
.slump-boundary { opacity: .65; }
.slump-zero { stroke: var(--ink-dim); stroke-width: 1.5; }
.slump-investment { stroke: #b5832a; stroke-dasharray: 6 4; }
.slump-return { stroke: var(--green); }
.slump-end line { stroke-width: 2; }
.slump-end text { fill: var(--ink); font-size: 10px; }
.slump-hit { fill: #d9a521; stroke: var(--green); stroke-width: 2; }
.slump-crosshair { stroke: var(--ink-dim); stroke-width: 1; stroke-dasharray: 3 3; pointer-events: none; }
.slump-crosshair[hidden] { display: none; }
.slump-tooltip { position: absolute; top: 4px; max-width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink); white-space: pre-line; overflow-wrap: anywhere; font-size: 12px; pointer-events: none; box-shadow: 0 2px 6px #0002; }
.slump-legend { display: flex; gap: 20px; font-size: 12px; }
.slump-legend span { display: inline-flex; align-items: center; gap: 6px; }
.slump-legend i { width: 24px; border-top: 2px solid var(--green); }
.slump-legend .investment { border-top: 2px dashed #b5832a; }
.slump-metrics { margin: 0; }
@media (max-width: 560px) { .slump-svg { height: 220px; } }

.brand-tag { font-size: 14px; font-weight: 500; margin-left: 4px; opacity: .85; }
.tabs #settings-open{margin-left:auto;font-size:.9rem;align-self:center;padding:.4rem .7rem}
dialog{max-width: min(90vw, 520px);max-height:85vh;overflow:auto;border:1px solid #245f2a;border-radius:12px;padding:1.3rem;color:#233524;background:#f2f1ec}
dialog::backdrop{background:#0007}#settings-close{float:right}dialog fieldset{margin:1rem 0}dialog label{display:block;margin:.6rem 0}dialog p{line-height:1.7}.invite-login{margin:1rem 0}.invite-login input{display:block;width:100%;box-sizing:border-box;margin:.5rem 0}
.guide-updated { margin: 0 0 4px; font-size: 12px; color: var(--ink-dim); }
