:root {
  color-scheme: light;
  --bg: #eef3f9;
  --surface: #ffffff;
  --surface-soft: #eef3f7;
  --text: #17212b;
  --muted: #66727f;
  --line: #d8e0e7;
  --primary: #0d6f91;
  --primary-strong: #07506c;
  --primary-soft: #e2f4f8;
  --accent: #4f46e5;
  --accent-soft: #eeedff;
  --navy: #0b1735;
  --warning: #a05a14;
  --warning-soft: #fff3e2;
  --danger: #a12b37;
  --shadow: 0 14px 34px rgba(24, 42, 58, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    radial-gradient(circle at 8% 12%, rgba(24, 166, 196, 0.14), transparent 28rem),
    radial-gradient(circle at 92% 24%, rgba(104, 83, 229, 0.12), transparent 30rem),
    linear-gradient(180deg, #f7f9fc 0%, var(--bg) 70%);
  color: var(--text);
  font-family: "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  line-height: 1.65;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.25;
  background-image: linear-gradient(rgba(38, 73, 103, 0.06) 1px, transparent 1px), linear-gradient(90deg, rgba(38, 73, 103, 0.06) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(to bottom, black, transparent 70%);
}

[hidden] { display: none !important; }

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.48; }

.app-header,
.workspace-tabs,
main,
footer {
  width: min(1180px, calc(100% - 32px));
  margin-inline: auto;
}

.app-header {
  min-height: 94px;
  margin-top: 16px;
  padding: 15px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 18px 55px rgba(23, 42, 68, 0.1);
  backdrop-filter: blur(16px);
}

.brand-lockup { display: flex; align-items: center; gap: 13px; }
.brand-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: linear-gradient(145deg, #0aa6bc, #355ee7 58%, #6d3dd6);
  color: white;
  font-weight: 900;
  letter-spacing: -0.05em;
  box-shadow: 0 11px 24px rgba(48, 88, 218, 0.28), inset 0 1px rgba(255, 255, 255, 0.34);
}
.brand-copy h1 { line-height: 1.05; letter-spacing: -0.035em; }
.brand-copy .eyebrow { font-size: 0.66rem; letter-spacing: 0.14em; }

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(1.6rem, 3vw, 2.2rem); }
h2 { margin-bottom: 6px; font-size: clamp(1.25rem, 2vw, 1.7rem); }
h3 { margin-bottom: 6px; font-size: 1rem; }

.eyebrow {
  margin: 0 0 2px;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.muted { color: var(--muted); }
.header-actions, .editor-actions, .drawing-toolbar, .source-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.workspace-tabs,
.result-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 10px;
  scrollbar-width: none;
}
.workspace-tabs::-webkit-scrollbar,
.result-tabs::-webkit-scrollbar { display: none; }

.workspace-tabs { margin-top: 12px; padding: 6px; border-radius: 15px; background: rgba(255, 255, 255, 0.62); backdrop-filter: blur(10px); }

.workspace-tab,
.result-tab,
button.primary,
button.secondary,
.file-button,
.text-button,
.evidence-button {
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid var(--line);
  padding: 9px 14px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.workspace-tab.active,
.result-tab.active,
button.primary {
  border-color: transparent;
  background: linear-gradient(110deg, #0d7898, #315edb 62%, #6548d8);
  color: white;
  box-shadow: 0 9px 20px rgba(42, 91, 197, 0.23);
}

button.primary:hover:not(:disabled) { background: var(--primary-strong); }
button.secondary:hover:not(:disabled),
.workspace-tab:hover:not(:disabled),
.result-tab:hover:not(:disabled),
.evidence-button:hover { border-color: var(--primary); }

.text-button,
.evidence-button {
  min-height: 36px;
  border: 0;
  padding: 5px 0;
  background: transparent;
  color: var(--primary);
  text-decoration: underline;
}

.wide { width: 100%; }
.saved-analysis { display: grid; gap: 7px; padding-top: 8px; border-top: 1px solid var(--line); }
.saved-analysis label { font-weight: 700; }
.saved-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; }
.screen, .result-panel { display: none; }
.screen.active, .result-panel.active { display: block; }
main { min-height: 640px; }

.upload-shell {
  max-width: 800px;
  margin: 28px auto 60px;
  display: grid;
  gap: 18px;
}

.upload-intro {
  position: relative;
  overflow: hidden;
  padding: clamp(24px, 5vw, 42px);
  border-radius: 24px;
  color: white;
  background:
    radial-gradient(circle at 88% 18%, rgba(71, 220, 225, 0.28), transparent 13rem),
    radial-gradient(circle at 70% 100%, rgba(114, 84, 229, 0.38), transparent 20rem),
    linear-gradient(130deg, #081632, #102d52 58%, #153c61);
  box-shadow: 0 24px 60px rgba(11, 31, 61, 0.22);
}
.upload-intro::after {
  content: "公報";
  position: absolute;
  right: -8px;
  top: -20px;
  color: rgba(255, 255, 255, 0.035);
  font-size: 8rem;
  font-weight: 900;
  line-height: 1;
}
.upload-intro-main { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(0, 1fr) 220px; align-items: center; gap: 30px; }
.upload-intro-copy { max-width: 520px; }
.upload-intro .eyebrow { color: #79e8ed; }
.upload-intro h2 { margin: 8px 0 13px; color: white; font-size: clamp(2rem, 5vw, 3.4rem); line-height: 1.08; letter-spacing: -0.055em; }
.upload-intro h2 span { color: #7de6e8; }
.upload-intro p:not(.eyebrow) { max-width: 560px; margin-bottom: 0; color: #d7e8f5; }
.upload-intro-visual { min-height: 180px; display: grid; grid-template-columns: 86px 28px minmax(0, 1fr); align-items: center; }
.intro-document { position: relative; min-height: 122px; display: grid; align-content: start; gap: 9px; padding: 17px 13px; border: 1px solid rgba(154, 232, 237, 0.4); border-radius: 10px 10px 16px 10px; background: rgba(255,255,255,0.94); box-shadow: 0 16px 34px rgba(2, 12, 32, 0.3); transform: rotate(-2deg); }
.intro-document::after { content: ""; position: absolute; right: 0; top: 0; border-width: 0 0 18px 18px; border-style: solid; border-color: transparent transparent #bfe9ef transparent; }
.intro-document b { color: #12365a; font-size: 0.68rem; }
.intro-document i { display: block; width: 100%; height: 4px; border-radius: 4px; background: #c8d5df; }
.intro-document i.short { width: 62%; }
.intro-document i.marked { height: 7px; background: linear-gradient(90deg, #25b7b4 0 58%, #c8d5df 58%); }
.intro-branch { position: relative; height: 1px; background: #60d8dc; }
.intro-branch::after { content: ""; position: absolute; right: 0; top: -4px; width: 7px; height: 7px; border-top: 2px solid #60d8dc; border-right: 2px solid #60d8dc; transform: rotate(45deg); }
.intro-results { display: grid; gap: 7px; }
.intro-results span { min-height: 36px; display: grid; align-items: center; padding: 6px 9px; border: 1px solid rgba(137, 222, 231, 0.3); border-left: 3px solid #5dd8da; border-radius: 7px; background: rgba(4, 24, 58, 0.5); color: #e9fbff; font-size: 0.68rem; font-weight: 800; box-shadow: inset 0 1px rgba(255,255,255,0.06); }
.feature-chips { position: relative; z-index: 1; display: flex; gap: 8px; flex-wrap: wrap; margin-top: 24px; }
.feature-chips span { padding: 6px 11px; border: 1px solid rgba(142, 222, 234, 0.3); border-radius: 999px; background: rgba(3, 18, 43, 0.34); color: #e5fbff; font-size: 0.76rem; font-weight: 700; backdrop-filter: blur(8px); }

.dropzone {
  min-height: 210px;
  padding: 28px;
  border: 2px dashed #92b9c7;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.9);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  text-align: center;
  box-shadow: 0 18px 44px rgba(28, 66, 96, 0.09), inset 0 0 0 6px rgba(226, 244, 248, 0.45);
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.dropzone:hover,
.dropzone.drag-over {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 4px rgba(23, 92, 117, 0.12), var(--shadow);
}
.dropzone.drag-over { transform: translateY(-2px); }
.dropzone input, .file-button input { position: absolute; opacity: 0; pointer-events: none; }
.drop-icon {
  position: relative;
  width: 58px;
  height: 70px;
  display: grid;
  place-items: end center;
  padding-bottom: 11px;
  border-radius: 9px 9px 12px 12px;
  background: linear-gradient(145deg, #0ca5b8, #3e5de0);
  color: white;
  box-shadow: 0 12px 24px rgba(39, 93, 191, 0.25);
}
.drop-icon::after { content: ""; position: absolute; top: 0; right: 0; border-width: 0 0 16px 16px; border-style: solid; border-color: transparent transparent rgba(255,255,255,0.56) transparent; }
.drop-icon small { font-size: 0.73rem; font-weight: 900; letter-spacing: 0.08em; }
.drop-limit { margin-top: 5px; color: var(--muted); }

.file-info,
.notice {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.file-info.empty { color: var(--muted); }
.file-info.error { border-color: #e2a9b0; background: #fff0f2; color: var(--danger); }
.notice { display: flex; gap: 10px; align-items: flex-start; }
.notice.warning { border-color: #e6bf91; background: var(--warning-soft); color: #70400e; }
.notice.error { border-color: #e2a9b0; background: #fff0f2; color: var(--danger); }

.document-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin: 14px 0 18px;
}

#screen-result > .document-header,
#screen-compare > .document-header {
  padding: 20px 22px;
  border-radius: 18px;
  color: white;
  background: linear-gradient(120deg, #0b1735, #123e62 70%, #254f75);
  box-shadow: 0 18px 42px rgba(13, 38, 68, 0.16);
}
#screen-result > .document-header .eyebrow,
#screen-compare > .document-header .eyebrow { color: #75e4e7; }
#screen-result > .document-header .muted,
#screen-compare > .document-header .muted { color: #c6d9e8; }
#screen-result > .document-header .secondary,
#screen-compare > .document-header .file-button { border-color: rgba(255,255,255,0.28); background: rgba(255,255,255,0.1); color: white; }

.result-layout,
.comparison-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px;
  align-items: start;
}

.content-column { display: grid; gap: 16px; }
.summary-card,
.flow-grid article,
.evidence-panel,
.claim-workspace,
.drawing-stage,
.drawing-info {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  padding: 18px;
  box-shadow: var(--shadow);
}

.summary-card {
  position: relative;
  overflow: hidden;
  border: 0;
  color: white;
  background: linear-gradient(125deg, #0b6e88, #315acb 64%, #6847c8);
  box-shadow: 0 20px 46px rgba(48, 81, 183, 0.22);
}
.summary-card::after { content: "⌁"; position: absolute; right: 20px; top: -22px; color: rgba(255,255,255,0.12); font-size: 7rem; font-weight: 900; }
.summary-card .eyebrow { color: #a9f2f2; }
.summary-card .evidence-button { color: white; text-decoration-color: rgba(255,255,255,0.55); }
.summary-title-row { position: relative; z-index: 1; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.rule-based-badge { padding: 4px 9px; border: 1px solid rgba(172, 235, 239, 0.32); border-radius: 999px; background: rgba(6, 27, 66, 0.24); color: #d9f9fa; font-size: 0.7rem; font-weight: 800; }
.summary-card > .lead { position: relative; z-index: 1; margin: 8px 0 16px; padding-bottom: 14px; border-bottom: 1px solid rgba(255,255,255,0.18); }
.quick-grid { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 10px; }
.quick-item { min-width: 0; min-height: 150px; display: flex; flex-direction: column; padding: 15px 16px; border: 1px solid rgba(255,255,255,0.14); border-radius: 13px; background: rgba(5, 23, 55, 0.27); box-shadow: inset 0 1px rgba(255,255,255,0.05); }
.quick-subject { grid-column: span 4; border-top: 3px solid #38bdf8; }
.quick-problem { grid-column: span 8; border-top: 3px solid #a78bfa; }
.quick-point { grid-column: span 8; border-top: 3px solid transparent; background: linear-gradient(rgba(12, 36, 79, 0.7), rgba(12, 36, 79, 0.7)) padding-box, linear-gradient(90deg, #6366f1, #22d3ee) border-box; box-shadow: 0 12px 32px rgba(17, 36, 87, 0.24), inset 0 1px rgba(255,255,255,0.08); }
.quick-benefit { grid-column: span 4; border-top: 3px solid #34d399; }
.quick-label { display: flex; align-items: baseline; gap: 7px; color: rgba(226, 239, 255, 0.58); font-size: 0.62rem; font-weight: 800; letter-spacing: 0.11em; }
.quick-label b { color: #a9f2f2; font-size: 1rem; }
.quick-item h3 { margin: 2px 0 7px; color: white; font-size: 0.82rem; }
.quick-item h3 em { display: inline-flex; margin-left: 5px; padding: 2px 6px; border-radius: 999px; background: rgba(255,255,255,0.1); color: #bfeef4; font-size: 0.62rem; font-style: normal; font-weight: 700; }
.quick-item p { margin-bottom: 8px; color: #f5f8ff; font-size: 0.98rem; line-height: 1.7; }
.quick-item small { margin-top: auto; color: #b8cce0; font-size: 0.69rem; }
.quick-link { min-height: 36px; width: fit-content; margin-top: 8px; padding: 4px 0; border: 0; background: transparent; color: #91edf0; font-size: 0.75rem; font-weight: 800; }
.quick-legal-note { position: relative; z-index: 1; margin: 11px 0 0; color: #c7d9ec; font-size: 0.7rem; }

/* 発明概要は他の結果ページと同じ明るい業務画面の色調にそろえる。 */
.summary-card {
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.summary-card::after { display: none; }
.quick-item {
  border: 1px solid var(--line);
  color: var(--text);
  background: #f7f9fc;
  box-shadow: none;
}
.quick-subject { border-top: 3px solid #2f7fc2; }
.quick-problem { border-top: 3px solid #7564c8; }
.quick-point {
  border: 1px solid #cfd7ea;
  border-top: 3px solid #596ed0;
  background: #f4f6fc;
  box-shadow: none;
}
.quick-benefit { border-top: 3px solid #2b9574; }
.quick-label { color: var(--muted); }
.quick-label b { color: var(--primary); }
.quick-item h3 { color: var(--text); }
.quick-item p { color: var(--text); }
.quick-item small { color: var(--muted); }
.quick-link { color: var(--primary); }
.quick-legal-note { color: var(--muted); }
.flow-grid article { position: relative; overflow: hidden; transition: transform 160ms ease, box-shadow 160ms ease; }
.flow-grid article::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: #15a5b3; }
.flow-grid article:nth-child(2)::before { background: #3e65dc; }
.flow-grid article:nth-child(3)::before { background: #744ccc; }
.flow-grid article:hover { transform: translateY(-3px); box-shadow: 0 14px 30px rgba(27, 59, 91, 0.12); }

.summary-card .lead { margin-bottom: 4px; font-size: clamp(1.08rem, 2vw, 1.34rem); font-weight: 700; }
.flow-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.flow-grid article { box-shadow: none; background: var(--surface-soft); }
.flow-grid article p { margin-bottom: 8px; }
.focus-card { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 18px 20px; border: 1px solid #d9d5ff; border-left: 5px solid #6352d9; border-radius: 13px; background: linear-gradient(110deg, #f7f8ff, #efedff); box-shadow: 0 12px 25px rgba(77, 66, 175, 0.08); }

.evidence-panel { position: sticky; top: 12px; display: grid; gap: 10px; }
.evidence-close { display: none; }
blockquote { margin: 0; border-left: 3px solid var(--primary); padding-left: 12px; }
.status-pill, .count {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  width: fit-content;
  border-radius: 999px;
  padding: 3px 9px;
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-size: 0.78rem;
  font-weight: 700;
}

.count { min-width: 24px; justify-content: center; padding-inline: 7px; }
.warning-stack { display: grid; gap: 8px; margin-bottom: 14px; }
.warning-stack .notice { background: var(--warning-soft); border-color: #e6bf91; }

.claims-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.claim-list { display: grid; gap: 8px; }
.claim-list button,
.claim-part {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  padding: 9px 12px;
  text-align: left;
}

.claim-list button.active,
.claim-part.selected { border-color: var(--primary); background: var(--primary-soft); }
.claim-list button.child { position: relative; margin-left: 18px; width: calc(100% - 18px); border-left: 3px solid #8a83db; }
.claim-list button { transition: transform 150ms ease, border-color 150ms ease; }
.claim-list button:hover { transform: translateX(3px); border-color: var(--primary); }
.user-edit-badge { display: inline-block; margin-bottom: 4px; color: var(--primary); font-size: 0.72rem; font-weight: 700; }
.claim-workspace { display: grid; gap: 16px; }
.claim-heading, .drawing-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.claim-parts { display: flex; gap: 9px; flex-wrap: wrap; }
.claim-part { position: relative; border-top: 4px solid #0f8e9d; box-shadow: 0 7px 18px rgba(26, 61, 91, 0.06); transition: transform 150ms ease, box-shadow 150ms ease; }
.claim-part:hover { transform: translateY(-3px); box-shadow: 0 13px 25px rgba(26, 61, 91, 0.11); }
.claim-part.unclassified { border-color: #d69a59; background: var(--warning-soft); }
.source-box, .raw-source {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  background: #f7f9fb;
  color: #24313c;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.editor { display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 14px; }
select, textarea, input[type="search"] {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  padding: 9px 11px;
}
.editor-actions { justify-content: flex-end; }

.drawing-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 16px; }
.drawing-stage { min-width: 0; }
.drawing-viewport {
  margin-top: 12px;
  min-height: 460px;
  max-height: 640px;
  overflow: auto;
  background: #e9edf0;
  border-radius: 10px;
  display: grid;
  place-items: start center;
  padding: 10px;
}
.drawing-viewport img { max-width: none; width: 100%; transform-origin: top center; transition: width 140ms ease; }
.drawing-empty { place-self: center; padding: 24px; color: var(--muted); text-align: center; }
.drawing-info { align-self: start; }

.source-toolbar { margin-bottom: 10px; }
.source-toolbar label { font-weight: 700; }
.source-toolbar input { flex: 1 1 280px; }
.source-toolbar #source-mode { width: auto; min-width: 170px; flex: 0 0 auto; }
.source-display-note { margin: 0 0 12px; color: var(--muted); font-size: 0.78rem; }
.source-layout { display: grid; grid-template-columns: 138px minmax(0, 1fr); gap: 14px; align-items: start; }
.source-page-navigation { position: sticky; top: 12px; display: grid; gap: 8px; padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.source-page-navigation strong { font-size: 0.8rem; }
.source-page-navigation > div { max-height: 560px; display: grid; gap: 5px; overflow-y: auto; }
.source-page-navigation button { min-height: 38px; border: 1px solid transparent; border-radius: 8px; background: var(--surface-soft); color: var(--text); text-align: left; padding: 6px 9px; }
.source-page-navigation button.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-strong); font-weight: 800; }
.source-mobile-nav { display: none; margin-bottom: 10px; }
.source-pages { display: grid; gap: 14px; min-width: 0; }
.source-page-card { scroll-margin-top: 14px; overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); box-shadow: var(--shadow); }
.source-page-card > header { display: flex; align-items: center; gap: 7px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-soft); }
.source-page-card > header span { padding: 2px 6px; border-radius: 5px; background: var(--primary); color: white; font-size: 0.65rem; font-weight: 900; }
.source-page-card > header strong { font-size: 0.84rem; }
.source-readable-page { padding: 18px clamp(16px, 3vw, 30px); }
.source-block { overflow-wrap: anywhere; }
.source-paragraph { margin: 0 0 0.9em; line-height: 1.95; }
.source-heading { margin: 1.25em 0 0.55em; padding: 7px 10px; border-left: 4px solid var(--primary); background: var(--primary-soft); color: var(--primary-strong); font-weight: 800; }
.source-marker { width: fit-content; margin: 1.15em 0 0.35em; padding: 3px 8px; border-radius: 7px; background: #eef0f7; color: #405170; font-weight: 800; }
.source-symbol { display: inline-flex; margin: 4px 5px 4px 0; padding: 2px 7px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 0.76rem; }
.source-raw-page { margin: 0; padding: 18px; background: #f7f9fb; color: #24313c; white-space: pre-wrap; overflow-wrap: anywhere; font-family: "Yu Gothic UI", "Meiryo", sans-serif; line-height: 1.75; }
.raw-source { max-height: 650px; overflow: auto; font-family: "Yu Gothic UI", "Meiryo", sans-serif; line-height: 1.75; }
mark { background: #ffe59a; color: #2a2209; }

.comparison-layout { margin-top: 18px; }
.comparison-documents { margin-top: 14px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.comparison-documents[hidden] { display: none; }
.comparison-documents article { position: relative; overflow: hidden; padding: 15px 17px 15px 21px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); box-shadow: 0 9px 22px rgba(24, 55, 83, 0.07); }
.comparison-documents article::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: #0d91a2; }
.comparison-documents article:nth-child(2)::before { background: #6553d8; }
.comparison-table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: 12px; overflow: hidden; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: var(--surface-soft); }
tbody tr { cursor: pointer; }
tbody tr:hover, tbody tr.selected { background: var(--primary-soft); }
.comparison-status { display: inline-flex; width: fit-content; padding: 5px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 800; white-space: nowrap; }
.status-同一 { background: #dff7ed; color: #116241; }
.status-明示候補 { background: #e2f4f8; color: #075c70; }
.status-実質対応候補 { background: #eeedff; color: #5144b5; }
.status-記載を発見できず { background: #fff0f2; color: #9b2c3b; }
.status-比較不能 { background: #fff3e2; color: #855018; }

/* 原文：公報ワードマッパー */
.word-mapper-shell { height: min(760px, calc(100vh - 185px)); min-height: 620px; display: grid; grid-template-columns: 300px minmax(0, 1fr) 72px; overflow: hidden; overflow-anchor: none; border: 1px solid var(--line); border-radius: 16px; background: #eef3f1; box-shadow: var(--shadow); }
.word-mapper-controls { min-width: 0; display: flex; flex-direction: column; overflow: hidden; border-right: 1px solid var(--line); background: #f7faf8; }
.mapper-mode-tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 10px; background: #edf3ef; }
.mapper-mode-tabs button { min-height: 42px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 800; }
.mapper-mode-tabs button.active { background: white; color: var(--primary-strong); box-shadow: 0 5px 15px rgba(21, 52, 43, 0.1); }
.mapper-mode-panel { padding: 14px 16px 0; }
.mapper-section-title, .mapper-selection-head, .mapper-hits-head, .word-mapper-viewer > header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.mapper-section-title h3 { margin: 0; font-size: 1.1rem; }
.mapper-section-title span { padding: 3px 8px; border-radius: 999px; background: #e3f2eb; color: #117153; font-size: 0.72rem; font-weight: 800; }
.mapper-section-title button, .mapper-selection-head button { min-height: 32px; border: 1px solid var(--line); border-radius: 7px; background: white; color: var(--text); padding: 3px 8px; }
.mapper-frequency-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 13px; }
.mapper-frequency-grid label { display: grid; grid-template-columns: 1fr auto; gap: 5px; color: var(--muted); font-size: 0.72rem; }
.mapper-frequency-grid output { color: #117153; font-weight: 800; }
.mapper-frequency-grid input { grid-column: 1 / -1; width: 100%; accent-color: #117b5a; }
.mapper-help { margin: 10px 0; color: var(--muted); font-size: 0.72rem; }
.mapper-selection-head { padding-top: 9px; border-top: 1px solid var(--line); font-size: 0.76rem; }
.mapper-selection-head > div { display: flex; gap: 4px; }
.mapper-candidate-list { height: 150px; margin-top: 8px; overflow-y: auto; overscroll-behavior: contain; border-block: 1px solid var(--line); }
.mapper-candidate-list > p, .mapper-result-list > p { padding: 10px 0; color: var(--muted); font-size: 0.76rem; }
.mapper-candidate-row { min-height: 38px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 6px 8px; border-bottom: 1px solid #e6ece8; cursor: pointer; }
.mapper-candidate-row.selected { background: #e2f2eb; }
.mapper-candidate-row input { width: 17px; height: 17px; accent-color: #117b5a; }
.mapper-candidate-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mapper-candidate-row small { color: var(--muted); }
.mapper-manual-list { display: grid; gap: 7px; }
.mapper-manual-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) 34px; gap: 6px; }
.mapper-manual-row input[type="color"] { width: 34px; min-height: 40px; padding: 3px; border: 1px solid var(--line); border-radius: 7px; background: white; }
.mapper-manual-row input[type="text"] { min-height: 40px; }
.mapper-manual-row button { border: 1px solid var(--line); border-radius: 7px; background: white; }
.mapper-selection-summary { margin: 12px 16px 6px; color: var(--muted); font-size: 0.72rem; }
.mapper-apply { min-height: 46px; margin: 0 16px 12px; display: flex; align-items: center; justify-content: space-between; border: 0; border-radius: 9px; padding: 8px 12px; background: #0f7b59; color: white; font-weight: 800; }
.mapper-apply small { padding: 1px 5px; border: 1px solid rgba(255,255,255,0.35); border-radius: 5px; }
.mapper-hits-head { padding: 12px 16px 8px; border-top: 1px solid var(--line); }
.mapper-hits-head span { font-size: 0.76rem; }
.mapper-hits-head strong { font-size: 1.35rem; }
.mapper-result-list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 12px 12px; }
.mapper-result-item { width: 100%; display: grid; gap: 2px; margin-bottom: 7px; border: 1px solid var(--line); border-left: 4px solid var(--result-color); border-radius: 8px; padding: 8px 9px; background: white; color: var(--text); text-align: left; }
.mapper-result-item.active { outline: 2px solid var(--result-color); }
.mapper-result-item > span { color: var(--muted); font-size: 0.65rem; }
.mapper-result-item p { margin: 2px 0 0; overflow: hidden; color: var(--muted); font-size: 0.7rem; white-space: nowrap; text-overflow: ellipsis; }

.word-mapper-viewer { min-width: 0; min-height: 0; position: relative; display: grid; grid-template-rows: auto minmax(0, 1fr); overflow: hidden; background: #e8eeeb; }
.word-mapper-viewer > header { min-height: 52px; padding: 8px 14px; border-bottom: 1px solid var(--line); background: white; }
.word-mapper-viewer > header > div:first-child { display: flex; gap: 9px; align-items: baseline; min-width: 0; }
.word-mapper-viewer > header strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.word-mapper-viewer > header span { color: var(--muted); font-size: 0.72rem; white-space: nowrap; }
.mapper-zoom { display: flex; align-items: center; gap: 8px; }
.mapper-zoom button { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 8px; background: white; }
.mapper-loading, .mapper-empty { position: absolute; inset: 52px 0 0; z-index: 4; display: grid; place-content: center; justify-items: center; gap: 8px; padding: 20px; background: rgba(240,245,242,0.93); text-align: center; }
.mapper-pdf-scroll { min-width: 0; min-height: 0; height: 100%; overflow: auto; overflow-anchor: none; overscroll-behavior: contain; scrollbar-gutter: stable both-edges; touch-action: pan-x pan-y; padding: 26px; }
.mapper-pages { width: max-content; min-width: 100%; display: grid; justify-items: center; gap: 18px; overflow-anchor: none; }
.mapper-pdf-page { position: relative; flex: none; overflow: hidden; background: white; box-shadow: 0 5px 18px rgba(21, 45, 36, 0.13); }
.mapper-pdf-page canvas { position: absolute; inset: 0; display: block; }
.mapper-text-layer { position: absolute; inset: 0; overflow: hidden; line-height: 1; transform-origin: 0 0; }
.mapper-text-item { position: absolute; color: transparent; white-space: pre; transform-origin: 0 0; cursor: text; }
.mapper-page-number { position: absolute; z-index: 3; top: 12px; right: 14px; color: #495b54; font-size: 11px; }
.mapper-text-hit { color: transparent; background: color-mix(in srgb, var(--hit-color) 42%, transparent); border-radius: 2px; }
.mapper-text-hit.current-hit { outline: 2px solid var(--hit-color); outline-offset: 1px; }

.word-mapper-map { min-width: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; justify-items: center; gap: 8px; padding: 12px 8px; border-left: 1px solid var(--line); background: #f4f7f5; }
.word-mapper-map > strong { font-size: 0.7rem; }
.mapper-map-track { position: relative; width: 42px; min-height: 0; height: 100%; border: 1px solid #cbd8d1; border-radius: 6px; background: #dfe8e3; cursor: pointer; }
.mapper-map-start, .mapper-map-end { position: absolute; left: 50%; color: var(--muted); font-size: 0.62rem; transform: translateX(-50%); }
.mapper-map-start { top: 3px; }
.mapper-map-end { bottom: 3px; }
.mapper-map-marker { position: absolute; left: var(--marker-left); z-index: 3; width: var(--marker-width); min-width: 2px; height: 4px; border: 0; border-radius: 2px; padding: 0; background: var(--marker-color); }
.mapper-map-marker.active { outline: 2px solid #17212b; }
.mapper-viewport-indicator { position: absolute; inset-inline: -5px; z-index: 2; border: 1px solid rgba(18, 110, 80, 0.35); border-radius: 5px; background: rgba(24, 146, 104, 0.08); pointer-events: none; }
.mapper-map-legend { width: 100%; display: grid; gap: 3px; overflow: hidden; }
.mapper-legend-item { overflow: hidden; color: var(--muted); font-size: 0.56rem; text-align: center; white-space: nowrap; text-overflow: ellipsis; }
.mapper-legend-item::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 3px; border-radius: 50%; background: var(--legend-color); }

.analysis-pipeline { position: relative; z-index: 1; display: flex; align-items: center; gap: 10px; margin-top: 22px; padding-top: 18px; border-top: 1px solid rgba(153, 220, 235, 0.2); }
.analysis-pipeline span { display: grid; gap: 1px; color: #d7e9f5; font-size: 0.72rem; line-height: 1.25; }
.analysis-pipeline b { color: #77e3e8; font-size: 0.65rem; letter-spacing: 0.12em; }
.analysis-pipeline i { flex: 1; min-width: 18px; height: 1px; background: linear-gradient(90deg, #49becb, rgba(121, 146, 220, 0.3)); }

.flow-grid article { overflow: visible; }
.flow-grid article:not(:last-child)::after { content: "→"; position: absolute; z-index: 2; right: -18px; top: 50%; width: 23px; height: 23px; display: grid; place-items: center; border-radius: 50%; background: white; color: #4369d1; font-weight: 900; box-shadow: 0 5px 14px rgba(36, 67, 101, 0.15); transform: translateY(-50%); }

.claim-list button { display: grid; gap: 3px; }
.claim-list-name { font-weight: 800; }
.claim-type { width: fit-content; padding: 2px 7px; border-radius: 999px; font-size: 0.66rem; font-weight: 800; }
.claim-type.independent { background: #dff7ed; color: #116241; }
.claim-type.dependent { background: #eeedff; color: #5144b5; }
.claim-part.kind-component { border-top-color: #2875d7; }
.claim-part.kind-relation { border-top-color: #7654d5; }
.claim-part.kind-condition { border-top-color: #e19528; }
.claim-part.kind-function { border-top-color: #1b9b73; }
.claim-part.kind-unclassified { border-top-color: #d69a59; }

.comparison-summary { margin-top: 10px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.comparison-summary article { padding: 17px 19px; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(125deg, #ffffff, #f4f8fb); box-shadow: 0 10px 24px rgba(24, 55, 83, 0.07); }
.comparison-summary article strong { display: block; margin: 3px 0; color: var(--navy); font-size: clamp(1.4rem, 3vw, 2.1rem); line-height: 1.1; }
.comparison-summary article p { margin-bottom: 0; }
.comparison-summary article.is-same { border-color: #a8e1cb; background: linear-gradient(125deg, #effcf7, #e4f8f1); }
.comparison-summary article.is-same strong { color: #116241; }

footer { padding: 24px 0 38px; color: var(--muted); font-size: 0.82rem; }

.busy-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(13, 26, 36, 0.54);
}
.busy-overlay[hidden] { display: none; }
.busy-card {
  width: min(430px, 100%);
  border-radius: 16px;
  background: var(--surface);
  padding: 24px;
  display: grid;
  justify-items: center;
  gap: 10px;
  text-align: center;
  box-shadow: var(--shadow);
}
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--primary); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 760px) {
  .app-header { align-items: flex-start; padding-top: 14px; }
  .header-actions { justify-content: flex-end; }
  .result-layout, .comparison-layout, .claims-layout, .drawing-layout, .flow-grid { grid-template-columns: 1fr; }
  .evidence-panel { position: static; }
  .evidence-close { display: block; justify-self: end; min-width: 44px; min-height: 44px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
  .claim-list { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
  .claim-list button.child { margin-left: 0; width: 100%; }
  .drawing-viewport { min-height: 360px; }
  .comparison-documents { grid-template-columns: 1fr; }
  .source-layout { grid-template-columns: 1fr; }
  .source-page-navigation { display: none; }
  .source-mobile-nav { display: grid; gap: 5px; }
  .source-toolbar #source-mode { width: 100%; }
  .word-mapper-shell { height: auto; min-height: 0; grid-template-columns: 1fr; overflow: visible; }
  .word-mapper-controls { max-height: 620px; border-right: 0; border-bottom: 1px solid var(--line); }
  .word-mapper-viewer { height: 680px; }
  .word-mapper-map { display: none; }
  .comparison-summary { grid-template-columns: 1fr; }
  .flow-grid article:not(:last-child)::after { content: "↓"; right: 18px; top: auto; bottom: -18px; transform: none; }
  .quick-subject, .quick-problem, .quick-point, .quick-benefit { grid-column: span 6; }
  .comparison-table-wrap { overflow: visible; }
  .comparison-table-wrap table,
  .comparison-table-wrap tbody,
  .comparison-table-wrap tr,
  .comparison-table-wrap td { display: block; width: 100%; }
  .comparison-table-wrap thead { display: none; }
  .comparison-table-wrap tr { margin-bottom: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); overflow: hidden; }
  .comparison-table-wrap td { border-bottom: 0; padding: 8px 12px; }
  .comparison-table-wrap td::before { content: attr(data-label); display: block; color: var(--muted); font-size: 0.75rem; font-weight: 700; }
}

@media (max-width: 480px) {
  .app-header, .workspace-tabs, main, footer { width: min(100% - 20px, 1180px); }
  .app-header { display: grid; }
  .header-actions { justify-content: flex-start; }
  .document-header { display: grid; }
  .upload-shell { margin-top: 16px; }
  .upload-intro { padding: 24px 20px; }
  .upload-intro-main { grid-template-columns: 1fr; }
  .upload-intro-visual { display: none; }
  .analysis-pipeline { display: grid; grid-template-columns: 1fr; }
  .analysis-pipeline i { width: 1px; min-width: 1px; height: 12px; margin-left: 12px; background: linear-gradient(#49becb, rgba(121, 146, 220, 0.3)); }
  .quick-grid { grid-template-columns: 1fr; }
  .quick-subject, .quick-problem, .quick-point, .quick-benefit { grid-column: 1; min-height: 0; }
  .dropzone { min-height: 180px; padding: 18px; }
  .saved-controls { grid-template-columns: 1fr; }
  .summary-card, .flow-grid article, .evidence-panel, .claim-workspace, .drawing-stage, .drawing-info { padding: 14px; }
  .focus-card { display: grid; }
  th, td { padding: 9px 7px; }
}

@media print {
  body { background: white; }
  .app-header, .workspace-tabs, .result-tabs, button, #screen-upload, #screen-compare, footer, .busy-overlay { display: none !important; }
  body.print-result #screen-result, body.print-result .result-panel.active { display: block !important; }
  body.print-compare #screen-compare, body.print-compare #comparison-results { display: block !important; }
  body.print-compare #screen-result { display: none !important; }
  main { width: 100%; }
  .summary-card, .flow-grid article, .evidence-panel, .claim-workspace, .drawing-stage, .drawing-info { box-shadow: none; break-inside: avoid; }
}
