/* Математичка вежбанка — "karirana sveska": squared paper, blue fountain-pen ink,
   the teacher's red pen for marks and grades, yellow highlighter, gold star stickers,
   help as sticky notes. Tokens on :root are also consumed by visuals.css. */

/* The shared Mudrica tokens (colours, fonts, --cell, --margin) come from /mudrica/mudrica.css; these are only
   the workbook's own additions. */
:root {
  /* pens */
  --red-deep: #9e1b22;
  --flame: #ea6a12;
  --tape: rgba(255, 255, 255, 0.6);

  /* geometry */
  --gutter: 16px;
  --radius: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* the same notebook at night */
    --red-deep: #c8504b;
    --heart: #ff6f91;
    --flame: #ff9a45;
    --tape: rgba(255, 255, 255, 0.14);
  }
}

/* ------------------------------------------------------------------ base */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-padding-top: 84px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 1.125rem;
  line-height: 1.55;
  color: var(--text);
  /* the squared paper with the red margin line: body.paper-grid from /mudrica/mudrica.css */
}

button,
input {
  font: inherit;
  color: inherit;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.icon {
  display: inline-flex;
  width: 1.25em;
  height: 1.25em;
  flex: none;
}

.icon svg,
[class*="icon-"] svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* ---------------------------------------------------------------- header
   The header itself is the shared <mudrica-header> (/mudrica/mudrica.css). Its middle slot holds this
   workbook's HUD (during a test) and the music button, pushed to the right next to the account menu. */

.mh-slot {
  justify-content: flex-end;
}

.hud {
  flex: 1;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px 14px;
  flex-wrap: wrap;
}

.hud[hidden] {
  display: none;
}

.hud-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 10px;
  border-radius: 10px;
  color: var(--ink);
}

.hud-item .icon {
  width: 22px;
  height: 22px;
}

.hud-num {
  font-weight: 800;
  font-size: 1.3rem;
  font-variant-numeric: tabular-nums;
}

.hud-text {
  font-weight: 700;
  max-width: 12ch;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hud-lives .icon {
  color: var(--heart);
}

.hud-lives.is-bump .icon {
  animation: heart-bump 0.6s ease-out;
}

.hud-time {
  border: 2px solid transparent;
}

.hud-time.is-warn {
  color: var(--red);
  border-color: var(--red);
  background: var(--marker-soft);
}

.music-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  min-width: 44px;
  padding: 0 12px;
  border: 2px solid var(--grid-strong);
  border-radius: 999px;
  background: var(--paper-raised);
  color: var(--ink);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
}

.music-btn[hidden] {
  display: none;
}

.music-btn .icon {
  width: 22px;
  height: 22px;
}

.music-btn[aria-pressed="false"] {
  color: var(--pencil);
  border-style: dashed;
}

/* ----------------------------------------------------------- notebook page */

.page {
  position: relative;
  max-width: calc(var(--margin) + 1200px);
  min-height: calc(100vh - 62px);
  margin: 0;
  padding: 28px var(--gutter) 96px calc(var(--margin) + 24px);
  outline: none;
  overflow-x: clip;
}

/* the red margin line of the exercise book is drawn by the body background, like on the portal */

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: 2rem;
  line-height: 1.1;
  color: var(--ink);
  margin-bottom: 14px;
}

.section-title .icon {
  width: 26px;
  height: 26px;
}

.boot-spinner {
  width: 46px;
  height: 46px;
  margin: 18vh auto 0;
  border-radius: 50%;
  border: 4px solid var(--grid-strong);
  border-top-color: var(--ink);
  animation: spin 0.9s linear infinite;
}

.fallback {
  max-width: 34rem;
  margin: 18vh auto 0;
  padding: 20px 24px;
  font-family: var(--font-body);
  font-size: 1.2rem;
  color: var(--red);
  border: 2px solid var(--red);
  border-radius: var(--radius);
  background: var(--paper-raised);
}

.fatal {
  max-width: 36rem;
  display: grid;
  gap: 18px;
  justify-items: start;
}

.fatal-text {
  font-size: 1.25rem;
  color: var(--red);
  font-weight: 700;
}

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 22px;
  border: 2px solid transparent;
  border-radius: 14px 16px 13px 15px;
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 1.15rem;
  line-height: 1.2;
  cursor: pointer;
  text-align: center;
  transition: transform 0.08s ease, box-shadow 0.08s ease, background-color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn:active:not(:disabled) {
  transform: translateY(2px);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  box-shadow: none;
}

.btn-icon {
  width: 22px;
  height: 22px;
}

.btn-big {
  min-height: 60px;
  padding: 0 30px;
  font-size: 1.3rem;
}

.btn-primary {
  background: var(--ink);
  color: var(--on-ink);
  box-shadow: 0 4px 0 var(--ink-deep);
}

.btn-primary:active:not(:disabled) {
  box-shadow: 0 2px 0 var(--ink-deep);
}

.btn-secondary {
  background: var(--paper-raised);
  color: var(--ink);
  border-color: var(--ink);
}

.btn-quiet {
  background: transparent;
  color: var(--pencil);
  border: 2px dashed var(--pencil);
}

.btn-danger {
  background: var(--red);
  color: #fff;
  box-shadow: 0 4px 0 var(--red-deep);
}

@media (prefers-color-scheme: dark) {
  .btn-danger {
    color: #1a0f12;
  }
}

body[data-busy] .btn {
  cursor: progress;
}

/* ----------------------------------------------------------- start screen */

.start {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 48px;
  align-items: start;
}

@media (min-width: 960px) {
  .start {
    grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
    gap: 64px;
  }
}

.start-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  gap: 36px;
  max-width: 40rem;
}

.hero-title {
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: clamp(2.4rem, 10vw, 4.8rem);
  line-height: 0.95;
  color: var(--ink);
  max-width: max-content;
  transform: rotate(-1.5deg);
  transform-origin: left center;
}

.hero-underline {
  display: block;
  width: min(100%, 26rem);
  height: 22px;
  margin-top: 4px;
  color: var(--ink-soft);
}

.hero-sub {
  margin-top: 10px;
  font-size: 1.15rem;
  color: var(--pencil);
  max-width: 34ch;
}

.start-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.hand-label {
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: 2.1rem;
  line-height: 1.1;
  color: var(--ink);
}

.name-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.name-input {
  flex: 1 1 14rem;
  min-width: 0;
  width: 100%;
  min-height: 60px;
  padding: 0 18px;
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--ink);
  background: var(--paper-raised);
  border: 2px solid var(--ink-soft);
  border-radius: var(--radius);
}

.name-input::placeholder {
  color: var(--muted);
  font-weight: 600;
}

.name-input[aria-invalid="true"] {
  border-color: var(--red);
  background: var(--marker-soft);
}

.start-form .btn {
  flex: 1 0 auto;
}

@media (min-width: 560px) {
  .start-form .btn {
    flex: 0 0 auto;
  }
}

.field-error {
  min-height: 1.5em;
  color: var(--red);
  font-weight: 700;
}

.rules {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.rule {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 12px;
  align-items: start;
  font-size: 1.15rem;
  line-height: 1.45;
}

.rule-icon {
  width: 30px;
  height: 30px;
  color: var(--ink);
}

.rule-heart .rule-icon {
  color: var(--heart);
}

.rule-check .rule-icon {
  color: var(--red);
}

.rule-cross .rule-icon {
  color: var(--red);
}

.check-cost {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--pencil);
}

