* { box-sizing: border-box; }
/* sidenote（サイドノート作成ツール）と同じデザイントークン・ヒーロー構成。 */
:root {
  --tx-text: #1e2126;
  --tx-muted: #4d4d4d;
  --tx-muted-2: #71717a;
  --tx-border: #e5e5e5;
  --tx-bg-muted: #f2f2f2;
  --tx-radius-card: 14px;
  --tx-radius-btn: 8px;
  --tx-shadow-sm: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px -1px rgba(0,0,0,.1);
  --tx-shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -2px rgba(0,0,0,.1);
  --tx-shadow-2xl: 0 25px 50px -12px rgba(0,0,0,.25);
  --danger: #d92d20;
  --accent: #ff4b4b;
}
html { scroll-behavior: smooth; }
body {
  margin: 0; color: var(--tx-text); background: #f4f5f7; padding: 28px 40px 100px;
  font-family: "Source Sans Pro", system-ui, "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  overflow-x: hidden;
}
[hidden] { display: none !important; }
.icon { width: 1em; height: 1em; flex: none; }

/* ── ヒーロー ── */
.hero {
  width: 100vw; position: relative; left: 50%; margin: -28px 0 0 -50vw;
  padding: 72px 40px 48px; background: #eef0f3; border-bottom: 1px solid var(--tx-border);
}
.hero-inner {
  max-width: 1100px; margin: 0 auto; display: grid; grid-template-columns: 1fr 1fr;
  gap: 56px; align-items: start;
}
.hero-title { font-size: 38px; font-weight: 700; line-height: 1.28; letter-spacing: -.5px; margin: 0 0 18px; }
.hero-desc { font-size: 22px; line-height: 1.7; color: var(--tx-muted); margin: 0 0 28px; max-width: 18em; }
.hero-shortcuts { margin-top: 20px; }
.hero-shortcuts-title { font-size: 12px; font-weight: 600; color: var(--tx-muted-2); margin-bottom: 6px; }
.hero-shortcuts ul { list-style: none; margin: 0; padding: 0; font-size: 12.5px; line-height: 1.9; color: var(--tx-muted); }
.hero-shortcuts li::before { content: "・"; }

