.hnum-converter {
  --hnum-bg: #fcf9f8;
  --hnum-border: #837377;
  --hnum-border-soft: #d5c2c6;
  --hnum-ink: #1b1c1c;
  --hnum-muted: #514347;
  --hnum-panel: #f6f3f2;
  --hnum-card: #ffffff;
  --hnum-accent: #864d61;
  --hnum-accent-soft: #ffb7ce;
  --hnum-accent-fixed: #ffd9e3;
  --hnum-secondary: #006c52;
  --hnum-secondary-soft: #8ff6d0;
  --hnum-tertiary: #d9cf29;
  --hnum-shadow: 4px 6px 0 rgba(27, 28, 28, 0.12);
  --hnum-shadow-soft: 0 8px 18px rgba(27, 28, 28, 0.10);
  background: var(--hnum-bg);
  border: 2px solid var(--hnum-border);
  border-radius: 18px;
  color: var(--hnum-ink);
  font-family: "Be Vietnam Pro", inherit;
  margin: 16px 0;
  padding: 14px;
  box-shadow: var(--hnum-shadow-soft);
}

.hnum-converter * {
  box-sizing: border-box;
}

.hnum-panel,
.hnum-preview-wrap,
.hnum-used-colors,
.hnum-share-panel,
.hnum-seo-content article,
.hnum-summary div {
  border: 2px solid var(--hnum-border);
  border-radius: 16px;
}

.hnum-seo-hero {
  padding: 4px 4px 12px;
}

.hnum-eyebrow {
  color: var(--hnum-accent);
  font-family: "Quicksand", "Be Vietnam Pro", inherit;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 6px;
  text-transform: uppercase;
}

.hnum-seo-hero h1 {
  color: var(--hnum-ink);
  font-family: "Quicksand", "Be Vietnam Pro", inherit;
  font-size: clamp(24px, 3.4vw, 38px);
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.16;
  margin: 0 0 10px;
  max-width: 980px;
}

.hnum-seo-hero p {
  color: var(--hnum-muted);
  font-size: 15px;
  line-height: 1.5;
  margin: 0;
  max-width: 980px;
}

.hnum-keyword-chips {
  height: 1px;
  margin: 0;
  overflow: hidden;
  position: absolute;
  width: 1px;
  clip-path: inset(50%);
}

.hnum-keyword-chips span {
  background: var(--hnum-accent-fixed);
  border: 2px solid var(--hnum-border);
  border-radius: 999px;
  color: var(--hnum-ink);
  font-size: 12px;
  font-weight: 800;
  padding: 7px 11px;
}

.hnum-panel {
  background: var(--hnum-panel);
  box-shadow: var(--hnum-shadow);
  padding: 18px;
}

.hnum-controls,
.hnum-advanced {
  display: grid;
  gap: 14px;
}

.hnum-controls {
  align-items: end;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.hnum-advanced {
  align-items: end;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  margin-top: 16px;
}

.hnum-advanced-details {
  border-top: 2px solid var(--hnum-border-soft);
  margin-top: 16px;
  padding-top: 12px;
}

.hnum-palette-details {
  border-top: 2px solid var(--hnum-border-soft);
  margin-top: 16px;
  padding-top: 12px;
}

.hnum-palette-details summary {
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
  min-height: 36px;
  color: var(--hnum-accent);
}

.hnum-palette-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 10px;
}

.hnum-mini-button {
  background: var(--hnum-card);
  border: 2px solid var(--hnum-border);
  border-radius: 999px;
  color: var(--hnum-ink);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  min-height: 34px;
  padding: 7px 10px;
  box-shadow: 0 2px 0 rgba(27, 28, 28, 0.16);
}

.hnum-color-grid {
  display: grid;
  gap: 0;
  max-height: 320px;
  overflow: auto;
  padding-right: 4px;
}

.hnum-color-row {
  align-items: center;
  background: var(--hnum-card);
  border: 0;
  border-bottom: 1px solid var(--hnum-border-soft);
  color: var(--hnum-ink);
  cursor: pointer;
  display: grid;
  gap: 10px;
  grid-template-columns: 38px minmax(0, 1fr) 74px;
  min-height: 48px;
  padding: 8px 0;
  text-align: left;
  width: 100%;
  transition: background 120ms ease, transform 120ms ease;
}

.hnum-color-row:hover {
  background: #fcf9f8;
}

.hnum-color-code {
  align-items: center;
  background: var(--chip-color);
  border: 2px solid rgba(27, 28, 28, 0.28);
  border-radius: 8px;
  color: var(--hnum-ink);
  display: inline-flex;
  font-size: 10px;
  font-weight: 800;
  height: 28px;
  justify-content: center;
  line-height: 1;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.55);
  width: 28px;
}