/* ---------------------------------------------------------------- choices */

.choices-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
}

.choices-wrap .section-title {
  margin-bottom: 0;
}

.choices-intro {
  max-width: 38rem;
  color: var(--pencil);
  font-size: 1.05rem;
}

.choices-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 22px;
}

.slots {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* an empty slot is a dashed box with a die (random); a picked one is inked in */
.slot {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: center;
  width: 56px;
  height: 64px;
  padding: 4px 0;
  border: 2px dashed var(--grid-strong);
  border-radius: 13px 11px 14px 12px;
  background: var(--paper-raised);
  color: var(--ink);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.slot-num {
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: 1.6rem;
  line-height: 1;
}

.slot-dice {
  width: 22px;
  height: 22px;
  color: var(--muted);
}

.slot-emoji {
  font-size: 1.3rem;
  line-height: 1.1;
}

.slot.is-picked {
  border: 2px solid var(--ink);
  background: linear-gradient(170deg, transparent 18%, var(--marker-soft) 20% 80%, transparent 82%), var(--paper-raised);
}

.slot.is-open {
  border: 3px solid var(--ink);
  border-style: solid;
}

.choices-balance {
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.choices-balance.is-short,
.choices-warn {
  color: var(--red);
  font-weight: 700;
}

.picker {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 2px solid var(--ink-soft);
  border-radius: 14px 12px 16px 13px;
  background: var(--paper-raised);
  box-shadow: var(--shadow);
}

.picker-title {
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: 1.8rem;
  line-height: 1.1;
  color: var(--ink);
}

.pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 11.5rem), 1fr));
  gap: 8px;
}

.pick {
  display: grid;
  grid-template-columns: 30px 1fr;
  align-items: center;
  column-gap: 8px;
  min-height: 52px;
  padding: 6px 10px;
  text-align: left;
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.2;
  color: var(--text);
  background: var(--paper);
  border: 2px solid var(--grid-strong);
  border-radius: 10px;
  cursor: pointer;
}

.pick-face {
  grid-row: span 2;
  font-size: 1.4rem;
  text-align: center;
}

.pick-dice {
  width: 26px;
  height: 26px;
  color: var(--pencil);
}

.pick-note {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

.pick.is-current {
  border-color: var(--ink);
  box-shadow: 0 0 0 2px var(--ink);
  background: var(--marker-soft);
}

.pick:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.picker-close {
  justify-self: start;
}

.link-btn {
  justify-self: start;
  min-height: 44px;
  padding: 0 4px;
  border: 0;
  background: none;
  color: var(--ink);
  font-weight: 700;
  text-decoration: underline 2px var(--ink-soft);
  text-underline-offset: 4px;
  cursor: pointer;
}

.rewards {
  display: grid;
  gap: 6px;
}

.rewards-title {
  font-size: 1rem;
  color: var(--pencil);
}

.reward-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
}

.reward {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.reward-star {
  width: 22px;
  height: 22px;
}

/* picked problem in the game: a small pin on its tab */
.tab-pin {
  position: absolute;
  left: -8px;
  bottom: -8px;
  width: 22px;
  height: 22px;
  color: var(--ink);
  transform: rotate(-25deg);
  filter: drop-shadow(0 1px 0 var(--paper));
}

/* result: "+2 choices" written by the teacher */
.earned {
  display: grid;
  gap: 8px;
  justify-items: start;
}

.earned-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: clamp(2rem, 6vw, 2.6rem);
  line-height: 1;
  color: var(--red);
  transform: rotate(-3deg);
  animation: write-in 0.6s ease-out calc(var(--rd, 0s) + 2.6s) both;
}

.earned-dice {
  width: 34px;
  height: 34px;
}

.earned-next {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 24rem;
  font-weight: 700;
  color: var(--ink);
}

.earned-dice-small {
  width: 24px;
  height: 24px;
  flex: none;
}

.earned-balance {
  color: var(--pencil);
  font-weight: 700;
}

/* ---------------------------------------------------------- account & key */

.account {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 26px;
  min-width: 0;
}

.greet-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 24px;
}

.greet {
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: clamp(2.2rem, 7vw, 2.8rem);
  line-height: 1.05;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
}

.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.link-icon {
  width: 22px;
  height: 22px;
}

.link-quiet {
  color: var(--pencil);
  text-decoration-color: var(--grid-strong);
}

.login-hint {
  max-width: 36rem;
  color: var(--pencil);
  font-size: 1rem;
}

.key-input {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.key-input::placeholder {
  letter-spacing: 0.12em;
}

/* the key: a cut-out coupon from the notebook (dashed edge = "keep this") */
.key-panel {
  display: grid;
  gap: 12px;
  justify-items: start;
  max-width: 34rem;
  padding: 18px 20px 20px;
  border: 2px dashed var(--ink-soft);
  border-radius: 14px 12px 16px 13px;
  background: var(--paper-raised);
  outline: none;
}

.key-panel:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 4px;
}

.key-panel.is-fresh {
  border: 3px solid var(--ink);
  box-shadow: var(--shadow);
}

.key-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: 2rem;
  line-height: 1.1;
  color: var(--ink);
}

.key-title-icon {
  width: 28px;
  height: 28px;
}

.key-save {
  font-weight: 700;
  color: var(--text);
}

.key-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
}

.key-code {
  padding: 4px 12px;
  font-family: var(--font-body);
  font-weight: 800;
  font-size: clamp(1.9rem, 8vw, 2.5rem);
  line-height: 1.2;
  letter-spacing: 0.1em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  background: linear-gradient(176deg, transparent 10%, var(--marker-soft) 12% 88%, transparent 90%);
  user-select: all;
  -webkit-user-select: all;
  white-space: nowrap;
}

.key-status {
  min-height: 1.5em;
  font-weight: 700;
  color: var(--red);
}

.key-qr {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 20px;
}

/* the QR code always sits on a white sticker so it scans in dark mode too */
.qr-card {
  display: grid;
  place-items: center;
  width: 196px;
  min-height: 196px;
  padding: 10px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12), var(--shadow);
  color: #000;
}

.qr-card svg {
  display: block;
  width: 176px;
  height: 176px;
}

.qr-card.is-missing {
  background: var(--paper);
  border: 2px dashed var(--grid-strong);
  box-shadow: none;
}

.qr-missing {
  font-size: 0.95rem;
  color: var(--pencil);
  text-align: center;
}

.key-help {
  flex: 1 1 12rem;
  max-width: 18rem;
  color: var(--text);
}

.confirm-logout {
  max-width: 34rem;
}

/* an unfinished test waits on the start page */
.resume-card {
  display: grid;
  gap: 10px;
  justify-items: start;
  max-width: 34rem;
  padding: 20px 22px 22px;
  border: 3px solid var(--ink);
  border-radius: 16px 13px 18px 14px;
  background: var(--paper-raised);
  box-shadow: var(--shadow);
}

.resume-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: 2.1rem;
  line-height: 1.1;
  color: var(--ink);
  background: linear-gradient(176deg, transparent 14%, var(--marker-soft) 16% 86%, transparent 88%);
}

.resume-icon {
  width: 28px;
  height: 28px;
}

.resume-info {
  font-size: 1.1rem;
}

