:root {
      color-scheme: light;
      --bg: #f4f6f8;
      --panel: #ffffff;
      --panel-2: #f6f8fa;
      --line: #d0d7de;
      --text: #1f2328;
      --muted: #57606a;
      --accent: #0969da;
      --accent-2: #0757b5;
      --danger: #cf222e;
      --control-bg: #ffffff;
      --hover-line: #8c959f;
      --primary-text: #ffffff;
      --code-bg: #ffffff;
      --code-gutter: #f6f8fa;
      --code-text: #1f2328;
      --code-muted: #8c959f;
      --syntax-keyword: #0000ff;
      --syntax-type: #267f99;
      --syntax-string: #a31515;
      --syntax-number: #098658;
      --syntax-comment: #008000;
      --restored-text: #8250df;
      --guide-color: rgba(9, 105, 218, .28);
      --selection: rgba(9, 105, 218, .18);
      --scroll-thumb: #8c959f;
      --scroll-track: #eaeef2;
    }
    :root[data-theme="dark"] :is(
      .toolbar,
      .highlight-legend,
      .display-settings,
      .editors
    ) {
      color-scheme: dark;
      --bg: #0d1117;
      --panel: #161b22;
      --panel-2: #21262d;
      --line: #30363d;
      --text: #e6edf3;
      --muted: #8b949e;
      --accent: #2f81f7;
      --accent-2: #1f6feb;
      --danger: #ff7b72;
      --control-bg: #0d1117;
      --hover-line: #8b949e;
      --primary-text: #ffffff;
      --code-bg: #252526;
      --code-gutter: #1f1f1f;
      --code-text: #f0f0f0;
      --code-muted: #b8b8b8;
      --syntax-keyword: #569cd6;
      --syntax-type: #4ec9b0;
      --syntax-string: #ce9178;
      --syntax-number: #b5cea8;
      --syntax-comment: #6a9955;
      --restored-text: #fff3a3;
      --guide-color: rgba(88, 166, 255, .34);
      --selection: rgba(38, 79, 120, .65);
      --scroll-thumb: #6e7681;
      --scroll-track: #21262d;
    }
    * {
      box-sizing: border-box;
    }
    body {
      margin: 0;
      min-height: 100vh;
      background: var(--bg);
      color: var(--text);
      font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    }
    main {
      width: max(min(1400px, 96vw), var(--workspace-width, 1602px));
      max-width: none;
      margin: 0 auto;
      padding: 24px 0 40px;
    }
    header {
      display: flex;
      align-items: end;
      justify-content: space-between;
      gap: 20px;
      margin-bottom: 18px;
    }
    h1 {
      margin: 0;
      font-size: clamp(1.5rem, 2.5vw, 1.9rem);
      letter-spacing: .01em;
    }
    .lead {
      margin: 7px 0 0;
      color: var(--muted);
    }
    .offline {
      color: var(--accent);
      font-size: .85rem;
      white-space: nowrap;
    }
    .offline::before {
      content: "●";
      margin-right: 7px;
    }
    .toolbar, .options, .status {
      display: flex;
      align-items: center;
      flex-wrap: wrap;
      gap: 10px;
    }
    .toolbar {
      justify-content: space-between;
      padding: 12px 14px;
      background: var(--panel);
      border: 1px solid var(--line);
      border-radius: 8px 8px 0 0;
    }
    .highlight-legend {
      display: flex;
      align-items: center;
      flex-wrap: wrap;
      gap: 6px 12px;
      padding: 8px 14px;
      color: var(--muted);
      background: var(--panel);
      border-right: 1px solid var(--line);
      border-bottom: 1px solid var(--line);
      border-left: 1px solid var(--line);
      font-size: .78rem;
    }
    .highlight-legend button {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 4px 7px;
      color: var(--text);
      background: var(--panel-2);
      border: 1px solid var(--line);
      border-radius: 6px;
      font: inherit;
      cursor: pointer;
      white-space: nowrap;
    }
    .highlight-legend button:hover {
      color: var(--text);
      background: var(--control-bg);
      border-color: var(--hover-line);
    }
    .highlight-legend button[aria-pressed="false"] {
      opacity: .42;
      text-decoration: line-through;
    }
    .highlight-legend i {
      width: 13px;
      height: 13px;
      background: var(--legend-color, var(--highlight));
      border: 1px solid var(--line);
      border-radius: 3px;
    }
    .display-settings {
      display: grid;
      grid-template-columns: repeat(5, max-content);
      grid-auto-rows: 48px;
      align-items: center;
      justify-content: start;
      gap: 10px;
      padding: 10px 14px;
      background: var(--panel);
      border-right: 1px solid var(--line);
      border-bottom: 1px solid var(--line);
      border-left: 1px solid var(--line);
    }
    .display-settings > * {
      align-self: center;
      height: 48px;
      min-height: 48px;
    }
    .display-settings .setting-control,
    .display-settings .font-control,
    .display-settings .theme-control,
    .display-settings .toggle-option,
    .display-settings .display-actions {
      align-items: center;
    }
    .setting-control {
      display: grid;
      justify-self: start;
      grid-template-columns: 90px minmax(0, 1fr);
      align-items: center;
      gap: 10px;
      min-width: 0;
      min-height: 48px;
      padding: 7px 10px;
      background: var(--panel-2);
      border: 1px solid var(--line);
      border-radius: 6px;
      overflow: hidden;
      white-space: nowrap;
    }
    .setting-control > span {
      color: var(--muted);
    }
    .size-stepper {
      display: grid;
      grid-template-columns: 36px 72px 36px;
      width: max-content;
      max-width: 100%;
      align-items: center;
      justify-content: start;
      gap: 7px;
      min-width: 0;
    }
    .size-stepper button {
      width: 36px;
      height: 34px;
      padding: 0;
      font-size: 1.15rem;
      line-height: 1;
      touch-action: none;
      user-select: none;
    }
    .size-stepper button:hover {
      transform: none;
    }
    .size-number {
      width: 72px;
      min-width: 0;
      max-width: 100%;
      padding: 7px 6px;
      color: var(--text);
      background: var(--control-bg);
      border: 1px solid var(--line);
      border-radius: 7px;
      font: 12px/1.2 "Cascadia Code", Consolas, monospace;
      text-align: right;
      appearance: textfield;
    }
    .size-number::-webkit-inner-spin-button,
    .size-number::-webkit-outer-spin-button {
      margin: 0;
      appearance: none;
    }
    .display-settings .toggle-option {
      width: max-content;
      max-width: 100%;
      min-height: 48px;
      padding: 7px 12px;
      background: var(--panel-2);
      border: 1px solid var(--line);
      border-radius: 6px;
    }
    .display-settings .font-control,
    .display-settings .theme-control {
      display: grid;
      grid-template-columns: 90px 190px;
      align-items: center;
      gap: 10px;
      min-height: 48px;
      padding: 7px 10px;
      background: var(--panel-2);
      border: 1px solid var(--line);
      border-radius: 6px;
    }
    .display-settings .font-control select {
      width: 190px;
      padding: 7px 9px;
    }
    .display-settings .theme-control {
      grid-template-columns: 90px 110px;
    }
    .display-settings .theme-control select {
      width: 110px;
      padding: 7px 9px;
    }
    .display-actions {
      display: flex;
      align-items: center;
      justify-content: flex-start;
      gap: 8px;
      min-height: 48px;
      padding: 7px 10px;
      background: var(--panel-2);
      border: 1px solid var(--line);
      border-radius: 6px;
    }
    label {
      color: var(--muted);
      font-size: .9rem;
    }
    .toggle-option {
      display: inline-flex;
      align-items: center;
      gap: 7px;
      cursor: pointer;
      user-select: none;
    }
    .toggle-option input {
      width: 16px;
      height: 16px;
      margin: 0;
      accent-color: var(--accent);
    }
    select, button {
      border: 1px solid var(--line);
      border-radius: 6px;
      color: var(--text);
      background: var(--panel-2);
      padding: 9px 13px;
      font: inherit;
    }
    button {
      cursor: pointer;
      font-weight: 650;
      transition: transform .12s, border-color .12s, background .12s;
    }
    button:hover {
      transform: none;
      border-color: var(--hover-line);
    }
    button.primary {
      color: var(--primary-text);
      background: var(--accent);
      border-color: var(--accent);
    }
    button.primary:hover {
      background: var(--accent-2);
    }
    button:disabled {
      cursor: not-allowed;
      opacity: .45;
      transform: none;
    }
    .editors {
      display: grid;
      grid-template-columns: var(--source-width, 800px) var(--result-width, 800px);
      width: max-content;
      min-width: 100%;
      margin-inline: auto;
      background: var(--code-bg);
      border: 1px solid var(--line);
      border-top: 0;
      border-radius: 0 0 8px 8px;
      overflow: visible;
    }
    .editor {
      display: flex;
      flex-direction: column;
      min-width: 0;
      background: var(--panel);
    }
    .editor + .editor {
      border-left: 1px solid var(--line);
    }
    .editor-title {
      display: flex;
      flex-direction: column;
      align-items: stretch;
      gap: 8px;
      flex: 0 0 auto;
      min-height: 60px;
      padding: 10px 14px;
      border-bottom: 1px solid var(--line);
      font-weight: 700;
    }
    .editor-heading {
      display: flex;
      align-items: center;
      justify-content: space-between;
      min-height: 38px;
      gap: 10px;
    }
    .editor-heading-actions {
      display: flex;
      align-items: center;
      gap: 8px;
    }
    .editor-heading-actions button {
      padding: 6px 10px;
      font-size: .78rem;
    }
    .editor-size-controls {
      display: flex;
      gap: 6px;
      min-width: 0;
    }
    .editor-size-controls .setting-control.compact {
      grid-template-columns: 34px minmax(0, 1fr);
      flex: 0 0 auto;
      width: max-content;
      min-height: 42px;
      padding: 3px 5px;
      gap: 4px;
      border-color: var(--line);
    }
    .editor-size-controls .size-stepper {
      grid-template-columns: 28px 50px 28px;
      gap: 3px;
    }
    .editor-size-controls .size-stepper button {
      width: 28px;
      height: 30px;
      font-size: 1rem;
    }
    .editor-size-controls .size-number {
      width: 50px;
      padding: 5px 3px;
    }
    .counter {
      color: var(--muted);
      font-size: .78rem;
      font-weight: 400;
    }
    .code-layer {
      position: relative;
      flex: 0 0 auto;
      min-height: 300px;
      overflow: hidden;
      background: var(--code-bg);
      border-bottom: 1px solid var(--line);
    }
    .horizontal-scroll {
      width: calc(100% - 52px);
      height: 18px;
      margin-left: 52px;
      overflow-x: auto;
      overflow-y: hidden;
      background: var(--code-gutter);
      scrollbar-color: var(--scroll-thumb) var(--scroll-track);
    }
    .horizontal-scroll > div {
      height: 1px;
    }
    .code-highlight,
    textarea {
      width: calc(100% - 52px);
      height: 100%;
      min-height: 100%;
      border: 0;
      padding: 18px 18px 18px 6px;
      font: var(--code-font-size, 14px)/var(--code-line-height, 23px) var(--code-font-family, "Cascadia Code", Consolas, monospace);
      tab-size: 4;
      direction: ltr;
      text-align: left;
      white-space: pre;
      overflow-wrap: normal;
    }
    .code-highlight {
      position: absolute;
      inset: 0 0 0 52px;
      width: auto;
      z-index: 2;
      margin: 0;
      overflow: hidden;
      color: var(--code-text);
      background: transparent;
      pointer-events: none;
    }
    .code-highlight mark {
      color: inherit;
      background: var(--highlight, rgba(244, 211, 94, .35));
      border-radius: 2px;
    }
    .code-highlight mark.source-anonymization {
      background: var(--highlight, rgba(244, 211, 94, .35));
    }
    .code-highlight mark.source-anonymization.restored-anonymization {
      box-shadow: inset 0 -2px 0 var(--accent);
    }
    .code-highlight mark.restored-anonymization,
    .code-highlight mark.restored-anonymization span {
      color: var(--restored-text);
      font-weight: 800;
      text-decoration: underline;
      text-decoration-color: var(--accent);
      text-decoration-thickness: 2px;
      text-underline-offset: 3px;
    }
    #sourceHighlight mark.java-source-anonymization.restored-anonymization,
    #sourceHighlight mark.java-source-anonymization.restored-anonymization span {
      color: #9a6700;
    }
    :root[data-theme="dark"] #sourceHighlight
      mark.java-source-anonymization.restored-anonymization,
    :root[data-theme="dark"] #sourceHighlight
      mark.java-source-anonymization.restored-anonymization span {
      color: #ffd866;
    }
    #sourceHighlight mark.frontend-source-anonymization.restored-anonymization,
    #sourceHighlight mark.frontend-source-anonymization.restored-anonymization span {
      color: #9a6700;
    }
    :root[data-theme="dark"] #sourceHighlight
      mark.frontend-source-anonymization.restored-anonymization,
    :root[data-theme="dark"] #sourceHighlight
      mark.frontend-source-anonymization.restored-anonymization span {
      color: #ffd866;
    }
    .syntax-keyword {
      color: var(--syntax-keyword);
      font-weight: 400;
    }
    .syntax-type {
      color: var(--syntax-type);
    }
    .syntax-string {
      color: var(--syntax-string);
    }
    .syntax-number {
      color: var(--syntax-number);
    }
    .syntax-comment {
      color: var(--syntax-comment);
      font-style: normal;
    }
    .code-highlight .indent-marker {
      color: var(--code-muted);
      font-style: normal;
      font-weight: 400;
      text-decoration: none;
      opacity: .8;
    }
    .indent-guides {
      position: absolute;
      inset: 0 0 0 52px;
      z-index: 1;
      padding: 18px 18px 18px 6px;
      font: var(--code-font-size, 14px)/var(--code-line-height, 23px) var(--code-font-family, "Cascadia Code", Consolas, monospace);
      overflow: hidden;
      pointer-events: none;
    }
    .indent-guides-content {
      min-width: 100%;
      min-height: 100%;
      transform: translate(var(--guide-scroll-x, 0), var(--guide-scroll-y, 0));
      will-change: transform;
    }
    .indent-guide-line {
      position: relative;
      display: block;
      width: 100%;
      height: var(--code-line-height, 23px);
    }
    .brace-guide {
      position: absolute;
      top: 0;
      bottom: 0;
      left: calc(var(--brace-column) * 1ch);
      width: 2px;
      background: var(--guide-color);
      opacity: max(.2, calc(.9 - var(--brace-level) * .12));
    }
    .brace-guide.guide-start {
      top: calc(50% - 10px);
    }
    .brace-guide.guide-end {
      bottom: calc(50% - 10px);
    }
    .highlight-package {
      --highlight: rgba(96, 165, 250, .24);
      --legend-color: #60a5fa;
    }
    .highlight-class {
      --highlight: rgba(192, 132, 252, .25);
      --legend-color: #c084fc;
    }
    .highlight-method {
      --highlight: rgba(74, 222, 128, .23);
      --legend-color: #4ade80;
    }
    .highlight-field {
      --highlight: rgba(251, 146, 60, .25);
      --legend-color: #fb923c;
    }
    .highlight-identifier {
      --highlight: rgba(250, 204, 21, .22);
      --legend-color: #facc15;
    }
    .highlight-literal {
      --highlight: rgba(248, 113, 113, .24);
      --legend-color: #f87171;
    }
    .highlight-sql-table {
      --highlight: rgba(34, 211, 238, .25);
      --legend-color: #22d3ee;
    }
    .highlight-sql-column {
      --highlight: rgba(163, 230, 53, .23);
      --legend-color: #a3e635;
    }
    .highlight-comment {
      --highlight: rgba(148, 163, 184, .24);
      --legend-color: #94a3b8;
    }
    .highlight-component {
      --highlight: rgba(192, 132, 252, .25);
      --legend-color: #c084fc;
    }
    .highlight-selector {
      --highlight: rgba(74, 222, 128, .23);
      --legend-color: #4ade80;
    }
    .highlight-log-address {
      --highlight: rgba(34, 211, 238, .23);
      --legend-color: #22d3ee;
    }
    .highlight-log-identity {
      --highlight: rgba(192, 132, 252, .23);
      --legend-color: #c084fc;
    }
    .highlight-log-secret {
      --highlight: rgba(248, 113, 113, .24);
      --legend-color: #f87171;
    }
    .highlight-log-path {
      --highlight: rgba(250, 204, 21, .22);
      --legend-color: #facc15;
    }
    .highlight-log-identifier {
      --highlight: rgba(74, 222, 128, .22);
      --legend-color: #4ade80;
    }
    .line-numbers {
      position: absolute;
      inset: 0 auto 0 0;
      z-index: 4;
      width: 52px;
      height: 100%;
      min-height: 100%;
      margin: 0;
      padding: 18px 10px 18px 0;
      overflow: hidden;
      color: var(--code-muted);
      background: var(--code-gutter);
      border-right: 1px solid var(--line);
      font: var(--code-font-size, 14px)/var(--code-line-height, 23px) var(--code-font-family, "Cascadia Code", Consolas, monospace);
      text-align: right;
      user-select: none;
      pointer-events: none;
    }
    textarea {
      position: relative;
      z-index: 3;
      margin-left: 52px;
      height: 100%;
      resize: none;
      outline: 0;
      color: transparent;
      caret-color: var(--code-text);
      background: transparent;
      overflow-x: hidden;
      overflow-y: auto;
    }
    textarea::placeholder {
      color: var(--code-muted);
    }
    textarea::selection {
      color: transparent;
      background: var(--selection);
    }
    textarea[readonly] {
      background: transparent;
    }
    .report {
      margin-top: 16px;
      display: grid;
      grid-template-columns: auto 1fr;
      gap: 16px;
      align-items: start;
    }
    .stats, .warning {
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--panel);
      padding: 14px 16px;
    }
    .stats {
      display: flex;
      gap: 20px;
    }
    .stat strong {
      display: block;
      color: var(--accent);
      font-size: 1.25rem;
    }
    .stat span {
      color: var(--muted);
      font-size: .75rem;
    }
    .warning {
      color: var(--muted);
    }
    .warning.danger {
      color: var(--danger);
      border-color: #ff8182;
    }
    .hidden {
      display: none;
    }
    :root[data-theme="dark"] .editors .editor,
    :root[data-theme="dark"] .editors .editor-title {
      color: #e6edf3;
      background: #161b22;
    }
    :root[data-theme="dark"] .editors .code-layer {
      color: #f0f0f0;
      background: #252526;
    }
    :root[data-theme="dark"] .editors .code-highlight {
      color: #f0f0f0;
      background: transparent;
    }
    :root[data-theme="dark"] .editors .line-numbers,
    :root[data-theme="dark"] .editors .horizontal-scroll {
      color: #b8b8b8;
      background: #1f1f1f;
    }
    :root[data-theme="dark"] .editors textarea {
      caret-color: #f0f0f0;
      background: transparent;
    }
    :root[data-theme="dark"] .editors .syntax-keyword {
      color: #569cd6;
    }
    :root[data-theme="dark"] .editors .syntax-type {
      color: #4ec9b0;
    }
    :root[data-theme="dark"] .editors .syntax-string {
      color: #ce9178;
    }
    :root[data-theme="dark"] .editors .syntax-number {
      color: #b5cea8;
    }
    :root[data-theme="dark"] .editors .syntax-comment {
      color: #79b86b;
    }
    @media (max-width: 800px) {
      main {
        width: 96vw;
        margin: 0 auto;
      }
      .display-settings {
        grid-template-columns: minmax(0, 1fr);
      }
      .display-settings .toggle-option {
        width: 100%;
      }
      header {
        align-items: start;
        flex-direction: column;
      }
      .editors {
        grid-template-columns: 1fr;
        width: 100%;
      }
      .editor + .editor {
        border-left: 0;
        border-top: 1px solid var(--line);
      }
      .report {
        grid-template-columns: 1fr;
      }
      textarea {
        min-height: 360px;
      }
    }