.hnum-color-label {
  color: var(--hnum-ink);
  font-size: 13px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hnum-color-value {
  color: var(--hnum-muted);
  font-size: 12px;
  justify-self: end;
}

.hnum-color-row[aria-pressed="true"] {
  background: var(--hnum-accent-fixed);
  box-shadow: inset 4px 0 0 var(--hnum-accent);
}

.hnum-advanced-details summary {
  color: var(--hnum-ink);
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
  list-style-position: inside;
  min-height: 36px;
}

.hnum-advanced-details[open] summary {
  margin-bottom: 4px;
}

.hnum-field,
.hnum-check {
  display: grid;
  gap: 7px;
}

.hnum-field span,
.hnum-check span {
  color: var(--hnum-muted);
  font-size: 13px;
  font-weight: 600;
}

.hnum-file,
.hnum-pattern-name,
.hnum-collection,
.hnum-color-count,
.hnum-palette,
.hnum-board-size,
.hnum-dither-mode,
.hnum-sharpen,
.hnum-detail {
  background: var(--hnum-card);
  border: 2px solid var(--hnum-border);
  border-radius: 14px;
  color: var(--hnum-ink);
  min-height: 42px;
  padding: 8px 10px;
  width: 100%;
}

.hnum-file:focus,
.hnum-pattern-name:focus,
.hnum-collection:focus,
.hnum-color-count:focus,
.hnum-palette:focus,
.hnum-board-size:focus,
.hnum-dither-mode:focus,
.hnum-sharpen:focus,
.hnum-detail:focus {
  border-color: var(--hnum-accent);
  box-shadow: 0 0 0 3px rgba(255, 183, 206, 0.55);
  outline: 0;
}

.hnum-width {
  accent-color: var(--hnum-accent);
  width: 100%;
}

.hnum-width-output {
  color: var(--hnum-ink);
  font-size: 13px;
  font-weight: 700;
}

.hnum-check {
  align-items: center;
  grid-template-columns: auto 1fr;
  min-height: 42px;
}

.hnum-check input {
  accent-color: var(--hnum-accent);
  height: 18px;
  width: 18px;
}

.hnum-button {
  background: var(--hnum-accent);
  border: 2px solid var(--hnum-border);
  border-radius: 999px;
  color: #ffffff;
  cursor: pointer;
  font-family: "Quicksand", "Be Vietnam Pro", inherit;
  font-weight: 800;
  min-height: 42px;
  padding: 10px 14px;
  white-space: nowrap;
  text-align: center;
  text-decoration: none;
  box-shadow: 0 4px 0 rgba(27, 28, 28, 0.18);
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.hnum-button:hover:not(:disabled) {
  box-shadow: 0 6px 0 rgba(27, 28, 28, 0.20);
  transform: translateY(-1px);
}

.hnum-button:disabled {
  background: #dcd9d9;
  border-color: var(--hnum-border-soft);
  color: #837377;
  cursor: not-allowed;
  box-shadow: none;
}

.hnum-button-secondary {
  background: var(--hnum-secondary-soft);
  color: #002117;
}

.hnum-button-secondary:disabled {
  background: #ffffff;
  color: #837377;
}

.hnum-share-panel {
  align-items: center;
  background: var(--hnum-accent-fixed);
  box-shadow: var(--hnum-shadow);
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr) auto;
  margin-top: 18px;
  padding: 16px;
}

.hnum-share-panel[hidden] {
  display: none;
}

.hnum-converter[data-can-save-seo="0"] .hnum-field:has(.hnum-pattern-name),
.hnum-converter[data-can-save-seo="0"] .hnum-field:has(.hnum-collection),
.hnum-converter[data-can-save-seo="0"] .hnum-field:has(.hnum-image-purpose),
.hnum-converter[data-can-save-seo="0"] .hnum-generate,
.hnum-converter[data-can-save-seo="0"] .hnum-save-map,
.hnum-converter[data-can-save-seo="0"] .hnum-share-panel {
  display: none !important;
}

.hnum-share-panel h2 {
  font-family: "Quicksand", "Be Vietnam Pro", inherit;
  font-size: 22px;
  line-height: 1.25;
  margin: 0 0 6px;
}

.hnum-share-description {
  color: var(--hnum-muted);
  margin: 0;
}

.hnum-share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.hnum-summary {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 16px;
}

.hnum-summary div,
.hnum-preview-wrap,
.hnum-used-colors {
  background: var(--hnum-card);
}

.hnum-summary div {
  padding: 12px;
}

.hnum-summary strong {
  display: block;
  font-size: 20px;
  font-family: "Quicksand", "Be Vietnam Pro", inherit;
  line-height: 1.2;
}

.hnum-summary span {
  color: var(--hnum-muted);
  display: block;
  font-size: 12px;
  margin-top: 4px;
}

.hnum-workspace {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) 320px;
  margin-top: 18px;
}

