:root {
    color-scheme: light;
    --bg: #fff6e4;
    --bg-dot: #f5e4c3;
    --surface: #ffffff;
    --surface-soft: #fffaf0;
    --ink: #33291f;
    --ink-soft: #7a6a58;
    --line: #efdfc2;
    --line-strong: #e2cca4;
    --green: #3aa757;
    --green-dark: #2a8043;
    --green-soft: #e3f5e6;
    --blue: #2f8fe0;
    --blue-dark: #1f6db0;
    --blue-soft: #e2f0fc;
    --orange: #f28b2b;
    --orange-dark: #c96a12;
    --orange-soft: #fdeedd;
    --purple: #8f5ad8;
    --purple-dark: #6c3fb0;
    --purple-soft: #f0e8fb;
    --teal: #16a39a;
    --teal-dark: #0e7c75;
    --teal-soft: #dff5f3;
    --pink: #e0508f;
    --pink-dark: #b3336c;
    --pink-soft: #fce6f0;
    --indigo: #4f63d8;
    --indigo-dark: #3646ab;
    --indigo-soft: #e6e9fb;
    --lime: #6b9e1a;
    --lime-dark: #4e7610;
    --lime-soft: #eef5de;
    --brown: #b06f32;
    --brown-dark: #83501f;
    --brown-soft: #f7ebde;
    --navy: #2e5189;
    --navy-dark: #1f3861;
    --navy-soft: #e3eaf6;
    --plum: #a3478a;
    --plum-dark: #7a2f66;
    --plum-soft: #f6e6f1;
    --yellow: #ffc83d;
    --yellow-dark: #d9a011;
    --red: #e5533d;
    --red-dark: #b83a27;
    --red-soft: #fde6e1;
    --radius: 24px;
    --font: ui-rounded, "SF Pro Rounded", "Nunito", "Varela Round", "Segoe UI", system-ui, sans-serif;
    --tone: var(--green);
    --tone-dark: var(--green-dark);
    --tone-soft: var(--green-soft);
}

.tone-green { --tone: var(--green); --tone-dark: var(--green-dark); --tone-soft: var(--green-soft); }
.tone-blue { --tone: var(--blue); --tone-dark: var(--blue-dark); --tone-soft: var(--blue-soft); }
.tone-orange { --tone: var(--orange); --tone-dark: var(--orange-dark); --tone-soft: var(--orange-soft); }
.tone-purple { --tone: var(--purple); --tone-dark: var(--purple-dark); --tone-soft: var(--purple-soft); }
.tone-red { --tone: var(--red); --tone-dark: var(--red-dark); --tone-soft: var(--red-soft); }
.tone-teal { --tone: var(--teal); --tone-dark: var(--teal-dark); --tone-soft: var(--teal-soft); }
.tone-pink { --tone: var(--pink); --tone-dark: var(--pink-dark); --tone-soft: var(--pink-soft); }
.tone-indigo { --tone: var(--indigo); --tone-dark: var(--indigo-dark); --tone-soft: var(--indigo-soft); }
.tone-lime { --tone: var(--lime); --tone-dark: var(--lime-dark); --tone-soft: var(--lime-soft); }
.tone-brown { --tone: var(--brown); --tone-dark: var(--brown-dark); --tone-soft: var(--brown-soft); }
.tone-navy { --tone: var(--navy); --tone-dark: var(--navy-dark); --tone-soft: var(--navy-soft); }
.tone-plum { --tone: var(--plum); --tone-dark: var(--plum-dark); --tone-soft: var(--plum-soft); }

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

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100dvh;
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.45;
    color: var(--ink);
    background: radial-gradient(var(--bg-dot) 1.6px, transparent 1.7px) 0 0 / 24px 24px, var(--bg);
    -webkit-tap-highlight-color: transparent;
}

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

a {
    color: inherit;
}

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

svg,
img {
    display: block;
}

.app {
    max-width: 720px;
    margin: 0 auto;
    padding:
        max(10px, env(safe-area-inset-top))
        max(16px, env(safe-area-inset-right))
        24px
        max(16px, env(safe-area-inset-left));
}

.notice {
    margin-top: 20px;
    padding: 12px 16px;
    border-radius: 16px;
    background: var(--red-soft);
    color: var(--red-dark);
    font-weight: 700;
    text-align: center;
}

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

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5em;
    min-height: 52px;
    padding: .7em 1.3em;
    border: 0;
    border-radius: 18px;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 1.1rem;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
    box-shadow: inset 0 0 0 2px var(--line), 0 4px 0 var(--line-strong);
    transition: transform .08s, box-shadow .08s;
    touch-action: manipulation;
}

.button:active {
    transform: translateY(3px);
    box-shadow: inset 0 0 0 2px var(--line), 0 1px 0 var(--line-strong);
}

.button--primary {
    background: var(--tone);
    color: #fff;
    box-shadow: 0 4px 0 var(--tone-dark);
}

.button--primary:active {
    box-shadow: 0 1px 0 var(--tone-dark);
}

.button:disabled {
    background: var(--line);
    color: var(--ink-soft);
    box-shadow: none;
    transform: none;
    cursor: default;
}

.button--block {
    width: 100%;
}

.button--big {
    min-height: 60px;
    font-size: 1.3rem;
}

.icon-button {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border: 0;
    border-radius: 16px;
    background: var(--surface);
    color: var(--ink);
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 4px 0 var(--line-strong);
    transition: transform .08s, box-shadow .08s;
    touch-action: manipulation;
}

.icon-button:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 var(--line-strong);
}

.icon-button svg {
    width: 24px;
    height: 24px;
}

.icon-button[aria-pressed="false"] {
    color: var(--ink-soft);
}