/* 「機能」ボタン群（sidenoteの「デザイン」グリッドと同じ見た目・同じ位置） */
.hero-theme-section { margin-top: 28px; }
.hero-theme-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.hero-theme-title { font-size: 16px; font-weight: 700; }
.theme-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; max-width: 460px; }
.theme-swatch {
  height: 40px; border: 1px solid var(--tx-border); background: var(--tx-bg-muted); border-radius: var(--tx-radius-btn);
  font: inherit; font-size: 13px; font-weight: 500; color: var(--tx-text); cursor: pointer; text-align: center;
  box-shadow: var(--tx-shadow-sm); transition: box-shadow .15s, background .15s; padding: 0 8px;
}
.theme-swatch:hover { background: #e8e8ea; box-shadow: var(--tx-shadow-md); }
.theme-swatch.selected { background: var(--tx-text); color: #fff; border-color: var(--tx-text); font-weight: 700; }
.theme-swatch:focus-visible { outline: 2px solid var(--tx-text); outline-offset: 2px; }

/* ── アプリのイメージ図 ── */
.browser-mock {
  border: 1px solid var(--tx-border); border-radius: var(--tx-radius-card); overflow: hidden;
  background: #fff; box-shadow: var(--tx-shadow-2xl);
}
.browser-mock-bar { height: 38px; display: flex; align-items: center; gap: 7px; padding: 0 14px; background: #f3f3f3; border-bottom: 1px solid var(--tx-border); }
.browser-mock-bar .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.dot-red { background: #ff5f57; } .dot-yellow { background: #ffbd2e; } .dot-green { background: #28c840; }
.browser-mock-url {
  margin-left: 10px; font-size: 11.5px; color: var(--tx-muted-2); background: #fff;
  border: 1px solid var(--tx-border); border-radius: 999px; padding: 3px 12px; flex: 1 1 auto;
}
.browser-mock-body { background: var(--tx-bg-muted); padding: 22px; }
.mock-paper {
  background: #fff; border: 1px solid var(--tx-border); border-radius: 10px; box-shadow: var(--tx-shadow-sm);
  padding: 22px; min-height: 236px;
}
.mock-doc { display: flex; flex-direction: column; gap: 11px; }
.mock-h { height: 11px; border-radius: 4px; background: #d7dade; }
.mock-line { height: 9px; border-radius: 5px; background: #eceef1; }
.mock-redact { height: 11px; border-radius: 3px; background: #111; }
.mock-hand { font-family: "Yomogi", "Klee One", cursive; color: #1d4ed8; font-size: 19px; transform: rotate(-3deg); line-height: 1.3; }
.mock-thumbs { display: flex; gap: 12px; align-items: flex-end; justify-content: center; }
.mock-thumb-page { width: 64px; height: 84px; border: 1px solid #d7dade; border-radius: 4px; background: #fff; box-shadow: var(--tx-shadow-sm); padding: 8px 6px; display: flex; flex-direction: column; gap: 5px; }
.mock-thumb-page.rot { transform: rotate(90deg); }
.mock-plus { align-self: center; font-size: 20px; font-weight: 700; color: var(--tx-muted-2); }
.mock-field { display: flex; align-items: center; gap: 10px; }
.mock-field-label { width: 52px; font-size: 11px; font-weight: 700; color: var(--tx-muted-2); flex: none; }
.mock-field-input { flex: 1; height: 24px; border: 1px solid var(--tx-border); border-radius: 6px; background: #fafafa; }
.mock-field-input.empty { background: repeating-linear-gradient(45deg, #fafafa 0 6px, #f0f0f0 6px 12px); }

/* ── ボタン共通 ── */
.btn-outline, .btn-primary {
  font: inherit; font-size: 14px; height: 40px; padding: 0 16px; border-radius: var(--tx-radius-btn);
  font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; text-decoration: none; white-space: nowrap;
}
.btn-outline { background: #fff; color: var(--tx-text); border: 1px solid var(--tx-border); }
.btn-outline:hover:not(:disabled) { background: #f4f4f5; }
.btn-primary { background: var(--tx-text); color: #fff; border: 1px solid var(--tx-text); }
.btn-primary:hover:not(:disabled) { background: #262626; }
.btn-outline:disabled, .btn-primary:disabled { background: #f5f6f8; color: #b7bac2; border-color: #eee; cursor: not-allowed; }
button:focus-visible, .filebtn:focus-within, .dropzone:focus-within { outline: 2px solid var(--tx-text); outline-offset: 2px; }

/* ── 本文 ── */
.workspace { max-width: 1100px; margin: 32px auto 0; }
.tool-panel { display: flex; flex-direction: column; gap: 16px; }
.panel-title { font-size: 22px; font-weight: 700; margin: 0; }
.panel-lead { font-size: 13.5px; color: var(--tx-muted); margin: -8px 0 0; line-height: 1.7; }

.card {
  background: #fff; border: 1px solid var(--tx-border); border-radius: var(--tx-radius-card);
  box-shadow: var(--tx-shadow-sm); padding: 18px 20px;
}
.toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; }
.toolbar-group { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.toolbar-sep { width: 1px; align-self: stretch; background: var(--tx-border); }
.field { display: flex; flex-direction: column; gap: 4px; }
.field > label, .field-label { font-size: 12px; font-weight: 600; color: var(--tx-muted-2); }
.text-input, select.text-input, textarea.text-input {
  font: inherit; font-size: 14px; height: 40px; padding: 0 12px; border: 1px solid var(--tx-border);
  border-radius: var(--tx-radius-btn); background: #fff; color: var(--tx-text); width: 100%;
}
textarea.text-input { height: auto; padding: 8px 12px; resize: vertical; line-height: 1.5; }
.text-input:focus { outline: 2px solid var(--tx-text); outline-offset: 0; border-color: var(--tx-text); }
input[type="range"] { accent-color: var(--tx-text); width: 130px; }
input[type="color"] { width: 40px; height: 40px; padding: 2px; border: 1px solid var(--tx-border); border-radius: var(--tx-radius-btn); background: #fff; cursor: pointer; }
.cap { font-size: 12.5px; color: var(--tx-muted-2); margin: 0; line-height: 1.6; }
.status { font-size: 13px; color: var(--tx-muted); margin: 0; min-height: 20px; line-height: 1.6; }
.status.is-error, .is-error-text { color: var(--danger); }
.badge { display: inline-block; font-size: 12px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--tx-border); background: #fff; color: #555; white-space: nowrap; }
.badge.ok { background: #e8f5e9; border-color: #c8e6c9; color: #256029; }
.badge.warn { background: #fff4e5; border-color: #ffe0b2; color: #8a5300; }

/* ドロップゾーン */
.dropzone {
  border: 2px dashed var(--tx-border); border-radius: 10px; padding: 30px 20px; background: #fff;
  text-align: center; cursor: pointer; transition: border-color .15s, background .15s; display: block;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--tx-text); background: var(--tx-bg-muted); }
.dropzone .icon-lg { width: 40px; height: 40px; color: var(--tx-muted-2); margin-bottom: 10px; }
.dropzone p { margin: 0; font-size: 16px; font-weight: 600; line-height: 1.6; }
.dropzone-sub { display: block; font-size: 13px; font-weight: 400; color: var(--tx-muted-2); margin-top: 4px; }
.dropzone input[type="file"] { display: none; }
.filebtn input { display: none; }

/* ── 墨消し・手書き：ページ表示 ── */
.pages-col { display: flex; flex-direction: column; align-items: center; gap: 24px; }
.page { display: flex; flex-direction: column; gap: 6px; max-width: 100%; }
.phead { display: flex; align-items: center; gap: 10px; font-size: 13px; color: #555; }
.mini { font: inherit; padding: 3px 8px; font-size: 12px; border-radius: 6px; border: 1px solid var(--tx-border); background: #fff; cursor: pointer; }
.mini:hover { border-color: var(--tx-text); }
.stage { position: relative; max-width: 100%; background: #fff; box-shadow: 0 2px 12px rgba(0,0,0,.12); }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.stage canvas.overlay { cursor: crosshair; touch-action: none; }

/* ── 結合・分割・回転：サムネイル ── */
.thumb-grid { display: flex; flex-wrap: wrap; gap: 16px; }
.page-card {
  width: 150px; display: flex; flex-direction: column; gap: 6px; background: #fff; border: 1px solid var(--tx-border);
  border-radius: var(--tx-radius-card); padding: 8px; box-shadow: var(--tx-shadow-sm); cursor: grab; user-select: none;
}
.page-card.dragging { opacity: .35; }
.page-card.selected { border-color: var(--tx-text); box-shadow: 0 0 0 2px var(--tx-text); }
.page-thumb-wrap {
  position: relative; border: 1px solid var(--tx-border); border-radius: 6px; overflow: hidden; background: #f7f7f7;
  line-height: 0; height: 150px; display: flex; align-items: center; justify-content: center;
}
.page-thumb { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; }
.page-remove, .page-check {
  position: absolute; top: 4px; width: 22px; height: 22px; padding: 0; border: none; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.page-remove { right: 4px; background: rgba(0,0,0,.55); color: #fff; }
.page-remove:hover { background: var(--danger); }
.page-remove .icon { width: 11px; height: 11px; }
.page-check { left: 4px; background: rgba(255,255,255,.92); border: 1.5px solid #9aa0a8; color: transparent; font-size: 13px; font-weight: 700; line-height: 1; }
.page-card.selected .page-check { background: var(--tx-text); border-color: var(--tx-text); color: #fff; }
.page-label { display: flex; flex-direction: column; gap: 1px; font-size: 11px; }
.page-num { font-weight: 700; font-size: 11.5px; }
.page-source { color: var(--tx-muted-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-actions { display: flex; gap: 4px; }
.act-btn {
  flex: 1; height: 24px; padding: 0; font: inherit; font-size: 13px; line-height: 1;
  border: 1px solid var(--tx-border); border-radius: 6px; background: #fff; color: var(--tx-muted); cursor: pointer;
}
.act-btn:hover { border-color: var(--tx-text); color: var(--tx-text); background: var(--tx-bg-muted); }

/* ── メタデータ ── */
.field-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field-hint-plain { font-size: 12px; color: var(--tx-muted-2); margin: 0; }
.advanced { margin-top: 4px; }
.advanced summary { cursor: pointer; font-size: 13px; font-weight: 600; margin-bottom: 14px; }
.readonly-info .info-row { display: flex; gap: 12px; font-size: 13px; padding: 3px 0; }
.info-label { width: 64px; color: var(--tx-muted-2); font-weight: 600; }
.table-scroll { overflow-x: auto; border: 1px solid var(--tx-border); border-radius: var(--tx-radius-card); background: #fff; }
.meta-table { width: 100%; border-collapse: collapse; min-width: 720px; }
.meta-table th, .meta-table td { padding: 10px 14px; text-align: left; vertical-align: middle; }
.meta-table thead th { font-size: 12px; font-weight: 700; color: var(--tx-muted); background: var(--tx-bg-muted); border-bottom: 1px solid var(--tx-border); }
.meta-table tbody tr { border-bottom: 1px solid var(--tx-border); }
.meta-table tbody tr:last-child { border-bottom: none; }
.meta-table tbody tr.is-error { background: #fff7f7; }
.col-name { width: 26%; } .col-field { width: 30%; } .col-action { width: 14%; white-space: nowrap; }
.meta-table .row-name { font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere; }
.meta-table .text-input { height: 34px; font-size: 13px; }
.row-error-text { font-size: 13px; color: var(--danger); }
.row-save-btn { height: 32px; padding: 0 12px; font: inherit; font-size: 12.5px; border-radius: var(--tx-radius-btn); border: 1px solid var(--tx-border); background: #fff; cursor: pointer; }
.row-save-btn:hover:not(:disabled) { border-color: var(--tx-text); background: var(--tx-bg-muted); }
.row-save-btn:disabled { opacity: .5; cursor: not-allowed; }
.row-status { display: block; font-size: 11px; color: var(--tx-muted-2); margin-top: 4px; white-space: nowrap; }

/* ── フッター（このツールについて／免責事項） ── */
.site-info { max-width: 1100px; margin: 48px auto 0; display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.site-info .shead { font-weight: 700; font-size: 14px; margin: 0 0 6px; }
.site-info .cap { margin-bottom: 4px; }
.link { font-size: 13px; color: #1f6feb; text-decoration: none; }
.link:hover { text-decoration: underline; }

@media (max-width: 860px) {
  .hero-inner { grid-template-columns: 1fr; gap: 32px; }
  .hero-title { font-size: 30px; }
  .site-info { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  body { padding-left: 16px; padding-right: 16px; }
  .hero { padding-left: 20px; padding-right: 20px; }
  .theme-grid { max-width: none; }
  .page-card { width: calc(50% - 8px); }
  .toolbar-sep { display: none; }
}
