:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #eef4f8;
  --ink: #101820;
  --muted: #5d6f7a;
  --soft: #7b8c96;
  --line: #d8e2ea;
  --brand: #0d7667;
  --brand-strong: #07584f;
  --blue: #245fcb;
  --amber: #b56a19;
  --rose: #b43d62;
  --radius: 8px;
  --shadow: 0 18px 48px rgba(22, 37, 56, 0.11);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color: var(--ink);
}

body {
  margin: 0;
  min-width: 320px;
}

a {
  color: inherit;
  text-decoration-color: rgba(13, 118, 103, 0.35);
  text-underline-offset: 0.18em;
}

button,
input {
  font: inherit;
}

main {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
  padding: 10px max(16px, calc((100vw - 1120px) / 2));
  border-bottom: 1px solid rgba(216, 226, 234, 0.88);
  background: rgba(244, 247, 251, 0.94);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
  text-decoration: none;
}

.brand img {
  border-radius: var(--radius);
  box-shadow: 0 6px 18px rgba(13, 118, 103, 0.18);
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.95rem;
}

.top-nav a {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-radius: var(--radius);
  text-decoration: none;
}

.top-nav a:hover,
.top-nav a[aria-current="page"] {
  background: #e8f2f0;
  color: var(--brand-strong);
}

.home-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: 22px;
  align-items: stretch;
  padding: 34px 0 18px;
}

.hero-copy {
  display: grid;
  align-content: center;
  gap: 16px;
  min-height: 360px;
}

.eyebrow {
  margin: 0;
  color: var(--rose);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.12;
  letter-spacing: 0;
}

h1 {
  max-width: 760px;
  font-size: 4rem;
}

.page-title h1,
.tool-title h1 {
  font-size: 3.15rem;
}

h2 {
  font-size: 1.32rem;
}

.lead {
  max-width: 660px;
  margin: 0;
  color: var(--muted);
  font-size: 1.12rem;
  line-height: 1.62;
}

.home-search,
.tool-search {
  width: 100%;
}

.search-shell {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 0 16px;
  border: 1px solid #cfdce6;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.search-shell span {
  color: var(--blue);
  font-size: 1.32rem;
  font-weight: 900;
}

.search-shell input,
.tool-search input {
  width: 100%;
  min-height: 52px;
  border: 0;
  background: transparent;
  color: var(--ink);
  outline: 0;
}

.tool-search input {
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.search-shell:focus-within,
.tool-search input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(13, 118, 103, 0.14), var(--shadow);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.primary-button,
.secondary-button,
.file-button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 850;
  text-decoration: none;
}

.primary-button,
.file-button {
  border: 0;
  background: var(--brand);
  color: #fff;
}

.secondary-button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--brand-strong);
}

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

.hero-panel {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 360px;
  padding: 14px;
  border: 1px solid #cbdbe7;
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(238, 244, 248, 0.92)),
    radial-gradient(circle at 100% 0%, rgba(36, 95, 203, 0.18), transparent 32%);
  box-shadow: var(--shadow);
}

.panel-bar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 9px;
  align-items: center;
  min-height: 42px;
  padding: 0 10px;
  border-bottom: 1px solid var(--line);
}

.panel-bar span {
  width: 42px;
  height: 10px;
  background:
    radial-gradient(circle at 5px 50%, var(--brand) 0 5px, transparent 5.5px),
    radial-gradient(circle at 21px 50%, var(--amber) 0 5px, transparent 5.5px),
    radial-gradient(circle at 37px 50%, var(--rose) 0 5px, transparent 5.5px);
}

.panel-bar em {
  color: var(--soft);
  font-size: 0.8rem;
  font-style: normal;
  font-weight: 800;
  text-transform: uppercase;
}

.panel-tool {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  min-height: 74px;
  padding: 14px;
  border: 1px solid #d8e2ea;
  border-radius: var(--radius);
  background: var(--surface);
  text-decoration: none;
}

.panel-tool span {
  grid-row: span 2;
  align-self: start;
  min-width: 42px;
  padding: 5px 7px;
  border-radius: 999px;
  background: #eef4f8;
  color: var(--soft);
  font-size: 0.78rem;
  font-weight: 900;
  text-align: center;
}