.start-row {
  display: grid;
  justify-items: start;
  gap: 6px;
}

/* home buttons */
.hud-home {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 12px;
  border: 2px solid var(--grid-strong);
  border-radius: 999px;
  background: var(--paper-raised);
  color: var(--ink);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  margin-right: auto;
}

.hud-home .icon {
  width: 22px;
  height: 22px;
}

/* ------------------------------------------------------------------ streak */

.hud-streak {
  position: relative;
}

.hud-streak[hidden] {
  display: none;
}

.hud-streak .icon {
  color: var(--flame);
}

.hud-streak.is-up .icon {
  animation: flame-up 0.6s cubic-bezier(0.3, 1.6, 0.5, 1);
}

.hud-streak.is-reset .hud-num {
  animation: streak-reset 0.7s ease-out;
}

.streak-pop {
  position: absolute;
  top: 100%;
  left: 50%;
  z-index: 30;
  padding: 2px 10px;
  white-space: nowrap;
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: 1.5rem;
  line-height: 1.2;
  color: var(--flame);
  background: var(--paper-raised);
  border: 2px solid var(--flame);
  border-radius: 12px 10px 13px 11px;
  box-shadow: var(--shadow);
  pointer-events: none;
  animation: streak-pop 1.9s ease-out forwards;
}

.streak-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: var(--text);
}

.streak-icon {
  width: 24px;
  height: 24px;
  color: var(--flame);
}

/* ------------------------------------------------------------- new sticker */

.new-sticker {
  position: fixed;
  z-index: 45;
  right: 16px;
  bottom: max(16px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  width: min(calc(100vw - 32px), 22rem);
  padding: 14px 12px 14px 16px;
  color: var(--text);
  background: var(--paper-raised);
  border: 2px solid var(--ink);
  border-radius: 16px 13px 18px 14px;
  box-shadow: var(--shadow), 0 6px 18px rgba(0, 0, 0, 0.12);
  animation: sticker-peel 0.6s cubic-bezier(0.3, 1.5, 0.5, 1) both;
}

.new-sticker.is-leaving {
  animation: sticker-leave 0.32s ease-in forwards;
}

.new-sticker-face {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  font-size: 2.3rem;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #fff 0 18%, transparent 40%), var(--note);
  box-shadow: 0 0 0 4px #fff, 0 4px 8px rgba(0, 0, 0, 0.25);
  transform: rotate(-8deg);
}

.new-sticker-title {
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: 1.7rem;
  line-height: 1;
  color: var(--red);
}

.new-sticker-name {
  font-weight: 800;
}

.new-sticker .link-btn {
  min-height: 36px;
  padding: 0;
}

.new-sticker-close {
  align-self: start;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 8px;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--pencil);
  cursor: pointer;
}

.new-sticker-close .icon {
  width: 18px;
  height: 18px;
}

/* -------------------------------------------------------------------- album */

.back-btn {
  margin-bottom: 18px;
}

.album {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.album-head {
  display: grid;
  gap: 4px;
  margin-bottom: 18px;
}

.album-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: clamp(2.6rem, 8vw, 3.4rem);
  line-height: 1;
  color: var(--ink);
}

.album-count {
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--ink);
}

.album-intro {
  color: var(--pencil);
}

.album-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 158px), 1fr));
  gap: 22px 18px;
  max-width: 64rem;
}

.album-slot {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 4px;
  min-height: 176px;
  padding: 16px 12px 14px;
  text-align: center;
  border-radius: 18px;
}

/* earned: a glossy sticker stuck on slightly crooked */
.album-slot.is-earned {
  background: var(--paper-raised);
  border: 4px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08), 0 8px 14px -8px rgba(28, 40, 71, 0.55);
  transform: rotate(var(--tilt, 0deg));
  overflow: hidden;
}

.album-slot.is-earned::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(125deg, rgba(255, 255, 255, 0.55) 0 18%, transparent 34% 100%);
  pointer-events: none;
}

.album-slot.is-earned .album-face {
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.2));
}

/* locked: the empty place for the sticker */
.album-slot.is-locked {
  border: 2px dashed var(--grid-strong);
  background: color-mix(in srgb, var(--paper) 70%, transparent);
}

.album-slot.is-locked .album-face {
  filter: grayscale(1);
  opacity: 0.3;
}

.album-face {
  font-size: 2.8rem;
  line-height: 1.1;
}

.album-name {
  font-weight: 800;
  font-size: 1.05rem;
  line-height: 1.2;
  color: var(--ink);
}

.album-slot.is-locked .album-name {
  color: var(--pencil);
}

.album-date {
  font-size: 0.85rem;
  color: var(--pencil);
}

.album-desc {
  font-size: 0.9rem;
  line-height: 1.35;
  color: var(--pencil);
}

.album-progress {
  width: 100%;
  height: 10px;
  margin-top: 6px;
  border-radius: 999px;
  background: var(--grid-line);
  overflow: hidden;
}

.album-bar {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--ink-soft);
}

.album-progress-text {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink);
}

/* -------------------------------------------------------------------- daily */

.daily-card {
  display: grid;
  gap: 8px;
  justify-items: start;
  max-width: 34rem;
  padding: 16px 20px 18px;
  border: 2px solid var(--ink-soft);
  border-radius: 14px 12px 16px 13px;
  background: var(--paper-raised);
}

.daily-card.is-new {
  border-width: 3px;
  border-color: var(--ink);
}

.daily-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: 2rem;
  line-height: 1.1;
  color: var(--ink);
}

.daily-icon,
.daily-page-icon {
  width: 28px;
  height: 28px;
}

.daily-mark {
  width: 34px;
  height: 34px;
  color: var(--red);
}

.daily-status {
  font-weight: 700;
}

.daily-card.is-failed .daily-status {
  color: var(--pencil);
}

.daily-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  color: var(--pencil);
  font-weight: 700;
}

.daily-streak {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  color: var(--text);
}

.daily-flame {
  width: 22px;
  height: 22px;
  color: var(--flame);
}

.daily-reward {
  color: var(--red);
}

.daily {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  max-width: 56rem;
}

.daily-page-head {
  display: grid;
  gap: 4px;
  margin-bottom: 22px;
}

.daily-review {
  margin-top: 26px;
  padding-top: 22px;
  border-top: 2px dashed var(--grid-strong);
}

.verdict-sub {
  grid-column: 2;
  font-weight: 700;
  color: var(--pencil);
}

/* ----------------------------------------------------------------- confetti */

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

.confetti-piece {
  position: absolute;
  top: -6vh;
  left: var(--x);
  animation: confetti-fall var(--dur) linear var(--delay) forwards;
}

.confetti-piece.is-paper {
  width: 10px;
  height: 15px;
  background: var(--c);
  border-radius: 2px;
}

.confetti-piece.is-star {
  display: block;
  width: 24px;
  height: 24px;
}

/* ------------------------------------------------------------ round 5 ui */

/* segmented control (leaderboard tabs) */
.board-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-bottom: 12px;
}

.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  max-width: 100%;
  padding: 3px;
  border: 2px solid var(--grid-strong);
  border-radius: 999px;
  background: var(--paper-raised);
}

.seg {
  min-height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--pencil);
  font-weight: 700;
  font-size: 0.98rem;
  cursor: pointer;
}

.seg.is-on {
  color: var(--on-ink);
  background: var(--ink);
}

