:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-strong: #111827;
  --text: #172033;
  --muted: #667085;
  --line: #d8dde6;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --danger: #b42318;
  --danger-bg: #fff4f2;
  --warning-bg: #fffaeb;
  --warning-text: #93370d;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(15, 118, 110, 0.08), transparent 340px),
    var(--bg);
  color: var(--text);
}

[hidden] {
  display: none !important;
}

button,
textarea {
  font: inherit;
}

button.text-link-button {
  cursor: pointer;
}

a {
  color: var(--accent);
  overflow-wrap: anywhere;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid rgba(216, 221, 230, 0.9);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
}

.nav-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: min(1120px, calc(100% - 32px));
  min-height: 64px;
  margin: 0 auto;
}

.brand {
  color: var(--text);
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

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

.site-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.site-nav a {
  border-radius: 6px;
  padding: 8px 12px;
  color: #475467;
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.site-nav a:hover {
  background: #eef4f3;
  color: var(--accent-strong);
}

.site-nav a.active {
  background: var(--accent);
  color: white;
  box-shadow: 0 1px 2px rgba(15, 118, 110, 0.25);
}

.language-switch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: white;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.language-switch:hover {
  background: #f2f4f7;
  color: var(--accent-strong);
}

.app-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0;
}

.workspace {
  display: grid;
  gap: 24px;
}

.masthead {
  max-width: 760px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 12px;
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 1.04;
}

h2 {
  margin-bottom: 0;
  font-size: 1.5rem;
}

h3 {
  margin: 24px 0 12px;
  font-size: 1rem;
}

.masthead p:last-child {
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.7;
}

.home-workspace {
  gap: 28px;
}

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

.tool-card {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 210px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: white;
  color: var(--text);
  text-decoration: none;
  box-shadow: 0 16px 38px rgba(17, 24, 39, 0.07);
}

.tool-card:hover {
  border-color: rgba(15, 118, 110, 0.35);
  color: var(--text);
  transform: translateY(-1px);
}

.tool-card-kicker {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.tool-card strong {
  font-size: 1.12rem;
  line-height: 1.3;
}

.tool-card span:not(.tool-card-kicker):not(.tool-card-action) {
  color: var(--muted);
  line-height: 1.6;
}

.tool-card-action {
  align-self: end;
  margin-top: auto;
  color: var(--accent-strong);
  font-weight: 800;
}

.home-copy {
  max-width: 820px;
  border-top: 1px solid var(--line);
  padding-top: 24px;
}

.home-copy p {
  color: var(--muted);
  line-height: 1.75;
}

.parser-panel,
.result {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 20px 50px rgba(17, 24, 39, 0.08);
}

.parser-panel {
  display: grid;
  gap: 14px;
  padding: 20px;
}

label {
  font-weight: 700;
}

textarea {
  width: 100%;
  min-height: 180px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  color: var(--text);
  background: #fbfcfe;
  line-height: 1.6;
}

textarea:focus {
  outline: 3px solid rgba(15, 118, 110, 0.18);
  border-color: var(--accent);
}

.actions,
.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.actions {
  justify-content: flex-start;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  background: var(--accent);
  color: white;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  background: var(--accent-strong);
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

button.secondary {
  border: 1px solid var(--line);
  background: white;
  color: var(--text);
}

button.secondary:hover {
  background: #f2f4f7;
}

.message {
  border-radius: 8px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: white;
}

.message.error {
  border-color: #fecdca;
  background: var(--danger-bg);
  color: var(--danger);
}

.message.success {
  border-color: #abefc6;
  background: #ecfdf3;
  color: #067647;
}

.result {
  padding: 20px;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 20px 0 0;
}

.meta-grid div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfe;
}

dt {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

dd {
  margin: 6px 0 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.warnings {
  margin-top: 16px;
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--warning-bg);
  color: var(--warning-text);
}

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

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

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

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

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

.article-box {
  margin-top: 20px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.section-title h3 {
  margin-bottom: 12px;
}

.section-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.text-link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: white;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
}

.text-link-button:hover {
  background: #f2f4f7;
}

.article-box p {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfe;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.preview-cell {
  width: 132px;
}

.media-preview {
  display: block;
  width: 112px;
  height: 72px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #eef2f6;
  object-fit: cover;
}

video.media-preview {
  object-fit: contain;
}

.url-cell {
  max-width: 320px;
}

.copy-row {
  white-space: nowrap;
}

.copy-row a,
.copy-row button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border-radius: 6px;
  padding: 0 10px;
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
  margin-right: 8px;
}

.copy-row a {
  border: 1px solid var(--line);
  background: white;
  color: var(--text);
}

.copy-row a:hover {
  background: #f2f4f7;
}

.copy-row button {
  min-height: 34px;
}

.copy-row a:last-child,
.copy-row button:last-child {
  margin-right: 0;
}

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

@media (max-width: 760px) {
  body {
    background:
      linear-gradient(180deg, rgba(15, 118, 110, 0.08), transparent 240px),
      var(--bg);
  }

  .nav-wrap {
    width: min(100% - 20px, 1120px);
    align-items: stretch;
    flex-direction: column;
    padding: 12px 0;
  }

  .nav-actions {
    width: 100%;
    align-items: stretch;
    gap: 8px;
  }

  .site-nav {
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .site-nav::-webkit-scrollbar {
    display: none;
  }

  .site-nav a {
    flex: 0 0 auto;
    text-align: center;
  }

  .language-switch {
    flex: 0 0 auto;
    min-height: 40px;
    padding: 0 10px;
  }

  .app-shell {
    width: min(100% - 20px, 1120px);
    padding: 22px 0 32px;
  }

  .workspace {
    gap: 18px;
  }

  .masthead p:last-child {
    font-size: 0.98rem;
    line-height: 1.6;
  }

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

  .tool-card {
    min-height: 0;
    padding: 16px;
  }

  .parser-panel,
  .result {
    padding: 16px;
    box-shadow: 0 12px 28px rgba(17, 24, 39, 0.08);
  }

  textarea {
    min-height: 140px;
  }

  .actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .actions button {
    width: 100%;
    min-width: 0;
    padding: 0 12px;
  }

  .result-header {
    align-items: flex-start;
  }

  .result-header > button {
    width: 100%;
  }

  .section-title {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  .section-title h3,
  .section-actions {
    margin-bottom: 0;
  }

  .section-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .text-link-button {
    min-height: 40px;
  }

  .article-box p {
    max-height: 360px;
    overflow: auto;
    padding: 12px;
    font-size: 0.95rem;
    line-height: 1.65;
  }

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

  h1 {
    font-size: 2rem;
    line-height: 1.1;
  }

  .result .table-wrap {
    overflow: visible;
    border: 0;
    border-radius: 0;
  }

  .result table {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .result thead {
    display: none;
  }

  .result tbody {
    display: grid;
    gap: 12px;
    width: 100%;
  }

  .result tr {
    display: grid;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    background: white;
  }

  .result tr:last-child td {
    border-bottom: 1px solid var(--line);
  }

  .result tr:last-child td:last-child,
  .result td:last-child {
    border-bottom: 0;
  }

  .result td {
    display: grid;
    grid-template-columns: minmax(72px, 0.35fr) minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
  }

  .result td[data-label]::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
  }

  .result .preview-cell {
    display: block;
    width: auto;
    padding: 12px;
  }

  .result .preview-cell::before,
  .result .empty-state::before {
    content: none;
  }

  .result .media-preview {
    width: 120px;
    height: 76px;
  }

  .result .copy-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    white-space: normal;
  }

  .result .copy-row::before {
    flex: 0 0 72px;
  }

  .result .copy-row a,
  .result .copy-row button {
    flex: 1 1 72px;
    min-height: 38px;
    margin-right: 0;
  }

  .result .empty-state {
    display: block;
    padding: 14px;
  }
}
