:root {
  --navy: #173650;
  --navy-2: #244b68;
  --cream: #fff8ee;
  --cream-2: #fffdf9;
  --peach: #f6ad67;
  --peach-soft: #fff0df;
  --blue-soft: #eaf4f8;
  --blue-line: #cfe1e9;
  --text: #182633;
  --muted: #728392;
  --line: #dce6eb;
  --white: #ffffff;
  --danger: #d75a5a;
  --shadow: 0 12px 34px rgba(23, 54, 80, .14);
  --header-h: 70px;
  --toolbar-h: 76px;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", sans-serif;
}

* { box-sizing: border-box; }
html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  color: var(--text);
  background: var(--cream);
  overscroll-behavior: none;
}
button, input, select, textarea { font: inherit; }
button, label { -webkit-tap-highlight-color: transparent; }
button {
  min-height: 44px;
  border: 1px solid var(--blue-line);
  border-radius: 14px;
  padding: 9px 13px;
  color: var(--navy);
  background: var(--white);
  font-weight: 750;
  cursor: pointer;
  touch-action: manipulation;
}
button:active, label:active { transform: scale(.98); }
button:disabled { opacity: .42; cursor: default; }
.hidden { display: none !important; }

.app-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  height: calc(var(--header-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 12px 0;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  background: var(--navy);
  color: var(--white);
  box-shadow: 0 4px 14px rgba(23, 54, 80, .18);
}
.icon-button {
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  font-size: 24px;
  line-height: 1;
}
.app-header .icon-button {
  border-color: rgba(255,255,255,.28);
  background: rgba(255,255,255,.11);
  color: var(--white);
}
.brand { min-width: 0; }
.brand-title { font-size: 21px; font-weight: 900; letter-spacing: .03em; }
.brand-sub {
  margin-top: 2px;
  max-width: 55vw;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: rgba(255,255,255,.74);
  font-size: 12px;
}
.header-actions { display: flex; align-items: center; gap: 8px; }
.save-button {
  min-width: 72px;
  border-color: var(--peach);
  background: var(--peach);
  color: #3e2b1c;
  font-weight: 900;
}

.main {
  position: fixed;
  top: calc(var(--header-h) + env(safe-area-inset-top));
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 46;
  display: flex;
  min-height: 0;
}
.workspace { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.side-panel {
  width: 360px;
  max-width: 92vw;
  height: 100%;
  padding: 0 14px 28px;
  overflow: auto;
  background: var(--cream-2);
  border-right: 1px solid var(--line);
  z-index: 70;
}
.side-panel.force-hidden { display: none !important; }
.drawer-head {
  position: sticky;
  top: 0;
  z-index: 2;
  min-height: 66px;
  margin: 0 -14px 12px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255,253,249,.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
  font-size: 19px;
}
.drawer-head .icon-button { background: var(--blue-soft); border-color: transparent; }
.compact-card {
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--white);
  box-shadow: 0 5px 16px rgba(23,54,80,.055);
}
.section-title { margin-bottom: 10px; font-weight: 900; color: var(--navy); }
textarea, select {
  width: 100%;
  border: 1px solid var(--blue-line);
  border-radius: 14px;
  padding: 12px;
  color: var(--text);
  background: var(--cream-2);
}
textarea { resize: vertical; }
.color-custom {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
}
.color-custom input[type="color"] {
  width: 58px;
  height: 40px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.palette { display: flex; gap: 9px; flex-wrap: wrap; }
.swatch {
  width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  border: 3px solid #fff;
  border-radius: 999px;
  box-shadow: 0 0 0 1px var(--blue-line);
}
.swatch.active { box-shadow: 0 0 0 3px var(--navy); }

.stepper-control {
  display: grid;
  grid-template-columns: 46px minmax(90px,1fr) 46px 58px;
  align-items: center;
  gap: 8px;
}
.step-button {
  width: 46px;
  min-width: 46px;
  min-height: 46px;
  padding: 0;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--blue-soft);
  border-color: var(--blue-line);
  color: var(--navy);
  font-size: 26px;
  line-height: 1;
}
.stepper-control input[type="range"], #zoomSlider {
  width: 100%;
  min-width: 72px;
  height: 36px;
  accent-color: var(--navy-2);
}
.stepper-control input[type="range"]::-webkit-slider-thumb,
#zoomSlider::-webkit-slider-thumb { width: 28px; height: 28px; }
.stepper-control output {
  min-width: 52px;
  padding: 7px 5px;
  border-radius: 11px;
  background: var(--cream);
  color: var(--navy);
  text-align: center;
  font-size: 13px;
  font-weight: 900;
}

