/* Cat class (js/cat-class.js): Polly and Mila teach the lesson's explanation step with animated cards. */
html.cat-class-on .buddy { display: none !important; }

.cc {
  --cc-pink: #ff5d8f; --cc-gold: #ffb627; --cc-teal: #1fb5a8; --cc-violet: #7a5cff; --cc-blue: #3d8bff;
  --cc-lv: var(--lv, var(--cc-violet));
  position: relative; margin: 6px 0 14px; padding: 14px 14px 12px; border-radius: 26px; isolation: isolate; overflow: hidden;
  background:
    radial-gradient(120% 90% at 100% 0%, color-mix(in srgb, var(--cc-pink) 22%, transparent), transparent 60%),
    radial-gradient(90% 80% at 0% 100%, color-mix(in srgb, var(--cc-teal) 20%, transparent), transparent 60%),
    linear-gradient(160deg, color-mix(in srgb, var(--cc-lv) 18%, var(--surface)), color-mix(in srgb, var(--cc-violet) 12%, var(--surface)));
  box-shadow: 0 1px 0 rgb(255 255 255 / .6) inset, 0 18px 50px -24px color-mix(in srgb, var(--cc-violet) 55%, transparent);
  border: 1px solid color-mix(in srgb, var(--cc-violet) 22%, transparent);
}
.cc::before { /* soft dotted classroom wallpaper */
  content: ''; position: absolute; inset: 0; z-index: -1; opacity: .35;
  background-image: radial-gradient(color-mix(in srgb, var(--cc-violet) 35%, transparent) 1.2px, transparent 1.4px);
  background-size: 18px 18px; mask-image: linear-gradient(180deg, #000, transparent 75%);
}
.cc-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.cc-badge { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px 6px 10px; border-radius: 999px; font-weight: 700; font-size: .9rem; color: #fff;
  background: linear-gradient(135deg, var(--cc-pink), var(--cc-violet)); box-shadow: 0 6px 16px -8px var(--cc-pink); }
.cc-badge svg { width: 16px; height: 16px; fill: #fff7c2; animation: cc-twinkle 2.4s ease-in-out infinite; }
.cc-mute { appearance: none; border: 0; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; color: var(--ink);
  background: color-mix(in srgb, var(--surface) 80%, transparent); box-shadow: var(--shadow-xs, 0 1px 2px rgb(0 0 0 / .1)); }
.cc-mute svg { width: 18px; height: 18px; }
.cc-mute[aria-pressed="true"] { opacity: .55; }
.cc-mute[aria-pressed="true"] svg path:last-child { display: none; }
.cc-dots { list-style: none; display: flex; gap: 5px; margin: 0 auto 0 0; padding: 0; }
[dir="rtl"] .cc-dots { margin: 0 0 0 auto; }
.cc-dots li { width: 8px; height: 8px; border-radius: 99px; background: color-mix(in srgb, var(--ink) 18%, transparent); transition: width .35s cubic-bezier(.2,.8,.2,1), background .3s; }
.cc-dots li.done { background: var(--cc-teal); }
.cc-dots li.now { width: 22px; background: linear-gradient(90deg, var(--cc-pink), var(--cc-gold)); }

/* stage: the cats on one side (physically right, so their pointing paws aim at the board), cards on the other */
.cc-stage { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 12px; align-items: end; direction: ltr; }
.cc-board { grid-column: 1; grid-row: 1; direction: rtl; display: grid; gap: 10px; align-content: center; min-height: 300px; }
[lang="ru"] .cc-board { direction: ltr; }
.cc-cats { grid-column: 2; grid-row: 1; position: relative; height: 340px; align-self: end; }
.cc-cat { position: absolute; bottom: 0; margin: 0; width: 190px; transition: transform .5s cubic-bezier(.2,.8,.2,1), filter .4s, opacity .4s; transform-origin: 50% 100%; }
.cc-cat img { display: block; width: 100%; height: auto; filter: drop-shadow(0 10px 12px rgb(20 10 40 / .28)); position: relative; z-index: 1; }
.cc-cat .cc-shadow { position: absolute; left: 14%; right: 14%; bottom: 2px; height: 14px; border-radius: 50%; background: rgb(20 10 40 / .28); filter: blur(5px); }
.cc-cat figcaption { position: absolute; z-index: 2; bottom: -4px; left: 50%; transform: translateX(-50%); padding: 2px 10px; border-radius: 99px; font-size: .78rem; font-weight: 700; color: #fff; white-space: nowrap; }
.cc-polly { right: 72px; z-index: 2; } .cc-polly figcaption { background: linear-gradient(135deg, #5b6b8a, #3d4a66); }
.cc-mila { right: -10px; bottom: 6px; width: 158px; z-index: 1; } .cc-mila figcaption { background: linear-gradient(135deg, var(--cc-pink), #e0458a); }
.cc-cat:not(.on) { filter: saturate(.85) brightness(.96); transform: scale(.9); }
.cc-cat.on { transform: scale(1.04); z-index: 3; }
.cc-cat.talking img { animation: cc-talk .55s ease-in-out infinite alternate; }
.cc-say { position: absolute; bottom: 222px; left: -6px; right: -4px; z-index: 4; padding: 9px 12px; border-radius: 16px; background: var(--surface); box-shadow: 0 10px 26px -12px rgb(20 10 40 / .45);
  border: 2px solid var(--cc-violet); }
.cc-say[data-cat="mila"] { border-color: var(--cc-pink); }
.cc-say::after { content: ''; position: absolute; bottom: -9px; right: 150px; width: 16px; height: 16px; background: var(--surface); border: 2px solid var(--cc-violet); border-top: 0; border-left: 0; transform: rotate(45deg); }
.cc-say[data-cat="mila"]::after { right: 60px; border-color: var(--cc-pink); }
.cc-say.pop { animation: cc-bubble .45s cubic-bezier(.2,1.4,.4,1) both; }
.cc-say p { margin: 0; }
.cc-say-en { font-family: var(--font-target); font-weight: 700; font-size: .98rem; line-height: 1.3; color: var(--ink); }
.cc-say-tr { font-size: .8rem; color: var(--muted); margin-top: 2px !important; }

/* cards */
.cc-card { position: relative; padding: 14px 16px 14px; border-radius: 20px; background: var(--surface); color: var(--ink);
  border: 1px solid color-mix(in srgb, var(--k) 30%, transparent);
  box-shadow: 0 1px 0 rgb(255 255 255 / .7) inset, 0 14px 30px -18px color-mix(in srgb, var(--k) 80%, transparent);
  animation: cc-in .6s cubic-bezier(.2,1.25,.35,1) both; transform-origin: 70% 100%; --k: var(--cc-violet); }
.cc-card::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 5px; border-radius: 20px 20px 0 0; background: linear-gradient(90deg, var(--k), color-mix(in srgb, var(--k) 40%, var(--cc-gold))); }
.cc-card.k-tip { --k: var(--cc-gold); } .cc-card.k-rule { --k: var(--cc-blue); } .cc-card.k-word { --k: var(--cc-pink); }
.cc-card.k-ex { --k: var(--cc-teal); } .cc-card.k-end { --k: var(--cc-violet); text-align: center;
  background: linear-gradient(135deg, color-mix(in srgb, var(--cc-gold) 22%, var(--surface)), color-mix(in srgb, var(--cc-pink) 16%, var(--surface))); }
.cc-card.past { display: none; }
.cc-card-h { position: relative; overflow: hidden; display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-weight: 800; font-size: .82rem; letter-spacing: .02em; color: color-mix(in srgb, var(--k) 70%, var(--ink)); }
.cc-ico { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 9px; font-size: 1rem; background: color-mix(in srgb, var(--k) 18%, transparent); }
.cc-card.now .cc-ico { animation: cc-wiggle 1s .4s ease-in-out 2; }
.cc-sheen { position: absolute; inset: -40% auto -40% -30%; width: 30%; background: linear-gradient(90deg, transparent, rgb(255 255 255 / .7), transparent); transform: skewX(-20deg); animation: cc-sheen 1.3s .3s ease-out both; pointer-events: none; }
.cc-text { margin: 0; font-size: 1.06rem; line-height: 1.6; }
.cc-endtext { font-family: var(--font-display); font-size: 1.2rem; }
.cc-line { background: none; }
.cc-en, .cc-line, .cc-big { appearance: none; border: 0; font: inherit; color: inherit; cursor: pointer; }
.cc-en { display: inline; -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 .3em; margin: 0 .05em; border-radius: 7px; font-family: var(--font-target); font-weight: 700; unicode-bidi: isolate;
  background: linear-gradient(transparent 55%, color-mix(in srgb, var(--cc-gold) 55%, transparent) 55%) no-repeat 0 0 / 0% 100%; animation: cc-marker .7s .5s ease-out forwards; }
.cc-en:hover, .cc-en:focus-visible { background-color: color-mix(in srgb, var(--cc-gold) 20%, transparent); }
.cc-word { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; margin-bottom: 4px; }
.cc-big { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px 4px 8px; border-radius: 12px; font-family: var(--font-target); font-size: 1.6rem; font-weight: 800; direction: ltr;
  background: linear-gradient(135deg, color-mix(in srgb, var(--cc-pink) 16%, transparent), color-mix(in srgb, var(--cc-violet) 14%, transparent)); color: color-mix(in srgb, var(--cc-pink) 55%, var(--ink)); }
.cc-big svg, .cc-line svg { width: 20px; height: 20px; flex: none; opacity: .8; }
.cc-tr { color: var(--muted); font-size: .92rem; }
.cc-mini { margin: 8px 0 0; display: grid; gap: 2px; padding: 8px 10px; border-radius: 12px; background: color-mix(in srgb, var(--k) 8%, transparent); }
.cc-exs { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.cc-exs li { display: grid; gap: 1px; padding: 8px 10px; border-radius: 12px; background: color-mix(in srgb, var(--cc-teal) 9%, transparent); animation: cc-in .5s calc(.25s + var(--k) * .22s) cubic-bezier(.2,1.2,.35,1) both; }
.cc-line { display: flex; align-items: center; gap: 8px; text-align: left; font-family: var(--font-target); font-size: 1.05rem; font-weight: 600; padding: 0; direction: ltr; }
.cc-line mark, .cc-mini mark { background: none; color: inherit; font-weight: 800; box-shadow: inset 0 -.42em 0 color-mix(in srgb, var(--cc-pink) 35%, transparent); border-radius: 2px; }
.cc-line.playing, .cc-big.playing { animation: cc-beat .5s ease-in-out 3; }
.cc-hint { margin: 8px 0 0; font-size: .8rem; color: var(--muted); }

.cc-ctrl { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.cc-ctrl .cc-next { margin-inline-start: auto; min-width: 130px; }
.cc-ctrl .cc-back:disabled { visibility: hidden; }
.cc-count { font-size: .82rem; color: var(--muted); }
.cc-actions:not(.cc-final) { justify-content: center; }
.cc-actions:not(.cc-final) [data-step] { font-size: .9rem; min-height: 0; padding: 8px 16px; }
.cc-actions.cc-final [data-step] { animation: cc-glow 1.6s ease-in-out infinite; }

.cc-confetti { position: absolute; inset: 0; pointer-events: none; z-index: 6; overflow: hidden; }
.cc-confetti i { position: absolute; top: -12px; left: var(--x); width: 8px; height: 12px; border-radius: 2px; animation: cc-fall var(--d) var(--dl) cubic-bezier(.3,.6,.5,1) forwards; }

@keyframes cc-in { from { opacity: 0; transform: translateY(18px) scale(.86) rotate(-2deg); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes cc-bubble { from { opacity: 0; transform: translateY(8px) scale(.8); } to { opacity: 1; transform: none; } }
@keyframes cc-talk { from { transform: translateY(0) rotate(0); } to { transform: translateY(-3px) rotate(-1.2deg); } }
@keyframes cc-sheen { from { left: -30%; } to { left: 130%; } }
@keyframes cc-marker { to { background-size: 100% 100%; } }
@keyframes cc-wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-12deg) scale(1.1); } 75% { transform: rotate(10deg) scale(1.1); } }
@keyframes cc-twinkle { 50% { transform: scale(1.25) rotate(20deg); } }
@keyframes cc-beat { 50% { transform: scale(1.04); } }
@keyframes cc-glow { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--cc-pink) 25%, transparent); } }
@keyframes cc-fall { 0% { transform: translateY(0) rotate(0); opacity: 1; } 100% { transform: translateY(420px) rotate(var(--r)); opacity: 0; } }

/* phones: the cats stand in a row above the board, the bubble beside them */
@media (max-width: 640px) {
  .cc { padding: 12px 10px 10px; border-radius: 22px; }
  .cc-stage { grid-template-columns: 1fr; }
  .cc-board { grid-column: 1; grid-row: 2; }
  .cc-cats { grid-column: 1; grid-row: 1; height: 150px; }
  .cc-cat { width: 120px; }
  .cc-polly { right: 66px; } .cc-mila { right: -4px; width: 100px; bottom: 4px; }
  .cc-say { top: 8px; bottom: auto; left: 0; right: 176px; }
  .cc-count { display: none; }
  .cc-say::after, .cc-say[data-cat="mila"]::after { right: -9px; bottom: auto; top: 22px; transform: rotate(-45deg); }
  .cc-board { min-height: 0; }
  .cc-text { font-size: 1rem; }
  .cc-big { font-size: 1.35rem; }
}
@media (prefers-reduced-motion: reduce) {
  .cc *, .cc *::before, .cc *::after { animation: none !important; transition: none !important; }
  .cc-en { background-size: 100% 100%; }
}
html.pref-calm .cc *, html.pref-calm .cc *::before { animation: none !important; }
html.pref-calm .cc-en { background-size: 100% 100%; }

/* cat dialogues (js/dialogues.js, dialogues with cats: true): Polly and Mila's own faces as avatars */
.dl-av.dl-cat { overflow: hidden; padding: 0; background: radial-gradient(circle at 50% 30%, #fff, #e9e3ff) !important; box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px #7a5cff; }
.dl-av.dl-cat-mila { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px #ff5d8f; }
.dl-av.dl-cat img { width: 175%; height: 175%; max-width: none; object-fit: cover; object-position: 50% 6%; margin-top: 30%; }
.dl-cats-hero { display: flex; justify-content: center; align-items: flex-end; height: 150px; margin: 0 auto 4px; }
.dl-cats-hero img { height: 100%; width: auto; filter: drop-shadow(0 8px 10px rgb(20 10 40 / .25)); animation: cc-in .7s cubic-bezier(.2,1.25,.35,1) both; }
.dl-cats-hero img + img { height: 112%; margin-inline-start: -22px; animation-delay: .15s; }
@media (prefers-reduced-motion: reduce) { .dl-cats-hero img { animation: none; } }
