:root {
  font-family: "Noto Sans JP", "Yu Gothic", Meiryo, sans-serif;
  color: #17212b;
  background: #eef2f1;
  font-synthesis: none;
  --green: #166534;
  --green-dark: #14532d;
  --line: #d8dfdc;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: #eef2f1; }
body.editing { overflow: hidden; }
button, input { font: inherit; }
button { touch-action: manipulation; }
[hidden] { display: none !important; }

.app-header {
  display: flex;
  align-items: center;
  min-height: 72px;
  padding: 10px 14px;
  padding-top: calc(10px + var(--safe-top));
  color: white;
  background: linear-gradient(135deg, var(--green-dark), var(--green));
  box-shadow: 0 2px 12px rgb(0 0 0 / 18%);
}
.header-brand { display: flex; align-items: center; gap: 10px; }
.header-logo { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; background: white; }
.app-header h1 { margin: 0; font-size: 19px; }
.app-header p { margin: 2px 0 0; font-size: 11px; opacity: .82; }

.start-panel { min-height: calc(100dvh - 150px); display: grid; place-items: center; padding: 24px; }
.start-card {
  width: min(100%, 430px);
  padding: 30px 22px;
  border-radius: 20px;
  text-align: center;
  background: white;
  box-shadow: 0 10px 35px rgb(20 60 43 / 12%);
}
.hero-logo { width: 108px; height: 108px; border-radius: 50%; object-fit: cover; box-shadow: 0 6px 18px rgb(0 0 0 / 10%); }
.start-card h2 { margin: 16px 0 10px; font-size: 22px; }
.start-card p { color: #56616b; line-height: 1.65; }
.file-button {
  display: inline-block;
  margin-top: 10px;
  padding: 13px 22px;
  border-radius: 12px;
  color: white;
  font-weight: 700;
  background: var(--green);
  cursor: pointer;
}
.file-button input { display: none; }
.small-note { font-size: 12px; }
.app-footer { padding: 14px 16px calc(16px + var(--safe-bottom)); color: #64706b; font-size: 12px; text-align: center; }
.app-footer nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 14px; margin-top: 8px; }
.app-footer a { color: #315f4a; text-decoration: none; }
.app-footer a:hover { text-decoration: underline; }

.editor-panel {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #eef2f1;
}
.editor-shell {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.editor-topbar {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  min-height: 58px;
  padding: 7px 9px;
  padding-top: calc(7px + var(--safe-top));
  color: white;
  background: linear-gradient(135deg, var(--green-dark), var(--green));
  box-shadow: 0 2px 10px rgb(0 0 0 / 20%);
}
.page-nav { display: flex; align-items: center; justify-content: center; gap: 9px; min-width: 0; }
.page-nav strong { min-width: 54px; text-align: center; font-size: 17px; white-space: nowrap; }
.topbar-button {
  min-height: 42px;
  border: 0;
  border-radius: 11px;
  padding: 8px 12px;
  font-weight: 700;
  background: white;
}
.topbar-button.secondary { color: #41504a; font-size: 12px; }
.topbar-button.square { min-width: 42px; padding-inline: 8px; color: #087ac1; font-size: 19px; }
.topbar-button.save { color: var(--green-dark); font-size: 15px; }
.topbar-button:disabled { opacity: .45; }

.document-area { position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; background: #cfd6d3; }
.canvas-stage { position: absolute; inset: 0; overflow: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.canvas-content { width: max-content; min-width: 100%; min-height: 100%; padding: 16px; }
.canvas-wrap {
  position: relative;
  margin: 0 auto;
  line-height: 0;
  background: white;
  box-shadow: 0 5px 22px rgb(0 0 0 / 28%);
}
.canvas-wrap canvas { display: block; width: 100%; height: 100%; }
#overlayCanvas { position: absolute; inset: 0; touch-action: none; cursor: crosshair; }
.loading-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #334155;
  font-weight: 700;
  background: rgb(255 255 255 / 78%);
}
.loading-overlay[hidden] { display: none !important; }

.floating-zoom {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px;
  border: 1px solid rgb(0 0 0 / 12%);
  border-radius: 14px;
  background: rgb(255 255 255 / 94%);
  box-shadow: 0 4px 16px rgb(0 0 0 / 20%);
  backdrop-filter: blur(8px);
}
.floating-zoom button {
  min-width: 40px;
  min-height: 40px;
  border: 1px solid #cad3cf;
  border-radius: 10px;
  color: #24312c;
  font-weight: 800;
  background: white;
}
.floating-zoom strong { min-width: 50px; text-align: center; font-size: 12px; }
.floating-zoom .zoom-text-button { min-width: 46px; padding-inline: 7px; font-size: 11px; }

.context-panel {
  flex: 0 0 auto;
  padding: 8px 9px 6px;
  border-top: 1px solid #b8c7c0;
  background: rgb(255 255 255 / 98%);
  box-shadow: 0 -2px 12px rgb(0 0 0 / 10%);
}
.context-text-row { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 7px; }
.context-text-row label { font-size: 12px; font-weight: 700; color: #52605a; }
.context-text-row input {
  min-width: 0;
  height: 40px;
  border: 1px solid #bfcac5;
  border-radius: 10px;
  padding: 7px 10px;
  font-size: 16px;
  background: white;
}
.context-delete { height: 36px; border: 1px solid #e1aaa5; border-radius: 10px; padding: 6px 12px; color: #b42318; font-weight: 700; background: #fff5f4; }
.size-control { display: flex; align-items: center; gap: 6px; min-width: 0; margin-top: 7px; }
.size-control label { font-size: 11px; color: #52605a; }
.size-control button { min-width: 40px; height: 36px; border: 1px solid #bfcac5; border-radius: 9px; font-weight: 800; background: white; }
.size-control input[type="range"] { flex: 1 1 auto; min-width: 70px; }
.size-control output { min-width: 23px; color: #34423c; font-size: 12px; text-align: center; }
.context-color-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 7px; }
.color-control { display: flex; align-items: center; gap: 8px; }
.color-control > span { font-size: 11px; color: #52605a; }
.color-swatch {
  width: 31px;
  height: 31px;
  border: 3px solid white;
  border-radius: 50%;
  padding: 0;
  background: var(--swatch);
  box-shadow: 0 0 0 1px #aab6b0;
}
.color-swatch.active { box-shadow: 0 0 0 3px #f5c542, 0 0 0 5px #2f4038; }
.context-hint { margin: 5px 2px 0; color: #64706b; font-size: 11px; text-align: center; }

.tool-bar {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 2px;
  padding: 5px 4px calc(5px + var(--safe-bottom));
  border-top: 1px solid #c5cfca;
  background: rgb(255 255 255 / 98%);
}
.tool {
  min-width: 0;
  min-height: 62px;
  border: 0;
  border-radius: 11px;
  padding: 5px 1px;
  color: #4b5563;
  font-size: 10px;
  background: transparent;
}
.tool span { display: block; margin-bottom: 3px; font-size: 23px; line-height: 1; }
.tool.active { color: white; background: var(--green); }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(78px + var(--safe-bottom));
  z-index: 250;
  max-width: calc(100% - 32px);
  padding: 11px 16px;
  border-radius: 999px;
  color: white;
  font-size: 13px;
  background: rgb(17 24 39 / 92%);
  opacity: 0;
  transform: translate(-50%, 15px);
  pointer-events: none;
  transition: .2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

dialog { width: min(90%, 380px); border: 0; border-radius: 16px; padding: 22px; }
dialog::backdrop { background: rgb(0 0 0 / 45%); }
dialog h3 { margin-top: 0; }
.dialog-buttons { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.dialog-buttons button { padding: 10px 14px; border: 0; border-radius: 9px; }
.danger-button { color: white; background: #b42318; }

@media (max-width: 390px) {
  .topbar-button { padding-inline: 9px; }
  .size-control { gap: 4px; }
  .color-control { gap: 5px; }
  .color-swatch { width: 28px; height: 28px; }
  .color-control { gap: 4px; }
  .tool { font-size: 9px; }
}


.feature-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
  margin: 14px 0 3px;
}
.feature-badges span {
  padding: 6px 10px;
  border: 1px solid #bdd5c8;
  border-radius: 999px;
  color: #14532d;
  font-size: 12px;
  font-weight: 700;
  background: #effaf3;
}
.privacy-note {
  margin: 15px auto 0;
  padding: 10px 12px;
  border-radius: 11px;
  color: #39544a !important;
  font-size: 12px;
  background: #f2f7f5;
}
.start-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 15px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid #e1e8e5;
}
.start-links a {
  color: #315f4a;
  font-size: 12px;
  text-decoration: none;
}
.start-links a:hover { text-decoration: underline; }

body.modal-open { overflow: hidden; }
.support-modal {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  padding-top: calc(20px + var(--safe-top));
  padding-bottom: calc(20px + var(--safe-bottom));
  background: rgb(0 0 0 / 50%);
  overflow-y: auto;
}
.support-modal[hidden] { display: none !important; }
.support-card {
  position: relative;
  width: 100%;
  max-width: 340px;
  max-height: min(92dvh, 720px);
  overflow-y: auto;
  padding: 20px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 18px 55px rgb(0 0 0 / 28%);
  text-align: left;
}
.support-close-top {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #f0f0f0;
  color: #555;
  font-size: 18px;
  line-height: 30px;
}
.support-close-top:active { background: #e0e0e0; }
.support-ad-label {
  margin: 0 0 10px;
  color: #999;
  font-size: 11px;
  text-align: center;
}
.support-status {
  margin: 0 0 10px;
  text-align: center;
}
.support-status span {
  display: inline-block;
  padding: 4px 9px;
  border-radius: 999px;
  background: #eef7f2;
  color: #315f4a;
  font-size: 11px;
  font-weight: 700;
}
.support-ad-block {
  margin-bottom: 12px;
  padding: 14px;
  border-radius: 12px;
  background: #f7f7f7;
}
.support-ad-header {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 8px;
  padding-right: 15px;
}
.support-avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 50%;
  object-fit: cover;
  background: white;
}
.support-card h2 {
  margin: 0;
  color: #222;
  font-size: 13px;
  line-height: 1.45;
  font-weight: 700;
}
.support-ad-sub {
  margin: 0 0 10px;
  color: #666;
  font-size: 12px;
  line-height: 1.5;
}
.support-sns-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}
.support-sns-btn {
  flex: 1;
  min-width: 0;
  padding: 8px 2px 7px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fff;
  color: #222;
  text-decoration: none;
  text-align: center;
}
.support-sns-icon {
  display: block;
  width: 24px;
  height: 24px;
  margin: 0 auto;
  object-fit: contain;
}
.support-sns-icon-x {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  margin-bottom: 2px;
}
.support-sns-btn small {
  display: block;
  margin-top: 2px;
  color: #777;
  font-size: 9px;
  white-space: nowrap;
}
.support-sns-btn:active { background: #f0f0f0; }
.support-share-btn {
  width: 100%;
  padding: 9px 8px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fff;
  color: #333;
  font-size: 13px;
}
.support-share-btn:active { background: #f0f0f0; }
.support-pr-block { margin-bottom: 12px; }
.support-pr-tag {
  margin: 0 0 6px;
  color: #999;
  font-size: 11px;
}
.support-pr-title {
  margin: 0 0 6px;
  color: #222;
  font-size: 13px;
  font-weight: 700;
}
.support-pr-text {
  margin: 0 0 10px;
  color: #555;
  font-size: 12px;
  line-height: 1.6;
}
.support-pr-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 9px 8px;
  border: 1px solid var(--green);
  border-radius: 8px;
  background: #fff;
  color: var(--green);
  font-size: 13px;
  text-align: center;
  text-decoration: none;
  font-weight: 700;
}
.support-pr-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 auto;
}
.support-pr-btn:active { background: #eef7f2; }
.support-main-cta {
  width: 100%;
  margin-top: 4px;
  padding: 13px 8px;
  border: 0;
  border-radius: 10px;
  background: #111;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}
.support-main-cta:active { background: #333; }
.support-main-cta:disabled { opacity: .55; }
.support-secondary-cta {
  width: 100%;
  margin-top: 8px;
  padding: 11px 8px;
  border: 1px solid #8aa99a;
  border-radius: 10px;
  background: #fff;
  color: #315f4a;
  font-size: 13px;
  font-weight: 700;
}
.support-secondary-cta:active { background: #eef7f2; }
.support-secondary-cta:disabled { opacity: .5; cursor: not-allowed; }
.support-save-hint {
  margin: 8px 2px 0;
  color: #68736e;
  font-size: 10px;
  line-height: 1.55;
  text-align: center;
}
.support-note {
  margin: 7px 2px 0;
  color: #999;
  font-size: 9px;
  line-height: 1.5;
  text-align: center;
}

@media (max-width: 360px) {
  .support-modal { padding-inline: 12px; }
  .support-card { padding: 16px; }
}

.analytics-note {
  margin: 8px auto 0;
  max-width: 36rem;
  color: #64706b;
  font-size: 11px;
  line-height: 1.6;
}

/* v1.6: LINE・メールからの受取／共有ガイド */
.receive-guide {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid #d5e2dc;
  border-radius: 14px;
  background: #f7fbf9;
  text-align: left;
}
.receive-guide h3 {
  margin: 0 0 10px;
  color: #244a39;
  font-size: 15px;
  text-align: center;
}
.receive-guide-grid {
  display: grid;
  gap: 9px;
}
.receive-guide-box {
  padding: 10px 11px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid #e0e8e4;
}
.receive-guide-box strong {
  display: block;
  margin-bottom: 5px;
  color: #1f3d31;
  font-size: 13px;
}
.receive-guide-box ol, .send-guide ol {
  margin: 0;
  padding-left: 1.45em;
}
.receive-guide-box li {
  margin: 4px 0;
  color: #4f5f58;
  font-size: 12px;
  line-height: 1.55;
}
.receive-guide-note {
  margin: 9px 2px 0 !important;
  color: #6b756f !important;
  font-size: 10.5px !important;
  line-height: 1.5 !important;
}
.send-guide {
  margin: 10px 0 5px;
  padding: 10px 11px;
  border-radius: 10px;
  background: #f4f8f6;
  text-align: left;
}
.send-guide strong {
  display: block;
  margin-bottom: 5px;
  color: #294c3d;
  font-size: 12px;
}
.send-guide li {
  margin: 3px 0;
  color: #56645e;
  font-size: 11px;
  line-height: 1.5;
}
@media (min-width: 720px) {
  .receive-guide-grid { grid-template-columns: 1fr 1fr; }
}


/* v1.9: PC保存修正 / ペン太さ / v1.8 security base */
.ios-share-guide-icon {
  width: 28px;
  height: auto;
  object-fit: contain;
  border-radius: 5px;
  vertical-align: middle;
  margin: -3px 3px -3px 0;
}
.ios-share-guide-icon.small {
  width: 21px;
  height: auto;
  border-radius: 4px;
  margin-right: 2px;
}
.support-main-cta:disabled {
  cursor: wait;
  opacity: .55;
}
.support-pr-block.is-changing {
  opacity: .75;
}


/* v1.9: visible release marker */
.app-version {
  margin-left: .35em;
  color: #6b756f;
  font-size: .85em;
  font-weight: 700;
}

/* v2.0: 緑系のトップ画面。設計図の固定pxは最大幅と余白に変換。 */
:root {
  --green:#166534;
  --green-dark:#114a30;
  --accent:#2a7c50;
}
body:not(.editing) { background:#f3f7f4; }
.app-header {
  width:min(1160px, calc(100% - 32px));
  margin:18px auto 0;
  padding:16px 22px 10px;
  min-height:120px;
  border-radius:20px;
  background:linear-gradient(115deg,#114a30,#176b43 68%,#258055);
  box-shadow:0 8px 24px rgb(14 71 42 / 15%);
}
.header-inner { width:100%; }
.header-brand { display:flex; gap:16px; align-items:center; }
.header-logo { width:90px; height:90px; border:3px solid rgb(255 255 255 / 75%); box-shadow:0 2px 10px rgb(0 0 0 / 14%); }
.brand-copy { min-width:0; }
.app-header h1 { margin:2px 0 0; font-size:clamp(23px, 3.4vw, 35px); line-height:1.2; letter-spacing:.015em; }
.app-header .brand-eyebrow { margin:0 0 3px; font-size:12px; color:#e5f5e9; opacity:1; }
.site-nav { display:grid; grid-template-columns:repeat(5, minmax(0,1fr)); gap:9px; margin:10px 0 0 108px; }
.site-nav a { color:white; text-decoration:none; border-radius:9px; padding:6px 7px; font-size:12px; text-align:center; background:rgb(255 255 255 / 11%); border:1px solid rgb(255 255 255 / 18%); }
.site-nav a:hover,.site-nav a:focus-visible { background:rgb(255 255 255 / 22%); }
.start-panel { display:block; min-height:0; padding:22px 16px 16px; }
.home-container { max-width:1140px; width:100%; margin:0 auto; display:grid; gap:14px; }
.dropzone-card { border-radius:19px; background:#fff; border:1px solid #dce9e0; box-shadow:0 8px 28px rgb(18 58 38 / 7%); overflow:hidden; }
.pdf-dropzone { display:flex; align-items:center; justify-content:center; gap:25px; min-height:200px; padding:24px 28px; text-align:left; border:2px dashed transparent; }
.pdf-dropzone.is-over { border-color:#238354; background:#f0faf3; }
.dropzone-icon { flex:0 0 auto; display:grid; place-items:center; position:relative; width:86px; height:100px; border-radius:13px; background:#ebf8ee; border:2px solid #9ac9a7; color:#14532d; font-size:25px; font-weight:900; }
.dropzone-icon span { position:absolute; right:-12px; bottom:-9px; display:grid; place-items:center; width:34px; height:34px; border-radius:50%; color:white; font-size:25px; background:#187545; border:3px solid #fff; }
.dropzone-copy { max-width:580px; min-width:0; }
.dropzone-copy h2 { color:#173f2c; font-size:clamp(21px,2.5vw,30px); margin:0 0 8px; line-height:1.28; }
.dropzone-copy p { margin:0; color:#52665a; font-size:14px; line-height:1.6; }
.file-button { position:relative; display:inline-flex; align-items:center; justify-content:center; min-height:50px; min-width:210px; margin-top:13px; font-size:16px; box-shadow:0 4px 12px rgb(17 90 47 / 18%); }
.file-button:focus-within { outline:3px solid #f0bc4f; outline-offset:3px; }
.file-button input { display:block; position:absolute; width:1px; height:1px; opacity:0; overflow:hidden; pointer-events:none; }
.dropzone-bottom { display:flex; flex-wrap:wrap; justify-content:center; gap:8px 24px; padding:11px 14px; border-top:1px solid #edf2ee; color:#315842; font-size:12px; background:#fafcfa; }
.dropzone-bottom span::before { content:'✓'; margin-right:6px; color:#218456; font-weight:900; }
/* 使い方を初期状態で折りたたみ、スマホの縦スクロールを減らす。 */
.receive-guide { margin:0; padding:0; border:1px solid #d7e6dc; background:#fff; border-radius:14px; }
.receive-guide summary { list-style:none; display:flex; align-items:center; justify-content:space-between; gap:12px; cursor:pointer; min-height:52px; padding:12px 16px; color:#21563b; font-size:14px; font-weight:800; }
.receive-guide summary::-webkit-details-marker { display:none; }
.receive-guide[open] summary { border-bottom:1px solid #e4eee8; }
.receive-guide .guide-chevron { transition:transform .2s; }
.receive-guide[open] .guide-chevron { transform:rotate(180deg); }
.receive-guide-grid { padding:12px 14px 4px; }
.receive-guide-box { background:#f7faf8; }
.receive-guide-note { padding:0 14px 12px; }
.home-notice { border-radius:15px; background:#eaf3ed; padding:13px 20px; color:#3c5747; }
.home-notice h2 { margin:0 0 5px; color:#205338; font-size:15px; }
.home-notice p { margin:4px 0 0; font-size:12px; line-height:1.55; }
.home-notice a { color:#165c3c; }
.app-footer { width:min(1160px,calc(100% - 32px)); min-height:90px; margin:3px auto 18px; padding:16px; border-radius:14px; background:#fff; box-shadow:0 4px 20px rgb(9 47 26 / 5%); }
.app-footer nav { gap:10px 20px; }
/* 読込完了ダイアログはPDF面積を犠牲にせず一度だけ表示。 */
.import-modal { position:fixed; inset:0; z-index:430; display:flex; align-items:center; justify-content:center; padding:18px; background:rgb(16 42 27 / 54%); }
.import-card { background:white; border-radius:22px; width:min(100%,390px); padding:24px 22px; text-align:center; box-shadow:0 16px 45px rgb(0 0 0 / 22%); }
.import-success { width:48px; height:48px; margin:0 auto 10px; display:grid; place-items:center; border-radius:50%; background:#daf5e2; color:#18623c; font-size:26px; font-weight:900; }
.import-card h2 { margin:0 0 9px; color:#183e2b; font-size:21px; }
.import-card > p { margin:0; color:#556b5c; font-size:13px; }
.import-steps { margin:16px 0; padding:13px; border-radius:13px; background:#f2f8f3; text-align:left; }
.import-steps p { margin:6px 0; color:#31513c; font-size:13px; }
.import-start-btn { width:100%; min-height:49px; border:0; border-radius:12px; color:#fff; background:#166534; font-weight:800; font-size:16px; }
/* 狭い画面で編集ボタンの横スクロールが発生しないようにする。 */
.tool-bar { grid-template-columns:repeat(6,minmax(0,1fr)); }
.tool { overflow-wrap:anywhere; }
@media (min-width:900px) {
  .header-inner { display:grid; grid-template-columns:90px minmax(0,1fr); column-gap:20px; }
  .header-brand { grid-column:1 / -1; }
  .site-nav { grid-column:2; margin: 0; align-self:end; }
  .app-header { min-height:148px; }
}
@media (max-width:650px) {
  .app-header { width:calc(100% - 20px); margin:10px auto 0; min-height:0; border-radius:16px; padding:12px 12px 10px; }
  .header-brand { gap:10px; }
  .header-logo { width:55px; height:55px; border-width:2px; }
  .app-header h1 { font-size:clamp(19px,5.5vw,25px); }
  .app-header .brand-eyebrow { font-size:10px; }
  .site-nav { grid-template-columns:repeat(5,minmax(0,1fr)); gap:4px; margin:10px 0 0; }
  .site-nav a { padding:8px 1px; line-height:1.25; font-size:10px; }
  .start-panel { padding:10px; }
  .home-container { gap:10px; }
  .pdf-dropzone { min-height:235px; padding:16px 15px; gap:10px; flex-direction:column; text-align:center; }
  .dropzone-icon { width:57px; height:60px; font-size:17px; border-radius:10px; }
  .dropzone-icon span { width:25px; height:25px; font-size:18px; right:-9px; bottom:-6px; }
  .dropzone-copy h2 { font-size:21px; margin-bottom:3px; }
  .dropzone-copy p { font-size:12px; }
  .file-button { min-height:50px; width:min(100%,280px); margin-top:9px; }
  .dropzone-bottom { font-size:11px; gap:3px 12px; padding:8px; }
  .home-notice { padding:11px 13px; }
  .home-notice h2 { font-size:13px; }
  .home-notice p { font-size:11px; }
  .app-footer { width:calc(100% - 20px); margin:0 auto 10px; min-height:0; padding:11px 8px; font-size:11px; }
  .app-footer nav { gap:6px 10px; }
  .floating-zoom { right:5px; bottom:5px; gap:2px; padding:3px; }
  .floating-zoom button { min-width:35px; min-height:38px; }
  .floating-zoom strong { min-width:37px; }
  .tool { min-height:55px; padding:4px 0; font-size:9px; }
  .tool span { font-size:21px; margin-bottom:3px; }
  .editor-topbar { gap:5px; padding-inline:6px; }
  .topbar-button { padding-inline:6px; }
  .page-nav { gap:3px; }
  .page-nav strong { min-width:40px; font-size:14px; }
  .topbar-button.square { min-width:35px; padding-inline:4px; }
}
@media (max-width:360px) {
  .site-nav a { font-size:9px; }
  .dropzone-copy h2 { font-size:19px; }
  .topbar-button.save { font-size:12px; }
  .topbar-button.secondary { font-size:11px; }
  .floating-zoom .zoom-text-button { min-width:35px; padding-inline:3px; }
}

/* v2.0.1：iPhoneでネイティブのファイル選択を確実に開始させる。 */
.file-button { position: relative; overflow: hidden; cursor: pointer; }
.file-button input[type="file"] {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  opacity: .01;
  cursor: pointer;
  pointer-events: auto;
}
.home-load-status { margin: 12px auto 0; padding: 9px 12px; max-width: 340px; background: #f0faf4; border: 1px solid #9cccab; color: #14532d; border-radius: 10px; font-size: 13px; text-align: center; }
.home-load-status[hidden] { display:none !important; }

/* v2.1: スマホ編集画面の省スペースなPDF保護ボタン。既存ページナビを残す。 */
.export-actions { display:flex; align-items:center; justify-content:flex-end; gap:5px; min-width:0; }
.topbar-button.password-button { color:#14532d; font-size:12px; padding:8px 9px; white-space:nowrap; }
.topbar-button.password-button.is-protected { background:#fef3c7; color:#78350f; }
@media (max-width:390px) {
  .editor-topbar { gap:4px; }
  .export-actions { gap:3px; }
  .topbar-button.password-button { min-width:39px; padding:8px 4px; font-size:11px; }
  .topbar-button.save { padding-inline:6px; }
}
/* パスワード設定: iPhoneのキーボード表示時もスクロールして設定可能。 */
.password-dialog { width:min(94vw,440px); max-height:min(88dvh,690px); padding:0; border:0; border-radius:16px; color:#182b24; box-shadow:0 16px 55px #0005; overflow:auto; }
.password-dialog::backdrop { background:rgb(0 0 0 / 55%); }
.password-dialog-body { padding:22px 20px calc(19px + env(safe-area-inset-bottom,0px)); }
.password-dialog h2 { margin:0 0 10px; font-size:20px; }
.password-dialog-note { font-size:13px; line-height:1.65; color:#4b6155; }
.password-enable-row { display:flex; align-items:center; gap:9px; margin:15px 0; padding:12px; border-radius:12px; background:#edf7ef; font-weight:700; font-size:13px; }
.password-enable-row input { width:20px; height:20px; accent-color:var(--green); flex-shrink:0; }
.password-fields { display:grid; gap:8px; }
.password-fields[hidden] { display:none !important; }
.password-fields>label { font-size:12px; font-weight:700; }
.password-fields>input { width:100%; padding:12px; border:1px solid #9ab6a3; border-radius:9px; background:white; color:#182b24; font-size:16px; }
.password-tools { display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap; }
.password-tools button { background:white; padding:9px; color:#17603a; border:1px solid #92c9aa; border-radius:8px; font-size:12px; font-weight:700; }
.password-tools label { display:flex; gap:4px; font-size:12px; align-items:center; }
.password-caution { margin:6px 0; padding:9px; border-radius:9px; background:#fff7e6; color:#72531d; font-size:12px; line-height:1.6; }
.password-feedback { margin:9px 0 0; color:#b42318; font-size:12px; line-height:1.5; }
.password-dialog-actions { display:flex; justify-content:flex-end; gap:9px; margin-top:16px; }
.password-dialog-actions button { padding:12px 15px; border-radius:9px; border:1px solid #b4c8ba; font-weight:700; background:#fff; }
.password-dialog-actions .password-apply { color:white; border-color:var(--green); background:var(--green); }
.support-protection-info { margin:9px 0; padding:8px 10px; border:1px solid #dac48f; border-radius:9px; background:#fff9e8; color:#704c0a; font-size:12px; line-height:1.55; }
.support-protection-info[hidden] {display:none!important;}

/* スマホでは上部の保護を鍵マークだけにし、ページ移動と保存を守る。 */
.topbar-button.password-button { font-size:19px; min-width:40px; }
@media (min-width: 651px) {
  .topbar-button.password-button::after { content:" PDF保護"; font-size:12px; vertical-align:middle; }
  .topbar-button.password-button.is-protected::after { content:" 保護中"; }
}
@media (max-width:390px) {
  .topbar-button.password-button { min-width:36px; font-size:19px; padding:5px 4px; }
}