.panel-tool.is-live {
  border-color: rgba(13, 118, 103, 0.34);
  box-shadow: 0 12px 28px rgba(13, 118, 103, 0.12);
}

.panel-tool.is-live span {
  background: #dff5ed;
  color: var(--brand-strong);
}

.panel-tool strong {
  line-height: 1.25;
}

.panel-tool small {
  color: var(--muted);
}

.panel-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: auto;
}

.panel-metrics div {
  display: grid;
  gap: 2px;
  min-height: 72px;
  align-content: center;
  padding: 10px;
  border-radius: var(--radius);
  background: #101820;
  color: #fff;
}

.panel-metrics strong {
  font-size: 1.45rem;
}

.panel-metrics span {
  color: #c7d4dc;
  font-size: 0.82rem;
}

.home-main {
  width: min(1200px, calc(100% - 32px));
}

.hub-hero {
  display: grid;
  gap: 10px;
  justify-items: center;
  padding: 34px 0 24px;
  text-align: center;
}

.hub-hero h1 {
  color: var(--brand-strong);
  font-size: 2.75rem;
}

.hub-hero .lead {
  max-width: 650px;
  font-size: 1rem;
}

.hub-hero .home-search {
  max-width: 560px;
  margin-top: 8px;
}

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

.hub-category {
  min-width: 0;
}

.hub-category h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 900;
}

.hub-category h2::before {
  content: "";
  width: 3px;
  height: 16px;
  border-radius: 999px;
  background: var(--amber);
}

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

.compact-tool-card {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 66px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(22, 37, 56, 0.055);
  text-decoration: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.compact-tool-card:hover {
  border-color: rgba(13, 118, 103, 0.45);
  box-shadow: 0 14px 32px rgba(22, 37, 56, 0.09);
  transform: translateY(-1px);
}

.compact-tool-card.is-live {
  border-color: rgba(13, 118, 103, 0.34);
}

.tool-icon {
  display: inline-flex;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  background: #eef4f8;
  color: var(--blue);
  font-size: 1.05rem;
  font-weight: 900;
  line-height: 1;
}

.compact-tool-card.is-live .tool-icon {
  background: #dff5ed;
  color: var(--brand-strong);
}

.tool-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.tool-copy strong,
.tool-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-copy strong {
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 850;
}

.tool-copy small {
  color: var(--muted);
  font-size: 0.76rem;
}

.compact-tool-card em {
  min-width: 34px;
  padding: 4px 6px;
  border-radius: 999px;
  background: #eef4f8;
  color: var(--brand-strong);
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 900;
  text-align: center;
}

.compact-tool-card.is-live em {
  background: #dff5ed;
}

.trust-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 36px;
  padding: 22px 0;
  border-top: 1px solid var(--line);
  text-align: center;
}

.trust-row div {
  display: grid;
  gap: 4px;
}

.trust-row strong {
  color: var(--brand-strong);
  font-size: 0.88rem;
  font-style: italic;
}

.trust-row span {
  color: var(--muted);
  font-size: 0.8rem;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 10px 0 14px;
}

.status-strip span {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.74);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
  text-align: center;
}

.page-title,
.tool-title {
  padding: 30px 0 18px;
}

.page-title .tool-search {
  margin-top: 18px;
}

.section {
  padding: 24px 0;
}

.section.compact {
  max-width: 780px;
}

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

.section-head a {
  color: var(--brand-strong);
  font-weight: 800;
  white-space: nowrap;
}

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

.quick-launch .tool-grid {
  grid-template-columns: minmax(0, 1fr);
}

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

.tool-card {
  display: grid;
  align-content: start;
  gap: 9px;
  min-height: 166px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 12px 32px rgba(22, 37, 56, 0.08);
  text-decoration: none;
}

.quick-launch .tool-card {
  min-height: 132px;
  border-color: rgba(13, 118, 103, 0.28);
}

.tool-card:hover,
.category-grid a:hover,
.panel-tool:hover {
  border-color: rgba(13, 118, 103, 0.42);
  transform: translateY(-1px);
}

