/* =============================================================================
   とここと録音帳 — Components
   とここと手帳（misawa-techo）の site/assets/css/app.css と同じ骨格。
   白地・黒細枠カード・直角寄り・字間ひろめ・銀杏イエローのアクセント。
   絵文字は使わず、線画SVG（Tabler Icons / MIT）をインラインで置く。
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--text-primary);
  background: var(--bg-app);
  -webkit-font-smoothing: antialiased;
}
h1,h2,h3,h4,p,figure,ul,ol,dl,dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: var(--text-link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: var(--fs-body); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 2px; }
::selection { background: var(--ginkgo-soft); color: var(--ink); }

.ic { width: 1.15em; height: 1.15em; stroke-width: 1.8; vertical-align: -0.22em; flex: none; }
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--space-4); }
.section { padding-block: var(--space-6); }
.section.tight { padding-block: var(--space-4); }
.stack > * + * { margin-top: var(--space-3); }
.muted { color: var(--text-tertiary); }
.small { font-size: var(--fs-caption); }
.num { font-variant-numeric: tabular-nums; }
.row { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: var(--z-header);
  background: rgba(255,255,255,.95); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--ink);
}
.site-header .inner {
  max-width: var(--container); margin-inline: auto;
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  padding: 10px var(--space-4);
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; }
.brand:hover { text-decoration: none; }
.brand .leaf { width: 30px; height: 30px; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-family: var(--font-logo); font-size: 17px; font-weight: 700; letter-spacing: var(--ls-mid); }
.brand-text small { font-size: 10px; color: var(--text-tertiary); letter-spacing: var(--ls-wide); }
.header-nav { display: flex; gap: 2px; align-items: center; }
.header-nav .nav-item {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px; font-size: var(--fs-sm); font-weight: 500; letter-spacing: var(--ls-mid);
  color: var(--ink-soft); border-radius: var(--radius-md); background: none; border: 0;
}
.header-nav .nav-item:hover { background: var(--bg-neutral); text-decoration: none; color: var(--ink); }
.header-nav .nav-item.active { font-weight: 700; color: var(--ink); }
@media (max-width: 720px) { .header-nav .label { display: none; } .header-nav .nav-item { padding: 7px 9px; } }

/* ---------- Card ---------- */
.card {
  background: var(--paper);
  border: 1px solid var(--ink);
  border-radius: var(--radius-md);
  padding: var(--space-5);
}
.card.soft { border-color: var(--border-default); }
.card + .card { margin-top: var(--space-3); }