.segmented.is-small .seg {
  min-height: 36px;
  font-size: 0.9rem;
}

.board-slot[aria-busy="true"] {
  opacity: 0.55;
}

/* with help / without help */
.mode-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.mode-wrap .section-title {
  margin-bottom: 0;
}

.mode-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
  gap: 12px;
  max-width: 40rem;
}

.mode-card {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  text-align: left;
  color: var(--text);
  background: var(--paper-raised);
  border: 2px solid var(--grid-strong);
  border-radius: 14px 12px 15px 13px;
  cursor: pointer;
}

.mode-card.is-on {
  border: 3px solid var(--ink);
  background: linear-gradient(176deg, transparent 6%, var(--marker-soft) 8% 30%, transparent 32%), var(--paper-raised);
}

.mode-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--ink);
}

.mode-icon {
  width: 24px;
  height: 24px;
}

.mode-desc {
  font-size: 0.98rem;
  color: var(--pencil);
}

.mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 12px;
  border: 2px solid var(--star-edge);
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--marker-soft);
}

.mode-badge-icon {
  width: 20px;
  height: 20px;
}

.game-body.is-nohelp {
  grid-template-columns: minmax(0, 1fr);
}

.choices-count {
  font-weight: 700;
  color: var(--pencil);
}

.hand-label-small {
  font-size: 1.7rem;
  margin-top: 8px;
}

/* invitations */
.invite-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 18px;
  width: 100%;
}

.invite-row {
  display: grid;
  gap: 8px;
}

.invite-row.is-open + .invite-row,
.invite-row + .invite-row.is-open {
  padding-top: 16px;
  border-top: 2px dashed var(--grid-strong);
}

.invite-row.is-used {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 16px;
  color: var(--pencil);
}

.invite-code {
  font-weight: 800;
  letter-spacing: 0.08em;
  text-decoration: line-through 2px var(--grid-strong);
}

.invite-used {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
}

.invite-used-icon {
  width: 22px;
  height: 22px;
  color: var(--red);
}

.invite-state {
  color: var(--pencil);
  font-weight: 700;
}

.invite-side {
  display: grid;
  gap: 8px;
  flex: 1 1 12rem;
  min-width: 0;
}

.invite-link {
  color: var(--ink);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.invite-new {
  display: grid;
  gap: 8px;
  justify-items: start;
}

.invite-remaining {
  font-weight: 700;
}

/* more things to do */
.tiles-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
}

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 12rem), 1fr));
  gap: 12px;
  max-width: 42rem;
}

.tile {
  display: grid;
  justify-items: start;
  gap: 4px;
  min-height: 110px;
  padding: 14px 16px;
  text-align: left;
  color: var(--text);
  background: var(--paper-raised);
  border: 2px solid var(--ink-soft);
  border-radius: 14px 12px 16px 13px;
  cursor: pointer;
}

.tile-icon {
  width: 28px;
  height: 28px;
  color: var(--ink);
}

.tile-name {
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: 1.7rem;
  line-height: 1.05;
  color: var(--ink);
}

.tile-desc {
  font-size: 0.95rem;
  color: var(--pencil);
}

/* practice */
.practice,
.notebook,
.quick-screen {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  max-width: 56rem;
}

.practice-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 22px;
}

.practice-grid {
  max-width: 48rem;
}

.practice-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

/* my notebook */
.nb-suggest {
  display: grid;
  gap: 6px;
  max-width: 40rem;
  margin-bottom: 18px;
  padding: 14px 18px;
  border-left: 5px solid var(--marker);
  background: var(--paper-raised);
}

.nb-suggest-title {
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: 1.8rem;
  line-height: 1.1;
  color: var(--ink);
}

.nb-suggest-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0 18px;
}

.nb-suggest-hint {
  color: var(--pencil);
  font-size: 0.98rem;
}

.nb-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  max-width: 48rem;
}

.nb-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 14px;
  min-height: calc(var(--cell) * 3);
  padding: 8px 6px;
  border-bottom: 1px solid var(--grid-strong);
}

.nb-row.is-weak {
  background: linear-gradient(178deg, transparent 6%, var(--marker-soft) 8% 92%, transparent 94%);
}

.nb-emoji {
  font-size: 1.7rem;
  text-align: center;
}

.nb-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.nb-name {
  font-weight: 800;
  color: var(--ink);
}

.nb-bar {
  max-width: 18rem;
  margin-top: 0;
}

.nb-text {
  font-size: 0.92rem;
  color: var(--pencil);
}

.nb-row.is-new .nb-name {
  color: var(--pencil);
}

.nb-stars {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-weight: 800;
  color: var(--text);
  white-space: nowrap;
}

.nb-practice {
  grid-column: 2 / -1;
  justify-self: start;
  min-height: 44px;
}

/* mascot */
.hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 24px;
}

.hero-text {
  flex: 1 1 18rem;
  min-width: 0;
}

.mascot-slot {
  flex: none;
}


.grade-row .mascot-big {
  align-self: center;
}

.corner-mascot {
  position: fixed;
  z-index: 15;
  left: 8px;
  bottom: max(10px, env(safe-area-inset-bottom));
}

.mascot-slot > *,
.corner-mascot > * {
  max-width: 100%;
}

/* ------------------------------------------------------------- avatars */

.user-avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--ink);
  background: var(--marker-soft);
  box-shadow: inset 0 0 0 2px var(--ink);
}

/* on phones the header has room only for the logo and the account: music stays in the account menu */
@media (max-width: 560px) {
  .music-btn {
    display: none;
  }
}

/* ------------------------------------------------------- no-help grading */

.saved-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  color: var(--ink);
}

.saved-icon {
  width: 24px;
  height: 24px;
}

.feedback.is-saved {
  color: var(--pencil);
}

.tab.is-answered {
  border-color: var(--ink-soft);
  border-style: solid;
}

.tab-mark.is-answered {
  width: 24px;
  height: 24px;
  top: -9px;
  right: -9px;
  padding: 3px;
  color: var(--ink);
  background: var(--paper-raised);
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--ink-soft);
}

/* the teacher goes through the problems one by one */
.grading {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  display: grid;
  width: min(100%, 34rem);
}

.grade-item {
  display: grid;
  grid-template-columns: 2.2rem 2rem minmax(0, 1fr) 40px auto;
  align-items: center;
  gap: 8px;
  min-height: calc(var(--cell) * 2);
  border-bottom: 1px solid var(--grid-strong);
}

.grade-item-no {
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: 1.6rem;
  color: var(--ink);
  text-align: center;
}

.grade-item-emoji {
  font-size: 1.3rem;
}

.grade-item-title {
  font-weight: 700;
  overflow-wrap: anywhere;
}

.grade-item-mark {
  width: 36px;
  height: 36px;
  color: var(--red);
}

.grade-item-points {
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--red);
  white-space: nowrap;
}

.grading.is-animated .grade-item {
  animation: fade-in 0.25s ease-out both;
  animation-delay: calc(var(--gi) * 0.7s);
}

.grading.is-animated .grade-item-mark .pen {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: draw 0.4s ease-out forwards;
  animation-delay: calc(var(--gi) * 0.7s + 0.3s);
}

.grading.is-animated .grade-item-mark .pen-2 {
  animation-delay: calc(var(--gi) * 0.7s + 0.45s);
}

