/* CosmicRay Recorder - manual.html / plotter.html
 *
 * console.css の上に重ねる。配色・文字・ボタン・入力欄・上の帯は console.css のものを使い、
 * ここには読み物（マニュアル）と解析画面（プロッター）にしかない部品だけを書く。
 */

/* ===== Top bar for the side pages ===== */
.brand { color: var(--ink); text-decoration: none; }
.pagenav { display: flex; align-items: center; gap: 2px; padding-left: 16px; border-left: 1px solid var(--rule); }
.pagenav a {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 11px; border-radius: var(--r);
  font-size: 13.5px; font-weight: 500; color: var(--ink-2); text-decoration: none; white-space: nowrap;
}
.pagenav a .i { width: 16px; height: 16px; }
.pagenav a:hover { background: var(--paper-2); color: var(--ink); }
.pagenav a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--ink); border-radius: var(--r) var(--r) 0 0; }

.foot {
  display: flex; flex-wrap: wrap; gap: 6px 22px; justify-content: center;
  padding: 28px 20px 36px; font-size: 12.5px; color: var(--ink-3);
  border-top: 1px solid var(--rule);
}

/* ===== Manual ===== */
.doc {
  display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 44px;
  max-width: 1140px; margin: 0 auto; padding: 48px 32px 64px;
}
.toc { position: sticky; top: calc(var(--head-h) + 24px); align-self: start; max-height: calc(100vh - var(--head-h) - 48px); overflow: auto; }
.toc-title { font-size: 12px; letter-spacing: .08em; color: var(--ink-3); margin-bottom: 10px; }
.toc ol { list-style: none; display: grid; gap: 1px; counter-reset: toc; }
.toc li { counter-increment: toc; }
.toc a {
  display: flex; gap: 10px; padding: 5px 8px; border-radius: var(--r);
  font-size: 13.5px; color: var(--ink-2); text-decoration: none; line-height: 1.45;
}
.toc a::before { content: counter(toc, decimal-leading-zero); font-family: var(--f-num); font-size: 11.5px; color: var(--ink-4); padding-top: 2px; }
.toc li.appx a::before { content: none; }
.toc li.appx { counter-increment: none; }
.toc li.appx:first-of-type, .toc .toc-sep { margin-top: 10px; }
.toc a:hover { background: var(--paper-2); color: var(--ink); }
.toc a.here { color: var(--ink); font-weight: 700; }

.article { max-width: 820px; min-width: 0; }
.article .lead { font-size: 16px; color: var(--ink-2); margin: 10px 0 0; }
.article h1 { font-family: var(--f-disp); font-weight: 700; font-size: 42px; line-height: 1.25; letter-spacing: .02em; }
.article h2 {
  display: flex; align-items: baseline; gap: 14px;
  font-family: var(--f-disp); font-weight: 700; font-size: 27px; line-height: 1.35; letter-spacing: .02em;
  margin: 64px 0 16px; padding-top: 18px; border-top: 1px solid var(--rule-strong);
  scroll-margin-top: calc(var(--head-h) + 16px);
}
.article h2 .no { font-family: var(--f-num); font-weight: 500; font-size: 14px; color: var(--ink-3); letter-spacing: 0; }
.article h3 { font-size: 17px; font-weight: 700; margin: 34px 0 10px; scroll-margin-top: calc(var(--head-h) + 16px); }
.article h4 { font-size: 14.5px; font-weight: 700; margin: 22px 0 6px; }
.article p, .article ul, .article ol, .article dl, .article table, .article pre, .article figure { margin: 0 0 14px; }
.article p, .article li, .article dd { font-size: 15px; line-height: 1.85; }
.article ul, .article ol { padding-left: 1.4em; }
.article li + li { margin-top: 3px; }
.article li > ul, .article li > ol { margin: 4px 0 0; }
.article strong { font-weight: 700; }
.article a { text-decoration-color: var(--rule-strong); }
.article a:hover { text-decoration-color: var(--ink); }

