/* Hand writing to ascii art generator — simple */

:root {
  --bg: #f4f4f2;
  --surface: #ffffff;
  --ink: #1a1a1a;
  --muted: #6b6b6b;
  --line: #d8d8d4;
  --accent: #1a1a1a;
  --paper: #ffffff;
  --font: "DM Sans", sans-serif;
  --mono: "DM Mono", ui-monospace, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  background: var(--bg);
}

.site-logo {
  display: flex;
  justify-content: center;
  padding: 1rem 1.25rem 0;
  max-width: 960px;
  margin: 0 auto;
}

.site-logo img {
  display: block;
  height: 40px;
  width: auto;
  max-width: 160px;
  object-fit: contain;
}

.top {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.75rem 1.25rem 1rem;
}

@media (min-width: 768px) {
  .site-logo {
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 100;
    justify-content: flex-start;
    padding: 0;
    margin: 0;
    max-width: none;
  }

  .site-logo img {
    height: 44px;
    max-width: 180px;
  }

  .top {
    padding-top: 4.5rem;
  }
}

.top h1 {
  margin: 0 0 0.25rem;
  font-size: clamp(1.15rem, 3.5vw, 1.5rem);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.top p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.stepper {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-top: 1rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
}

.step-item.is-active {
  color: var(--ink);
  font-weight: 500;
}

.step-item.is-done {
  color: var(--ink);
  opacity: 0.55;
}

.layout {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1.25rem 2.5rem;
  display: grid;
  gap: 1.5rem;
}

.layout[data-step="1"] .photo-step,
.layout[data-step="1"] .result-step,
.layout[data-step="2"] .draw,
.layout[data-step="2"] .result-step,
.layout[data-step="3"] .draw,
.layout[data-step="3"] .photo-step {
  display: none;
}

.layout[data-step="3"] {
  grid-template-columns: 1fr;
}

@media (min-width: 800px) {
  .layout[data-step="3"] {
    grid-template-columns: minmax(220px, 280px) 1fr;
    align-items: start;
  }

  .layout[data-step="3"] .result-frame {
    min-height: 420px;
  }
}

.panel-step,
.col {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 1.1rem;
}

.result-step {
  display: contents;
}

.layout[data-step="3"] .result-step {
  display: contents;
}

.block {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 1.1rem;
}

.step-copy {
  margin: -0.35rem 0 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.step-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1rem;
}

.step-actions.stacked {
  flex-direction: column;
  align-items: stretch;
}

.step-actions.stacked .btn {
  width: 100%;
}

.photo-thumb-wrap {
  margin-bottom: 0.85rem;
}

#resultPhotoThumb {
  display: block;
  width: 100%;
  max-height: 140px;
  object-fit: contain;
  background: #111;
}

#resultPhotoThumb[hidden] {
  display: none;
}

h2 {
  margin: 0 0 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Glyph rail */
.glyph-rail {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.glyph-slot {
  width: 40px;
  height: 48px;
  border: 1px solid var(--line);
  background: var(--bg);
  cursor: pointer;
  position: relative;
  padding: 0;
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.glyph-slot:hover {
  border-color: var(--ink);
}

.glyph-slot.active {
  border-color: var(--ink);
  outline: 1px solid var(--ink);
}

.glyph-slot.filled {
  background: var(--paper);
}

.glyph-slot .slot-char {
  font-family: var(--mono);
  font-size: 1.1rem;
  color: var(--ink);
  line-height: 1;
  pointer-events: none;
}

.glyph-slot.filled .slot-char {
  display: none;
}

.glyph-slot canvas {
  width: 100%;
  height: 100%;
  display: none;
  pointer-events: none;
}

.glyph-slot.filled canvas {
  display: block;
}

.glyph-slot .slot-check {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 5px;
  height: 5px;
  background: var(--ink);
  opacity: 0;
  pointer-events: none;
}

.glyph-slot.filled .slot-check {
  opacity: 1;
}

/* Draw */
.draw-meta {
  margin-bottom: 0.5rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
}

#drawCanvas {
  display: block;
  width: 100%;
  max-width: 220px;
  margin: 0 auto;
  aspect-ratio: 160 / 220;
  height: auto;
  background: var(--paper);
  border: 1px solid var(--line);
  cursor: crosshair;
  touch-action: none;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.tools {
  margin-top: 0.85rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.75rem;
  color: var(--muted);
  flex: 1;
  min-width: 90px;
}

.field span {
  font-family: var(--mono);
  color: var(--ink);
}

.field input[type="range"] {
  width: 100%;
  accent-color: var(--ink);
}

.check {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
}

.check input {
  accent-color: var(--ink);
}

.btn {
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.btn:hover:not(:disabled) {
  border-color: var(--ink);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn.primary {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.btn.primary:hover:not(:disabled) {
  opacity: 0.85;
}

.btn.download {
  background: #0d7a5f;
  border-color: #0d7a5f;
  color: #fff;
}

.btn.download:hover:not(:disabled) {
  background: #0a624c;
  border-color: #0a624c;
}

.btn.full {
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.65rem;
}

/* Photo */
.dropzone {
  border: 1px dashed var(--line);
  background: var(--bg);
  cursor: pointer;
  overflow: hidden;
  margin-bottom: 0.85rem;
  min-height: 120px;
}

.dropzone:hover,
.dropzone:focus-visible,
.dropzone.dragover {
  border-color: var(--ink);
  border-style: solid;
  outline: none;
}

.dropzone.has-image {
  border-style: solid;
}

.dropzone-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

#photoPreview {
  display: block;
  width: 100%;
  max-height: 180px;
  object-fit: contain;
  background: #111;
}

#photoPreview[hidden] {
  display: none;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.result-head h2 {
  margin: 0;
}

.result-frame {
  background: #111;
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
}

.result-placeholder {
  padding: 1.5rem;
  text-align: center;
  color: #777;
  font-size: 0.85rem;
}

#outputCanvas {
  display: block;
  max-width: 100%;
  height: auto;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.result-bar {
  margin-top: 0.75rem;
}

.status {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
}

/* SEO content */
.seo {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
  border-top: 1px solid var(--line);
  color: var(--ink);
}

.seo h2 {
  margin: 0 0 0.75rem;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  text-transform: none;
  color: var(--ink);
}

.seo h3 {
  margin: 1.5rem 0 0.5rem;
  font-size: 1.05rem;
  font-weight: 600;
}

.seo h4 {
  margin: 1rem 0 0.35rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.seo p,
.seo li {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

.seo p {
  margin: 0 0 0.75rem;
}

.seo ol,
.seo ul {
  margin: 0 0 0.75rem;
  padding-left: 1.25rem;
}

.seo li {
  margin-bottom: 0.35rem;
}

.seo code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 0.05em 0.35em;
}

.seo strong {
  color: var(--ink);
  font-weight: 600;
}

.site-footer {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1.25rem 2rem;
  border-top: 1px solid var(--line);
}

.site-footer p {
  margin: 1rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
}

.site-footer a {
  color: var(--ink);
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}