.hnum-preview-area {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.hnum-used-colors {
  padding: 14px;
  box-shadow: var(--hnum-shadow);
}

.hnum-used-colors h3 {
  color: var(--hnum-accent);
  font-family: "Quicksand", "Be Vietnam Pro", inherit;
  font-size: 15px;
  line-height: 1.3;
  margin: 0 0 10px;
}

.hnum-used-color-list {
  display: grid;
  max-height: 540px;
  overflow: auto;
}

.hnum-used-color-row {
  align-items: center;
  border-bottom: 1px solid var(--hnum-border-soft);
  display: grid;
  gap: 10px;
  grid-template-columns: 38px minmax(0, 1fr) 74px;
  min-height: 48px;
  padding: 8px 0;
}

.hnum-preview-wrap {
  max-height: min(78vh, 760px);
  min-height: 360px;
  overflow: hidden;
  overscroll-behavior: contain;
  padding: 14px;
  position: relative;
  -webkit-overflow-scrolling: touch;
  box-shadow: var(--hnum-shadow);
}

.hnum-preview-toolbar {
  align-items: center;
  background: var(--hnum-card);
  border: 2px solid var(--hnum-border-soft);
  border-radius: 16px;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin: 0;
  padding: 10px 14px;
}

.hnum-view-switch {
  background: var(--hnum-accent-fixed);
  border: 2px solid var(--hnum-border);
  border-radius: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  overflow: visible;
  padding: 2px;
}

.hnum-popular-patterns {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 0;
}

.hnum-popular-patterns h2 {
  flex: 0 0 auto;
  font-size: 16px;
  margin: 0;
}

.hnum-popular-patterns a {
  background: var(--hnum-accent-fixed);
  border: 2px solid var(--hnum-border);
  border-radius: 999px;
  color: var(--hnum-ink);
  font-size: 13px;
  font-weight: 800;
  padding: 8px 12px;
  text-decoration: none;
}

.hnum-popular-patterns .hnum-more-patterns {
  background: var(--hnum-secondary-soft);
}

.hnum-view-button {
  background: transparent;
  border-radius: 14px;
  border: 0;
  color: var(--hnum-ink);
  cursor: pointer;
  flex: 1 1 108px;
  font-size: 12px;
  font-family: "Quicksand", "Be Vietnam Pro", inherit;
  font-weight: 800;
  min-height: 34px;
  padding: 7px 10px;
  line-height: 1.15;
  white-space: normal;
  word-break: keep-all;
}

.hnum-view-button[aria-pressed="true"] {
  background: var(--hnum-accent);
  color: #ffffff;
}

.hnum-view-note {
  color: var(--hnum-muted);
  font-size: 12px;
  line-height: 1.3;
}

.hnum-canvas {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  max-width: none;
  transform-origin: top left;
  user-select: none;
}

.hnum-canvas.is-fit-view {
  margin: 0 auto;
}

.hnum-preview-wrap.is-detail-mode {
  cursor: grab;
  touch-action: none;
}

.hnum-preview-wrap.is-detail-mode.is-panning {
  cursor: grabbing;
}

.hnum-preview-area:fullscreen {
  background: #f8fbff;
  display: grid;
  gap: 10px;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100vh;
  padding: 12px;
}

.hnum-preview-area:fullscreen .hnum-preview-toolbar,
.hnum-converter.is-map-fullscreen-fallback .hnum-preview-toolbar {
  position: relative;
  z-index: 2;
}

.hnum-preview-area:fullscreen .hnum-preview-wrap,
.hnum-converter.is-map-fullscreen-fallback .hnum-preview-wrap {
  border-radius: 12px;
  height: 100%;
  max-height: none;
  min-height: 0;
}

.hnum-converter.is-map-fullscreen-fallback .hnum-preview-area {
  background: #f8fbff;
  display: grid;
  gap: 10px;
  grid-template-rows: auto minmax(0, 1fr) auto;
  inset: 0;
  padding: 12px;
  position: fixed;
  z-index: 999999;
}

.hnum-lock-scroll,
.hnum-lock-scroll body {
  overflow: hidden;
}

.hnum-empty {
  color: var(--hnum-muted);
  left: 24px;
  margin: 0;
  position: absolute;
  top: 24px;
}

.hnum-status {
  color: var(--hnum-muted);
  font-size: 13px;
  margin: 10px 0 0;
}

.hnum-status:empty {
  display: none;
}

.hnum-status.is-error {
  color: #ba1a1a;
  font-weight: 700;
}

.hnum-swatch {
  align-items: center;
  border: 2px solid rgba(27, 28, 28, 0.24);
  border-radius: 8px;
  color: var(--hnum-ink);
  display: inline-flex;
  font-size: 11px;
  font-weight: 800;
  height: 28px;
  justify-content: center;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.55);
  width: 28px;
}

