/* Logical properties only, so the layout works in right-to-left languages too. */
:root {
  --accent: #b00020;
  --ok: #1b7f3b;
  --fail: #b00020;
  --warn-bg: #fff4d6;
  color-scheme: light dark;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
}

body {
  margin: 0;
  padding-block: env(safe-area-inset-top) env(safe-area-inset-bottom);
}

main {
  max-inline-size: 40rem;
  margin-inline: auto;
  padding: 1rem;
}

h1 { font-size: 1.4rem; margin: 0; }
h2 { font-size: 1.15rem; margin-block: 1.5rem 0.5rem; }
h3 { font-size: 1rem; margin-block: 1rem 0.25rem; }

section {
  border-block-start: 1px solid color-mix(in srgb, currentColor 20%, transparent);
}

.row { display: flex; gap: 0.5rem; align-items: center; justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 0.5rem; margin-block: 0.5rem; }

button, .button {
  display: inline-block;
  min-block-size: 2.75rem;
  padding-inline: 1rem;
  border: 0;
  border-radius: 0.5rem;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  line-height: 2.75rem;
  cursor: pointer;
}
button.secondary { background: color-mix(in srgb, currentColor 15%, transparent); color: inherit; }
button.small { min-block-size: 2rem; line-height: 2rem; font-size: 0.9rem; }

input, textarea, select {
  font: inherit;
  padding: 0.5rem;
  border-radius: 0.4rem;
  border: 1px solid color-mix(in srgb, currentColor 40%, transparent);
  inline-size: 100%;
  box-sizing: border-box;
}
#code-form input { flex: 1; text-transform: uppercase; letter-spacing: 0.1em; }
label { display: flex; flex-direction: column; gap: 0.25rem; margin-block: 0.5rem; }

dl { display: grid; grid-template-columns: max-content 1fr; gap: 0.25rem 1rem; }
dt { font-weight: 600; }
dd { margin: 0; overflow-wrap: anywhere; }

.hint { font-size: 0.9rem; opacity: 0.8; }
.warning { background: var(--warn-bg); color: #3d2e00; padding: 0.75rem; border-radius: 0.5rem; }
.ok { color: var(--ok); font-weight: 600; }
.error { color: var(--fail); font-weight: 600; }
.code { font-size: 2rem; font-weight: 700; letter-spacing: 0.15em; font-family: ui-monospace, monospace; }

#log { font-family: ui-monospace, monospace; font-size: 0.8rem; padding-inline-start: 1.5rem; }
#log li.ok { color: var(--ok); }
#log li.fail { color: var(--fail); }

.visually-hidden {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