.action-grid.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.action-grid .span-2 { grid-column: 1 / -1; }
button.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
button.primary-soft, .mini-file-label {
  background: var(--blue-soft);
  border-color: var(--blue-line);
  color: var(--navy);
}
button.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
button.danger-light { background: #fff4f3; border-color: #f3c9c6; color: #b44343; }
.file-label, .mini-file-label {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--blue-line);
  border-radius: 14px;
  padding: 9px 13px;
  font-weight: 800;
  cursor: pointer;
}
.file-label input, .mini-file-label input, .file-start-card input { display: none; }
.preset-list { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.preset-item {
  min-height: 40px;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--cream);
}
.preset-item.active, .preset-item.serial-active {
  background: var(--blue-soft);
  border-color: var(--navy-2);
  color: var(--navy);
}
.serial-next { margin-left: 4px; color: var(--muted); font-size: 11px; }
.serial-status {
  margin-top: 10px;
  padding: 9px 11px;
  border-radius: 12px;
  background: var(--cream);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.serial-status.active { background: #e8f7ed; color: #257040; }

.page-toolbar {
  flex: 0 0 auto;
  min-height: 60px;
  padding: 7px 10px;
  display: flex;
  align-items: center;
  gap: 7px;
  overflow-x: auto;
  white-space: nowrap;
  background: var(--cream-2);
  border-bottom: 1px solid var(--line);
  scrollbar-width: none;
}
.page-toolbar::-webkit-scrollbar, .tool-bar::-webkit-scrollbar { display: none; }
.page-toolbar button { flex: 0 0 auto; }
.page-label {
  min-width: 58px;
  color: var(--navy);
  text-align: center;
  font-weight: 900;
}
.toolbar-space { flex: 1 0 6px; }
.zoom-control {
  min-width: 270px;
  display: grid;
  grid-template-columns: 44px minmax(90px,1fr) 44px 58px;
  align-items: center;
  gap: 6px;
}
.zoom-control .step-button { width: 44px; min-width: 44px; min-height: 42px; }
#zoomLabel { text-align: center; color: var(--navy); font-size: 13px; font-weight: 900; }
#btnFit { background: var(--blue-soft); }

.scroll-area {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 14px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  background:
    radial-gradient(circle at 12px 12px, rgba(23,54,80,.035) 1.6px, transparent 1.8px) 0 0 / 24px 24px,
    var(--cream);
  -webkit-overflow-scrolling: touch;
  touch-action: none;
}
.empty-state {
  width: min(700px, 100%);
  margin: auto;
  padding: 22px;
  border-radius: 28px;
  background: rgba(255,255,255,.78);
  border: 1px solid rgba(207,225,233,.9);
  box-shadow: var(--shadow);
}
.start-mark { margin-bottom: 16px; text-align: center; font-size: 46px; }
.start-actions { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.start-card {
  min-height: 122px;
  padding: 16px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-radius: 22px;
  background: var(--white);
  color: var(--navy);
  border: 1px solid var(--blue-line);
  font-size: 16px;
  font-weight: 900;
  box-shadow: 0 6px 18px rgba(23,54,80,.08);
  cursor: pointer;
}
.blank-card { background: var(--peach-soft); border-color: #f5d1ad; }
.continue-card { grid-column: 1 / -1; min-height: 80px; flex-direction: row; background: var(--blue-soft); }
.start-icon {
  min-width: 54px;
  height: 54px;
  padding: 0 8px;
  display: grid;
  place-items: center;
  border-radius: 17px;
  background: var(--cream);
  color: var(--navy);
  font-size: 17px;
  font-weight: 950;
}
.page-wrap {
  position: relative;
  flex: 0 0 auto;
  line-height: 0;
  background: #fff;
  box-shadow: 0 12px 32px rgba(23,54,80,.22);
  transform-origin: 0 0;
  touch-action: none;
}
#pdfCanvas, #annoCanvas, #pdfLayer {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
}
#pdfCanvas { z-index: 1; }
#pdfLayer { z-index: 0; pointer-events: none; }
#annoCanvas { z-index: 3; touch-action: none; }
.page-wrap.zoom-preview { will-change: transform; }
body.tool-view .scroll-area { cursor: grab; }
.scroll-area.grabbing { cursor: grabbing !important; }

.tool-bar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 45;
  height: calc(var(--toolbar-h) + env(safe-area-inset-bottom));
  padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
  display: flex;
  gap: 7px;
  overflow-x: auto;
  background: rgba(255,253,249,.98);
  border-top: 1px solid var(--line);
  box-shadow: 0 -6px 22px rgba(23,54,80,.11);
}
.tool {
  flex: 0 0 66px;
  min-width: 66px;
  min-height: 58px;
  padding: 5px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: 16px;
  color: var(--navy);
}
.tool span { font-size: 22px; line-height: 1; }
.tool small { font-size: 10px; font-weight: 850; }
.tool.active { background: var(--peach-soft); border-color: var(--peach); color: #653b1b; }
body.has-document .main { bottom: calc(var(--toolbar-h) + env(safe-area-inset-bottom)); }

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(12,32,46,.52);
}
.modal-box {
  width: min(620px, 100%);
  max-height: min(800px, 90vh);
  overflow: auto;
  padding: 16px;
  border-radius: 26px;
  background: var(--cream-2);
  box-shadow: 0 22px 70px rgba(0,0,0,.28);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.modal-head h2 { margin: 0; color: var(--navy); font-size: 22px; }
.modal-head .icon-button { background: var(--blue-soft); border-color: transparent; }
.save-actions { display: grid; gap: 10px; margin-top: 16px; }
.save-choice {
  min-height: 78px;
  padding: 12px;
  display: grid;
  grid-template-columns: 58px 1fr;
  align-items: center;
  gap: 12px;
  text-align: left;
  border-radius: 20px;
}
.save-choice-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: var(--blue-soft);
  font-size: 16px;
  font-weight: 950;
}
.save-choice strong, .save-choice small { display: block; }
.save-choice strong { font-size: 17px; }
.save-choice small { margin-top: 4px; color: var(--muted); font-weight: 650; }
.primary-choice { background: var(--peach-soft); border-color: var(--peach); }
.primary-choice .save-choice-icon { background: var(--peach); color: #3e2b1c; }
.blank-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 18px; }
.blank-choice { min-height: 132px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; }
.paper { display: block; border: 2px solid var(--navy); background: #fff; box-shadow: 3px 4px 0 var(--blue-soft); }
.paper.portrait { width: 46px; height: 64px; }
.paper.landscape { width: 64px; height: 46px; }
.paper.a3.portrait { width: 52px; height: 74px; }
.paper.a3.landscape { width: 74px; height: 52px; }
.paper.square { width: 54px; height: 54px; }
.saved-project-list { display: grid; gap: 9px; margin-top: 15px; }
.saved-project-row { display: grid; grid-template-columns: minmax(0,1fr) 72px; gap: 8px; }
.saved-project-item { min-width: 0; text-align: left; }
.saved-project-name, .saved-project-meta { display: block; }
.saved-project-name { overflow-wrap: anywhere; font-weight: 900; }
.saved-project-meta { margin-top: 4px; color: var(--muted); font-size: 11px; }


.confirm-sheet {
  width: min(430px, 100%);
  padding: 24px 20px 20px;
  overflow: visible;
  text-align: center;
  border: 3px solid rgba(242,162,76,.45);
  background:
    radial-gradient(circle at 20% 0%, rgba(255,255,255,.95), transparent 32%),
    var(--cream-2);
}
.confirm-mark {
  width: 62px;
  height: 62px;
  margin: -6px auto 10px;
  display: grid;
  place-items: center;
  border-radius: 50% 50% 46% 46%;
  background: var(--peach-soft);
  border: 3px solid var(--peach);
  color: var(--navy);
  box-shadow: 0 7px 0 rgba(242,162,76,.18);
  font-size: 30px;
  font-weight: 950;
  transform: rotate(-4deg);
}
.confirm-title {
  margin: 0;
  color: var(--navy);
  font-size: 22px;
  line-height: 1.35;
}
.confirm-message {
  margin: 10px 0 0;
  color: #304b60;
  font-size: 16px;
  font-weight: 750;
  line-height: 1.65;
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 20px;
}
.confirm-actions button {
  min-height: 52px;
  border-radius: 18px;
  font-size: 16px;
  font-weight: 900;
}
.confirm-cancel {
  background: #fff;
  color: var(--navy);
  border-color: var(--blue-soft);
}
.confirm-ok {
  background: var(--peach);
  color: #3e2b1c;
  border-color: var(--peach);
  box-shadow: 0 4px 0 rgba(150,94,30,.18);
}
.confirm-ok.danger-confirm {
  background: #e96b70;
  border-color: #e96b70;
  color: #fff;
  box-shadow: 0 4px 0 rgba(112,35,40,.18);
}
.confirm-actions button:focus-visible {
  outline: 4px solid rgba(46,120,183,.28);
  outline-offset: 2px;
}
@media (max-width: 420px) {
  .confirm-sheet { padding: 22px 16px 16px; }
  .confirm-message { font-size: 15px; }
  .confirm-actions { grid-template-columns: 1fr; }
  .confirm-ok { order: -1; }
}

.drawer-backdrop {
  /* Keep this inside .main so it sits above the workspace but below the settings drawer. */
  position: fixed;
  inset: calc(var(--header-h) + env(safe-area-inset-top)) 0 0 0;
  z-index: 60;
  background: rgba(12,32,46,.38);
}
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--toolbar-h) + env(safe-area-inset-bottom) + 18px);
  z-index: 120;
  max-width: 88vw;
  padding: 11px 15px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  border-radius: 999px;
  background: rgba(23,54,80,.94);
  color: #fff;
  transform: translateX(-50%);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
  font-size: 13px;
  font-weight: 750;
}
.toast.show { opacity: 1; }

