:root {
  color-scheme: light;
  --ink: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --soft: #f9fafb;
  --accent: #111827;
  --blue: #2563eb;
  --green: #15803d;
  --red: #b91c1c;
  --radius: 14px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: #ffffff;
  font-size: 15px;
  line-height: 1.6;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.container {
  width: min(1120px, calc(100% - 40px));
  margin-inline: auto;
}

/* Unified header */

.site-header {
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.header-inner {
  width: min(1120px, calc(100% - 40px));
  min-height: 72px;
  margin: auto;
  display: flex;
  align-items: center;
  gap: 30px;
}

.brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  white-space: nowrap;
}

.brand-logo {
  display: block;
  width: 190px;
  max-width: 100%;
  height: auto;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-left: auto;
}

.top-nav a,
.site-footer a {
  color: #4b5563;
  text-decoration: none;
  font-size: 14px;
}

.top-nav a:hover,
.site-footer a:hover {
  color: #111827;
}

/* Product introduction */

.page-intro {
  padding: 56px 0 30px;
}

.eyebrow {
  margin: 0 0 10px;
  color: #6b7280;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.13em;
}

.page-intro h1 {
  margin: 0;
  font-size: clamp(32px, 5vw, 46px);
  line-height: 1.15;
  letter-spacing: -0.045em;
}

.intro-copy {
  max-width: 760px;
  margin: 16px 0 18px;
  color: #4b5563;
  font-size: 17px;
}

.trust-points {
  display: flex;
  gap: 12px 22px;
  flex-wrap: wrap;
  color: #4b5563;
  font-size: 13px;
}

.trust-points i {
  margin-right: 5px;
  color: var(--green);
  font-style: normal;
  font-weight: 800;
}

/* Main tool */

.tool-section {
  padding-bottom: 38px;
}

.workspace {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: stretch;
}

.panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 21px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: 0 4px 18px rgba(17, 24, 39, 0.035);
}

.panel-heading {
  min-height: 48px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 13px;
}

.panel-title {
  display: block;
  color: var(--ink);
  font-size: 15px;
  font-weight: 750;
}

.panel-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

/* Input and output toolbar */

.input-toolbar {
  min-height: 38px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}

.file-button {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  padding: 7px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #ffffff;
  color: #111827;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.file-button:hover {
  border-color: #9ca3af;
  background: #f9fafb;
}

.file-name {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.output-toolbar {
  justify-content: flex-start;
}

.preview-label {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  padding: 4px 10px;
  border-radius: 7px;
  background: #f3f4f6;
  color: #374151;
  font-size: 11px;
  font-weight: 700;
}

/* Text editors */

textarea {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 330px;
  flex: 1;
  padding: 14px;
  border: 1px solid #d1d5db;
  border-radius: 9px;
  outline: none;
  resize: vertical;
  background: #ffffff;
  color: var(--ink);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.7;
  tab-size: 2;
}

textarea:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

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

#json-input {
  background: #ffffff;
}

#csv-output {
  margin: 0;
  background: #f9fafb;
}

.panel-footer {
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 9px;
}

.stats {
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.status {
  color: var(--blue);
  font-size: 11px;
  text-align: right;
  overflow-wrap: anywhere;
}

/* Buttons */

button {
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 650;
  transition:
    background 0.15s,
    border-color 0.15s,
    color 0.15s,
    box-shadow 0.15s;
}

button:focus-visible,
.file-button:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.22);
  outline-offset: 2px;
}

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

.text-button {
  min-height: 30px;
  padding: 4px 6px;
  background: transparent;
  color: #374151;
  font-size: 12px;
}

.text-button:hover {
  color: #111827;
  text-decoration: underline;
}

.danger-text {
  color: var(--red);
}

.danger-text:hover {
  color: #991b1b;
}

.primary-button {
  min-height: 43px;
  padding: 10px 20px;
  background: #111827;
  color: #ffffff;
}

.primary-button:hover:not(:disabled) {
  background: #293548;
}

.secondary-button {
  min-height: 43px;
  padding: 10px 18px;
  border-color: #d1d5db;
  background: #ffffff;
  color: #111827;
}

.secondary-button:hover:not(:disabled) {
  border-color: #9ca3af;
  background: #f3f4f6;
}

/* Conversion options */

