:root {
  --bg: #faf7f2;
  --ink: #1d1d1f;
  --muted: #9a938a;
  --line: #e8e1d6;
  --red: #c0182f;
  --green: #2f7a4d;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

main {
  flex: 1;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  padding: 64px 22px 16px;
}

header {
  text-align: center;
  margin-bottom: 28px;
}

.flake {
  display: block;
  color: var(--red);
  font-size: 22px;
  margin-bottom: 12px;
}

h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
  font-size: 30px;
  letter-spacing: -.01em;
  margin: 0 0 6px;
}

#subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.4;
}

textarea,
input {
  width: 100%;
  font: inherit;
  font-size: 16px;
  color: inherit;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  outline: none;
  transition: border-color .15s;
}

textarea {
  display: block;
  min-height: 140px;
  resize: vertical;
  line-height: 1.5;
}

textarea:focus,
input:focus { border-color: var(--red); }

::placeholder { color: #bdb5aa; }

.meta {
  display: flex;
  justify-content: space-between;
  margin: 8px 2px 18px;
  font-size: 13px;
  color: var(--muted);
}

.meta .over { color: var(--red); }

#preview {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto 18px;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.row.single { grid-template-columns: 1fr; }

button {
  width: 100%;
  margin-top: 16px;
  border: 0;
  border-radius: 12px;
  padding: 15px;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  background: var(--red);
  cursor: pointer;
  transition: opacity .15s, transform .1s;
}

button:active { transform: scale(.99); }
button:disabled { opacity: .5; cursor: progress; }
button:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

#result {
  min-height: 1.4em;
  margin: 14px 0 0;
  text-align: center;
  font-size: 14px;
  color: var(--muted);
}

#result.ok { color: var(--green); }
#result.err { color: var(--red); }

footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 20px;
  font-size: 12px;
  color: var(--muted);
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #d3cbc0;
}

footer.ok .dot { background: var(--green); }
footer.warn .dot { background: #d9a520; }
footer.off .dot { background: var(--red); }

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

[hidden] { display: none !important; }

@media (max-width: 380px) {
  main { padding-top: 44px; }
  .row { grid-template-columns: 1fr; }
}
