:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1d2330;
  --muted: #6b7280;
  --line: #e2e5ea;
  --accent: #1f6feb;
  --accent-soft: #e6efff;
  --error: #c62828;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171c;
    --card: #1d2128;
    --text: #e6e8eb;
    --muted: #9aa3ae;
    --line: #2f3540;
    --accent: #5b9dff;
    --accent-soft: #1f2d44;
    --error: #ff6b6b;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}
header { padding: 12px 16px; }
h1 { font-size: 20px; margin: 0; }
h2 { font-size: 16px; margin: 0 0 8px; }
main { max-width: 760px; margin: 0 auto; padding: 0 16px 32px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 14px;
}
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
label { display: inline-flex; gap: 6px; align-items: center; }
select, button, .file-button {
  font: inherit;
  min-height: 40px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
  cursor: pointer;
}
.file-button { display: inline-flex; align-items: center; }
.muted { color: var(--muted); font-size: 13px; margin: 4px 0; }
.error { color: var(--error); margin: 4px 0; }
.error a { color: inherit; text-decoration: underline; font-weight: 600; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 4px 4px; border-bottom: 1px solid var(--line); text-align: center; }
th { font-size: 13px; color: var(--muted); font-weight: 600; }

.marks .name { text-align: left; width: 100%; }
.marks td.name { font-size: 14px; line-height: 1.25; word-break: break-all; }
.marks .odds { font-size: 13px; white-space: nowrap; }
.marks .col-toggle { min-height: 34px; padding: 4px 8px; font-size: 13px; }
.marks td.mark { padding: 0; }
.marks td.mark label {
  display: flex; justify-content: center; align-items: center;
  width: 48px; height: 44px; margin: 0 auto; cursor: pointer;
}
.marks input[type="checkbox"] { width: 24px; height: 24px; accent-color: var(--accent); cursor: pointer; }
.marks tr.checked-any td.num, .marks tr.checked-any td.name { font-weight: 600; }
#clear-marks { margin-top: 10px; }
.marks tr.scratched td { color: var(--muted); text-decoration: line-through; }

.frame {
  display: inline-block; min-width: 30px; padding: 2px 4px; border-radius: 4px;
  border: 1px solid #999; font-weight: 600; font-size: 14px;
}
.frame-1 { background: #fff; color: #000; }
.frame-2 { background: #000; color: #fff; }
.frame-3 { background: #e53935; color: #fff; }
.frame-4 { background: #1e5bd8; color: #fff; }
.frame-5 { background: #fdd835; color: #000; }
.frame-6 { background: #2e9d48; color: #fff; }
.frame-7 { background: #fb8c00; color: #000; }
.frame-8 { background: #f48fb1; color: #000; }

.results td:first-child { text-align: left; font-weight: 600; white-space: nowrap; }
.results td.composite { font-variant-numeric: tabular-nums; white-space: nowrap; }
.results tr.bet { cursor: pointer; }
.results tr.bet:hover { background: var(--accent-soft); }
.results tr.not-sold td { color: var(--muted); }
.results tr.tickets td { text-align: left; font-size: 13px; color: var(--muted); }
.ticket-list { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.yes { color: var(--accent); font-weight: 600; }

/* --- 共通部品（第3段階） --- */
header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; max-width: 760px; margin: 0 auto; }
header h1 a { color: inherit; text-decoration: none; }
nav { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; font-size: 14px; }
nav a, button.link { color: var(--accent); text-decoration: none; }
button.link { border: none; background: none; padding: 0; min-height: auto; font-size: 14px; }
form.inline { display: inline; }
.flash { background: var(--accent-soft); border-radius: 8px; padding: 8px 12px; margin: 0 0 12px; }
.narrow { max-width: 420px; margin: 24px auto; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.stack label { display: flex; flex-direction: column; align-items: stretch; gap: 4px; font-size: 14px; }
.stack label.check { flex-direction: row; align-items: center; }
input[type="text"], input:not([type]), input[type="password"], input[type="url"], input[type="number"] {
  font: inherit; min-height: 40px; padding: 6px 10px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--card); color: var(--text); width: 100%;
}
input.short { width: 7.5em; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button:disabled { opacity: .5; cursor: default; }
.spaced { margin-top: 10px; }
.entry-list { list-style: none; margin: 0; padding: 0; }
.entry-list li { border-bottom: 1px solid var(--line); }
.entry-list a { display: flex; flex-direction: column; padding: 10px 2px; color: inherit; text-decoration: none; }
td.left, th.left { text-align: left; }
td.actions { text-align: right; white-space: nowrap; }
td.actions button { min-height: 34px; padding: 4px 8px; font-size: 13px; }
.history td, .conditions td, .users td { font-size: 14px; }
.users td.actions { white-space: normal; }
.users td.actions .short { width: 9em; display: inline-block; }
