:root {
  --bg: #f4f7f5;
  --card: #fff;
  --ink: #202b29;
  --muted: #6d7b78;
  --line: #dce6e2;
  --accent: #506f66;
  --accent2: #78958c;
  --good: #26784c;
  --bad: #a23e3e;
  --gold: #edb43f;
  --learning: #d58c2f;
  --new: #bac6c2;
  --purple: #6c65c7;
  --purple-soft: #f0efff;
  --sky: #4c9cba;
  --shadow: 0 15px 35px rgba(38, 63, 56, .11);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: linear-gradient(#eef4f2, #fafcfb 55%, #fff);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button {
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: .55;
  transform: none;
}

button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(80, 111, 102, .24);
  outline-offset: 2px;
}

.wrap {
  max-width: 1040px;
  margin: auto;
  padding: 22px;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.logo {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: linear-gradient(145deg, var(--accent), var(--purple));
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 30px;
  font-weight: 900;
  box-shadow: var(--shadow);
}

h1 {
  margin: 0;
  font-size: clamp(26px, 4vw, 38px);
}

h2,
h3 {
  margin: 0;
}

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

.card {
  background: rgba(255, 255, 255, .96);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 22px;
  box-shadow: var(--shadow);
}

.controls {
  display: grid;
  grid-template-columns: 1fr 1.25fr .7fr auto;
  gap: 12px;
  align-items: end;
  margin-top: 20px;
}

.field label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

select,
input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.toggle {
  display: flex;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.toggle button {
  flex: 1;
  padding: 11px 9px;
  border: 0;
  background: #fff;
}

.toggle button.active {
  background: var(--accent);
  color: #fff;
}

.primary,
.secondary,
.good,
.bad {
  padding: 12px 16px;
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 750;
}

.compact {
  padding: 9px 12px;
}

.primary {
  background: var(--accent);
  color: #fff;
}

.secondary {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.good {
  border: 1px solid #b8dec6;
  background: #eaf7ef;
  color: var(--good);
}

.bad {
  border: 1px solid #e5bcbc;
  background: #fff0f0;
  color: var(--bad);
}

.progress-overview {
  margin-top: 22px;
  padding: 20px;
  border: 1px solid #dbe7e2;
  border-radius: 20px;
  background: linear-gradient(135deg, #f8fbfa, #fffdf7);
}

.progress-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}

.progress-heading h2 {
  margin: 3px 0;
  font-size: clamp(22px, 3.5vw, 30px);
}

.score-badge {
  min-width: 126px;
  padding: 12px 18px;
  border: 1px solid #ead8ab;
  border-radius: 18px;
  background: #fffaf0;
  text-align: center;
}

.score-badge strong {
  display: block;
  color: #835d0d;
  font-size: 31px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.score-badge span {
  color: #8c7546;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.overall-stars {
  display: flex;
  gap: 4px;
  margin: 13px 0 15px;
  font-size: 29px;
  line-height: 1;
}

.star {
  color: #d8dfdc;
  text-shadow: 0 1px 0 #fff;
}

.star.on {
  color: var(--gold);
  text-shadow: 0 1px 0 #a67716;
}

.mastery-bar {
  display: flex;
  width: 100%;
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7eeeb;
}

.mastery-bar span {
  display: block;
  height: 100%;
  transition: width .25s ease;
}

.mastery-known {
  background: #53a875;
}

.mastery-learning {
  background: #e7ad4c;
}

.mastery-new {
  background: var(--new);
}

.summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 16px;
}

.progress-summary {
  grid-template-columns: repeat(4, 1fr);
}

.stat {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, .75);
  text-align: center;
}

.stat-known {
  border-color: #c8e4d3;
  background: #f3fbf6;
}

.stat-learning {
  border-color: #efdbb7;
  background: #fffaf1;
}

.stat-new {
  background: #f7f9f8;
}

.stat b {
  display: block;
  font-size: 25px;
  font-variant-numeric: tabular-nums;
}

.progress-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 16px;
}

.progress-backup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.progress-hint {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.progress-message {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid #b8dec6;
  border-radius: 12px;
  background: #eaf7ef;
  color: var(--good);
  font-size: 13px;
}

.progress-message.error {
  border-color: #e5bcbc;
  background: #fff0f0;
  color: var(--bad);
}

.progress-details {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.progress-tools {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 12px;
}

.progress-tools h3 {
  margin-bottom: 3px;
}

.progress-filter {
  width: min(240px, 100%);
}

.progress-list {
  max-height: 560px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.progress-item {
  display: grid;
  grid-template-columns: minmax(210px, 1.5fr) 165px 145px auto;
  gap: 14px;
  align-items: center;
  min-height: 72px;
  padding: 11px 14px;
  border-bottom: 1px solid #e8eeeb;
}

.progress-item:last-child {
  border-bottom: 0;
}

.word-pair {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.word-pair b {
  overflow-wrap: anywhere;
  font-size: 17px;
}

.word-pair span {
  overflow-wrap: anywhere;
  font-size: 13px;
}

.word-mastery {
  display: flex;
  align-items: center;
  gap: 9px;
}

.mini-stars {
  display: flex;
  gap: 1px;
  font-size: 17px;
  line-height: 1;
  white-space: nowrap;
}

.word-percent,
.attempt-count {
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.word-percent {
  min-width: 38px;
  font-weight: 750;
}

.status {
  justify-self: end;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status-known {
  background: #e5f5eb;
  color: #246a43;
}

.status-learning {
  background: #fff3dd;
  color: #8c5b10;
}

.status-review {
  background: #fff0f0;
  color: #9a3838;
}

.status-new {
  background: #eef2f0;
  color: #64716d;
}

.study {
  display: none;
  margin-top: 18px;
}

.studyHead {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.bar {
  flex: 1;
  height: 11px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7efec;
}

.bar > div {
  width: 0;
  height: 100%;
  background: var(--accent);
}

.flash {
  min-height: 430px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.front {
  margin: 22px 0;
  font-size: clamp(40px, 8vw, 70px);
  font-weight: 850;
  line-height: 1.05;
}

.finish-title {
  margin-bottom: 14px;
  font-size: 50px;
}

.finish-score {
  margin-bottom: 20px;
  padding: 15px 26px;
  border: 1px solid #ead8ab;
  border-radius: 18px;
  background: #fffaf0;
}

.finish-score strong,
.finish-score span {
  display: block;
}

.finish-score strong {
  color: #835d0d;
  font-size: 36px;
}

.finish-score span {
  color: #8c7546;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.finish-score .overall-stars {
  justify-content: center;
  margin: 8px 0 0;
  font-size: 22px;
}

.instruction {
  max-width: 650px;
  color: var(--muted);
  font-size: 17px;
}

.back {
  display: none;
  width: min(100%, 700px);
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px dashed var(--line);
}

.back.show {
  display: block;
}

.answer {
  font-size: clamp(26px, 5vw, 42px);
  font-weight: 800;
}

.note {
  margin-top: 8px;
  color: var(--muted);
}

.actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.speak {
  width: 48px;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  font-size: 22px;
}

.foot {
  margin-top: 16px;
  color: var(--muted);
  font-size: 13px;
}

.adminlink {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.empty {
  padding: 20px;
  color: var(--muted);
  text-align: center;
}

.load-error,
.form-error {
  padding: 12px 14px;
  border: 1px solid #e5bcbc;
  border-radius: 12px;
  background: #fff0f0;
  color: var(--bad);
}

.hidden {
  display: none !important;
}

@media (max-width: 860px) {
  .controls {
    grid-template-columns: 1fr 1fr;
  }

  .progress-item {
    grid-template-columns: minmax(190px, 1fr) 160px auto;
  }

  .attempt-count {
    display: none;
  }
}

@media (max-width: 640px) {
  .wrap {
    padding: 14px;
  }

  .top {
    flex-direction: column;
  }

  .card {
    padding: 17px;
    border-radius: 20px;
  }

  .controls {
    grid-template-columns: 1fr;
  }

  .progress-overview {
    padding: 16px;
  }

  .progress-heading {
    align-items: flex-start;
  }

  .score-badge {
    min-width: 104px;
    padding: 11px 12px;
  }

  .score-badge strong {
    font-size: 27px;
  }

  .progress-summary {
    grid-template-columns: 1fr 1fr;
  }

  .progress-actions,
  .progress-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .progress-backup-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .progress-filter {
    width: 100%;
  }

  .progress-item {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 12px;
  }

  .word-mastery {
    grid-column: 1;
  }

  .status {
    grid-column: 2;
    grid-row: 1 / span 2;
  }

  .flash {
    min-height: 390px;
  }
}

/* Spielprofil und Tagesmission */
.game-panel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 18px;
  padding: 18px;
  border: 1px solid #dddaf7;
  border-radius: 21px;
  background:
    radial-gradient(circle at 95% 0, rgba(240, 184, 62, .18), transparent 32%),
    linear-gradient(135deg, #f5fbf8, #f7f5ff);
}

.player-main {
  display: flex;
  align-items: center;
  flex: 1 1 360px;
  gap: 14px;
}

.avatar {
  display: grid;
  flex: 0 0 58px;
  width: 58px;
  height: 58px;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 18px;
  background: linear-gradient(145deg, #ffe9a8, #f2bf45);
  box-shadow: 0 8px 20px rgba(131, 93, 13, .18);
  font-size: 31px;
}

.player-copy {
  flex: 1;
  min-width: 0;
}

.level-line {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin: 2px 0 8px;
}

.level-title {
  color: var(--purple);
  font-weight: 800;
}

.xp-track,
.quest-bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(91, 99, 116, .13);
}

.xp-track span,
.quest-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--purple), #948de2);
  transition: width .3s ease;
}

.xp-text,
.quest-text {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.game-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(82px, 1fr));
  gap: 8px;
}

.game-metric {
  min-width: 86px;
  padding: 9px 10px;
  border: 1px solid rgba(91, 99, 116, .13);
  border-radius: 15px;
  background: rgba(255, 255, 255, .78);
  color: var(--ink);
  text-align: center;
}

.game-metric > span,
.game-metric strong,
.game-metric small {
  display: block;
}

.game-metric strong {
  margin: 1px 0;
  font-size: 19px;
  font-variant-numeric: tabular-nums;
}

.game-metric small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.metric-button {
  cursor: pointer;
  font: inherit;
}

.badge-shelf {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  flex: 1 0 100%;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid rgba(91, 99, 116, .13);
}

.badge-item {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.badge-item > * {
  display: block;
}

.badge-item .badge-icon {
  margin-bottom: 3px;
  font-size: 23px;
}

.badge-item b {
  font-size: 13px;
}

.badge-item small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.25;
}

.badge-item.locked {
  filter: grayscale(1);
  opacity: .52;
}

.badge-item.unlocked {
  border-color: #ead8ab;
  background: #fffaf0;
}

.daily-quest {
  display: flex;
  gap: 14px;
  margin-top: 14px;
  padding: 15px 18px;
  border: 1px solid #cfe5ee;
  border-radius: 18px;
  background: #f3fbfe;
}

.daily-quest.complete {
  border-color: #b8dec6;
  background: #f0fbf4;
}

.quest-icon {
  display: grid;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 14px;
  background: #dff3fa;
  font-size: 24px;
}

.quest-copy {
  flex: 1;
  min-width: 0;
}

.quest-title-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.quest-title-line h3 {
  margin-top: 2px;
  font-size: 16px;
}

.quest-reward {
  flex: 0 0 auto;
  padding: 5px 9px;
  border-radius: 999px;
  background: #fff;
  color: #77600f;
  font-size: 13px;
}

.quest-bar span {
  background: linear-gradient(90deg, var(--sky), #65bd93);
}

/* Modusauswahl */
.mode-section {
  margin-top: 24px;
}

.section-heading {
  margin-bottom: 12px;
}

.section-heading h2 {
  margin-top: 3px;
  font-size: 23px;
}

.mode-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.mode-option {
  display: flex;
  align-items: center;
  min-height: 78px;
  gap: 11px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.mode-option.active {
  border-color: var(--purple);
  background: var(--purple-soft);
  box-shadow: 0 0 0 2px rgba(108, 101, 199, .1);
}

.mode-option .mode-icon {
  flex: 0 0 auto;
  font-size: 27px;
}

.mode-option b,
.mode-option small {
  display: block;
}

.mode-option b {
  margin-bottom: 3px;
  font-size: 15px;
}

.mode-option small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.controls.writing-mode {
  grid-template-columns: 1.4fr .7fr auto;
}

.start-button {
  min-height: 44px;
  box-shadow: 0 8px 18px rgba(80, 111, 102, .16);
}

.mode-tip {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 13px;
  padding: 11px 13px;
  border-radius: 14px;
  background: #fff9e9;
  color: #705b22;
  font-size: 13px;
}

.mode-tip b,
.mode-tip span {
  display: block;
}

.mode-tip b {
  margin-bottom: 1px;
}

.score-badges {
  display: flex;
  gap: 9px;
}

.spelling-score {
  border-color: #dcd8f5;
  background: #f7f6ff;
}

.spelling-score strong {
  color: #5d56ae;
}

.spelling-score em {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
}

/* Training */
.mode-chip {
  margin-bottom: 8px;
  padding: 6px 11px;
  border: 1px solid #dcd8f5;
  border-radius: 999px;
  background: var(--purple-soft);
  color: #5750a5;
  font-size: 12px;
  font-weight: 850;
}

.front.spelling-prompt {
  max-width: 820px;
  margin: 17px 0;
  font-size: clamp(30px, 6vw, 54px);
}

.session-hud {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
}

.session-hud span {
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.session-hud .hot {
  border-color: #edcb82;
  background: #fff6df;
  color: #835d0d;
  animation: warm-pulse .7s ease;
}

.spell-box {
  width: min(100%, 720px);
  margin-top: 22px;
}

.spell-box > label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .08em;
  text-align: left;
  text-transform: uppercase;
}

.spell-input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 9px;
}

.spell-input-row input {
  min-width: 0;
  padding: 14px 15px;
  border-width: 2px;
  font-size: 20px;
  font-weight: 700;
  text-align: center;
}

.spell-input-row input:focus {
  border-color: var(--purple);
}

.input-note {
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  text-align: left;
}

.spell-input-row input.input-error {
  border-color: var(--bad);
  animation: nudge .28s ease;
}

.spell-helpers {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 9px;
}

.spell-helpers .sub {
  font-size: 12px;
}

.hint-box {
  margin-top: 12px;
  padding: 11px 13px;
  border: 1px solid #ead8ab;
  border-radius: 13px;
  background: #fffaf0;
  color: #715a20;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.spell-feedback {
  margin-top: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  text-align: left;
}

.spell-feedback.success {
  border-color: #b8dec6;
  background: #effaf3;
}

.spell-feedback.error {
  border-color: #e5bcbc;
  background: #fff5f5;
}

.feedback-title {
  display: block;
  margin-bottom: 9px;
  font-size: 18px;
}

.correct-answer {
  color: var(--good);
  font-size: 25px;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.answer-comparison {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.answer-comparison > div {
  min-width: 0;
  padding: 10px;
  border-radius: 11px;
  background: rgba(255, 255, 255, .78);
}

.answer-comparison span,
.answer-comparison code {
  display: block;
}

.answer-comparison span {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.answer-comparison code {
  color: var(--ink);
  font-family: inherit;
  font-size: 19px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.entered-answer {
  text-decoration-color: #db8585;
  text-decoration-line: underline;
  text-decoration-style: wavy;
}

.expected-answer {
  color: var(--good) !important;
}

.error-focus {
  margin-top: 9px;
  color: var(--bad);
  font-weight: 750;
}

.learning-tip,
.book-note {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed rgba(91, 99, 116, .2);
  color: #525d5a;
  line-height: 1.45;
}

.book-note {
  color: var(--muted);
  font-size: 13px;
}

#spellNext {
  margin-top: 13px;
}

.round-results {
  display: grid;
  grid-template-columns: repeat(4, minmax(110px, 1fr));
  width: min(100%, 700px);
  gap: 9px;
  margin-bottom: 18px;
}

.round-results > div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #f8fbfa;
}

.round-results strong,
.round-results span {
  display: block;
}

.round-results strong {
  font-size: 24px;
}

.round-results span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

/* Belohnungen */
.reward-layer {
  position: fixed;
  z-index: 50;
  top: 15px;
  right: 15px;
  display: grid;
  gap: 8px;
  width: min(340px, calc(100vw - 30px));
  pointer-events: none;
}

.reward-toast {
  padding: 12px 14px;
  border: 1px solid #d8d3f3;
  border-radius: 15px;
  background: rgba(255, 255, 255, .97);
  box-shadow: 0 12px 30px rgba(38, 45, 71, .2);
  color: #514a9d;
  font-weight: 850;
  animation: reward-in .32s ease both;
}

.reward-toast.reward-badge,
.reward-toast.reward-level {
  border-color: #e4c26f;
  background: #fff9e8;
  color: #71550d;
}

.reward-toast.reward-quest {
  border-color: #a8d4b9;
  background: #eefaf2;
  color: #256844;
}

.reward-toast.leaving {
  animation: reward-out .35s ease both;
}

.celebration {
  position: fixed;
  z-index: 60;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.celebration i {
  position: absolute;
  top: -18px;
  width: 10px;
  height: 16px;
  border-radius: 3px;
  animation: confetti-fall 1.55s ease-in forwards;
}

@keyframes reward-in {
  from { opacity: 0; transform: translateY(-10px) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes reward-out {
  to { opacity: 0; transform: translateX(25px); }
}

@keyframes confetti-fall {
  to { transform: translate(var(--drift), calc(100vh + 40px)) rotate(640deg); }
}

@keyframes warm-pulse {
  50% { transform: scale(1.08); }
}

@keyframes nudge {
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

@media (max-width: 860px) {
  .badge-shelf {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
  }

  .mode-picker {
    grid-template-columns: 1fr;
  }

  .mode-option {
    min-height: 68px;
  }

  .controls.writing-mode {
    grid-template-columns: 1fr 1fr;
  }

  .controls.writing-mode .start-button {
    grid-column: 1 / -1;
  }

  .round-results {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .game-panel {
    padding: 14px;
  }

  .player-main {
    flex-basis: 100%;
  }

  .game-metrics {
    width: 100%;
  }

  .game-metric {
    min-width: 0;
    padding: 8px 5px;
  }

  .badge-shelf {
    grid-template-columns: 1fr 1fr;
  }

  .daily-quest {
    padding: 13px;
  }

  .quest-icon {
    display: none;
  }

  .controls.writing-mode {
    grid-template-columns: 1fr;
  }

  .controls.writing-mode .start-button {
    grid-column: auto;
  }

  .score-badges {
    flex-direction: column;
  }

  .score-badge {
    min-width: 112px;
  }

  .studyHead {
    flex-wrap: wrap;
  }

  .studyHead .bar {
    min-width: 120px;
  }

  .session-hud {
    width: 100%;
    justify-content: flex-end;
  }

  .spell-input-row {
    grid-template-columns: 1fr;
  }

  .spell-input-row .primary {
    width: 100%;
  }

  .spell-helpers {
    align-items: flex-start;
    flex-direction: column;
  }

  .answer-comparison {
    grid-template-columns: 1fr;
  }

  .round-results {
    gap: 7px;
  }

  .finish-title {
    font-size: 38px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}

.home-nav{display:inline-block;margin:13px max(18px,calc((100vw - 1100px)/2));padding:9px 14px;border-radius:50px;background:#fff;color:#193c4c;text-decoration:none;font:700 14px system-ui,sans-serif;box-shadow:0 3px 10px #0002}.home-nav:hover{text-decoration:underline}@media print{.home-nav{display:none}}
