:root {
  --bg: #f3f5f8;
  --panel: #ffffff;
  --line: #d7dbe2;
  --text: #111;
  --muted: #6b7280;
  --radius: 16px;
  --shadow: 3px 3px 3px rgba(0, 0, 0, 0.08);
  --headerGrad1: #c8d3e6;
  --headerGrad2: #dbe6f3;
}

* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
  overflow-x: hidden;
}
body {
  margin: 0;
  font-family:
    system-ui,
    -apple-system,
    "Hiragino Sans",
    "Noto Sans JP",
    sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* ===== Header (共通) ===== */
.appHeader {
  position: sticky;
  top: 0;
  z-index: 50;
  background: linear-gradient(90deg, var(--headerGrad1), var(--headerGrad2));
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  padding: 10px 10px 10px 12px;
}

.appHeader__inner {
  max-width: 980px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brandMark {
  width: 66px;
  display: grid;
  place-items: center;
}
.brandMark {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.headText {
  flex: 1;
  min-width: 0;
}
.breadcrumb {
  font-size: 13px;
  color: rgba(0, 0, 0, 0.72);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}
.headTitle {
  font-size: 22px;
  /* font-weight: 800; */
  margin-top: 2px;
  line-height: 1.2;
}

.docHeadRow {
  display: flex;
  align-items: center;
  min-width: 0;
}

.headTitle {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap; /* 長い日付でも崩れない */
}

/* PDFは右に寄せて小さく、さりげなく */
.pdfMini {
  display: none;
  align-items: center;
  gap: 2px;
  font-size: 12px;
  line-height: 1;
  padding: 4px 6px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 4px;
  text-decoration: none;
  color: inherit;
  opacity: 0.72;
  flex: 0 0 auto;
  margin-top: 3px;
}

@media (min-width: 768px) {
  body.is-viewer .pdfMini {
    display: inline-flex;
  }
}

.pdfMini svg {
  width: 14px;
  height: 14px;
  stroke-width: 2;
}
@media (max-width: 360px) {
  .pdfMini {
    padding: 5px 6px;
  }
  .pdfMini svg {
    display: none;
  }
  /* 超狭い時はアイコン無し */
}
.dateKanji {
  font-size: 0.8em;
}

.pdfMini:hover {
  opacity: 1;
}

.dots {
  margin-top: 4px;
  display: flex;
  gap: 3px;
}
.dot {
  width: 6px;
  height: 8px;
  /* border-radius: 999px; */
  background: rgba(0, 0, 0, 0.22);
}
.dot.is-active {
  background: rgba(0, 0, 0, 0.78);
}

/* ===== Menu Button ===== */
.menuBtn {
  width: 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}
.menuBtn__icon {
  width: 34px;
  height: 22px;
  position: relative;
}
.menuBtn__icon i {
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.72);
}
.menuBtn__icon i:nth-child(1) {
  top: 0;
}
.menuBtn__icon i:nth-child(2) {
  top: 9px;
}
.menuBtn__icon i:nth-child(3) {
  bottom: 0;
}
.menuBtn__label {
  font-size: 10px;
  color: rgba(0, 0, 0, 0.62);
}

/* ===== Main ===== */
.main {
  max-width: 980px;
  margin: 0 auto;
  padding: 10px;
  padding-bottom: 110px; /* 下部固定バー分 */
}

/* ===== Viewer page ===== */
.pageWrap {
  position: relative;
}

.paper {
  /* border-radius: 22px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(0, 0, 0, 0.06); */
  position: relative;
  padding: 4px;
}

.viewerModeSwitch {
  --switch-outline: #123c7c;
  position: fixed;
  top: 66px;
  right: max(-18px, calc((100vw - 980px) / 2 - 18px));
  z-index: 70;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 98px;
  height: 58px;
  padding: 3px 12px 6px 0;
  border-radius: 8px;
  border: 1px solid rgba(18, 60, 124, 0.22);
  background: rgba(255, 255, 255, 0.92);
  color: #123c7c;
  text-decoration: none;
  font-weight: 700;
  line-height: 1.05;
  box-shadow: 0 4px 14px rgba(18, 60, 124, 0.15);
}

.viewerModeSwitch[hidden] {
  display: none;
}

.viewerModeSwitch__image {
  display: block;
  width: 66px;
  height: 28px;
  object-fit: contain;
}

.viewerModeSwitch__sub {
  margin-top: 3px;
  font-size: 10px;
}

.viewerModeSwitch--aiBoard {
  --switch-outline: #123c7c;
  border: 2px solid #123c7c;
  background: #335d9c;
  color: #fff;
  box-shadow: 7px 9px 0 rgba(0, 0, 0, 0.28);
  animation: aiBoardSwitchIn 1.35s 0.65s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes aiBoardSwitchIn {
  0% {
    opacity: 0;
    transform: translateX(120%);
    box-shadow: 0 0 0 rgba(0, 0, 0, 0);
  }

  64% {
    opacity: 1;
    transform: translateX(0);
    box-shadow: 0 0 0 rgba(0, 0, 0, 0);
  }

  100% {
    opacity: 1;
    transform: translateX(0);
    box-shadow: 7px 9px 0 rgba(0, 0, 0, 0.28);
  }
}

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

.page {
  position: relative;
  /* border-radius: 20px; */
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* 画像 */
.page img {
  display: block;
  width: 100%;
  height: auto;
  background: #fff;
  touch-action: manipulation;
}

/* 矢印：控えめ＆外側配置 */
.navArrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5; /* paper より上 */

  width: 42px;
  height: 42px;

  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(0, 0, 0, 0.12);
  box-shadow: none;

  opacity: 0.55;
  transition:
    opacity 0.15s ease,
    background 0.15s ease;
}

/* スマホ用に */
.navArrow {
  color: #111;
}

/* 紙の外に出す */
.navArrow--left {
  left: -22px;
}
.navArrow--right {
  right: -22px;
}

/* アイコンも少し細く */
.navArrow svg {
  width: 28px;
  height: 28px;
  stroke-width: 2.5;
}

/* hover / アクティブ時だけ少し存在感 */
.navArrow:hover,
.navArrow:focus-visible {
  opacity: 0.9;
  background: rgba(255, 255, 255, 0.95);
}

/* disabled はさらに控えめ */
.navArrow:disabled {
  opacity: 0.2;
  background: rgba(255, 255, 255, 0.5);
  cursor: default;
}

/* OCR highlight */
.hl {
  position: absolute;
  background: rgba(255, 235, 59, 0.55);
  border-radius: 4px;
  pointer-events: none;
  animation: hlFlash 1.2s ease-out;
}
@keyframes hlFlash {
  from {
    box-shadow: 0 0 0 rgba(255, 200, 0, 0.9);
  }
  to {
    box-shadow: 0 0 20px rgba(255, 200, 0, 0);
  }
}
/* =========docNav======== */
.docNav {
  margin: 14px 0 10px;
  font-size: .9em;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  padding: 12px 2px;
  display: flex;
  justify-content: space-between;
}

.docNav__inner {
  margin: 0 auto;
  width: inherit;
  max-width: 980px;
  display: flex;
  justify-content: space-between;
}

.docNav__btn,
.docNav__center {
  font: inherit;
  border: 1px solid #ddd;
  background: #fff;
  border-radius: 999px;
  padding: 10px 20px;
  text-decoration: none;
  color: inherit;
  min-width: 7.2rem;
}

.docNav__center {
  opacity: 0.85;
  text-align: center;
}

.docNav__btn[aria-disabled="true"] {
  opacity: 0.35;
  pointer-events: none;
}
#docOlder {
  text-align: left;
  border-left: 0;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  padding-left: 10px;
}
#docNewer {
  /* justify-self: end; */
  text-align: right;
  border-right: 0;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  padding-right: 10px;
}

/* ===== Bottom fixed actions ===== */
.bottomBar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  padding: 12px 40px;
  background: rgba(243, 245, 248, 0.9);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}
