:root {
  color-scheme: light;
  --bg: #f7f5ef;
  --surface: #ffffff;
  --surface-2: #f0f6f3;
  --ink: #202322;
  --muted: #68736f;
  --line: #d8ddd7;
  --teal: #12766d;
  --teal-2: #0e5e57;
  --coral: #d85f45;
  --amber: #c98a18;
  --mint: #dcefe9;
  --shadow: 0 16px 44px rgba(30, 38, 35, .12);
  --radius: 8px;
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(180deg, rgba(220, 239, 233, .72), rgba(247, 245, 239, 0) 340px),
    var(--bg);
  color: var(--ink);
}

a { color: inherit; text-decoration: none; }

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

button {
  border: 0;
  cursor: pointer;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  outline: none;
}

textarea:focus,
input:focus,
select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(18, 118, 109, .14);
}

textarea {
  min-height: 180px;
  padding: 12px;
  resize: vertical;
  line-height: 1.5;
}

input,
select {
  min-height: 42px;
  padding: 0 12px;
}

input[type="file"] {
  display: flex;
  align-items: center;
  min-height: 52px;
  padding: 8px 10px;
  line-height: 1.2;
}

input[type="file"]::file-selector-button {
  min-height: 34px;
  margin: 0 12px 0 0;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7faf8;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

input[type="file"]::file-selector-button:hover {
  border-color: rgba(18, 118, 109, .35);
  background: var(--mint);
}

code,
pre,
.mono {
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
}

pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(210px, 280px) minmax(220px, 1fr) auto;
  gap: 16px;
  align-items: center;
  min-height: 76px;
  padding: 12px clamp(16px, 3vw, 36px);
  border-bottom: 1px solid rgba(216, 221, 215, .82);
  background: rgba(247, 245, 239, .92);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: #202322;
  color: #fff;
  font-weight: 800;
  letter-spacing: 0;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 18px;
}

.brand small {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.search {
  position: relative;
}

.search span {
  position: absolute;
  left: 14px;
  top: 7px;
  color: var(--muted);
  font-size: 11px;
}

.search input {
  height: 50px;
  padding-top: 14px;
  background: rgba(255, 255, 255, .84);
}

.top-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.top-actions a,
.category-pill,
.btn,
.ghost-btn,
.mini-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border-radius: var(--radius);
  transition: .16s ease;
}

.top-actions a,
.category-pill,
.ghost-btn,
.mini-btn {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .72);
  color: var(--ink);
}

.top-actions a {
  padding: 0 12px;
  font-size: 14px;
}

.layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 28px;
  padding: 24px clamp(16px, 3vw, 36px) 48px;
}

.sidebar {
  position: sticky;
  top: 100px;
  align-self: start;
  max-height: calc(100vh - 116px);
  overflow: auto;
  padding-right: 4px;
}

.sidebar-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin: 0 0 10px;
}

#category-nav {
  display: grid;
  gap: 8px;
}

.category-pill {
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  font-size: 14px;
}

.category-pill.active,
.category-pill:hover,
.top-actions a:hover,
.ghost-btn:hover,
.mini-btn:hover {
  border-color: rgba(18, 118, 109, .28);
  background: var(--mint);
}

.category-pill small {
  color: var(--muted);
}

#app {
  min-width: 0;
}

#app:focus {
  outline: none;
}

.page-head {
  display: grid;
  gap: 10px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0;
  color: var(--teal-2);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}

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

h1[id],
h2[id],
h3[id],
.section[id],
.seo-text[id] {
  scroll-margin-top: 104px;
}

h1 {
  max-width: 980px;
  margin-bottom: 0;
  font-size: clamp(34px, 5vw, 60px);
  line-height: 1.02;
  letter-spacing: 0;
}

.tool-page h1 {
  font-size: clamp(30px, 4vw, 48px);
}

.lead {
  max-width: 820px;
  margin: 0;
  color: #4e5a55;
  font-size: 18px;
  line-height: 1.55;
}

.hero-actions,
.toolbar,
.button-row,
.inline-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.hero-actions {
  margin-top: 18px;
}

.btn {
  min-width: 132px;
  padding: 0 16px;
  background: var(--teal);
  color: white;
  font-weight: 750;
}

.btn:hover {
  background: var(--teal-2);
  transform: translateY(-1px);
}

.btn.secondary {
  background: #202322;
}

.btn.warn {
  background: var(--coral);
}

.ghost-btn,
.mini-btn {
  padding: 0 12px;
}

.mini-btn {
  min-height: 34px;
  font-size: 13px;
}

.section {
  margin-top: 34px;
}

.section h2 {
  font-size: 24px;
  margin-bottom: 14px;
}

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

.tool-card {
  display: grid;
  gap: 8px;
  min-height: 148px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 8px 22px rgba(30, 38, 35, .05);
}