/* ツール固有CSSより優先する共通コンポーネントの最終表示値 */
.editors .editor-title,
.editors .editor-heading,
.editors .editor-heading > span:not(.counter),
.editors .editor-heading > strong {
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 1rem;
  font-weight: 700;
  line-height: normal;
}

.editors .editor-heading .counter {
  color: var(--muted);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: .78rem;
  font-weight: 400;
}

.editors .editor-size-controls .setting-control.compact > span {
  color: var(--muted);
  font: inherit;
}

.editors .editor-size-controls {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  margin: 0;
  padding: 0;
}

.editors .editor-size-controls .setting-control.compact {
  flex: 0 0 auto;
  margin: 0;
}

.editors .editor-size-controls .size-number {
  font: 12px/1.2 "Cascadia Code", Consolas, monospace !important;
}

.display-settings > .setting-control > span {
  color: var(--muted);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 1rem;
  font-weight: 400;
  line-height: normal;
}

.display-settings > .setting-control .size-number {
  font: 12px/1.2 "Cascadia Code", Consolas, monospace !important;
}

.editors .code-layer textarea,
.editors .code-layer textarea::placeholder {
  font: var(--code-font-size, 14px)/var(--code-line-height, 23px)
    var(--code-font-family, "Cascadia Code", Consolas, monospace);
}

