/* 部の試合動画書庫（試作）── 剣道つなぎの試作と同じ系統：藍・紺を主に、生成りの地。見出しは明朝、本文はゴシック。朱は注意だけ */
:root {
  color-scheme: light;
  --kon: #172338; --ai: #1f3b63; --ai-2: #2f5283; --ai-soft: #e8edf4; --ai-line: #c3cddc;
  --bg: #f5f0e6; --paper: #fffdf8; --paper-2: #faf6ee;
  --ink: #1b2130; --sub: #5a6272; --line: #e0d9ca;
  --ok: #1d5a8a; --ok-soft: #e4eef7;
  --near: #7a5a12; --near-soft: #f5ecd8;
  --mute: #646a76; --mute-soft: #eeeeec;
  --shu: #a4402d; --shu-soft: #f7e6e0;
  --radius: 14px; --tap: 44px; --bottom-h: 62px;
  --sans: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", "YuGothic", Meiryo, sans-serif;
  --serif: "Noto Serif JP", "Hiragino Mincho ProN", "Hiragino Mincho Pro", "Yu Mincho", "YuMincho", "BIZ UDPMincho", serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.7; overflow-x: hidden; }
body.in { padding-bottom: calc(var(--bottom-h) + env(safe-area-inset-bottom)); }
body.has-sheet { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
:focus-visible { outline: 3px solid #7f9cd0; outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
.ico { width: 22px; height: 22px; flex: none; }
.sub { color: var(--sub); font-size: 13px; margin-left: 6px; }
p.sub { margin-left: 0; }
.shu { color: var(--shu); }

.trial-band { background: #fff1cc; color: #5a4512; border-bottom: 1px solid #e8d49c; font-size: 12.5px; line-height: 1.45; text-align: center; padding: 6px 12px; }

/* ── 上の帯 */
.top { background: var(--kon); color: #fff; padding: 10px 16px 12px; }
.top-row { display: flex; align-items: center; gap: 10px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mark { width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--paper); color: var(--kon);
  font-family: var(--serif); font-weight: 700; font-size: 17px; line-height: 1; box-shadow: inset 0 0 0 2px var(--kon), inset 0 0 0 4px var(--paper), inset 0 0 0 5px var(--kon); }
.brand-name { font-family: var(--serif); font-weight: 700; letter-spacing: .04em; font-size: 16px; line-height: 1.35; }
.brand-sub { font-size: 12px; color: #c9d3e3; }
.who { margin-top: 10px; width: 100%; display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.25); color: #fff;
  border-radius: 10px; padding: 7px 12px; min-height: var(--tap); text-align: left; }
.who-l { font-size: 12px; color: #c9d3e3; flex: none; }
.who-n { font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-c { font-size: 12.5px; color: #e2e8f2; flex: none; }

/* ── 本文 */
main { max-width: 720px; margin: 0 auto; }
.pad { padding: 18px 16px 28px; }
.h2 { font-family: var(--serif); font-weight: 700; color: var(--kon); font-size: 22px; line-height: 1.4; }
.h3 { font-family: var(--serif); font-weight: 700; color: var(--kon); font-size: 16.5px; margin-bottom: 8px; }
.hint { color: var(--sub); font-size: 14px; margin: 6px 0 14px; }
.note { color: var(--sub); font-size: 12.5px; margin: 6px 0; line-height: 1.55; }
.empty { color: var(--sub); background: var(--paper); border: 1px dashed var(--line); border-radius: var(--radius); padding: 18px; text-align: center; font-size: 14px; }
.count { font-size: 13px; color: var(--sub); margin: 4px 0 8px; }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.back { background: none; border: 0; color: var(--ai); padding: 0 0 8px; min-height: 36px; font-size: 14px; }

.hello { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.hello-t { font-family: var(--serif); font-weight: 700; color: var(--kon); font-size: 19px; }
.stats { display: grid; grid-template-columns: 1fr 1fr 2fr; gap: 8px; margin-top: 10px; }
.stats div { background: var(--ai-soft); border-radius: 10px; padding: 8px 10px; text-align: center; min-width: 0; }
.stats b { display: block; font-size: 18px; color: var(--ai); line-height: 1.3; }
.stats .wz b { font-size: 14px; padding-top: 3px; overflow-wrap: anywhere; }
.stats span { font-size: 11.5px; color: var(--sub); }

.meet-h { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-family: var(--serif); color: var(--kon); font-size: 16px; margin: 20px 0 8px;
  padding-bottom: 4px; border-bottom: 1px solid var(--ai-line); }
.meet-h span { font-family: var(--sans); font-size: 12.5px; color: var(--sub); font-weight: 400; }

/* ── 試合のカード */
.card { display: flex; gap: 12px; width: 100%; text-align: left; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; margin-bottom: 10px; }
.card:active { background: var(--paper-2); }
.thumb { position: relative; width: 104px; height: 66px; border-radius: 9px; flex: none; display: grid; place-items: center; }
.play { width: 30px; height: 30px; border-radius: 50%; background: rgba(255,255,255,.9); color: var(--kon); display: grid; place-items: center; font-size: 12px; padding-left: 2px; }
.dur { position: absolute; right: 5px; bottom: 4px; font-size: 11px; color: #fff; background: rgba(0,0,0,.45); border-radius: 5px; padding: 0 5px; line-height: 1.5; }
.card-b { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: 1px; }
.card-t { font-weight: 700; font-size: 15px; line-height: 1.4; }
.vs { font-weight: 400; color: var(--sub); font-size: 13.5px; }
.card-m, .card-n { font-size: 12.5px; color: var(--sub); line-height: 1.5; }
.card-r { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; margin: 2px 0; }
.res { font-size: 12px; font-weight: 700; border-radius: 6px; padding: 0 7px; line-height: 1.75; }
.res-win { background: var(--ok-soft); color: var(--ok); }
.res-lose { background: var(--mute-soft); color: var(--mute); }
.res-draw { background: var(--near-soft); color: var(--near); }
.waza { font-size: 12px; color: var(--ai-2); }
.pill { font-size: 11.5px; border-radius: 999px; padding: 0 8px; line-height: 1.8; white-space: nowrap; }
.pill-wait { background: var(--near-soft); color: var(--near); }
.pill-shu { background: var(--shu-soft); color: var(--shu); }
.pill-ok { background: var(--ok-soft); color: var(--ok); }

/* ── 探す */
.filters { display: grid; gap: 8px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.in { width: 100%; min-height: var(--tap); border: 1px solid var(--ai-line); border-radius: 10px; background: var(--paper); padding: 8px 10px; font-size: 15px; min-width: 0; }
select.in { padding-right: 4px; font-size: 13.5px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--ai-line); background: var(--paper); color: var(--ai); font-size: 14px; }
.chip.on { background: var(--ai); color: #fff; border-color: var(--ai); }

/* ── 入力の紙 */
.form { display: grid; gap: 12px; }
.form-inline { margin-top: 22px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; gap: 8px; }
.lb { display: grid; gap: 4px; font-size: 13.5px; color: var(--sub); border: 0; padding: 0; margin: 0; min-width: 0; }
.lb legend { padding: 0; margin-bottom: 4px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px; }
.ck { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px; background: var(--paper); border: 1px solid var(--ai-line); border-radius: 10px; font-size: 14px; color: var(--ink); }
.ck input { width: 18px; height: 18px; accent-color: var(--ai); }
.ck.big { display: flex; align-items: flex-start; padding: 10px 12px; line-height: 1.55; }
.ck.big input { margin-top: 3px; flex: none; }
.btn { min-height: 48px; border: 0; border-radius: 12px; background: var(--ai); color: #fff; font-weight: 700; font-size: 16px; padding: 0 18px; width: 100%; }
.btn-sub { background: var(--paper); color: var(--ai); border: 1px solid var(--ai); }
.btn-s { min-height: 38px; border: 1px solid var(--ai-line); border-radius: 10px; background: var(--paper); color: var(--ai); font-size: 13.5px; padding: 0 12px; }
.btn-s[disabled] { opacity: .45; cursor: not-allowed; }
.btn-main { background: var(--ai); color: #fff; border-color: var(--ai); }
.btn-shu { color: var(--shu); border-color: #e3bcb2; }
.lr-b { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

/* ── 一覧の行 */
.link-row, .mem-row, .pend { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; }
.link-row.stopped { opacity: .6; }
.lr-t, .mm-t { font-weight: 700; }
.lr-m { font-size: 13px; color: var(--sub); margin-top: 2px; }
.mm-c { margin-top: 4px; }
.pend { padding: 8px; }
.pend .card { border: 0; margin: 0; padding: 4px; }
.pend-b { padding: 4px 6px 4px; }
.meet-row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 8px; min-height: 64px; }
.mr-d { font-size: 11.5px; color: var(--sub); text-align: center; line-height: 1.3; flex: none; width: 52px; }
.mr-d b { display: block; color: var(--kon); font-size: 14px; }
.mr-t { flex: 1; min-width: 0; font-weight: 700; display: flex; flex-direction: column; }
.mr-t .sub { margin: 0; font-weight: 400; }
.mr-n { color: var(--ai); font-size: 13.5px; flex: none; }

/* ── 下のタブ */
.bottom { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; background: var(--paper); border-top: 1px solid var(--line);
  height: calc(var(--bottom-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); }
.bottom button { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; border: 0; background: none; color: var(--mute); font-size: 11.5px; }
.bottom button.on { color: var(--ai); font-weight: 700; }
.bottom button.on::before { content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--ai); }
.badge { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 18px; height: 18px; border-radius: 9px; background: var(--shu); color: #fff; font-size: 11px; line-height: 18px; text-align: center; padding: 0 4px; font-weight: 700; }

/* ── 下から出る紙 */
.sheet-bg { position: fixed; inset: 0; background: rgba(15,22,36,.45); z-index: 40; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-height: 92vh; overflow-y: auto; background: var(--bg); border-radius: 18px 18px 0 0;
  padding: 18px 16px calc(24px + env(safe-area-inset-bottom)); max-width: 720px; margin: 0 auto; display: grid; gap: 10px; }
.sheet-x { position: sticky; top: 0; justify-self: end; width: 40px; height: 40px; margin: -6px -4px -40px 0; border-radius: 50%; border: 1px solid var(--line); background: var(--paper); font-size: 20px; line-height: 1; z-index: 2; }
.pl-video { position: relative; border-radius: 12px; overflow: hidden; background: #000; margin-top: 30px; }
.pl-video video { display: block; width: 100%; aspect-ratio: 16 / 9; background: #000; }
.pl-label { position: absolute; left: 0; right: 0; top: 34%; text-align: center; color: #fff; font-weight: 700; font-size: 15px; pointer-events: none; text-shadow: 0 1px 3px rgba(0,0,0,.5); }
.pl-label small { font-weight: 400; font-size: 12px; opacity: .85; }
.pl-acts { display: grid; gap: 8px; margin-top: 4px; }
.box { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.url-box { background: var(--paper); border: 1px solid var(--ai-line); border-radius: 10px; padding: 10px 12px; font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; overflow-wrap: anywhere; }
.qr { width: 190px; margin: 4px auto; background: #fff; padding: 6px; border-radius: 10px; border: 1px solid var(--line); }
.qr svg { display: block; width: 100%; height: auto; }
.who-opt { display: flex; flex-direction: column; text-align: left; width: 100%; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; min-height: 56px; }
.who-opt.on { border-color: var(--ai); box-shadow: inset 0 0 0 1px var(--ai); }
.who-opt span { font-size: 12.5px; color: var(--sub); }

.toast { position: fixed; left: 50%; bottom: calc(var(--bottom-h) + 16px + env(safe-area-inset-bottom)); transform: translate(-50%, 10px); opacity: 0; transition: .25s; z-index: 60;
  background: var(--kon); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; max-width: calc(100% - 32px); box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 360px) { .row3 { grid-template-columns: 1fr 1fr; } .row3 select:last-child { grid-column: span 2; } }