.tool-card:hover {
  border-color: rgba(18, 118, 109, .34);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.tool-card strong {
  font-size: 17px;
  line-height: 1.25;
}

.tool-card p {
  color: var(--muted);
  margin: 0;
  line-height: 1.45;
  font-size: 14px;
}

.tool-card .tag-row,
.tag-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #f3eee2;
  color: #73541d;
  font-size: 12px;
  font-weight: 650;
}

.tool-shell {
  display: grid;
  gap: 18px;
}

.tool-panel,
.result-panel,
.preview-panel,
.info-band {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.tool-panel,
.result-panel {
  padding: clamp(16px, 2vw, 22px);
}

.info-band {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  background: var(--line);
}

.info-band > div {
  padding: 16px;
  background: var(--surface);
}

.metric {
  display: grid;
  gap: 3px;
}

.metric strong {
  font-size: 24px;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
}

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

.field {
  display: grid;
  gap: 7px;
}

.field.full,
.full {
  grid-column: 1 / -1;
}

.field label,
.group-title {
  color: #3b4541;
  font-size: 13px;
  font-weight: 750;
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}

.check,
.radio {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  font-size: 14px;
}

.check input,
.radio input {
  width: auto;
  min-height: 0;
}

.range-grid {
  display: grid;
  gap: 10px;
}

.range-line {
  display: grid;
  grid-template-columns: minmax(130px, 170px) 1fr 64px;
  gap: 10px;
  align-items: center;
}

input[type="range"] {
  padding: 0;
}

.result-panel {
  display: grid;
  gap: 12px;
  min-height: 110px;
}

.result-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.result-title {
  margin: 0;
  font-size: 16px;
}

.output {
  overflow: auto;
  max-height: 540px;
  padding: 14px;
  border-radius: var(--radius);
  background: #18211f;
  color: #ecf5f0;
  line-height: 1.55;
}

.output.light {
  background: #f7faf8;
  color: var(--ink);
  border: 1px solid var(--line);
}

.output table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.output th,
.output td {
  padding: 9px;
  border-bottom: 1px solid rgba(216, 221, 215, .7);
  text-align: left;
  vertical-align: top;
}

.output th {
  color: #2d3934;
  background: #edf4f1;
}

.canvas-zone {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(260px, 380px);
  gap: 16px;
}

.canvas-wrap {
  display: grid;
  place-items: center;
  min-height: 320px;
  border: 1px dashed #b9c6bf;
  border-radius: var(--radius);
  background:
    linear-gradient(45deg, #f4f4f4 25%, transparent 25%),
    linear-gradient(-45deg, #f4f4f4 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #f4f4f4 75%),
    linear-gradient(-45deg, transparent 75%, #f4f4f4 75%);
  background-size: 24px 24px;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
  overflow: hidden;
}

canvas {
  max-width: 100%;
  max-height: 560px;
}

.preview-panel {
  min-height: 220px;
  padding: 18px;
}

.preview-box {
  display: grid;
  place-items: center;
  min-height: 220px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #fff;
  overflow: hidden;
}

.gradient-preview {
  width: 100%;
  min-height: 260px;
}

.qr-grid {
  display: grid;
  place-items: center;
  padding: 20px;
  background: #fff;
}

.status {
  color: var(--muted);
  font-size: 14px;
}

.status.ok { color: var(--teal-2); }
.status.bad { color: var(--coral); }

.hidden { display: none !important; }

.empty-state {
  display: grid;
  gap: 8px;
  place-items: center;
  min-height: 180px;
  color: var(--muted);
  text-align: center;
}

.blog-list {
  display: grid;
  gap: 12px;
}

.blog-item {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.blog-item h2 {
  font-size: 20px;
  margin-bottom: 8px;
}

.blog-item p {
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 0;
}

.seo-text {
  margin-top: 34px;
  padding: clamp(18px, 2.5vw, 28px);
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, .52);
}

.seo-text h2 {
  max-width: 860px;
  margin-bottom: 12px;
  font-size: 24px;
}

.seo-text p {
  max-width: 920px;
  margin-bottom: 12px;
  color: #4e5a55;
  line-height: 1.68;
}

.seo-text p:last-child {
  margin-bottom: 0;
}

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

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

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

  .sidebar {
    position: static;
    max-height: none;
  }

  #category-nav {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }

  .canvas-zone,
  .form-grid,
  .info-band {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .topbar,
  .layout {
    padding-left: 12px;
    padding-right: 12px;
  }

  h1 {
    font-size: 32px;
  }

  .lead {
    font-size: 16px;
  }

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

  .range-line {
    grid-template-columns: 1fr;
  }

  .btn,
  .ghost-btn {
    width: 100%;
  }
}
