:root {
  --bg: #0d1117;
  --surface: #151b24;
  --surface-2: #1c2430;
  --border: #2a3443;
  --text: #e6edf3;
  --muted: #8b98a8;
  --accent: #5cc8ff;
  --ally: #4ea1ff;
  --ally-soft: rgba(78, 161, 255, 0.22);
  --enemy: #ff5d6c;
  --enemy-soft: rgba(255, 93, 108, 0.22);
  --good: #3fcf8e;
  --bad: #ff5d6c;
  --even: #c9a94b;
  --map-bg: #17251c;
  --map-lane: #3a4a3c;
  --map-river: #1d3a4d;
  /* モノトーンの3段階（フェーズの区別などに使う。チームの青・赤と紛れないように） */
  --mono-1: #d5dbe2;
  --mono-2: #9aa5b1;
  --mono-3: #69737f;
  --radius: 10px;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f7fa;
    --surface: #ffffff;
    --surface-2: #eef2f6;
    --border: #d6dde6;
    --text: #17202b;
    --muted: #5b6878;
    --accent: #0077c2;
    --ally: #1f6fd1;
    --ally-soft: rgba(31, 111, 209, 0.16);
    --enemy: #d6334a;
    --enemy-soft: rgba(214, 51, 74, 0.15);
    --good: #12925b;
    --bad: #d6334a;
    --even: #9a7a16;
    --map-bg: #dfe9de;
    --map-lane: #b5c2b3;
    --map-river: #b9d6e6;
    --mono-1: #4a5562;
    --mono-2: #7d8894;
    --mono-3: #adb6c0;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }

.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 20px; border-bottom: 1px solid var(--border); background: var(--surface);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); font-size: 17px; }
.brand:hover { text-decoration: none; }
.brand svg { color: var(--accent); }
.tagline { color: var(--muted); font-size: 13px; }
@media (max-width: 520px) { .tagline { display: none; } }

main { flex: 1; width: 100%; max-width: 1040px; margin: 0 auto; padding: 24px 16px 48px; }
.footer { color: var(--muted); font-size: 11.5px; text-align: center; padding: 20px 16px; border-top: 1px solid var(--border); }

/* ---- 共通パーツ ---- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
h1, h2, h3 { line-height: 1.3; margin: 0; }
h1 { font-size: 26px; }
h2 { font-size: 18px; }
h3 { font-size: 15.5px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 28px 0 12px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  border: 1px solid var(--border); background: var(--surface-2); border-radius: 8px;
  padding: 8px 14px; cursor: pointer; font-weight: 600; font-size: 14px; white-space: nowrap;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #04121c; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.small { padding: 4px 10px; font-size: 12.5px; }
.btn:disabled { opacity: 0.55; cursor: default; }

input[type=text], select, textarea {
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px; width: 100%;
}
input[type=text]:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
textarea { resize: vertical; min-height: 64px; }
label.field { display: block; }
label.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; border: 1px solid currentColor; }
.badge.good { color: var(--good); }
.badge.bad { color: var(--bad); }
.badge.even { color: var(--even); }
.badge.key { color: var(--accent); }
.chip { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12.5px; background: var(--surface-2); border: 1px solid var(--border); }

.notice { border-left: 3px solid var(--even); background: var(--surface); padding: 10px 14px; border-radius: 6px; font-size: 14px; }
.error { border-left: 3px solid var(--bad); background: var(--surface); padding: 10px 14px; border-radius: 6px; }
.loading { color: var(--muted); padding: 40px 0; text-align: center; }

.champ { width: 40px; height: 40px; border-radius: 8px; background: var(--surface-2); flex: none; object-fit: cover; display: inline-grid; place-items: center; font-weight: 700; font-size: 13px; color: var(--muted); }
.champ.lg { width: 56px; height: 56px; border-radius: 10px; }
.champ.sm { width: 26px; height: 26px; border-radius: 6px; font-size: 10px; }

/* ---- ホーム ---- */
.hero { text-align: center; padding: 24px 0 20px; }
.hero h1 { font-size: clamp(24px, 5vw, 34px); }
.hero p { color: var(--muted); max-width: 620px; margin: 12px auto 0; }
.search { display: grid; grid-template-columns: 110px 1fr auto; gap: 8px; max-width: 620px; margin: 28px auto 0; }
@media (max-width: 520px) { .search { grid-template-columns: 1fr; } }