.grading.is-animated .grade-item-points {
  animation: write-in 0.35s ease-out both;
  animation-delay: calc(var(--gi) * 0.7s + 0.55s);
}

/* the score and stats wait until grading is done */
.result.is-reveal .stats,
.result.is-reveal .result-actions {
  animation: fade-in 0.4s ease-out both;
  animation-delay: var(--rd, 0s);
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (max-width: 480px) {
  .grade-item {
    grid-template-columns: 1.8rem 1.6rem minmax(0, 1fr) 32px;
  }

  .grade-item-points {
    grid-column: 3 / -1;
    margin-top: -6px;
    font-size: 1.2rem;
  }
}

/* ----------------------------------------------------------------- friends */

.friends {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  max-width: 60rem;
}

.friend-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr));
  gap: 16px;
}

.friend-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  padding: 14px 16px;
  background: var(--paper-raised);
  border: 2px solid var(--grid-strong);
  border-radius: 14px 12px 16px 13px;
}

.friend-card.is-me {
  border: 3px solid var(--ink);
  background: linear-gradient(176deg, transparent 4%, var(--marker-soft) 6% 26%, transparent 28%), var(--paper-raised);
}

.friend-avatar {
  width: 46px;
  height: 46px;
  font-size: 1.9rem;
}

.friend-main {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.friend-name {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  font-weight: 800;
  font-size: 1.2rem;
  line-height: 1.2;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.friend-stickers {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.friend-sticker,
.friend-more {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  font-size: 1.25rem;
  border-radius: 9px;
  background: var(--paper);
  box-shadow: 0 0 0 2px #fff, 0 2px 4px rgba(28, 40, 71, 0.25);
}

.friend-sticker:nth-child(odd) {
  transform: rotate(-4deg);
}

.friend-sticker:nth-child(even) {
  transform: rotate(3deg);
}

.friend-more {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--ink);
}

.friend-none {
  color: var(--pencil);
  font-size: 0.95rem;
}

.friend-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  font-weight: 700;
  font-size: 0.98rem;
  color: var(--text);
}

.friend-count {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.friend-count-icon {
  width: 20px;
  height: 20px;
  color: var(--ink);
}

.friends-empty {
  display: grid;
  gap: 12px;
  justify-items: start;
  max-width: 30rem;
  margin-top: 18px;
  font-size: 1.1rem;
}

/* ----------------------------------------------------------------- history */

.history,
.locked {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  max-width: 56rem;
}

.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  max-width: 48rem;
}

.history-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 12px;
  width: 100%;
  min-height: calc(var(--cell) * 3);
  padding: 8px 6px;
  border: 0;
  border-bottom: 1px solid var(--grid-strong);
  background: none;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.history-row:hover,
.history-row:focus-visible {
  background: var(--marker-soft);
}

.history-emoji {
  font-size: 1.6rem;
  text-align: center;
}

.history-main {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.history-title {
  font-weight: 800;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.history-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0 12px;
  font-size: 0.9rem;
  color: var(--pencil);
}

.history-result {
  display: grid;
  justify-items: end;
  gap: 0;
  text-align: right;
}

.history-mark {
  width: 30px;
  height: 30px;
  color: var(--red);
}

.history-mark.is-tried {
  color: var(--pencil);
}

.history-status {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--pencil);
}

.history-points {
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: 1.3rem;
  line-height: 1;
  color: var(--red);
  white-space: nowrap;
}

.history-more {
  justify-self: start;
  margin-top: 14px;
}

.history-item .review-card {
  border-bottom: 0;
  padding-top: 8px;
}

.history-none {
  color: var(--pencil);
}

.answer-list.is-mine-right dd {
  color: var(--ink);
}

/* locked during a test */
.tile.is-locked {
  cursor: not-allowed;
  opacity: 0.6;
}

.tile.is-locked .tile-desc {
  color: var(--red);
  font-weight: 700;
}

/* ------------------------------------------------------- account requests */

.login-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0 22px;
}

.waiting-card {
  display: grid;
  gap: 12px;
  justify-items: start;
  max-width: 34rem;
  padding: 20px 22px 22px;
  border: 3px dashed var(--ink-soft);
  border-radius: 16px 13px 18px 14px;
  background: var(--paper-raised);
}

.waiting-card.is-rejected {
  border-color: var(--grid-strong);
}

.request-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  max-width: 44rem;
}

.request-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px 14px;
  padding: 12px 6px;
  border-bottom: 1px solid var(--grid-strong);
}

.request-main {
  min-width: 0;
}

.request-name {
  font-weight: 800;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.request-date {
  font-size: 0.9rem;
  color: var(--pencil);
}

.request-actions,
.request-confirm {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.request-confirm {
  display: grid;
  gap: 8px;
}

.request-ask {
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: 1.5rem;
  line-height: 1.1;
  color: var(--red);
}

.request-actions .btn,
.request-confirm .btn {
  min-height: 46px;
  padding: 0 16px;
  font-size: 1rem;
}

.invited {
  display: grid;
  gap: 8px;
  width: 100%;
  padding-top: 14px;
  border-top: 2px dashed var(--grid-strong);
}

.invited-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  color: var(--ink);
}

.invited-icon {
  width: 22px;
  height: 22px;
}

.invited-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.invited-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
}

.invited-name {
  font-weight: 700;
}

.invited-row .board-date {
  display: inline;
}

/* ------------------------------------------------------------ leaderboard */

.board-wrap {
  min-width: 0;
}

.board {
  width: 100%;
  border-collapse: collapse;
  font-size: 1.05rem;
}

.board th {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--pencil);
  text-align: left;
  padding: 0 8px 6px;
  border-bottom: 2px solid var(--ink-soft);
}

.board td {
  height: calc(var(--cell) * 2);
  padding: 0 8px;
  border-bottom: 1px solid var(--grid-strong);
  vertical-align: middle;
}

.board .col-rank {
  width: 3.2em;
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--ink);
  text-align: center;
}

.board th.col-rank {
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--pencil);
}

.board .col-player {
  max-width: 10rem;
}

.player-name {
  font-weight: 700;
  overflow-wrap: break-word;
}

.board .col-score strong {
  font-weight: 800;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.of-max {
  color: var(--muted);
  font-size: 0.85em;
}

.board .col-stars {
  white-space: nowrap;
  color: var(--pencil);
}

.mini-star {
  display: inline-flex;
  width: 20px;
  height: 20px;
  vertical-align: -4px;
  margin-right: 4px;
}

.board .col-helps {
  font-variant-numeric: tabular-nums;
  color: var(--pencil);
  text-align: center;
}

.board .col-time {
  font-variant-numeric: tabular-nums;
  color: var(--pencil);
  white-space: nowrap;
}

.board tr.is-me td {
  background: linear-gradient(176deg, transparent 12%, var(--marker-soft) 14% 86%, transparent 88%);
}

.board tr.is-detached td {
  border-top: 2px dashed var(--grid-strong);
}

/* discreet date of a record, under the name */
.board-date,
.qr-round-board-date {
  display: block;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--pencil);
}

.you-tag {
  margin-left: 8px;
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--red);
}

.board-empty {
  color: var(--pencil);
  font-size: 1.1rem;
}

@media (max-width: 480px) {
  .board .col-time,
  .board .col-helps {
    display: none;
  }
}

/* ------------------------------------------------------------- game: tabs */

