:root {
  --bg: #f7f7f5;
  --fg: #1a1a1a;
  --muted: #5a5a5a;
  --accent: #2a6df4;
  --border: #e3e3e0;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  line-height: 1.6;
}

header {
  border-bottom: 1px solid var(--border);
  background: #fff;
}

header .inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

header h1 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
}

header h1 a {
  color: inherit;
  text-decoration: none;
}

header h1 a:hover {
  color: var(--accent);
}

header nav a {
  color: var(--muted);
  text-decoration: none;
  margin-left: 1rem;
  font-size: 0.95rem;
}

header nav a:hover {
  color: var(--accent);
}

main {
  max-width: 900px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

main h2 {
  margin-top: 0;
  font-size: 2rem;
  letter-spacing: -0.01em;
}

main p {
  color: var(--muted);
  font-size: 1.05rem;
}

.question {
  margin: 0 0 2.5rem;
  padding: 1.75rem 2rem;
  background: #fff;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 4px;
}

.question .lede {
  margin: 0;
  color: var(--fg);
  font-size: 1.15rem;
}

.question .eq-line {
  position: relative;
  text-align: center;
  margin: 0.8rem 0 1.2rem;
}

.question .eq-line:last-child {
  margin-bottom: 0;
}

.question .eq {
  font-family: "Cambria Math", Cambria, Georgia, serif;
  font-size: 1.25rem;
  color: var(--fg);
}

.question .eq-label {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.95rem;
  color: var(--muted);
}

@media (max-width: 640px) {
  .question {
    padding: 1.25rem 1rem;
  }

  .question .eq-line {
    position: static;
  }

  .question .eq {
    display: block;
    font-size: 1.05rem;
    word-break: break-word;
  }

  .question .eq-label {
    position: static;
    transform: none;
    display: block;
    text-align: center;
    margin-top: 0.35rem;
  }
}

.question .eq-label a {
  color: var(--accent);
  text-decoration: none;
}

.question .eq-label a:hover {
  text-decoration: underline;
}

footer {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  color: var(--muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  text-align: center;
}

.size-list {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.5rem 1rem;
}

.size-list a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.size-list a:hover {
  text-decoration: underline;
}

.size-list .count {
  color: var(--muted);
  font-size: 0.9rem;
}

.thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.thumb {
  display: block;
  line-height: 0;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #fff;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.thumb:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.thumb img {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.magma-image-wrap {
  margin: 1.5rem 0;
  display: flex;
  justify-content: center;
}

.magma-image {
  max-width: 100%;
  width: 512px;
  height: auto;
  aspect-ratio: 1 / 1;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  border: 1px solid var(--border);
  background: #fff;
}

.magma-meta {
  display: grid;
  grid-template-columns: max-content 1fr;
  column-gap: 1.25rem;
  row-gap: 0.35rem;
  margin: 1rem 0;
}

.magma-meta dt {
  font-weight: 600;
  color: var(--fg);
}

.magma-meta dd {
  margin: 0;
  color: var(--muted);
}

.magma-meta dd.muted {
  color: var(--muted);
}

.magma-meta code {
  font-size: 0.9rem;
  word-break: break-all;
}

@media (max-width: 520px) {
  .magma-meta {
    grid-template-columns: 1fr;
    row-gap: 0.1rem;
  }
  .magma-meta dt {
    margin-top: 0.5rem;
  }
}

.browse-cta {
  margin: 1.75rem 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.browse-cta a {
  color: var(--accent);
  text-decoration: none;
}

.browse-cta a:hover {
  text-decoration: underline;
}

.landing-samples {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin: 1rem 0 0.5rem;
}

.landing-samples-caption {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 2rem;
}

@media (max-width: 480px) {
  .landing-samples {
    grid-template-columns: repeat(2, 1fr);
  }
}

.submit {
  margin-top: 3rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--border);
}

.submit h2 {
  margin-top: 0;
  font-size: 1.3rem;
}

.submit-help {
  color: var(--muted);
  font-size: 0.95rem;
  margin-top: 0.25rem;
}

.submit textarea {
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.95rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  resize: vertical;
  box-sizing: border-box;
  line-height: 1.4;
}

.submit textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: transparent;
}

.submit-row {
  margin-top: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
}

.submit-row label {
  flex: 1 1 280px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.submit-row input[type="text"] {
  flex: 1;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  font-size: 0.95rem;
  min-width: 0;
}

.submit-row button {
  padding: 0.5rem 1.2rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
}

.submit-row button:hover {
  filter: brightness(1.08);
}

.submit-result {
  padding: 1rem 1.25rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: #fff;
  margin: 1rem 0;
}

.submit-result.submit-accepted {
  border-left: 4px solid #2a9d48;
}

.submit-result.submit-rejected {
  border-left: 4px solid #c0392b;
}

.submit-result.submit-error {
  border-left: 4px solid #b07a00;
}

.submit-result p {
  margin: 0.35rem 0;
}

.witness {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9rem;
  color: var(--muted);
}