.tool-card strong {
  line-height: 1.28;
  font-size: 1.05rem;
}

.tool-card span:last-child {
  color: var(--muted);
  line-height: 1.45;
}

.tool-card.disabled {
  background: linear-gradient(180deg, #ffffff, #f7fafc);
}

.tool-type {
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 900;
}

.tool-type.live {
  color: var(--brand-strong);
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.category-grid a {
  display: grid;
  gap: 6px;
  min-height: 96px;
  align-content: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-decoration: none;
}

.category-grid span {
  color: var(--rose);
  font-size: 0.82rem;
  font-weight: 900;
}

.category-grid strong {
  line-height: 1.28;
}

.principle-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.principle-list p,
details {
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

details + details {
  margin-top: 10px;
}

summary {
  cursor: pointer;
  font-weight: 850;
}

details p,
.section.compact > p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.62;
}

.breadcrumbs {
  display: flex;
  gap: 8px;
  align-items: center;
  padding-top: 18px;
  color: var(--muted);
  font-size: 0.92rem;
}

.tool-surface {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

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

.file-input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
}

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

.preview-layout {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 14px;
  align-items: stretch;
  margin-top: 16px;
}

.preview-box,
.zoom-box {
  display: grid;
  gap: 8px;
  align-content: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.preview-label {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 850;
}

canvas {
  image-rendering: pixelated;
  background:
    linear-gradient(45deg, #d9e2e8 25%, transparent 25%),
    linear-gradient(-45deg, #d9e2e8 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #d9e2e8 75%),
    linear-gradient(-45deg, transparent 75%, #d9e2e8 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  border: 1px solid #b8c7d2;
}

#crest-canvas {
  width: 128px;
  height: 96px;
}

#crest-zoom {
  width: 100%;
  max-width: 384px;
  height: auto;
  aspect-ratio: 4 / 3;
}

.control-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
}

.control-grid label {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.toggle-row {
  align-content: center;
  grid-template-columns: auto 1fr;
}

.result-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding: 12px;
  border-radius: var(--radius);
  background: #eef4f8;
}

.related-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.category-strip a,
.related-links a {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--brand-strong);
  font-weight: 800;
  text-decoration: none;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  width: min(1120px, calc(100% - 32px));
  margin: 36px auto 0;
  padding: 24px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 960px) {
  .home-workbench {
    grid-template-columns: 1fr;
    padding-top: 24px;
  }

  .hero-copy,
  .hero-panel {
    min-height: auto;
  }

  .status-strip,
  .hub-layout,
  .category-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

@media (max-width: 760px) {
  main,
  .home-main,
  .site-footer {
    width: min(100% - 24px, 1120px);
  }

  .site-header {
    min-height: 56px;
    padding-inline: 12px;
  }

  .brand img {
    width: 32px;
    height: 32px;
  }

  .top-nav {
    gap: 2px;
    font-size: 0.9rem;
  }

  .top-nav a {
    min-height: 34px;
    padding-inline: 8px;
  }

  .home-workbench {
    gap: 16px;
  }

  h1 {
    font-size: 2.55rem;
  }

  .hub-hero {
    padding: 22px 0 18px;
  }

  .hub-hero h1 {
    font-size: 2.05rem;
  }

  .hub-hero .lead {
    font-size: 0.95rem;
  }

  .page-title h1,
  .tool-title h1 {
    font-size: 2.16rem;
  }

  .lead {
    font-size: 1.02rem;
  }

  .search-shell {
    min-height: 54px;
  }

  .hero-actions > * {
    flex: 1 1 150px;
  }

  .panel-metrics {
    grid-template-columns: 1fr;
  }

  .status-strip,
  .hub-layout,
  .compact-tool-grid,
  .trust-row,
  .tool-grid,
  .compact-grid,
  .category-grid {
    grid-template-columns: 1fr;
  }

  .tool-card {
    min-height: 132px;
  }

  .preview-layout {
    grid-template-columns: 1fr;
  }

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

  .result-strip {
    align-items: stretch;
    flex-direction: column;
  }

  .primary-button {
    width: 100%;
  }
}
