:root {
  color-scheme: dark;
  /* Palette adapted from Spacemacs (GPL-3.0). */
  --bg: #292b2e;
  --bg-alt: #212026;
  --bg-alt-2: #100a14;
  --bg-alt-3: #0a0814;
  --panel: #222226;
  --fg: #b2b2b2;
  --fg-bright: #e3dedd;
  --muted: #686868;
  --border: #5d4d7a;
  --highlight-dim: #3b314d;
  --blue: #4f97d7;
  --green: #67b11d;
  --success: #86dc2f;
  --green-bg: #293235;
  --yellow: #EEAD0E;
  --red: #f2241f;
  --red-bg: #3c2a2c;
  --func: #bc6ec5;
  --shadow: 0 24px 80px rgba(10, 8, 20, 0.42);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top, rgba(93, 77, 122, 0.28), transparent 36rem),
    var(--bg);
  color: var(--fg);
}

button,
input,
select {
  font: inherit;
}

button,
summary,
input,
select {
  border-radius: 0.55rem;
}

button,
summary {
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--fg-bright);
  cursor: pointer;
  padding: 0.72rem 0.95rem;
  transition: border-color 120ms ease, color 120ms ease, background 120ms ease, transform 120ms ease;
}

button:hover,
button.keyboard-pressed,
summary:hover {
  border-color: var(--blue);
  color: var(--fg-bright);
  background: var(--highlight-dim);
}

button:focus-visible {
  border-color: var(--blue);
  outline: 3px solid var(--blue);
  outline-offset: 0;
}

button:active,
button.keyboard-pressed,
summary:active {
  transform: translateY(1px);
}

button.primary {
  background: var(--yellow);
  border-color: var(--yellow);
  color: var(--bg-alt-3);
  font-weight: 800;
}

button.primary:hover {
  background: var(--blue);
  border-color: var(--blue);
  color: var(--bg-alt-3);
}

button.primary:focus-visible {
  background: var(--yellow);
  border-color: var(--blue);
  color: var(--bg-alt-3);
}

input,
select {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--bg-alt-2);
  color: var(--fg-bright);
  padding: 0.78rem 0.85rem;
  outline: none;
}

input:focus,
select:focus,
summary:focus-visible {
  border-color: var(--blue);
  outline: 3px solid var(--blue);
  outline-offset: 0;
  box-shadow: none;
}

kbd {
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 0.35rem;
  padding: 0.05rem 0.35rem;
  color: var(--yellow);
  background: var(--bg-alt-2);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  color: var(--fg-bright);
  font-size: 1em;
  letter-spacing: -0.075em;
  line-height: 0.85;
}

.brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  gap: 0.12em;
  max-width: 100%;
  font-size: min(17vw, 7rem);
}

.brand-icon {
  position: relative;
  left: 0.0625em;
  top: 0.125em;
  width: auto;
  height: 0.72em;
  flex: 0 0 auto;
  margin-right: -0.0625em;
}

.brand-title {
  /* Anchor the subtitle on the dot of the “i” in coniugare. */
  --tagline-x: 11.5825em;
  --tagline-y: 1em;
  position: relative;
  display: inline-block;
  font-size: 1em;
}

.tagline {
  position: absolute;
  left: var(--tagline-x);
  top: var(--tagline-y);
  color: var(--yellow);
  font-size: 0.135em;
  line-height: 1;
  text-transform: lowercase;
  white-space: nowrap;
}

.tagline span {
  position: absolute;
  top: 0;
  font-size: 1em;
  font-weight: 800;
  letter-spacing: 0.08em;
  transform: translateY(-50%);
}

.tagline-before {
  right: 0.587em;
}

.tagline-after {
  left: 1.125em;
}

@supports (-moz-appearance: none) {
  .brand-title {
    --tagline-y: 1.125em;
  }
}

h2 {
  color: var(--fg-bright);
  font-size: clamp(1.55rem, 4vw, 2.4rem);
  letter-spacing: -0.04em;
}

.muted {
  color: var(--muted);
}

.app-shell {
  width: min(1040px, calc(100% - 2rem));
  min-height: 100vh;
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 3rem) 0;
  display: grid;
  align-content: center;
  gap: 1.2rem;
}

.hero {
  position: relative;
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 0.75rem;
}

.picker-bar {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.7rem;
  width: 100%;
  margin-top: 1rem;
}

.picker {
  position: relative;
}

.picker summary {
  min-width: 12rem;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  user-select: none;
}

.picker summary::-webkit-details-marker {
  display: none;
}

.picker summary::after {
  content: "↓";
  color: var(--func);
  font-weight: 900;
}

.picker[open] summary {
  border-color: var(--blue);
  background: var(--highlight-dim);
}

.picker[open] summary::after {
  content: "↑";
}

.picker summary strong {
  color: var(--yellow);
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

.picker-menu {
  position: absolute;
  top: calc(100% + 0.55rem);
  left: 50%;
  transform: translateX(-50%);
  width: min(28rem, calc(100vw - 2rem));
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 0.85rem;
  background: color-mix(in srgb, var(--bg-alt) 96%, transparent);
  box-shadow: var(--shadow);
  text-align: left;
}

.search {
  margin-bottom: 0.65rem;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(5rem, 1fr));
  gap: 0.55rem;
  margin-bottom: 0.65rem;
}

.quick-actions button[aria-pressed="true"] {
  border-color: var(--green);
  background: var(--green-bg);
  color: var(--success);
}

.filter-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
}

.filter-button::before {
  content: "";
  width: 0.9em;
  height: 0.9em;
  background: currentColor;
  clip-path: polygon(8% 12%, 92% 12%, 58% 52%, 58% 88%, 42% 88%, 42% 52%);
}

