@font-face {
  font-family: "TeX Gyre Heros";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/HelveticaNeueRoman.woff2") format("woff2"),
       url("../fonts/HelveticaNeueRoman.woff") format("woff");
}

@font-face {
  font-family: "TeX Gyre Heros";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/HelveticaNeueRoman.woff2") format("woff2"),
       url("../fonts/HelveticaNeueRoman.woff") format("woff");
}

html {
  color-scheme: light dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: #dddddd;
  color: #000000;
  font-family: Chicago, Charcoal, Geneva, "Helvetica Neue", "TeX Gyre Heros", Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.35;
}

body.has-result {
  place-items: start center;
}

a:link { color: #0000ee; }
a:visited { color: #551a8b; }
a:active { color: #ff0000; }

.nav {
  margin: 1.2rem 0 0;
  font-size: 0.95em;
}

main {
  width: min(44rem, 100%);
  padding: 1.5rem;
  background: #eeeeee;
  border: 1px solid #000000;
  border-radius: 12px;
}

h1, h2 {
  font-family: Chicago, Charcoal, Geneva, "Helvetica Neue", "TeX Gyre Heros", Helvetica, Arial, sans-serif;
  font-weight: bold;
}

h1 {
  margin: 0 0 0.35rem;
  font-size: 1.6rem;
}

h2 {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
  border-bottom: 1px solid #666666;
  padding-bottom: 0.15em;
}

p.hint {
  margin: 0 0 1.1rem;
  color: #333333;
  font-size: 0.9rem;
}

code {
  font-family: Monaco, "Courier New", Courier, monospace;
  font-size: 0.88em;
  padding: 0 0.2em;
  background: #eeeeee;
  border: 1px solid #999999;
}

form {
  display: grid;
  gap: 0.75rem;
}

.url-row {
  display: flex;
  gap: 0.5rem;
}

label.field {
  display: grid;
  gap: 0.35rem;
  color: #333333;
  font-size: 0.9rem;
}

input[type="url"],
input[type="number"],
textarea {
  width: 100%;
  min-width: 0;
  padding: 0.45rem 0.7rem;
  color: #000000;
  background: #ffffff;
  border: 1px solid #000000;
  border-radius: 8px;
  font: inherit;
}

input[type="url"]:focus,
input[type="number"]:focus,
textarea:focus {
  outline: 2px solid #0000ee;
  outline-offset: 1px;
}

input[type="number"] { width: 6.5rem; }

.opts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  color: #333333;
  font-size: 0.9rem;
}

.opts label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
}

button {
  padding: 0.45rem 0.95rem;
  color: #000000;
  background: #eeeeee;
  border: 1px solid #000000;
  border-radius: 999px;
  font: inherit;
  font-weight: bold;
  cursor: pointer;
  white-space: nowrap;
}

button:hover { background: #ffffff; }

.error {
  margin: 1.1rem 0 0;
  color: #cc0000;
  font-size: 0.9rem;
}

#result {
  margin-top: 1.1rem;
  padding-top: 1.1rem;
  border-top: 1px solid #666666;
}

textarea {
  min-height: 14rem;
  margin: 0.7rem 0;
  font-family: Monaco, "Courier New", Courier, monospace;
  font-size: 0.8rem;
  overflow-x: auto;
}

.preview {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.preview img {
  height: 72px;
  width: auto;
  background: #ffffff;
  border: 1px solid #000000;
  border-radius: 8px;
}

@media (prefers-color-scheme: dark) {
  body {
    background: #2c2c2e;
    color: #f2f2f7;
  }

  a:link { color: #6cb4ff; }
  a:visited { color: #c4a6e0; }
  a:active { color: #ff6b6b; }

  main {
    background: #1c1c1e;
    border-color: #6e6e73;
  }

  h2 { border-bottom-color: #636366; }

  p.hint,
  label.field,
  .opts { color: #aeaeb2; }

  code {
    background: #1c1c1e;
    border-color: #555555;
    color: #f2f2f7;
  }

  input[type="url"],
  input[type="number"],
  textarea {
    color: #f2f2f7;
    background: #242426;
    border-color: #6e6e73;
  }

  input[type="url"]:focus,
  input[type="number"]:focus,
  textarea:focus {
    outline-color: #6cb4ff;
  }

  button {
    color: #f2f2f7;
    background: #3a3a3c;
    border-color: #6e6e73;
  }

  button:hover { background: #48484a; }

  .error { color: #ff6b6b; }

  #result { border-top-color: #636366; }

  .preview img {
    background: #1c1c1e;
    border-color: #6e6e70;
  }
}