.link-button {
    padding: 8px;
    border: 0;
    background: none;
    color: var(--ink-soft);
    font: inherit;
    font-size: .95rem;
    text-decoration: underline;
    cursor: pointer;
}

.chevron {
    flex: none;
    width: 22px;
    height: 22px;
    color: var(--ink-soft);
}

.chevron svg {
    width: 100%;
    height: 100%;
}

/* ------------------------------------------------------------ topbar */

.topbar {
    display: grid;
    grid-template-columns: 48px 1fr 48px;
    align-items: center;
    gap: 10px;
    min-height: 56px;
    margin-bottom: 12px;
}

.topbar-title {
    min-width: 0;
    text-align: center;
}

.topbar-title h1 {
    overflow: hidden;
    font-size: 1.35rem;
    font-weight: 900;
    line-height: 1.15;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.topbar-title p {
    overflow: hidden;
    color: var(--ink-soft);
    font-size: .9rem;
    font-weight: 700;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.screen-lead {
    max-width: 52ch;
    margin: 0 auto 20px;
    color: var(--ink-soft);
    font-size: 1.05rem;
    text-align: center;
}

.screen-lead b {
    color: var(--ink);
}

/* ------------------------------------------------------------ home */

.hero {
    padding: 0 0 24px;
    text-align: center;
}

.hero-art {
    display: block;
    width: min(230px, 62vw);
    aspect-ratio: 1;
    margin: 0 auto;
    padding: 0;
    overflow: hidden;
    border: 5px solid var(--surface);
    border-radius: 40px;
    background: var(--surface);
    cursor: pointer;
    box-shadow: 0 8px 0 var(--line-strong);
    transform: rotate(-2deg);
}

.hero-art img {
    width: 100%;
    height: 100%;
}

.hero-caption {
    margin-top: 14px;
    color: var(--ink-soft);
    font-weight: 700;
}

.hero-mascot {
    position: relative;
    width: min(200px, 52vw);
    margin: 0 auto;
    padding-top: 8px;
}

.hero-mascot img {
    display: block;
    width: 100%;
    height: auto;
    animation: bob 2.6s ease-in-out infinite;
}

.hero-bubble {
    position: absolute;
    top: 0;
    right: -46%;
    padding: 8px 14px;
    border: 3px solid var(--ink);
    border-radius: 18px 18px 18px 4px;
    background: var(--surface);
    font-weight: 900;
    white-space: nowrap;
    transform: rotate(4deg);
}

.hero-title {
    margin-top: 18px;
    font-size: clamp(2.6rem, 11vw, 3.6rem);
    font-weight: 900;
    line-height: 1;
    letter-spacing: -.02em;
}

.hero-title span {
    color: var(--green);
}

.hero-lead {
    max-width: 30ch;
    margin: 10px auto 0;
    color: var(--ink-soft);
    font-size: 1.1rem;
}

.section-title {
    margin: 0 4px 12px;
    font-size: 1.2rem;
    font-weight: 900;
}

.subject-list {
    display: grid;
    gap: 12px;
    margin-bottom: 20px;
}

.subject-card,
.collection-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    border-radius: var(--radius);
    background: var(--surface);
    color: inherit;
    text-decoration: none;
    box-shadow: 0 6px 0 var(--line-strong);
    transition: transform .1s;
}

a.subject-card:active,
.collection-card:active {
    transform: translateY(3px);
}

.subject-icon {
    display: grid;
    flex: none;
    place-items: center;
    width: 64px;
    height: 64px;
    border-radius: 20px;
    background: var(--green);
    color: #fff;
    font-size: 1.35rem;
    font-weight: 900;
    box-shadow: inset 0 -5px 0 rgb(0 0 0 / .15);
}

.subject-body,
.collection-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.subject-body strong,
.collection-body strong {
    font-size: 1.3rem;
    font-weight: 900;
}

.subject-body small,
.collection-body small {
    color: var(--ink-soft);
    font-size: .95rem;
    font-weight: 700;
}

.progress {
    display: block;
    height: 10px;
    margin-top: 6px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--line);
}

.progress span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--yellow);
}

.collection-thumbs {
    display: flex;
    flex: none;
}

.collection-thumb {
    width: 52px;
    height: 52px;
    overflow: hidden;
    border: 3px solid var(--surface);
    border-radius: 50%;
    background: var(--surface-soft);
    box-shadow: 0 2px 0 var(--line-strong);
}

.collection-thumb + .collection-thumb {
    margin-left: -18px;
}

.collection-thumb img {
    width: 100%;
    height: 100%;
}

/* ------------------------------------------------------------ topics */

.topic-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

.topic-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 168px;
    padding: 18px;
    overflow: hidden;
    border-radius: 28px;
    background: var(--tone);
    color: #fff;
    text-decoration: none;
    box-shadow: 0 6px 0 var(--tone-dark);
    transition: transform .1s;
}

.topic-card:active {
    transform: translateY(3px);
}

.topic-card::after {
    content: "";
    position: absolute;
    right: -30px;
    bottom: -30px;
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: rgb(255 255 255 / .12);
}

.topic-symbol {
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    border-radius: 20px;
    background: rgb(255 255 255 / .22);
    font-size: 2.8rem;
    font-weight: 900;
    line-height: 1;
}

.topic-symbol.is-word {
    align-self: flex-start;
    width: auto;
    min-width: 64px;
    padding: 0 12px;
    font-size: 1.6rem;
}

.topic-name {
    margin-top: auto;
    font-size: 1.35rem;
    font-weight: 900;
}