.tabs {
  margin-bottom: 30px;
}

.tablist {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tab {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 0;
  width: 66px;
  height: 70px;
  padding: 4px 0;
  border: 2px solid var(--grid-strong);
  border-radius: 14px 12px 15px 13px;
  background: var(--paper-raised);
  color: var(--ink);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.tab-num {
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: 2rem;
  line-height: 1;
}

.tab-emoji {
  font-size: 1.2rem;
  line-height: 1.2;
}

.tab[aria-selected="true"] {
  border: 3px solid var(--ink);
  background: linear-gradient(170deg, transparent 18%, var(--marker-soft) 20% 80%, transparent 82%), var(--paper-raised);
}

.tab.is-failed .tab-num,
.tab.is-solved .tab-num {
  opacity: 0.6;
}

.tab-mark {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 30px;
  height: 30px;
  color: var(--red);
  filter: drop-shadow(0 1px 0 var(--paper));
}

/* -------------------------------------------------------- game: layout */

.game-body {
  display: grid;
  gap: 48px;
  align-items: start;
}

@media (min-width: 1100px) {
  .game-body {
    grid-template-columns: minmax(0, 1fr) minmax(340px, 420px);
    gap: 56px;
  }
}

.problem {
  min-width: 0;
  outline: none;
}

.problem-head {
  position: relative;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-bottom: 14px;
}

/* task number written in the margin, left of the red line */
.problem-no {
  position: absolute;
  left: calc(-1 * (var(--margin) + 24px));
  top: 50%;
  width: var(--margin);
  transform: translateY(-50%);
  text-align: center;
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: 2.4rem;
  line-height: 1;
  color: var(--ink);
}

.problem-emoji {
  font-size: 2rem;
  line-height: 1;
}

.problem-title {
  font-weight: 800;
  font-size: clamp(1.4rem, 3.6vw, 1.75rem);
  line-height: 1.2;
  color: var(--ink);
}

.problem-text {
  max-width: 62ch;
  font-size: 1.22rem;
  line-height: 1.65;
  margin-bottom: 26px;
}

/* ---------------------------------------------------------- answer fields */

.answer-form {
  display: grid;
  gap: 22px;
  max-width: 44rem;
}

.field {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.field-label {
  display: block;
  padding: 0;
  margin-bottom: 8px;
  font-weight: 700;
  font-size: 1.12rem;
  color: var(--text);
}

.field-line {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  max-width: 100%;
}

.num-input,
.set-input,
.cell-input {
  min-height: 58px;
  padding: 0 14px;
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 1.6rem;
  color: var(--ink);
  background: var(--paper-raised);
  border: 2px solid var(--ink-soft);
  border-radius: 10px 12px 10px 11px;
  font-variant-numeric: tabular-nums;
}

.num-input {
  width: 8.5ch;
  text-align: center;
}

.set-input {
  width: min(100%, 22rem);
  font-size: 1.35rem;
}

.set-input::placeholder {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--muted);
}

.num-input:disabled,
.set-input:disabled,
.cell-input:disabled {
  opacity: 1;
  color: var(--ink);
  background: transparent;
  border-style: dashed;
  -webkit-text-fill-color: var(--ink);
}

.unit {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--pencil);
}

.field-mark {
  display: inline-flex;
  flex: none;
  width: 34px;
  height: 34px;
  color: var(--red);
}

.field.is-wrong .num-input,
.field.is-wrong .set-input,
.cell-input.is-wrong {
  border-color: var(--red);
  border-width: 3px;
  text-decoration: line-through 2px var(--red);
}

.field.is-missing .num-input,
.field.is-missing .set-input,
.field.is-missing .cell-input,
.field-choice.is-missing .choice-face {
  background: var(--marker-soft);
  border-color: var(--red);
  border-style: dashed;
}

/* Correct answers stay in ink on a highlighter; red is reserved for mistakes (children read red as "wrong"). */
.field.is-right .num-input:disabled,
.field.is-right .set-input:disabled {
  border-color: var(--ink);
  border-width: 3px;
  border-style: solid;
  background: var(--marker-soft);
}

.set-info {
  margin-top: 6px;
  color: var(--red);
  font-weight: 700;
}

/* choice: big buttons, the picked one gets circled with ink */
.choices {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.choice {
  position: relative;
  cursor: pointer;
}

.choice-input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.choice-face {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 58px;
  min-width: 6rem;
  padding: 0 22px;
  font-weight: 800;
  font-size: 1.3rem;
  color: var(--ink);
  background: var(--paper-raised);
  border: 2px solid var(--ink-soft);
  border-radius: 999px;
  transition: box-shadow 0.12s ease, background-color 0.12s ease;
}

.choice-input:checked + .choice-face {
  border-color: var(--ink);
  background: var(--marker-soft);
  box-shadow: 0 0 0 3px var(--ink);
}

.choice-input:focus-visible + .choice-face {
  outline: 3px solid var(--focus);
  outline-offset: 5px;
}

.choice-input:disabled + .choice-face {
  cursor: default;
  opacity: 0.6;
}

.choice-input:disabled:checked + .choice-face {
  opacity: 1;
}

.field-choice.is-wrong .choice-input:checked + .choice-face {
  box-shadow: 0 0 0 3px var(--red);
  border-color: var(--red);
}

/* magic square */
.grid3 {
  display: inline-grid;
  grid-template-columns: repeat(3, 66px);
  grid-auto-rows: 66px;
  gap: 0;
  border: 3px solid var(--ink);
  border-radius: 6px;
  background: var(--paper-raised);
}

.grid3 .cell {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0;
  border-radius: 0;
  border: 1px solid var(--ink-soft);
  font-size: 1.6rem;
  font-weight: 800;
  text-align: center;
}

.cell-given {
  color: var(--text);
  background: repeating-linear-gradient(135deg, transparent 0 6px, var(--grid-line) 6px 8px);
}

.cell-input {
  background: var(--paper-raised);
}

.cell-input:focus-visible {
  outline-offset: -4px;
}

.field-grid .field-mark {
  vertical-align: top;
  margin-left: 10px;
}

/* --------------------------------------------------------- check & feedback */

.check-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px 22px;
  margin-top: 6px;
}

.attempts {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--pencil);
  font-weight: 700;
  font-size: 1rem;
}

.dots {
  display: inline-flex;
  gap: 6px;
}

.dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--ink-soft);
}

.dot.is-left {
  background: var(--ink);
  border-color: var(--ink);
}

.feedback {
  min-height: 1.6em;
  max-width: 40rem;
  font-weight: 700;
  font-size: 1.12rem;
}

.feedback.is-wrong {
  color: var(--red);
}

.feedback.is-info {
  color: var(--ink);
}

/* ------------------------------------------------------- verdict (solved) */

.verdict {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 4px 16px;
  margin-top: 18px;
  max-width: 40rem;
}

.verdict-check {
  grid-row: span 2;
  width: 84px;
  height: 84px;
  color: var(--red);
}

.verdict-text {
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: 2.6rem;
  line-height: 1;
  color: var(--red);
  transform: rotate(-2deg);
}

.verdict-text.small {
  font-size: 1.9rem;
  line-height: 1.1;
}

.verdict-star {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: var(--text);
}

.verdict-star .sticker {
  width: 48px;
  height: 48px;
}