.choice-list {
  display: grid;
  gap: 0.42rem;
  max-height: min(22rem, 45vh);
  overflow: auto;
  padding-right: 0.25rem;
}

.done-button {
  width: 100%;
  margin-top: 0.7rem;
}

.choice {
  position: relative;
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.7rem;
  align-items: center;
  text-align: left;
  padding: 0.65rem 0.7rem;
}

.choice:focus-visible {
  z-index: 1;
  outline-offset: -3px;
}

.choice[aria-selected="true"] {
  border-color: var(--green);
  background: var(--green-bg);
}

.checkmark {
  width: 1.05rem;
  height: 1.05rem;
  display: grid;
  place-items: center;
  border: 1px solid var(--muted);
  border-radius: 0.28rem;
  color: var(--bg-alt-3);
  font-size: 0.8rem;
}

.choice[aria-selected="true"] .checkmark {
  background: var(--success);
  border-color: var(--success);
}

.choice-title,
.choice-subtitle {
  display: block;
}

.choice-title {
  color: var(--fg-bright);
  font-weight: 800;
}

.choice-subtitle {
  color: var(--muted);
  font-size: 0.88rem;
}

.quiz-panel {
  position: relative;
  z-index: 1;
  background: color-mix(in srgb, var(--bg-alt) 92%, transparent);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: 1rem;
  padding: clamp(1rem, 3vw, 1.6rem);
  display: grid;
  gap: 1rem;
}

.quiz-toolbar,
.result-bar,
.toolbar-actions,
.round-actions,
.answer-row {
  display: flex;
  gap: 0.85rem;
}

.quiz-toolbar,
.result-bar {
  align-items: flex-start;
  justify-content: space-between;
}

.toolbar-actions {
  align-items: end;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.round-actions {
  align-items: center;
  justify-content: flex-end;
}

.icon-button {
  width: 3rem;
  height: 3rem;
  display: inline-grid;
  place-items: center;
  padding: 0;
  font-size: 1.35rem;
  line-height: 1;
}

.prompt-toggle {
  --prompt-gap: 0.95rem;
  min-height: calc(1em + 1.44rem + 6px);
  display: flex;
  align-items: center;
  gap: var(--prompt-gap);
  border: 1px solid var(--border);
  border-radius: 0.55rem;
  background: var(--panel);
  padding: 0 var(--prompt-gap);
}

.prompt-toggle button {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: var(--muted);
  margin: 0;
  padding: 0;
  font-size: 0.82rem;
  font-weight: 800;
}

.prompt-toggle button:hover,
.prompt-toggle button:focus-visible {
  color: var(--fg-bright);
  background: transparent;
}

.prompt-toggle button.selected {
  background: transparent;
  color: var(--yellow);
}

.prompt-toggle button.selected:hover,
.prompt-toggle button.selected:focus-visible {
  background: transparent;
  color: var(--yellow);
}

.answer-grid {
  display: grid;
  gap: 0.58rem;
}

.answer-row {
  display: grid;
  grid-template-columns: minmax(11rem, 1fr) minmax(7rem, 14rem) minmax(18rem, 34rem);
  align-items: center;
  column-gap: 1rem;
  row-gap: 0.25rem;
  border: 1px solid var(--border);
  background: var(--bg-alt-2);
  border-radius: 0.75rem;
  padding: 0.62rem;
}

.pronoun {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  min-width: 0;
  padding-left: 1rem;
  white-space: nowrap;
  text-align: left;
}

.pronoun strong {
  color: var(--func);
  font-size: clamp(1.45rem, 2.4vw, 2rem);
}

.pronoun .muted {
  font-size: clamp(1rem, 1.6vw, 1.25rem);
}

.answer-input {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  width: min(100%, 34rem);
  font-size: clamp(1.05rem, 2vw, 1.55rem);
  letter-spacing: 0.01em;
  text-align: left;
}

.feedback {
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
  text-align: right;
}

.feedback:empty {
  display: none;
}

.answer-row.correct {
  border-color: var(--success);
  background: var(--green-bg);
}

.answer-row.correct .feedback {
  color: var(--success);
}

.answer-row.incorrect {
  border-color: var(--red);
  background: var(--red-bg);
}

.answer-row.incorrect .feedback {
  color: var(--red);
}

.result-bar {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

.site-footer {
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem 0.9rem;
}

.site-footer a,
.legal-panel a {
  color: var(--muted);
  text-decoration: none;
}

.site-footer a:hover,
.site-footer a:focus-visible,
.legal-panel a:hover,
.legal-panel a:focus-visible {
  color: var(--yellow);
}

.legal-shell {
  align-content: start;
}

.legal-panel {
  display: grid;
  gap: 1rem;
  text-align: left;
}

.legal-panel h1 {
  font-size: clamp(2.4rem, 8vw, 5rem);
}

.legal-section {
  display: grid;
  gap: 0.4rem;
}

.legal-section p {
  color: var(--fg);
  line-height: 1.55;
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 1rem, 1040px);
    align-content: start;
  }

  .picker,
  .picker summary {
    width: 100%;
  }

  .picker-menu {
    width: 100%;
  }

  .quiz-toolbar,
  .result-bar,
  .toolbar-actions,
  .answer-row {
    flex-direction: column;
    align-items: stretch;
  }

  .round-actions {
    justify-content: flex-start;
  }

  .prompt-toggle {
    width: 100%;
  }

  .answer-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 52%);
    align-items: center;
  }

  .pronoun {
    grid-column: 1;
    grid-row: 1;
  }

  .answer-input {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
  }

  .feedback {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    width: auto;
    max-width: 100%;
    overflow: hidden;
    text-align: right;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #hintText {
    display: none;
  }

  .pronoun,
  .feedback {
    flex-basis: auto;
  }
}