@media (max-width: 860px) {
  :root { --header-h: 64px; --toolbar-h: 72px; }
  .side-panel {
    position: fixed;
    top: calc(var(--header-h) + env(safe-area-inset-top));
    bottom: 0;
    left: 0;
    width: min(370px, 92vw);
    height: auto;
    box-shadow: 12px 0 36px rgba(23,54,80,.24);
  }
  .side-panel.open { display: block !important; }
  .brand-title { font-size: 19px; }
  .brand-sub { max-width: 38vw; }
  .header-actions { gap: 6px; }
  .save-button { min-width: 66px; padding-inline: 10px; }
  .page-toolbar { min-height: 58px; padding-inline: 7px; }
  .zoom-control { min-width: 246px; grid-template-columns: 42px 86px 42px 56px; }
  .scroll-area { padding: 9px; justify-content: flex-start; }
  .empty-state { padding: 16px; border-radius: 24px; }
  .start-mark { display: none; }
  .start-actions { gap: 10px; }
  .start-card { min-height: 112px; font-size: 15px; }
  .tool { flex-basis: 64px; min-width: 64px; }
  .modal { align-items: flex-end; padding: 8px; }
  .modal-box { width: 100%; max-height: 88vh; border-radius: 26px 26px 18px 18px; }
  .blank-actions { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 430px) {
  .blank-actions { grid-template-columns: repeat(2, 1fr); }
  .app-header { grid-template-columns: 44px minmax(0,1fr) auto; padding-inline: 8px; }
  .app-header .icon-button { width: 40px; min-width: 40px; height: 40px; min-height: 40px; }
  .brand-sub { max-width: 42vw; }
  .start-card { min-height: 102px; padding: 12px 8px; }
  .start-icon { height: 48px; min-width: 48px; border-radius: 15px; }
  .stepper-control { grid-template-columns: 44px minmax(78px,1fr) 44px 54px; gap: 6px; }
  .blank-choice { min-height: 116px; padding-inline: 4px; }
  .blank-choice strong { font-size: 13px; }
  .saved-project-row { grid-template-columns: 1fr; }
}

body.original-preview #annoCanvas { pointer-events: none !important; }
#btnOriginalPdf.original-active { background: var(--navy); color: #fff; }
body.drag-over .scroll-area { outline: 4px dashed var(--navy-2); outline-offset: -10px; }
.pdf-layer { overflow: hidden; background: #fff; }
.pdf-layer svg { display: block; }
.pdf-text-span { position: absolute; white-space: pre; line-height: 1; transform-origin: left top; }

.hint { padding: 16px; color: var(--muted); text-align: center; }
/* PCテスト版だけの目印 */
body::after {
  content: "PCテスト版";
  position: fixed;
  right: 10px;
  bottom: calc(74px + env(safe-area-inset-bottom));
  z-index: 35;
  padding: 4px 9px;
  border-radius: 999px;
  color: #173650;
  background: rgba(255, 248, 229, .9);
  border: 1px solid rgba(23, 54, 80, .18);
  font-size: 11px;
  font-weight: 800;
  pointer-events: none;
}
@media (min-width: 900px) {
  body::after { bottom: 12px; }
}


/* うちわ統合版: 文字・きおく文字操作 */
.wide-action-button {
  width: 100%;
  min-height: 44px;
  margin-top: 10px;
}
.field-hint {
  margin: 8px 0 0;
  color: var(--muted, #64748b);
  font-size: 12px;
  line-height: 1.5;
}

.photo-adjust-box {
  width: min(1100px, 100%);
  max-height: min(920px, 94vh);
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.photo-adjust-header {
  flex: 0 0 auto;
  padding: 12px 14px;
  display: grid;
  grid-template-columns: 44px minmax(0,1fr) auto;
  gap: 10px;
  align-items: center;
  background: var(--navy);
  color: #fff;
}
.photo-adjust-title-wrap { min-width: 0; }
.photo-adjust-header h2 {
  margin: 0;
  font-size: 21px;
  color: #fff;
}
.photo-adjust-sub {
  margin: 4px 0 0;
  font-size: 12px;
  color: rgba(255,255,255,.74);
}
.photo-adjust-header .icon-button {
  border-color: rgba(255,255,255,.28);
  background: rgba(255,255,255,.11);
  color: #fff;
}
.photo-done-button { min-width: 82px; }
.photo-adjust-stage-wrap {
  flex: 1 1 auto;
  min-height: 240px;
  padding: 12px;
  background:
    radial-gradient(circle at 12px 12px, rgba(23,54,80,.045) 1.6px, transparent 1.8px) 0 0 / 24px 24px,
    var(--cream);
}
.photo-adjust-stage {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.78);
  overflow: hidden;
}
#photoPreviewCanvas, #photoOverlayCanvas {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: none;
  max-height: none;
}
#photoPreviewCanvas { z-index: 1; background: #fff; box-shadow: 0 8px 24px rgba(23,54,80,.16); }
#photoOverlayCanvas { z-index: 2; touch-action: none; }
.photo-adjust-panels {
  flex: 0 0 auto;
  max-height: 42vh;
  padding: 12px;
  overflow: auto;
  background: var(--cream-2);
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 10px;
}
.photo-card {
  padding: 12px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--white);
  box-shadow: 0 5px 16px rgba(23,54,80,.05);
}
.photo-card-title {
  margin-bottom: 10px;
  font-weight: 900;
  color: var(--navy);
}
.photo-button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.photo-mini-toggle.active,
.photo-tool-active {
  background: var(--peach-soft);
  border-color: var(--peach);
  color: #653b1b;
}
.photo-help {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.photo-size-info {
  margin-top: 8px;
  padding: 9px 11px;
  border-radius: 12px;
  background: var(--cream);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.photo-brush-row {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 44px minmax(80px,1fr) 58px;
  gap: 8px;
  align-items: center;
}
.photo-brush-row output {
  min-width: 52px;
  padding: 7px 5px;
  border-radius: 11px;
  background: var(--cream);
  color: var(--navy);
  text-align: center;
  font-size: 13px;
  font-weight: 900;
}
.photo-brush-row input[type="range"] {
  width: 100%;
  accent-color: var(--navy-2);
}
@media (max-width: 860px) {
  .photo-adjust-box {
    width: 100%;
    max-height: 100vh;
    border-radius: 0;
  }
  .photo-adjust-stage-wrap { min-height: 32vh; padding: 8px; }
  .photo-adjust-stage { min-height: 220px; }
  .photo-adjust-panels {
    grid-template-columns: 1fr;
    max-height: 44vh;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }
}

/* きおく文字・文字コマンドの下から出る入力欄 */
.memory-text-actions,
.command-sheet-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}
.memory-preset-list {
  max-height: 190px;
  overflow: auto;
  padding: 4px 2px 2px;
}
.memory-preset-list .preset-item {
  min-height: 44px;
  font-size: 15px;
}
.command-sheet {
  position: fixed;
  right: 10px;
  bottom: calc(var(--toolbar-h) + env(safe-area-inset-bottom) + 10px);
  left: 10px;
  z-index: 92;
  width: min(680px, calc(100% - 20px));
  max-height: min(48vh, 430px);
  margin: 0 auto;
  padding: 14px;
  overflow: auto;
  border: 2px solid var(--blue-line);
  border-radius: 24px;
  background: var(--cream-2);
  box-shadow: 0 16px 50px rgba(12,32,46,.28);
}
.command-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  color: var(--navy);
  font-size: 19px;
}
.command-sheet-head .icon-button {
  background: var(--blue-soft);
  border-color: transparent;
}
.command-sheet textarea {
  min-height: 76px;
  resize: none;
  font-size: 17px;
}
.command-memory-list {
  margin-top: 12px;
  max-height: 150px;
}
body.text-command-open .toast,
body.memory-command-open .toast {
  bottom: calc(var(--toolbar-h) + env(safe-area-inset-bottom) + 250px);
}
@media (max-width: 520px) {
  .command-sheet {
    right: 6px;
    bottom: calc(var(--toolbar-h) + env(safe-area-inset-bottom) + 6px);
    left: 6px;
    width: calc(100% - 12px);
    max-height: 52vh;
    padding: 12px;
    border-radius: 22px;
  }
  .command-sheet-actions,
  .memory-text-actions {
    grid-template-columns: 1fr;
  }
  .command-sheet textarea { min-height: 68px; }
  body.text-command-open .toast,
  body.memory-command-open .toast {
    bottom: calc(var(--toolbar-h) + env(safe-area-inset-bottom) + 280px);
  }
}

/* 写真調整: 拡大縮小・移動 */
#photoPreviewCanvas,
#photoOverlayCanvas {
  transform-origin: center center;
  will-change: transform;
}
.photo-zoom-bar {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border: 1px solid rgba(207,225,233,.95);
  border-radius: 16px;
  background: rgba(255,253,249,.94);
  box-shadow: 0 6px 18px rgba(23,54,80,.14);
  backdrop-filter: blur(8px);
}
.photo-zoom-bar button {
  min-height: 40px;
  padding: 7px 10px;
  border-radius: 12px;
}
.photo-zoom-button {
  width: 42px;
  min-width: 42px;
  padding: 0 !important;
  font-size: 24px;
  line-height: 1;
}
.photo-zoom-label {
  min-width: 54px;
  color: var(--navy);
  text-align: center;
  font-size: 13px;
  font-weight: 900;
}
.photo-landscape-scroll-hint {
  display: none;
  position: absolute;
  left: 50%;
  bottom: 60px;
  z-index: 7;
  max-width: calc(100% - 24px);
  padding: 6px 11px;
  border-radius: 999px;
  color: #fff;
  background: rgba(23,54,80,.82);
  transform: translateX(-50%);
  font-size: 11px;
  font-weight: 800;
  pointer-events: none;
  white-space: nowrap;
}
#btnPhotoPanMode.photo-tool-active {
  background: var(--peach-soft);
  border-color: var(--peach);
  color: #653b1b;
}