/* ---- 試合一覧 ---- */
.match-list { display: grid; gap: 8px; }
.match-item {
  display: grid; grid-template-columns: 4px 40px 1fr auto; gap: 12px; align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px 10px 0;
  color: var(--text); overflow: hidden;
}
.match-item:hover { border-color: var(--accent); text-decoration: none; }
.match-item .bar { align-self: stretch; background: var(--bad); }
.match-item.win .bar { background: var(--ally); }
.match-item .kda { font-weight: 700; font-variant-numeric: tabular-nums; }
.match-item .result { font-weight: 700; color: var(--bad); }
.match-item.win .result { color: var(--ally); }

/* ---- 試合分析 ---- */
.match-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.match-head .meta { flex: 1; min-width: 200px; }
.match-head .result { font-weight: 800; font-size: 20px; color: var(--bad); }
.match-head .result.win { color: var(--ally); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-top: 16px; }
.stat { background: var(--surface-2); border-radius: 8px; padding: 10px 12px; }
.stat .label { font-size: 12px; color: var(--muted); }
.stat .value { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pos { color: var(--good); }
.neg { color: var(--bad); }
.headline { font-size: 15px; border-left: 3px solid var(--accent); padding: 8px 0 8px 14px; margin-top: 16px; }

.chart-wrap { position: relative; }
.chart { width: 100%; height: auto; display: block; user-select: none; }
.chart text { fill: var(--muted); font-size: 11px; font-family: inherit; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .zero { stroke: var(--muted); stroke-width: 1; opacity: .6; }
.chart .line { fill: none; stroke: var(--text); stroke-width: 1.6; opacity: .75; }
/* リード（0 より上）は明るい面、ビハインド（下）は斜線。色はチームの青・赤と紛れないようモノトーン */
.chart .area-ally { fill: var(--text); opacity: .16; }
.chart .area-enemy { opacity: .55; }
.chart .hatch-line { stroke: var(--muted); stroke-width: 1.2; }
.chart .mline { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 2 3; opacity: .45; }
.chart .mline.key { opacity: .9; }
.chart .marker { cursor: pointer; }
/* 分岐点: 有利＝塗りつぶし、不利＝白抜き、互角＝灰 */
.chart .marker circle { stroke: var(--text); stroke-width: 2; }
.chart .marker text { font-size: 11px; font-weight: 800; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.chart .marker.good circle { fill: var(--text); }
.chart .marker.good text { fill: var(--bg); }
.chart .marker.bad circle { fill: var(--bg); }
.chart .marker.bad text { fill: var(--text); }
.chart .marker.even circle { fill: var(--mono-3); stroke: var(--mono-3); }
.chart .marker.even text { fill: var(--bg); }
.chart .marker:hover circle, .chart .marker.active circle { stroke-width: 3.5; }
.chart .death { stroke: var(--text); stroke-width: 2; stroke-linecap: round; opacity: .8; }
.chart .hover-line { stroke: var(--text); stroke-width: 1; opacity: .5; pointer-events: none; }
.chart-tip {
  position: absolute; pointer-events: none; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 6px; padding: 4px 8px; font-size: 12.5px; white-space: nowrap; transform: translate(-50%, -110%);
  font-variant-numeric: tabular-nums;
}
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 28px 0 16px; overflow-x: auto; }
.tab { background: none; border: none; border-bottom: 2px solid transparent; padding: 8px 14px; cursor: pointer; color: var(--muted); font-weight: 600; white-space: nowrap; }
.tab[aria-selected=true] { color: var(--text); border-bottom-color: var(--accent); }

.moment { display: grid; grid-template-columns: 1fr 180px; gap: 18px; scroll-margin-top: 16px; transition: border-color .2s; }
.moment.active { border-color: var(--accent); }
@media (max-width: 720px) { .moment { grid-template-columns: 1fr; } .moment .minimap { max-width: 220px; } }
.moment-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.moment-num { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #fff; flex: none; }
.moment-num.good { background: var(--good); }
.moment-num.bad { background: var(--bad); }
.moment-num.even { background: var(--even); }
.moment-num.minor { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.moment .time { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600; }
.events { list-style: none; padding: 0; margin: 12px 0 0; font-size: 13.5px; }
.events li { display: grid; grid-template-columns: 44px 10px 1fr; gap: 8px; align-items: baseline; padding: 2px 0; }
.events .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.events .ally .dot { background: var(--ally); }
.events .enemy .dot { background: var(--enemy); }
.events .me { font-weight: 700; }
.events .t { color: var(--muted); font-variant-numeric: tabular-nums; }
.prompts { margin: 14px 0 0; padding: 10px 14px; background: var(--surface-2); border-radius: 8px; font-size: 13.5px; }
.prompts strong { display: block; font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.prompts ul { margin: 0; padding-left: 18px; }
.replay-hint { font-size: 12.5px; color: var(--muted); margin-top: 10px; }
.replay-hint code { background: var(--surface-2); padding: 1px 6px; border-radius: 4px; color: var(--text); }

.minimap { width: 100%; height: auto; display: block; border-radius: 8px; }
.minimap .bg { fill: var(--map-bg); }
.minimap .lane { stroke: var(--map-lane); stroke-width: 9; fill: none; stroke-linecap: round; }
.minimap .river { stroke: var(--map-river); stroke-width: 16; fill: none; stroke-linecap: round; }
.minimap .base-ally { fill: var(--ally); opacity: .55; }
.minimap .base-enemy { fill: var(--enemy); opacity: .55; }
/* 本陣は左下＝ブルー、右上＝レッド（.base-ally / .base-enemy は青 / 赤の色として使う） */
.minimap .obj { fill: none; stroke-width: 2; }
.minimap .obj.blue { stroke: var(--ally); }
.minimap .obj.red { stroke: var(--enemy); }
/* 関与したチャンピオンの顔アイコン（枠はチームの色、あなたは緑。倒された側は薄く ×） */
.minimap .tok-bg { fill: var(--surface-2); }
.minimap .tok-ring { fill: none; stroke-width: 2; }
.minimap .tok.blue .tok-ring { stroke: var(--ally); }
.minimap .tok.red .tok-ring { stroke: var(--enemy); }
.minimap .tok.me .tok-ring { stroke: var(--good); stroke-width: 2.6; }
.minimap .tok.dead image, .minimap .tok.dead .tok-bg { opacity: .55; }
.minimap .tok-badge { fill: var(--bg); stroke: var(--text); stroke-width: 1; }
.minimap .tok-x { stroke: var(--text); stroke-width: 1.4; stroke-linecap: round; }

.deaths-summary { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.death-card { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: start; }
.death-card .time { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 16px; }
.death-card .tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }

/* ---- コメント ---- */
.comments { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 12px; }
.comment { padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: 14px; }
.comment:last-of-type { border-bottom: none; }
.comment .who { font-weight: 700; font-size: 13px; }
.comment .when { color: var(--muted); font-size: 12px; margin-left: 6px; }
.comment .body { white-space: pre-wrap; word-break: break-word; margin-top: 2px; }
.comment-form { display: grid; grid-template-columns: 140px 1fr auto; gap: 8px; margin-top: 10px; align-items: start; }
.comment-form textarea { min-height: 40px; }
@media (max-width: 620px) { .comment-form { grid-template-columns: 1fr; } }
.link-btn { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 12px; padding: 0 4px; }
.link-btn:hover { color: var(--bad); }

.review-bar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; justify-content: space-between; }
.share-url { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.theme-box { margin-top: 10px; padding: 10px 14px; border-radius: 8px; background: var(--surface-2); }
.theme-box .label { font-size: 12px; color: var(--muted); }

dialog { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 12px; padding: 20px; width: min(480px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(0, 0, 0, .55); }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--surface-2); border: 1px solid var(--border); padding: 8px 16px; border-radius: 8px; font-size: 14px; z-index: 10; }

/* ---- フェーズ別スコア ---- */
.phases { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 820px) { .phases { grid-template-columns: 1fr; } }
.phase { border-top: 3px solid var(--phase-color); }
.phase-laning { --phase-color: var(--mono-1); }
.phase-mid { --phase-color: var(--mono-2); }
.phase-late { --phase-color: var(--mono-3); }
/* フェーズ別スコアの点数と評価は色を付けず、文字の濃さで見せる */
.phase-score.grade-S, .phase-score.grade-A, .phase-score.grade-B, .phase-score.grade-C, .phase-score.grade-D { color: var(--text); }
.phase-score .grade { color: var(--muted); }
.phase-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.phase-score { display: flex; align-items: baseline; gap: 6px; font-variant-numeric: tabular-nums; }
.phase-score .num { font-size: 30px; font-weight: 800; line-height: 1; }
.phase-score .of { font-size: 13px; font-weight: 700; color: var(--muted); }
.phase-score .grade { font-size: 15px; font-weight: 800; padding: 1px 7px; border-radius: 6px; border: 1.5px solid currentColor; }
.phase-score.none { font-size: 26px; color: var(--muted); }
.grade-S { color: #ffb020; }
.grade-A { color: var(--good); }
.grade-B { color: var(--ally); }
.grade-C { color: var(--even); }
.grade-D { color: var(--bad); }
.phase-reason { margin-top: 6px; min-height: 2.6em; }
.phase-metrics { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 10px; font-size: 13.5px; }
.meter { height: 5px; background: var(--surface-2); border-radius: 3px; overflow: hidden; margin-top: 3px; }
.meter span { display: block; height: 100%; background: var(--phase-color); border-radius: 3px; }
.lane-ends { margin-top: 12px; color: var(--muted); }
.lane-ends summary { cursor: pointer; }
.lane-ends ul { list-style: none; padding: 0; margin: 8px 0 0; columns: 2; }
@media (max-width: 520px) { .lane-ends ul { columns: 1; } }
.lane-ends li { color: var(--text); }
.lane-ends .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.lane-ends .ally .dot { background: var(--ally); }
.lane-ends .enemy .dot { background: var(--enemy); }
.chart .phase-band { fill: var(--text); }
.chart .phase-band.phase-laning { opacity: .025; }
.chart .phase-band.phase-mid { opacity: .055; }
.chart .phase-band.phase-late { opacity: .085; }
.chart text.phase-label { font-size: 11px; font-weight: 700; fill: var(--muted); }

/* ---- レーン別分析 ---- */
.mode-tabs { margin: 16px 0 16px; }
.mode-tabs .tab:hover { text-decoration: none; color: var(--text); }
.role-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.role-chip { color: var(--text); padding: 4px 12px; font-size: 13.5px; }
.role-chip:hover { text-decoration: none; border-color: var(--accent); }
.role-chip.active { border-color: var(--accent); background: var(--accent); color: #04121c; }
.role-chip.active .muted { color: inherit; opacity: .75; }
.role-chip.empty { opacity: .5; }
.pick-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 820px) { .pick-cards { grid-template-columns: 1fr; } }
.pick-card { border-top: 3px solid var(--pick-color); }
.pick-blind { --pick-color: #8ab4f8; }
.pick-counter { --pick-color: #c77dff; }
.pick-unknown { --pick-color: var(--border); }
.pick-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.pick-stats .big { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.2; }
.table-wrap { overflow-x: auto; margin-top: 12px; }
.lane-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.lane-table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; padding: 4px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.lane-table td { padding: 6px 8px; border-bottom: 1px dashed var(--border); white-space: nowrap; }
.lane-table tr:last-child td { border-bottom: none; }
.lane-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.rune-setup { display: inline-flex; align-items: center; gap: 4px; }
.rune { width: 22px; height: 22px; border-radius: 50%; background: var(--surface-2); flex: none; display: inline-block; }
.rune.sub { width: 16px; height: 16px; }
.lane-game { grid-template-columns: 4px auto 1fr auto; }
.lane-game .vs { display: flex; align-items: center; gap: 6px; }
.lane-game:hover { border-color: var(--border); }
.lane-game.excluded { opacity: 0.55; }
.lane-game.excluded:hover { opacity: 0.85; }
.excluded-badge { font-size: 11px; padding: 1px 8px; }
.lane-game-side { display: grid; gap: 6px; }
.lane-score { font-variant-numeric: tabular-nums; font-weight: 700; }
.lane-score b { font-size: 18px; }
.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg { background: var(--surface-2); border: none; padding: 3px 10px; font-size: 12.5px; cursor: pointer; color: var(--muted); font-weight: 600; }
.seg + .seg { border-left: 1px solid var(--border); }
.seg:hover { color: var(--text); }
.seg.on { background: var(--accent); color: #04121c; }
@media (max-width: 620px) {
  .lane-game { grid-template-columns: 4px 1fr; }
  .lane-game .vs { grid-column: 2; }
  .lane-game > div:nth-child(3), .lane-game-side { grid-column: 2; }
  .lane-game-side .row { justify-content: flex-start !important; }
}
.count-select { width: auto; padding: 4px 8px; font-size: 13px; }
.axis-bar { position: sticky; top: 0; z-index: 5; margin-top: 20px; padding: 10px 14px; }
.axis-opt { display: inline-flex; align-items: center; gap: 5px; font-size: 13.5px; cursor: pointer; padding: 2px 10px 2px 6px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); }
.axis-opt.on { border-color: var(--accent); }
.axis-opt input { accent-color: var(--accent); margin: 0; }
.side-badge { display: inline-block; padding: 0 7px; border-radius: 5px; font-size: 12px; font-weight: 700; color: #fff; }
.side-badge.blue { background: var(--ally); }
.side-badge.red { background: var(--enemy); }
.item { width: 22px; height: 22px; border-radius: 4px; background: var(--surface-2); flex: none; display: inline-block; }
.item-cell { display: inline-flex; align-items: center; gap: 4px; }

.lane-games { margin-top: 20px; }
.lane-games > summary { cursor: pointer; padding: 10px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.lane-games[open] > summary { border-color: var(--accent); }
.axis-group { display: inline-flex; align-items: center; gap: 4px; }
.core-filter { position: relative; display: inline-flex; }
.core-filter[hidden] { display: none; }
.core-summary { display: inline-flex; align-items: center; gap: 3px; font-size: 12.5px; padding: 2px 8px; border: 1px dashed var(--accent); border-radius: 999px; cursor: pointer; min-height: 28px; }
.core-summary .item { width: 20px; height: 20px; }
.core-summary .caret { color: var(--muted); font-size: 11px; }
.core-pop {
  display: none; position: absolute; top: 100%; left: 0; z-index: 20; width: min(360px, calc(100vw - 32px));
  background: var(--surface); border: 1px solid var(--accent); border-radius: 8px; padding: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
}
.core-filter:hover .core-pop, .core-filter:focus-within .core-pop { display: grid; gap: 8px; }
.core-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.core-opt { position: relative; padding: 2px; border: 2px solid transparent; border-radius: 6px; background: var(--surface-2); cursor: pointer; line-height: 0; }
.core-opt .item { width: 36px; height: 36px; }
.core-opt .n { position: absolute; right: -4px; bottom: -4px; font-size: 10.5px; line-height: 1.4; padding: 0 4px; border-radius: 6px; background: var(--bg); border: 1px solid var(--border); color: var(--muted); }
.core-opt:hover { border-color: var(--border); }
.core-opt.on { border-color: var(--accent); }
.lane-table tr.group-start td { border-top: 1px solid var(--border); }
.lane-table tbody tr:first-child td { border-top: none; }
.lane-table td.dup { border-bottom-color: transparent; }

/* ---- Pro（高機能モード） ---- */
.pro-badge { display: inline-block; font-size: 10.5px; font-weight: 800; letter-spacing: .06em; padding: 1px 6px; border-radius: 4px; background: linear-gradient(135deg, #ffb020, #ff7a45); color: #1a1000; vertical-align: 2px; }
.pro-switch { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; padding: 3px 10px 3px 6px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); color: var(--text); }
.pro-switch.on { border-color: #ffb020; }
.pro-switch input { accent-color: #ffb020; margin: 0; }
.card.locked { margin-top: 16px; border-style: dashed; opacity: .8; }
.filter-panel { margin-top: 16px; }
.filter-panel > summary { cursor: pointer; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.filter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px 20px; margin-top: 12px; }
.filter-block { display: grid; gap: 6px; align-content: start; }
.filter-title { font-size: 12px; font-weight: 700; color: var(--muted); }
.filter-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; cursor: pointer; }
.filter-check input { accent-color: var(--accent); margin: 0; }
.filter-block input[type=range] { width: 120px; accent-color: var(--accent); }
.th-value { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 52px; }
.num-input { width: 64px; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 3px 6px; }
.filter-status .muted { margin-left: 6px; }
.axis-opt.pro { border-color: rgba(255, 176, 32, .5); }
.axis-opt.locked { opacity: .5; cursor: not-allowed; }
.lane-table .ci { font-size: 11px; color: var(--muted); font-weight: 400; }
.lane-table .reliability { line-height: 1.35; }
.rel { display: inline-block; font-size: 11px; font-weight: 800; padding: 0 5px; border-radius: 4px; color: #fff; }
.rel-高 { background: var(--good); }
.rel-中 { background: var(--even); }
.rel-低 { background: var(--muted); }

/* ---------- 分岐点: ひと目で分かる要約 ---------- */
.moments-overview { display: grid; gap: 2px; padding: 8px; margin-bottom: 12px; }
.mo-row { display: grid; grid-template-columns: 28px 52px 84px 104px 1fr; gap: 10px; align-items: center; width: 100%; text-align: left;
  background: none; border: 0; border-radius: 8px; padding: 6px 8px; color: inherit; font: inherit; cursor: pointer; }
.mo-row:hover, .mo-row:focus-visible { background: var(--surface-2); }
.mo-time { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600; }
.mo-swing { font-variant-numeric: tabular-nums; font-weight: 800; text-align: right; }
.mo-swing.big { font-size: 22px; line-height: 1; }
.mo-type { font-weight: 700; }
.mo-facts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.moment-key { display: flex; flex-wrap: wrap; gap: 10px; align-items: baseline; margin-top: 10px; }
.pill { display: inline-flex; align-items: center; gap: 2px; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 700;
  border: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.pill.kills .ally { color: var(--ally); }
.pill.kills .enemy { color: var(--enemy); }
.pill.obj.ally { color: var(--ally); border-color: currentColor; background: none; }
.pill.obj.enemy { color: var(--enemy); border-color: currentColor; background: none; }
.pill.me.good { color: var(--good); border-color: currentColor; background: none; }
.pill.me.bad { color: var(--bad); border-color: currentColor; background: none; }
.pill.me.none { color: var(--muted); }
.pill.shutdown.good { color: var(--good); border-color: currentColor; background: none; }
.pill.shutdown.bad { color: var(--bad); border-color: currentColor; background: none; }
.events-detail { margin-top: 10px; }
.events-detail summary { cursor: pointer; color: var(--muted); }
@media (max-width: 720px) {
  .mo-row { grid-template-columns: 28px 52px 1fr; }
  .mo-row .mo-type { grid-column: 3; grid-row: 1; }
  .mo-row .mo-swing { grid-column: 3; grid-row: 1; justify-self: end; }
  .mo-row .mo-facts { grid-column: 2 / -1; }
}

/* ---------- あなた（プレイの仕方の分析） ---------- */
.you-insights ul { margin: 0; padding-left: 18px; display: grid; gap: 6px; font-size: 14px; }
.you-insights .chip { font-size: 11.5px; margin-left: 4px; }
.you-insights .chip.strong { border-color: var(--accent); color: var(--accent); }
.heat-wrap { overflow-x: auto; }
.heat { border-collapse: separate; border-spacing: 2px; width: 100%; table-layout: fixed; font-size: 12.5px; }
.heat th { font-weight: 600; color: var(--muted); padding: 4px 6px; text-align: center; white-space: nowrap; }
.heat thead th:first-child, .heat tbody th { width: 52px; }
.heat tbody th { text-align: right; padding-right: 6px; line-height: 1.2; }
.heat-hours { display: block; font-size: 10.5px; font-weight: 500; }
.heat td { height: 44px; border-radius: 4px; text-align: center; vertical-align: middle; position: relative;
  background: color-mix(in srgb, var(--accent) calc(var(--heat, 0) * 100%), var(--surface-2)); }
.heat td.empty { background: var(--surface-2); opacity: .5; }
.heat td.hi .heat-n, .heat td.hi .heat-wr:not(.pos):not(.neg) { color: var(--bg); }
.heat-n { display: block; font-weight: 800; font-size: 14px; color: var(--text); font-variant-numeric: tabular-nums; }
.heat-wr { display: block; font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }
.heat td .heat-wr:not(.pos):not(.neg) { color: var(--text); }
.heat td .heat-wr.pos, .heat td .heat-wr.neg { background: var(--surface); border-radius: 4px; padding: 0 4px; display: inline-block; }
.you-axes { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 12px; }
.you-table { width: 100%; }
.you-table td, .you-table th { padding: 5px 6px; }
.wr-cell { display: flex; align-items: center; gap: 8px; min-width: 150px; }
.wr-bar { position: relative; flex: 1; height: 10px; background: var(--surface-2); border-radius: 5px; }
.wr-ci { position: absolute; top: 2px; height: 6px; background: color-mix(in srgb, var(--accent) 35%, transparent); border-radius: 3px; }
.wr-base { position: absolute; top: -3px; width: 2px; height: 16px; margin-left: -1px; background: var(--muted); border-radius: 1px; }
.wr-dot { position: absolute; top: 1px; width: 8px; height: 8px; margin-left: -4px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--surface); }
.wr-num { width: 38px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
@media (max-width: 720px) { .you-axes { grid-template-columns: 1fr; } }

/* ---------- 分析サマリ（トップページ） ---------- */
.brief { margin: 8px 0 24px; }
.brief-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.brief-head h2 { margin: 0; }
.brief-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.brief-col { display: flex; flex-direction: column; gap: 10px; border-top: 3px solid var(--border); }
.brief-col.win { border-top-color: var(--good); }
.brief-col.loss { border-top-color: var(--bad); }
.brief-col.level-rest { border-top-color: var(--bad); }
.brief-col.level-caution { border-top-color: var(--even); }
.brief-col.level-good { border-top-color: var(--good); }
.brief-col.level-normal { border-top-color: var(--accent); }
.brief-kicker { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .04em; display: flex; align-items: center; gap: 8px; }
.level-badge { font-size: 11px; padding: 1px 8px; border-radius: 999px; border: 1px solid currentColor; }
.level-badge.rest { color: var(--bad); }
.level-badge.caution { color: var(--even); }
.level-badge.good { color: var(--good); }
.level-badge.normal { color: var(--accent); }
.brief-title { font-size: 17px; font-weight: 800; }
.brief-matchup { display: flex; align-items: center; gap: 8px; }
.brief-facts { display: flex; flex-wrap: wrap; gap: 6px; }
.brief-tips, .brief-review { margin: 0; padding-left: 18px; display: grid; gap: 6px; font-size: 14px; }
.brief-review { list-style: none; padding-left: 0; gap: 10px; }
.good-text { color: var(--good); }
.bad-text { color: var(--bad); }
.brief-empty, .brief-loading, .brief-error { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 8px 0 20px; }

/* ---------- 30秒リプレイ ---------- */
.replay { display: grid; gap: 10px; }
.replay-canvas { width: 100%; height: auto; border-radius: 8px; cursor: pointer; display: block; }
.replay-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.replay-seek { flex: 1; min-width: 160px; position: relative; padding-top: 24px; }
.replay-scrub { width: 100%; margin: 0; accent-color: var(--accent); }
.replay-marks { position: absolute; left: 0; right: 0; top: 0; height: 22px; }
.replay-mark { position: absolute; top: 0; transform: translateX(-50%); width: 20px; height: 20px; border-radius: 50%; border: 0; padding: 0;
  font: 800 11px/20px system-ui, sans-serif; color: #fff; cursor: pointer; }
.replay-mark::after { content: ''; position: absolute; left: 50%; top: 20px; width: 2px; height: 8px; margin-left: -1px; background: inherit; }
.replay-mark.good { background: var(--good); }
.replay-mark.bad { background: var(--bad); }
.replay-mark.even { background: var(--even); }
.replay-mark:hover, .replay-mark:focus-visible { outline: 2px solid var(--text); outline-offset: 1px; }
.replay-seek.two-rows { padding-top: 46px; }
.replay-seek.two-rows .replay-marks { height: 44px; }
.replay-seek.two-rows .replay-mark { top: 22px; }
.replay-seek.two-rows .replay-mark.up { top: 0; }
.replay-mark.up::after { height: 30px; }

/* リプレイ: シークバーの下のフェーズの帯（色はフェーズ別スコアと同じ） */
.replay-phases { position: relative; height: 18px; margin-top: 4px; }
.replay-phase { position: absolute; top: 0; height: 18px; padding: 0 6px; border: 0; border-left: 2px solid var(--phase-color);
  background: color-mix(in srgb, var(--phase-color) 28%, transparent); color: var(--text);
  font: 700 11px/18px system-ui, sans-serif; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.replay-phase:hover, .replay-phase:focus-visible { background: color-mix(in srgb, var(--phase-color) 45%, transparent); }

/* Pro: フェーズの区切りの定義 */
.phase-def { margin: 0 0 10px; }
.phase-def.locked { opacity: .8; }
details.phase-def > summary { cursor: pointer; list-style: revert; }
.phase-def-body { display: grid; gap: 8px; margin: 8px 0 0 18px; }

/* トップページ一番上の短い説明 */
.intro { text-align: center; padding: 18px 0 0; }
.intro h2 { margin: 0; font-size: clamp(17px, 3.6vw, 21px); }
.intro p { margin: 6px auto 0; max-width: 640px; }
.intro-points { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 10px; }

/* ゴールド差の推移の凡例（モノトーン） */
.legend .sw-lead { background: color-mix(in srgb, var(--text) 30%, transparent); border-radius: 2px; }
.legend .sw-behind { background: repeating-linear-gradient(135deg, var(--muted) 0 1.5px, transparent 1.5px 5px); border-radius: 2px; }
.legend .sw-good { background: var(--text); border-radius: 50%; }
.legend .sw-bad { background: transparent; border: 2px solid var(--text); border-radius: 50%; box-sizing: border-box; }
