/* 釣果カウンター web: the sea before dawn - a pale tide-pool ground by day, the night harbor by
   dark mode; one sea-teal accent, the app's medal metals, and a coral pulse for "live". */
:root {
  --bg: #f2f6f7;
  --surface: #ffffff;
  --surface-2: #e6eef1;
  --ink: #12212b;
  --muted: #557080;
  --line: #d3e0e6;
  --accent: #146a8a;
  --accent-ink: #ffffff;
  --accent-soft: #d9ebf2;
  --live: #d4553f;
  --warn-bg: #fbe7e3;
  --warn-ink: #8a2b1b;
  --scheduled-bg: #e3e9f6;
  --scheduled-ink: #2c3f6b;
  --confirmed-bg: #f4ead0;
  --confirmed-ink: #6b4f12;
  --bronze: #b0703c;
  --silver: #9aa4ae;
  --gold: #d4a62a;
  --platinum: #6fb7c9;
  --shadow: 0 1px 2px rgba(18, 33, 43, 0.06), 0 4px 16px rgba(18, 33, 43, 0.05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b141b;
    --surface: #121f28;
    --surface-2: #182a35;
    --ink: #e3edf2;
    --muted: #93abb9;
    --line: #22394a;
    --accent: #5fb6d6;
    --accent-ink: #062130;
    --accent-soft: #15384a;
    --live: #f07a62;
    --warn-bg: #3b1d17;
    --warn-ink: #f6b8aa;
    --scheduled-bg: #1d2a45;
    --scheduled-ink: #bccbf0;
    --confirmed-bg: #3a2f14;
    --confirmed-ink: #ecd396;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "BIZ UDPGothic", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans JP", sans-serif;
  font-size: 16px;
  line-height: 1.75;
}
a { color: var(--accent); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { line-height: 1.35; text-wrap: balance; margin: 0; }
p { margin: 0 0 12px; }
.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

/* ---- Header and footer ---- */
.site-header { border-bottom: 1px solid var(--line); background: var(--surface); }
.site-header .wrap { display: flex; align-items: center; gap: 16px; min-height: 56px; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font-weight: 700; }
.brand .icon { width: 28px; height: 28px; padding: 4px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); }
.site-header nav { margin-left: auto; display: flex; gap: 14px; font-size: 14px; }
.site-header nav a { color: var(--muted); text-decoration: none; }
.site-header nav a:hover { color: var(--accent); }
.site-footer { margin-top: 64px; padding: 24px 0 40px; border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.site-footer a { color: var(--muted); }

/* ---- Icons, chips, buttons ---- */
.icon { display: inline-flex; width: 1.1em; height: 1.1em; vertical-align: -0.15em; flex: none; }
.icon svg, .avatar svg, .medal svg { width: 100%; height: 100%; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px;
  font-size: 13px; font-weight: 700; line-height: 1.6; white-space: nowrap;
  background: var(--surface-2); color: var(--muted);
}
.chip.phase-live { background: var(--live); color: #fff; }
.chip.phase-live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulse 1.6s ease-in-out infinite; }
.chip.phase-scheduled { background: var(--scheduled-bg); color: var(--scheduled-ink); }
.chip.phase-confirmed { background: var(--confirmed-bg); color: var(--confirmed-ink); }
.chip.phase-cancelled { background: var(--warn-bg); color: var(--warn-ink); }
@keyframes pulse { 50% { opacity: 0.35; } }
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 20px;
  border-radius: 999px; border: 0; background: var(--accent); color: var(--accent-ink);
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
}
.button.secondary { background: var(--accent-soft); color: var(--accent); }

/* ---- Top page ---- */
.hero { padding: 40px 0 28px; display: grid; gap: 16px; }
.hero h1 { font-size: clamp(28px, 6vw, 40px); }
.hero .lede { font-size: 17px; max-width: 34em; }
.features { list-style: none; padding: 0; margin: 4px 0 8px; display: grid; gap: 8px; }
.features li { display: flex; gap: 10px; align-items: baseline; }
.features .icon { color: var(--accent); }
.section-title { font-size: 20px; margin: 36px 0 12px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.filter-chip {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-size: 14px;
  padding: 4px 12px; border-radius: 999px; cursor: pointer; min-height: 36px;
}
.filter-chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; margin: 4px 0 12px; }
.segmented button { border: 0; background: var(--surface); color: var(--ink); font: inherit; font-size: 14px; padding: 6px 16px; cursor: pointer; min-height: 36px; }
.segmented button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.list-group { font-size: 14px; font-weight: 700; color: var(--muted); margin: 16px 0 6px; }
.derby-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.derby-row {
  display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-radius: 12px;
  background: var(--surface); box-shadow: var(--shadow); color: var(--ink); text-decoration: none;
}
.derby-row:hover { outline: 1px solid var(--accent); }
.derby-row .body { flex: 1; min-width: 0; }
.derby-row .name { font-weight: 700; overflow-wrap: anywhere; }
.derby-row .meta { font-size: 13px; color: var(--muted); }
.derby-row .species { color: var(--accent); width: 22px; height: 22px; }
.empty { padding: 20px 16px; border-radius: 12px; background: var(--surface); color: var(--muted); }

/* ---- Derby page ---- */
.derby-head { padding: 28px 0 8px; display: grid; gap: 8px; }
.derby-head .chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 14px; color: var(--muted); }
.derby-head h1 { font-size: clamp(24px, 5.5vw, 34px); overflow-wrap: anywhere; }
.derby-head .period { font-size: 17px; font-variant-numeric: tabular-nums; }
.derby-head .facts { font-size: 14px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; }
.derby-head .facts .icon { color: var(--accent); }
.description { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface); border-radius: 12px; padding: 12px 16px; margin: 4px 0 0; }
.notice { border-radius: 12px; padding: 12px 16px; background: var(--warn-bg); color: var(--warn-ink); }
.notice strong { display: block; }
.card { background: var(--surface); border-radius: 16px; padding: 16px; box-shadow: var(--shadow); }
.result { background: var(--confirmed-bg); color: var(--confirmed-ink); }
.result h2 { font-size: 16px; margin-bottom: 8px; }
.winner { display: flex; gap: 10px; align-items: center; padding: 6px 0; }
.winner .name { font-size: 18px; font-weight: 700; }
.app-cta { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin: 20px 0; }
.app-cta p { margin: 0; flex: 1 1 260px; }
.live-note { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.live-note::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--live); animation: pulse 1.6s ease-in-out infinite; }

