.kkmr-tool {
  max-width: 1220px;
}

.tool-panel {
  background: #ffffff;
  border: 1px solid #d8dee8;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(32, 45, 64, 0.08);
  padding: 24px;
}

.tool-panel__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.code-area {
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.95rem;
  line-height: 1.6;
  min-height: 240px;
  resize: vertical;
}

.result-area {
  background: #1f2937;
  color: #f8fafc;
  min-height: 200px;
  white-space: pre;
}

.status-message {
  background: #f8fafc;
  border: 1px solid #d8dee8;
  border-radius: 8px;
  color: #334155;
  padding: 12px 14px;
}

.status-message.is-success {
  background: #eefaf2;
  border-color: #9dd7b0;
  color: #14532d;
}

.status-message.is-error {
  background: #fff1f1;
  border-color: #f3a7a7;
  color: #8a1f1f;
}

.status-message.is-info {
  background: #f0f7ff;
  border-color: #b8d4f4;
  color: #1e3a5f;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.stats-grid div {
  background: #fbfcfe;
  border: 1px solid #d8dee8;
  border-radius: 8px;
  padding: 12px;
}

.stats-grid span {
  color: #64748b;
  display: block;
  font-size: 0.82rem;
}

.stats-grid strong {
  color: #111827;
  display: block;
  font-size: 1.12rem;
}

.diff-preview {
  display: grid;
  gap: 6px;
}

.diff-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 6px;
}

.diff-cell {
  background: #ffffff;
  border: 1px solid #d8dee8;
  border-radius: 6px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.88rem;
  overflow-wrap: anywhere;
  padding: 8px 10px;
  white-space: pre-wrap;
}

.diff-row--header .diff-cell {
  background: #eef3fb;
  color: #334155;
  font-family: inherit;
  font-weight: 600;
}

.diff-row.is-added .diff-cell {
  background: #effaf2;
  border-color: #b6e1c0;
}

.diff-row.is-removed .diff-cell {
  background: #fff2f2;
  border-color: #efc0c0;
}

.diff-row.is-changed .diff-cell {
  background: #fffbeb;
  border-color: #f0d999;
}

.diff-row.is-unchanged .diff-cell {
  background: #f8fafc;
  color: #64748b;
}

.diff-cell--kind {
  font-family: inherit;
  text-align: center;
}

.diff-cell--path {
  color: #1e3a5f;
}

.mode-note {
  color: #64748b;
  font-size: 0.85rem;
}

.path-table {
  border-collapse: collapse;
  font-size: 0.9rem;
  width: 100%;
  max-width: 720px;
}

.path-table th,
.path-table td {
  border: 1px solid #d8dee8;
  padding: 6px 10px;
  text-align: left;
}

.path-table th {
  background: #f0f7ff;
}

.path-table td code {
  overflow-wrap: anywhere;
}

@media (max-width: 767.98px) {
  header h1 {
    font-size: 1rem;
    line-height: 1.2;
  }

  .tool-panel {
    padding: 16px;
  }

  .tool-panel__header {
    display: block;
  }

  .tool-panel__header .button-row {
    margin-top: 16px;
  }

  .button-row .btn {
    flex: 1 1 45%;
  }

  .code-area {
    min-height: 180px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .diff-row {
    grid-template-columns: 1fr;
  }

  .path-table {
    font-size: 0.82rem;
  }
}