.next-btn {
  grid-column: 1 / -1;
  justify-self: start;
  margin-top: 14px;
}

/* the celebratory red-pen moment */
.celebrate .pen {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: draw 0.55s cubic-bezier(0.6, 0.05, 0.4, 1) 0.05s forwards;
}

.celebrate .verdict-text {
  animation: write-in 0.5s ease-out 0.35s both;
}

.celebrate .sticker {
  animation: sticker-slap 0.55s cubic-bezier(0.3, 1.6, 0.5, 1) 0.7s both;
}

/* --------------------------------------------------------- helps & notes */

.helps {
  min-width: 0;
}

.help-next {
  display: grid;
  gap: 10px;
  justify-items: start;
  margin-bottom: 26px;
}

.help-hint {
  color: var(--pencil);
  font-size: 1.05rem;
}

.help-hint.is-warn {
  color: var(--red);
  font-weight: 700;
}

.help-progress {
  color: var(--muted);
  font-size: 0.95rem;
}

/* the pad of sticky notes you can tear the next one from */
.help-btn {
  display: grid;
  justify-items: start;
  gap: 6px;
  width: 100%;
  max-width: 24rem;
  min-height: 72px;
  padding: 12px 18px;
  text-align: left;
  color: var(--note-ink);
  background: var(--note);
  border: 2px dashed var(--note-edge);
  border-radius: 4px 4px 16px 4px;
  box-shadow: var(--shadow);
  justify-content: stretch;
}

.help-btn:hover:not(:disabled) {
  transform: rotate(-0.6deg);
}

.help-btn-label {
  font-size: 1.2rem;
}

.help-btn-cost {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cost {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 800;
  background: var(--paper-raised);
}

.cost .icon {
  width: 18px;
  height: 18px;
}

.cost-hearts {
  color: var(--heart);
}

.cost-points {
  color: var(--red);
}

.notes {
  display: grid;
  gap: 26px;
}

.note {
  position: relative;
  padding: 26px 20px 22px;
  color: var(--note-ink);
  background: var(--note);
  border-radius: 3px 3px 18px 3px;
  box-shadow: var(--shadow);
  transform: rotate(-0.7deg);
  outline: none;
}

.note:nth-child(even) {
  transform: rotate(0.6deg);
}

.note:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 4px;
}

/* a strip of tape holding the note */
.note::before {
  content: "";
  position: absolute;
  top: -11px;
  left: 50%;
  width: 92px;
  height: 24px;
  transform: translateX(-50%) rotate(-3deg);
  background: var(--tape);
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.note-title {
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: 1.85rem;
  line-height: 1.1;
  margin-bottom: 8px;
}

.note-text {
  font-size: 1.15rem;
  line-height: 1.55;
}

.note-visual,
.note-viewer {
  min-width: 0;
  overflow-x: auto;
}

.note-visual > *,
.note-viewer > * {
  max-width: 100%;
}

.note-fresh {
  animation: note-stick 0.45s cubic-bezier(0.3, 1.4, 0.5, 1) both;
}

.plain-steps {
  margin: 0;
  padding-left: 1.4em;
  display: grid;
  gap: 10px;
}

.plain-step-math {
  display: block;
  font-weight: 800;
  color: var(--ink);
}

/* ------------------------------------------------------------------ finish */

.finish {
  margin-top: 64px;
  padding-top: 24px;
  border-top: 2px dashed var(--grid-strong);
  display: flex;
  justify-content: flex-end;
}

.end-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
}

.end-abandon .btn-icon {
  width: 18px;
  height: 18px;
}

.confirm {
  display: grid;
  gap: 10px;
  max-width: 30rem;
  width: 100%;
  padding: 18px 20px 20px;
  border: 3px solid var(--red);
  border-radius: 18px 12px 20px 14px;
  background: var(--paper-raised);
}

.confirm-q {
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: 2rem;
  line-height: 1.1;
  color: var(--red);
}

.confirm-info {
  color: var(--text);
}

.confirm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 6px;
}

/* ----------------------------------------------------------- result screen */

.result {
  display: grid;
  gap: 64px;
}

.grade-sheet {
  display: grid;
  gap: 22px;
  justify-items: start;
}

.result-title {
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: clamp(2.4rem, 6vw, 3.4rem);
  line-height: 1;
  color: var(--ink);
}

.status-note {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 40rem;
  font-weight: 700;
  color: var(--pencil);
}

.status-note .icon {
  width: 24px;
  height: 24px;
}

.status-note.is-expired {
  color: var(--red);
}

.status-tag {
  margin-left: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}

.grade-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 40px;
}

.grade {
  position: relative;
  width: min(84vw, 330px);
  aspect-ratio: 320 / 190;
  display: grid;
  place-items: center;
  color: var(--red);
}

.grade-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.grade-ring .pen {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: draw 0.9s cubic-bezier(0.55, 0.1, 0.35, 1) calc(var(--rd, 0s) + 0.75s) forwards;
}

.grade-score {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 2px;
  font-family: var(--font-hand);
  font-weight: 700;
  color: var(--red);
  transform: rotate(-6deg);
  animation: write-in 0.7s ease-out calc(var(--rd, 0s) + 0.1s) both;
}

.grade-num {
  font-size: clamp(5rem, 18vw, 7.5rem);
  line-height: 0.8;
}

.grade-max {
  font-size: clamp(2rem, 7vw, 2.8rem);
}

.grade-side {
  display: grid;
  gap: 14px;
  justify-items: start;
}

.remark {
  position: relative;
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: clamp(2.4rem, 7vw, 3.2rem);
  line-height: 1;
  color: var(--red);
  padding-bottom: 18px;
  transform: rotate(-3deg);
  animation: write-in 0.6s ease-out calc(var(--rd, 0s) + 1.5s) both;
}

.remark-line {
  position: absolute;
  left: -4%;
  bottom: 0;
  width: 108%;
  height: 18px;
}

.remark-line .pen {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: draw 0.45s ease-out calc(var(--rd, 0s) + 1.9s) forwards;
}

.remark-line .pen-2 {
  animation-delay: calc(var(--rd, 0s) + 2.15s);
}

.stickers {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.sticker {
  display: inline-flex;
  width: 54px;
  height: 54px;
  filter: drop-shadow(0 2px 0 var(--paper-raised)) drop-shadow(0 3px 4px rgba(0, 0, 0, 0.25));
}

.stickers .sticker {
  animation: sticker-slap 0.5s cubic-bezier(0.3, 1.6, 0.5, 1) both;
  animation-delay: calc(var(--rd, 0s) + 2.3s + var(--i, 0) * 0.18s);
}

.stickers .sticker:nth-child(1) { --i: 0; transform: rotate(-8deg); }
.stickers .sticker:nth-child(2) { --i: 1; transform: rotate(6deg); }
.stickers .sticker:nth-child(3) { --i: 2; transform: rotate(-3deg); }
.stickers .sticker:nth-child(4) { --i: 3; transform: rotate(9deg); }
.stickers .sticker:nth-child(5) { --i: 4; transform: rotate(-6deg); }

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 18px 40px;
  margin: 8px 0 0;
}

.stat {
  display: grid;
  grid-template-columns: 30px auto;
  column-gap: 10px;
  align-items: center;
}

.stat-icon {
  grid-row: span 2;
  width: 30px;
  height: 30px;
  color: var(--ink);
}

