:root {
  --bg: #f3f5f8;
  --bg-deep: #d5dde9;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-strong: #ffffff;
  --surface-muted: #f7f9fc;
  --surface-deep: #13253d;
  --text: #152131;
  --muted: #5f6d80;
  --line: rgba(21, 33, 49, 0.1);
  --line-strong: rgba(21, 33, 49, 0.18);
  --primary: #0f4c81;
  --primary-dark: #0a375d;
  --primary-soft: rgba(15, 76, 129, 0.08);
  --success: #1f6f58;
  --warn: #8a5600;
  --shadow: 0 24px 54px rgba(19, 37, 61, 0.1);
  --shadow-soft: 0 10px 28px rgba(19, 37, 61, 0.08);
  --radius: 26px;
  --font-display: "Georgia", "Times New Roman", serif;
  --font-body: "Aptos", "Segoe UI", Tahoma, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--font-body);
  background:
    linear-gradient(180deg, #fafbfd 0%, var(--bg) 48%, #edf1f6 100%);
  letter-spacing: 0.01em;
}

a {
  color: inherit;
}

p a,
.site-footer a,
.text-link-card {
  color: var(--primary);
}

.page-shell {
  width: min(1160px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.25rem 0 4rem;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--line);
}

.brand {
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.76rem;
}

.nav-links {
  display: flex;
  gap: 1.25rem;
}

.nav-links a {
  text-decoration: none;
  color: var(--muted);
  padding: 0.2rem 0;
  border-bottom: 1px solid transparent;
  transition: border-color 160ms ease, color 160ms ease;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  color: var(--text);
  border-color: var(--text);
}

.hero {
  padding: 0.75rem 0 2.75rem;
}

.hero-copy {
  padding: 3.5rem 0 1rem;
}

.hero-small .hero-copy {
  padding-bottom: 0;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.72fr);
  gap: 3rem;
  align-items: end;
}

.eyebrow {
  margin: 0 0 0.75rem;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.74rem;
  font-weight: 700;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  line-height: 0.98;
  letter-spacing: -0.03em;
}

h1 {
  max-width: 9ch;
  margin: 0;
  font-size: clamp(3.1rem, 7vw, 5.8rem);
}

.lede {
  max-width: 58ch;
  margin: 1.4rem 0 0;
  font-size: 1.08rem;
  line-height: 1.75;
  color: var(--muted);
}

.hero-notes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.6rem;
}

.hero-notes span {
  display: inline-flex;
  align-items: center;
  min-height: 2.2rem;
  padding: 0.4rem 0.85rem;
  border: 1px solid rgba(21, 62, 117, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  font-size: 0.92rem;
  box-shadow: var(--shadow-soft);
}

.hero-aside {
  padding: 1.4rem 0 1.1rem 1.5rem;
  border-left: 1px solid var(--line);
}

.aside-label,
.section-kicker,
.meta-label,
.panel-caption {
  margin: 0;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  font-weight: 700;
}

.aside-list {
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.aside-list li {
  padding: 0.95rem 0;
  border-bottom: 1px solid var(--line);
  line-height: 1.65;
}

.workspace-card,
.info-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.workspace-card {
  padding: 1.85rem;
}

.tool-header p,
.info-card p,
.status {
  color: var(--muted);
}

.workspace-header {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  align-items: end;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--line);
}

.tool-header h2,
.info-card h2,
.output-head h3 {
  margin: 0;
  font-size: clamp(1.6rem, 3vw, 2.05rem);
}

.tool-header p {
  margin: 0.65rem 0 0;
  line-height: 1.65;
}

.workspace-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  min-width: 280px;
}

.meta-item {
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-muted);
}

.meta-item strong {
  display: block;
  margin-top: 0.4rem;
  font-size: 0.98rem;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 0.9fr);
  gap: 1.35rem;
  margin-top: 1.35rem;
}

.field {
  display: grid;
  gap: 0.6rem;
}

.mode-switcher legend {
  font-weight: 600;
}

.editor-panel,
.output-panel {
  min-width: 0;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  margin-bottom: 0.9rem;
}

.panel-head h3 {
  margin: 0;
  font-size: 1.3rem;
}

textarea,
button {
  font: inherit;
}

