:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #eaf1fb;
  --text: #162033;
  --muted: #627087;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --accent: #0f8f83;
  --accent-dark: #0b756c;
  --success: #16805d;
  --danger: #bc3b51;
  --border: #d7e0ec;
  --shadow: 0 18px 50px rgba(29, 52, 89, 0.1);
  --page-glow: #dcecff;
  --header-bg: rgba(244, 247, 251, 0.9);
  --hero-start: #ffffff;
  --hero-end: #e9f2ff;
  --input-bg: #ffffff;
  --focus: #0f8f83;
  --success-soft: #e8f7f1;
  --error-soft: #fff0f2;
  --error-text: #902c3b;
  --radius: 20px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1422;
  --surface: #151f30;
  --surface-soft: #1d2b40;
  --text: #edf4ff;
  --muted: #a8b5c8;
  --primary: #6fa0ff;
  --primary-dark: #4e83ef;
  --accent: #43c6b5;
  --accent-dark: #2fa594;
  --success: #49c493;
  --danger: #ff8294;
  --border: #2c3a50;
  --shadow: 0 18px 55px rgba(0, 0, 0, 0.28);
  --page-glow: #152d4d;
  --header-bg: rgba(13, 20, 34, 0.9);
  --hero-start: #172338;
  --hero-end: #132b46;
  --input-bg: #101a2a;
  --focus: #65d7c9;
  --success-soft: #17392f;
  --error-soft: #3b2028;
  --error-text: #ffb5c0;
}

* {
  box-sizing: border-box;
}
html {
  color-scheme: light;
  scroll-behavior: smooth;
}
body {
  margin: 0;
  min-width: 280px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 95% 0%, var(--page-glow) 0, transparent 28rem),
    var(--bg);
  color: var(--text);
  font:
    16px/1.55 system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  transition:
    background-color 0.2s ease,
    color 0.2s ease;
}
button,
input,
textarea {
  font: inherit;
}
button {
  color: inherit;
}
h1,
h2,
p {
  margin-top: 0;
}
h1 {
  margin-bottom: 0.7rem;
  font-size: clamp(2rem, 5vw, 3.8rem);
  line-height: 1.08;
  letter-spacing: -0.045em;
}
h2 {
  margin-bottom: 0.55rem;
  line-height: 1.25;
}
p {
  color: var(--muted);
}
code,
kbd {
  padding: 0.1rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-soft);
}
button,
label,
input,
textarea {
  -webkit-tap-highlight-color: transparent;
}
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
[hidden] {
  display: none !important;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 0.5rem;
  left: 0.5rem;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  background: var(--text);
  color: white;
  transform: translateY(-150%);
}
.skip-link:focus {
  transform: none;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 70px;
  padding: 0.75rem clamp(1rem, 4vw, 3rem);
  border-bottom: 1px solid var(--border);
  background: var(--header-bg);
  backdrop-filter: blur(14px);
}
.brand {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  border: 0;
  background: transparent;
  font-size: 1.15rem;
  font-weight: 800;
  cursor: pointer;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 11px 11px 11px 3px;
  background: var(--primary);
  color: white;
}
.header-actions {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}
.set-summary {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.65rem;
  color: var(--muted);
  font-size: 0.9rem;
}
#header-set-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.count-badge {
  flex: 0 0 auto;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--primary-dark);
  font-weight: 700;
}
.theme-toggle {
  position: relative;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-size: 1.15rem;
  cursor: pointer;
  transition:
    background 0.16s ease,
    transform 0.16s ease;
}
.theme-toggle:hover {
  background: var(--surface-soft);
  transform: translateY(-1px);
}
.theme-toggle span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
}
.theme-toggle .moon-icon,
:root[data-theme="dark"] .theme-toggle .sun-icon {
  opacity: 0;
  transform: rotate(-30deg) scale(0.65);
}
:root[data-theme="dark"] .theme-toggle .moon-icon {
  opacity: 1;
  transform: none;
}
.palette-toggle {
  color: var(--primary);
}