/* UI words as they appear on screen */
.ui {
  display: inline-block; padding: 0 6px; margin: 0 1px;
  border: 1px solid var(--rule-strong); border-radius: 3px; background: var(--field);
  font-size: .92em; font-weight: 500; line-height: 1.55; white-space: nowrap;
}
kbd { font-family: var(--f-num); font-size: .88em; padding: 0 5px; border: 1px solid var(--rule-strong); border-bottom-width: 2px; border-radius: 3px; background: var(--field); }

code { font-family: var(--f-num); font-size: .9em; padding: 1px 5px; border-radius: 3px; background: var(--paper-2); }
pre {
  padding: 14px 16px; overflow-x: auto;
  border: 1px solid var(--rule); border-left: 3px solid var(--ink-3); border-radius: var(--r); background: var(--field);
  font-family: var(--f-num); font-size: 13px; line-height: 1.65; color: var(--ink);
}
pre code { padding: 0; background: none; font-size: inherit; }

.table-wrap { overflow-x: auto; margin: 0 0 16px; }
.table-wrap table { margin: 0; }
.article table { width: 100%; border-collapse: collapse; font-size: 14px; }
.article th, .article td { padding: 8px 12px 8px 0; text-align: left; vertical-align: top; border-bottom: 1px solid var(--rule); line-height: 1.65; }
.article th { font-size: 12.5px; font-weight: 500; color: var(--ink-3); border-bottom-color: var(--rule-strong); white-space: nowrap; }
.article td code { white-space: nowrap; }
.dir-in  { color: var(--signal-ink); font-weight: 700; }
.dir-out { color: var(--coral-2); font-weight: 700; }
.dir-bi  { color: var(--ink); font-weight: 700; }

.note {
  display: flex; gap: 12px; padding: 12px 16px; margin: 0 0 16px;
  border-left: 3px solid var(--ink-3); background: var(--paper-2); border-radius: 0 var(--r) var(--r) 0;
  font-size: 14px; line-height: 1.8;
}
.note > .i { margin-top: 3px; color: var(--ink-2); }
.note > div { min-width: 0; }
.note b { display: block; margin-bottom: 2px; }
.note p, .note ul { margin: 0; font-size: 14px; }
.note-warn { border-left-color: var(--coral); background: var(--coral-pale); }
.note-warn > .i { color: var(--coral-2); }
.note-ok { border-left-color: var(--signal-2); background: var(--signal-pale); }
.note-ok > .i { color: var(--signal-ink); }

.tag {
  display: inline-block; padding: 0 7px; margin-right: 6px; border-radius: 999px;
  font-size: 11.5px; font-weight: 500; line-height: 1.7; vertical-align: 1px;
  border: 1px solid var(--rule-strong); color: var(--ink-2); background: var(--field);
}
.tag-new { border-color: var(--signal-2); color: var(--signal-ink); background: var(--signal-pale); }

.cmd { margin: 0 0 12px; padding: 12px 16px; border: 1px solid var(--rule); border-radius: var(--r); background: var(--field); }
.cmd .syntax { font-family: var(--f-num); font-weight: 500; font-size: 14px; color: var(--ink); margin-bottom: 4px; }
.cmd p, .cmd ul { font-size: 14px; margin: 0 0 6px; }
.cmd p:last-child, .cmd ul:last-child, .cmd .note:last-child { margin-bottom: 0; }
.cmd .note { margin-top: 8px; }

.steps-list { list-style: none; padding: 0 !important; counter-reset: st; }
.steps-list > li { position: relative; padding-left: 38px; counter-increment: st; }
.steps-list > li + li { margin-top: 10px; }
.steps-list > li::before {
  content: counter(st); position: absolute; left: 0; top: 2px;
  display: grid; place-items: center; width: 24px; height: 24px;
  border: 1px solid var(--ink-2); border-radius: 50%;
  font-family: var(--f-num); font-size: 12.5px; line-height: 1;
}