.stat .icon-heart {
  color: var(--heart);
}

.stat .icon-flame {
  color: var(--flame);
}

.stat dt {
  font-size: 0.95rem;
  color: var(--pencil);
  font-weight: 700;
}

.stat dd {
  margin: 0;
  font-weight: 800;
  font-size: 1.45rem;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 8px;
}

/* ------------------------------------------------------------ review cards */

.review {
  display: grid;
  gap: 0;
}

.review-intro {
  color: var(--pencil);
  margin-bottom: 8px;
}

.review-card {
  padding: 40px 0 8px;
  border-bottom: 2px dashed var(--grid-strong);
  display: grid;
  gap: 4px;
  min-width: 0;
}

.review-card .problem-text {
  margin-bottom: 18px;
}

.review-points {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: 1.8rem;
  line-height: 1;
  color: var(--red);
}

.review-helps {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: -4px 0 12px;
  color: var(--pencil);
  font-weight: 700;
}

.review-helps-icon {
  width: 20px;
  height: 20px;
  flex: none;
}

.review-mark {
  width: 32px;
  height: 32px;
  color: var(--red);
}

.answers {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 48px;
  margin-bottom: 22px;
}

.answer-title {
  font-weight: 800;
  font-size: 1rem;
  color: var(--pencil);
  margin-bottom: 6px;
}

.answer-list {
  margin: 0;
  display: grid;
  gap: 6px;
}

.answer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
}

.answer-row dt {
  color: var(--text);
}

.answer-row dd {
  margin: 0;
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-weight: 800;
  font-size: 1.3rem;
}

.answer-list.is-correct dd {
  color: var(--red);
}

.answer-list.is-yours dd {
  color: var(--pencil);
  text-decoration: line-through 2px var(--red);
}

.answer-grid {
  display: grid;
}

.grid3-mini {
  grid-template-columns: repeat(3, 44px);
  grid-auto-rows: 44px;
  border-width: 2px;
}

.grid3-mini .cell {
  font-size: 1.2rem;
}

.grid3-mini .cell-answer {
  color: var(--red);
}

.answer-list.is-yours .grid3-mini .cell-answer {
  color: var(--pencil);
}

.review-solution {
  min-width: 0;
  max-width: 52rem;
  margin-bottom: 18px;
}

.review-note {
  max-width: 60ch;
  margin-bottom: 18px;
  padding-left: 12px;
  border-left: 4px solid var(--marker);
  color: var(--text);
}

/* ------------------------------------------------------------------- toast */

.toast {
  position: fixed;
  z-index: 40;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  max-width: min(92vw, 30rem);
  padding: 14px 20px;
  font-weight: 700;
  color: var(--text);
  background: var(--paper-raised);
  border: 2px solid var(--ink);
  border-radius: 14px 12px 16px 13px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 24px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast:empty {
  padding: 0;
  border: 0;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.is-error {
  color: var(--red);
  border-color: var(--red);
}

.toast.is-warn {
  border-color: var(--red);
  background: var(--note);
  color: var(--note-ink);
}

/* -------------------------------------------------------------- keyframes */

@keyframes flame-up {
  0% { transform: scale(1); }
  40% { transform: scale(1.5) rotate(-8deg); }
  100% { transform: scale(1); }
}

@keyframes streak-reset {
  0% { opacity: 1; }
  40% { opacity: 0.3; transform: translateY(3px); }
  100% { opacity: 1; transform: none; }
}

@keyframes streak-pop {
  0% { opacity: 0; transform: translate(-50%, -6px) scale(0.6) rotate(-4deg); }
  15% { opacity: 1; transform: translate(-50%, 6px) scale(1.08) rotate(-4deg); }
  70% { opacity: 1; transform: translate(-50%, 6px) scale(1) rotate(-4deg); }
  100% { opacity: 0; transform: translate(-50%, 14px) scale(1) rotate(-4deg); }
}

@keyframes sticker-peel {
  from { opacity: 0; transform: translateY(-60px) rotate(-18deg) scale(1.35); }
  to { opacity: 1; transform: none; }
}

@keyframes sticker-leave {
  to { opacity: 0; transform: translateY(20px) scale(0.96); }
}

@keyframes confetti-fall {
  0% { transform: translate(0, 0) rotate(0deg); opacity: 1; }
  85% { opacity: 1; }
  100% { transform: translate(var(--drift), 112vh) rotate(var(--spin)); opacity: 0; }
}

@keyframes draw {
  to {
    stroke-dashoffset: 0;
  }
}

/* handwriting appears left to right; the end state is unclipped so slanted glyphs are not cut */
@keyframes write-in {
  from {
    clip-path: inset(-30% 100% -30% -30%);
  }
  to {
    clip-path: inset(-30% -30% -30% -30%);
  }
}

@keyframes sticker-slap {
  from {
    opacity: 0;
    scale: 1.9;
  }
  to {
    opacity: 1;
    scale: 1;
  }
}

@keyframes note-stick {
  from {
    opacity: 0;
    translate: 0 -16px;
    scale: 1.04;
  }
  to {
    opacity: 1;
    translate: 0 0;
    scale: 1;
  }
}

@keyframes heart-bump {
  0%,
  100% {
    transform: none;
  }
  30% {
    transform: scale(0.7);
  }
  60% {
    transform: scale(1.15);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ------------------------------------------------------------- small screens */

/* phones: the narrow margin (--margin is 44px there, /mudrica/mudrica.css) */
@media (max-width: 720px) {
  .page {
    padding-left: calc(var(--margin) + 12px);
  }

  .problem-no {
    left: calc(-1 * (var(--margin) + 12px));
  }
}

@media (max-width: 759px) {
  :root {
    --gutter: 14px;
  }

  .problem-no {
    font-size: 1.9rem;
  }

  .problem-text {
    font-size: 1.15rem;
  }
}

@media (max-width: 560px) {
  .hud {
    gap: 2px;
  }

  .hud-item {
    padding: 0 3px;
    gap: 4px;
  }

  .hud-player,
  .music-label,
  .hud-home-label {
    display: none;
  }

  .hud-home {
    padding: 0 9px;
  }

  .hud-score .icon {
    display: none;
  }

  .corner-mascot {
    left: 2px;
  }

  .mode-badge-text {
    display: none;
  }

  .mode-badge {
    padding: 0 8px;
  }

  .new-sticker {
    right: 12px;
    left: 12px;
    width: auto;
  }

  .hud-item .icon {
    width: 18px;
    height: 18px;
  }

  .hud-num {
    font-size: 1.15rem;
  }

  body[data-screen="game"] mudrica-header {
    gap: 4px;
  }

  .music-btn {
    padding: 0 10px;
  }

  .tablist {
    gap: 7px;
  }

  .tab {
    width: 52px;
    height: 64px;
  }

  .slot {
    width: 50px;
  }

  .tab-mark {
    top: -9px;
    right: -9px;
    width: 24px;
    height: 24px;
  }

  .grid3 {
    grid-template-columns: repeat(3, 60px);
    grid-auto-rows: 60px;
  }

  .help-btn {
    max-width: none;
  }

  .finish {
    justify-content: stretch;
  }

  .end-actions,
  .end-btn {
    width: 100%;
  }
}

/* -------------------------------------------------------- reduced motion */

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

  .boot-spinner {
    animation: none;
  }
}
