/* 剣道 進路のつなぎ（試作）── 紺と白・差し色は藍の濃淡と朱（注意だけ）（2026-10-12） */
:root {
  color-scheme: light;
  --navy: #1c2a48;
  --navy-2: #2c3e66;
  --navy-soft: #e8ecf4;
  --navy-line: #c9d1e2;
  --bg: #f6f7fa;
  --card: #ffffff;
  --ink: #18202f;
  --sub: #5d6678;
  --line: #dde2ea;
  --ok: #1f5c8f;        /* ○ */
  --ok-soft: #e3eef8;
  --near: #8a6516;      /* △ */
  --near-soft: #f6eedb;
  --ng: #a23b2c;        /* × と注意 */
  --ng-soft: #f8e6e2;
  --radius: 12px;
  --sans: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", sans-serif;
  --serif: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", 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.65;
  overflow-x: hidden; padding-bottom: calc(40px + env(safe-area-inset-bottom));
}
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; }
.wrap { max-width: 920px; margin: 0 auto; padding: 0 16px; }

/* ── 最上部の試作の帯 */
.trial-band {
  background: #fff4d6; color: #5a4512; border-bottom: 1px solid #ead9a8;
  font-size: 12.5px; line-height: 1.4; text-align: center; padding: 5px 12px;
}