/* スマホ横持ち: 写真と全コマンドを縦スクロール可能にする */
@media (orientation: landscape) and (max-height: 650px) {
  #photoAdjustModal {
    display: block;
    padding: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    background: var(--cream-2);
  }
  #photoAdjustModal .photo-adjust-box {
    width: 100%;
    max-width: none;
    min-height: 100dvh;
    max-height: none;
    overflow: visible;
    display: block;
    border-radius: 0;
    box-shadow: none;
  }
  #photoAdjustModal .photo-adjust-header {
    position: sticky;
    top: 0;
    z-index: 20;
    min-height: 58px;
    padding-top: max(7px, env(safe-area-inset-top));
    padding-bottom: 7px;
  }
  #photoAdjustModal .photo-adjust-header h2 { font-size: 18px; }
  #photoAdjustModal .photo-adjust-sub { display: none; }
  #photoAdjustModal .photo-adjust-stage-wrap {
    height: max(250px, calc(100dvh - 58px));
    min-height: 250px;
    padding: 8px;
  }
  #photoAdjustModal .photo-adjust-stage {
    height: 100%;
    min-height: 230px;
  }
  #photoAdjustModal .photo-adjust-panels {
    max-height: none;
    overflow: visible;
    grid-template-columns: repeat(2, minmax(0,1fr));
    padding: 10px 10px calc(18px + env(safe-area-inset-bottom));
  }
  #photoAdjustModal .photo-card { padding: 10px; }
  #photoAdjustModal .photo-landscape-scroll-hint { display: block; }
  #photoAdjustModal .photo-zoom-bar {
    right: 6px;
    bottom: 6px;
    gap: 4px;
    padding: 4px;
  }
  #photoAdjustModal .photo-zoom-bar button {
    min-height: 38px;
    padding: 6px 8px;
  }
}

