/* Roboto をローカル同梱（外部送信なしを維持） */
@font-face {
  font-family: "Roboto";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("./vendor/fonts/roboto-latin-400.woff2") format("woff2");
}
@font-face {
  font-family: "Roboto";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("./vendor/fonts/roboto-latin-500.woff2") format("woff2");
}
@font-face {
  font-family: "Roboto";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("./vendor/fonts/roboto-latin-700.woff2") format("woff2");
}

:root {
  color-scheme: light;
  /* Google Material 配色 */
  --bg: #f8f9fa;
  --surface: #ffffff;
  --ink: #202124;
  --secondary: #5f6368;
  --line: #dadce0;
  --line-strong: #bdc1c6;
  --blue: #1a73e8;
  --blue-hover: #1765cc;
  --blue-soft: #e8f0fe;
  --blue-text: #1967d2;
  --red: #d93025;
  --green: #188038;
  --yellow-soft: #fef7e0;
  /* 検出カテゴリ（機能色） */
  --c-contact: #0b7c74;
  --c-identity: #9a6a12;
  --c-education: #6741d9;
  --c-sensitive: #d93025;
  --c-location: #188038;
  --c-id: #1a73e8;
  --elev-1: 0 1px 2px rgba(60, 64, 67, 0.1), 0 1px 3px rgba(60, 64, 67, 0.08);
  --elev-2: 0 1px 3px rgba(60, 64, 67, 0.12), 0 4px 8px rgba(60, 64, 67, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family:
    "Roboto", "Noto Sans JP", "Hiragino Sans", "Hiragino Kaku Gothic ProN",
    "Yu Gothic", "Meiryo", sans-serif;
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.5;
}

h1,
h2,
p {
  margin: 0;
}

button,
textarea,
input {
  font: inherit;
}

.app {
  width: min(1040px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 22px 0 40px;
}

/* ---------- Top bar ---------- */
.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.tagline {
  color: var(--secondary);
  font-size: 13px;
  line-height: 1.4;
}

.mark {
  display: inline-block;
  width: 22px;
  height: 11px;
  background: var(--blue);
  border-radius: 2px;
}

.modes {
  display: inline-flex;
  gap: 6px;
}

.mode {
  background: none;
  border: none;
  padding: 8px 14px;
  color: var(--secondary);
  font-weight: 500;
  cursor: pointer;
  border-radius: 8px;
}

.mode:hover {
  background: rgba(60, 64, 67, 0.06);
  color: var(--ink);
}

.mode.active {
  color: var(--blue-text);
  background: var(--blue-soft);
}

/* ---------- Usage ---------- */
.usage {
  margin-bottom: 14px;
  padding: 14px 16px;
  background: var(--blue-soft);
  border-radius: 10px;
  color: #174ea6;
}

.usageLead {
  font-size: 13.5px;
  line-height: 1.75;
  margin-bottom: 8px;
}

.usageLead b {
  font-weight: 700;
}

.usageSteps {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  font-size: 13px;
  line-height: 1.7;
  color: #1a56b8;
  padding-top: 8px;
  border-top: 1px solid rgba(26, 115, 232, 0.18);
}

.usageLabel {
  display: inline-block;
  background: var(--blue);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
  letter-spacing: 0.04em;
}

/* ---------- Toolbar ---------- */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.samples {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.samplesLabel {
  color: var(--secondary);
  font-size: 12.5px;
}

.toolbarRight {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.chip {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--secondary);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.chip:hover {
  background: var(--blue-soft);
  border-color: var(--blue-soft);
  color: var(--blue-text);
}

.fileLink {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--blue-text);
  background: var(--surface);
  cursor: pointer;
}

.fileLink:hover {
  background: var(--blue-soft);
  border-color: var(--blue-soft);
}

.fileLink input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.fileStatus {
  min-height: 18px;
  margin: -2px 0 10px;
  color: var(--secondary);
  font-size: 12.5px;
}

/* ---------- Options bar ---------- */
.options {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 10px 14px;
  margin-bottom: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.optLabel {
  font-size: 12px;
  font-weight: 700;
  color: var(--secondary);
  letter-spacing: 0.04em;
}

.opt {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  user-select: none;
}

.opt input {
  accent-color: var(--blue);
  width: 16px;
  height: 16px;
}

.counts {
  margin-left: auto;
  color: var(--secondary);
  font-size: 12.5px;
  white-space: nowrap;
}

/* ---------- Buttons ---------- */
button {
  cursor: pointer;
}

#restoreButton,
.primary {
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 10px 24px;
  font-weight: 500;
  box-shadow: var(--elev-1);
}

#restoreButton:hover,
.primary:hover {
  background: var(--blue-hover);
  box-shadow: var(--elev-2);
}

.ghost {
  background: none;
  border: none;
  color: var(--blue-text);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
}

.ghost:hover {
  background: var(--blue-soft);
}

/* ---------- Panes ---------- */
.panes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.pane {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.paneHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 48px;
  padding: 0 8px 0 16px;
  border-bottom: 1px solid var(--line);
}

.paneHead h2 {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
}

.paneNote {
  color: var(--secondary);
  font-size: 12px;
}

.pane textarea {
  flex: 1;
  min-height: 300px;
  border: none;
  background: transparent;
  color: var(--ink);
  line-height: 1.7;
  padding: 14px 16px;
  resize: vertical;
}

.pane textarea:focus {
  outline: none;
}

textarea::placeholder {
  color: #80868b;
}

/* ---------- Status bar ---------- */
.statusBar:empty {
  display: none;
}

.statusBar {
  margin-top: 14px;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--secondary);
}

.statusBar.ok {
  background: #e6f4ea;
  border-color: transparent;
  color: var(--green);
}

.statusBar.info {
  background: var(--blue-soft);
  border-color: transparent;
  color: var(--blue-text);
}

.statusBar.warn {
  background: #fce8e6;
  border-color: transparent;
  color: var(--red);
}

/* ---------- Advanced ---------- */
.advanced {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  padding: 0 16px;
}

.advanced > summary {
  cursor: pointer;
  padding: 14px 0;
  font-weight: 500;
  font-size: 13px;
  color: var(--blue-text);
}

.advanced[open] > summary {
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}

.advanced > *:last-child {
  margin-bottom: 16px;
}

.hint {
  color: var(--secondary);
  font-size: 13px;
  line-height: 1.65;
  margin: 0 0 12px;
}

.hint.toolbar {
  display: block;
}

/* 復元タブ：パネル下のボタンに余白をつける */
#restoreView .panes + .toolbar {
  margin-top: 16px;
  margin-bottom: 0;
}

.toggleRow {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--secondary);
  cursor: pointer;
  user-select: none;
}

.toggle:has(input:checked) {
  border-color: var(--blue-soft);
  background: var(--blue-soft);
  color: var(--blue-text);
}

.toggle input {
  accent-color: var(--blue);
}

/* ---------- Highlights ---------- */
.highlightBox {
  min-height: 200px;
  max-height: 480px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 14px 16px;
  line-height: 1.9;
  white-space: pre-wrap;
  word-break: break-word;
}

.hit {
  border-radius: 3px;
  padding: 1px 3px;
  border-bottom: 2px solid currentColor;
  font-weight: 500;
  cursor: pointer;
}

.hit.excluded {
  background: transparent;
  color: var(--secondary);
  border-bottom: 2px dashed var(--secondary);
  text-decoration: line-through;
  font-weight: 400;
}

.hit.contact {
  background: #e0f2f1;
  color: var(--c-contact);
}

.hit.identity {
  background: #fef7e0;
  color: var(--c-identity);
}

.hit.education {
  background: #ede7f6;
  color: var(--c-education);
}

.hit.sensitive {
  background: #fce8e6;
  color: var(--c-sensitive);
}

.hit.location {
  background: #e6f4ea;
  color: var(--c-location);
}

.hit.id {
  background: #e8f0fe;
  color: var(--c-id);
}

/* ---------- Footer ---------- */
.foot {
  margin-top: 24px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--secondary);
  font-size: 12px;
  line-height: 1.7;
}

.foot p {
  margin: 0 0 6px;
}

.foot .disclaimer {
  color: #80868b;
}

code {
  font-family: "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: #f1f3f4;
  padding: 1px 5px;
  border-radius: 4px;
}

@media (max-width: 760px) {
  .bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .panes {
    grid-template-columns: 1fr;
  }

  .counts {
    margin-left: 0;
  }
}
