:root {
  --ink: #1b2a3a;
  --muted: #56677a;
  --page: #f2f5f8;
  --surface: #ffffff;
  --line: #d7dee6;
  --rack: #1f6f78;
  --rack-dark: #155259;
  --tile: #f6dc8c;
  --tile-edge: #d4ad45;
  --link: #1f5fa8;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 17px/1.55 "Atkinson Hyperlegible", system-ui, sans-serif;
}

a { color: var(--link); }
:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; }

.wrap { max-width: 46rem; margin: 0 auto; padding: 0 16px; }

header .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem 1.25rem;
  align-items: baseline;
  justify-content: space-between;
  padding-block: 1rem;
}
.brand { font-weight: 700; font-size: 1.2rem; color: var(--ink); text-decoration: none; }
nav { display: flex; gap: 1rem; }
nav a { color: var(--muted); text-decoration: none; }
nav a:hover { color: var(--ink); }
nav a[aria-current] { color: var(--ink); font-weight: 700; }

h1 { font-size: 2rem; line-height: 1.15; margin: .5rem 0 0; }

.tool {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.25rem;
  margin: 1rem 0 1.5rem;
}
.tool > label { display: block; font-weight: 700; margin-bottom: .35rem; }
.row { display: flex; gap: .5rem; }
.row input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 1.4rem;
  padding: .5rem .75rem;
  color: var(--ink);
  border: 2px solid var(--line);
  border-radius: 8px;
}
#letters { letter-spacing: .12em; text-transform: uppercase; }
#letters::placeholder { letter-spacing: normal; text-transform: none; }
.row input:focus { border-color: var(--rack); outline: none; }
button {
  font: inherit;
  font-weight: 700;
  color: #fff;
  background: var(--rack);
  border: 0;
  border-radius: 8px;
  padding: 0 1.4rem;
  cursor: pointer;
}
button:hover { background: var(--rack-dark); }
.hint { margin: .4rem 0 0; font-size: .9rem; color: var(--muted); }

.rack {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 3.5rem;
  margin-top: .9rem;
  padding: 8px;
  background: var(--rack);
  border-radius: 6px;
  box-shadow: inset 0 -5px 0 var(--rack-dark);
}
.rack:empty::before { content: "Your letters show up here as tiles."; align-self: center; padding-left: .3rem; color: #cde4e6; }
.rack span {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  font-size: 1.35rem;
  font-weight: 700;
  text-transform: uppercase;
  background: var(--tile);
  border-radius: 4px;
  box-shadow: inset 0 -3px 0 var(--tile-edge);
}
.rack .blank { background: #fbf1cf; }
.rack .gap { width: 1rem; background: none; box-shadow: none; }

details { margin-top: 1rem; }
summary { cursor: pointer; font-weight: 700; }
.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: .75rem;
  margin-top: .75rem;
}
.filters label { display: grid; gap: .2rem; font-size: .9rem; color: var(--muted); }
.filters input, .filters select {
  font: inherit;
  color: var(--ink);
  padding: .4rem .5rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.status { margin: 1rem 0 0; font-weight: 700; }
.status:empty { display: none; }

.group h2 {
  font-size: 1rem;
  margin: 1.5rem 0 .4rem;
  padding-bottom: .25rem;
  border-bottom: 1px solid var(--line);
}
.group p { display: flex; flex-wrap: wrap; gap: .2rem 1.1rem; margin: 0; font-size: 1.1rem; }

.scrambled { margin: .75rem 0 0; font-size: 1.3rem; letter-spacing: .08em; overflow-wrap: anywhere; }
.scrambled:empty { display: none; }

article { max-width: 40rem; }
article h2 { font-size: 1.35rem; margin: 2.25rem 0 .5rem; }
article h3 { font-size: 1.05rem; margin: 1.5rem 0 .25rem; }

footer { margin-top: 3rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem; }
footer .wrap { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; padding-block: 1.25rem 2rem; }
footer a { color: var(--muted); }

@media (max-width: 480px) {
  h1 { font-size: 1.6rem; }
  .row { flex-direction: column; }
  button { padding: .75rem; }
  .rack span { width: 2.1rem; height: 2.1rem; font-size: 1.15rem; }
}
