@font-face {
  font-family: "Cinzel";
  src: url("fonts/cinzel-latin.woff2") format("woff2");
  font-weight: 400 900;
  font-display: swap;
}

:root {
  --night: #1c140d;
  --panel: #2a1e13;
  --well: #120c07;
  --bronze: #8d6a35;
  --gold: #e5bf63;
  --parchment: #f0e5cc;
  --muted: #bfae8e;
  --valid: #6cc24a;
  --invalid: #f0705f;
  --names: Georgia, "Noto Serif", "Times New Roman", serif;
}

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--night);
  color: var(--parchment);
  font-family: var(--names);
  font-size: 1.0625rem;
  line-height: 1.55;
}

main {
  flex: 1;
  width: 100%;
  max-width: 40rem;
  margin: 0 auto;
  padding: 3.75rem 1rem 2rem;
}

.language {
  position: absolute;
  top: 0.75rem;
  right: 1rem;
  display: inline-flex;
  border: 1px solid var(--bronze);
  border-radius: 2px;
}

.language button {
  min-width: 2.75rem;
  min-height: 2.25rem;
  padding: 0.15rem 0.5rem;
  background: none;
  border: 0;
  border-radius: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.language button[aria-pressed="true"] {
  background: var(--gold);
  color: var(--well);
  font-weight: 700;
}

header {
  margin-bottom: 1.75rem;
  text-align: center;
}

h1 {
  margin: 0 0 0.5rem;
  font-family: "Cinzel", var(--names);
  font-size: clamp(1.8rem, 7vw, 2.6rem);
  font-weight: 600;
  line-height: 1.2;
  color: var(--gold);
}

header p {
  margin: 0;
  color: var(--muted);
}

a {
  color: var(--gold);
}

/* The double frame echoes the in-game name dialog, built from plain borders. */
.panel {
  padding: 1.25rem 1rem 0.75rem;
  background: var(--panel);
  border: 2px solid var(--bronze);
  outline: 1px solid var(--bronze);
  outline-offset: 3px;
}

.fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.field {
  min-width: 0;
}

label {
  display: block;
  margin-bottom: 0.3rem;
  font-family: "Cinzel", var(--names);
  font-weight: 600;
  color: var(--gold);
}

.input-wrap {
  position: relative;
}

input {
  width: 100%;
  padding: 0.55rem 2rem 0.55rem 0.65rem;
  background: var(--well);
  border: 1px solid var(--bronze);
  border-radius: 2px;
  color: var(--parchment);
  font-family: var(--names);
  font-size: 1.2rem;
}

input:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}

.state-icon {
  position: absolute;
  top: 50%;
  right: 0.6rem;
  transform: translateY(-50%);
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1;
}

[data-state="valid"] .state-icon::after {
  content: "✓";
  color: var(--valid);
}

[data-state="invalid"] .state-icon::after {
  content: "✕";
  color: var(--invalid);
}

[data-state="invalid"] input {
  border-color: var(--invalid);
}

.message {
  margin: 0.3rem 0 0;
  min-height: 1.4em;
  font-size: 0.95rem;
  line-height: 1.4;
  color: var(--muted);
}

[data-state="invalid"] .message,
#name-error {
  color: var(--invalid);
}

#name-error:empty {
  display: none;
}

.availability {
  margin: 1.1rem 0 0;
  text-align: center;
  color: var(--parchment);
}

#results {
  margin-top: 1.75rem;
}

.note {
  margin: 0.4rem 0 0;
  font-size: 0.95rem;
  color: var(--muted);
}

h3 {
  margin: 1.5rem 0 0.25rem;
  font-family: "Cinzel", var(--names);
  font-size: 1rem;
  font-weight: 600;
  color: var(--gold);
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.variant {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgb(141 106 53 / 45%);
}

.variant-name {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 1.4rem;
  line-height: 1.3;
}

/* The changed letter is what people came to compare. */
mark {
  background: none;
  color: var(--gold);
  border-bottom: 2px solid var(--gold);
}

button {
  flex: none;
  min-height: 2.5rem;
  padding: 0.3rem 0.85rem;
  background: var(--panel);
  border: 1px solid var(--bronze);
  border-radius: 2px;
  color: var(--gold);
  font-family: var(--names);
  font-size: 1rem;
  cursor: pointer;
}

button:hover {
  background: #3a2a1a;
}

button:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.actions button {
  flex: 1 1 10rem;
}

#copy-all {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--well);
  font-weight: 700;
}

#copy-all:hover {
  background: #f0d283;
}

[hidden] {
  display: none !important;
}

footer {
  padding: 1rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--muted);
}

/* Keeps a 12-letter name visible in the side-by-side fields. */
@media (max-width: 30rem) {
  input {
    padding: 0.5rem 1.4rem 0.5rem 0.4rem;
    font-size: 1rem;
  }

  .state-icon {
    right: 0.35rem;
    font-size: 1rem;
  }
}

@media (max-width: 22rem) {
  .fields {
    grid-template-columns: 1fr;
  }
}