@media (orientation: landscape) and (max-height: 480px) {
  #photoAdjustModal .photo-adjust-stage-wrap {
    height: max(220px, calc(100dvh - 54px));
  }
  #photoAdjustModal .photo-adjust-panels {
    grid-template-columns: repeat(2, minmax(0,1fr));
  }
  #photoAdjustModal .photo-zoom-label { min-width: 46px; }
}

@media (max-width: 430px) and (orientation: portrait) {
  .photo-zoom-bar {
    right: 5px;
    bottom: 5px;
    gap: 4px;
    padding: 4px;
  }
  .photo-zoom-bar button { min-height: 38px; padding: 6px 8px; }
  .photo-zoom-label { min-width: 46px; }
}


/* Web v7.5.71: Android標準のselect画面を使わない線種ボタン */
.line-style-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.line-style-button {
  min-width: 0;
  min-height: 54px;
  padding: 8px 10px;
  display: grid;
  grid-template-columns: minmax(44px, 1fr) auto;
  align-items: center;
  gap: 8px;
  background: var(--cream-2);
  color: var(--navy);
}
.line-style-button.active {
  background: var(--peach-soft);
  border-color: var(--peach);
  box-shadow: inset 0 0 0 1px var(--peach);
}
.line-style-sample {
  display: block;
  width: 100%;
  min-width: 42px;
  height: 4px;
  border-radius: 999px;
  background-color: var(--navy);
}
.line-style-sample.dash {
  background: repeating-linear-gradient(90deg, var(--navy) 0 15px, transparent 15px 24px);
}
.line-style-sample.dot {
  background: repeating-linear-gradient(90deg, var(--navy) 0 4px, transparent 4px 11px);
}
.line-style-sample.dashdot {
  background: repeating-linear-gradient(90deg, var(--navy) 0 15px, transparent 15px 21px, var(--navy) 21px 25px, transparent 25px 32px);
}

/* 狭いスマホでも拡大縮小の％表示が画面外へ出ない */
@media (max-width: 620px) {
  .page-toolbar {
    display: grid;
    grid-template-columns: 40px 58px 40px minmax(76px, 1fr) 40px 40px;
    grid-template-rows: 44px 46px;
    gap: 6px;
    min-height: 108px;
    overflow: hidden;
    white-space: normal;
    align-items: center;
  }
  .page-toolbar > #btnPrev { grid-column: 1; grid-row: 1; }
  .page-toolbar > .page-label { grid-column: 2; grid-row: 1; min-width: 0; }
  .page-toolbar > #btnNext { grid-column: 3; grid-row: 1; }
  .page-toolbar > #btnFit { grid-column: 4; grid-row: 1; width: 100%; min-width: 0; padding-inline: 6px; }
  .page-toolbar > #btnUndo { grid-column: 5; grid-row: 1; }
  .page-toolbar > #btnRedo { grid-column: 6; grid-row: 1; }
  .page-toolbar > .toolbar-space { display: none; }
  .page-toolbar > .zoom-control {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    min-width: 0;
    grid-template-columns: 42px minmax(60px, 1fr) 42px minmax(54px, auto);
    gap: 6px;
  }
  .page-toolbar > #btnFinishPolyline {
    grid-column: 1 / -1;
    width: 100%;
  }
  #zoomLabel {
    min-width: 54px;
    padding-inline: 2px;
    white-space: nowrap;
    overflow: visible;
  }
}

