:root {
  --bg: #f5f5f7;
  --panel: #ffffff;
  --panel-muted: #fafafc;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --text: #111827;
  --muted: #6b7280;
  --accent: #2563eb;
  --accent-soft: #eff6ff;
  --success: #166534;
  --warning: #b45309;
  --danger: #b91c1c;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.04), 0 8px 28px rgba(15, 23, 42, 0.06);
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family:
    "SF Pro Display",
    "SF Pro Text",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

button,
textarea {
  font: inherit;
}

.topbar,
.stack {
  width: min(960px, calc(100vw - 32px));
  margin: 0 auto;
}

.topbar {
  padding: 40px 0 12px;
}

.topbar h1 {
  margin: 0;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  line-height: 1.1;
  letter-spacing: -0.04em;
  font-weight: 750;
}

.caption {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.stack {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  padding: 14px 0 24px;
}

.panel {
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow);
}

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

.panel-head h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.panel-head h2 i {
  font-size: 0.9rem;
  color: var(--muted);
}

.status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 60px;
  min-height: 28px;
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel-muted);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.status.is-success {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: var(--success);
}

.status.is-warning {
  border-color: #fed7aa;
  background: #fff7ed;
  color: var(--warning);
}

.status.is-danger {
  border-color: #fecaca;
  background: #fef2f2;
  color: var(--danger);
}

.field {
  display: block;
  margin-bottom: 14px;
}

.field-grid {
  display: grid;
  gap: 14px;
}

.field-grid-inputs {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field > span:first-child {
  display: inline-block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}

.field-head span:last-child,
.field-head > span:first-child {
  margin-bottom: 0;
}

textarea {
  width: 100%;
  min-height: 96px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--panel-muted);
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.5;
  resize: vertical;
  transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.textarea-compact {
  min-height: 88px;
}

.textarea-output {
  min-height: 108px;
}

.textarea-result {
  min-height: 88px;
}

textarea::placeholder {
  color: #9ca3af;
}

textarea:focus {
  outline: none;
  border-color: #bfdbfe;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

textarea[readonly] {
  background: #fcfcfd;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #ffffff;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease, color 120ms ease;
}

.button:hover {
  border-color: var(--border-strong);
}

.button-copy {
  min-height: 28px;
  padding: 5px 10px;
  gap: 5px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  font-size: 0.8rem;
}

.button-copy i {
  font-size: 0.78rem;
  line-height: 1;
}

.button-copy:hover {
  border-color: var(--border);
  background: var(--panel-muted);
  color: #374151;
  box-shadow: none;
}

.button-copy:active {
  background: #f0f1f3;
}

.button-copy.is-copied {
  border-color: #bfdbfe;
  background: var(--accent-soft);
  color: var(--accent);
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.stat {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel-muted);
}

.stat span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.stat strong {
  display: block;
  font-size: 1.15rem;
  font-weight: 750;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.note {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.45;
}

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

.dump-panel pre {
  margin: 0;
  max-height: 240px;
  overflow: auto;
  color: #1f2937;
  background: var(--panel-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  font-family:
    "SFMono-Regular",
    ui-monospace,
    Menlo,
    Consolas,
    monospace;
  font-size: 0.8rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.site-credit {
  width: min(960px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 8px 0 28px;
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
}

.site-credit a {
  color: var(--muted);
  text-decoration: none;
  transition: color 120ms ease;
}

.site-credit a:hover {
  color: var(--text);
}

.notice {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%) translateY(18px);
  min-width: min(420px, calc(100vw - 32px));
  max-width: min(560px, calc(100vw - 32px));
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.92);
  color: #f9fafb;
  text-align: center;
  font-size: 0.86rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease, transform 120ms ease;
}

.notice.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 900px) {
  .field-grid-inputs,
  .result-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .topbar {
    padding-top: 28px;
  }

  .topbar,
  .stack,
  .site-credit {
    width: min(100vw - 20px, 100%);
  }

  .panel {
    padding: 16px;
  }

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

  .field-head {
    align-items: flex-start;
    flex-direction: column;
  }
}