.models-fig { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 6px 0 18px; }
.models-fig figure { margin: 0; border: 1px solid var(--rule); border-radius: 6px; overflow: hidden; background: var(--field); }
.models-fig img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: var(--paper-2); }
.models-fig figcaption { padding: 8px 12px 10px; font-size: 13px; color: var(--ink-3); line-height: 1.6; }
.models-fig figcaption b { display: block; font-family: var(--f-num); font-weight: 500; font-size: 16px; color: var(--ink); }

.article details { margin: 0 0 8px; border: 1px solid var(--rule); border-radius: var(--r); background: var(--field); }
.article summary {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 14px; cursor: pointer; list-style: none; font-weight: 500; font-size: 14.5px;
}
.article summary::-webkit-details-marker { display: none; }
.article summary .i { width: 16px; height: 16px; color: var(--ink-3); transition: transform .15s; flex: none; }
.article details[open] summary .i { transform: rotate(180deg); }
.article details > :not(summary) { margin: 0 14px 12px; }
.article details ul { font-size: 14px; }

.article dl.terms { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 10px 22px; }
.article dl.terms dt { font-weight: 700; font-size: 14.5px; }
.article dl.terms dd { font-size: 14.5px; line-height: 1.75; }

.toplink { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; font-size: 12.5px; color: var(--ink-3); }

/* ===== Manual: screenshots with numbered pins ===== */
.shot { margin: 6px 0 22px; }
.shot-frame {
  position: relative; display: block; overflow: hidden;
  border: 1px solid var(--rule-strong); border-radius: 6px; background: var(--field);
  box-shadow: 0 14px 30px -22px rgba(42, 39, 48, .55);
}
.shot-frame img { display: block; width: 100%; height: auto; }
a.shot-frame { cursor: zoom-in; }
.pin {
  position: absolute; z-index: 1; transform: translate(-50%, -50%); pointer-events: none;
  display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--ink); color: var(--paper); border: 2px solid var(--paper);
  box-shadow: 0 2px 6px rgba(23, 22, 48, .35);
  font-family: var(--f-num); font-size: 12px; font-weight: 500; line-height: 1;
}
.hl { position: absolute; pointer-events: none; border: 2px solid var(--ink); border-radius: 5px; box-shadow: 0 0 0 3px rgba(250, 246, 235, .7); }
.shot figcaption { margin-top: 10px; font-size: 13px; color: var(--ink-3); line-height: 1.7; }
.legend { list-style: none; padding: 0 !important; margin: 10px 0 0 !important; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 22px; }
.legend.one { grid-template-columns: minmax(0, 1fr); }
.legend li { display: flex; gap: 9px; align-items: flex-start; font-size: 13.5px; line-height: 1.65; color: var(--ink-2); margin: 0 !important; }
.legend li b { color: var(--ink); font-weight: 700; }
.legend .n {
  flex: none; display: grid; place-items: center; width: 20px; height: 20px; margin-top: 1px; border-radius: 50%;
  background: var(--ink); color: var(--paper); font-family: var(--f-num); font-size: 11px; line-height: 1;
}
.legend-n {
  display: inline-grid; place-items: center; width: 18px; height: 18px; margin: 0 2px; vertical-align: 1px; border-radius: 50%;
  background: var(--ink); color: var(--paper); font-family: var(--f-num); font-size: 10.5px; line-height: 1;
}
.side { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 26px; align-items: start; margin: 6px 0 22px; }
.side .shot { margin: 0; }
.side > div > :last-child { margin-bottom: 0; }