.app-shell {
  width: min(1180px, calc(100% - 2rem));
  min-height: calc(100vh - 150px);
  margin: 0 auto;
  padding: clamp(2rem, 6vw, 5rem) 0;
}
.app-shell:focus {
  outline: none;
}
.screen {
  animation: screen-in 0.22s ease-out;
}
.screen.narrow {
  width: min(720px, 100%);
  margin-inline: auto;
}
.panel {
  border: 1px solid rgba(222, 219, 233, 0.85);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.eyebrow {
  margin-bottom: 0.55rem;
  color: var(--primary);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 0.9rem;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(240px, 0.65fr);
  gap: clamp(2rem, 5vw, 5rem);
  align-items: center;
  overflow: hidden;
  padding: clamp(2rem, 6vw, 5rem);
  background: linear-gradient(135deg, var(--hero-start) 20%, var(--hero-end));
}
.hero-copy {
  max-width: 630px;
  font-size: 1.08rem;
}
.hero-art {
  position: relative;
  height: 290px;
}
.mini-card {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: min(280px, 90%);
  height: 190px;
  padding: 1rem;
  border-radius: 22px;
  box-shadow: 0 25px 45px rgba(68, 54, 150, 0.18);
  text-align: center;
  font-size: 1.65rem;
  font-weight: 800;
}
.mini-card span {
  margin-top: 0.8rem;
  font-size: 0.88rem;
  font-weight: 500;
  opacity: 0.75;
}
.card-backdrop {
  top: 10px;
  right: 0;
  background: #c8e1ff;
  color: #245792;
  transform: rotate(9deg);
}
.card-front {
  right: 20px;
  bottom: 10px;
  background: var(--primary);
  color: white;
  transform: rotate(-4deg);
}
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}
.button-row.end {
  justify-content: flex-end;
}
.button {
  min-height: 44px;
  padding: 0.7rem 1rem;
  border: 1px solid transparent;
  border-radius: 11px;
  font-weight: 750;
  cursor: pointer;
  transition:
    transform 0.16s ease,
    background 0.16s ease,
    box-shadow 0.16s ease;
}
.button:hover:not(:disabled) {
  transform: translateY(-1px);
}
.button:disabled,
.text-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.button.primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 8px 20px rgba(91, 75, 196, 0.2);
}
.button.primary:hover:not(:disabled) {
  background: var(--primary-dark);
}
.button.accent {
  background: var(--accent);
  color: white;
}
.button.accent:hover:not(:disabled) {
  background: var(--accent-dark);
}
.button.secondary {
  border-color: var(--border);
  background: var(--surface);
}
.button.secondary:hover:not(:disabled),
.button.ghost:hover:not(:disabled) {
  background: var(--surface-soft);
}
.button.ghost {
  background: transparent;
}
.button.success {
  background: var(--success);
  color: white;
}
.button.danger {
  background: var(--danger);
  color: white;
}
.button.danger-ghost {
  border-color: #eed3d8;
  background: transparent;
  color: var(--danger);
}
.button.wide {
  width: 100%;
  margin-top: 0.75rem;
}
.text-button {
  padding: 0.35rem 0;
  border: 0;
  background: transparent;
  color: var(--primary);
  font-weight: 800;
  cursor: pointer;
  text-align: left;
}
.text-button.centered {
  display: block;
  margin: 1.25rem auto 0;
}
.active-panel {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  justify-content: space-between;
  margin-top: 1.5rem;
  padding: 1.5rem 1.75rem;
}
.active-panel h2,
.active-panel p {
  margin-bottom: 0.25rem;
}
.mode-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 1rem;
}
.mode-card {
  padding: 1.5rem;
  box-shadow: none;
}
.mode-card p {
  min-height: 4.7em;
}
.mode-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 1rem;
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--primary);
  font-weight: 800;
}