/* ── ヘッダー */
.head { background: var(--navy); color: #fff; }
.head-in { max-width: 920px; margin: 0 auto; padding: 12px 16px 0; }
.brand { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.brand h1 { font-family: var(--serif); font-size: 20px; letter-spacing: .04em; font-weight: 700; }
.brand .tag { font-size: 12px; opacity: .75; }
.me { font-size: 13px; opacity: .85; margin-top: 2px; }
.roles { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; align-items: center; }
.roles .lbl { font-size: 12px; opacity: .75; margin-right: 2px; }
.role-btn {
  border: 1px solid rgba(255,255,255,.35); background: transparent; color: #fff;
  border-radius: 999px; padding: 4px 12px; font-size: 14px;
}
.role-btn[aria-pressed="true"] { background: #fff; color: var(--navy); border-color: #fff; font-weight: 700; }
.tabs { display: flex; gap: 2px; margin-top: 10px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  border: 0; background: transparent; color: rgba(255,255,255,.78);
  padding: 9px 12px 10px; font-size: 15px; white-space: nowrap; border-bottom: 3px solid transparent;
}
.tab[aria-current="page"] { color: #fff; border-bottom-color: #fff; font-weight: 700; }
.tab .badge { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 9px; background: #c24a3a; color: #fff; font-size: 11px; line-height: 18px; text-align: center; }

/* ── 本文 */
main { padding-top: 16px; }
.sec-title { font-size: 18px; font-weight: 700; margin: 8px 0 4px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sec-lead { color: var(--sub); font-size: 14px; margin-bottom: 12px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.spacer { flex: 1; }
.muted { color: var(--sub); font-size: 13px; }
.small { font-size: 13px; }
.pill { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--navy-soft); color: var(--navy-2); white-space: nowrap; }
.pill.warn { background: var(--ng-soft); color: var(--ng); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.mine { background: #fff; border: 1px solid var(--navy-line); }

.btn {
  border: 1px solid var(--navy); background: var(--navy); color: #fff;
  border-radius: 8px; padding: 8px 14px; font-size: 15px; line-height: 1.3;
}
.btn.sub { background: #fff; color: var(--navy); }
.btn.ghost { background: transparent; color: var(--navy-2); border-color: var(--navy-line); }
.btn.danger { background: #fff; color: var(--ng); border-color: #e2b9b1; }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ── 注意の枠 */
.notice { border-radius: 10px; padding: 10px 12px; font-size: 14px; margin-bottom: 12px; border: 1px solid; }
.notice.caution { background: var(--ng-soft); border-color: #ebc3bb; color: #6f2419; }
.notice.info { background: var(--navy-soft); border-color: var(--navy-line); color: var(--navy); }
.notice.done { background: var(--ok-soft); border-color: #bcd3ea; color: #173f63; }
.notice b { font-weight: 700; }

/* ── 入口 */
.gate { max-width: 460px; margin: 28px auto 0; padding: 0 16px; }
.gate .logo { text-align: center; margin-bottom: 18px; }
.gate .logo .mark { width: 54px; height: 54px; border-radius: 50%; margin: 0 auto 8px; background: var(--navy); color: #fff; font-family: var(--serif); font-size: 26px; display: grid; place-items: center; }
.gate h1 { font-family: var(--serif); font-size: 22px; letter-spacing: .05em; }
.gate .panel { padding: 18px; }
.gate .promise { margin: 14px 0 0; padding-left: 1.2em; font-size: 13.5px; color: var(--sub); }
.gate .promise li { margin: 2px 0; }

/* ── フォーム */
.form-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 640px) { .form-grid { grid-template-columns: 1fr 1fr; } .form-grid .full { grid-column: 1 / -1; } }
.field label, .field .lab { display: block; font-size: 13.5px; font-weight: 700; margin-bottom: 4px; color: var(--navy); }
.field .hint { font-size: 12.5px; color: var(--sub); margin-top: 3px; }
input[type=text], input[type=date], select, textarea {
  width: 100%; max-width: 100%; border: 1px solid var(--navy-line); border-radius: 8px; padding: 8px 10px; background: #fff; font-size: 16px;
}
textarea { min-height: 76px; resize: vertical; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 8px; }
.checks label { display: inline-flex; align-items: center; gap: 4px; font-weight: 400; color: var(--ink); font-size: 14.5px; border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px 3px 6px; margin: 0; background: #fff; }
.checks input { margin: 0; }
.confirm-box { border: 1px dashed var(--navy-line); border-radius: 10px; padding: 10px 12px; background: #fafbfd; }
.confirm-box label.line { display: flex; gap: 8px; align-items: flex-start; font-weight: 700; color: var(--ink); }
.confirm-box input[type=checkbox] { margin-top: 5px; }
.code-input { font-size: 20px !important; letter-spacing: .12em; text-align: center; text-transform: uppercase; }

/* ── 絞り込み */
.filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 720px) { .filters { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.filters label { font-size: 12px; color: var(--sub); display: block; }
.filters select { padding: 6px 8px; font-size: 14px; }
.mode-switch { display: flex; gap: 0; border: 1px solid var(--navy-line); border-radius: 10px; overflow: hidden; margin-bottom: 12px; }
.mode-switch button { flex: 1; border: 0; background: #fff; padding: 9px 6px; font-size: 14px; color: var(--navy-2); line-height: 1.35; }
.mode-switch button[aria-pressed="true"] { background: var(--navy); color: #fff; font-weight: 700; }

/* ── 募集・カードの表示 */
.list { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 760px) { .list.two { grid-template-columns: 1fr 1fr; } }
.item { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; min-width: 0; }
.item.stopped { opacity: .55; }
.item-head { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.item-title { font-size: 17px; font-weight: 700; line-height: 1.4; min-width: 0; overflow-wrap: anywhere; }
.card-no { font-family: ui-monospace, Menlo, monospace; font-weight: 700; color: var(--navy); font-size: 17px; letter-spacing: .03em; }
.item-meta { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.kv { display: grid; grid-template-columns: 6.2em 1fr; gap: 3px 10px; margin-top: 10px; font-size: 14px; }
.kv dt { color: var(--sub); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.comment { margin-top: 10px; padding: 8px 10px; background: var(--bg); border-left: 3px solid var(--navy-line); border-radius: 0 8px 8px 0; font-size: 14px; }
.item-foot { margin-top: 10px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ── 合い方（○△×） */
.fit { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.fit > span { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; border-radius: 6px; padding: 2px 8px; border: 1px solid; }
.fit .m { font-weight: 700; font-size: 14px; }
.fit > .o { background: var(--ok-soft); border-color: #bdd4ea; color: var(--ok); }
.fit > .n { background: var(--near-soft); border-color: #e6d4a8; color: var(--near); }
.fit > .x { background: #f2f3f5; border-color: #d9dce2; color: #6c7280; }
.fit-legend { font-size: 12.5px; color: var(--sub); margin: 4px 0 10px; }
.fit-detail { font-size: 12.5px; color: var(--sub); margin-top: 6px; }
.selected-ref { background: var(--navy-soft); border: 1px solid var(--navy-line); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; font-size: 14px; }

/* ── チャット */
.chat-layout { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 820px) { .chat-layout { grid-template-columns: 260px 1fr; } }
.thread-list { display: flex; flex-direction: column; gap: 8px; }
.thread-btn { text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%; }
.thread-btn[aria-current="true"] { border-color: var(--navy); box-shadow: inset 3px 0 0 var(--navy); }
.thread-btn .t1 { font-weight: 700; font-size: 14.5px; display: block; }
.thread-btn .t2 { font-size: 12.5px; color: var(--sub); display: block; }
.stages { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 3px; margin-bottom: 10px; }
.stage { font-size: 11px; line-height: 1.3; text-align: center; padding: 6px 2px; border-radius: 6px; background: #eef0f4; color: #7a8192; min-width: 0; overflow-wrap: anywhere; }
.stage .no { display: block; font-size: 15px; font-weight: 700; }
.stage.done { background: var(--navy-2); color: #fff; }
.stage.now { background: #fff; color: var(--navy); border: 2px solid var(--navy); font-weight: 700; }
.stage.dropped { background: #efe9e8; color: #8a5a52; }
.stage-ctl { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; font-size: 14px; }
.stage-ctl .row { margin-top: 6px; }
.stage-ctl input[type=date] { width: auto; }
.msgs { display: flex; flex-direction: column; gap: 8px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px; max-height: 460px; overflow-y: auto; }
.msg { max-width: 86%; padding: 8px 11px; border-radius: 12px; font-size: 14.5px; overflow-wrap: anywhere; }
.msg .who { display: block; font-size: 11.5px; color: var(--sub); margin-bottom: 2px; }
.msg.them { align-self: flex-start; background: #f0f2f6; border-top-left-radius: 4px; }
.msg.me { align-self: flex-end; background: var(--navy); color: #fff; border-top-right-radius: 4px; }
.msg.me .who { color: rgba(255,255,255,.7); }
.msg.sys { align-self: center; background: transparent; color: var(--sub); font-size: 12.5px; text-align: center; max-width: 100%; }
.composer { display: flex; gap: 8px; margin-top: 10px; align-items: flex-end; }
.composer textarea { min-height: 44px; height: 44px; }
.send-warn { margin-top: 8px; }

/* ── 運営 */
.code-out { font-family: ui-monospace, Menlo, monospace; font-size: 22px; letter-spacing: .1em; font-weight: 700; color: var(--navy); background: var(--navy-soft); border-radius: 8px; padding: 8px 12px; display: inline-block; }
.tlist { display: flex; flex-direction: column; gap: 8px; }
.trow { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: flex; gap: 8px 12px; flex-wrap: wrap; align-items: center; }
.trow .main { flex: 1 1 220px; min-width: 0; }
.trow .name { font-weight: 700; }
.trow .aff { font-size: 13px; color: var(--sub); overflow-wrap: anywhere; }
.trow.stopped { background: #f6f6f7; }
.trow.stopped .name { text-decoration: line-through; color: var(--sub); }

/* ── 下の約束 */
.footer-promise { margin-top: 28px; padding: 14px 16px; border-top: 1px solid var(--line); font-size: 13px; color: var(--sub); }
.footer-promise ul { margin: 6px 0 0; padding-left: 1.2em; }
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--navy); color: #fff; padding: 9px 16px; border-radius: 999px; font-size: 14px; box-shadow: 0 6px 20px rgba(0,0,0,.18); z-index: 10; max-width: calc(100% - 32px); text-align: center; }
.empty { text-align: center; color: var(--sub); padding: 20px; font-size: 14px; }

/* ── スマホ幅：段階の帯は 3×2・スレッド一覧は詰める（2026-10-12 確認で直した） */
@media (max-width: 560px) {
  .stages { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stage { font-size: 12px; padding: 5px 4px; }
  .stage .no { display: inline; font-size: 13px; margin-right: 2px; }
  .thread-btn { padding: 7px 10px; }
  .thread-btn .t1 { font-size: 14px; }
}
