:root {
  color-scheme: dark;
  --bg: #14110d;
  --bg-2: #1d1913;
  --ink: #f4ead7;
  --muted: #b3a48c;
  --line: rgba(244, 234, 215, 0.12);
  --gold: #e2b441;
  --gold-2: #f0d27a;
  --danger: #e07a5f;
  --ok: #8fbf7a;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Segoe UI", "Helvetica Neue", system-ui, sans-serif;
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(226, 180, 65, 0.12), transparent 55%),
    radial-gradient(800px 400px at 100% 0%, rgba(90, 60, 20, 0.35), transparent 50%),
    var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

.grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
  opacity: 0.08;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
  z-index: 0;
}

.top,
main,
footer {
  position: relative;
  z-index: 1;
  width: min(680px, calc(100% - 2.4rem));
  margin-inline: auto;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.4rem 0 0.4rem;
}

.mark {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--gold-2);
  text-decoration: none;
  font-weight: 650;
  letter-spacing: 0.01em;
}

html[data-i18n-pending] body {
  visibility: hidden;
}

.langs {
  display: flex;
  align-items: center;
  gap: 0.1rem;
}

.langs button {
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.32rem 0.55rem;
  font-weight: 650;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  min-width: 2.35rem;
  width: auto;
  margin: 0;
}

.langs button:hover {
  color: var(--gold-2);
  background: rgba(226, 180, 65, 0.12);
}

.langs button[aria-pressed="true"] {
  color: #1a1408;
  background: var(--gold);
}

.langs button[aria-pressed="true"]:hover {
  background: var(--gold-2);
  color: #1a1408;
}

h1 {
  font-family: Georgia, "Iowan Old Style", Palatino, serif;
  font-weight: 600;
  font-size: clamp(1.8rem, 4vw, 2.45rem);
  line-height: 1.15;
  margin: 1.6rem 0 0.8rem;
}

.lead,
.hint,
.fine,
footer p,
.notes li {
  color: var(--muted);
}

.lead {
  margin: 0 0 1.6rem;
  font-size: 1.05rem;
}

code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.9em;
  color: var(--gold-2);
}

form label {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 0.4rem;
  color: var(--muted);
}

.row {
  display: flex;
  gap: 0.6rem;
}

input,
button,
.download {
  font: inherit;
}

input {
  flex: 1;
  min-width: 0;
  background: var(--bg-2);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.85rem 1.1rem;
  outline: none;
}

input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(226, 180, 65, 0.18);
}

button,
.download {
  border: 0;
  border-radius: 999px;
  background: var(--gold);
  color: #1a1408;
  font-weight: 700;
  padding: 0.85rem 1.2rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

button:hover,
.download:hover {
  background: var(--gold-2);
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.download-secondary {
  background: transparent;
  color: var(--gold-2);
  border: 1px solid var(--gold);
}

.download-secondary:hover {
  background: rgba(226, 180, 65, 0.14);
}

button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.hint {
  margin: 0.45rem 0 0;
  font-size: 0.85rem;
}

.status {
  min-height: 1.4rem;
  margin: 1rem 0;
}

.status.error {
  color: var(--danger);
}

.status.busy {
  color: var(--gold-2);
}

.card {
  background: rgba(29, 25, 19, 0.86);
  border: 1px solid var(--line);
  border-radius: 1.1rem;
  padding: 1.2rem 1.3rem 1.3rem;
  margin-bottom: 1.8rem;
}

.kicker {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  color: var(--gold);
}

.card h2 {
  margin: 0.2rem 0 0.9rem;
  font-size: 1.45rem;
  font-family: Georgia, Palatino, serif;
}

.download {
  width: 100%;
  flex-direction: column;
  gap: 0.18rem;
  text-align: center;
  line-height: 1.2;
  padding: 0.9rem 1rem;
}

.download-sub {
  font-size: 0.75rem;
  font-weight: 550;
  opacity: 0.82;
}

.fine {
  margin: 0.8rem 0 0;
  font-size: 0.85rem;
}

.notes {
  border-top: 1px solid var(--line);
  padding-top: 1.2rem;
  margin-bottom: 2rem;
}

.notes h2 {
  font-size: 1rem;
  margin: 0 0 0.5rem;
}

.notes ul {
  padding-left: 1.1rem;
  margin: 0;
}

.notes li + li {
  margin-top: 0.45rem;
}

footer {
  padding-bottom: 2.2rem;
  font-size: 0.85rem;
}

@media (max-width: 640px) {
  .row,
  .actions {
    display: block;
  }

  .row button,
  .download {
    width: 100%;
    margin-top: 0.55rem;
  }

  .langs button {
    width: auto;
    margin: 0;
  }
}
