﻿/* 社労士styles.cssを.sharoshi-app配下にスコープ（自動生成）*/
.sharoshi-app {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Noto Sans JP", "BIZ UDPGothic", "Hiragino Kaku Gothic ProN", "Meiryo", sans-serif;
  letter-spacing: 0.03em;
}
.sharoshi-app button, .sharoshi-app input, .sharoshi-app select {
  font: inherit;
}
.sharoshi-app button {
  cursor: pointer;
}
/* ═══════════════════════════════════════════════════════
   外枠：左のメニュー ＋ 幅の狭い上部バー
   横に並べたモードタブは、幅が要るうえに上部を1段まるごと占有していた。
   縦のメニューに移し、上部バーは画面名とその画面の操作だけに絞って、
   本文（読む・解く場所）の面積を最大化する。
   ═══════════════════════════════════════════════════════ */
.sharoshi-app {
  display: grid;
  grid-template-columns: var(--sidenav-w, 208px) minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}
.sharoshi-app.is-nav-collapsed { --sidenav-w: 60px; }

.sharoshi-app .shell {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}
/* 本文だけがスクロールする。上部バーとメニューは常に見えている */
.sharoshi-app main {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* 深緑の地に薄い緑字だと、色相が近すぎて文字が沈む（読みにくいと指摘あり）。
   本文と同じ明るい地に濃い字へ変え、選択中だけを色で立てる */
.sharoshi-app .sidenav {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #eef2f1;
  color: var(--ink);
  border-right: 1px solid var(--line);
  overflow: hidden;
}
/* メニュー頭のアプリ名。見出しのグループを外したので、ここが唯一の名札になる。
   主役は学習項目なので控えめに（項目より小さく・淡く） */
.sharoshi-app .sidenav-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: none;
  padding: 11px 12px 10px;
  border-bottom: 1px solid var(--line);
}
.sharoshi-app .sidenav-brand img {
  flex: none;
  display: block;
  width: 22px;
  height: 22px; /* 角印なので角丸は付けない */
}
.sharoshi-app .sidenav-brand span {
  font-size: 12.5px;
  font-weight: 700;
  color: #55666c;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* 誰として記録しているか（Google ログインのアドレス）とログアウト。
   学習ログは人ごとに分かれるので常に見えるようにするが、主役ではないので小さく */
.sharoshi-app .sidenav-viewer {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px 7px;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  color: #7d8c92;
}
.sharoshi-app .sidenav-viewer[hidden] { display: none; }
.sharoshi-app .sidenav-viewer-name {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sharoshi-app .sidenav-logout {
  flex: none;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: #637176;
  font-size: 11px;
  cursor: pointer;
}
.sharoshi-app .sidenav-logout:hover { border-color: var(--accent); color: var(--accent-dark); }
/* 閉じたとき（幅60px）はアイコンだけにする */
.sharoshi-app.is-nav-collapsed .sidenav-brand { justify-content: center; padding: 11px 0 10px; }
.sharoshi-app.is-nav-collapsed .sidenav-brand span { display: none; }
.sharoshi-app.is-nav-collapsed .sidenav-viewer { display: none; }

.sharoshi-app .sidenav-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 0 12px;
}
/* 見出しと項目はそろえる。閉じたときはアイコンだけが残る */
.sharoshi-app .sidenav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 0;
  border-radius: 0; /* 縦メニューでは角丸が浮いて見えるので角のまま */
  background: transparent;
  color: #43555a;
  font: inherit;
  font-size: 13.5px;
  font-weight: 700;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}
.sharoshi-app .sidenav-item i {
  flex: none;
  width: 22px;
  font-style: normal;
  font-size: 15px;
  text-align: center;
}
.sharoshi-app .sidenav-item span { overflow: hidden; text-overflow: ellipsis; }
.sharoshi-app .sidenav-item:hover { background: rgba(15, 118, 110, 0.08); color: var(--ink); }
/* 選択中は角丸をやめ、左の帯で示す（丸いピルは縦メニューだと浮く） */
.sharoshi-app .sidenav-item.is-active {
  background: #fff;
  color: var(--accent-dark);
  box-shadow: inset 3px 0 0 var(--accent);
}
.sharoshi-app .sidenav-caret {
  margin-left: auto;
  font-size: 10px;
  transition: transform 0.15s;
}

.sharoshi-app .sidenav-collapse {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 12px;
  min-height: 40px;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  color: #55666c;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}
.sharoshi-app .sidenav-collapse i { flex: none; width: 22px; font-style: normal; font-size: 15px; text-align: center; }
.sharoshi-app .sidenav-collapse:hover { color: var(--ink); background: rgba(15, 118, 110, 0.08); }
.sharoshi-app.is-nav-collapsed .sidenav-collapse i { transform: rotate(180deg); }

/* 閉じた状態：文字を消してアイコンだけにする（幅60px） */
.sharoshi-app.is-nav-collapsed .sidenav-item span,
.sharoshi-app.is-nav-collapsed .sidenav-collapse span,
.sharoshi-app.is-nav-collapsed .sidenav-caret { display: none; }
.sharoshi-app.is-nav-collapsed .sidenav-item,
.sharoshi-app.is-nav-collapsed .sidenav-collapse { justify-content: center; padding: 0; }

.sharoshi-app .sidenav-scrim { display: none; }

.sharoshi-app .topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: none;
  padding: 0 clamp(12px, 2vw, 22px);
  min-height: 46px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.sharoshi-app .topbar-burger {
  display: none;
  width: 32px;
  height: 32px;
  color: var(--ink);
  background: none;
  border: 0;
  padding: 6px;
  cursor: pointer;
}
.sharoshi-app .topbar-burger-lines,
.sharoshi-app .topbar-burger-lines::before,
.sharoshi-app .topbar-burger-lines::after {
  display: block;
  width: 20px;
  height: 2px;
  border-radius: 1px;
  background: currentColor;
}
.sharoshi-app .topbar-burger-lines { position: relative; }
.sharoshi-app .topbar-burger-lines::before,
.sharoshi-app .topbar-burger-lines::after {
  content: "";
  position: absolute;
  left: 0;
}
.sharoshi-app .topbar-burger-lines::before { top: -6px; }
.sharoshi-app .topbar-burger-lines::after { top: 6px; }
.sharoshi-app .topbar-title {
  flex: 0 0 auto; /* 右の絞り込みラベルが伸びても、画面名は削らない */
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
  white-space: nowrap;
}
.sharoshi-app .topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}
.sharoshi-app .topbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  height: 32px;
  white-space: nowrap;
  cursor: pointer;
}
.sharoshi-app .topbar-btn { min-width: 0; }
.sharoshi-app .topbar-btn span { overflow: hidden; text-overflow: ellipsis; }
.sharoshi-app .topbar-btn:hover { border-color: var(--accent); color: var(--accent-dark); }
.sharoshi-app .topbar-btn[aria-expanded="true"] { background: var(--paper); border-color: var(--accent); color: var(--accent-dark); }
.sharoshi-app .topbar-btn[hidden] { display: none; }
/* 絞り込みが効いているときは点で知らせる（畳んでいても気づける） */
.sharoshi-app .topbar-btn.has-filter::after {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #b7791f;
}
/* ブランドマーク（角印）はサイドメニューから外したため定義ごと削除 */
.sharoshi-app h1, .sharoshi-app h2, .sharoshi-app h3, .sharoshi-app p {
  margin: 0;
}
.sharoshi-app h1 {
  font-size: clamp(22px, 3vw, 32px);
}
.sharoshi-app .ghost-button, .sharoshi-app .search-row button, .sharoshi-app .chip, .sharoshi-app .subject-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 6px;
}
.sharoshi-app .ghost-button {
  min-height: 42px;
  padding: 0 16px;
  color: var(--accent-dark);
  border-color: #9ac7c2;
  font-weight: 700;
}
.sharoshi-app .search-band {
  padding: 24px clamp(16px, 4vw, 48px) 18px;
  background: linear-gradient(180deg, #eef8f3 0%, var(--paper) 100%);
}
.sharoshi-app .search-panel {
  max-width: 1180px;
  margin: 0 auto;
}
.sharoshi-app .search-panel label {
  display: block;
  margin-bottom: 8px;
  color: var(--accent-dark);
  font-weight: 800;
}
.sharoshi-app .search-row {
  display: grid;
  grid-template-columns: 1fr 44px;
  gap: 8px;
}
.sharoshi-app .search-row input {
  width: 100%;
  min-height: 48px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-size: 16px;
}
.sharoshi-app .search-row button {
  font-size: 22px;
}
.sharoshi-app .filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.sharoshi-app .chip {
  min-width: 52px;
  min-height: 34px;
}
.sharoshi-app .chip.is-active, .sharoshi-app .subject-button.is-active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}
.sharoshi-app .layout {
  display: grid;
  grid-template-columns: minmax(160px, 210px) minmax(280px, 360px) minmax(560px, 1fr);
  gap: 18px;
  max-width: 1480px;
  margin: 0 auto;
  padding: 18px clamp(16px, 4vw, 48px) 42px;
}
.sharoshi-app .side-panel, .sharoshi-app .results, .sharoshi-app .detail-panel {
  min-width: 0;
}
.sharoshi-app .control-block {
  padding: 16px;
  margin-bottom: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
}
.sharoshi-app .control-block h2 {
  margin-bottom: 12px;
  font-size: 16px;
}
.sharoshi-app .stack {
  display: grid;
  gap: 8px;
}
.sharoshi-app .subject-button {
  min-height: 38px;
  padding: 0 10px;
  text-align: left;
}
.sharoshi-app input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}
.sharoshi-app #importanceLabel {
  margin-top: 8px;
  color: var(--gold);
  font-weight: 800;
}
.sharoshi-app .results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.sharoshi-app .results-head h2 {
  font-size: 18px;
}
.sharoshi-app .results-head select {
  min-height: 36px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}