.hnum-color-name {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hnum-color-hex {
  color: var(--hnum-muted);
  font-size: 12px;
}

.hnum-actions {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
  margin-top: 14px;
}

.hnum-seo-content {
  margin-top: 18px;
}

.hnum-seo-content h2 {
  font-family: "Quicksand", "Be Vietnam Pro", inherit;
  font-size: 18px;
  line-height: 1.25;
  margin: 0;
}

.hnum-seo-content p,
.hnum-seo-content li {
  color: var(--hnum-muted);
  line-height: 1.65;
}

.hnum-seo-content h3 {
  color: var(--hnum-ink);
  font-family: "Quicksand", "Be Vietnam Pro", inherit;
  font-size: 18px;
  line-height: 1.3;
  margin: 0 0 8px;
}

.hnum-seo-content ol {
  margin: 0;
  padding-left: 20px;
}

.hnum-guide,
.hnum-faq {
  background: var(--hnum-card);
  border: 2px solid var(--hnum-border);
  border-radius: 16px;
  margin-top: 14px;
  padding: 14px 16px;
}

.hnum-guide summary,
.hnum-faq summary {
  color: var(--hnum-accent);
  cursor: pointer;
  font-family: "Quicksand", "Be Vietnam Pro", inherit;
  font-weight: 800;
}

.hnum-sticky-cta {
  display: none;
}

.hnum-pattern-page img {
  border: 2px solid var(--hnum-border, #837377);
  border-radius: 16px;
  display: block;
  height: auto;
  max-width: 100%;
}

.hnum-pattern-page h2 {
  font-family: "Quicksand", "Be Vietnam Pro", inherit;
  font-size: 24px;
  line-height: 1.25;
}

.hnum-pattern-legend {
  columns: 2;
  list-style: none;
  padding-left: 0;
}

.hnum-pattern-legend li {
  break-inside: avoid;
  margin: 0 0 8px;
}

.hnum-pattern-legend span {
  border: 1px solid #837377;
  border-radius: 4px;
  display: inline-block;
  height: 18px;
  margin-right: 8px;
  vertical-align: middle;
  width: 18px;
}

@media (max-width: 1100px) {
  .hnum-controls,
  .hnum-advanced {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hnum-workspace {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .hnum-controls,
  .hnum-advanced,
  .hnum-summary,
  .hnum-seo-grid,
  .hnum-share-panel {
    grid-template-columns: 1fr;
  }

  .hnum-panel {
    padding: 12px;
  }

  .hnum-button {
    width: 100%;
  }

  .hnum-share-actions {
    justify-content: stretch;
  }

  .hnum-download-top {
    order: 99;
  }

  .hnum-preview-wrap {
    border-left: 0;
    border-radius: 0;
    border-right: 0;
    margin-left: -12px;
    margin-right: -12px;
    max-height: 68vh;
    min-height: 300px;
    padding: 10px 12px;
  }

  .hnum-preview-toolbar {
    margin: 0;
    padding: 8px 12px;
  }

  .hnum-canvas {
    min-width: 0;
  }

  .hnum-sticky-cta {
    background: var(--hnum-accent);
    border: 2px solid var(--hnum-border);
    border-radius: 999px;
    bottom: 16px;
    box-shadow: 0 4px 0 rgba(27, 28, 28, 0.18);
    color: #ffffff;
    display: inline-flex;
    font-family: "Quicksand", "Be Vietnam Pro", inherit;
    font-size: 13px;
    font-weight: 800;
    left: 50%;
    min-height: 42px;
    padding: 10px 18px;
    position: fixed;
    text-decoration: none;
    transform: translateX(-50%);
    z-index: 9999;
  }

}

@media (max-width: 520px) {
  .hnum-converter {
    margin: 16px 0;
  }

  .hnum-summary strong {
    font-size: 17px;
  }

  .hnum-workspace {
    gap: 12px;
  }

  .hnum-preview-wrap {
    max-height: 62vh;
  }

  .hnum-preview-toolbar {
    align-items: stretch;
    display: grid;
    gap: 7px;
    grid-template-columns: 1fr;
  }

  .hnum-view-note {
    font-size: 11px;
  }

  .hnum-used-color-list {
    max-height: 260px;
  }

  .hnum-actions {
    grid-template-columns: 1fr;
  }

  .hnum-field span,
  .hnum-check span {
    font-size: 12px;
  }

  .hnum-color-grid {
    max-height: 260px;
  }

  .hnum-file,
  .hnum-pattern-name,
  .hnum-collection,
  .hnum-color-count,
  .hnum-palette,
  .hnum-dither-mode,
  .hnum-sharpen,
  .hnum-board-size,
  .hnum-detail,
  .hnum-button {
    min-height: 44px;
  }
}
