/* MIC ナレッジルーム
   台帳（帳票）をモチーフにした画面。紺のインク、罫線、テーマごとの背表紙の色、
   そして見終えた印としての朱の判子。朱は判子にしか使わない。 */
:root {
  --ink: #14284b;        /* 紺：文字・罫 */
  --paper: #edf0f3;      /* 帳票の地 */
  --sheet: #ffffff;      /* 紙面 */
  --rule: #c3cad4;       /* 罫線 */
  --pencil: #56617a;     /* 補足の文字 */
  --action: #e8761c;     /* MIC オレンジ：押せるもの */
  --action-ink: #a54c06; /* オレンジ地でない所で使う文字色 */
  --shu: #c9352b;        /* 朱：判子専用 */
  --theme: var(--ink);
  --font: "Zen Kaku Gothic New", "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
  --num: "Barlow Condensed", "Zen Kaku Gothic New", sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font); font-weight: 500; line-height: 1.75; }
a { color: var(--ink); text-underline-offset: 3px; }
a:hover { color: var(--action-ink); }
:focus-visible { outline: 3px solid var(--action); outline-offset: 2px; border-radius: 2px; }
h1, h2, p { margin: 0; }
h1 { font-size: 1.5rem; font-weight: 900; line-height: 1.35; }
h2 { font-size: 1.0625rem; font-weight: 700; }
.display { font-size: clamp(1.75rem, 1.2rem + 2.4vw, 2.5rem); letter-spacing: .02em; line-height: 1.25; }
.muted { color: var(--pencil); }
.small { font-size: .8125rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.inline { display: inline; }

/* ---- 上部 ---- */
.topbar {
  background: var(--sheet); border-bottom: 2px solid var(--ink);
  display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; padding: 10px 24px;
}
.brand { color: var(--ink); text-decoration: none; font-weight: 900; letter-spacing: .04em; display: inline-flex; align-items: center; gap: 8px; margin: 0; }
.brand b { background: var(--ink); color: #fff; font-family: var(--num); font-weight: 600; font-size: 1.05rem; letter-spacing: .08em; padding: 0 7px; line-height: 1.5; }
.topbar nav { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.topbar nav a, .navbtn {
  color: var(--ink); text-decoration: none; padding: 5px 10px; font: inherit; font-size: .875rem; font-weight: 700;
  background: none; border: 0; border-bottom: 3px solid transparent; cursor: pointer;
}
.topbar nav a:hover, .navbtn:hover { border-bottom-color: var(--rule); color: var(--ink); }
.topbar nav a.on { border-bottom-color: var(--action); }
.navbtn { font-weight: 500; color: var(--pencil); }

.wrap { max-width: 1040px; margin: 0 auto; padding: 32px 24px 72px; }
.pagehead { margin-bottom: 24px; }
.pagehead p { margin-top: 6px; }
.row { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px 16px; flex-wrap: wrap; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back { display: inline-block; margin-bottom: 16px; color: var(--pencil); font-size: .875rem; }
.back::before { content: "‹ "; }

/* ---- 紙面 ---- */
.sheet { background: var(--sheet); border: 1px solid var(--rule); border-radius: 4px; padding: 24px; margin-bottom: 20px; }
.sheet > h1, .sheet > h2 { margin-bottom: 14px; }
.sheet > p { margin-bottom: 14px; max-width: 42em; }
.sheet .row { margin-bottom: 14px; align-items: flex-start; }
.sheet.narrow { max-width: 520px; }
.narrow-wide { max-width: 760px; }
.sheet.empty { text-align: left; padding: 32px 24px; }
.sheet.empty p + p { margin-top: 12px; margin-bottom: 0; }

/* ---- フォーム ---- */
label { display: block; margin: 0 0 16px; font-size: .875rem; font-weight: 700; }
input:not([type=radio]):not([type=checkbox]):not([type=color]), select, textarea {
  display: block; width: 100%; margin-top: 4px; padding: 9px 11px; font: inherit; font-weight: 500; color: var(--ink);
  border: 1px solid #8792a5; border-radius: 3px; background: #fff;
}
input::placeholder, textarea::placeholder { color: #8b94a6; }
input[type=color] { display: block; margin-top: 4px; width: 100%; height: 42px; border: 1px solid #8792a5; border-radius: 3px; padding: 2px; background: #fff; }
input.short { max-width: 140px; }
td select { width: auto; display: inline-block; margin: 0; padding: 4px 8px; }
fieldset { border: 1px solid var(--rule); border-radius: 3px; padding: 12px 16px; margin: 0 0 16px; }
legend { font-weight: 700; font-size: .875rem; padding: 0 6px; }
label.radio, label.check { font-weight: 500; display: flex; gap: 8px; align-items: center; margin: 6px 0; }
.grid2 { display: grid; grid-template-columns: 2fr 1fr; gap: 0 16px; }
.grid2.tight { grid-template-columns: 1fr 1fr; }
.members summary { cursor: pointer; font-size: .875rem; margin-top: 8px; text-decoration: underline; text-underline-offset: 3px; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 12px; margin-top: 8px; }

.kinds { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.kind-opt { margin: 0; position: relative; }
.kind-opt input { position: absolute; opacity: 0; }
.kind-opt span { display: block; border: 1px solid var(--rule); border-radius: 3px; padding: 10px 12px; cursor: pointer; height: 100%; }
.kind-opt small { display: block; font-weight: 500; color: var(--pencil); font-size: .75rem; line-height: 1.5; margin-top: 2px; }
.kind-opt input:checked + span { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink), inset 5px 0 0 var(--action); }
.kind-opt input:focus-visible + span { outline: 3px solid var(--action); outline-offset: 2px; }

.btn {
  display: inline-block; background: var(--sheet); color: var(--ink); border: 1.5px solid var(--ink); text-decoration: none;
  padding: 8px 18px; border-radius: 3px; cursor: pointer; font: inherit; font-size: .9375rem; font-weight: 700; line-height: 1.5;
}
.btn:hover { background: var(--ink); color: #fff; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--action); border-color: var(--action); color: #fff; }
.btn.primary:hover { background: #cf6510; border-color: #cf6510; }
.btn.quiet { border-color: transparent; background: none; font-weight: 500; text-decoration: underline; text-underline-offset: 3px; padding-inline: 8px; }
.btn.quiet:hover { color: var(--action-ink); }
.btn.small { padding: 4px 12px; font-size: .8125rem; }
.btn.full { width: 100%; text-align: center; }
.linkish { background: none; border: 0; padding: 0; color: var(--ink); cursor: pointer; font: inherit; text-decoration: underline; text-underline-offset: 3px; }
.linkish.small { font-size: .8125rem; }
.danger { color: #a3261d; }
.danger-zone { margin-top: 24px; padding-top: 14px; border-top: 1px dashed var(--rule); font-size: .875rem; }
.icon { border: 1px solid var(--rule); background: #fff; border-radius: 3px; width: 28px; height: 28px; cursor: pointer; color: var(--ink); font: inherit; line-height: 1; }
.icon:hover:not(:disabled) { border-color: var(--ink); }
.icon:disabled { opacity: .3; cursor: default; }
.alert, .ok { padding: 10px 14px; border-radius: 3px; margin-bottom: 16px; font-size: .9375rem; border-left: 5px solid; }
.alert { background: #fbeceb; color: #7d1f17; border-color: #a3261d; }
.ok { background: #e8f3ee; color: #1b5239; border-color: #2e7d5b; }

/* ---- 数字（競りのロット番号のような細身の数字） ---- */
.num { font-family: var(--num); font-weight: 600; font-size: 2rem; line-height: 1; letter-spacing: .01em; font-variant-numeric: tabular-nums; }
.num small { font-size: .6em; color: var(--pencil); font-weight: 500; margin-left: 1px; }
.num.lg { font-size: 3rem; }
.num.sm { font-size: 1.25rem; }
.no { font-family: var(--num); font-weight: 600; font-size: 1.125rem; color: var(--pencil); font-variant-numeric: tabular-nums; letter-spacing: .03em; }

/* ---- 判子 ---- */
.stamp {
  --d: 56px;
  flex: none; display: inline-grid; place-items: center; width: var(--d); height: var(--d); border-radius: 50%;
  color: var(--shu); border: calc(var(--d) * .055) solid currentColor; outline: 1px solid currentColor; outline-offset: -5px;
  font-weight: 900; font-size: calc(var(--d) * .32); line-height: 1; transform: rotate(-9deg); opacity: .9;
  mix-blend-mode: multiply; user-select: none;
}
.stamp span { writing-mode: vertical-rl; letter-spacing: .06em; }
.stamp.xs { --d: 24px; outline: 0; font-size: 13px; border-width: 1.5px; }
.stamp.sm { --d: 34px; outline: 0; font-size: 17px; border-width: 2px; }
.stamp.lg { --d: 76px; }
.stamp.xl { --d: 132px; opacity: .82; }
.stamp.sm span, .stamp.xs span { writing-mode: horizontal-tb; letter-spacing: 0; }
.stamp.press { animation: press .42s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes press {
  0% { transform: rotate(-9deg) scale(2.1); opacity: 0; }
  60% { transform: rotate(-9deg) scale(.94); opacity: 1; }
  100% { transform: rotate(-9deg) scale(1); opacity: .9; }
}
@media (prefers-reduced-motion: reduce) { .stamp.press { animation: none; } }

/* ---- ログイン ---- */
.login { max-width: 420px; margin: 0 auto; padding-top: 12vh; }
.login-title { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; font-family: var(--num); font-weight: 600; font-size: 2.75rem; letter-spacing: .03em; line-height: 1.2; }
.login-title b { background: var(--ink); color: #fff; font-weight: 600; letter-spacing: .08em; padding: 0 11px; }
.login > * + * { margin-top: 16px; }
.sso-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
#clerk-signin { display: flex; justify-content: center; }
.login-box { margin: 0; border-top: 6px solid var(--ink); }
.gbtn {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 11px 16px; margin-bottom: 10px;
  background: #fff; color: #1f1f1f; border: 1px solid #747775; border-radius: 4px; font-weight: 700; text-decoration: none;
}
.gbtn:hover { background: #f3f6fb; color: #1f1f1f; }
.or { display: flex; align-items: center; gap: 12px; color: var(--pencil); font-size: .8125rem; margin: 16px 0; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--rule); }

/* ---- テーマ一覧 ---- */
.themes { list-style: none; margin: 0; padding: 0; background: var(--sheet); border: 1px solid var(--rule); border-radius: 4px; overflow: hidden; }
.themes li + li { border-top: 1px solid var(--rule); }
.theme {
  display: grid; grid-template-columns: auto minmax(0, 1fr) 112px; gap: 20px; align-items: center;
  padding: 20px 24px; color: var(--ink); text-decoration: none;
}
.theme:hover { background: #f7f9fb; color: var(--ink); }
.theme-mark { flex: none; display: grid; place-items: center; width: 64px; height: 64px; background: var(--ink); }
.theme-mark svg { width: 30px; height: 30px; }
.theme-mark.lg { width: 80px; height: 80px; }
.theme-mark.lg svg { width: 38px; height: 38px; }
.theme-mark.sm { width: 32px; height: 32px; }
.theme-mark.sm svg { width: 17px; height: 17px; }
.theme-cell { display: flex; align-items: center; gap: 12px; }
.theme-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.theme-body strong { font-size: 1.25rem; font-weight: 900; letter-spacing: .02em; line-height: 1.4; }
.theme:hover .theme-body strong { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 2px; }
.theme-desc { color: var(--pencil); font-size: .9375rem; max-width: 40em; }
.subthemes { display: flex; flex-wrap: wrap; gap: 4px 6px; margin-top: 6px; }
.subthemes i { font-style: normal; font-size: .8125rem; border: 1px solid var(--rule); border-radius: 2px; padding: 0 8px; line-height: 1.7; background: #fff; }
.tag { font-style: normal; font-size: .75rem; font-weight: 700; border: 1px solid var(--ink); border-radius: 2px; padding: 1px 6px; margin-left: 10px; vertical-align: middle; letter-spacing: 0; }
.theme-count { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.meter { width: 100%; height: 4px; background: #dfe4ea; display: block; }
.meter i { display: block; height: 100%; background: var(--theme); }

/* ---- テーマの中 ---- */
.theme-head {
  background: var(--sheet); border: 1px solid var(--rule); border-radius: 4px;
  padding: 28px; margin-bottom: 28px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: end;
}
.theme-head-main { display: flex; gap: 20px; align-items: flex-start; }
.theme-head-main p { margin-top: 8px; color: var(--pencil); max-width: 36em; }
.theme-head-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.theme-head-side .actions { margin-top: 10px; }

.ledger { margin-bottom: 32px; }
.ledger-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 0 4px 6px; border-bottom: 3px solid var(--ink); }
.ledger-head h2 { font-size: 1.25rem; font-weight: 900; }
.ledger ol { list-style: none; margin: 0; padding: 0; background: var(--sheet); border: 1px solid var(--rule); border-radius: 4px; }
.ledger-head + ol { border-top: 0; border-radius: 0 0 4px 4px; }
.ledger li + li { border-top: 1px solid var(--rule); }
.ledger a { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto 40px; gap: 14px; align-items: center; padding: 13px 16px 13px 18px; text-decoration: none; color: var(--ink); }
.ledger a:hover { background: #f7f9fb; }
.ledger a:hover strong { text-decoration: underline; text-underline-offset: 4px; }
.ltext { display: flex; flex-direction: column; min-width: 0; }
.ltext strong { font-weight: 700; }
.ltext small { color: var(--pencil); font-size: .8125rem; }
.lmeta { color: var(--pencil); font-size: .8125rem; white-space: nowrap; }
.lstamp { display: grid; place-items: center; height: 34px; }
.is-done .ltext strong { font-weight: 500; }

/* ---- レッスン ---- */
.lesson-layout { display: grid; grid-template-columns: minmax(0, 1fr) 272px; gap: 32px; align-items: start; }
.lesson-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; min-height: 76px; }
.lesson-head h1 { font-size: clamp(1.375rem, 1.1rem + 1.2vw, 1.75rem); }
.lesson-head p.muted { margin-top: 4px; }
.crumb { display: flex; align-items: baseline; gap: 10px; font-size: .875rem; color: var(--pencil); font-weight: 700; margin-bottom: 2px; }
.player { width: 100%; aspect-ratio: 16 / 9; background: #0c1626; border-radius: 4px; display: block; margin-bottom: 20px; }
.player.embed iframe { width: 100%; height: 100%; border: 0; border-radius: 4px; }
.html-lesson { width: 100%; height: 78vh; border: 1px solid var(--rule); border-radius: 4px; background: #fff; display: block; margin-bottom: 8px; }
.notes { background: var(--sheet); border: 1px solid var(--rule); border-radius: 4px; padding: 20px 24px; margin-top: 20px; }
.notes h2 { margin-bottom: 8px; }
.notes p { white-space: pre-wrap; max-width: 40em; }
.notes p + p { margin-top: 12px; }
.files { margin-top: 20px; }
.files h2 { margin-bottom: 8px; }
.files ul { list-style: none; margin: 0; padding: 0; background: var(--sheet); border: 1px solid var(--rule); border-radius: 4px; }
.files li + li { border-top: 1px solid var(--rule); }
.files a { display: flex; align-items: center; gap: 12px; padding: 11px 16px; text-decoration: none; color: var(--ink); }
.files a:hover { background: #f7f9fb; }
.files summary { display: flex; align-items: center; gap: 12px; padding: 11px 16px; cursor: pointer; list-style: none; }
.files summary::-webkit-details-marker { display: none; }
.files summary:hover { background: #f7f9fb; }
.files details .when-open, .files details[open] .when-closed { display: none; }
.files details[open] .when-open { display: inline; }
.files details[open] summary { border-bottom: 1px solid var(--rule); }
.pdf-view { display: block; width: 100%; height: 78vh; border: 0; background: #525659; }
.pdf-links { display: flex; flex-wrap: wrap; gap: 4px 20px; padding: 10px 16px; margin: 0; border-top: 1px solid var(--rule); }
.files .pdf-links a { display: inline; padding: 0; text-decoration: underline; }
.ftype { flex: none; min-width: 44px; text-align: center; font-family: var(--num); font-weight: 600; font-size: .9375rem; letter-spacing: .04em; border: 1.5px solid var(--ink); padding: 0 6px; line-height: 1.6; }
.fname { flex: 1; min-width: 0; overflow-wrap: anywhere; font-weight: 700; }
.fsize { flex: none; color: var(--pencil); font-size: .8125rem; }
.fget { flex: none; font-size: .875rem; text-decoration: underline; text-underline-offset: 3px; }
.complete-row { display: flex; gap: 8px 12px; align-items: center; margin-top: 24px; padding-top: 20px; border-top: 2px solid var(--ink); flex-wrap: wrap; }

.toc { position: sticky; top: 20px; background: var(--sheet); border: 1px solid var(--rule); border-radius: 4px; padding: 10px 0; max-height: calc(100vh - 40px); overflow: auto; }
.toc h2 { font-size: .8125rem; font-weight: 900; padding: 12px 16px 4px; }
.toc ol + h2 { margin-top: 6px; border-top: 1px solid var(--rule); }
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc li a { display: grid; grid-template-columns: 24px minmax(0, 1fr) 24px; gap: 8px; align-items: center; padding: 7px 12px 7px 16px; text-decoration: none; color: var(--ink); font-size: .875rem; line-height: 1.5; }
.toc li a:hover { background: #f1f4f7; }
.toc .no { font-size: .9375rem; }
.toc li.current a { background: var(--ink); color: #fff; font-weight: 700; }
.toc li.current .no { color: #b9c4d6; }
.toc li.current .stamp { mix-blend-mode: normal; color: #ff9d94; }

/* ---- 管理 ---- */
table.list { width: 100%; border-collapse: collapse; font-size: .9375rem; }
table.list th, table.list td { border-bottom: 1px solid var(--rule); padding: 9px 10px; text-align: left; vertical-align: middle; }
table.list tr:last-child td { border-bottom: 0; }
table.list th { color: var(--pencil); font-weight: 700; font-size: .8125rem; border-bottom: 2px solid var(--ink); }
table.list td.right { text-align: right; }
.numcell { font-family: var(--num); font-weight: 600; font-size: 1.125rem; font-variant-numeric: tabular-nums; }
.narrowcol { width: 76px; }
.adm-group td.muted { width: 120px; }
.adm-group td.right { width: 110px; }
.swatch { display: inline-block; width: 6px; height: 22px; margin-right: 10px; vertical-align: middle; }
.cred { display: grid; grid-template-columns: max-content 1fr; gap: 6px 20px; border-block: 1px solid var(--rule); padding: 14px 0; margin: 0 0 20px; }
.cred dt { color: var(--pencil); font-size: .875rem; }
.cred dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.cred code { font-size: 1.125rem; background: var(--paper); padding: 2px 8px; }
.scroll-x { overflow-x: auto; }
.matrix td.full { box-shadow: inset 4px 0 0 var(--shu); font-weight: 700; }
.matrix td.part { box-shadow: inset 4px 0 0 var(--action); }

.swatches, .icon-picks { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.swatch-opt, .icon-opt { position: relative; margin: 0; }
.swatch-opt input, .icon-opt input { position: absolute; opacity: 0; }
.swatch-opt span { display: block; width: 44px; height: 44px; cursor: pointer; }
.swatch-opt input:checked + span { box-shadow: inset 0 0 0 3px #fff, 0 0 0 2px var(--ink); }
.icon-opt span { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--rule); border-radius: 3px; color: var(--ink); cursor: pointer; background: #fff; }
.icon-opt svg { width: 22px; height: 22px; }
.icon-opt input:checked + span { background: var(--ink); color: #fff; border-color: var(--ink); }
.swatch-opt input:focus-visible + span, .icon-opt input:focus-visible + span { outline: 3px solid var(--action); outline-offset: 2px; }
.swatch-opt em, .icon-opt em { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.current-file { border: 1px solid var(--rule); border-left: 5px solid var(--ink); border-radius: 3px; padding: 12px 16px; margin-bottom: 16px; background: #f7f9fb; }
.current-file p { margin: 0; }
.cf-label { font-size: .8125rem; font-weight: 700; color: var(--pencil); }
.cf-name { font-weight: 700; overflow-wrap: anywhere; }
.cf-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 8px !important; }
.current-file > .small.muted:last-of-type { margin-top: 8px; }
.cf-prev { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--rule); }
.adm-group { border: 1px solid var(--rule); border-radius: 3px; margin-bottom: 14px; }
.adm-group-head { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; padding: 10px 12px; background: #f4f6f8; border-bottom: 1px solid var(--rule); }
.rename { display: flex; gap: 8px; align-items: center; flex: 1 1 260px; }
.rename input { margin: 0 !important; font-weight: 700 !important; }
.rename .btn { white-space: nowrap; }
.add-section { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-top: 20px; }
.add-section label { flex: 1 1 260px; margin: 0; max-width: 420px; }

/* ---- アプリランチャー（MIC Compass・Leon Port と同じ並び・同じ印） ---- */
.al-root { position: relative; display: inline-flex; margin: 0 4px; }
.al-btn { width: 36px; height: 36px; border-radius: 3px; border: 1px solid var(--rule); background: #fff; color: var(--pencil); display: grid; place-items: center; cursor: pointer; padding: 0; }
.al-btn:hover, .al-btn[aria-expanded="true"] { border-color: var(--ink); color: var(--ink); }
.al-btn svg { width: 18px; height: 18px; }
.al-panel { position: absolute; top: calc(100% + 8px); right: 0; width: 300px; background: #fff; border: 1px solid var(--rule); border-radius: 4px; box-shadow: 0 12px 32px rgba(20, 40, 75, .18); padding: 12px; z-index: 100; }
.al-title { font-size: .75rem; font-weight: 700; color: var(--pencil); margin: 2px 4px 10px; }
.al-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.topbar nav .al-tile { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px 10px; border: 0; border-radius: 4px; color: var(--ink); font-size: .75rem; font-weight: 700; text-align: center; line-height: 1.3; }
.topbar nav .al-tile:hover { background: #f1f4f7; border: 0; }
.al-tile.current { background: #f4f6f8; }
.al-mark { width: 40px; height: 40px; border-radius: 12px; color: #fff; display: grid; place-items: center; font-weight: 800; font-size: .875rem; letter-spacing: -.02em; }
.al-badge { font-size: .625rem; font-weight: 700; color: var(--ink); background: #e6eaf0; border-radius: 999px; padding: 1px 7px; }

@media (max-width: 820px) {
  .wrap { padding: 20px 16px 56px; }
  .al-panel { position: fixed; left: 12px; right: 12px; top: 96px; width: auto; }
  .topbar { padding: 10px 16px; }
  .login { padding-top: 24px; }
  .theme { grid-template-columns: auto minmax(0, 1fr); padding: 16px; gap: 12px 14px; }
  .theme-mark { width: 48px; height: 48px; }
  .theme-mark svg { width: 24px; height: 24px; }
  .theme-mark.lg { width: 60px; height: 60px; }
  .theme-count { grid-column: 2; flex-direction: row; align-items: center; justify-content: flex-start; gap: 12px; }
  .theme-count .meter { max-width: 140px; }
  .theme-head { grid-template-columns: 1fr; padding: 20px; }
  .theme-head-side { align-items: flex-start; }
  .lesson-layout { grid-template-columns: 1fr; }
  .toc { position: static; max-height: none; }
  .ledger a { grid-template-columns: 28px minmax(0, 1fr) 34px; gap: 10px; padding-inline: 12px; }
  .lmeta { grid-column: 2; grid-row: 2; }
  .lstamp { grid-column: 3; grid-row: 1 / span 2; }
  .grid2 { grid-template-columns: 1fr; }
  .sheet { padding: 18px 16px; }
}

/* ---- AIロープレ ---- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.rp-brief h2 { margin: 20px 0 8px; }
.rp-request { border-left: 6px solid var(--ink); background: var(--sheet); padding: 12px 16px; border-radius: 0 4px 4px 0; }
.rp-request p:first-child { font-size: .8125rem; color: var(--pencil); font-weight: 700; }
.rp-request p:last-child { font-size: 1.0625rem; font-weight: 700; }
.rp-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); background: var(--sheet); border: 1px solid var(--rule); border-radius: 4px; margin: 12px 0 0; }
.rp-facts div { padding: 8px 12px; border-right: 1px solid var(--rule); }
.rp-facts div:last-child { border-right: 0; }
.rp-facts dt { font-size: .75rem; color: var(--pencil); }
.rp-facts dd { margin: 0; font-weight: 700; }
.rp-howto { padding-left: 1.3em; margin: 0; }
.rp-howto li + li { margin-top: 6px; }
.rp-start-row { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin-top: 18px; }
.rp-past { list-style: none; padding: 0; margin: 0; background: var(--sheet); border: 1px solid var(--rule); border-radius: 4px; }
.rp-past li { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; padding: 9px 14px; }
.rp-past li + li { border-top: 1px solid var(--rule); }
.rp-past .num { font-size: 1.15rem; }
.ok-chip { color: var(--shu); font-weight: 900; border: 1.5px solid var(--shu); border-radius: 2px; padding: 0 6px; }

body.rp-open { overflow: hidden; }
.rp-stage { position: fixed; inset: 0; z-index: 200; background: var(--paper); display: flex; flex-direction: column; }
.rp-stage[hidden] { display: none; }
.rp-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 10px 20px; background: var(--sheet); border-bottom: 2px solid var(--ink); }
.rp-title { display: flex; align-items: center; gap: 10px; font-weight: 900; margin-right: auto; }
.rp-title b { background: var(--ink); color: #fff; padding: 0 8px; font-weight: 700; font-size: .875rem; }
.rp-meta { display: flex; gap: 14px; font-size: .875rem; color: var(--pencil); }
.rp-meta .num { font-size: 1.05rem; color: var(--ink); }
.rp-voice { margin: 0; display: flex; align-items: center; gap: 6px; font-weight: 500; font-size: .875rem; }
.rp-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 230px minmax(0, 1fr) 280px; gap: 16px; padding: 16px 20px; max-width: 1400px; width: 100%; margin: 0 auto; }
.rp-people { display: flex; flex-direction: column; gap: 6px; overflow-y: auto; }
.rp-person { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: #fff; border: 1px solid var(--rule); border-radius: 4px; padding: 10px 12px; cursor: pointer; font: inherit; color: var(--ink); }
.rp-person:hover { border-color: var(--ink); }
.rp-person[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 5px 0 0 var(--action); }
.rp-person .avatar { flex: none; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: #fff; font-weight: 900; }
.rp-person strong { display: block; line-height: 1.4; }
.rp-person small { display: block; color: var(--pencil); font-size: .75rem; line-height: 1.4; }
.rp-talk { display: flex; flex-direction: column; min-height: 0; background: #fff; border: 1px solid var(--rule); border-radius: 4px; }
.rp-log { flex: 1; min-height: 0; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.rp-msg { max-width: 85%; }
.rp-msg .who { font-size: .75rem; color: var(--pencil); font-weight: 700; margin: 0; }
.rp-msg .body { border-radius: 4px; padding: 9px 13px; white-space: pre-wrap; }
.rp-msg.me { align-self: flex-end; }
.rp-msg.me .body { background: var(--ink); color: #fff; }
.rp-msg.them .body { background: #f1f3f6; }
.rp-sep { text-align: center; color: var(--pencil); font-size: .8125rem; }
.rp-input { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-top: 2px solid var(--ink); }
.rp-mic { flex: none; width: 64px; height: 64px; border-radius: 50%; border: 0; background: var(--action); color: #fff; display: grid; place-items: center; cursor: pointer; }
.rp-mic svg { width: 30px; height: 30px; }
.rp-mic:hover:not(:disabled) { background: #cf6510; }
.rp-mic:disabled { opacity: .45; cursor: default; }
.rp-mic.on { background: var(--shu); animation: rp-pulse 1.2s ease-in-out infinite; }
@keyframes rp-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(201, 53, 43, .45); } 50% { box-shadow: 0 0 0 12px rgba(201, 53, 43, 0); } }
@media (prefers-reduced-motion: reduce) { .rp-mic.on { animation: none; } }
.rp-form { flex: 1; display: flex; gap: 8px; }
.rp-form input { margin: 0 !important; }
.rp-status { min-height: 1.6em; padding: 0 16px 10px; margin: 0; }
.rp-status.err { color: #a3261d; font-weight: 700; }
.rp-notes { display: flex; flex-direction: column; min-height: 0; }
.rp-notes label { margin-bottom: 6px; }
.rp-notes textarea { flex: 1; min-height: 160px; resize: none; }

.rp-result-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; align-items: center; }
.rp-summary { margin-top: 10px; max-width: 46em; }
.rp-scores { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); background: var(--sheet); border: 1px solid var(--rule); border-radius: 4px; margin: 0 0 20px; }
.rp-scores div { padding: 14px 18px; border-right: 1px solid var(--rule); }
.rp-scores div:last-child { border-right: 0; }
.rp-scores dt { font-size: .8125rem; color: var(--pencil); }
.rp-scores dd { margin: 0; font-family: var(--num); font-weight: 600; font-size: 2rem; line-height: 1.15; }
.rp-scores dd small { font-size: 1.1rem; color: var(--pencil); }
.rp-scores dd.small { font-family: var(--font); font-size: .75rem; font-weight: 500; }
.rp-map { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.rp-map .col { border: 1px solid var(--rule); border-radius: 4px; padding: 10px; }
.rp-map h3 { margin: 0 0 6px; font-size: .9375rem; }
.rp-map .cell { border-radius: 3px; padding: 6px 8px; font-size: .8125rem; line-height: 1.5; margin-top: 6px; border-left: 4px solid; }
.rp-map .cell.red { background: #fbeceb; border-color: var(--shu); }
.rp-map .cell.yellow { background: #fdf4d9; border-color: #b07d00; }
.rp-map .cell.miss { background: #f4f6f8; border-color: #a9b2c0; color: var(--pencil); border-left-style: dashed; }
.chip-num { display: inline-block; font-size: .6875rem; font-weight: 700; background: var(--ink); color: #fff; padding: 0 6px; border-radius: 2px; }
.rp-list { margin: 0; padding-left: 1.2em; }
.rp-list li + li { margin-top: 10px; }
.rp-list q { font-weight: 700; }
.rp-transcript { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; font-size: .9375rem; }
.rp-transcript p { margin: 0; }
.rp-transcript b { display: block; font-size: .75rem; color: var(--pencil); }
.rp-transcript .me { color: var(--ink); }
.rp-actions { display: flex; flex-wrap: wrap; gap: 10px; }

@media (max-width: 980px) {
  .rp-body { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr) auto; padding: 10px; gap: 10px; }
  .rp-people { flex-direction: row; overflow-x: auto; }
  .rp-person { min-width: 170px; }
  .rp-notes textarea { min-height: 70px; }
  .rp-map { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rp-result-head { grid-template-columns: 1fr; }
}
.rp-form .btn { white-space: nowrap; }

/* ---- ロープレのシナリオ編集 ---- */
.alert.warn { background: #fdf4d9; color: #5c4300; border-color: #b07d00; }
.alert ul { margin: 4px 0 0; padding-left: 1.2em; }
.sc-form .sheet h2 { margin-top: 0; }
.sc-form p.label { font-size: .875rem; font-weight: 700; margin: 0 0 6px; }
.sc-facts { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.sc-fact { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto; gap: 8px; align-items: center; max-width: 560px; }
.sc-fact input { margin: 0 !important; }
.sc-findings td { vertical-align: top; }
.sc-findings textarea { min-width: 260px; margin: 0; resize: vertical; }
.sc-findings input, .sc-findings select { margin: 0; }
.sc-findings .f-quant { min-width: 180px; }
.sc-findings .f-who { min-width: 90px; }
.sc-findings .f-who.danger { font-weight: 700; }
.sc-people { display: flex; flex-direction: column; gap: 14px; margin-bottom: 10px; }
.sc-person { border: 1px solid var(--rule); border-radius: 4px; padding: 12px 16px 8px; margin: 0; min-width: 0; }
.sc-person legend { font-weight: 900; padding: 0 6px; }
.sc-person .p-facts { font-family: var(--mono, ui-monospace, monospace); font-size: .875rem; line-height: 1.7; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 14px; }
.sc-form code { font-size: .8125rem; }
.sc-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.sc-delete { margin-top: 10px; }
@media (max-width: 640px) { .grid3 { grid-template-columns: 1fr; } .sc-fact { grid-template-columns: 1fr 1fr auto; } }