.bottomBar__inner {
  max-width: 980px;
  margin: 0 auto;
  display: flex;
  gap: 14px;
  justify-content: space-between;
}
.actionBtn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 62px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.25);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.08);
  text-decoration: none;
  color: inherit;
  /* font-weight: 700; */
}
.actionBtn svg {
  width: 22px;
  height: 22px;
}

/* ===== Menu (drawer) ===== */
.menuOverlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, 0.35); /* ほんの少し色味 */
  display: none;
  z-index: 80;
}
.menuOverlay.is-open {
  display: block;
}

.menuPanel {
  position: absolute;
  top: 10px;
  right: 10px;
  width: min(340px, calc(100% - 20px));
  background: #fff;
  border-radius: 16px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.22);
  overflow: hidden;
}
.menuPanel__hd {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  font-weight: 800;
}
.menuPanel__bd a {
  display: block;
  padding: 12px 14px;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
.menuPanel__bd a:last-child {
  border-bottom: 0;
}
.menuPanel__bd a:hover {
  background: #f6f7fb;
}

/* Archive list cards（ざっくり） */
.searchBox {
  background: #fff6d3;
  border: 1px solid rgba(0, 0, 0, 0.06);
  /* border-radius: 18px; */
  padding: 18px;
}
.searchBox input {
  width: 100%;
  padding: 14px 14px;
  font-size: 16px;
  /* border-radius: 12px; */
  border: 1px solid rgba(0, 0, 0, 0.18);
}
.note {
  margin-top: 10px;
  font-size: 12px;
  color: rgba(0, 0, 0, 0.55);
}

.list {
  margin-top: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 0 30px;
}
.listItem {
  height: 78px;
  border-radius: 14px;
  border: 1px solid rgba(0, 0, 0, 0.25);
  background: #fff;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  gap: 14px;
  padding-left: 20%;
  text-decoration: none;
  color: inherit;
  /* font-weight: 800; */
  font-size: 18px;
}
.listItem__icon {
  width: 28px;
  height: 28px;
  opacity: 0.65;
}