.screen-heading {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.screen-heading h1 {
  font-size: clamp(2rem, 4vw, 3.1rem);
}
.screen-heading p:last-child {
  margin-bottom: 0;
}
.builder-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.75fr) minmax(0, 1.25fr);
  gap: 1.25rem;
  align-items: start;
}
.editor-panel,
.cards-panel,
.setup-panel,
.import-panel {
  padding: clamp(1.25rem, 4vw, 2rem);
}
.editor-panel {
  position: sticky;
  top: 90px;
}
label,
legend {
  font-weight: 750;
}
input:not([type="radio"]):not([type="file"]),
textarea {
  width: 100%;
  margin: 0.4rem 0 1rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--input-bg);
  color: var(--text);
}
textarea {
  resize: vertical;
  min-height: 125px;
}
input:focus,
textarea:focus {
  border-color: var(--primary);
}
hr {
  margin: 0.6rem 0 1.5rem;
  border: 0;
  border-top: 1px solid var(--border);
}
.shortcut-hint {
  margin-top: -0.4rem;
  font-size: 0.8rem;
}
.panel-title {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.panel-title h2,
.panel-title p {
  margin-bottom: 0.15rem;
}
.card-list {
  display: grid;
  gap: 0.8rem;
}
.empty-state {
  padding: 3rem 1rem;
  border: 2px dashed var(--border);
  border-radius: 14px;
  text-align: center;
  color: var(--muted);
}
.builder-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.9rem;
  align-items: start;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 14px;
}
.card-number {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--surface-soft);
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 800;
}
.card-content {
  min-width: 0;
}
.card-content strong,
.card-content p {
  overflow-wrap: anywhere;
}
.card-content p {
  margin: 0.25rem 0 0;
  white-space: pre-wrap;
}
.card-actions {
  display: flex;
  gap: 0.25rem;
}
.icon-button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
}
.icon-button:hover:not(:disabled) {
  background: var(--surface-soft);
}
.icon-button.delete {
  color: var(--danger);
}
.action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  align-items: center;
  margin-top: 1.25rem;
  padding: 1rem;
}
.action-spacer {
  flex: 1;
}
.message {
  margin-bottom: 1.25rem;
  padding: 0.8rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--text);
}
.message.compact {
  margin: 0 0 1rem;
}
.message.error {
  border-color: color-mix(in srgb, var(--danger) 45%, var(--border));
  background: var(--error-soft);
  color: var(--error-text);
}
.message.success {
  border-color: color-mix(in srgb, var(--success) 45%, var(--border));
  background: var(--success-soft);
  color: var(--success);
}

.drop-zone {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  align-items: center;
  padding: 3.5rem 1rem;
  border: 2px dashed var(--border);
  border-radius: 16px;
  background: var(--surface-soft);
  text-align: center;
  cursor: pointer;
}
.drop-zone.dragging {
  border-color: var(--primary);
  background: var(--surface-soft);
}
.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.upload-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: var(--primary);
  color: white;
  font-size: 1.5rem;
}
.fake-button {
  margin-top: 0.75rem;
}
.import-panel > .message {
  margin-top: 1rem;
}

fieldset {
  display: grid;
  gap: 0.7rem;
  margin: 0 0 1.5rem;
  padding: 0;
  border: 0;
}
legend {
  margin-bottom: 0.75rem;
  font-size: 1.05rem;
}
.choice-card {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
}
.choice-card:has(input:checked) {
  border-color: var(--primary);
  background: var(--surface-soft);
  box-shadow: inset 0 0 0 1px var(--primary);
}
.choice-card input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}
.choice-card span {
  display: flex;
  flex-direction: column;
}
.choice-card small {
  color: var(--muted);
  font-weight: 500;
}
.pair-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 0.6rem;
}
.pair-option {
  position: relative;
  text-align: center;
}
.pair-option input {
  position: absolute;
  opacity: 0;
}
.pair-option span {
  display: block;
  padding: 0.85rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.pair-option input:checked + span {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 13%, var(--surface));
  box-shadow: inset 0 0 0 1px var(--accent);
}