textarea {
  width: 100%;
  min-height: 340px;
  padding: 1.15rem 1.2rem;
  border: 1px solid rgba(20, 32, 51, 0.12);
  border-radius: 20px;
  resize: vertical;
  background: var(--surface-strong);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  line-height: 1.65;
}

textarea:focus,
button:focus,
.mode-switcher input:focus {
  outline: 2px solid rgba(21, 62, 117, 0.2);
  outline-offset: 2px;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem;
  justify-content: space-between;
  align-items: end;
  margin-top: 1rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface-muted);
}

.mode-switcher {
  display: flex;
  gap: 1rem;
  border: 0;
  padding: 0;
  margin: 0;
}

.mode-switcher label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  border-radius: 999px;
  background: white;
  border: 1px solid var(--line);
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 0.88rem 1.25rem;
  cursor: pointer;
  background: var(--primary);
  color: white;
  font-weight: 600;
  box-shadow: 0 14px 28px rgba(21, 62, 117, 0.22);
  transition: transform 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

button:hover {
  transform: translateY(-1px);
  background: var(--primary-dark);
  box-shadow: 0 18px 34px rgba(21, 62, 117, 0.24);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

button.ghost {
  background: white;
  color: var(--text);
  border: 1px solid var(--line-strong);
  box-shadow: none;
}

.status {
  min-height: 1.5rem;
  margin: 0;
  font-size: 0.95rem;
}

.output-panel {
  display: flex;
  flex-direction: column;
  padding: 1.35rem;
  border-radius: 24px;
  background: var(--surface-deep);
  color: white;
}

.output-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.result-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
  margin: 1rem 0 0;
}

.result-meta div {
  padding: 0.8rem 0.9rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.result-meta dt {
  margin: 0;
  color: rgba(237, 244, 255, 0.7);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.68rem;
  font-weight: 700;
}

.result-meta dd {
  margin: 0.45rem 0 0;
  color: #edf4ff;
  font-size: 0.95rem;
  font-weight: 600;
}

.badge {
  border-radius: 999px;
  padding: 0.38rem 0.78rem;
  background: rgba(33, 107, 82, 0.1);
  color: var(--success);
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.output-text {
  white-space: pre-wrap;
  margin: 1rem 0 0;
  min-height: 180px;
  padding: 1.1rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-family: var(--font-body);
  line-height: 1.65;
  color: #edf4ff;
}

.output-actions {
  margin-top: 1rem;
}

.warnings {
  margin: 1rem 0 0;
  padding-left: 1.2rem;
  color: #f3c978;
  line-height: 1.6;
}

.content-grid,
.about-layout {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.1rem;
  margin-top: 1.7rem;
}

.content-grid-wide {
  align-items: stretch;
}

.info-card {
  padding: 1.45rem;
}

.info-card p {
  margin-bottom: 0;
  line-height: 1.7;
}

.link-panel {
  margin-top: 1.7rem;
  padding: 1.6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.link-panel h2 {
  margin: 0.5rem 0 0.75rem;
}

.link-panel p {
  max-width: 58ch;
}

.link-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.text-link-card {
  display: block;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: white;
  text-decoration: none;
  font-weight: 600;
}

.site-footer {
  display: flex;
  gap: 1.5rem;
  padding: 1.4rem 0 0;
  margin-top: 1.5rem;
  border-top: 1px solid var(--line);
}

.site-footer a {
  text-decoration: none;
}

@media (max-width: 860px) {
  .hero-grid,
  .workspace-header,
  .workspace-grid,
  .content-grid,
  .about-layout {
    grid-template-columns: 1fr;
  }

  .topbar,
  .controls,
  .output-head {
    align-items: start;
  }

  .topbar,
  .controls,
  .output-head,
  .workspace-header {
    flex-direction: column;
  }

  .nav-links,
  .hero-notes,
  .action-row,
  .mode-switcher,
  .workspace-meta,
  .result-meta,
  .link-row,
  .site-footer {
    width: 100%;
  }

  .hero-aside {
    padding: 0;
    border-left: 0;
  }

  .hero-copy {
    padding-top: 2.75rem;
  }

  .workspace-card {
    padding: 1.2rem;
  }

  .site-footer {
    flex-direction: column;
    gap: 0.75rem;
  }
}