.sharoshi-app .term-list {
  display: grid;
  gap: 10px;
}
.sharoshi-app .term-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  width: 100%;
  min-height: 78px;
  padding: 12px 14px;
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 6px 16px rgba(30, 37, 40, 0.04);
}
.sharoshi-app .term-card.is-active {
  border-color: var(--accent);
  box-shadow: var(--shadow);
}
.sharoshi-app .term-card strong {
  display: block;
  margin-bottom: 4px;
  font-size: 16px;
}
.sharoshi-app .term-card small {
  color: var(--muted);
  font-size: 12px;
}
.sharoshi-app .term-card em {
  grid-column: 1 / -1;
  color: var(--accent-dark);
  font-style: normal;
  font-weight: 700;
  font-size: 13px;
}
.sharoshi-app .detail-panel {
  /* 内部スクロールにすると、マウスが用語一覧側にある間はページが動かず
     深掘り解説など縦に長いコンテンツの下部に到達できなくなるため、
     常にページ全体でスクロールする（sticky・内部overflowは持たせない） */
  align-self: start;
  padding: 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
}
/* ≤1040px幅のマスターディテール表示でのみ表示（通常は非表示） */
.sharoshi-app .detail-back-btn {
  display: none;
  width: 100%;
  min-height: 44px;
  margin-bottom: 18px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-dark);
  cursor: pointer;
  text-align: left;
}
.sharoshi-app .detail-back-btn:hover { border-color: var(--accent); }
.sharoshi-app .detail-title {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.sharoshi-app .detail-title p {
  color: var(--accent-dark);
  font-weight: 800;
}
.sharoshi-app .detail-title h2 {
  margin-top: 4px;
  font-size: clamp(24px, 3vw, 34px);
}
.sharoshi-app .detail-title span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}
.sharoshi-app .explain {
  margin: 18px 0;
}
.sharoshi-app .explain p {
  font-size: 16px;
  line-height: 2;
}
.sharoshi-app .detail-panel section {
  margin-top: 18px;
}
.sharoshi-app .detail-panel h3 {
  margin-bottom: 8px;
  color: var(--rose);
  font-size: 15px;
}
.sharoshi-app .detail-panel p {
  line-height: 1.8;
}
.sharoshi-app .related {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
/* さらに詳しく（試験ポイント・深掘り解説など）：既定は折りたたみ */
.sharoshi-app .detail-more {
  margin-top: 20px;
  border-top: 1px solid var(--line);
  padding-top: 4px;
}
.sharoshi-app .detail-more > summary {
  cursor: pointer;
  padding: 10px 0;
  font-weight: 700;
  color: var(--muted);
  font-size: 13px;
  list-style: none;
}
.sharoshi-app .detail-more > summary::-webkit-details-marker { display: none; }
.sharoshi-app .detail-more > summary::before { content: "▸ "; }
.sharoshi-app .detail-more[open] > summary::before { content: "▾ "; }
.sharoshi-app .detail-more > summary:hover { color: var(--accent-dark); }
.sharoshi-app .related button {
  padding: 6px 10px;
  color: var(--ink);
  background: #f4f0e8;
  border: 1px solid #e2d8c5;
  border-radius: 6px;
  font-weight: 700;
}
.sharoshi-app .related button.is-known {
  color: var(--accent-dark);
  background: #eef8f3;
  border-color: #9ac7c2;
}
.sharoshi-app .deep-dive {
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.sharoshi-app .deep-dive-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.sharoshi-app .deep-dive-head h3 {
  margin-bottom: 0;
}
.sharoshi-app .deep-dive button, .sharoshi-app #applyDeepDiveButton {
  min-height: 38px;
  padding: 0 12px;
  color: var(--accent-dark);
  background: #eef8f3;
  border: 1px solid #9ac7c2;
  border-radius: 6px;
  font-weight: 800;
}
.sharoshi-app .deep-dive button:disabled {
  opacity: 0.55;
  cursor: wait;
}
.sharoshi-app .deep-dive-result {
  display: grid;
  gap: 12px;
}
.sharoshi-app .deep-group {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}
.sharoshi-app .deep-group summary {
  min-height: 42px;
  padding: 10px 12px;
  color: var(--accent-dark);
  background: #eef8f3;
  cursor: pointer;
  font-weight: 800;
}
.sharoshi-app .deep-group-body {
  display: grid;
  gap: 10px;
  padding: 12px;
}
.sharoshi-app .deep-block {
  display: grid;
  gap: 8px;
  padding: 12px;
  background: #fbfcfa;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.sharoshi-app .deep-block h4 {
  margin: 0;
  color: var(--accent-dark);
  font-size: 14px;
}
.sharoshi-app .table-wrap {
  overflow-x: auto;
}
.sharoshi-app .deep-block table {
  width: 100%;
  min-width: 420px;
  border-collapse: collapse;
  font-size: 14px;
}
.sharoshi-app .deep-block th, .sharoshi-app .deep-block td {
  padding: 8px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.sharoshi-app .deep-block th {
  background: #eef8f3;
  color: var(--accent-dark);
}
.sharoshi-app .formula-block pre {
  margin: 0;
  overflow-x: auto;
  padding: 12px;
  white-space: pre;
  background: #172022;
  color: #f0f7f3;
  border-radius: 6px;
  line-height: 1.5;
}
.sharoshi-app .formula-display {
  overflow-x: auto;
  padding: 8px 0;
  text-align: center;
}
.sharoshi-app .mermaid {
  overflow-x: auto;
  text-align: center;
}
.sharoshi-app .mermaid svg {
  max-width: 100%;
  height: auto;
}
/* mermaid.initialize() が body直下に作る #mermaidTooltip は、そのままだと
   在フローの空divとして文書末尾に6px積まれ、全モードで下端に隙間を作る。
   ツールチップ本体は表示時に絶対配置で位置決めされるため、外しても影響しない */
#mermaidTooltip, .mermaidTooltip {
  position: absolute;
  top: 0;
  left: 0;
}
.sharoshi-app .quiz-list {
  display: grid;
  gap: 8px;
}
.sharoshi-app .quiz-list details {
  padding: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.sharoshi-app .quiz-list summary {
  cursor: pointer;
  font-weight: 800;
}
.sharoshi-app .quiz-list p {
  margin-top: 8px;
}
.sharoshi-app .law-check {
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.sharoshi-app .law-check-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.sharoshi-app .law-check-head h3 {
  margin-bottom: 0;
}
.sharoshi-app .law-check button, .sharoshi-app #applyLawPatchButton {
  min-height: 38px;
  padding: 0 12px;
  color: var(--accent-dark);
  background: #eef8f3;
  border: 1px solid #9ac7c2;
  border-radius: 6px;
  font-weight: 800;
}
.sharoshi-app .law-check button:disabled {
  opacity: 0.55;
  cursor: wait;
}
.sharoshi-app .law-result {
  display: grid;
  gap: 10px;
  color: var(--ink);
}
.sharoshi-app .law-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.sharoshi-app .law-status strong {
  padding: 4px 8px;
  color: #fff;
  background: var(--rose);
  border-radius: 6px;
}
.sharoshi-app .law-status span, .sharoshi-app .source-title {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.sharoshi-app .source-list {
  margin: 0;
  padding-left: 20px;
  line-height: 1.7;
}
.sharoshi-app .source-list a {
  color: var(--accent-dark);
}
.sharoshi-app .query-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.sharoshi-app .query-list span {
  padding: 4px 8px;
  background: #f4f0e8;
  border-radius: 6px;
}
.sharoshi-app .patch-preview {
  display: grid;
  gap: 6px;
  margin: 0;
}
.sharoshi-app .patch-preview dt {
  color: var(--rose);
  font-weight: 800;
}
.sharoshi-app .patch-preview dd {
  margin: 0 0 8px;
  line-height: 1.7;
}
.sharoshi-app .error-text {
  color: var(--rose);
  font-weight: 800;
}
.sharoshi-app .empty-state {
  padding: 24px;
  color: var(--muted);
  text-align: center;
}
/* 読み込み失敗の理由と再試行ボタン（空欄のまま放置しないため） */
.sharoshi-app .empty-state-detail {
  display: inline-block;
  margin: 6px 0 10px;
  color: var(--rose);
  font-size: 0.86rem;
}
.sharoshi-app .exam-retry-btn {
  padding: 6px 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.sharoshi-app .exam-retry-btn:hover { background: var(--paper); border-color: var(--accent); }
.sharoshi-app dialog {
  width: min(720px, calc(100vw - 24px));
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
}
.sharoshi-app dialog::backdrop {
  background: rgba(30, 37, 40, 0.42);
}
/* 横並びのモードタブは左メニューに置き換えたため削除（.sidenav-item を参照） */
.sharoshi-app .mode-panel.is-hidden {
  display: none;
}

/* ── ホーム（ダッシュボード） ── */
.sharoshi-app .home-grid {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px clamp(16px, 4vw, 48px) 48px;
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 20px;
}
.sharoshi-app .home-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 20px 22px;
}
.sharoshi-app .home-card h2 {
  margin: 0 0 12px;
  font-size: 15px;
  color: var(--muted);
}
.sharoshi-app .home-continue {
  grid-column: 1;
  grid-row: 1 / 3;
  background: linear-gradient(160deg, #eef8f3 0%, var(--panel) 55%);
}
.sharoshi-app .home-continue-subject {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  padding: 3px 12px;
  border-radius: 6px;
  margin: 0 0 10px;
}
.sharoshi-app .home-continue-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--ink);
  margin: 0 0 8px;
  line-height: 1.4;
}
.sharoshi-app .home-continue-time {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 20px;
}
.sharoshi-app .home-cta {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  padding: 12px 22px;
  border: none;
  border-radius: 8px;
  text-decoration: none;
  cursor: pointer;
}
.sharoshi-app .home-cta:hover { background: var(--accent-dark); }
.sharoshi-app .home-review-count {
  font-size: 40px;
  font-weight: 800;
  color: var(--accent-dark);
  margin: 0 0 4px;
}
.sharoshi-app .home-review-count span {
  font-size: 15px;
  font-weight: 700;
  color: var(--muted);
  margin-left: 4px;
}
.sharoshi-app .home-nav {
  grid-column: 1 / 3;
}
.sharoshi-app .home-analysis {
  grid-column: 1 / 3;
}
.sharoshi-app .home-analysis .analysis-head {
  padding: 0 0 12px;
  margin: 0 0 16px;
  border-bottom: 1px solid var(--line);
}
.sharoshi-app .home-analysis #homeAnalysisBody {
  padding: 0;
  max-width: 820px;
}
.sharoshi-app .home-nav-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
}
.sharoshi-app .home-nav-btn {
  padding: 14px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  font-weight: 700;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
}
.sharoshi-app .home-nav-btn:hover { border-color: var(--accent); color: var(--accent-dark); }
@media (max-width: 820px) {
  .sharoshi-app .home-grid { grid-template-columns: 1fr; padding: 16px 14px 32px; }
  .sharoshi-app .home-continue { grid-column: 1; grid-row: auto; }
  .sharoshi-app .home-nav { grid-column: 1; }
  .sharoshi-app .home-analysis { grid-column: 1; }
  .sharoshi-app .home-nav-grid { grid-template-columns: repeat(3, 1fr); }
  .sharoshi-app .home-continue-title { font-size: 19px; }
}
.sharoshi-app .exam-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px clamp(16px, 4vw, 48px);
  background: linear-gradient(180deg, #eef8f3 0%, var(--paper) 100%);
  border-bottom: 1px solid var(--line);
}
.sharoshi-app .exam-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.sharoshi-app .exam-filters select {
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font: inherit;
  font-size: 14px;
}
.sharoshi-app .weak-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  min-height: 38px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
}
.sharoshi-app .exam-action-btn {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}
.sharoshi-app .exam-action-btn--danger {
  color: var(--rose);
  border-color: #e8b4bf;
}
.sharoshi-app .exam-stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.sharoshi-app .exam-stat {
  text-align: center;
  line-height: 1.3;
}
.sharoshi-app .exam-stat-value {
  display: block;
  font-size: 22px;
  font-weight: 800;
  color: var(--accent-dark);
}
.sharoshi-app .exam-stat-label {
  font-size: 11px;
  color: var(--muted);
}
.sharoshi-app .exam-layout {
  display: grid;
  grid-template-columns: minmax(260px, 340px) 1fr;
  gap: 0;
  max-width: 1280px;
  margin: 0 auto;
  /* 高さは fitPaneHeight() が実測して入れる。上のバー類の高さは
     画面幅・折り返し・絞り込みの開閉で変わるため、固定の引き算だと合わない */
  height: var(--exam-h, 70vh);
  max-height: var(--exam-h, 70vh);
}
.sharoshi-app .exam-list-wrap {
  overflow-y: auto;
  overscroll-behavior: contain;
  border-right: 1px solid var(--line);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sharoshi-app .exam-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sharoshi-app .exam-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  cursor: pointer;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.sharoshi-app .exam-card.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(15,118,110,0.15);
}
.sharoshi-app .exam-card-badge {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 800;
  background: #f0f4f3;
  color: var(--muted);
}
.sharoshi-app .exam-card-badge.is-correct { background: #d1fae5; color: #065f46; }
.sharoshi-app .exam-card-badge.is-wrong { background: #fee2e2; color: #991b1b; }
.sharoshi-app .exam-card-body {
  flex: 1;
  min-width: 0;
}
.sharoshi-app .exam-card-meta {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 2px;
}
.sharoshi-app .exam-card-subj {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
}
.sharoshi-app .exam-detail {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 24px clamp(16px, 3vw, 36px);
}
.sharoshi-app .exam-detail-head {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.sharoshi-app .exam-detail-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.sharoshi-app .exam-attempt-info {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
  margin-left: auto;
}
.sharoshi-app .exam-tag {
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  background: #eef8f3;
  color: var(--accent-dark);
}
.sharoshi-app .exam-tag--year { background: #f4f0e8; color: var(--gold); }
.sharoshi-app .exam-tag--subj { background: #eef8f3; color: var(--accent-dark); }
.sharoshi-app .exam-question-text {
  font-size: 15px;
  line-height: 1.9;
  font-weight: 700;
  margin: 0;
  /* 個数・組合せ問題はア〜オの記述を改行で持つ。潰すと1段落に溶けて読めない */
  white-space: pre-line;
}
.sharoshi-app .choice-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 20px 0;
}
.sharoshi-app .choice-btn {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  font-size: 14px;
  line-height: 1.7;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.sharoshi-app .choice-btn:not([disabled]):hover {
  background: #f0faf7;
  border-color: #9ac7c2;
}
.sharoshi-app .choice-btn[disabled] { cursor: default; }
.sharoshi-app .choice-btn.is-selected { border-color: var(--accent); background: #eef8f3; }
.sharoshi-app .choice-btn.is-correct { border-color: #059669; background: #d1fae5; color: #065f46; }
.sharoshi-app .choice-btn.is-wrong { border-color: #dc2626; background: #fee2e2; color: #991b1b; }
.sharoshi-app .choice-key {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 13px;
  background: #f0f4f3;
  color: var(--muted);
}
/* 複数選択の設問（〜を2つ選びなさい）。
   1タップで即確定にすると、1つ目を押した瞬間に不正解が確定する。
   選び直せるトグルにし、必要数そろってから確定ボタンで解答する */
.sharoshi-app .choice-btn.is-picked { border-color: var(--accent); background: #eef8f3; }
.sharoshi-app .choice-btn.is-picked .choice-key { background: var(--accent); color: #fff; }
.sharoshi-app .multi-row {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 12px;
}
.sharoshi-app .multi-hint { font-size: 12.5px; color: var(--muted); }
.sharoshi-app .multi-submit {
  margin-left: auto; min-height: 40px; padding: 0 18px; border: 0; border-radius: 8px;
  background: var(--accent); color: #fff; font: inherit; font-size: 14px; font-weight: 800;
}
.sharoshi-app .multi-submit:disabled { opacity: .5; }
.sharoshi-app .choice-btn.is-correct .choice-key { background: #059669; color: #fff; }
.sharoshi-app .choice-btn.is-wrong .choice-key { background: #dc2626; color: #fff; }
.sharoshi-app .exam-answer-area {
  margin-top: 16px;
}
.sharoshi-app .reveal-btn {
  width: 100%;
  min-height: 44px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  font: inherit;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
}
.sharoshi-app .exam-result-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 6px;
  font-weight: 800;
  font-size: 15px;
  margin-bottom: 16px;
}
.sharoshi-app .exam-result-banner.is-correct { background: #d1fae5; color: #065f46; }
.sharoshi-app .exam-result-banner.is-wrong { background: #fee2e2; color: #991b1b; }
.sharoshi-app .exam-explanation {
  padding: 16px;
  background: #f8faf7;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 4px;
  font-size: 14px;
  line-height: 1.9;
}
.sharoshi-app .exam-explanation h4 {
  margin: 0 0 8px;
  color: var(--accent-dark);
  font-size: 13px;
}
.sharoshi-app .exp-body { font-size: 14px; line-height: 1.85; color: var(--ink); }
.sharoshi-app .exp-body > *:first-child { margin-top: 0; }
.sharoshi-app .exp-body > *:last-child { margin-bottom: 0; }
.sharoshi-app .exp-body h1, .sharoshi-app .exp-body h2, .sharoshi-app .exp-body h3, .sharoshi-app .exp-body h4, .sharoshi-app .exp-body h5, .sharoshi-app .exp-body h6 {
  margin: 20px 0 10px;
  padding: 6px 12px;
  font-size: 14px;
  font-weight: 800;
  color: var(--accent-dark);
  background: #eef5f3;
  border-left: 4px solid var(--accent);
  border-radius: 0 4px 4px 0;
}
.sharoshi-app .exp-body h1, .sharoshi-app .exp-body h2 { font-size: 15px; }
.sharoshi-app .exp-body p { margin: 0 0 10px; }
.sharoshi-app .exp-body hr {
  border: none;
  border-top: 1px dashed var(--line);
  margin: 16px 0;
}
.sharoshi-app .exp-body ul, .sharoshi-app .exp-body ol {
  margin: 0 0 10px;
  padding-left: 1.4em;
}
.sharoshi-app .exp-body ul { list-style: none; padding-left: 1.25em; }
.sharoshi-app .exp-body ul ul, .sharoshi-app .exp-body ol ol, .sharoshi-app .exp-body ul ol, .sharoshi-app .exp-body ol ul { margin: 6px 0; }
.sharoshi-app .exp-body li { margin: 0 0 6px; }
.sharoshi-app .exp-body ul > li {
  position: relative;
  padding-left: 2px;
}
.sharoshi-app .exp-body ul > li::before {
  content: "";
  position: absolute;
  left: -0.95em;
  top: 0.7em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}
.sharoshi-app .exp-body ul ul > li::before {
  background: transparent;
  border: 1.5px solid var(--gold);
}
.sharoshi-app .exp-body strong { color: var(--accent-dark); font-weight: 800; }
.sharoshi-app .exp-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.92em;
  background: #f1efe9;
  padding: 1px 5px;
  border-radius: 4px;
}
.sharoshi-app .exp-body blockquote {
  margin: 0 0 10px;
  padding: 4px 14px;
  border-left: 3px solid var(--gold);
  background: #faf8f2;
  color: var(--muted);
}
.sharoshi-app .exp-body table {
  border-collapse: collapse;
  width: 100%;
  margin: 0 0 12px;
  font-size: 13px;
}
.sharoshi-app .exp-body th, .sharoshi-app .exp-body td {
  border: 1px solid var(--line);
  padding: 6px 10px;
  text-align: left;
  vertical-align: top;
}
.sharoshi-app .exp-body th { background: #eef5f3; font-weight: 800; }
.sharoshi-app .exam-related {
  margin-top: 14px;
}
.sharoshi-app .exam-related-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 6px;
}
.sharoshi-app .exam-nav {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.sharoshi-app .exam-nav-btn {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font: inherit;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
}
.sharoshi-app .exam-nav-btn:disabled { opacity: 0.4; cursor: default; }
.sharoshi-app .sentaku-body {
  font-weight: 500;
  font-size: 14px;
}
.sharoshi-app .blank-mark {
  display: inline-block;
  min-width: 28px;
  padding: 0 6px;
  margin: 0 2px;
  text-align: center;
  font-weight: 800;
  color: #7c3aed;
  background: #f1eafa;
  border-radius: 4px;
  cursor: pointer;
}
/* 空欄の記号（Ａ〜Ｅ）。語を入れたら小さく添えるだけにして、文章として読めるようにする */
.sharoshi-app .blank-mark i {
  font-style: normal;
  font-size: 11px;
}
.sharoshi-app .blank-mark.is-filled {
  color: #14603f;
  background: #e6f6ee;
  box-shadow: inset 0 -2px 0 #7cc5a6;
}
.sharoshi-app .blank-mark.is-filled i {
  margin-right: 3px;
  opacity: 0.65;
}

/* ── 選択式の入力ドック ──
   本文が画面数枚ぶんあり、下まで送らないと選択欄に届かなかった。
   未回答のあいだは下端に貼り付けて、本文を読みながら選べるようにする。 */
.sharoshi-app .sentaku-dock {
  position: sticky;
  bottom: 0;
  z-index: 20;
  margin: 16px -8px 0;
  padding: 0 8px 8px;
  background: linear-gradient(180deg, rgba(253, 250, 244, 0) 0%, var(--paper) 14px, var(--paper) 100%);
}
.sharoshi-app .sentaku-dock-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 8px 10px 0 0;
  background: #f6f1fb;
}
.sharoshi-app .sentaku-dock-title { font-size: 12px; font-weight: 800; color: #7c3aed; }
.sharoshi-app .sentaku-dock-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-left: auto;
}
.sharoshi-app .sentaku-dock-count.is-full { color: #14603f; }
.sharoshi-app .sentaku-dock-fold {
  font: inherit;
  font-size: 11px;
  line-height: 1;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 8px;
  cursor: pointer;
}
.sharoshi-app .sentaku-dock-body {
  border: 1px solid var(--line);
  border-radius: 0 0 10px 10px;
  background: #fff;
  padding: 10px 12px 12px;
  box-shadow: 0 -6px 18px rgba(24, 30, 45, 0.09);
  max-height: min(46vh, 340px);
  overflow-y: auto;
}
.sharoshi-app .sentaku-dock.is-folded .sentaku-dock-body { display: none; }
.sharoshi-app .sentaku-dock.is-folded .sentaku-dock-head { border-bottom: 1px solid var(--line); border-radius: 8px; }
.sharoshi-app .sentaku-dock-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}
.sharoshi-app .sentaku-dock-actions .reveal-btn { flex: 1; margin: 0; }

.sharoshi-app .sentaku-blanks {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sharoshi-app .exam-answer-area .sentaku-blanks { margin-top: 16px; }

/* 空欄（Ａ〜Ｅ）。押すと「いま埋める場所」になる */
.sharoshi-app .sentaku-slots {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 6px;
}
.sharoshi-app .sentaku-slot {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 10px;
  font: inherit;
  font-size: 13px;
  text-align: left;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
}
.sharoshi-app .sentaku-slot-label {
  flex: none;
  font-weight: 800;
  font-size: 12px;
  color: #7c3aed;
  background: #f1eafa;
  border-radius: 4px;
  padding: 2px 6px;
}
.sharoshi-app .sentaku-slot-word { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sharoshi-app .sentaku-slot.is-filled { color: var(--ink); font-weight: 700; }
.sharoshi-app .sentaku-slot.is-active {
  border-color: #7c3aed;
  background: #faf7ff;
  box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.18);
}

/* 語群。プルダウンにすると開いた瞬間に問題文を覆うので、常に出しておく */
.sharoshi-app .sentaku-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}
.sharoshi-app .sentaku-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font: inherit;
  font-size: 12.5px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
}
.sharoshi-app .sentaku-chip:hover { border-color: #7c3aed; background: #faf7ff; }
/* すでにどこかの空欄に入っている語。どの空欄かを添える（入れ違いに気づける） */
.sharoshi-app .sentaku-chip.is-used {
  color: var(--muted);
  background: var(--paper);
  border-style: dashed;
}
.sharoshi-app .sentaku-chip.is-used i {
  font-style: normal;
  font-size: 10px;
  font-weight: 800;
  color: #7c3aed;
  background: #f1eafa;
  border-radius: 3px;
  padding: 1px 4px;
}
.sharoshi-app .sentaku-chip.is-current {
  color: var(--ink);
  background: #f4ecff;
  border: 1px solid #7c3aed;
  border-style: solid;
}

/* スマホは1列になるぶんドックが伸びる。5空欄で画面の半分を占めては本文が読めないので、
   行を詰めて 5行ぶんがちょうど収まる高さに抑える */
@media (max-width: 720px) {
  .sharoshi-app .sentaku-dock-body {
    max-height: min(38vh, 268px);
    padding: 8px 10px 10px;
  }
  .sharoshi-app .sentaku-slots { grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: 5px; }
  .sharoshi-app .sentaku-slot { min-height: 36px; padding: 0 8px; font-size: 12px; gap: 6px; }
  .sharoshi-app .sentaku-chip { font-size: 12px; padding: 6px 8px; }
  .sharoshi-app .sentaku-dock-actions { margin-top: 8px; }
  .sharoshi-app .sentaku-dock-actions .conf-toggle { font-size: 12px; padding: 7px 10px; }
}
.sharoshi-app .sentaku-row {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  gap: 8px 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}
.sharoshi-app .sentaku-row.is-correct { border-color: #059669; background: #ecfdf5; }
.sharoshi-app .sentaku-row.is-wrong { border-color: #dc2626; background: #fef2f2; }
.sharoshi-app .sentaku-label {
  font-weight: 800;
  color: #7c3aed;
  font-size: 14px;
}
.sharoshi-app .sentaku-picked {
  font-size: 13px;
  font-weight: 700;
  padding: 6px 4px;
}
.sharoshi-app .sentaku-picked.is-correct { color: #065f46; }
.sharoshi-app .sentaku-picked.is-wrong { color: #991b1b; }
.sharoshi-app .sentaku-mark { font-size: 18px; font-weight: 800; }
.sharoshi-app .sentaku-row.is-correct .sentaku-mark { color: #059669; }
.sharoshi-app .sentaku-row.is-wrong .sentaku-mark { color: #dc2626; }
.sharoshi-app .sentaku-correct {
  grid-column: 2 / 4;
  font-size: 12.5px;
  color: #065f46;
  font-weight: 700;
}
.sharoshi-app .analysis-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px clamp(16px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
}
.sharoshi-app .analysis-head h2 { margin: 0; font-size: 18px; }
.sharoshi-app .analysis-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}
.sharoshi-app .analysis-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.sharoshi-app .ac-value { font-size: 22px; font-weight: 800; }
.sharoshi-app .ac-label { font-size: 11px; color: var(--muted); }
.sharoshi-app .analysis-section { margin-bottom: 28px; }
.sharoshi-app .analysis-section h3 { font-size: 14px; margin: 0 0 12px; color: var(--accent-dark); }
.sharoshi-app .chart-svg {
  width: 100%;
  height: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
}
.sharoshi-app .subject-bars { display: flex; flex-direction: column; gap: 8px; }
.sharoshi-app .sbar-row {
  display: grid;
  grid-template-columns: 160px 1fr 96px;
  align-items: center;
  gap: 10px;
}
.sharoshi-app .sbar-name {
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sharoshi-app .sbar-track {
  height: 14px;
  background: #f0f0ee;
  border-radius: 6px;
  overflow: hidden;
}
.sharoshi-app .sbar-fill { display: block; height: 100%; border-radius: 6px; transition: width .3s; }
.sharoshi-app .sbar-val { font-size: 12px; font-weight: 700; text-align: right; }
.sharoshi-app .sbar-val small { color: var(--muted); font-weight: 400; }
.sharoshi-app .analysis-ai-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.sharoshi-app .analysis-ai-head h3 { margin: 0; }
.sharoshi-app .analysis-ai-result { min-height: 8px; }
@media (max-width: 640px) {
.sharoshi-app .analysis-cards { grid-template-columns: repeat(2, 1fr); }
.sharoshi-app .sbar-row { grid-template-columns: 110px 1fr 72px; }

}
@media (max-width: 1040px) {
.sharoshi-app .layout {
    grid-template-columns: 200px 1fr;
  }
.sharoshi-app .detail-panel {
    position: static;
    max-height: none;
    overflow: visible;
    grid-column: 1 / -1;
  }

  /* 用語辞典：この幅では一覧の下に解説が縦積みになり、解説を見るたびに
     長い一覧の下までスクロール→また上に戻る、という往復が苦痛だったため、
     一覧/解説のどちらか一方だけを表示するマスターディテール表示に切り替える */
  #dictionaryMode .detail-back-btn { display: block; }
  #dictionaryMode.is-term-detail-view .search-band,
  #dictionaryMode.is-term-detail-view .side-panel,
  #dictionaryMode.is-term-detail-view .results {
    display: none;
  }
  #dictionaryMode:not(.is-term-detail-view) .detail-panel { display: none; }
}
@media (max-width: 720px) {
.sharoshi-app .exam-layout {
    grid-template-columns: 1fr;
    height: auto;
    max-height: none;
  }
.sharoshi-app .exam-list-wrap {
    height: auto;
    max-height: none;
    overflow: visible;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
.sharoshi-app .exam-detail {
    overflow: visible;
    height: auto;
  }
.sharoshi-app .layout {
    grid-template-columns: 1fr;
  }
.sharoshi-app .side-panel {
    display: grid;
    grid-template-columns: 1fr;
  }
.sharoshi-app .results-head {
    align-items: stretch;
    flex-direction: column;
  }

}

/* ── ポータル統合用オーバーライド ── */
/* 社労士独自ヘッダはポータルのヘッダ/サイドバーがあるため隠す */
/* クラウド版はtopbar(モードタブ)を表示する */
/* コンテンツ領域にフィット（ポータルの main 内に収める） */
.sharoshi-app { min-height: auto; background: transparent; }

/* ── スマホ：メニューは画面外に置き、☰ で引き出す ──
   ドロワーと幕は position:fixed にしない。iOS Safari は fixed の要素が
   下部バーの領域に重なると、バーを不透明な灰色に切り替えたまま、ページを
   読み直すまで戻さない（実機で切り分け：メニューを一度でも開くと以後ずっと
   灰色・URL直打ちの新規読み込みだけ正常・fixedを一切出さない章ページは常に
   正常）。absolute で置き、開く瞬間に現在のスクロール位置へ JS が合わせる */
@media (max-width: 820px) {
  .sharoshi-app { grid-template-columns: minmax(0, 1fr); }
  .sharoshi-app .sidenav {
    position: absolute;
    z-index: 90;
    top: 0; bottom: auto; left: 0;
    width: 232px;
    height: 100dvh; /* 開くときに JS が実測値で上書きする */
    transform: translateX(-100%);
    /* visibility はスライドが終わってから隠す（即時に消すと閉じる動きが見えない） */
    transition: transform 0.2s ease, visibility 0s 0.2s;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.35);
    visibility: hidden; /* 画面外に居るあいだ描画対象にしない */
  }
  .sharoshi-app.is-nav-open .sidenav {
    transform: none;
    visibility: visible;
    transition: transform 0.2s ease, visibility 0s;
  }
  /* 引き出したときは常に文字つき（畳んだ状態を持ち込まない） */
  .sharoshi-app.is-nav-collapsed .sidenav-item span { display: inline; }
  .sharoshi-app.is-nav-collapsed .sidenav-item { justify-content: flex-start; padding: 0 12px; }
  .sharoshi-app.is-nav-collapsed .sidenav-brand span { display: inline; }
  .sharoshi-app.is-nav-collapsed .sidenav-brand { justify-content: flex-start; padding: 11px 12px 10px; }
  .sharoshi-app.is-nav-collapsed .sidenav-viewer { display: block; }
  .sharoshi-app .sidenav-collapse { display: none; } /* 引き出し式では畳む概念が要らない */
  .sharoshi-app .topbar-burger { display: block; }
  /* 絞り込みの内訳まで出すと画面名を押し出すので、ここでは幅を切る（点で有無は分かる） */
  .sharoshi-app #screenToolsBtn { max-width: 40vw; }
  .sharoshi-app .topbar { padding: 0 10px; gap: 8px; }
  .sharoshi-app.is-nav-open .sidenav-scrim {
    display: block;
    position: absolute; /* fixed禁止（このメディアクエリ冒頭のコメント参照） */
    z-index: 80;
    top: 0; left: 0; right: 0;
    height: 100dvh; /* 開くときに JS が位置と実測高で上書きする */
    background: rgba(12, 15, 22, 0.45);
  }
}

/* ── 画面ごとの操作（絞り込みなど）──
   上部の狭いボタンで開閉する。既定は閉じておき、本文の面積を優先する */
.sharoshi-app .screen-tools.is-folded { display: none; }

/* ── 横断検索（Ctrl+K） ── */
.sharoshi-app .gsearch {
  position: fixed;
  inset: 0;
  z-index: 200;
}
.sharoshi-app .gsearch.is-hidden { display: none; }
.sharoshi-app .gsearch-scrim {
  position: absolute;
  inset: 0;
  background: rgba(15, 20, 30, 0.42);
}
.sharoshi-app .gsearch-box {
  position: relative;
  max-width: 640px;
  margin: 9vh auto 0;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 24px 70px rgba(10, 16, 28, 0.4);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 74vh;
}
.sharoshi-app .gsearch-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.sharoshi-app .gsearch-head input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  font: inherit;
  font-size: 16px;
  background: transparent;
  color: var(--ink);
}
.sharoshi-app .gsearch-head button {
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
}
.sharoshi-app .gsearch-results {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px;
}
.sharoshi-app .gsearch-empty { margin: 0; padding: 26px 16px; text-align: center; font-size: 13px; color: var(--muted); }
.sharoshi-app .gsearch-group { margin-bottom: 8px; }
.sharoshi-app .gsearch-group-title {
  font-size: 11.5px;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: 0.06em;
  padding: 8px 10px 4px;
}
.sharoshi-app .gsearch-row {
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  background: transparent;
  border: 0;
  border-radius: 7px;
  padding: 8px 10px;
  cursor: pointer;
}
.sharoshi-app .gsearch-row:hover { background: #f0f6f5; }
.sharoshi-app .gsearch-row-head { display: block; font-size: 13.5px; font-weight: 700; color: var(--ink); }
.sharoshi-app .gsearch-row-sub {
  display: block;
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 1px;
}
.sharoshi-app .gs-kbd {
  font-family: inherit;
  font-size: 10px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
  background: var(--paper);
}
@media (max-width: 820px) {
  .sharoshi-app .gs-kbd { display: none; } /* スマホにCtrl+Kは無い */
  .sharoshi-app .gs-btn-label { display: none; } /* 🔍 だけにして幅を空ける */
  .sharoshi-app .gsearch-box { margin: 4vh 10px 0; max-height: 82vh; }
}

/* ── 画面をまたいで飛んだときの「もどる」バー ──
   タブ自体は「どこから来たか」を持たないため、別タブへ飛ばす導線でだけ出す。
   固定表示ではなく本文の上に積むので、下のボタン類と重ならない。 */
.sharoshi-app .nav-back-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  padding: 6px clamp(12px, 3vw, 28px);
  background: #fdf6e8;
  border-bottom: 1px solid #e8d9b8;
}
/* .is-hidden の汎用定義が無く、上の display:flex（詳細度20）に負けるため明示する */
.sharoshi-app .nav-back-bar.is-hidden { display: none; }
.sharoshi-app .nav-back {
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  color: #7a5410;
  background: #fff;
  border: 1px solid #e0cba0;
  border-radius: 6px;
  padding: 6px 16px;
  cursor: pointer;
}
.sharoshi-app .nav-back:hover { background: #fffaf0; border-color: #c9a961; }

/* ── 条文モード ── */
.sharoshi-app .law-toolbar { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.sharoshi-app #lawSearch { min-height: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: 6px; background: #fff; font-size: 15px; }
.sharoshi-app .law-subjects { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.sharoshi-app .law-subj-chip { min-height: 36px; padding: 0 14px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); font-weight: 700; font-size: 13px; cursor: pointer; transition: all 0.12s ease; }
.sharoshi-app .law-subj-chip:hover { border-color: #9ac7c2; }
.sharoshi-app .law-subj-chip.is-active { color: #fff; background: var(--accent); border-color: var(--accent); }
.sharoshi-app .cloze-btn { min-height: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); font-weight: 700; white-space: nowrap; cursor: pointer; }
.sharoshi-app .cloze-btn.is-active { background: #dc2626; color: #fff; border-color: #dc2626; }
.sharoshi-app .law-hint { margin-top: 10px; color: var(--muted); font-size: 12px; }
.sharoshi-app .law-count { max-width: 1180px; margin: 14px auto 0; padding: 0 clamp(16px, 4vw, 48px); color: var(--muted); font-weight: 700; }
.sharoshi-app .law-list { max-width: 1180px; margin: 8px auto 0; padding: 8px clamp(16px, 4vw, 48px) 56px; display: grid; gap: 12px; }
.sharoshi-app .law-card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); overflow: hidden; }
.sharoshi-app .law-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 10px 16px; background: #eef8f3; border-bottom: 1px solid var(--line); }
.sharoshi-app .law-card-label { font-weight: 800; color: var(--accent-dark); font-size: 16px; white-space: nowrap; }
.sharoshi-app .law-card-sub { color: var(--muted); font-size: 12px; text-align: right; }
.sharoshi-app .law-card-body { padding: 14px 16px; }
.sharoshi-app .law-card-body p { margin: 0 0 8px; line-height: 1.95; font-size: 15px; }
.sharoshi-app .law-card-body p:last-child { margin: 0; }
.sharoshi-app .law-card-body mark { background: rgba(15, 118, 110, 0.12); color: var(--accent-dark); padding: 0 2px; border-radius: 2px; }

/* 赤シート（用語を隠す） */
.sharoshi-app .law-list.cloze-mode mark { background: #dc2626 !important; color: transparent !important; border-radius: 3px; cursor: pointer; user-select: none; }
.sharoshi-app .law-list.cloze-mode mark.is-revealed { background: rgba(15, 118, 110, 0.12) !important; color: var(--accent-dark) !important; }


@media (max-width: 720px) {
  .sharoshi-app .law-toolbar { grid-template-columns: 1fr; }
}

/* ── 学習効果強化（復習キュー・弱点リスト・バッジ） ── */
.sharoshi-app .review-btn.has-due {
  color: #fff;
  background: linear-gradient(135deg, #d97706, #dc2626);
  border-color: transparent;
  font-weight: 800;
  animation: due-pulse 2.4s ease-in-out infinite;
}
@keyframes due-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.35); }
  50% { box-shadow: 0 0 0 6px rgba(220, 38, 38, 0); }
}
.sharoshi-app .retry-btn { color: var(--accent-dark); border-color: #9ac7c2; background: #eef8f3; font-weight: 700; }
.sharoshi-app .exam-attempt-weak {
  margin-left: 6px; padding: 1px 7px; border-radius: 6px;
  background: #fde8ea; color: #b91c1c; font-size: 11px; font-weight: 800;
}
.sharoshi-app .text-review-due {
  margin-left: 8px; padding: 1px 8px; border-radius: 6px;
  background: #fff7e6; color: #b45309; border: 1px solid #f0d9a8; font-size: 11px; font-weight: 800;
}
.sharoshi-app .weak-list { display: grid; gap: 8px; }
.sharoshi-app .weak-item {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px;
  padding: 10px 14px; text-align: left; background: var(--panel);
  border: 1px solid var(--line); border-radius: 6px; cursor: pointer;
}
.sharoshi-app .weak-item:hover { border-color: #9ac7c2; box-shadow: var(--shadow); }
.sharoshi-app .weak-subj { padding: 1px 8px; border-radius: 6px; background: #eef8f3; color: var(--accent-dark); font-size: 11px; font-weight: 800; white-space: nowrap; }
.sharoshi-app .weak-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.sharoshi-app .weak-count { color: #b91c1c; font-size: 12px; font-weight: 800; white-space: nowrap; }
.sharoshi-app .analysis-hint { margin-top: 8px; color: var(--muted); font-size: 12px; }

/* ── 自信度（メタ認知の較正） ── */
.sharoshi-app .conf-row { display: flex; align-items: center; gap: 10px; margin: 4px 0 12px; }
.sharoshi-app .conf-toggle {
  min-height: 34px; padding: 0 14px; border-radius: 6px;
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  font-weight: 700; font-size: 13px; cursor: pointer; transition: all 0.12s ease;
}
.sharoshi-app .conf-toggle:hover { border-color: #f0d9a8; }
.sharoshi-app .conf-toggle.is-on {
  color: #92400e; background: #fff7e6; border-color: #f0b429;
  box-shadow: 0 0 0 2px rgba(240, 180, 41, 0.25);
}
.sharoshi-app .conf-hint { color: var(--muted); font-size: 11px; }
.sharoshi-app .conf-compare { display: flex; gap: 14px; margin-bottom: 10px; }
.sharoshi-app .conf-cell {
  flex: 1; max-width: 220px; padding: 14px; text-align: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px;
}
.sharoshi-app .conf-rate { display: block; font-size: 26px; font-weight: 800; }
.sharoshi-app .conf-label { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.sharoshi-app .conf-sub { margin: 14px 0 8px; font-size: 14px; color: #b91c1c; }

/* ══ 暗記カード（フラッシュカード）モード ══════════════════════════ */

/* ホームカード内のミニデッキボタン（🔥 今日の暗記） */
.sharoshi-app .home-flash-decks {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.sharoshi-app .home-flash-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  cursor: pointer;
  text-align: left;
}
.sharoshi-app .home-flash-btn:hover { border-color: var(--accent); }
.sharoshi-app .home-flash-icon { font-size: 18px; flex-shrink: 0; }
.sharoshi-app .home-flash-label { flex: 1; font-weight: 700; font-size: 13px; color: var(--ink); }
.sharoshi-app .home-flash-count { font-size: 12px; font-weight: 700; color: var(--accent-dark); flex-shrink: 0; }

/* デッキ選択画面 */
.sharoshi-app .flash-deck-picker {
  max-width: 640px;
  margin: 0 auto;
  padding: 32px clamp(16px, 4vw, 24px) 48px;
}
.sharoshi-app .flash-deck-picker h2 { margin: 0 0 8px; font-size: 22px; }
.sharoshi-app .flash-deck-hint { margin: 0 0 24px; color: var(--muted); font-size: 13px; line-height: 1.8; }
.sharoshi-app .flash-deck-grid { display: grid; gap: 12px; margin-bottom: 20px; }
.sharoshi-app .flash-deck-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 18px 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 9px;
  box-shadow: var(--shadow);
  font: inherit;
  cursor: pointer;
  text-align: left;
  min-height: 64px;
}
.sharoshi-app .flash-deck-btn:hover { border-color: var(--accent); }
.sharoshi-app .flash-deck-icon { font-size: 26px; flex-shrink: 0; }
.sharoshi-app .flash-deck-name { flex: 1; font-weight: 800; font-size: 16px; color: var(--ink); }
.sharoshi-app .flash-deck-count { font-size: 12px; font-weight: 700; color: var(--accent-dark); text-align: right; white-space: nowrap; }
.sharoshi-app .flash-deck-filter {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}
.sharoshi-app .flash-deck-filter select {
  flex: 1;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font: inherit;
}

/* セッション画面 */
.sharoshi-app .flash-session {
  max-width: 640px;
  margin: 0 auto;
  padding: 20px clamp(16px, 4vw, 24px) 32px;
}
.sharoshi-app .flash-session-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.sharoshi-app .flash-exit-btn {
  flex-shrink: 0;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
}
.sharoshi-app .flash-progress {
  flex: 1;
  height: 6px;
  background: var(--line);
  border-radius: 6px;
  overflow: hidden;
}
.sharoshi-app .flash-progress-bar {
  height: 100%;
  background: var(--accent);
  transition: width 0.2s ease;
}
.sharoshi-app .flash-progress-text {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}
.sharoshi-app .flash-card {
  min-height: 320px;
}
.sharoshi-app .flash-card-face {
  display: flex;
  flex-direction: column;
  min-height: 320px;
  padding: 28px 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  cursor: pointer;
}
.sharoshi-app .flash-card-face.is-back {
  background: linear-gradient(160deg, #eef8f3 0%, var(--panel) 55%);
  cursor: default;
}
.sharoshi-app .flash-card-subject {
  margin: 0 0 16px;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-dark);
}
.sharoshi-app .flash-card-main {
  flex: 1;
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  line-height: 1.9;
  color: var(--ink);
  display: flex;
  align-items: center;
}
.sharoshi-app .flash-card-face.is-back .flash-card-main { font-size: 16px; font-weight: 400; line-height: 1.9; }
/* 裏面に残す問い。解説を読んでいる間に、何の用語だったかを見失わないため。
   主役は答えなので、問いは小さく、区切り線だけ引いて置く */
.sharoshi-app .flash-card-q {
  margin: -8px 0 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.7;
  color: var(--accent-dark);
}
.sharoshi-app .flash-card-sub {
  margin: 16px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
  line-height: 1.8;
}
.sharoshi-app .flash-card-hint {
  margin: 16px 0 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
}
.sharoshi-app .flash-rate-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
  position: sticky;
  bottom: 16px;
}
.sharoshi-app .flash-rate-btn {
  min-height: 56px;
  border: none;
  border-radius: 9px;
  font: inherit;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.sharoshi-app .flash-rate-no { background: #fee2e2; color: #991b1b; }
.sharoshi-app .flash-rate-yes { background: #d1fae5; color: #065f46; }

/* 完了画面 */
.sharoshi-app .flash-complete {
  max-width: 480px;
  margin: 0 auto;
  padding: 64px 24px;
  text-align: center;
}
.sharoshi-app .flash-complete-emoji { font-size: 48px; margin: 0 0 8px; }
.sharoshi-app .flash-complete-stats { color: var(--muted); font-size: 14px; margin: 8px 0 24px; }
.sharoshi-app .flash-complete-actions { display: flex; gap: 12px; justify-content: center; }
/* .is-hidden は .mode-panel 等の限定定義しかないため、#flashcardMode配下の内側要素向けに明示する */
#flashcardMode .is-hidden { display: none; }

/* ══ クラウド単体版パッチ ══════════════════════════
   1) 配色変数（ポータルCSSに依存しない自前定義。白黒化の修正）
   2) スマホ最適化（iPhone等 ～820px） */

:root {
  color-scheme: light;
  --ink: #1e2528; --muted: #637176; --line: #d9e1e3;
  --paper: #f8faf7; --panel: #ffffff;
  --accent: #0f766e; --accent-dark: #0b4f4a;
  --gold: #b7791f; --rose: #a23b53; --blue: #2563eb; --green: #16a34a;
  --shadow: 0 12px 28px rgba(30, 37, 40, 0.08);
}

html, body { margin: 0; padding: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Noto Sans JP", "BIZ UDPGothic", "Hiragino Kaku Gothic ProN", "Meiryo", sans-serif;
  letter-spacing: 0.02em;
}
/* 学習アプリ本体だけ、ページ自体はスクロールさせず本文だけを送る。
   この指定を html/body 全体にかけると、同じCSSを読む設定・レビュー画面まで
   スクロールできなくなる（実際にそうしてしまった） */
body.app-shell, html:has(> body.app-shell) {
  height: 100%;
  overflow: hidden;
}

/* ── スマホ最適化 ── */
@media (max-width: 820px) {
  /* 辞典：3カラム → 1カラム */
  .sharoshi-app .search-band { padding: 14px; }
  .sharoshi-app .layout { grid-template-columns: 1fr; gap: 12px; padding: 12px 14px 48px; }
  .sharoshi-app .control-block { margin-bottom: 0; }
  /* 科目フィルタ：縦積み11個は場所を取りすぎるため、横並び折り返しのチップに
     （重要度ブロック撤去で side-panel の2カラム指定が空きカラムを作っていた分も解消） */
  .sharoshi-app .stack { display: flex; flex-wrap: wrap; gap: 6px; }
  .sharoshi-app .subject-button {
    min-height: 34px; width: auto; flex: 0 0 auto;
    padding: 0 12px; font-size: 13px; border-radius: 6px;
  }
  /* 旧: max-height:300pxの内部スクロール箱にしていたため、リストの見た目の
     高さが常に一定になり、どの用語を選んでも解説が同じ位置（3件目付近）の
     下に出てしまい分かりにくかった。ページ全体で自然に縦スクロールさせ、
     選択時にJS側で解説へオートスクロールする方式に変更（app.jsのrenderDetail） */
  .sharoshi-app .detail-panel { position: static; max-height: none; padding: 16px; }

  /* 過去問：2カラム → 1カラム */
  .sharoshi-app .exam-toolbar { padding: 10px 14px; }
  .sharoshi-app .exam-filters { flex-wrap: wrap; gap: 8px; }
  .sharoshi-app .exam-layout { grid-template-columns: 1fr; gap: 12px; padding: 10px 14px 48px; }
  .sharoshi-app .exam-list-wrap { max-height: 260px; overflow-y: auto; }
  .sharoshi-app .exam-detail { position: static; max-height: none; padding: 14px; }
  .sharoshi-app .choice-btn { min-height: 52px; }

  /* 条文 */
  .sharoshi-app .law-count, .sharoshi-app .law-list { padding-left: 14px; padding-right: 14px; }
  .sharoshi-app .law-card-head { flex-direction: column; align-items: flex-start; gap: 4px; }
  .sharoshi-app .law-card-sub { text-align: left; }

  /* 学習分析 */
  .sharoshi-app .analysis-cards { grid-template-columns: repeat(2, 1fr); }
  .sharoshi-app .conf-compare { flex-direction: column; }
  .sharoshi-app .conf-cell { max-width: none; }

  /* タップしやすく */
  .sharoshi-app button, .sharoshi-app select { min-height: 40px; }
  .sharoshi-app .chip { min-height: 38px; }
}

/* 過去問を1カラムにする条件（過去問だけ。辞典などの1カラム化は 720px のまま）。
   720px までだったが、iPad 縦（834px）では 2カラムのまま残り、左メニュー110px＋一覧340px を
   引いた解答パネルが 271px しかなく、設問文が12文字ごとに折り返す柱になっていた（実機の指摘）。
   1000px 以下と、幅にかかわらずタッチ端末（パネル内スクロールだと Safari のツールバーが
   畳まれない）は1カラムにし、一覧は上の低い箱、本文は文書スクロールで読ませる */
@media (max-width: 1000px), (hover: none) and (pointer: coarse) {
  .sharoshi-app .exam-layout {
    grid-template-columns: 1fr;
    gap: 12px;
    height: auto;
    max-height: none;
    padding: 10px 14px 48px;
  }
  .sharoshi-app .exam-list-wrap {
    height: auto;
    max-height: 260px;
    overflow-y: auto;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  .sharoshi-app .exam-detail {
    position: static;
    overflow: visible;
    height: auto;
    max-height: none;
    padding: 14px;
  }
}

/* ══ スマホ最適化 第2弾（ボタン折返し・表の崩れ対策） ══ */
@media (max-width: 820px) {
  /* 操作系の小ボタンだけ1行厳守（本文を持つボタンには適用しない） */
  .sharoshi-app .exam-action-btn, .sharoshi-app .weak-toggle,
  .sharoshi-app .conf-toggle, .sharoshi-app .exam-nav-btn,
  .sharoshi-app .review-btn, .sharoshi-app .chip,
  .sharoshi-app .law-subj-chip { white-space: nowrap; }
  /* 本文入りボタン（選択肢・問題カード・用語カード等）は必ず折り返す */
  .sharoshi-app .choice-btn, .sharoshi-app .term-card,
  .sharoshi-app #examList button, .sharoshi-app #examList > *,
  .sharoshi-app .weak-item, .sharoshi-app .related button,
  .sharoshi-app .subject-button { white-space: normal; text-align: left; }
  .sharoshi-app .choice-btn { font-size: 14px; line-height: 1.7; }
  .sharoshi-app .exam-filters select,
  .sharoshi-app .exam-action-btn,
  .sharoshi-app .weak-toggle { font-size: 12px; min-height: 36px; padding: 0 10px; }
  .sharoshi-app .weak-toggle { white-space: nowrap; }
  .sharoshi-app .review-btn { font-size: 12px; }

  /* 問題ナビ（前へ/もう一度/次へ）を1行3分割 */
  .sharoshi-app .exam-nav { display: flex; gap: 6px; }
  .sharoshi-app .exam-nav-btn { flex: 1; min-width: 0; font-size: 12px; padding: 8px 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  /* 補足ヒントなど、なくても困らない文言は隠す/縮小 */
  .sharoshi-app .conf-hint { display: none; }
  .sharoshi-app .law-hint { font-size: 11px; }
  .sharoshi-app .conf-toggle { font-size: 12px; min-height: 32px; }

  /* 辞典詳細・解説内のボタン群（深掘り/法改正チェック等）を小さく */
  .sharoshi-app .detail-panel button,
  .sharoshi-app .deep-dive button { font-size: 12px; min-height: 34px; padding: 0 10px; }
  .sharoshi-app .search-actions .ghost-button { font-size: 13px; min-height: 38px; }

  /* 表は「小さめの字＋横スクロール」で崩さない（辞典の深掘り・過去問解説・条文） */
  .sharoshi-app .detail-panel table,
  .sharoshi-app .exam-explanation table,
  .sharoshi-app .law-card-body table {
    display: block; max-width: 100%; overflow-x: auto;
    -webkit-overflow-scrolling: touch; font-size: 12px;
  }
  .sharoshi-app .detail-panel th, .sharoshi-app .detail-panel td,
  .sharoshi-app .exam-explanation th, .sharoshi-app .exam-explanation td { padding: 4px 8px; }

  /* 詳細ヘッダの折返し調整 */
  .sharoshi-app .detail-title { flex-wrap: wrap; gap: 8px; }
  .sharoshi-app .exam-detail-meta { flex-wrap: wrap; gap: 4px; }
  .sharoshi-app .exam-tag { font-size: 11px; }
}

/* ═══════════════════════════════════════════════════════
   相談モード（記述式ノベル）
   ここだけアプリ全体のライトテーマから外れ、暗いノベル画面にする。
   立ち絵は背景透過WebP。吹き出しは半透明で立ち絵に重なる（重なって透けるのが要件）。
   スタイルは #novelMode 配下に閉じてあり、他モードには影響しない。
   ═══════════════════════════════════════════════════════ */

#novelMode { --nv-ink: #eef1f6; --nv-dim: #9aa5b8; --nv-line: rgba(255, 255, 255, 0.16); }

.novel-stage {
  position: relative;
  /* 高さは novelFitStage() が実測して --nv-stage-h に入れる。
     ヘッダーの高さが画面幅で変わるため、固定の引き算では下に余白が残る。
     変数が入る前の初期値としてのみ calc を使う */
  height: var(--nv-stage-h, calc(100dvh - 120px));
  min-height: 420px;
  border-radius: 10px;
  overflow: hidden;
  background:
    radial-gradient(120% 85% at 28% 12%, #2f3a4e 0%, #1a1f2b 55%, #0c0f16 100%);
  box-shadow: inset 0 0 90px rgba(0, 0, 0, 0.55);
}

/* 立ち絵。ステージいっぱいに置き、吹き出しはこの上に重ねる */
.novel-chara {
  position: absolute; inset: 0; display: flex; pointer-events: none;
  justify-content: center; align-items: flex-start;
}
.novel-chara img {
  height: 100%; width: auto; max-width: 100%; object-fit: contain; object-position: top center;
  filter: drop-shadow(0 18px 40px rgba(0, 0, 0, 0.55));
  transition: opacity 0.18s ease;
}

/* 上部HUD（論点・信頼度）。枠外に出さずステージ内に重ねる */
.novel-hud {
  position: absolute; top: 0; left: 0; right: 0; z-index: 3;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px;
  background: linear-gradient(rgba(8, 10, 15, 0.75), rgba(8, 10, 15, 0));
}
.novel-hud select {
  padding: 5px 9px; font: inherit; font-size: 12px;
  color: var(--nv-ink); background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--nv-line); border-radius: 6px;
}
.novel-hud select option { color: #1e2528; }
.novel-hud .exam-action-btn {
  color: var(--nv-ink); background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--nv-line); font-size: 12px; padding: 5px 12px;
}
/* 実力メーター。80の位置に合格ラインの目盛りを刻む */
.novel-prof { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.novel-prof-label { font-size: 11px; color: var(--nv-dim); letter-spacing: 0.08em; }
.novel-prof-num { font-size: 12px; color: var(--nv-dim); white-space: nowrap; }
.novel-prof-num b { font-size: 17px; font-weight: 800; color: var(--nv-ink); }
.novel-prof-bar {
  position: relative; display: block; width: 96px; height: 7px;
  border-radius: 6px; background: rgba(255, 255, 255, 0.18); overflow: hidden;
}
.novel-prof-bar::after {          /* 合格ライン 80 の目盛り */
  content: ""; position: absolute; left: 80%; top: -1px; bottom: -1px;
  width: 2px; background: rgba(255, 255, 255, 0.75);
}
.novel-prof-bar > i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, #6b8cd8, #8fb4ff);
  transition: width 0.5s ease;
}
.novel-prof-bar > i.is-pass { background: linear-gradient(90deg, #2e9e63, #4ade80); }
.novel-prof-note { font-size: 11px; color: var(--nv-dim); white-space: nowrap; }
.novel-prof-note.is-pass { color: #8ff0bd; font-weight: 700; }

.novel-verdict {
  margin-left: 8px; font-size: 12px; font-weight: 700; color: #ffb3c0;
  background: rgba(122, 31, 47, 0.3); border: 1px solid rgba(231, 76, 106, 0.4);
  padding: 3px 10px; border-radius: 6px;
}
.novel-verdict.is-pass {
  color: #8ff0bd; background: rgba(31, 122, 77, 0.3); border-color: rgba(46, 204, 113, 0.4);
}

/* 本文。立ち絵の上に重なってスクロールする */
.novel-body {
  position: absolute; inset: 0; z-index: 2;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  display: flex; flex-direction: column; gap: 11px;
  padding: 52px 12px 14px;
  scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}
.novel-body::-webkit-scrollbar { width: 7px; }
.novel-body::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.22); border-radius: 99px; }

/* 吹き出し。半透明＋ぼかしで、下の立ち絵が透けて見える */
.novel-card {
  background: rgba(12, 15, 22, 0.74);
  -webkit-backdrop-filter: blur(7px) saturate(1.1);
  backdrop-filter: blur(7px) saturate(1.1);
  border: 1px solid var(--nv-line);
  border-radius: 13px; padding: 13px 15px;
  color: var(--nv-ink); line-height: 1.85; font-size: 15px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.35);
}
.novel-card h4 { margin: 0 0 6px; font-size: 12px; color: var(--nv-dim); letter-spacing: 0.08em; }
.novel-card p { margin: 0 0 6px; }
.novel-card p:last-child { margin-bottom: 0; }

.novel-say { border-left: 3px solid #8fb4ff; }
.novel-client { border-left: 3px solid #ffc46b; }
/* お野菜さんの相談（選択式） */
.novel-stage.is-pop .novel-chara, .novel-stage.is-pop .novel-chara-name { display: none; }
/* 暗いステージではなす子など色の濃いお野菜さんが沈むので、明るい丸を敷く */
#novelMode .pop-say-veg { background: radial-gradient(circle, #fff7df 0%, #f3e6c4 70%); border-radius: 50%; padding: 4px; box-sizing: border-box; width: 52px; height: 52px; }
/* 立ち絵が無いので、立ち絵ぶんの余白も取らず上から並べる。PCは中央寄せで幅いっぱい使う */
@media (max-width: 819px) {
  .novel-stage.is-pop .novel-body { padding-top: 84px; }
  .novel-stage.is-pop .novel-body > :first-child { margin-top: 0; }
}
@media (min-width: 820px) {
  .novel-stage.is-pop .novel-body { width: min(760px, 100%); margin: 0 auto; }
}
.novel-popq-scene summary, .novel-popq-model summary { cursor: pointer; font-size: 13px; color: var(--nv-dim); }
.novel-popq-scene p, .novel-popq-model p { font-size: 14px; margin-top: 6px !important; }
.novel-popq-no { display: inline-block; font-size: 12px; font-weight: 800; color: #ffc46b; margin-bottom: 6px; letter-spacing: 0.06em; }
.novel-popq-choices { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 6px; }
.novel-popq-choice {
  text-align: left; font: inherit; font-size: 15px; line-height: 1.6; padding: 11px 14px;
  border-radius: 12px; border: 2px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08); color: var(--nv-ink); cursor: pointer;
  transition: transform .12s ease, background .12s ease;
}
.novel-popq-choice:hover:not(:disabled) { background: rgba(255, 255, 255, 0.16); transform: translateY(-1px); }
.novel-popq-choice:disabled { cursor: default; opacity: 0.55; }
.novel-popq-choice.is-right { opacity: 1; border-color: #6fe3a0; background: rgba(111, 227, 160, 0.18); }
.novel-popq-choice.is-right::before { content: "⭕ "; }
.novel-popq-choice.is-wrong { opacity: 1; border-color: #ff8a8a; background: rgba(255, 138, 138, 0.16); }
.novel-popq-choice.is-wrong::before { content: "✖ "; }
.novel-popq-reply:empty { display: none; }
.novel-popq-helpbtn {
  margin: 2px 0 4px; font: inherit; font-size: 13px; padding: 6px 12px; border-radius: 99px;
  border: 1px dashed rgba(255, 255, 255, 0.35); background: transparent; color: var(--nv-dim); cursor: pointer;
}
.novel-popq-helpbtn:hover { color: var(--nv-ink); border-color: rgba(255, 255, 255, 0.6); }
.novel-popq-help { margin-top: 8px; }
.novel-popq-terms { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.novel-popq-term { background: rgba(255, 255, 255, 0.06); border-radius: 9px; padding: 7px 11px; }
.novel-popq-term summary { cursor: pointer; font-size: 13px; color: #ffd9a0; }
.novel-popq-term p { font-size: 13px; margin: 6px 0 !important; }
.novel-popq-reply { margin-top: 8px; }
.novel-popq-score { font-size: 15px; margin-bottom: 10px !important; }
.novel-popq-score b { font-size: 34px; color: #ffd36b; margin-right: 2px; }
.novel-popq-end .hero-note { color: #1f2a44; }

/* 採点のあとの「先輩と話す」 */
.novel-talk { border-left: 3px solid #8fe0b4; }
.novel-talk-lead { color: var(--nv-dim); font-size: 13px; }
.novel-talk-log { display: flex; flex-direction: column; gap: 8px; margin: 8px 0; }
.novel-talk-log:empty { display: none; }
.novel-talk-line { padding: 8px 11px; border-radius: 11px; max-width: 92%; }
.novel-talk-line p { margin: 0; }
.novel-talk-line.is-senpai { background: rgba(143, 180, 255, 0.12); align-self: flex-start; }
.novel-talk-line.is-me { background: rgba(143, 224, 180, 0.14); align-self: flex-end; }
.novel-talk-line.is-me .novel-who { color: #8fe0b4; }
.novel-talk-form { display: flex; flex-direction: column; gap: 6px; }
.novel-talk-form textarea {
  width: 100%; box-sizing: border-box; font: inherit; font-size: 16px; line-height: 1.6;
  padding: 8px 10px; border-radius: 9px; border: 1px solid var(--nv-line);
  background: rgba(255, 255, 255, 0.06); color: var(--nv-ink); resize: vertical;
}
.novel-talk-form button { align-self: flex-end; }
.novel-talk-progress { font-size: 12px; color: var(--nv-dim); margin-top: 6px !important; }
.novel-talk-progress:empty { display: none; }
.novel-who { display: block; font-size: 12px; font-weight: 700; margin-bottom: 6px; color: #8fb4ff; }
.novel-client .novel-who { color: #ffc46b; }
.novel-ask { font-weight: 700; margin-top: 9px !important; color: #fff; }

.novel-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.novel-tag {
  font-size: 11px; color: var(--nv-dim);
  background: rgba(255, 255, 255, 0.08); border: 1px solid var(--nv-line);
  border-radius: 6px; padding: 2px 9px;
}
.novel-tag--done { color: #8ff0bd; border-color: rgba(46, 204, 113, 0.4); }

.novel-body textarea {
  box-sizing: border-box; width: 100%; resize: vertical;
  font: inherit; font-size: 16px; line-height: 1.8; padding: 11px;
  color: var(--nv-ink); background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--nv-line); border-radius: 8px;
}
.novel-body textarea::placeholder { color: rgba(238, 241, 246, 0.4); }
.novel-body textarea:focus { outline: 2px solid rgba(143, 180, 255, 0.5); border-color: #8fb4ff; }

.novel-actions { display: flex; align-items: center; gap: 12px; margin-top: 10px; flex-wrap: wrap; }
.novel-submit {
  background: #3f6fd8; color: #fff; border: 0; border-radius: 7px;
  padding: 10px 22px; font: inherit; font-weight: 700; cursor: pointer;
}
.novel-submit:hover { background: #3560c4; }
.novel-submit:disabled { background: rgba(255, 255, 255, 0.2); cursor: default; }
.novel-status { font-size: 13px; color: var(--nv-dim); }
.novel-nav { display: flex; gap: 10px; flex-wrap: wrap; background: rgba(12, 15, 22, 0.6); }
.novel-nav .exam-action-btn {
  color: var(--nv-ink); background: rgba(255, 255, 255, 0.12); border: 1px solid var(--nv-line);
}

.novel-score { display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.novel-score b { font-size: 30px; font-weight: 800; line-height: 1; color: #fff; }
.novel-score span { font-size: 13px; color: var(--nv-dim); }

.novel-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.novel-chip { font-size: 12px; border-radius: 6px; padding: 3px 10px; line-height: 1.6; }
.novel-chip--ok { background: rgba(31, 122, 77, 0.35); border: 1px solid rgba(46, 204, 113, 0.4); color: #8ff0bd; }
.novel-chip--ng { background: rgba(122, 31, 47, 0.35); border: 1px solid rgba(231, 76, 106, 0.4); color: #ffb3c0; }

.novel-wrong { margin-top: 10px !important; font-size: 13px; color: #ffb3c0; }
.novel-law { margin-top: 12px !important; font-size: 13px; color: var(--nv-dim); }
.novel-source { font-size: 12px; color: var(--nv-dim); margin-top: 8px !important; }
.novel-error { border-color: rgba(231, 76, 106, 0.6); color: #ffb3c0; }
#novelMode .empty-state { color: var(--nv-dim); text-align: center; padding: 40px 0; }

/* スマホ: 立ち絵は上、吹き出しは下から重なる */
@media (max-width: 819px) {
  /* 吹き出しは下寄せにしたいが、justify-content:flex-end だと内容が溢れたとき
     先頭カードがスクロール範囲の外に出て戻れなくなる。先頭に margin-top:auto を
     付ける方式なら、短いときは下寄せ・長いときは通常のスクロールになる */
  .novel-body { padding-top: clamp(150px, 30vh, 280px); }
  .novel-body > :first-child { margin-top: auto; }
  .novel-chara img { height: 62%; }
  /* HUDが3段に折り返すと立ち絵の見える面積を食うので、狭い画面では詰める */
  /* HUDの折り返しを減らす。論点名が長いのでセレクトに上限を付ける */
  .novel-hud { padding: 8px 10px; gap: 7px; }
  /* 3要素は375pxに1行では収まらないので2段になる。立ち絵の頭上の余白に重なるだけなので許容 */
  .novel-hud select { max-width: 132px; }
  .novel-prof { gap: 6px; }
  .novel-prof-label { display: none; }
  .novel-prof-num span { display: none; }
  .novel-prof-bar { width: 58px; }
  .novel-prof-note { font-size: 10px; }
}

/* PC: 立ち絵は右、吹き出しは左寄せ。重なった部分は透けて見える */
@media (min-width: 820px) {
  .novel-chara { justify-content: flex-end; align-items: flex-end; padding-right: 2%; }
  .novel-chara img { height: 96%; object-position: bottom center; }
  /* 立ち絵の左端に少しかぶる幅にする。半透明なので重なった部分は透けて見える */
  .novel-body { padding: 56px 18px 18px; width: min(880px, 72%); }
}

/* 相談モード: 章へのリンク（アウトプット→インプットの戻り導線） */
.novel-tag--text {
  color: #ffd9a0; border-color: rgba(255, 196, 107, 0.4);
  background: rgba(255, 196, 107, 0.12); text-decoration: none;
}
.novel-tag--text:hover { background: rgba(255, 196, 107, 0.22); }
.novel-back-to-text { text-decoration: none; display: inline-flex; align-items: center; }

/* 相談モード: 担当キャラクター名（科目が変わったことが分かるように） */
.novel-chara-name {
  font-size: 12px; font-weight: 700; color: #8fb4ff; white-space: nowrap;
  background: rgba(143, 180, 255, 0.12); border: 1px solid rgba(143, 180, 255, 0.3);
  padding: 3px 10px; border-radius: 6px;
}
@media (max-width: 819px) { .novel-chara-name { display: none; } }

/* 相談モード: 紐づいた条文へのリンク */
.novel-articles { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.novel-article {
  font: inherit; font-size: 12px; font-weight: 700; cursor: pointer;
  color: #c9b6ff; background: rgba(150, 120, 255, 0.14);
  border: 1px solid rgba(150, 120, 255, 0.38); border-radius: 6px;
  padding: 3px 11px; white-space: nowrap;
}
.novel-article:hover { background: rgba(150, 120, 255, 0.26); }

/* 相談モード: 設問ピッカー（科目 → 章 → 設問） */
.novel-picker {
  position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column;
  background: rgba(8, 10, 15, 0.94);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.novel-picker.is-hidden { display: none; }
.novel-picker-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 14px; border-bottom: 1px solid var(--nv-line); color: var(--nv-ink);
}
.novel-picker-head strong { font-size: 14px; }
.novel-picker-filter { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--nv-dim); }
.novel-picker-head .exam-action-btn {
  margin-left: auto; color: var(--nv-ink);
  background: rgba(255, 255, 255, 0.12); border: 1px solid var(--nv-line);
}
.novel-picker-body { flex: 1; overflow-y: auto; padding: 10px 14px 16px; }

.novel-pick-subject { margin-bottom: 14px; }
.novel-pick-subject h4 {
  margin: 0 0 8px; font-size: 13px; color: #8fb4ff; display: flex; align-items: center; gap: 8px;
}
.novel-pick-n {
  font-size: 11px; font-weight: 700; color: var(--nv-dim);
  background: rgba(255, 255, 255, 0.1); border-radius: 6px; padding: 1px 8px;
}
.novel-pick-chapter { border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.novel-pick-chapter > summary {
  cursor: pointer; padding: 9px 4px; font-size: 13px; color: var(--nv-ink);
  display: flex; align-items: center; gap: 8px; list-style: none;
}
.novel-pick-chapter > summary::-webkit-details-marker { display: none; }
.novel-pick-chapter > summary::before { content: "▸"; color: var(--nv-dim); }
.novel-pick-chapter[open] > summary::before { content: "▾"; }
.novel-pick-chapter ul { list-style: none; margin: 0 0 8px; padding: 0 0 0 16px; }
.novel-pick-item {
  display: flex; align-items: flex-start; gap: 10px; width: 100%; text-align: left;
  font: inherit; font-size: 13px; line-height: 1.6; cursor: pointer;
  color: var(--nv-ink); background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 7px;
  padding: 8px 11px; margin-bottom: 6px;
}
.novel-pick-item:hover { background: rgba(143, 180, 255, 0.16); border-color: rgba(143, 180, 255, 0.4); }
.novel-pick-ask { flex: 1; min-width: 0; }
.novel-pick-badge {
  flex-shrink: 0; font-size: 11px; font-weight: 700; white-space: nowrap;
  color: var(--nv-dim); background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--nv-line); border-radius: 6px; padding: 2px 9px;
}
.novel-pick-badge.is-pass { color: #8ff0bd; border-color: rgba(46, 204, 113, 0.4); background: rgba(31, 122, 77, 0.28); }

/* 前回との比較 */
.novel-delta {
  margin-left: 8px; font-size: 12px; font-weight: 700; color: var(--nv-dim);
  background: rgba(255, 255, 255, 0.08); border: 1px solid var(--nv-line);
  border-radius: 6px; padding: 3px 10px;
}
.novel-delta.is-up { color: #8ff0bd; border-color: rgba(46, 204, 113, 0.4); background: rgba(31, 122, 77, 0.28); }
.novel-delta.is-down { color: #ffb3c0; border-color: rgba(231, 76, 106, 0.4); background: rgba(122, 31, 47, 0.28); }
.novel-prev { margin-top: 10px; font-size: 13px; }
.novel-prev > summary { cursor: pointer; color: var(--nv-dim); font-size: 12px; }
.novel-prev > p { margin: 8px 0 0; padding: 9px 11px; line-height: 1.8;
  background: rgba(255, 255, 255, 0.06); border-radius: 7px; color: var(--nv-dim); }

/* ピッカーの絞り込みタブと章クリア表示 */
.novel-picker-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.novel-filter {
  font: inherit; font-size: 12px; cursor: pointer; white-space: nowrap;
  color: var(--nv-dim); background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--nv-line); border-radius: 6px; padding: 4px 12px;
}
.novel-filter:hover { background: rgba(255, 255, 255, 0.14); }
.novel-filter.is-active { color: #0b1220; background: #8fb4ff; border-color: #8fb4ff; font-weight: 700; }
.novel-pick-clear {
  margin-left: auto; font-size: 11px; font-weight: 700; color: var(--nv-dim);
  background: rgba(255, 255, 255, 0.08); border: 1px solid var(--nv-line);
  border-radius: 6px; padding: 1px 9px; white-space: nowrap;
}
.novel-pick-clear.is-done { color: #8ff0bd; border-color: rgba(46, 204, 113, 0.45); background: rgba(31, 122, 77, 0.3); }

/* 結果画面: 次に直すこと / 内訳の折りたたみ */
.novel-todo {
  margin: 4px 0 12px; padding: 11px 14px; border-radius: 8px;
  background: rgba(255, 196, 107, 0.1); border: 1px solid rgba(255, 196, 107, 0.32);
}
.novel-todo h4 { margin: 0 0 6px; font-size: 12px; color: #ffd9a0; letter-spacing: 0.06em; }
.novel-todo ol { margin: 0; padding-left: 1.3em; line-height: 1.85; }
.novel-todo li { margin-bottom: 2px; }
.novel-todo-more { margin: 6px 0 0 !important; font-size: 12px; color: var(--nv-dim); }
.novel-chips-wrap > summary { cursor: pointer; font-size: 12px; color: var(--nv-dim); margin-bottom: 8px; }
.novel-verdict.is-near { color: #ffd9a0; background: rgba(255, 196, 107, 0.16); border-color: rgba(255, 196, 107, 0.4); }
.novel-verdict.is-low { color: #ffb3c0; }

/* モバイル: HUDを2段にして実力メーターを独立させる */
@media (max-width: 819px) {
  .novel-hud { flex-wrap: wrap; }
  .novel-prof { margin-left: 0; width: 100%; justify-content: flex-end; }
  .novel-picker-head { gap: 8px; }
  .novel-picker-filters { order: 3; width: 100%; }
  .novel-picker-head .exam-action-btn { margin-left: auto; }
}

/* 条文タブに出す「相談に戻る」。.nav-back-bar の帯に緑の色味を足しただけ。
   パネルの中にあるので sticky にはしない（外の「ホームにもどる」帯と重なる） */
.sharoshi-app .novel-law-back {
  position: static; gap: 12px;
  background: #eef8f3; border-bottom: 1px solid #b9dbd6;
}
.sharoshi-app .novel-law-back .nav-back { color: var(--accent-dark); border-color: #9ac7c2; }
.sharoshi-app .novel-law-back .nav-back:hover { background: #f6fbf9; border-color: var(--accent); }
.novel-law-back-note { font-size: 12px; color: var(--muted); min-width: 0; }
@media (max-width: 640px) { .novel-law-back-note { display: none; } }

/* 章リンクはボタンだが見た目はタグに揃える */
button.novel-tag--text { cursor: pointer; font: inherit; font-size: 11px; }
button.novel-back-to-text { cursor: pointer; }

/* ホーム: 今日の相談3件（ライトテーマ側なのでアプリ標準の配色に合わせる） */
.home-consult-progress {
  font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap;
  background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 3px 11px;
}
.home-consult-progress.is-done { color: var(--accent-dark); border-color: rgba(15, 118, 110, 0.4); background: rgba(15, 118, 110, 0.1); }
.home-consult-clear {
  margin: 0 0 10px; font-size: 13px; font-weight: 700; color: var(--accent-dark);
  background: rgba(15, 118, 110, 0.08); border: 1px solid rgba(15, 118, 110, 0.28);
  border-radius: 7px; padding: 9px 12px;
}
.home-consult-item {
  display: block; width: 100%; text-align: left; cursor: pointer; font: inherit;
  background: var(--paper); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 13px; margin-bottom: 8px;
}
.home-consult-item:hover { border-color: var(--accent); background: #fff; }
.home-consult-item.is-done { opacity: 0.55; }
.home-consult-item.is-done .home-consult-ask { text-decoration: line-through; }
.home-consult-ask { display: block; font-size: 14px; line-height: 1.7; color: var(--ink); }
.home-consult-meta { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); }

/* 担当者の切り替え（科目ごと／1人に固定） */
.novel-cast-toggle {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--nv-dim); white-space: nowrap;
}
.novel-cast-toggle select {
  padding: 4px 8px; font: inherit; font-size: 12px;
  color: var(--nv-ink); background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--nv-line); border-radius: 6px;
}
.novel-cast-toggle select option { color: #1e2528; }
@media (max-width: 819px) { .novel-cast-toggle { order: 2; } }

/* ── 音声読み上げ ─────────────────────────────────────
   HUDのトグルが点いているあいだ、相談と台詞を自動で読む。
   各吹き出しの ▶ で聞き直せる（読み上げ中は ■ になり、押すと止まる） */
.novel-hud .exam-action-btn.is-on {
  background: rgba(143, 180, 255, 0.22);
  border-color: #8fb4ff;
  color: #fff;
}
.novel-hud .exam-action-btn.is-speaking { animation: novel-tts-pulse 1.2s ease-in-out infinite; }
@keyframes novel-tts-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(143, 180, 255, 0.45); }
  50% { box-shadow: 0 0 0 5px rgba(143, 180, 255, 0); }
}
.novel-say-btn {
  margin-left: 8px; padding: 0 7px;
  font: inherit; font-size: 11px; line-height: 18px;
  color: inherit; background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--nv-line); border-radius: 4px;
  cursor: pointer; vertical-align: middle;
}
.novel-say-btn:hover { background: rgba(255, 255, 255, 0.2); }
.novel-card.is-speaking .novel-say-btn { background: #8fb4ff; border-color: #8fb4ff; color: #0b1020; }
.novel-client.is-speaking .novel-say-btn { background: #ffc46b; border-color: #ffc46b; color: #0b1020; }
.novel-voice-pick select { max-width: 150px; }
.novel-voice-pick.is-unavailable { opacity: 0.55; }

/* ═══════════════════════════════════════════════════════
   ホーム（作り替え）
   主役は「今日やること」。空の項目はカードごと出さない。
   幅は他モード（テキスト・条文）と同じ 1280px に揃える。画面いっぱいにしない。
   ═══════════════════════════════════════════════════════ */

/* is-hidden はクラス（詳細度10）なので、#homeMode（100）で display を指定すると勝ってしまい、
   他タブでもホームが出たままになる。レイアウトはクラス側に置き、ID指定を使わない。 */
.sharoshi-app .home-wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: clamp(16px, 4vw, 48px);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.sharoshi-app .home-card { border-radius: 10px; padding: 18px 20px; }
.sharoshi-app .home-card.is-hidden { display: none; }
.sharoshi-app .home-card h2 { margin: 0; font-size: 15px; letter-spacing: .02em; }

/* タッチ端末では最初から常にページ（body）自体をスクロールさせる。
   アプリのシェルは height:100dvh + overflow:hidden で内側の main だけを送るため、
   iOS Safari は「ページをスクロールしていない」と判断して下部バーを縮めず、
   章ページ（独立ページ＝bodyスクロール）に対しアプリ側だけがバーの上で
   明確に途切れて見えた。
   当初はモード切替時にクラスで body スクロールへ切り替えていたが、実機での
   検証で「Safariはページ読み込み時にスクロールの主体を決め、途中の切替には
   描画が追随しない」ことが判明（起動時から文書スクロールのモードだけが
   バーに透け、後から切り替えたモードは不透明な灰色のまま。?mode=law の
   直接起動なら条文でも透けることで確定）。そのため切替をやめ、常時こちらにする。
   ・固定シェル前提だった3モードは、パネル側をビューポート基準で画面高に
   　合わせる（相談は元からvisualViewport基準。マップ・過去問の fitPaneHeight は
   　bodyがスクロールする環境では innerHeight を使うよう変更済み）。
   　文書がほぼ画面高に収まるため、これまでどおりバーは開いたままになるだけ
   ・この幅ではサイドメニューが position:fixed のドロワーになっているため、
   　シェルの高さを解除してもメニューの位置は変わらない */
/* タッチ端末（iPhone・iPad）は幅に関係なく文書スクロールにする。
   iPad（744～1180px）はこのブロックが 640px 限定だったころは固定シェルのままで、
   内側の main だけがスクロールしていたため、Safari が「ページをスクロールしていない」と
   判断して上部のアドレスバーを縮めなかった（実機で確定）。
   幅ではなく (hover: none) and (pointer: coarse) で分けるのは、デスクトップの
   広いウィンドウ（バーの伸縮がない）を巻き込まないため */
@media (max-width: 640px), (hover: none) and (pointer: coarse) {
  body.app-shell,
  html:has(> body.app-shell) { height: auto; overflow: visible; }
  body.app-shell .sharoshi-app { height: auto; min-height: 100dvh; overflow: visible; }
  body.app-shell .shell { overflow: visible; }
  body.app-shell main { overflow-y: visible; overscroll-behavior: auto; }
  /* 章ページのヘッダーと同じく、スクロールしても操作できるよう貼り付ける
     （流れると☰でメニューを開けなくなる） */
  body.app-shell .topbar { position: sticky; top: 0; z-index: 20; }
}

/* iPadのようにメニューが常設の列のまま文書スクロールになる幅では、
   高さの拘束を外すとメニューが本文と一緒に流れて画面外へ消える。
   sticky で貼り付ける（fixed は使わない—— pinToViewport のコメント参照） */
@media (hover: none) and (pointer: coarse) and (min-width: 821px) {
  body.app-shell .sharoshi-app .sidenav {
    position: sticky;
    top: 0;
    align-self: start;
    height: 100dvh;
  }
}

@media (max-width: 640px) {
  /* 章ページは本文が文書の末尾まで詰まっていて（余白0）、半透明の下部バー越しに
     うっすら透ける。下に余白があるとちょうどバーの位置に無地の帯が出て
     「灰色で区切られている」ように見えるため、下余白を落としてそろえる。
     いちばん下に来る入れ物はモードごとに別物なので個別に挙げる */
  body.app-shell .home-wrap,        /* ホーム */
  body.app-shell .text-accordion,   /* テキスト */
  body.app-shell .law-list,         /* 条文 */
  body.app-shell .layout,           /* 辞典 */
  body.app-shell .flash-deck-picker /* 暗記カード */ { padding-bottom: 0; }
  body.app-shell .mode-panel > :last-child { margin-bottom: 0; }
}

/* 単調さの解消：カードごとに色の役割を変える。
   今日やること＝行動（アクセント色の帯）、実力＝計測（落ち着いた紺）、分析＝補助（地色） */
.sharoshi-app .home-today {
  background: linear-gradient(180deg, #f4fbf8 0%, #ffffff 120px);
  border: 1px solid rgba(15, 118, 110, .28);
  box-shadow: 0 10px 24px rgba(15, 118, 110, .07);
}
.sharoshi-app .home-today > .analysis-head h2 { color: var(--accent-dark); }
.sharoshi-app .home-prof {
  background: linear-gradient(180deg, #f5f7fb 0%, #ffffff 120px);
  border: 1px solid #ccd6e6;
}
.sharoshi-app .home-prof > .analysis-head h2 { color: #33456b; }

/* ホームのひとこと（担当キャラが毎日出迎える） */
/* ═══════════════════════════════════════════════════════
   ナビゲーター（佐藤 律）
   以前は 72px の顔写真を横帯に並べただけで、「アイコン付きの通知」にしか
   見えなかった。相談モードの立ち絵を知っている目には、同じ人物が縮尺だけ
   変わって出てくるのは弱い。ここでは相談よりひとまわり小さい立ち絵を
   台座から浮かび上がらせ、吹き出しで話させる。
   ・立ち絵は下端そろえ。台座（パネル）から生えているように見せる
   ・背後に淡い光を置く。暗い地に暗い服が沈むのを防ぐ意味もある
   ═══════════════════════════════════════════════════════ */
.sharoshi-app .plan-hero {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: end;
  gap: clamp(6px, 1.6vw, 22px);
  padding: 16px clamp(16px, 2.4vw, 26px) 0 clamp(6px, 1.4vw, 16px);
  border-radius: 14px;
  overflow: hidden;
  background: radial-gradient(125% 135% at 16% 100%, #2c3f55 0%, #1e2937 52%, #151d28 100%);
  box-shadow: 0 14px 34px rgba(18, 24, 36, 0.22);
  animation: plan-hero-rise 0.42s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}
.sharoshi-app .plan-hero.is-hidden { display: none; }
@keyframes plan-hero-rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
/* 立ち絵の後ろの光。立ち絵より下のレイヤーに置く */
.sharoshi-app .plan-hero-glow {
  position: absolute;
  left: -4%;
  bottom: -22%;
  width: min(48%, 360px);
  aspect-ratio: 1;
  pointer-events: none;
  background: radial-gradient(closest-side, rgba(94, 214, 197, 0.26), rgba(94, 214, 197, 0) 72%);
}
.sharoshi-app .plan-hero-chara {
  position: relative;
  z-index: 1;
  align-self: end;
  height: clamp(196px, 27vw, 312px); /* 相談モードの立ち絵（約400px）よりひとまわり小さい */
  width: auto;
  object-fit: contain;
  object-position: bottom center;
  filter: drop-shadow(0 16px 30px rgba(0, 0, 0, 0.5));
  animation: plan-hero-float 6.5s ease-in-out infinite;
}
@keyframes plan-hero-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.sharoshi-app .plan-hero-talk {
  position: relative;
  z-index: 2;
  align-self: center;
  min-width: 0;
  padding-bottom: 18px;
}
/* 吹き出し。立ち絵に向かってしっぽを出す */
.sharoshi-app .plan-hero-bubble {
  position: relative;
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 10px 26px rgba(8, 12, 20, 0.34);
}
.sharoshi-app .plan-hero-bubble::before {
  content: "";
  position: absolute;
  left: -9px;
  top: 24px;
  border: 9px solid transparent;
  border-left: 0;
  border-right-color: rgba(255, 255, 255, 0.95);
}
.sharoshi-app .plan-hero-line {
  font-size: 14.5px;
  line-height: 1.85;
  font-weight: 700;
  color: #16202b;
}
.sharoshi-app .plan-hero-sub {
  margin-top: 6px;
  font-size: 12.5px;
  line-height: 1.75;
  color: #53616f;
}
.sharoshi-app .plan-hero-sub:empty { display: none; }
.sharoshi-app .plan-hero-name { margin-top: 7px; font-size: 11.5px; color: #9fb0c8; }
.sharoshi-app .plan-hero-stats { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.sharoshi-app .plan-hero-stat {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-size: 11.5px;
  color: #cfdcea;
  white-space: nowrap;
}
.sharoshi-app .plan-hero-stat b { font-size: 13.5px; font-weight: 800; color: #f2f7fb; }
/* 遅れ／貯金は色で即断できるようにする（数字を読む前に分かる） */
.sharoshi-app .plan-hero-stat.is-behind b { color: #ffb1a0; }
.sharoshi-app .plan-hero-stat.is-ahead b { color: #8ee6c8; }
/* 試験日のチップだけ <button>。button の min-height:40px が効くと
   他のチップと背が揃わないので打ち消す */
.sharoshi-app .plan-hero-stat--btn {
  font: inherit;
  font-size: 11.5px;
  min-height: 0;
  cursor: pointer;
}
.sharoshi-app .plan-hero-stat--btn:hover { background: rgba(255, 255, 255, 0.18); border-color: rgba(255, 255, 255, 0.3); }
.sharoshi-app .plan-hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.sharoshi-app .plan-hero-btn {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  color: #eef4fa;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
}
/* 未提出の日はここが今日いちばん押してほしいボタンなので、色を持たせる */
.sharoshi-app .plan-hero-btn.is-todo {
  background: var(--accent);
  border-color: #2aa79a;
  color: #fff;
}
.sharoshi-app .plan-hero-btn:hover { filter: brightness(1.1); }
.sharoshi-app .plan-hero-link {
  border: 0;
  background: none;
  color: #9fb0c8;
  font: inherit;
  font-size: 12px;
  text-decoration: underline;
}
.sharoshi-app .plan-hero-link:hover { color: #dce6f0; }
/* 立ち絵と吹き出しを横に並べられるのは、かなり広い画面だけ。
   実測では 430pxのiPhone で吹き出し250px弱、834pxのiPad縦でも330pxしかなく、
   200字を超えるAI講評が細長い柱になって読めなかった
   （得られる幅は 画面幅 − メニュー208px − 余白 − 立ち絵。広い画面でないと残らない）。
   1100px以下では「立ち絵＋名前とチップ」を上段に、吹き出しを下段の全幅に置く。
   並べ替えは grid-template-areas で行い、DOMの順序（＝広い画面の見た目）は変えない */
@media (max-width: 1100px) {
  .sharoshi-app .plan-hero {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "chara meta"
      "bubble bubble"
      "actions actions";
    align-items: start;
    gap: 10px;
    padding: 12px 14px 14px;
  }
  .sharoshi-app .plan-hero-talk { display: contents; }
  .sharoshi-app .plan-hero-chara {
    grid-area: chara;
    align-self: end;
    height: clamp(152px, 26vw, 224px);
  }
  .sharoshi-app .plan-hero-meta { grid-area: meta; }
  .sharoshi-app .plan-hero-bubble { grid-area: bubble; padding: 12px 13px; }
  .sharoshi-app .plan-hero-actions { grid-area: actions; margin-top: 0; }
  /* しっぽは上向き。吹き出しが立ち絵の下に来るので、左向きだと何も指さない */
  .sharoshi-app .plan-hero-bubble::before {
    top: -9px;
    left: 20px;
    border: 9px solid transparent;
    border-top: 0;
    border-right-color: transparent;
    border-bottom-color: rgba(255, 255, 255, 0.95);
  }
  .sharoshi-app .plan-hero-line { font-size: 13.5px; line-height: 1.8; }
  .sharoshi-app .plan-hero-sub { font-size: 12px; }
  .sharoshi-app .plan-hero-name { margin-top: 0; margin-bottom: 7px; }
  .sharoshi-app .plan-hero-stat { font-size: 10.5px; padding: 4px 8px; }
  .sharoshi-app .plan-hero-stat b { font-size: 12px; }
  .sharoshi-app .plan-hero-stats { margin-top: 0; gap: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  .sharoshi-app .plan-hero { animation: none; }
  .sharoshi-app .plan-hero-chara { animation: none; }
}

/* ── 日報ダイアログ ── */
.sharoshi-app .plan-dialog { position: fixed; inset: 0; z-index: 210; }
.sharoshi-app .plan-dialog-scrim { position: absolute; inset: 0; background: rgba(12, 16, 24, 0.5); }
.sharoshi-app .plan-dialog-box {
  position: relative;
  width: min(520px, 92vw);
  max-height: 82vh;
  margin: 7vh auto 0;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 24px 70px rgba(10, 16, 28, 0.4);
  overflow: hidden;
}
.sharoshi-app .plan-dialog-head {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px; border-bottom: 1px solid var(--line);
}
.sharoshi-app .plan-dialog-head h3 { margin: 0; font-size: 15px; font-weight: 800; }
.sharoshi-app .plan-dialog-head .plan-dialog-date { margin-left: auto; font-size: 12px; color: var(--muted); }
.sharoshi-app .plan-dialog-close {
  border: 0; background: none; font: inherit; font-size: 18px; line-height: 1;
  color: var(--muted); cursor: pointer; padding: 4px 6px;
}
.sharoshi-app .plan-dialog-body { padding: 14px 16px 18px; overflow-y: auto; }
.sharoshi-app .plan-field { margin-bottom: 14px; }
.sharoshi-app .plan-field > label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
/* 時間入力：よく使う値をボタンで置く。毎日の入力で数字キーを叩かせない */
.sharoshi-app .plan-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.sharoshi-app .plan-quick button {
  min-height: 34px; padding: 0 11px; border: 1px solid var(--line); border-radius: 6px;
  background: #fff; font: inherit; font-size: 12.5px; font-weight: 700; color: var(--ink);
}
.sharoshi-app .plan-quick button.is-on { background: var(--accent); border-color: var(--accent); color: #fff; }
.sharoshi-app .plan-hm { display: flex; align-items: center; gap: 6px; }
.sharoshi-app .plan-hm input {
  width: 74px; min-height: 40px; padding: 0 10px; text-align: right;
  border: 1px solid var(--line); border-radius: 6px; font: inherit; font-size: 15px;
}
.sharoshi-app .plan-hm span { font-size: 13px; color: var(--muted); }
.sharoshi-app .plan-field select,
.sharoshi-app .plan-field textarea {
  width: 100%; box-sizing: border-box; padding: 9px 10px;
  border: 1px solid var(--line); border-radius: 6px; font: inherit; font-size: 14px;
}
.sharoshi-app .plan-field select { min-height: 40px; }
.sharoshi-app .plan-field textarea { min-height: 72px; resize: vertical; line-height: 1.7; }
.sharoshi-app .plan-measured { font-size: 12px; color: var(--muted); line-height: 1.7; }
/* 自動計測の枠。手入力欄より先に、目立つ形で出す
   （「全部自分で入れるのか」と思わせない） */
.sharoshi-app .plan-auto {
  margin-bottom: 14px; padding: 11px 13px; border-radius: 8px;
  background: #eef8f3; border: 1px solid rgba(15, 118, 110, .28);
}
.sharoshi-app .plan-auto-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  font-size: 12.5px; font-weight: 700; color: var(--accent-dark);
}
.sharoshi-app .plan-auto-row b { font-size: 20px; font-weight: 800; }
.sharoshi-app .plan-auto-note { margin-top: 6px; font-size: 11.5px; line-height: 1.7; color: #4c6a66; }
.sharoshi-app .plan-auto-note b { color: var(--accent-dark); }
.sharoshi-app .plan-total-line { margin-top: 9px; font-size: 13px; color: var(--ink); }
.sharoshi-app .plan-total-line b { font-size: 16px; font-weight: 800; color: var(--accent-dark); }
.sharoshi-app .plan-total-line span { font-size: 12px; color: var(--muted); }
.sharoshi-app .plan-dialog-foot { display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.sharoshi-app .plan-save {
  min-height: 42px; padding: 0 18px; border: 0; border-radius: 8px;
  background: var(--accent); color: #fff; font: inherit; font-size: 14px; font-weight: 800;
}
.sharoshi-app .plan-save:disabled { opacity: 0.6; }
.sharoshi-app .plan-save-note { font-size: 12px; color: var(--muted); }
.sharoshi-app .plan-setting { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.sharoshi-app .plan-setting > summary {
  cursor: pointer; font-size: 12px; font-weight: 700; color: var(--muted); list-style: none;
}
.sharoshi-app .plan-setting > summary::before { content: "▸ "; }
.sharoshi-app .plan-setting[open] > summary::before { content: "▾ "; }
.sharoshi-app .plan-setting > summary::-webkit-details-marker { display: none; }
.sharoshi-app .plan-setting .plan-field { margin: 10px 0 8px; }
.sharoshi-app .plan-setting b { color: var(--accent-dark); }
/* 過去の日報。申告とアプリ実測を並べて、差が一目で分かるようにする */
.sharoshi-app .plan-log { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
.sharoshi-app .plan-log h4 { margin: 0 0 8px; font-size: 12px; font-weight: 700; color: var(--muted); }
.sharoshi-app .plan-log-row {
  display: grid; grid-template-columns: 58px 1fr auto; gap: 8px; align-items: baseline;
  padding: 7px 0; border-bottom: 1px dotted var(--line); font-size: 12.5px;
}
.sharoshi-app .plan-log-row:last-child { border-bottom: 0; }
.sharoshi-app .plan-log-date { color: var(--muted); font-size: 11.5px; }
.sharoshi-app .plan-log-main { min-width: 0; }
.sharoshi-app .plan-log-note { color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.sharoshi-app .plan-log-min { font-weight: 800; white-space: nowrap; }
.sharoshi-app .plan-log-row.is-zero .plan-log-min { color: var(--rose); }

/* ── 学習計画（科目別の期限）──
   10行並ぶので、1行の高さを詰めて一覧性を優先する。
   「いま取り組む科目」だけを地色で立て、他は淡く置く */
.sharoshi-app .home-plan-note { margin-left: auto; font-size: 11.5px; color: var(--muted); }
.sharoshi-app .study-plan-toolbar { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; margin: 12px 0; }
.sharoshi-app .study-plan-toolbar button,
.sharoshi-app .study-plan-dialog button:not(.plan-dialog-close) { padding: 8px 12px; border: 1px solid #b9cbc3; border-radius: 6px; background: #f7fbf9; color: var(--ink); cursor: pointer; font: inherit; }
.sharoshi-app .study-plan-tabs { display: flex; gap: 6px; }
.sharoshi-app .study-plan-tabs button[aria-pressed="true"] { background: var(--accent-dark); color: white; border-color: var(--accent-dark); }
.sharoshi-app .study-plan-toolbar button:disabled,
.sharoshi-app .study-plan-dialog button:disabled { opacity: .45; cursor: default; }
.sharoshi-app .study-plan-notice, .sharoshi-app .study-plan-warning { padding: 10px 12px; background: #fff6df; color: #785a18; border-left: 3px solid #cb9b35; font-size: 12px; }
.sharoshi-app .study-plan-caption { font-size: 11.5px; color: var(--muted); line-height: 1.65; }
.sharoshi-app .study-plan-row { padding: 12px 4px; border-bottom: 1px solid #e3eae6; }
.sharoshi-app .study-plan-row-head, .sharoshi-app .study-plan-row-detail { display: flex; gap: 8px; justify-content: space-between; flex-wrap: wrap; }
.sharoshi-app .study-plan-row-head { font-size: 13px; }
.sharoshi-app .study-plan-row-head > span { font-size: 12px; font-weight: 700; }
.sharoshi-app .study-plan-row-detail { margin-top: 5px; font-size: 11.5px; color: var(--muted); }
.sharoshi-app .study-plan-row.is-behind .study-plan-row-head > span { color: var(--rose); }
.sharoshi-app .study-plan-row.is-done .study-plan-row-head > span { color: var(--green); }
.sharoshi-app .study-plan-progress { height: 7px; background: #e7efeb; position: relative; margin: 9px 2px 7px; }
.sharoshi-app .study-plan-progress > i { display: block; height: 100%; background: var(--accent); }
.sharoshi-app .study-plan-progress > b { position: absolute; top: -3px; bottom: -3px; width: 2px; background: #555f5a; transform: translateX(-1px); }
.sharoshi-app .study-plan-dialog .plan-dialog-box {
  width: min(880px, calc(100% - 24px));
  /* 上の余白（margin: 7vh）を必ず差し引く。100%のままだと下端が画面外へ出て、
     本文をスクロールしても保存ボタンに届かない */
  max-height: calc(100% - 7vh - 24px);
}
/* 保存ボタンは本文のいちばん下にあり、科目期限の表を開いた日は特に遠い。
   帯ごと貼り付けて、どこまでスクロールしても押せるようにする
   （ボタン単体を sticky にすると、表の上に浮いて見える） */
.sharoshi-app .study-plan-dialog .plan-save-bar {
  position: sticky;
  bottom: 0;
  margin-top: 14px;
  padding: 12px 0;
  background: #fff;
  box-shadow: 0 -12px 14px -10px rgba(20, 40, 30, 0.2);
}
.sharoshi-app .study-plan-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 16px 0; }
.sharoshi-app .study-plan-fields label { display: grid; gap: 6px; font-size: 13px; }
.sharoshi-app .study-plan-fields input { min-width: 0; width: 100%; padding: 9px; border: 1px solid #b9cbc3; border-radius: 4px; font: inherit; background: white; color: var(--ink); box-sizing: border-box; }
.sharoshi-app .study-plan-summary { border: 1px solid #d5e3db; padding: 0 12px; margin-top: 12px; font-size: 12px; }
.sharoshi-app .study-plan-table-wrap { overflow-x: auto; margin: 12px 0; }
.sharoshi-app .study-plan-table { border-collapse: collapse; width: 100%; font-size: 12px; }
.sharoshi-app .study-plan-table th, .sharoshi-app .study-plan-table td { padding: 8px; border-bottom: 1px solid #d5e3db; text-align: left; }
.sharoshi-app .study-plan-table small { color: var(--muted); white-space: nowrap; }
.sharoshi-app .study-plan-message { color: var(--rose); font-size: 13px; }
.sharoshi-app .study-plan-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 16px 0; }
.sharoshi-app .study-plan-option { padding: 14px; border: 1px solid #b9cbc3; border-radius: 6px; font-size: 13px; line-height: 1.7; }
.sharoshi-app .study-plan-option h4 { margin: 0; font-size: 15px; }
.sharoshi-app .study-plan-option ul { padding-left: 18px; font-size: 11px; }
.sharoshi-app .study-plan-coach { background: #edf6f1; border-left: 3px solid var(--accent); padding: 12px; line-height: 1.8; }
.sharoshi-app .study-plan-history > section { padding: 15px 0; border-bottom: 1px solid #d5e3db; }
@media (max-width: 600px) {
  .sharoshi-app .study-plan-options, .sharoshi-app .study-plan-fields { grid-template-columns: 1fr; }
  .sharoshi-app .study-plan-dialog .plan-dialog-body { padding: 10px; }
  .sharoshi-app #homePlanCard > .analysis-head { flex-wrap: wrap; gap: 8px; }
  .sharoshi-app .home-plan-note { margin-left: 0; }
}
.sharoshi-app .plan-sub-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px minmax(60px, 1.1fr) 62px 74px;
  align-items: center;
  gap: 9px;
  padding: 7px 8px;
  border-radius: 6px;
  font-size: 12.5px;
  color: var(--ink);
}
.sharoshi-app .plan-sub-row.is-future { color: var(--muted); }
.sharoshi-app .plan-sub-row.is-current { background: #eef8f3; box-shadow: inset 3px 0 0 var(--accent); }
.sharoshi-app .plan-sub-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sharoshi-app .plan-sub-row.is-current .plan-sub-name { color: var(--accent-dark); }
.sharoshi-app .plan-sub-due { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.sharoshi-app .plan-sub-bar { height: 7px; border-radius: 99px; background: #e4ebe9; overflow: hidden; }
.sharoshi-app .plan-sub-bar > i { display: block; height: 100%; border-radius: 99px; background: var(--accent); }
.sharoshi-app .plan-sub-row.is-done .plan-sub-bar > i { background: #16a34a; }
.sharoshi-app .plan-sub-row.is-behind .plan-sub-bar > i { background: var(--gold); }
.sharoshi-app .plan-sub-count { font-size: 11.5px; color: var(--muted); text-align: right; white-space: nowrap; }
.sharoshi-app .plan-sub-state { font-size: 11.5px; font-weight: 700; text-align: right; white-space: nowrap; color: var(--muted); }
.sharoshi-app .plan-sub-row.is-behind .plan-sub-state { color: var(--rose); }
.sharoshi-app .plan-sub-row.is-ahead .plan-sub-state,
.sharoshi-app .plan-sub-row.is-done .plan-sub-state { color: var(--green); }
@media (max-width: 640px) {
  /* 5列は入らないので、2段に折る（科目名と状態を上段、進捗を下段） */
  .sharoshi-app .plan-sub-row {
    grid-template-columns: minmax(0, 1fr) 46px 74px;
    grid-template-areas: "name due state" "bar bar count";
    row-gap: 5px;
  }
  .sharoshi-app .plan-sub-name { grid-area: name; }
  .sharoshi-app .plan-sub-due { grid-area: due; text-align: right; }
  .sharoshi-app .plan-sub-state { grid-area: state; }
  .sharoshi-app .plan-sub-bar { grid-area: bar; }
  .sharoshi-app .plan-sub-count { grid-area: count; }
}

/* 今日やることの進捗タグ。
   以前は隣に試験日チップも並べていたが、ナビゲーターの
   「試験まで◇日」と同じ数字だったためそちらへ寄せた */
.sharoshi-app .home-today-progress {
  display: inline-flex;
  align-items: center;
  height: 30px;
  min-height: 0;
  box-sizing: border-box;
  padding: 0 11px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  border-radius: 6px;
}
.sharoshi-app .home-today-progress {
  color: var(--accent-dark);
  background: #fff;
  border: 1px solid rgba(15,118,110,.35);
}
.sharoshi-app .home-today-progress.is-done { color: #fff; background: var(--accent); border-color: var(--accent); }
.sharoshi-app .home-today-bar {
  height: 8px; border-radius: 99px; background: #dfeeea; overflow: hidden; margin: 12px 0 18px;
}
.sharoshi-app .home-today-bar > i {
  display: block; height: 100%; width: 0; border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), #34b39a); transition: width .5s;
}
/* セクション見出しは左に色帯を付けて、カード内の区切りを目で追えるようにする */
.sharoshi-app .home-today-sec { margin-bottom: 18px; }
.sharoshi-app .home-today-sec:last-child { margin-bottom: 0; }
.sharoshi-app .home-today-sec h3 {
  margin: 0 0 9px; font-size: 12px; font-weight: 800; color: var(--muted);
  letter-spacing: .1em; display: flex; align-items: center; gap: 8px;
}
.sharoshi-app .home-today-sec h3::before {
  content: ""; width: 4px; height: 14px; border-radius: 2px; background: var(--accent);
}
.sharoshi-app .home-today-sec h3 b { color: var(--accent-dark); font-size: 13px; letter-spacing: 0; }
/* そのブロックに配られた時間。件数の根拠が時間であることを見せるための添え物なので控えめに */
.sharoshi-app .home-today-sec h3 .home-sec-min {
  margin-left: 6px; font-size: 11px; font-weight: 400; color: var(--muted); letter-spacing: 0;
}

/* 試験日の入力欄。ナビゲーターの「試験まで◇日」を押すと、
   チップの隣にこれが出る */
.sharoshi-app .home-exam-input {
  font: inherit;
  font-size: 12px;
  height: 30px;
  min-height: 0;
  box-sizing: border-box;
  border: 1px solid #c9a961;
  border-radius: 6px;
  padding: 3px 8px;
}

/* 連続学習日数（上部バー）。今日まだなら色を落として「途切れそう」を知らせる */
/* 上部バーの各コントロール（検索・用語・設定・🔥連続日数）は高さをそろえる。
   スマホの「button に min-height:40px」が検索などのボタンにだけ効き、
   <span> の🔥チップだけ背が低く取り残されていた。
   上部バー自体が46pxしかないので、40pxまで伸ばさず全部32pxに統一する。 */
.sharoshi-app .topbar-streak {
  flex: none;
  display: inline-flex;
  align-items: center;
  height: 32px;
  box-sizing: border-box;
  font-size: 12px;
  font-weight: 800;
  color: #b45309;
  background: #fdf1e3;
  border: 1px solid #f0d9b8;
  border-radius: 6px;
  padding: 0 9px;
  white-space: nowrap;
}
/* スマホのタップ領域確保ルールより後に置き、上部バーだけは32pxに固定する */
@media (max-width: 820px) {
  .sharoshi-app .topbar .topbar-btn,
  .sharoshi-app .topbar .owner-menu-btn {
    min-height: 32px;
    height: 32px;
  }
}
.sharoshi-app .topbar-streak.is-pending { color: #8a6a4a; background: #f6f1ea; border-style: dashed; }

/* 学習マップ（1問1マス） */
.sharoshi-app .home-cov-note { font-size: 12px; color: var(--muted); }
.sharoshi-app .home-cov-block + .home-cov-block {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}
.sharoshi-app .home-cov-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.sharoshi-app .home-cov-head h3 {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: .04em;
}
.sharoshi-app .home-cov-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 14px;
  font-size: 11px;
  color: var(--muted);
  margin: 8px 0 10px;
}
.sharoshi-app .home-cov-legend span { display: inline-flex; align-items: center; gap: 4px; }
.sharoshi-app .home-cov-hint { margin-left: auto; font-size: 11px; color: var(--muted); }
.sharoshi-app .home-cov-row { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 7px; }
.sharoshi-app .home-cov-sub {
  flex: none;
  width: 128px;
  font-size: 11px;
  color: var(--muted);
  padding-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sharoshi-app .home-cov-cells { display: flex; flex-wrap: wrap; gap: 3px; min-width: 0; }
.sharoshi-app .cov-cell {
  width: 11px;
  height: 11px;
  border-radius: 2px;
  background: #e2e8e7;
  cursor: pointer;
}
.sharoshi-app .cov-cell.is-ok { background: var(--accent); }
.sharoshi-app .cov-cell.is-ng { background: #f59e0b; }
/* テキストは読了回数で濃くする（周回が積み上がって見えるように） */
.sharoshi-app #homeCoverage .cov-cell:hover { outline: 2px solid var(--accent-dark); outline-offset: 1px; }
@media (max-width: 640px) {
  .sharoshi-app .home-cov-sub { width: 84px; }
  .sharoshi-app .cov-cell { width: 13px; height: 13px; } /* 指で押せる大きさ */
}

/* ノルマ完走の儀式 */
.sharoshi-app .celebrate {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 14, 22, 0.6);
  cursor: pointer;
}
.sharoshi-app .celebrate-card {
  max-width: min(420px, 90vw);
  text-align: center;
  padding: 22px 26px 16px;
  border-radius: 14px;
  background: radial-gradient(120% 85% at 28% 12%, #2f3a4e 0%, #1a1f2b 60%, #0c0f16 100%);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  animation: celebrate-pop 0.35s cubic-bezier(0.2, 1.4, 0.4, 1);
}
@keyframes celebrate-pop {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.sharoshi-app .celebrate-title { margin: 0 0 10px; font-size: 15px; font-weight: 800; color: #ffd58a; }
.sharoshi-app .celebrate-card img { max-height: 240px; max-width: 100%; }
.sharoshi-app .celebrate-line {
  margin: 12px 0 4px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.94);
  color: #1e2528;
  font-size: 14px;
  line-height: 1.9;
  text-align: left;
}
.sharoshi-app .celebrate-name { margin: 0; font-size: 11.5px; color: #9fb0c8; }
.sharoshi-app .celebrate-close { margin: 10px 0 0; font-size: 11px; color: #7c8aa0; }

/* 節目の称賛（過去問・暗記のノルマ達成、テキストの読了）。
   全画面の儀式は1日ぶん完走したときだけ。こちらは小さめの帯で邪魔をしない */
.sharoshi-app .milestone {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 295;
  display: flex;
  align-items: center;
  gap: 12px;
  /* 幅を決めておく。指定しないと中身なりに縮んで文字が詰まる */
  width: min(420px, calc(100vw - 24px));
  box-sizing: border-box;
  padding: 10px 18px 10px 10px;
  border-radius: 14px;
  background: linear-gradient(110deg, #1f2b3a 0%, #29384a 60%, #33465c 100%);
  box-shadow: 0 16px 40px rgba(10, 16, 28, 0.42);
  cursor: pointer;
  /* 既定を「表示された状態」にしておき、アニメーションは動きだけを足す。
     fill-mode:both で開始状態（透明）を保持すると、アニメーションが動かない
     環境で永久に見えなくなる。rAFでクラスを足す方式も同じ理由で使わない */
  transform: translate(-50%, 0);
  animation: milestone-in .28s ease-out;
}
@keyframes milestone-in {
  from { opacity: 0; transform: translate(-50%, 24px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
.sharoshi-app .milestone.is-out { animation: milestone-out .3s ease-in forwards; }
@keyframes milestone-out {
  from { opacity: 1; transform: translate(-50%, 0); }
  to { opacity: 0; transform: translate(-50%, 16px); }
}
.sharoshi-app .milestone img {
  flex: none;
  width: 66px;
  height: 66px;
  object-fit: cover;
  object-position: top center;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
}
.sharoshi-app .milestone-body { min-width: 0; }
.sharoshi-app .milestone-title { font-size: 12px; font-weight: 800; color: #ffd58a; }
.sharoshi-app .milestone-line { margin-top: 3px; font-size: 13px; line-height: 1.75; color: #f2f6fa; font-weight: 700; }
.sharoshi-app .milestone-name { margin-top: 3px; font-size: 11px; color: #9fb0c8; }
@media (max-width: 640px) {
  .sharoshi-app .milestone { bottom: 16px; padding: 9px 14px 9px 9px; gap: 10px; }
  .sharoshi-app .milestone img { width: 56px; height: 56px; }
  .sharoshi-app .milestone-line { font-size: 12.5px; }
}

/* 有能感トースト（解答直後の小さな瞬間） */
.sharoshi-app .feat-toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translate(-50%, 16px);
  z-index: 290;
  font-size: 14px;
  font-weight: 800;
  color: #fff;
  background: #1e2b3a;
  border-radius: 999px;
  padding: 11px 22px;
  box-shadow: 0 12px 32px rgba(10, 16, 28, 0.4);
  pointer-events: none;
  transform: translate(-50%, 0);
  animation: milestone-in .25s ease-out;
}
.sharoshi-app .feat-toast.is-out { animation: milestone-out .3s ease-in forwards; }

/* 昨日の実績・直近ペースの帯 */
.sharoshi-app .home-guide {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  font-size: 12.5px;
  color: var(--muted);
  padding: 2px 2px 10px;
  border-bottom: 1px dashed var(--line);
  margin-bottom: 10px;
}
.sharoshi-app .home-guide b { color: var(--ink); }

/* いまの科目の切り替え */
.sharoshi-app .home-focus { margin-top: 8px; }
.sharoshi-app .home-focus label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--muted);
}
.sharoshi-app .home-focus select {
  font: inherit;
  font-size: 12px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 8px;
  max-width: 260px;
}

/* 読むセクションの残量・ペース注記 */
.sharoshi-app .home-pace-note {
  margin: 6px 2px 0;
  font-size: 12px;
  line-height: 1.8;
  color: var(--muted);
}
.sharoshi-app .home-today-item {
  display: block; width: 100%; text-align: left; cursor: pointer; font: inherit; text-decoration: none;
  background: #fff; border: 1px solid var(--line); border-left: 3px solid #dfe7e6;
  border-radius: 8px; padding: 11px 14px; margin-bottom: 8px; box-sizing: border-box;
  transition: border-color .15s, box-shadow .15s;
}
.sharoshi-app .home-today-item:hover {
  border-color: var(--accent); border-left-color: var(--accent);
  box-shadow: 0 4px 12px rgba(15,118,110,.12);
}
.sharoshi-app .home-today-item.is-done { opacity: .45; border-left-color: var(--accent); }
.sharoshi-app .home-today-item.is-done .home-today-ask { text-decoration: line-through; }
.sharoshi-app .home-today-ask { display: block; font-size: 14px; line-height: 1.75; color: var(--ink); }
.sharoshi-app .home-today-meta { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); }

/* 実力 */
.sharoshi-app .home-prof-note { font-size: 12px; color: var(--muted); }
.sharoshi-app .home-prof-main { display: flex; align-items: baseline; gap: 8px; margin: 12px 0 14px; }
.sharoshi-app .home-prof-main b { font-size: 40px; font-weight: 800; line-height: 1; color: #8a97ab; }
.sharoshi-app .home-prof-main b.is-pass { color: var(--accent-dark); }
.sharoshi-app .home-prof-main span { font-size: 13px; color: var(--muted); }
.sharoshi-app .home-prof-line { margin-left: auto; }
.sharoshi-app .home-prof-list { list-style: none; margin: 0; padding: 0; }
.sharoshi-app .home-prof-list li { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 13px; }
.sharoshi-app .home-prof-sub { flex: 0 0 8.5em; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sharoshi-app .home-prof-track { flex: 1; height: 8px; border-radius: 99px; background: #e4e9f2; overflow: hidden; }
.sharoshi-app .home-prof-track > i { display: block; height: 100%; background: var(--gold); }
.sharoshi-app .home-prof-track > i.is-pass { background: var(--accent); }
.sharoshi-app .home-prof-val { flex: 0 0 2.4em; text-align: right; font-weight: 800; color: var(--ink); }

/* 学習分析（折りたたみ） */
.sharoshi-app .home-analysis { background: var(--paper); border: 1px solid var(--line); }
.sharoshi-app .home-analysis > summary {
  cursor: pointer; list-style: none; display: flex; align-items: center; gap: 10px;
  font-size: 14px; font-weight: 700; color: var(--muted);
}
.sharoshi-app .home-analysis > summary::-webkit-details-marker { display: none; }
.sharoshi-app .home-analysis > summary::before { content: "▸"; font-weight: 400; }
.sharoshi-app .home-analysis[open] > summary::before { content: "▾"; }
.sharoshi-app .home-analysis[open] { background: var(--panel); }
.sharoshi-app .home-analysis-hint { margin-left: auto; font-size: 12px; font-weight: 400; }

@media (min-width: 900px) {
  /* 「今日やること」と「実力」を横並びにして、ファーストビューに収める */
  .sharoshi-app .home-wrap { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); align-items: start; }
  /* 過去問マップは503マス並ぶので、2カラムに入れず全幅を使う */
  .sharoshi-app .home-coverage { grid-column: 1 / -1; }
  /* ナビゲーターも全幅。片方の列に入れると立ち絵と吹き出しが両方つぶれる
     （実際に右列へ落ちて、吹き出しが幅112pxの縦棒になった）。
     行を明示しないと、行番号を指定済みの他カードに押し出されて最下段へ回る */
  .sharoshi-app .plan-hero { grid-column: 1 / -1; grid-row: 1; }
  .sharoshi-app .home-today { grid-column: 1; grid-row: 2 / span 2; }
  .sharoshi-app .home-prof { grid-column: 2; grid-row: 2; }
  /* 科目別の期限は10行あるので全幅。行番号を明示しないと最下段へ回る */
  .sharoshi-app .home-plan { grid-column: 1 / -1; grid-row: 4; }
  .sharoshi-app .home-analysis { grid-column: 1 / -1; }
}

/* 暗記カード裏面 → 辞典・関連語の導線（カードが行き止まりにならないように） */
.flash-links { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; justify-content: center; }
.flash-link {
  font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; white-space: nowrap;
  color: #fff; background: var(--accent); border: 0; border-radius: 6px; padding: 6px 14px;
}
.flash-link:hover { background: var(--accent-dark); }
.flash-link.is-related {
  color: var(--accent-dark); background: #fff; border: 1px solid var(--accent);
}
.flash-link.is-related:hover { background: #eef8f3; }

/* 辞典 → 暗記の導線 */
.detail-actions { margin: 12px 0 4px; }
.detail-action {
  font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
  color: var(--accent-dark); background: #fff; border: 1px solid var(--accent);
  border-radius: 6px; padding: 8px 16px;
}
.detail-action:hover { background: #eef8f3; }

/* 相談の結果 → 辞典 */
.novel-term {
  font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; white-space: nowrap;
  color: #8ff0bd; background: rgba(31, 122, 77, 0.28);
  border: 1px solid rgba(46, 204, 113, 0.4); border-radius: 6px; padding: 3px 11px;
}
.novel-term:hover { background: rgba(31, 122, 77, 0.45); }

/* 記述カード（暗記の3段目：落とした用語をAI採点） */
.flash-deck-btn.is-desc { border-color: var(--gold); }
.flash-deck-sub { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }

.flash-desc { text-align: left; padding: 4px 2px; }
.flash-desc-term { margin: 6px 0 4px; font-size: 20px; font-weight: 800; color: var(--ink); }
.flash-desc-ask { margin: 0 0 12px; font-size: 14px; line-height: 1.8; color: var(--ink); }
.flash-desc textarea {
  box-sizing: border-box; width: 100%; resize: vertical; font: inherit; font-size: 16px;
  line-height: 1.8; padding: 11px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--paper); color: var(--ink);
}
.flash-desc textarea:focus { outline: 2px solid rgba(15,118,110,.3); border-color: var(--accent); }
.flash-desc-actions { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.flash-desc-submit {
  font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; color: #fff;
  background: var(--accent); border: 0; border-radius: 7px; padding: 10px 22px;
}
.flash-desc-submit:hover { background: var(--accent-dark); }
.flash-desc-submit:disabled { background: var(--muted); cursor: default; }
.flash-desc-status { font-size: 13px; color: var(--muted); }

.flash-desc-score { display: flex; align-items: baseline; gap: 8px; margin: 16px 0 10px; }
.flash-desc-score b { font-size: 30px; font-weight: 800; line-height: 1; color: var(--muted); }
.flash-desc-score b.is-pass { color: var(--accent-dark); }
.flash-desc-score span { font-size: 13px; color: var(--muted); }
.flash-desc-verdict {
  margin-left: auto; font-size: 12px; font-weight: 700; border-radius: 6px; padding: 3px 11px;
  color: var(--rose); background: rgba(162,59,83,.08); border: 1px solid rgba(162,59,83,.3);
}
.flash-desc-verdict.is-pass { color: var(--accent-dark); background: rgba(15,118,110,.1); border-color: rgba(15,118,110,.35); }
.flash-desc-todo {
  margin: 0 0 12px; padding: 10px 13px; border-radius: 7px;
  background: #fff7e6; border: 1px solid #e0b96a; font-size: 13px; line-height: 1.8;
}
.flash-desc-todo b { display: block; margin-bottom: 4px; font-size: 12px; color: #6b4a06; }
.flash-desc-todo ol { margin: 0; padding-left: 1.3em; }
.flash-desc-chips > summary { cursor: pointer; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.flash-desc-chips > div { display: flex; flex-wrap: wrap; gap: 6px; }
.flash-chip { font-size: 12px; border-radius: 6px; padding: 3px 10px; line-height: 1.6; }
.flash-chip.is-ok { background: rgba(22,163,74,.1); border: 1px solid rgba(22,163,74,.35); color: #15803d; }
.flash-chip.is-ng { background: rgba(162,59,83,.08); border: 1px solid rgba(162,59,83,.3); color: var(--rose); }
.flash-desc-comment {
  margin: 12px 0 0; padding: 10px 13px; border-radius: 7px; font-size: 13px; line-height: 1.85;
  background: var(--paper); border-left: 3px solid var(--accent); color: var(--ink);
}
.flash-desc-model { margin-top: 14px; font-size: 13px; line-height: 1.85; }
.flash-desc-model b { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.flash-desc-model p { margin: 0; padding: 10px 13px; background: var(--paper); border-radius: 7px; }
.flash-desc-error { margin-top: 12px; color: var(--rose); font-size: 13px; }
.flash-desc-next {
  font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; white-space: nowrap;
  color: #fff; background: var(--accent-dark); border: 0; border-radius: 6px; padding: 6px 16px;
}

/* 採点結果 → その設問のレビュー画面（採点がおかしいと感じたその場で直すための導線） */
.novel-fix-rubric {
  display: inline-flex; align-items: center; font: inherit; font-size: 12px; font-weight: 700;
  text-decoration: none; white-space: nowrap; padding: 8px 14px; border-radius: 7px;
  color: var(--nv-dim); background: rgba(255, 255, 255, 0.08); border: 1px solid var(--nv-line);
}
.novel-fix-rubric:hover { color: var(--nv-ink); background: rgba(255, 255, 255, 0.16); }

/* 保守用ページ（設定・レビュー）への入口。学習には使わないので控えめに */
.sharoshi-app .owner-menu { position: relative; flex-shrink: 0; }
/* 隣の「用語を作る」と高さ・角丸を揃える。inline-block だと字が上下に寄る */
/* 隣の .topbar-btn（32px）と高さを揃える。上部バーは幅も高さも詰めてある */
.sharoshi-app .owner-menu-btn {
  display: inline-flex; align-items: center; justify-content: center;
  font: inherit; font-size: 15px; line-height: 1; cursor: pointer;
  width: 32px; height: 32px; padding: 0; border-radius: 6px;
  color: var(--muted); background: #fff; border: 1px solid var(--line);
}
.sharoshi-app .owner-menu-btn:hover { color: var(--ink); border-color: var(--accent); }
.sharoshi-app .owner-menu-list {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 40;
  min-width: 220px; padding: 6px; border-radius: 8px;
  background: #fff; border: 1px solid var(--line); box-shadow: 0 12px 28px rgba(30,37,40,.16);
}
.sharoshi-app .owner-menu-list.is-hidden { display: none; }
.sharoshi-app .owner-menu-list a {
  display: block; padding: 9px 12px; border-radius: 6px; font-size: 13px;
  color: var(--ink); text-decoration: none; white-space: nowrap;
}
.sharoshi-app .owner-menu-list a:hover { background: var(--paper); color: var(--accent-dark); }

/* ── スマホ：かぶせ物から position:fixed を排除する ──
   iOS Safari は fixed の要素が下部バーの領域に重なると、バーを不透明な灰色に
   切り替えたまま、ページを読み直すまで元に戻さない。実機で確定した挙動で、
   メニューを一度開くと以後どのモードでも本文が透けなくなり、fixed を一切
   出さない章ページだけが常に正常だった。ドロワーと幕は 820px の
   メディアクエリ側で対応済み。ここは後から出るかぶせ物・トースト類。
   位置と高さは表示のたびに app.js の pinToViewport() が実測して入れる。
   ※このブロックはファイル末尾に置くこと。各要素の定義より前に書くと
   　同じ詳細度で後勝ちされ、上書きが効かない（実際に取り逃した） */
/* 条件は「文書スクロールになる端末」と同じにする（3315行付近の body.app-shell の分岐）。
   幅だけで切っていたころは iPad（834〜1180px）が文書スクロールなのに fixed のままで、
   iOS の下部バーが灰色に固定される条件がそろっていた。app.js の pinToViewport も同じ条件 */
@media (max-width: 820px), (hover: none) and (pointer: coarse) {
  .sharoshi-app .gsearch,
  .sharoshi-app .celebrate,
  .sharoshi-app .plan-dialog,
  #mmLightbox {
    position: absolute;
    top: 0; left: 0; right: 0;
    bottom: auto;
    height: 100dvh; /* 表示時に実測値で上書きされる */
  }
  .sharoshi-app .milestone,
  .sharoshi-app .feat-toast { position: absolute; }
  /* 選択ポップアップは JS が画面座標で置くので、文書座標へ読み替えている */
}

/* 条文タブを章で絞っているときの帯（app.js の renderLawChapterBar） */
.sharoshi-app .law-chapter-bar { max-width: 1180px; margin: 14px auto 0; padding: 8px clamp(16px, 4vw, 48px); display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-weight: 700; color: var(--ink); }
.sharoshi-app .law-chapter-clear { background: none; border: 1px solid var(--line); border-radius: 4px; padding: 3px 10px; font-size: 12px; color: var(--muted); cursor: pointer; }
@media (max-width: 820px) { .sharoshi-app .law-chapter-bar { padding-left: 14px; padding-right: 14px; } }

/* ── ログイン画面 ──
   未ログイン（API が 401）のときだけ出す。かぶせ物にせずアプリ本体を隠し、通常の流れに置く
   （スマホで position: fixed を使わない約束）。本体用の overflow: hidden もここでは外す */
body.app-shell.is-login, html:has(> body.app-shell.is-login) { height: auto; overflow: visible; }
body.is-login .sharoshi-app { display: none; }
.login-screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  box-sizing: border-box;
}
.login-screen[hidden] { display: none; }
.login-card {
  width: 100%;
  max-width: 420px;
  padding: 32px 24px 28px;
  box-sizing: border-box;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  text-align: center;
}
.login-oyasai { display: block; width: 160px; height: 160px; margin: 0 auto 12px; object-fit: contain; }
.login-title { margin: 0 0 12px; font-size: 22px; line-height: 1.4; color: var(--accent-dark); }
.login-title span { display: block; font-size: 15px; color: var(--muted); font-weight: 600; }
.login-text { margin: 0 0 20px; font-size: 14px; line-height: 1.8; color: var(--ink); text-align: left; }
.login-button { display: flex; justify-content: center; min-height: 44px; }
.login-error { margin: 14px 0 0; font-size: 13px; line-height: 1.6; color: var(--rose); }
