* {
  box-sizing: border-box;
}

:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --line: #d8e0e8;
  --text: #1e2933;
  --muted: #667789;
  --primary: #2463a6;
  --primary-dark: #194f88;
  --danger: #9a3412;
  --danger-bg: #fff4ed;
  --ok: #116b43;
  --ok-bg: #ecfdf3;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
}

a {
  color: var(--primary);
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand {
  color: var(--text);
  font-size: 20px;
  font-weight: 800;
  text-decoration: none;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.nav a {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
}

.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 18px 16px 42px;
}

.page-narrow {
  max-width: 860px;
}

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

.panel {
  margin-bottom: 16px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

h1 {
  margin: 0 0 12px;
  font-size: 26px;
}

h2 {
  margin: 0 0 12px;
  font-size: 20px;
}

label {
  display: block;
  margin: 14px 0 6px;
  font-weight: 700;
}

input,
select,
textarea,
button {
  width: 100%;
  min-height: 42px;
  padding: 10px 11px;
  border: 1px solid #bfccd9;
  border-radius: 7px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
}

textarea {
  min-height: 160px;
  resize: vertical;
}

.raw-textarea {
  min-height: 320px;
}

.markdown-output {
  min-height: 420px;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  white-space: pre;
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 120px;
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

button:hover,
.button:hover {
  background: var(--primary-dark);
}

button.secondary,
.button.secondary {
  border-color: #bfccd9;
  background: #ffffff;
  color: var(--text);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
}

.grid-full {
  grid-column: 1 / -1;
}

.message {
  display: none;
  margin: 0 0 14px;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #f8fafc;
  white-space: pre-wrap;
}

.message.is-error {
  display: block;
  border-color: #fdba74;
  background: var(--danger-bg);
  color: var(--danger);
}

.message.is-success {
  display: block;
  border-color: #86efac;
  background: var(--ok-bg);
  color: var(--ok);
}

.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: #f8fafc;
  color: var(--muted);
  font-size: 13px;
}

.muted {
  color: var(--muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #eef6ff;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
}

.badge-x {
  border-color: #1e2933;
  background: #1e2933;
  color: #ffffff;
}

.badge-chatgpt {
  border-color: #0f766e;
  background: #ccfbf1;
  color: #134e4a;
}

.badge-web {
  border-color: #2563eb;
  background: #dbeafe;
  color: #1e3a8a;
}

.badge-github {
  border-color: #334155;
  background: #e2e8f0;
  color: #0f172a;
}

.badge-pdf {
  border-color: #b91c1c;
  background: #fee2e2;
  color: #7f1d1d;
}

.badge-manual {
  border-color: #7c3aed;
  background: #ede9fe;
  color: #4c1d95;
}

.pre-box {
  padding: 12px;
  overflow: auto;
  white-space: pre-wrap;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

@media (max-width: 720px) {
  .site-header,
  .toolbar {
    display: block;
  }

  .nav {
    margin-top: 10px;
  }

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

  .panel {
    padding: 14px;
  }

  button,
  .button {
    width: 100%;
  }
}