.sec-title {
  display: flex; align-items: baseline; gap: var(--space-3);
  font-size: var(--fs-h2); font-weight: 700; letter-spacing: var(--ls-mid);
  margin-bottom: var(--space-4);
}
.sec-title::after { content: ""; flex: 1; height: 1px; background: var(--ink); transform: translateY(-4px); }
.sec-title .en { font-size: var(--fs-micro); font-weight: 500; color: var(--text-tertiary); letter-spacing: .14em; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: var(--fs-micro); font-weight: 700; letter-spacing: var(--ls-mid);
  padding: 2px 9px; border-radius: var(--radius-sm); line-height: 1.7; white-space: nowrap;
  border: 1px solid var(--ink); background: var(--paper); color: var(--ink);
}
.badge.ginkgo { background: var(--ginkgo-soft); border-color: var(--ginkgo-deep); color: #7a5a08; }
.badge.soft { border-color: var(--border-default); color: var(--text-secondary); }
.badge.good { background: var(--good-bg); border-color: var(--good); color: var(--good); }
.badge.warn { background: var(--warn-bg); border-color: var(--warn); color: var(--warn); }
.badge.risk { background: var(--risk-bg); border-color: var(--risk); color: var(--risk); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--radius-md);
  font-size: var(--fs-sm); font-weight: 700; letter-spacing: var(--ls-wide);
  border: 1px solid var(--ink); cursor: pointer;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover:not(:disabled) { background: #000; }
.btn-line { background: var(--paper); color: var(--ink); }
.btn-line:hover:not(:disabled) { background: var(--bg-neutral); }
.btn-ginkgo { background: var(--ginkgo); border-color: var(--ginkgo-deep); color: #3a2d05; }
.btn-ginkgo:hover:not(:disabled) { background: var(--ginkgo-deep); color: #fff; }
.btn.sm { padding: 7px 13px; font-size: var(--fs-caption); }
.btn.block { width: 100%; }

/* ---------- Form ---------- */
.field { display: block; }
.field > .lb {
  display: block; font-size: var(--fs-caption); font-weight: 700;
  letter-spacing: var(--ls-mid); color: var(--text-secondary); margin-bottom: 5px;
}
.input, .textarea, .select {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--border-default); border-radius: var(--radius-sm);
  background: var(--paper); color: var(--ink); line-height: 1.6;
}
.input:focus, .textarea:focus, .select:focus { border-color: var(--ink); outline: none; }
.textarea { min-height: 72px; resize: vertical; }
.input.code {
  font-size: 26px; font-weight: 700; letter-spacing: .5em; text-align: center;
  font-variant-numeric: tabular-nums; padding-left: .5em;
}
.hint { font-size: var(--fs-caption); color: var(--text-tertiary); margin-top: 6px; line-height: 1.7; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-sm); cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--ink); }

/* ---------- 通知 ---------- */
.notice {
  border: 1px solid var(--border-default); border-left: 3px solid var(--ink);
  background: var(--bg-subtle); padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm); font-size: var(--fs-sm); line-height: 1.8;
}
.notice.err { border-left-color: var(--risk); background: var(--risk-bg); color: #8c2318; }
.notice.ok { border-left-color: var(--good); background: var(--good-bg); color: #1d5c2c; }
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 11px 20px; border-radius: var(--radius-full);
  font-size: var(--fs-sm); font-weight: 700; letter-spacing: var(--ls-mid);
  z-index: 300; box-shadow: 0 8px 24px rgba(0,0,0,.22);
}

/* ---------- 録音 ---------- */
.rec-panel { text-align: center; padding-block: var(--space-6); }
.rec-btn {
  width: 132px; height: 132px; border-radius: var(--radius-full);
  border: 2px solid var(--ink); background: var(--paper);
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font-size: var(--fs-sm); font-weight: 700; letter-spacing: var(--ls-wide);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.rec-btn .ic { width: 38px; height: 38px; stroke-width: 1.5; }
.rec-btn:hover:not(:disabled) { background: var(--bg-neutral); }
.rec-btn.on { background: var(--risk); border-color: var(--risk); color: #fff; animation: pulse 2s infinite; }
.rec-btn.on:hover { background: #a8342a; }
.rec-btn:disabled { opacity: .4; cursor: not-allowed; animation: none; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(192,57,43,.34); } 50% { box-shadow: 0 0 0 14px rgba(192,57,43,0); } }
@media (prefers-reduced-motion: reduce) { .rec-btn.on { animation: none; } }

.rec-time {
  font-size: 38px; font-weight: 700; font-variant-numeric: tabular-nums;
  letter-spacing: .04em; line-height: 1.2; margin-top: var(--space-4);
}
.rec-state { font-size: var(--fs-caption); color: var(--text-tertiary); letter-spacing: var(--ls-wide); }
.level { height: 5px; background: var(--bg-neutral); border-radius: var(--radius-full); overflow: hidden; margin: var(--space-3) auto 0; max-width: 260px; }
.level > i { display: block; height: 100%; width: 0; background: var(--ink); transition: width .08s linear; }

.bar { height: 6px; background: var(--bg-neutral); border-radius: var(--radius-full); overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; background: var(--ginkgo-deep); transition: width .2s var(--ease); }

/* ---------- 録音中の「ちゃんと録れている」表示 ---------- */
.mic-status { margin-top: var(--space-3); }
.mic-line {
  display: flex; align-items: center; justify-content: center; gap: var(--space-2);
  flex-wrap: wrap; margin-top: var(--space-2);
}
.mic-line .badge.risk { animation: blink 1.4s infinite; }
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .mic-line .badge.risk { animation: none; } }

/* ---------- 停止後の段階表示 ---------- */
.steps { margin-top: var(--space-5); border-top: 1px solid var(--border-subtle); }
.steps li {
  display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: var(--space-2);
  padding: 11px 2px; border-bottom: 1px solid var(--border-subtle);
  font-size: var(--fs-sm); color: var(--text-disabled);
}
.steps li .mark {
  width: 18px; height: 18px; border-radius: var(--radius-full);
  border: 1.5px solid var(--border-default); position: relative;
}
.steps li .sub { font-size: var(--fs-caption); color: var(--text-tertiary); font-variant-numeric: tabular-nums; }
.steps li.doing { color: var(--text-primary); font-weight: 700; }
.steps li.doing .mark { border-color: var(--ink); border-top-color: transparent; animation: spin .9s linear infinite; }
.steps li.done { color: var(--text-secondary); }
.steps li.done .mark { border-color: var(--good); background: var(--good); }
.steps li.done .mark::after {
  content: ""; position: absolute; left: 5px; top: 1px; width: 5px; height: 10px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.steps li.failed { color: var(--risk); font-weight: 700; }
.steps li.failed .mark { border-color: var(--risk); background: var(--risk); }
.steps li.failed .mark::after {
  content: "!"; position: absolute; inset: 0; color: #fff; font-size: 12px;
  font-weight: 700; line-height: 15px; text-align: center;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .steps li.doing .mark { animation: none; border-top-color: var(--ink); } }

/* ---------- 「問題なく記録できています」 ---------- */
.assured {
  margin-top: var(--space-4); padding: var(--space-4) var(--space-5);
  border: 1.5px solid var(--good); background: var(--good-bg); border-radius: var(--radius-md);
}
.assured-head {
  display: flex; align-items: center; gap: 8px;
  font-size: var(--fs-h3); font-weight: 700; letter-spacing: var(--ls-mid); color: #1d5c2c;
}
.assured-head .ic { width: 22px; height: 22px; stroke-width: 2.4; }
.assured-body { margin-top: 6px; font-size: var(--fs-sm); color: #245c33; line-height: 1.9; }

/* ---------- 困ったときの案内 ---------- */
.trouble {
  margin-top: var(--space-4); padding: var(--space-4) var(--space-5);
  border: 1.5px solid var(--risk); border-radius: var(--radius-md); background: var(--risk-bg);
}
.trouble h3 { font-size: var(--fs-h3); font-weight: 700; letter-spacing: var(--ls-mid); color: #8c2318; }
.trouble p { margin: 8px 0 0; font-size: var(--fs-sm); line-height: 1.9; }
.trouble ol { margin: var(--space-3) 0 0; padding-left: 1.4em; list-style: decimal; }
.trouble ol li { font-size: var(--fs-sm); line-height: 1.9; margin-bottom: 6px; }
.trouble .keep {
  margin-top: 10px; padding: 8px 12px; border-radius: var(--radius-sm);
  font-size: var(--fs-sm); font-weight: 700;
}
.trouble .keep.ok { background: var(--good-bg); color: #1d5c2c; border: 1px solid var(--good); }
.trouble .keep.warn { background: var(--ginkgo-wash); color: #7a5a08; border: 1px solid var(--ginkgo-deep); }
.trouble .small { margin-top: var(--space-3); }

/* ---------- 書き起こし ---------- */
.transcript {
  white-space: pre-wrap; word-break: break-word;
  background: var(--bg-subtle); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm);
  padding: var(--space-4); font-size: var(--fs-sm); line-height: 2;
  max-height: 52vh; overflow-y: auto;
}

/* ---------- 一覧 ---------- */
.note-list > li + li { margin-top: var(--space-3); }
.note-row {
  background: var(--paper); border: 1px solid var(--border-default); border-radius: var(--radius-md);
  padding: var(--space-4);
}
.note-row.open { border-color: var(--ink); }
.note-row .head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); }
.note-row h3 { font-size: var(--fs-body); font-weight: 700; letter-spacing: var(--ls-mid); line-height: 1.6; }
.note-row .meta { font-size: var(--fs-caption); color: var(--text-tertiary); letter-spacing: var(--ls-mid); }
.note-row .body { margin-top: var(--space-4); }

.empty { text-align: center; padding: var(--space-10) var(--space-4); color: var(--text-tertiary); font-size: var(--fs-sm); }

/* ---------- 表（管理） ---------- */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--paper); }
table.tbl { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
table.tbl th, table.tbl td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border-subtle); white-space: nowrap; }
table.tbl th { background: var(--bg-subtle); font-size: var(--fs-caption); font-weight: 700; letter-spacing: var(--ls-mid); color: var(--text-secondary); }
table.tbl tbody tr:last-child td { border-bottom: 0; }
table.tbl td.wrap { white-space: normal; min-width: 200px; }
.tbl .mini {
  width: 84px; padding: 5px 8px; border: 1px solid var(--border-default);
  border-radius: var(--radius-sm); font-size: var(--fs-caption);
}

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: var(--space-3); }
.stat {
  background: var(--paper); border: 1px solid var(--ink); border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
}
.stat .k { font-size: var(--fs-micro); color: var(--text-tertiary); letter-spacing: var(--ls-wide); }
.stat .v { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.4; }
.stat .v small { font-size: var(--fs-caption); font-weight: 500; color: var(--text-tertiary); margin-left: 3px; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: var(--space-4); }
.tabs button {
  padding: 7px 14px; font-size: var(--fs-caption); font-weight: 700; letter-spacing: var(--ls-mid);
  border: 1px solid var(--border-default); background: var(--paper); color: var(--text-secondary);
  border-radius: var(--radius-full);
}
.tabs button.on { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--ink); background: var(--paper);
  margin-top: var(--space-10); padding: var(--space-6) 0;
  font-size: var(--fs-caption); color: var(--text-tertiary); line-height: 1.9;
}

