:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-strong: #f0f5f9;
  --ink: #14202b;
  --muted: #637083;
  --line: #d8e0e8;
  --primary: #0f766e;
  --primary-dark: #0a5751;
  --primary-soft: #e3f5f2;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --warn: #8a5a00;
  --warn-soft: #fff5d6;
  --ok: #147a3c;
  --ok-soft: #e8f6ed;
  --shadow: 0 16px 40px rgba(24, 41, 56, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Yu Gothic UI", "Yu Gothic", Meiryo, sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

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

.wrap {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  background: #0e2b30;
  color: #ffffff;
  padding: 36px 0 34px;
}

.header-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 28px;
  align-items: end;
}

.eyebrow,
.section-kicker {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
}

.site-header .eyebrow {
  color: #9ee7da;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1.12;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1.15rem;
  line-height: 1.35;
}

.lead {
  max-width: 760px;
  margin-bottom: 0;
  color: #d8ebe8;
  font-size: 1rem;
}

.header-metrics {
  display: grid;
  grid-template-columns: repeat(3, 86px);
  gap: 10px;
}

.header-metrics div {
  min-height: 82px;
  padding: 14px 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  text-align: center;
}

.header-metrics span {
  display: block;
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.1;
}

.header-metrics small {
  color: #c4ddd9;
  font-size: 0.78rem;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.85fr);
  gap: 18px;
  padding: 22px 0 48px;
}

.panel,
.results-section,
.disclaimer {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel {
  padding: 22px;
}

.input-panel {
  grid-row: span 2;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.button-row,
.input-actions,
.api-grid {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.button {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 700;
  white-space: nowrap;
}

.button.primary {
  background: var(--primary);
  color: #ffffff;
}

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

.button.secondary {
  border-color: #b9c9d5;
  background: #ffffff;
  color: #163038;
}

.button.secondary:hover,
.button.secondary:focus-visible {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.button.ghost {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.button.ghost:hover,
.button.ghost:focus-visible {
  background: var(--surface-strong);
  color: var(--ink);
}

.text-link {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  font-weight: 700;
  text-decoration: none;
}

.text-link:hover,
.text-link:focus-visible {
  text-decoration: underline;
}

.field-label {
  display: block;
  margin-bottom: 8px;
  color: #334155;
  font-size: 0.9rem;
  font-weight: 700;
}

textarea,
input[type="password"] {
  width: 100%;
  border: 1px solid #c7d2dd;
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  outline: none;
}

textarea:focus,
input[type="password"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

textarea {
  min-height: 260px;
  resize: vertical;
  padding: 14px;
  font-family: "Consolas", "SFMono-Regular", "Courier New", monospace;
  line-height: 1.55;
}

input[type="password"] {
  height: 42px;
  padding: 0 12px;
}

.input-actions {
  justify-content: space-between;
  margin-top: 14px;
}

.file-control {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.file-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.api-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

.notice {
  margin: 14px 0 0;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--surface-strong);
  color: #304251;
  font-size: 0.92rem;
}

.notice.error {
  background: var(--danger-soft);
  color: var(--danger);
}

.notice.success {
  background: var(--ok-soft);
  color: var(--ok);
}

.notice.warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.test-result {
  margin-bottom: 10px;
  font-weight: 800;
}

.test-result.pass {
  color: var(--ok);
}

.test-result.fail {
  color: var(--danger);
}

.test-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 1.2rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.results-section {
  grid-column: 1 / -1;
  padding: 22px;
}

.results-head {
  align-items: center;
}

.empty-state {
  padding: 36px 20px;
  border: 1px dashed #b8c7d2;
  border-radius: 8px;
  background: #fbfcfd;
  color: var(--muted);
  text-align: center;
}

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

table {
  width: 100%;
  min-width: 1080px;
  border-collapse: collapse;
  background: #ffffff;
}

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

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #edf3f7;
  color: #31414e;
  font-size: 0.82rem;
  font-weight: 800;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.number-cell {
  font-family: "Consolas", "SFMono-Regular", "Courier New", monospace;
  white-space: nowrap;
}

.status-pill {
  display: inline-flex;
  min-width: 58px;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
}

.status-ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.status-ng {
  background: var(--danger-soft);
  color: var(--danger);
}

.status-wait {
  background: var(--warn-soft);
  color: var(--warn);
}

.manual-link {
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.manual-link:hover,
.manual-link:focus-visible {
  text-decoration: underline;
}

.disclaimer {
  grid-column: 1 / -1;
  padding: 20px 22px;
  box-shadow: none;
}

.disclaimer h2 {
  margin-bottom: 8px;
}

.disclaimer p {
  margin-bottom: 8px;
  color: #465766;
  font-size: 0.92rem;
}

.disclaimer p:last-child {
  margin-bottom: 0;
}

@media (max-width: 900px) {
  .header-grid,
  .app-shell {
    grid-template-columns: 1fr;
  }

  .header-metrics {
    width: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .input-panel {
    grid-row: auto;
  }
}

@media (max-width: 620px) {
  .wrap {
    width: min(100% - 20px, 1180px);
  }

  .site-header {
    padding: 28px 0 26px;
  }

  .panel,
  .results-section,
  .disclaimer {
    padding: 16px;
  }

  .section-head,
  .input-actions,
  .api-grid {
    display: grid;
    grid-template-columns: 1fr;
  }

  .button-row {
    justify-content: flex-start;
  }

  .button,
  .text-link {
    width: 100%;
    justify-content: center;
  }

  .file-control {
    display: grid;
    grid-template-columns: 1fr;
  }

  textarea {
    min-height: 220px;
  }
}