.topic-medals {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.medal-dot {
    flex: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgb(255 255 255 / .3);
}

.medal-dot.is-earned {
    background: var(--yellow);
    box-shadow: 0 0 0 2px #fff;
}

/* ------------------------------------------------------------ level path */

.level-path {
    position: relative;
    display: grid;
    gap: 14px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.level-path::before {
    content: "";
    position: absolute;
    top: 40px;
    bottom: 40px;
    left: 42px;
    border-left: 5px dotted var(--line-strong);
}

.level-button {
    position: relative;
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    padding: 12px 16px 12px 12px;
    border: 0;
    border-radius: var(--radius);
    background: var(--surface);
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    box-shadow: 0 6px 0 var(--line-strong);
    transition: transform .1s;
}

.level-button:active:not(:disabled) {
    transform: translateY(3px);
}

.level-button:disabled {
    background: var(--surface-soft);
    cursor: not-allowed;
    box-shadow: 0 6px 0 var(--line);
}

.level-bubble {
    display: grid;
    flex: none;
    place-items: center;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: var(--tone);
    color: #fff;
    font-size: 1.6rem;
    font-weight: 900;
    box-shadow: 0 4px 0 var(--tone-dark);
}

.level-bubble svg {
    width: 28px;
    height: 28px;
}

.is-done .level-bubble {
    background: var(--yellow);
    color: var(--ink);
    box-shadow: 0 4px 0 var(--yellow-dark);
}

.is-locked .level-bubble {
    background: #e3d7c1;
    color: #b3a386;
    box-shadow: 0 4px 0 #cdbd9f;
}

.is-next .level-bubble {
    animation: pulse 1.8s ease-in-out infinite;
}

.level-text {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
}

.level-text small {
    color: var(--tone-dark);
    font-size: .8rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.is-locked .level-text small,
.is-locked .level-text strong {
    color: var(--ink-soft);
}

.level-text strong {
    font-size: 1.15rem;
    font-weight: 900;
    line-height: 1.2;
}

.level-text span {
    color: var(--ink-soft);
    font-size: .92rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------ dialogs */

.dialog {
    width: min(460px, calc(100vw - 24px));
    max-height: calc(100dvh - 24px);
    padding: 0;
    overflow: auto;
    border: 0;
    border-radius: 30px;
    background: var(--surface);
    color: var(--ink);
    box-shadow: 0 24px 60px rgb(51 41 31 / .35);
    overscroll-behavior: contain;
}

.dialog::backdrop {
    background: rgb(51 41 31 / .55);
}

.dialog[open] > :not(canvas) {
    animation: dialog-in .32s cubic-bezier(.2, 1.3, .4, 1);
}

.dialog-close {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 1;
    box-shadow: inset 0 0 0 2px var(--line), 0 3px 0 var(--line-strong);
}

.eyebrow {
    color: var(--tone-dark);
    font-size: .85rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.dialog-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 20px;
}

.dialog-actions > :only-child {
    grid-column: 1 / -1;
}

.sheet {
    position: relative;
    padding: 24px 20px 22px;
}

.sheet-title {
    margin: 4px 56px 6px 0;
    font-size: 1.6rem;
    font-weight: 900;
    line-height: 1.15;
}

.sheet-example {
    color: var(--ink-soft);
    font-weight: 700;
}

.sheet-example span {
    display: inline-block;
    margin-left: 4px;
    padding: 2px 10px;
    border-radius: 10px;
    background: var(--tone-soft);
    color: var(--tone-dark);
    font-weight: 900;
    font-variant-numeric: tabular-nums;
}

.sheet-reference {
    margin-top: 10px;
    padding: 10px 14px;
    border-radius: 16px;
    background: var(--tone-soft);
    color: var(--ink);
    font-size: .95rem;
    font-weight: 700;
    line-height: 1.4;
}

.facts {
    display: grid;
    gap: 6px;
    margin: 18px 0 0;
    padding: 12px 14px;
    border-radius: 18px;
    background: var(--surface-soft);
    box-shadow: inset 0 0 0 2px var(--line);
}

.facts div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.facts dt {
    color: var(--ink-soft);
    font-weight: 700;
}

.facts dd {
    margin: 0;
    font-weight: 800;
    text-align: right;
}

.recent-tests {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin-top: 12px;
    color: var(--ink-soft);
    font-size: .9rem;
    font-weight: 700;
}

.recent-tests span {
    padding: 2px 8px;
    border-radius: 8px;
    background: var(--line);
    color: var(--ink);
}

.mode-grid {
    display: grid;
    gap: 12px;
    margin-top: 20px;
}

.mode-card {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 16px 18px;
    border: 0;
    border-radius: 22px;
    color: #fff;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: transform .08s, box-shadow .08s;
    touch-action: manipulation;
}

.mode-card strong {
    font-size: 1.35rem;
    font-weight: 900;
}

.mode-card span {
    font-weight: 700;
    opacity: .92;
}

.mode-card--practice {
    background: var(--tone);
    box-shadow: 0 5px 0 var(--tone-dark);
}

.mode-card--test {
    background: var(--ink);
    box-shadow: 0 5px 0 #000;
}

.mode-card:active {
    transform: translateY(4px);
    box-shadow: 0 1px 0 rgb(0 0 0 / .4);
}

.goat-detail,
.celebration {
    position: relative;
    padding: 22px 20px 22px;
    text-align: center;
}

.dialog--goat {
    overflow-x: hidden;
    touch-action: pan-y;
}

.goat-detail {
    transition: translate .2s ease-out;
}

.goat-detail.is-dragged {
    transition: none;
}

.dialog[open] > .goat-detail.is-from-next {
    animation: goat-from-next .28s ease-out;
}

.dialog[open] > .goat-detail.is-from-previous {
    animation: goat-from-previous .28s ease-out;
}

.goat-detail-stage {
    position: relative;
    width: min(300px, 72vw);
    margin: 22px auto 16px;
}

.goat-detail-art {
    overflow: hidden;
    border-radius: 26px;
    box-shadow: 0 6px 0 var(--line-strong);
}

.goat-step {
    position: absolute;
    top: calc(50% - 24px);
    border-radius: 50%;
    box-shadow: inset 0 0 0 2px var(--line), 0 3px 0 var(--line-strong);
}

.goat-step--previous {
    left: -22px;
}

.goat-step--next {
    right: -22px;
}

.goat-step:disabled {
    visibility: hidden;
}

.goat-detail-art img {
    display: block;
    width: 100%;
    height: auto;
}

.goat-detail-name,
.celebration-name {
    margin-top: 2px;
    font-size: 1.7rem;
    font-weight: 900;
    line-height: 1.15;
}

.goat-detail-text,
.celebration-text {
    max-width: 34ch;
    margin: 8px auto 0;
    font-size: 1.05rem;
}

.goat-detail-meta {
    margin-top: 14px;
    color: var(--ink-soft);
    font-size: .95rem;
    font-weight: 700;
}

.celebration .eyebrow {
    color: var(--yellow-dark);
    font-size: 1.1rem;
}

.celebration-stage {
    position: relative;
    width: min(250px, 64vw);
    margin: 18px auto 14px;
}

.celebration-stage::before {
    content: "";
    position: absolute;
    inset: -14%;
    border-radius: 50%;
    background: repeating-conic-gradient(rgb(255 200 61 / .45) 0 10deg, transparent 10deg 20deg);
    -webkit-mask: radial-gradient(closest-side, #000 55%, transparent);
    mask: radial-gradient(closest-side, #000 55%, transparent);
    animation: spin 16s linear infinite;
}

.celebration-stage img {
    display: block;
    height: auto;
    position: relative;
    width: 100%;
    overflow: hidden;
    border: 4px solid var(--surface);
    border-radius: 28px;
    box-shadow: 0 8px 0 var(--line-strong);
    animation: goat-reveal .8s cubic-bezier(.2, 1.5, .4, 1) both .15s;
}

.celebration-medal {
    display: grid;
    place-items: center;
    width: 140px;
    height: 140px;
    margin: 18px auto 14px;
    border: 8px solid #fff3c9;
    border-radius: 50%;
    background: var(--yellow);
    color: var(--ink);
    box-shadow: 0 8px 0 var(--yellow-dark);
    animation: goat-reveal .8s cubic-bezier(.2, 1.5, .4, 1) both .15s;
}

.celebration-medal svg {
    width: 64px;
    height: 64px;
}

.celebration-count {
    color: var(--ink-soft);
    font-weight: 800;
}

.celebration-unlock,
.celebration-final {
    margin-top: 14px;
    padding: 10px 14px;
    border-radius: 16px;
    background: var(--tone-soft);
    color: var(--tone-dark);
    font-weight: 700;
}

.celebration-final {
    background: #fff3c9;
    color: #8a6400;
    font-weight: 900;
}

.fireworks {
    position: fixed;
    inset: 0;
    z-index: 50;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* ------------------------------------------------------------ play */

.play-body {
    display: flex;
    flex-direction: column;
}

.meter {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 7px;
}

.meter-slot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #efe2c9;
    box-shadow: inset 0 -3px 0 rgb(0 0 0 / .07);
    transition: background .2s, transform .25s cubic-bezier(.2, 1.6, .4, 1);
}

.meter-slot.is-filled {
    background: var(--tone);
    box-shadow: inset 0 -3px 0 var(--tone-dark);
    transform: scale(1.12);
}

.meter-slot.is-wrong {
    background: var(--red);
    box-shadow: inset 0 -3px 0 var(--red-dark);
}

.meter-slot.is-current {
    box-shadow: inset 0 0 0 3px var(--tone);
}

.meter-label {
    margin: 8px 0 14px;
    color: var(--ink-soft);
    font-weight: 800;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.meter-label b {
    color: var(--tone-dark);
}

.meter-label span {
    font-weight: 700;
}

.problem {
    display: grid;
    gap: 12px;
}

.problem-card {
    position: relative;
    padding: 26px 14px;
    overflow: hidden;
    border-radius: 30px;
    background: var(--surface);
    box-shadow: 0 6px 0 var(--line-strong);
}

.equation {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: .15em .3em;
    font-size: clamp(2rem, 9.5vw, 3.5rem);
    font-weight: 900;
    line-height: 1.1;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    cursor: text;
}

.equation-equals {
    color: var(--ink-soft);
}

.answer {
    width: 2.9em;
    min-width: 0;
    padding: .06em .1em;
    border: 0;
    border-radius: 18px;
    background: var(--surface-soft);
    color: var(--ink);
    font: inherit;
    text-align: center;
    caret-color: var(--tone);
    box-shadow: inset 0 0 0 3px var(--line-strong);
    transition: box-shadow .15s, background .15s, color .15s;
}

.answer:focus {
    outline: none;
    box-shadow: inset 0 0 0 4px var(--tone);
}

.problem-card.is-correct {
    animation: pop .35s cubic-bezier(.2, 1.6, .4, 1);
}

.problem-card.is-correct .answer {
    background: var(--green-soft);
    color: var(--green-dark);
    box-shadow: inset 0 0 0 4px var(--green);
}

.problem-card.is-wrong {
    animation: shake .42s;
}

.problem-card.is-wrong .answer {
    background: var(--red-soft);
    color: var(--red-dark);
    box-shadow: inset 0 0 0 4px var(--red);
}

.problem-card.is-revealed .answer {
    background: var(--yellow);
    color: var(--ink);
    box-shadow: inset 0 0 0 4px var(--yellow-dark);
}

.timer {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
}

.timer-track {
    flex: 1;
    height: 12px;
    overflow: hidden;
    border-radius: 999px;
    background: #f1e6d0;
}

.timer-bar {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--tone);
    transform-origin: left center;
    transition: transform .1s linear;
}

.timer-seconds {
    min-width: 2ch;
    font-weight: 900;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.timer.is-urgent .timer-bar {
    background: var(--red);
}

.timer.is-urgent .timer-seconds {
    color: var(--red);
    animation: pop .4s;
}

.countdown {
    position: absolute;
    inset: 0;
    display: none;
    place-items: center;
    background: var(--surface);
    color: var(--tone);
    font-size: clamp(3rem, 16vw, 5rem);
    font-weight: 900;
}

.countdown.is-visible {
    display: grid;
}

.countdown span {
    animation: countdown .6s cubic-bezier(.2, 1.4, .4, 1);
}

.feedback {
    min-height: 1.5em;
    font-size: 1.15rem;
    font-weight: 800;
    text-align: center;
}

.feedback--correct {
    color: var(--green-dark);
}

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

.feedback--hint {
    color: var(--ink-soft);
}

.play-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-top: 10px;
}

.play-mascot {
    width: 120px;
    height: auto;
}

.play-stats {
    color: var(--ink-soft);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.play-body > .feedback {
    margin-top: 12px;
}

/* ------------------------------------------------------------ vocabulary */

.vocab-card {
    padding: 20px 16px 22px;
    text-align: center;
}

.vocab-direction {
    color: var(--tone-dark);
    font-size: .85rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.vocab-again {
    display: inline-block;
    margin-right: 8px;
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--yellow);
    color: var(--ink);
    letter-spacing: .04em;
}

.vocab-again[hidden] {
    display: none;
}

.vocab-word {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px 12px;
    margin-top: 6px;
    font-size: clamp(2rem, 9vw, 3rem);
    font-weight: 900;
    line-height: 1.1;
}

.vocab-sentence {
    margin-top: 12px;
    color: var(--ink-soft);
    font-size: 1.15rem;
    font-weight: 700;
}

.vocab-card mark,
.vocab-example mark {
    padding: 0 .2em;
    border-radius: 6px;
    background: var(--tone-soft);
    color: var(--tone-dark);
}

.speak-button {
    flex: none;
    width: 44px;
    height: 44px;
    color: var(--tone-dark);
    box-shadow: inset 0 0 0 2px var(--line), 0 3px 0 var(--line-strong);
}

.speak-button[hidden] {
    display: none;
}

.choices {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 14px;
}

.choices[hidden] {
    display: none;
}

.choice {
    position: relative;
    min-height: 68px;
    padding: 12px 10px;
    border: 0;
    border-radius: 20px;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 1.2rem;
    font-weight: 800;
    line-height: 1.2;
    cursor: pointer;
    box-shadow: inset 0 0 0 2px var(--line), 0 4px 0 var(--line-strong);
    transition: transform .08s, box-shadow .08s;
    touch-action: manipulation;
}

.choice:active:not(:disabled) {
    transform: translateY(3px);
    box-shadow: inset 0 0 0 2px var(--line), 0 1px 0 var(--line-strong);
}

.choice:disabled {
    cursor: default;
}

.choice-key {
    position: absolute;
    top: 6px;
    left: 10px;
    color: var(--ink-soft);
    font-size: .75rem;
    opacity: .7;
}

.choice.is-correct {
    background: var(--green);
    color: #fff;
    box-shadow: 0 4px 0 var(--green-dark);
    animation: pop .35s cubic-bezier(.2, 1.6, .4, 1);
}

.choice.is-correct .choice-key {
    color: #fff;
}

.choice.is-wrong {
    background: var(--red-soft);
    color: var(--red-dark);
    box-shadow: inset 0 0 0 3px var(--red);
    animation: shake .42s;
}

.vocab-example {
    display: grid;
    gap: 10px;
    margin-top: 14px;
    padding: 18px 16px 16px;
    border-radius: 28px;
    background: var(--surface);
    text-align: center;
    box-shadow: 0 6px 0 var(--line-strong);
    animation: dialog-in .3s cubic-bezier(.2, 1.3, .4, 1);
}

.vocab-example[hidden] {
    display: none;
}

.vocab-pair {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px 12px;
    font-size: 1.5rem;
    font-weight: 900;
}

.vocab-pair b:last-child {
    color: var(--tone-dark);
}

.vocab-example-en {
    font-size: 1.25rem;
    font-weight: 800;
}

.vocab-example-cs {
    color: var(--ink-soft);
    font-size: 1.05rem;
    font-weight: 700;
}

/* ------------------------------------------------------------ listening */

.listen-card {
    padding: 20px 16px 22px;
    text-align: center;
}

.listen-task {
    color: var(--tone-dark);
    font-size: .85rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.listen-play {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    padding: 14px 26px 14px 20px;
    border: 0;
    border-radius: 999px;
    background: var(--tone);
    color: #fff;
    font: inherit;
    font-size: 1.3rem;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 5px 0 var(--tone-dark);
    transition: transform .08s, box-shadow .08s;
    touch-action: manipulation;
}

.listen-play:active {
    transform: translateY(3px);
    box-shadow: 0 2px 0 var(--tone-dark);
}

.listen-play[hidden] {
    display: none;
}

.listen-play svg {
    width: 34px;
    height: 34px;
}

.listen-unsupported {
    margin-top: 12px;
    color: var(--red-dark);
    font-weight: 700;
}

/* Whole sentences don't fit two to a row on a phone. */
.listen-choices {
    grid-template-columns: 1fr;
}

.listen-choice {
    min-height: 56px;
    padding: 12px 14px 12px 36px;
    font-size: 1.1rem;
    text-align: left;
}

.listen-choice .choice-key {
    top: 50%;
    left: 14px;
    transform: translateY(-50%);
}

/* ------------------------------------------------------------ spelling (i/y, ě/je, mě/mně) */

.spelling-card {
    padding: 20px 16px 22px;
    text-align: center;
}

.spelling-task {
    color: var(--tone-dark);
    font-size: .85rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.spelling-sentence {
    margin-top: 10px;
    font-size: clamp(1.45rem, 6.4vw, 2.1rem);
    font-weight: 800;
    line-height: 1.45;
}

.spelling-word {
    color: var(--tone-dark);
    white-space: nowrap;
}

/* --gap-letters: the longest option (y = 1, je = 2, mně = 3), set by SpellingView. */
.spelling-gap {
    display: inline-block;
    width: calc(.45em + var(--gap-letters, 1) * .65em);
    height: 1.2em;
    margin: 0 .06em;
    border-radius: 8px;
    background: var(--surface-soft);
    color: var(--ink);
    line-height: 1.2em;
    text-align: center;
    box-shadow: inset 0 0 0 3px var(--tone);
}

/*
 * An empty inline-block sits on its bottom edge, a filled one on its text, so the gap would drop
 * a few pixels once filled. An invisible character gives it a text baseline from the start, and
 * the filled-in letter then sits on the line like the rest of the word.
 */
.spelling-gap::before,
.grammar-gap::before {
    content: '\200b';
}

.spelling-gap.is-correct,
.grammar-gap.is-correct {
    background: var(--green-soft);
    color: var(--green-dark);
    box-shadow: inset 0 0 0 3px var(--green);
    animation: pop .35s cubic-bezier(.2, 1.6, .4, 1);
}

.spelling-gap.is-revealed,
.grammar-gap.is-revealed {
    background: var(--yellow);
    box-shadow: inset 0 0 0 3px var(--yellow-dark);
    animation: pop .35s cubic-bezier(.2, 1.6, .4, 1);
}

.spelling-why {
    margin-top: 12px;
    color: var(--ink-soft);
    font-size: 1.05rem;
    font-weight: 700;
}

.spelling-why b {
    color: var(--ink);
}

.spelling-choices {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 14px;
}

.spelling-choice {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 84px;
}

.spelling-letter {
    font-size: 2.6rem;
    font-weight: 900;
    line-height: 1;
}

.spelling-choice small {
    color: var(--ink-soft);
    font-size: .75rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.spelling-choice.is-correct small {
    color: #fff;
}

.spelling-choice.is-wrong small {
    color: var(--red-dark);
}

.spelling-next {
    margin-top: 14px;
}

.spelling-next[hidden] {
    display: none;
}

/* ------------------------------------------------------------ grammar */

.grammar-card {
    padding: 20px 16px 22px;
    text-align: center;
}

.grammar-sentence {
    margin-top: 10px;
    font-size: clamp(1.35rem, 5.8vw, 1.9rem);
    font-weight: 800;
    line-height: 1.5;
}

/* Empty it is a box to fill in; with the word inside it grows to fit. */
.grammar-gap {
    display: inline-block;
    min-width: 2.4em;
    height: 1.3em;
    padding: 0 .25em;
    border-radius: 10px;
    background: var(--surface-soft);
    color: var(--ink);
    line-height: 1.3em;
    box-shadow: inset 0 0 0 3px var(--tone);
}

.grammar-translation {
    margin-top: 8px;
    color: var(--ink-soft);
    font-size: 1.05rem;
    font-weight: 700;
}

.grammar-choices.is-three-columns {
    grid-template-columns: repeat(3, 1fr);
}

.grammar-choice {
    min-height: 64px;
    padding: 12px 6px;
    font-size: 1.45rem;
    font-weight: 900;
}

/* ------------------------------------------------------------ geometry */

.figure-card {
    padding: 16px 12px 18px;
    text-align: center;
}

.figure-task {
    font-size: clamp(1.15rem, 5vw, 1.45rem);
    font-weight: 900;
    line-height: 1.3;
}

.figure {
    margin-top: 10px;
}

.fig {
    display: block;
    width: 100%;
    height: auto;
    overflow: hidden;
    border-radius: 16px;
    background: var(--surface-soft);
}

.fig-grid {
    fill: none;
    stroke: #d6e6f5;
    stroke-width: 1;
}

.fig-shape {
    fill: var(--tone-soft);
    stroke: var(--ink);
    stroke-width: 3;
    stroke-linejoin: round;
}

.fig-shape.is-open {
    fill: none;
}

.fig-segment,
.fig-line {
    stroke: var(--ink);
    stroke-width: 3;
    stroke-linecap: round;
}

.fig-segment.is-dashed,
.fig-line.is-dashed {
    stroke: var(--tone);
    stroke-dasharray: 6 6;
}

.fig-arc {
    fill: var(--tone-soft);
    stroke: var(--tone);
    stroke-width: 2.4;
}

.fig-corner {
    fill: none;
    stroke: var(--tone);
    stroke-width: 2.4;
    stroke-dasharray: 5 4;
}

.fig-mark {
    fill: none;
    stroke: var(--tone);
    stroke-width: 3;
}

.fig-point {
    fill: var(--ink);
    stroke: var(--surface);
    stroke-width: 1.6;
}

.fig-point.is-asked {
    fill: var(--tone);
}

.fig-label {
    fill: var(--ink);
    font: 900 18px var(--font);
    text-anchor: middle;
    dominant-baseline: central;
    paint-order: stroke;
    stroke: var(--surface-soft);
    stroke-width: 5px;
    stroke-linejoin: round;
}

.fig-tag circle {
    fill: var(--tone);
}

.fig-tag .fig-label {
    fill: #fff;
    font-size: 15px;
    stroke: none;
}

/* The hint in the drawing – the notebook's corner, the rest of a line – comes with the answer. */
.fig-reveal {
    display: none;
}

.figure-card.is-answered .fig-reveal {
    display: inline;
}

.figure-choices {
    grid-template-columns: repeat(var(--figure-columns, 2), 1fr);
}

.figure-choice {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 64px;
    padding: 12px 6px;
    font-size: 1.25rem;
    font-weight: 900;
}

.figure-symbol {
    color: var(--ink-soft);
    font-size: 1.35rem;
    line-height: 1;
    font-weight: 900;
}

.figure-choice.is-correct .figure-symbol {
    color: #fff;
}

.figure-choice.is-wrong .figure-symbol {
    color: var(--red-dark);
}

/* ------------------------------------------------------------ test result */

.result {
    text-align: center;
}

.grade-stamp {
    display: grid;
    place-items: center;
    width: 128px;
    height: 128px;
    margin: 12px auto 16px;
    border: 7px solid var(--red);
    border-radius: 50%;
    color: var(--red);
    font-size: 4.6rem;
    font-weight: 900;
    line-height: 1;
    transform: rotate(-12deg);
    animation: stamp .5s cubic-bezier(.2, 1.5, .4, 1) both;
}

.result-title {
    font-size: 2rem;
    font-weight: 900;
}

.result-score {
    margin-top: 4px;
    color: var(--ink-soft);
    font-size: 1.15rem;
    font-weight: 700;
}

.result-score b {
    color: var(--ink);
}

.result-perfect {
    margin-top: 18px;
    font-size: 1.1rem;
    font-weight: 800;
}

.result-subtitle {
    margin: 24px 0 10px;
    font-size: 1.1rem;
    font-weight: 900;
}

.mistakes {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
    text-align: left;
}

.mistakes li {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 4px 12px;
    padding: 10px 14px;
    border-radius: 16px;
    background: var(--surface);
    box-shadow: inset 0 0 0 2px var(--line);
}

.mistake-question {
    font-size: 1.2rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.mistake-question b {
    color: var(--green-dark);
}

.mistake-given {
    color: var(--red-dark);
    font-weight: 700;
}

.result-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 24px;
}

/* ------------------------------------------------------------ about */

.app-footer {
    margin-top: 28px;
    text-align: center;
}

.info-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

.info-link svg {
    width: 18px;
    height: 18px;
}

.backup {
    position: relative;
    padding: 24px 20px 22px;
}

/* Bigger than the other dialogs, and the same height on both pages, so switching doesn't jump. */
.dialog--about {
    width: min(760px, calc(100vw - 24px));
    height: min(760px, calc(100dvh - 24px));
}

.about {
    padding: 0 20px 24px;
}

/* The title and the tabs stay on top while the long install guide scrolls. */
.about-header {
    position: sticky;
    top: 0;
    z-index: 1;
    margin: 0 -20px 6px;
    padding: 24px 20px 14px;
    background: var(--surface);
}

.about-title,
.backup-title {
    margin: 2px 56px 10px 0;
    font-size: 1.6rem;
    font-weight: 900;
}

.about h3 {
    margin: 18px 0 4px;
    font-size: 1.05rem;
    font-weight: 900;
}

.about a {
    color: var(--green-dark);
    font-weight: 800;
}

.about .button {
    margin-top: 10px;
}

.install-page,
.install-guide {
    display: grid;
    gap: 14px;
    align-content: start;
}

.install-page {
    padding-top: 10px;
}

.install-shortcut {
    padding: 12px 14px;
    border-radius: 18px;
    background: var(--green-soft);
    font-weight: 700;
}

.install-steps {
    display: grid;
    gap: 14px;
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: install-step;
}

.install-step {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px;
    border-radius: 20px;
    background: var(--surface-soft);
    box-shadow: inset 0 0 0 2px var(--line);
    counter-increment: install-step;
}

.install-step p {
    position: relative;
    min-height: 28px;
    padding-left: 38px;
}

/* Orange like the circles in the pictures that show where to tap. */
.install-step p::before {
    content: counter(install-step);
    position: absolute;
    top: -2px;
    left: 0;
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--orange);
    color: #fff;
    font-weight: 900;
}

.install-step img {
    width: 100%;
    max-width: 360px;
    height: auto;
    margin: auto auto 0;
    border-radius: 14px;
}

.install-note {
    padding: 12px 14px;
    border-radius: 18px;
    background: var(--orange-soft);
}

/* ------------------------------------------------------------ for parents */

.parents-panel {
    margin-top: 16px;
    padding: 18px 16px;
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 6px 0 var(--line-strong);
}

.parents-panel h2 {
    font-size: 1.2rem;
    font-weight: 900;
}

.parents-panel p {
    margin-top: 6px;
    color: var(--ink-soft);
    font-weight: 700;
}

.parents-panel .button {
    margin-top: 14px;
}

/* ------------------------------------------------------------ backup */

.backup-panel {
    margin-top: 28px;
    padding: 18px 16px;
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 6px 0 var(--line-strong);
    text-align: center;
}

.backup-panel h2 {
    font-size: 1.2rem;
    font-weight: 900;
}

.backup-panel p {
    margin: 4px 0 14px;
    color: var(--ink-soft);
    font-weight: 700;
}

.backup-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.backup-text {
    display: block;
    width: 100%;
    margin-top: 14px;
    padding: 12px 14px;
    border: 2px solid var(--line-strong);
    border-radius: 16px;
    background: var(--surface-soft);
    color: var(--ink);
    font: inherit;
    /* At least 16px, or iOS zooms the page in when the field gets focus. */
    font-size: 1rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
    resize: vertical;
}

.backup-status {
    margin-top: 10px;
    color: var(--green-dark);
    font-weight: 800;
}

.backup-status:empty {
    display: none;
}

.backup-status.is-error {
    color: var(--red-dark);
}

.backup-contents {
    font-size: 1.05rem;
}

.backup-warning {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 16px;
    background: var(--orange-soft);
    color: var(--orange-dark);
    font-weight: 700;
}

.backup-warning b {
    color: var(--red-dark);
}

.backup--done {
    text-align: center;
}

.backup--done .backup-title {
    margin: 0 0 6px;
}

.backup-mascot {
    width: min(150px, 40vw);
    height: auto;
    margin: 0 auto 8px;
}

.site-footer {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 16px calc(24px + env(safe-area-inset-bottom));
    color: var(--ink-soft);
    font-size: .85rem;
    text-align: center;
    opacity: .85;
}

.site-footer a {
    color: inherit;
    font-weight: 700;
}

/* ------------------------------------------------------------ gallery */

.goat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.goat-card {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 100%;
    height: 100%;
    padding: 8px 8px 12px;
    border: 0;
    border-radius: 24px;
    background: var(--surface);
    color: inherit;
    font: inherit;
    text-align: left;
    box-shadow: 0 6px 0 var(--line-strong);
}

button.goat-card {
    cursor: pointer;
    transition: transform .1s;
}

button.goat-card:active {
    transform: translateY(3px);
}

.goat-art {
    position: relative;
    display: block;
    margin-bottom: 6px;
    overflow: hidden;
    border-radius: 18px;
    background: var(--surface-soft);
}

.goat-art img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1;
}

.goat-number {
    position: absolute;
    top: 6px;
    left: 6px;
    min-width: 30px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgb(255 255 255 / .9);
    font-size: .85rem;
    font-weight: 900;
    text-align: center;
}

.goat-card strong {
    padding: 0 4px;
    font-size: 1rem;
    font-weight: 900;
    line-height: 1.2;
}

.goat-card small {
    padding: 0 4px;
    color: var(--ink-soft);
    font-weight: 700;
}

.goat-card.is-locked {
    background: var(--surface-soft);
    box-shadow: 0 6px 0 var(--line);
}

.goat-card.is-locked .goat-art {
    background: repeating-linear-gradient(-45deg, #f6ecd9 0 12px, #f1e4cc 12px 24px);
}

.silhouette {
    filter: brightness(0);
    opacity: .16;
}

.goat-card.is-locked strong {
    color: var(--ink-soft);
}

.gallery-tabs {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 22px;
}

/* „Podle získání" and the four albums: one wide tab, then two rows of two. */
.gallery-tab:first-child {
    grid-column: 1 / -1;
}

.gallery-tab,
.tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 56px;
    padding: 8px 10px;
    border-radius: 18px;
    background: var(--surface);
    color: inherit;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    box-shadow: inset 0 0 0 2px var(--line), 0 4px 0 var(--line-strong);
    transition: transform .08s, box-shadow .08s;
    touch-action: manipulation;
}

.gallery-tab:active,
.tab:active {
    transform: translateY(3px);
    box-shadow: inset 0 0 0 2px var(--line), 0 1px 0 var(--line-strong);
}

.gallery-tab strong {
    font-size: 1.05rem;
    font-weight: 900;
}

.gallery-tab small {
    color: var(--ink-soft);
    font-size: .88rem;
    font-weight: 700;
}

.gallery-tab[aria-current="page"],
.tab[aria-current="true"] {
    background: var(--green);
    color: #fff;
    box-shadow: 0 4px 0 var(--green-dark);
}

.gallery-tab[aria-current="page"] small {
    color: rgb(255 255 255 / .88);
}

/* Tabs inside a dialog: one row, smaller than the gallery's. */
.tabs {
    display: grid;
    grid-auto-columns: 1fr;
    grid-auto-flow: column;
    gap: 8px;
}

.tab {
    min-height: 44px;
    padding: 6px 10px;
    border: 0;
    font: inherit;
    font-size: 1rem;
    font-weight: 900;
    cursor: pointer;
}

.gallery-empty {
    padding: 8px 12px 12px;
    color: var(--ink-soft);
    font-size: 1.05rem;
    font-weight: 700;
    text-align: center;
}

.gallery-empty img {
    width: min(160px, 44vw);
    height: auto;
    margin: 0 auto 10px;
}

.reset {
    margin-top: 28px;
    text-align: center;
}

/* ------------------------------------------------------------ responsive */

@media (min-width: 560px) {
    .goat-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .gallery-tabs {
        grid-template-columns: none;
        grid-auto-columns: 1fr;
        grid-auto-flow: column;
    }

    .gallery-tab:first-child {
        grid-column: auto;
    }

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

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

@media (min-width: 720px) {
    .goat-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Phones with the number keyboard open: keep the problem and the button above it. */
@media (max-height: 520px) {
    .meter-label span,
    .play-footer {
        display: none;
    }

    .problem-card {
        padding: 14px 12px;
    }

    .topbar {
        margin-bottom: 6px;
    }

    .meter-label {
        margin: 4px 0 8px;
    }
}

@media (max-width: 380px) {
    .meter-slot {
        width: 20px;
        height: 20px;
    }
}

/* ------------------------------------------------------------ animations */

@keyframes bob {
    50% { transform: translateY(-6px); }
}

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

@keyframes pop {
    40% { transform: scale(1.05); }
}

@keyframes shake {
    20%, 60% { transform: translateX(-10px); }
    40%, 80% { transform: translateX(10px); }
}

@keyframes countdown {
    from { opacity: 0; transform: scale(2.2); }
}

@keyframes dialog-in {
    from { opacity: 0; transform: translateY(24px) scale(.96); }
}

@keyframes goat-from-next {
    from { opacity: 0; transform: translateX(40%); }
}

@keyframes goat-from-previous {
    from { opacity: 0; transform: translateX(-40%); }
}

@keyframes goat-reveal {
    from { opacity: 0; transform: scale(.3) rotate(-14deg); }
}

@keyframes stamp {
    from { opacity: 0; transform: rotate(-12deg) scale(2.4); }
}

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

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