.study-screen {
  width: min(900px, 100%);
  margin-inline: auto;
}
.study-topbar {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1.25rem;
  text-align: center;
}
.study-topbar > :first-child {
  justify-self: start;
}
.study-topbar > :last-child {
  justify-self: end;
}
.progress-track {
  height: 5px;
  margin-top: 0.45rem;
  overflow: hidden;
  border-radius: 999px;
  background: var(--border);
}
.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--primary);
  transition: width 0.2s ease;
}
.flashcard {
  display: block;
  width: 100%;
  height: min(470px, 58vh);
  min-height: 320px;
  padding: 0;
  border: 0;
  border-radius: 24px;
  background: transparent;
  perspective: 1300px;
  cursor: pointer;
}
.flashcard-inner {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  box-shadow: var(--shadow);
  transform-style: preserve-3d;
  transition: transform 0.45s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.flashcard.revealed .flashcard-inner {
  transform: rotateY(180deg);
}
.flash-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: clamp(2rem, 7vw, 5rem);
  border: 1px solid var(--border);
  border-radius: inherit;
  background: linear-gradient(145deg, var(--surface), var(--hero-end));
  backface-visibility: hidden;
}
.flash-back {
  background: linear-gradient(145deg, #1857c9, #2773e8);
  color: white;
  transform: rotateY(180deg);
}
.side-label {
  position: absolute;
  top: 1.5rem;
  left: 1.5rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--primary);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.flash-back .side-label {
  background: rgba(255, 255, 255, 0.14);
  color: white;
}
.flash-text {
  max-width: 100%;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  font-size: clamp(1.45rem, 4vw, 2.8rem);
  font-weight: 750;
  line-height: 1.3;
}
.tap-hint {
  position: absolute;
  bottom: 1.5rem;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
}
.assessment {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: center;
  min-height: 72px;
}
.assessment > span {
  color: var(--muted);
  font-size: 0.9rem;
}
.study-controls {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr;
  gap: 0.7rem;
  margin-top: 0.5rem;
}

.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.game-stats {
  display: flex;
  gap: clamp(0.8rem, 4vw, 2.5rem);
}
.game-stats div {
  display: flex;
  flex-direction: column;
  min-width: 55px;
  text-align: center;
}
.game-stats span {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
}
.game-stats strong {
  font-size: 1.15rem;
}
.matching-grid {
  display: grid;
  grid-template-columns: repeat(var(--match-columns, 4), minmax(0, 1fr));
  gap: clamp(0.45rem, 1.3vw, 0.8rem);
}
.match-tile {
  position: relative;
  min-width: 0;
  min-height: clamp(105px, 15vw, 165px);
  padding: 0.65rem;
  overflow: hidden;
  border: 2px solid #ddd9ed;
  border-radius: 14px;
  background: var(--primary);
  color: transparent;
  cursor: pointer;
  transition:
    transform 0.15s ease,
    background 0.2s ease,
    border-color 0.2s ease;
}
.match-tile::before {
  content: "?";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.8);
  font-size: 1.6rem;
  font-weight: 800;
}
.match-tile:hover:not(:disabled) {
  transform: translateY(-2px);
  background: var(--primary-dark);
}
.match-tile .tile-type,
.match-tile .tile-text {
  visibility: hidden;
}
.match-tile.revealed,
.match-tile.matched {
  background: var(--surface);
  color: var(--text);
}
.match-tile.revealed::before,
.match-tile.matched::before {
  display: none;
}
.match-tile.revealed .tile-type,
.match-tile.revealed .tile-text,
.match-tile.matched .tile-type,
.match-tile.matched .tile-text {
  visibility: visible;
}
.match-tile.matched {
  border-color: var(--success);
  background: var(--success-soft);
  cursor: default;
}
.match-tile.matched::after {
  content: "✓";
  position: absolute;
  top: 0.4rem;
  right: 0.5rem;
  color: var(--success);
  font-weight: 900;
}
.tile-type {
  display: block;
  margin-bottom: 0.45rem;
  color: var(--primary);
  font-size: 0.64rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.tile-text {
  display: -webkit-box;
  overflow: hidden;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
  font-size: clamp(0.72rem, 1.5vw, 0.95rem);
  font-weight: 700;
  line-height: 1.28;
}

.results-panel {
  padding: clamp(2rem, 7vw, 4rem);
  text-align: center;
}
.results-panel h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
}
.result-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin: 0 auto 1.2rem;
  border-radius: 50%;
  background: var(--surface-soft);
  color: var(--primary);
  font-size: 1.8rem;
  font-weight: 900;
}
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 2rem 0;
}
.stats-grid div {
  display: flex;
  flex-direction: column;
  padding: 1.2rem;
  border-radius: 14px;
  background: var(--surface-soft);
}
.stats-grid strong {
  font-size: 2rem;
}
.stats-grid span {
  color: var(--muted);
}
.button-stack {
  display: grid;
  gap: 0.65rem;
  width: min(360px, 100%);
  margin-inline: auto;
}
dialog {
  width: min(460px, calc(100% - 2rem));
  padding: 0;
  border: 0;
  border-radius: 18px;
  box-shadow: 0 30px 90px rgba(25, 20, 55, 0.3);
}
dialog::backdrop {
  background: rgba(25, 20, 45, 0.45);
  backdrop-filter: blur(3px);
}
.dialog-card {
  padding: 1.6rem;
}
.palette-dialog-card {
  width: min(520px, 100%);
}
.dialog-heading {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.dialog-heading h2,
.dialog-heading p {
  margin-bottom: 0;
}
.palette-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
}
.palette-option {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  align-items: flex-start;
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.palette-option:hover {
  background: var(--surface-soft);
}
.palette-option[aria-pressed="true"] {
  border-color: var(--primary);
  box-shadow: inset 0 0 0 1px var(--primary);
}
.palette-option > span:nth-child(2) {
  display: flex;
  flex-direction: column;
}
.palette-option small {
  color: var(--muted);
}
.palette-option b {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  display: none;
  color: var(--primary);
}
.palette-option[aria-pressed="true"] b {
  display: block;
}
.palette-swatches {
  display: flex;
  padding-right: 1.5rem;
}
.palette-swatches i {
  width: 25px;
  height: 25px;
  margin-left: -4px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--swatch);
}
.palette-swatches i:first-child {
  margin-left: 0;
}
footer {
  display: flex;
  justify-content: space-between;
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.5rem 0 2rem;
  color: var(--muted);
  font-size: 0.8rem;
}