@media (max-width: 370px) {
  .page-toolbar {
    grid-template-columns: 38px 52px 38px minmax(64px, 1fr) 38px 38px;
    gap: 4px;
    padding-inline: 5px;
  }
  .page-toolbar .icon-button,
  .page-toolbar .step-button {
    width: 38px;
    min-width: 38px;
  }
  .page-toolbar > .zoom-control {
    grid-template-columns: 38px minmax(48px, 1fr) 38px 52px;
    gap: 4px;
  }
  #zoomLabel { min-width: 52px; font-size: 12px; }
  .line-style-buttons { grid-template-columns: 1fr; }
}


/* 写真調整: 画像を触れる範囲を広げるため、拡大縮小バーを画像の外へ出す */
.photo-adjust-stage-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.photo-adjust-stage {
  flex: 1 1 auto;
  min-height: 300px;
}
.photo-zoom-toolbar-wrap {
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
}
.photo-zoom-bar {
  position: static;
  width: 100%;
  max-width: 720px;
  display: grid;
  grid-template-columns: minmax(88px,1.2fr) 52px minmax(52px,.7fr) 52px minmax(74px,.9fr) minmax(84px,1fr);
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: rgba(255,253,249,.98);
  box-shadow: 0 6px 18px rgba(23,54,80,.08);
}
.photo-zoom-bar button {
  min-height: 52px;
}
.photo-landscape-scroll-hint {
  bottom: 10px;
}
@media (max-width: 860px) {
  .photo-adjust-stage-wrap {
    min-height: 0;
  }
  .photo-adjust-stage {
    min-height: 240px;
  }
  .photo-zoom-bar {
    grid-template-columns: minmax(80px,1.2fr) 48px minmax(48px,.65fr) 48px minmax(66px,.9fr) minmax(78px,1fr);
    gap: 6px;
    padding: 6px;
  }
  .photo-zoom-bar button { min-height: 46px; }
}
@media (max-width: 430px) {
  .photo-zoom-bar {
    grid-template-columns: minmax(72px,1.1fr) 44px minmax(44px,.6fr) 44px minmax(60px,.85fr) minmax(70px,.9fr);
    gap: 5px;
    padding: 5px;
  }
  .photo-zoom-label {
    min-width: 0;
    font-size: 14px;
  }
  .photo-zoom-bar button {
    min-height: 42px;
    padding: 6px 6px;
  }
}
@media (orientation: landscape) and (max-height: 650px) {
  #photoAdjustModal .photo-adjust-stage-wrap {
    height: auto;
    min-height: 0;
  }
  #photoAdjustModal .photo-adjust-stage {
    height: min(62dvh, 360px);
    min-height: 220px;
  }
  #photoAdjustModal .photo-zoom-toolbar-wrap {
    padding-inline: 8px;
  }
  #photoAdjustModal .photo-zoom-bar {
    max-width: none;
    grid-template-columns: minmax(82px,1.1fr) 46px minmax(44px,.6fr) 46px minmax(60px,.8fr) minmax(72px,.9fr);
  }
  #photoAdjustModal .photo-adjust-panels {
    padding-top: 6px;
  }
}

/* お絵かき編集範囲改善: 下の道具欄を必要な時だけ表示 */
.tool-bar {
  transition: transform .2s ease, opacity .2s ease;
}
.tool-bar-toggle {
  position: fixed;
  right: 10px;
  bottom: calc(var(--toolbar-h) + env(safe-area-inset-bottom) + 8px);
  z-index: 48;
  min-height: 42px;
  padding: 7px 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--blue-line);
  border-radius: 999px;
  background: rgba(255,253,249,.97);
  color: var(--navy);
  box-shadow: 0 7px 22px rgba(23,54,80,.18);
  font-size: 12px;
  font-weight: 900;
}
.tool-bar-toggle-icon {
  font-size: 18px;
  line-height: 1;
}
body.tool-bar-collapsed .tool-bar {
  transform: translateY(115%);
  opacity: 0;
  pointer-events: none;
}
body.tool-bar-collapsed.has-document .main {
  bottom: 0;
}
body.tool-bar-collapsed .tool-bar-toggle {
  bottom: calc(8px + env(safe-area-inset-bottom));
}
body.tool-bar-collapsed .command-sheet {
  bottom: calc(58px + env(safe-area-inset-bottom));
}

/* 文字入力欄の長押しでAndroidのアプリ付きメニューを出さない */
.no-native-longpress {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
.no-native-longpress:focus {
  -webkit-user-select: text;
  user-select: text;
}

/* スマホ横持ち: タイトルと操作欄を薄くして編集範囲を優先 */
@media (orientation: landscape) and (max-height: 650px) {
  :root {
    --header-h: 50px;
    --toolbar-h: 62px;
  }
  .app-header {
    grid-template-columns: 38px minmax(0,1fr) auto;
    gap: 6px;
    padding-right: 8px;
    padding-left: 8px;
  }
  .app-header .icon-button {
    width: 36px;
    min-width: 36px;
    height: 36px;
    min-height: 36px;
    font-size: 21px;
  }
  .brand-title {
    font-size: 17px;
    line-height: 1.05;
  }
  .brand-sub {
    margin-top: 1px;
    max-width: 56vw;
    font-size: 10px;
    line-height: 1.05;
  }
  .header-actions {
    gap: 5px;
  }
  .save-button {
    min-width: 58px;
    min-height: 36px;
    padding: 5px 9px;
    border-radius: 12px;
    font-size: 14px;
  }
  .page-toolbar {
    min-height: 46px;
    height: 46px;
    padding: 3px 7px;
    gap: 5px;
    display: flex;
    grid-template-columns: none;
    grid-template-rows: none;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
  }
  .page-toolbar > * {
    grid-column: auto !important;
    grid-row: auto !important;
  }
  .page-toolbar .icon-button,
  .page-toolbar .step-button {
    width: 38px;
    min-width: 38px;
    height: 38px;
    min-height: 38px;
  }
  .page-toolbar > #btnFit {
    width: auto;
    min-width: 76px;
    min-height: 38px;
    padding: 5px 10px;
  }
  .page-toolbar > .toolbar-space {
    display: block;
    flex: 1 0 4px;
  }
  .page-toolbar > .zoom-control {
    width: auto;
    min-width: 230px;
    display: grid;
    grid-template-columns: 38px minmax(72px,1fr) 38px 50px;
    gap: 5px;
  }
  #zoomLabel {
    min-width: 50px;
    font-size: 12px;
  }
  .scroll-area {
    padding: 6px;
  }
  .tool-bar-toggle {
    right: 6px;
    min-height: 36px;
    padding: 5px 9px;
    font-size: 11px;
  }
  .tool-bar-toggle-icon {
    font-size: 16px;
  }
  .tool {
    flex-basis: 58px;
    min-width: 58px;
    min-height: 50px;
    padding: 4px 3px;
  }
  .tool span { font-size: 19px; }
  .tool small { font-size: 9px; }
  .command-sheet {
    max-height: calc(100dvh - 106px);
    bottom: calc(var(--toolbar-h) + env(safe-area-inset-bottom) + 5px);
    padding: 10px;
  }
  .command-sheet textarea {
    min-height: 54px;
  }
  body.tool-bar-collapsed .command-sheet {
    bottom: calc(48px + env(safe-area-inset-bottom));
  }
}