/* =============================================================================
   ミニ校長（みさわ小 キャラクター素材集より）
   線画だけの画面が事務的になりすぎないよう、要所に小さく置く。
   置き方の約束:
     ・情報の邪魔をしない（pointer-events は殺す・文字に重ねない）
     ・1画面に多くて2体。並べると散らかる
     ・「うまくいった」「困った」など、状態が変わる場所にだけ出す
   ========================================================================== */
.chara { position: absolute; pointer-events: none; user-select: none; z-index: 0; }
.chara img { display: block; width: 100%; height: auto; }

/* 録音ボタンの後ろからのぞく */
.rec-btn-wrap { position: relative; display: inline-block; }
.rec-btn-wrap .rec-btn { position: relative; z-index: 1; }
.chara-peek { right: -46px; bottom: -2px; width: 76px; animation: bob 3.2s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@media (max-width: 420px) { .chara-peek { right: -34px; width: 60px; } }

/* ログインの箱 */
.login-card { position: relative; padding-bottom: 74px; }
.chara-hello { right: 14px; bottom: -2px; width: 82px; }

/* 「問題なく記録できています」 */
.assured { position: relative; padding-right: 96px; }
.chara-ok { right: 10px; bottom: 4px; width: 78px; }
@media (max-width: 420px) { .assured { padding-right: 74px; } .chara-ok { width: 62px; } }

/* 困ったときの案内 */
.trouble { position: relative; }
.chara-oops { right: 12px; top: -14px; width: 62px; }
@media (max-width: 520px) { .chara-oops { width: 48px; right: 6px; } }

/* 書き起こしができた */
.result-head { position: relative; }
.chara-yay { right: 0; top: -34px; width: 66px; }

/* まとめて NotebookLM へ */
.bundle-card { position: relative; padding-right: 104px; }
.chara-note { right: 12px; bottom: 8px; width: 84px; }
@media (max-width: 560px) { .bundle-card { padding-right: var(--space-5); } .chara-note { display: block; position: static; width: 76px; margin: 10px 0 0 auto; } }

/* 記録がまだ無いとき */
.empty .chara-sleep { display: block; position: static; width: 108px; margin: 0 auto 10px; }

/* チームの進み具合 */
.teams-head { position: relative; }
.chara-team { right: 0; top: -20px; width: 92px; }
@media (max-width: 560px) { .chara-team { display: none; } }

@media (prefers-reduced-motion: reduce) { .chara-peek { animation: none; } }