@keyframes screen-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}
@media (max-width: 820px) {
  .hero {
    grid-template-columns: 1fr;
  }
  .hero-art {
    display: none;
  }
  .mode-grid {
    grid-template-columns: 1fr;
  }
  .mode-card p {
    min-height: auto;
  }
  .builder-grid {
    grid-template-columns: 1fr;
  }
  .editor-panel {
    position: static;
  }
  .active-panel {
    align-items: flex-start;
    flex-direction: column;
  }
  .matching-grid {
    --match-columns: 3 !important;
  }
}
@media (max-width: 540px) {
  .site-header {
    min-height: 62px;
  }
  .brand > span:last-child {
    display: none;
  }
  .header-actions {
    max-width: calc(100% - 55px);
  }
  #header-set-title {
    display: none;
  }
  .count-badge {
    display: none;
  }
  .app-shell {
    width: min(100% - 1rem, 1180px);
    padding: 1.5rem 0 3rem;
  }
  .hero {
    padding: 1.5rem;
  }
  .screen-heading {
    align-items: flex-start;
  }
  .screen-heading h1 {
    font-size: 2rem;
  }
  .screen-heading .button {
    padding-inline: 0.7rem;
  }
  .builder-card {
    grid-template-columns: auto minmax(0, 1fr);
  }
  .card-actions {
    grid-column: 2;
    flex-wrap: wrap;
  }
  .action-spacer {
    display: none;
  }
  .action-bar .button {
    width: 100%;
  }
  .study-topbar {
    grid-template-columns: auto 1fr auto;
    gap: 0.4rem;
  }
  .study-topbar .button {
    padding-inline: 0.6rem;
    font-size: 0.85rem;
  }
  .flashcard {
    min-height: 300px;
    height: 52vh;
  }
  .flash-face {
    padding: 3.5rem 1.3rem;
  }
  .assessment {
    align-items: stretch;
    flex-direction: column;
    padding: 0.65rem 0;
    text-align: center;
  }
  .assessment .button-row {
    flex-wrap: nowrap;
  }
  .assessment .button {
    flex: 1;
  }
  .study-controls {
    gap: 0.4rem;
  }
  .study-controls .button {
    padding: 0.6rem 0.35rem;
    font-size: 0.84rem;
  }
  .game-header {
    gap: 0.5rem;
    align-items: flex-start;
  }
  .game-header > .button {
    padding-inline: 0.6rem;
  }
  .game-stats {
    gap: 0.5rem;
  }
  .matching-grid {
    --match-columns: 2 !important;
  }
  .match-tile {
    min-height: 112px;
  }
  footer {
    flex-direction: column;
    gap: 0.25rem;
  }
  .palette-options {
    grid-template-columns: 1fr;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