/* Web 7.5.75 / Android 0.4.69:
   横持ちでキーボードが出たときは、文字入力を専用の小さな入力画面にする。
   Android WebViewの自動スクロールで入力欄だけがヘッダー上へ飛ぶのを防ぐ。 */
:root {
  --oekaki-visual-top: 0px;
  --oekaki-visual-height: 100dvh;
}
@media (orientation: landscape) and (max-height: 650px) {
  body.text-keyboard-active .app-header,
  body.text-keyboard-active .page-toolbar,
  body.text-keyboard-active .tool-bar,
  body.text-keyboard-active .tool-bar-toggle {
    visibility: hidden !important;
    pointer-events: none !important;
  }
  body.text-keyboard-active .main {
    top: 0 !important;
    bottom: 0 !important;
  }
  body.text-keyboard-active .command-sheet:not(.hidden) {
    position: fixed;
    top: calc(var(--oekaki-visual-top) + 4px);
    right: 6px;
    bottom: auto !important;
    left: 6px;
    z-index: 220;
    width: calc(100% - 12px);
    max-height: calc(var(--oekaki-visual-height) - 8px);
    margin: 0;
    padding: 8px 10px;
    overflow-y: auto;
    border-radius: 16px;
    box-shadow: 0 8px 28px rgba(12,32,46,.32);
  }
  body.text-keyboard-active .command-sheet-head {
    min-height: 38px;
    margin-bottom: 6px;
    font-size: 16px;
  }
  body.text-keyboard-active .command-sheet-head .icon-button {
    width: 36px;
    min-width: 36px;
    height: 36px;
    min-height: 36px;
    font-size: 20px;
  }
  body.text-keyboard-active .command-sheet textarea {
    min-height: 42px;
    max-height: 54px;
    padding: 8px 10px;
    font-size: 16px;
    line-height: 1.25;
  }
  body.text-keyboard-active .command-sheet-actions,
  body.text-keyboard-active .memory-text-actions {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-top: 6px;
  }
  body.text-keyboard-active .command-sheet-actions button,
  body.text-keyboard-active .memory-text-actions button {
    min-height: 40px;
    padding: 6px 8px;
    font-size: 13px;
  }
  body.text-keyboard-active .field-hint,
  body.text-keyboard-active .command-memory-list {
    display: none !important;
  }
}


/* PDF編集 standalone */
.header-spacer {
  width: 44px;
  min-width: 44px;
  height: 44px;
}
.palette-button {
  font-size: 23px !important;
}
.page-edit-status {
  margin-bottom: 10px;
  padding: 9px 11px;
  border-radius: 12px;
  background: var(--blue-soft);
  color: var(--navy);
  font-size: 12px;
  font-weight: 900;
}
.page-edit-block {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.page-edit-block:first-of-type {
  margin-top: 0;
}
.page-edit-label {
  display: block;
  margin-bottom: 7px;
  color: var(--navy);
  font-size: 13px;
  font-weight: 900;
}
.page-edit-input {
  width: 100%;
  min-height: 44px;
  margin-bottom: 8px;
  border: 1px solid var(--blue-line);
  border-radius: 14px;
  padding: 10px 12px;
  background: var(--cream-2);
  color: var(--text);
}


/* V8: canvas上で直接文字入力・編集 */
.inline-text-editor {
  position: absolute;
  z-index: 25;
  box-sizing: border-box;
  min-width: 90px;
  min-height: 32px;
  padding: 2px 5px;
  margin: 0;
  border: 2px solid #2e78b7;
  border-radius: 5px;
  outline: none;
  resize: none;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.94);
  font-family: "Noto Sans JP", "Yu Gothic", Meiryo, sans-serif;
  font-weight: 700;
  white-space: pre-wrap;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.inline-text-editor:focus {
  border-color: #173650;
  box-shadow: 0 0 0 2px rgba(46,120,183,.22), 0 2px 8px rgba(0,0,0,.15);
}


/* V9: きおく文字と連番を統合 */
.memory-preset-list,
#quickTextPresets {
  align-items: flex-start;
}

.memory-preset-chip {
  position: relative;
  display: inline-flex;
  align-items: stretch;
  margin: 2px 3px 10px 0;
  padding: 0 8px 7px 0;
}

.memory-preset-chip .memory-main-button {
  min-width: 58px;
  min-height: 42px;
  padding-right: 19px;
}

.memory-preset-chip .memory-serial-button {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 3;
  min-width: 34px;
  min-height: 24px;
  height: 24px;
  padding: 1px 5px;
  border-radius: 10px;
  border: 1px solid #2e78b7;
  background: #eaf4ff;
  color: #173650;
  font-size: 10px;
  line-height: 1;
  font-weight: 900;
  box-shadow: 0 1px 3px rgba(0,0,0,.12);
}