.editors .code-layer textarea::placeholder {
  color: var(--code-muted);
  opacity: 1;
}

.display-settings .display-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  height: 48px;
  min-height: 48px;
  padding: 7px 10px;
  overflow: hidden;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  align-self: center;
}

.display-settings .display-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  height: 34px;
  margin: 0;
  padding: 0 12px;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  line-height: 1;
  vertical-align: middle;
  transform: none;
}

.display-settings .display-actions button:disabled {
  cursor: not-allowed;
  opacity: .45;
}

/* Keep every anonymizer's size steppers visually identical. */
:root {
  --stepper-button-bg: #eaeef2;
  --stepper-button-border: #d0d7de;
}

:root[data-theme="dark"] :is(
  .toolbar,
  .highlight-legend,
  .display-settings,
  .editors
) {
  --stepper-button-bg: #30363d;
  --stepper-button-border: #484f58;
}

.display-settings .size-stepper button,
.editors .editor-size-controls .size-stepper button {
  color: var(--text);
  background: var(--stepper-button-bg);
  border-color: var(--stepper-button-border);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-style: normal;
  font-weight: 650;
  line-height: 1;
}

.display-settings .size-stepper button:hover,
.editors .editor-size-controls .size-stepper button:hover {
  background: var(--control-bg);
  border-color: var(--hover-line);
}

.highlight-legend i {
  background: var(--legend-color, var(--mark, var(--highlight, #94a3b8)));
}