.tabs { display: flex; gap: 4px; margin: 28px 0 8px; border-bottom: 1px solid var(--line); }
.tabs button {
  border: 0; background: none; color: var(--muted); font: inherit; font-weight: 700; padding: 8px 14px; cursor: pointer;
  border-bottom: 3px solid transparent; margin-bottom: -1px; min-height: 44px;
}
.tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.ranking { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.rank-row {
  display: grid; grid-template-columns: 40px 36px 1fr auto; gap: 10px; align-items: center;
  padding: 10px 14px; background: var(--surface); border-radius: 12px; box-shadow: var(--shadow);
}
.rank-row.dq { grid-template-columns: 36px 1fr auto; opacity: 0.75; }
.rank-row .rank { font-size: 20px; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; color: var(--muted); }
.rank-row.top .rank { color: var(--gold); }
.rank-row .who { min-width: 0; }
.rank-row .name { font-weight: 700; display: flex; gap: 6px; align-items: center; overflow-wrap: anywhere; }
.rank-row .detail { font-size: 13px; color: var(--muted); }
.rank-row .count { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; display: flex; gap: 4px; align-items: center; }
.rank-row .count .icon { width: 18px; height: 18px; color: var(--accent); }
.rank-row .count.bumped { animation: bump 0.9s ease-out; }
@keyframes bump { 0% { color: var(--live); transform: scale(1.25); } 100% { transform: none; } }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  color: #fff; padding: 7px; object-fit: cover; font-weight: 700; font-size: 15px;
}
img.avatar { padding: 0; }
.avatar.guest { background: var(--surface-2); color: var(--muted); padding: 0; }
.medal { display: inline-flex; width: 18px; height: 18px; flex: none; }
.medal-bronze { color: var(--bronze); } .medal-silver { color: var(--silver); }
.medal-gold { color: var(--gold); } .medal-platinum { color: var(--platinum); }
.subhead { font-size: 14px; font-weight: 700; color: var(--muted); margin: 20px 0 6px; }
details.log { margin-top: 24px; }
details.log summary { cursor: pointer; color: var(--accent); font-weight: 700; min-height: 44px; display: flex; align-items: center; }
details.log ol { list-style: none; padding: 0; margin: 0; }
details.log li { padding: 8px 0; border-top: 1px solid var(--line); }
details.log .when { font-size: 13px; color: var(--muted); }

/* ---- Text pages (privacy, deleting an account) ---- */
.doc { padding: 32px 0 0; }
.doc h1 { font-size: clamp(26px, 5vw, 34px); margin-bottom: 8px; }
.doc h2 { font-size: 20px; margin: 36px 0 12px; padding-top: 8px; border-top: 1px solid var(--line); }
.doc p, .doc li, .doc dd { max-width: 40em; }
.doc dl { display: grid; grid-template-columns: minmax(7em, max-content) 1fr; gap: 10px 18px; margin: 12px 0 20px; }
.doc dt { font-weight: 700; color: var(--accent); }
.doc dd { margin: 0; }
.doc ol, .doc ul { padding-left: 1.4em; }
.doc li { margin-bottom: 8px; }
.doc .contact { display: inline-block; padding: 12px 16px; border-radius: 12px; background: var(--surface); }
.doc table { border-collapse: collapse; width: 100%; font-size: 15px; }
.doc .table-wrap { overflow-x: auto; background: var(--surface); border-radius: 12px; }
.doc th, .doc td { text-align: left; vertical-align: top; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.doc th { font-size: 13px; color: var(--muted); white-space: nowrap; }
.doc tr:last-child td { border-bottom: 0; }
@media (max-width: 520px) {
  /* Thirteen sea areas: one swipeable row rather than five lines of chips. */
  .filters { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px 8px; padding: 0 16px 4px; scrollbar-width: none; }
  .filter-chip { flex: none; }
  .doc dl { grid-template-columns: 1fr; gap: 2px; }
  .doc dd { margin-bottom: 10px; }
  .rank-row { grid-template-columns: 32px 32px 1fr auto; gap: 8px; padding: 10px 12px; }
  .avatar { width: 32px; height: 32px; padding: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before { animation: none !important; transition: none !important; }
}