.memory-preset-chip .memory-serial-button:hover {
  background: #d9ecff;
}

.memory-preset-chip .memory-serial-next {
  position: absolute;
  left: 4px;
  bottom: -7px;
  max-width: 72px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #64748b;
  font-size: 9px;
  line-height: 1;
  pointer-events: none;
}

.memory-preset-chip.number-only .memory-main-button {
  min-width: 74px;
}

.memory-preset-chip.compact {
  margin-bottom: 8px;
}

.memory-preset-chip.compact .memory-main-button {
  min-width: 52px;
  min-height: 38px;
  padding: 6px 17px 6px 8px;
}

.memory-preset-chip.compact .memory-serial-button {
  min-width: 30px;
  height: 22px;
  min-height: 22px;
  font-size: 9px;
}

.memory-preset-chip.compact .memory-serial-next {
  display: none;
}


/* V10: 編集パレットのsticky見出しより123バッジが前に出る問題を修正 */
.side-panel {
  isolation: isolate;
}

.drawer-head {
  z-index: 100 !important;
}

.compact-card,
.memory-preset-list,
.memory-preset-chip {
  position: relative;
  z-index: 0;
}

.memory-preset-chip .memory-serial-button {
  z-index: 1 !important;
}


/* V11: 関連リンク + PC上部道具バー */
.app-header {
  grid-template-columns: minmax(180px, 1fr) auto auto;
}

.site-nav {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.site-nav a {
  padding: 7px 10px;
  border-radius: 999px;
  color: rgba(255,255,255,.88);
  text-decoration: none;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}
.site-nav a:hover { background: rgba(255,255,255,.12); color:#fff; }

.site-nav-menu { position: relative; display: none; }
.site-nav-menu summary {
  list-style: none;
  cursor: pointer;
  padding: 8px 10px;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 999px;
  background: rgba(255,255,255,.10);
  color:#fff;
  font-size:12px;
  font-weight:900;
}
.site-nav-menu summary::-webkit-details-marker { display:none; }
.site-nav-menu-panel {
  position:absolute;
  top:calc(100% + 8px);
  right:0;
  z-index:90;
  min-width:170px;
  padding:7px;
  display:grid;
  gap:3px;
  border:1px solid var(--line);
  border-radius:14px;
  background:#fff;
  box-shadow:0 12px 34px rgba(23,54,80,.22);
}
.site-nav-menu-panel a {
  padding:9px 10px;
  border-radius:10px;
  color:var(--navy);
  text-decoration:none;
  font-size:13px;
  font-weight:800;
}
.site-nav-menu-panel a:hover { background:var(--blue-soft); }

.seo-intro {
  margin-top:18px;
  padding:14px 16px;
  border-top:1px solid var(--line);
  color:var(--muted);
  text-align:left;
}
.seo-intro h1 { margin:0 0 6px; color:var(--navy); font-size:17px; }
.seo-intro p { margin:0; line-height:1.65; font-size:12px; }
.seo-intro a { display:inline-block; margin-top:7px; color:#2e78b7; font-size:12px; font-weight:800; }

/* 1100px以上は道具を1/1の右側へ */
@media (min-width:1100px) {
  :root { --toolbar-h:0px; }

  body.has-document .main,
  body.tool-bar-collapsed.has-document .main {
    bottom:0;
  }

  .page-toolbar {
    min-height:58px;
    overflow:hidden;
    gap:5px;
  }

  .page-toolbar > .tool-bar {
    position:static;
    inset:auto;
    z-index:auto;
    width:auto;
    height:auto;
    min-width:0;
    max-width:none;
    padding:0;
    flex:1 1 auto;
    gap:3px;
    overflow-x:auto;
    background:transparent;
    border:0;
    box-shadow:none;
    transform:none !important;
    opacity:1 !important;
    pointer-events:auto !important;
  }

  .page-toolbar > .tool-bar .tool {
    flex:0 0 45px;
    min-width:45px;
    min-height:44px;
    padding:3px 2px;
    gap:1px;
    border-radius:11px;
  }
  .page-toolbar > .tool-bar .tool span { font-size:17px; }
  .page-toolbar > .tool-bar .tool small { font-size:8px; }

  .page-toolbar .toolbar-space { flex:0 0 4px; }

  .page-toolbar .zoom-control {
    min-width:220px;
    grid-template-columns:38px minmax(70px,1fr) 38px 48px;
  }
  .page-toolbar .zoom-control .step-button {
    width:38px;
    min-width:38px;
    min-height:38px;
  }
  .page-toolbar #btnFit { padding-inline:9px; }

  .tool-bar-toggle { display:none !important; }
}

/* 狭い画面は従来どおり下部 */
@media (max-width:1099px) {
  .site-nav { display:none; }
  .site-nav-menu { display:block; }

  .app-header { grid-template-columns:minmax(0,1fr) auto; }
  .brand-sub { max-width:48vw; }

  .page-toolbar > .tool-bar {
    position:fixed;
    right:0;
    bottom:0;
    left:0;
    z-index:45;
    height:calc(var(--toolbar-h) + env(safe-area-inset-bottom));
    padding:7px 8px calc(7px + env(safe-area-inset-bottom));
    display:flex;
    gap:7px;
    overflow-x:auto;
    background:rgba(255,253,249,.98);
    border-top:1px solid var(--line);
    box-shadow:0 -6px 22px rgba(23,54,80,.11);
  }
}

@media (max-width:560px) {
  .site-nav-menu summary {
    width:38px;
    overflow:hidden;
    white-space:nowrap;
    text-indent:-9999px;
    position:relative;
  }
  .site-nav-menu summary::after {
    content:"↗";
    position:absolute;
    inset:0;
    display:grid;
    place-items:center;
    text-indent:0;
    font-size:18px;
  }
  .seo-intro { display:none; }
}