/* ===== Manual: diagrams (inline SVG, drawn with the console palette) ===== */
.fig { margin: 8px 0 22px; padding: 18px 18px 12px; border: 1px solid var(--rule); border-radius: 6px; background: var(--field); }
.fig svg { display: block; width: 100%; height: auto; overflow: visible; }
.fig figcaption { margin-top: 8px; font-size: 13px; color: var(--ink-3); line-height: 1.7; }
.dg text { font-family: var(--f-ui); font-size: 13px; fill: var(--ink-2); }
.dg .t-b { font-weight: 700; fill: var(--ink); }
.dg .t-s { font-size: 11.5px; fill: var(--ink-3); }
.dg .t-m { font-family: var(--f-num); font-size: 12px; }
.dg .t-c { text-anchor: middle; }
.dg .t-e { text-anchor: end; }
.dg .box { fill: var(--paper); stroke: var(--ink-2); stroke-width: 1.3; }
.dg .box-soft { fill: var(--paper-2); stroke: var(--rule-strong); stroke-width: 1; }
.dg .box-ink { fill: var(--ink); stroke: none; }
.dg .box-ink + text, .dg .on-ink { fill: var(--paper); }
.dg .box-sig { fill: var(--signal-pale); stroke: var(--signal-2); stroke-width: 1.3; }
.dg .box-coral { fill: var(--coral-pale); stroke: var(--coral); stroke-width: 1.3; }
.dg .ln { fill: none; stroke: var(--ink-2); stroke-width: 1.5; }
.dg .ln-soft { fill: none; stroke: var(--ink-4); stroke-width: 1.2; stroke-dasharray: 4 4; }
.dg .ln-sig { fill: none; stroke: var(--signal-2); stroke-width: 2; }
.dg .ln-coral { fill: none; stroke: var(--coral); stroke-width: 1.5; stroke-dasharray: 5 4; }
.dg .ln-thick { fill: none; stroke: var(--ink); stroke-width: 2.2; }
.dg .fill-sig { fill: var(--signal); }
.dg .fill-dead { fill: var(--coral-pale); stroke: var(--coral); stroke-width: 1; }
.dg .fill-ink { fill: var(--ink); }
.dg .fill-paper2 { fill: var(--paper-2); }

/* ===== Plotter ===== */
.tool { max-width: 1240px; margin: 0 auto; padding: 28px 28px 48px; }
.tool-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; margin-bottom: 18px; }
.tool-head h1 { font-family: var(--f-disp); font-weight: 700; font-size: 32px; line-height: 1.3; letter-spacing: .02em; }
.tool-head p { font-size: 14px; color: var(--ink-3); max-width: 44em; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--rule-strong); margin-bottom: 22px; overflow-x: auto; }
.tabs button {
  height: 40px; padding: 0 16px; border: 0; background: none; cursor: pointer; white-space: nowrap;
  font-size: 14px; font-weight: 500; color: var(--ink-3);
  box-shadow: inset 0 -2px 0 transparent;
}
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { color: var(--ink); font-weight: 700; box-shadow: inset 0 -2px 0 var(--ink); }

.panel { min-width: 0; margin-bottom: 18px; padding: 18px 20px 20px; border: 1px solid var(--rule); border-radius: 6px; background: var(--field); }
.panel-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; margin-bottom: 14px; }
.panel-title { font-size: 15px; font-weight: 700; }
.panel-sub { font-size: 12.5px; color: var(--ink-3); }

.controls { display: flex; flex-wrap: wrap; gap: 14px 18px; align-items: flex-end; }
.controls .field { min-width: 0; }
.controls .field > span { white-space: nowrap; gap: 6px; }
.controls .num-input { width: 104px; }
.controls .checks { display: flex; flex-direction: column; gap: 6px; padding-bottom: 2px; }
.controls .sep { width: 1px; align-self: stretch; background: var(--rule); }
.dim { color: var(--ink-4); font-weight: 400; }