.options-panel {
  margin-top: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.options-heading h2 {
  margin: 0;
  font-size: 19px;
  letter-spacing: -0.02em;
}

.options-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

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

.option-item {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  cursor: pointer;
}

.option-item:hover {
  border-color: #cbd5e1;
  background: #fafafa;
}

.option-item input {
  width: 16px;
  height: 16px;
  flex: none;
  margin: 3px 0 0;
  accent-color: #111827;
  cursor: pointer;
}

.option-item strong {
  display: block;
  font-size: 13px;
  font-weight: 700;
}

.option-item small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.action-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.error-message {
  min-height: 0;
  margin: 10px 0 0;
  color: var(--red);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.error-message:empty {
  display: none;
}

/* Privacy notice */

.privacy-note {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin-top: 16px;
  padding: 14px 16px;
  border: 1px solid #dcfce7;
  border-radius: 10px;
  background: #f0fdf4;
}

.privacy-icon {
  flex: none;
  margin-top: 1px;
  color: #15803d;
  font-size: 12px;
}

.privacy-note p {
  margin: 0;
  color: #365744;
  font-size: 13px;
}

.privacy-note strong {
  color: #14532d;
}

/* Information sections: one left-aligned column */

.information-area {
  padding-bottom: 34px;
}

.content-section {
  max-width: 860px;
  margin: 0;
  padding: 29px 0;
  border-top: 1px solid var(--line);
}

.content-section h2 {
  margin: 0 0 11px;
  font-size: 21px;
  line-height: 1.3;
  letter-spacing: -0.035em;
}

.content-section h3 {
  margin: 20px 0 7px;
  font-size: 15px;
}

.content-section p,
.content-section li {
  color: #4b5563;
  font-size: 14px;
}

.content-section p {
  margin: 9px 0;
}

.content-section ol,
.content-section ul {
  padding-left: 22px;
}

.content-section li {
  padding: 4px 0;
}

/* FAQ */

.faq-section details {
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.faq-section summary {
  color: var(--ink);
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
}

.faq-section summary:hover {
  color: #374151;
}

.faq-section p {
  margin: 9px 0 2px;
}

.privacy-section {
  padding-bottom: 20px;
}

/* Unified footer */

.site-footer {
  border-top: 1px solid var(--line);
  background: #ffffff;
}

.footer-inner {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  color: #9ca3af;
  font-size: 12px;
}

.footer-inner nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 18px;
}

.site-footer a {
  font-size: 12px;
}

/* Tablet */

@media (max-width: 850px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  textarea {
    min-height: 280px;
  }

  .panel {
    padding: 18px;
  }
}

/* Mobile */

@media (max-width: 600px) {
  .container,
  .header-inner {
    width: calc(100% - 28px);
  }

  .header-inner {
    min-height: 0;
    padding: 14px 0;
    flex-wrap: wrap;
    gap: 12px;
  }

  .brand-logo {
    width: 155px;
  }

  .top-nav {
    order: 3;
    width: 100%;
    margin: 0;
    gap: 20px;
  }

  .top-nav a {
    font-size: 12px;
  }

  .page-intro {
    padding: 38px 0 25px;
  }

  .page-intro h1 {
    font-size: 34px;
  }

  .intro-copy {
    font-size: 15px;
  }

  .trust-points {
    gap: 9px 15px;
    font-size: 12px;
  }

  .workspace {
    gap: 14px;
  }

  .panel {
    padding: 15px;
  }

  .panel-heading {
    gap: 8px;
  }

  textarea {
    min-height: 250px;
    padding: 12px;
    font-size: 12px;
  }

  .options-panel {
    padding: 17px;
  }

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

  .action-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .primary-button {
    grid-column: 1 / -1;
  }

  .action-row button {
    width: 100%;
    padding-inline: 10px;
  }

  .content-section {
    padding: 24px 0;
  }

  .content-section h2 {
    font-size: 19px;
  }

  .footer-inner {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 10px;
    padding-top: 19px;
    padding-bottom: 19px;
  }

  .footer-inner nav {
    gap: 12px 18px;
  }
}

@media (max-width: 360px) {
  .panel {
    padding: 12px;
  }

  .panel-footer {
    align-items: flex-start;
  }

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

  .primary-button {
    grid-column: auto;
  }
}

/* Reduced motion */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