.filepick { display: grid; gap: 5px; font-size: 13px; color: var(--ink-2); font-weight: 500; }
.filepick input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.filepick .btn { justify-self: start; }
.filepick input[type="file"]:focus-visible + .btn { outline: 2px solid var(--signal-2); outline-offset: 2px; }
.file-name { font-family: var(--f-num); font-size: 12px; color: var(--ink-3); font-weight: 400; max-width: 22em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-name.has { color: var(--ink); }

.readouts-sm { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin-bottom: 18px; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.readouts-sm > div { padding: 12px 18px; border-left: 1px solid var(--rule); }
.readouts-sm > div:first-child { border-left: 0; padding-left: 0; }
.readouts-sm dt { font-size: 12.5px; color: var(--ink-3); }
.readouts-sm dd { font-family: var(--f-num); font-size: 28px; line-height: 1.3; font-variant-numeric: tabular-nums; }

.plot { position: relative; height: 420px; min-width: 0; overflow: hidden; }
.plot > div { width: 100%; height: 100%; }
.plot-empty {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 20px;
  font-size: 13.5px; color: var(--ink-3);
  background: repeating-linear-gradient(0deg, transparent 0 31px, rgba(42, 39, 48, .045) 31px 32px);
  border: 1px dashed var(--rule-strong); border-radius: var(--r);
}
.plot-hint { font-size: 12px; color: var(--ink-4); margin-top: 8px; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-2 .plot { height: 360px; }
.grid-side { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.grid-side .plot { height: 360px; }

.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th {
  padding: 6px 8px; text-align: center; white-space: nowrap;
  font-size: 12px; font-weight: 500; color: var(--ink-3); border-bottom: 1px solid var(--rule-strong);
}
.data-table td { padding: 5px 8px; text-align: center; border-bottom: 1px solid var(--rule); font-family: var(--f-num); font-variant-numeric: tabular-nums; }
.data-table td input[type="number"], .data-table td input[type="text"] { width: 100px; height: 30px; text-align: center; font-family: var(--f-num); }
.data-table td input[type="text"] { font-family: var(--f-ui); }
.data-table td input[type="radio"], .data-table td input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--ink); }
.data-table .auto { color: var(--ink-3); }
.data-table tr.cal-row-armed td { background: var(--signal-pale); }
.data-table .cal-remove { color: var(--ink-4); }
.data-table .cal-remove:hover { color: var(--coral-2); background: var(--coral-pale); }
.table-scroll { overflow-x: auto; }

.action-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.fit-out { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 18px; }
.fit-big { font-family: var(--f-num); font-size: 22px; font-weight: 500; }
.fit-small { font-family: var(--f-num); font-size: 13px; color: var(--ink-3); }
.fit-eqn { font-family: var(--f-num); font-size: 15px; font-weight: 500; }
.fit-warn { color: var(--coral-2); }

.save-col { display: grid; gap: 10px; }
.save-col .row { display: flex; flex-wrap: wrap; gap: 8px; }

/* ===== Narrower screens ===== */
@media (max-width: 1000px) {
  .doc { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 32px 20px 56px; }
  .toc { position: static; max-height: none; margin-bottom: 8px; padding: 14px 16px; border: 1px solid var(--rule); border-radius: 6px; background: var(--field); }
  .toc ol { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-side { grid-template-columns: minmax(0, 1fr); }
  .side { grid-template-columns: 240px minmax(0, 1fr); }
}
@media (max-width: 820px) {
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .readouts-sm { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .readouts-sm > div:nth-child(3) { border-left: 0; padding-left: 0; }
  .readouts-sm > div:nth-child(n+3) { border-top: 1px solid var(--rule); }
  .tool { padding: 20px 16px 40px; }
  .controls .sep { display: none; }
  .plot { height: 340px; }
}
@media (max-width: 640px) {
  .topbar-row { flex-wrap: wrap; row-gap: 4px; padding: 8px 16px; }
  .pagenav { order: 3; width: 100%; padding-left: 0; border-left: 0; margin-left: -10px; }
  .article h1 { font-size: 32px; }
  .article h2 { font-size: 23px; margin-top: 48px; }
  .toc ol { grid-template-columns: minmax(0, 1fr); }
  .models-fig { grid-template-columns: minmax(0, 1fr); }
  .legend { grid-template-columns: minmax(0, 1fr); }
  .side { grid-template-columns: minmax(0, 1fr); }
  .side .shot { max-width: 320px; }
  .pin { width: 18px; height: 18px; font-size: 10px; border-width: 1.5px; }
  .fig { padding: 12px 10px 8px; }
  .models-fig figure { display: grid; grid-template-columns: 40% minmax(0, 1fr); }
  .article dl.terms { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .article dl.terms dd { margin-bottom: 10px; }
  .tool-head h1 { font-size: 26px; }
  .readouts-sm dd { font-size: 22px; }
}
