/* ==========================================================================
   Contritok — Learning layer (v1)
   Duolingo-style lesson paths, the instant translator, phrasebook flashcards,
   pronunciation practice and the leaderboard. Loaded after theme.css so it
   reuses every --ct-* token (brand emerald & gold) and drops straight into
   the existing app shell. Dark theme handled through html[data-theme="dark"].
   ========================================================================== */

:root {
    --ct-learn-sky:    #1990d8;
    --ct-learn-sky-2:  #41b3f2;
    --ct-learn-violet: #7b57d6;
    --ct-learn-pink:   #e5568f;
    --ct-learn-flame:  #ff8a1e;
    --ct-btn3d-shadow: .28rem;
}

/* ============================ 3D chunky buttons ========================= */
.ct-btn3d {
    --btn3d: var(--ct-emerald-600);
    --btn3d-dark: var(--ct-emerald-800);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    font-weight: 800;
    letter-spacing: .02em;
    text-transform: uppercase;
    font-size: .82rem;
    color: #fff;
    background: var(--btn3d);
    border: none;
    border-radius: .85rem;
    padding: .8rem 1.2rem;
    box-shadow: 0 var(--ct-btn3d-shadow) 0 var(--btn3d-dark);
    transition: transform .06s ease, box-shadow .06s ease, filter .15s ease;
    text-decoration: none;
    cursor: pointer;
}
.ct-btn3d:hover { color: #fff; filter: brightness(1.05); }
.ct-btn3d:active { transform: translateY(var(--ct-btn3d-shadow)); box-shadow: 0 0 0 var(--btn3d-dark); }
.ct-btn3d:disabled, .ct-btn3d.disabled { opacity: .55; box-shadow: 0 var(--ct-btn3d-shadow) 0 var(--btn3d-dark); cursor: not-allowed; }
.ct-btn3d.gold   { --btn3d: var(--ct-gold-400); --btn3d-dark: var(--ct-gold-600); color: #452f00; }
.ct-btn3d.gold:hover { color: #452f00; }
.ct-btn3d.sky    { --btn3d: var(--ct-learn-sky); --btn3d-dark: #0d6aa3; }
.ct-btn3d.violet { --btn3d: var(--ct-learn-violet); --btn3d-dark: #553a9c; }
.ct-btn3d.danger { --btn3d: #d64533; --btn3d-dark: #9c2a1c; }
.ct-btn3d.ghost  { --btn3d: transparent; --btn3d-dark: transparent; color: var(--ct-link); box-shadow: none; border: 2px solid var(--ct-border-strong); }
.ct-btn3d.ghost:active { transform: translateY(2px); }
.ct-hero .ct-btn3d.ghost { color: #fff; border-color: rgba(255,255,255,.55); }
.ct-hero .ct-btn3d.ghost:hover { color: #fff; background: rgba(255,255,255,.14); }
.ct-learn-hero .ct-btn3d.ghost { color: #fff; border-color: rgba(255,255,255,.55); }
.ct-learn-hero .ct-btn3d.ghost:hover { color: #fff; background: rgba(255,255,255,.14); }
.ct-btn3d.wide { width: 100%; }
.ct-btn3d.sm { padding: .5rem .8rem; font-size: .72rem; border-radius: .65rem; }
.ct-btn3d.lg { padding: 1rem 1.5rem; font-size: .95rem; }

/* ============================ Stat pills ================================ */
.ct-statbar { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.ct-pill-stat {
    display: inline-flex; align-items: center; gap: .38rem;
    background: var(--ct-surface-2); border: 1px solid var(--ct-border);
    border-radius: 999px; padding: .3rem .7rem; font-weight: 700; font-size: .8rem;
    color: var(--ct-heading); line-height: 1;
}
.ct-pill-stat i { font-size: .85rem; }
.ct-pill-stat.flame  { color: #b85800; background: #fff3e2; border-color: #ffd9ad; }
.ct-pill-stat.flame i { color: var(--ct-learn-flame); }
.ct-pill-stat.heart  { color: #b81d3f; background: #ffe9ef; border-color: #ffc6d5; }
.ct-pill-stat.heart i { color: var(--ct-learn-pink); }
.ct-pill-stat.xp i   { color: var(--ct-gold-500); }
.ct-pill-stat.streak i { color: var(--ct-learn-flame); }

/* ============================ Goal ring ================================= */
.ct-ring {
    --val: 0; --size: 96px; --thick: 9px; --ring: var(--ct-emerald-500); --track: var(--ct-emerald-100);
    width: var(--size); height: var(--size); border-radius: 50%;
    background: conic-gradient(var(--ring) calc(var(--val) * 1%), var(--track) 0);
    display: grid; place-items: center; position: relative; flex: 0 0 auto;
}
.ct-ring::before {
    content: ""; position: absolute; inset: var(--thick);
    background: var(--ct-surface); border-radius: 50%;
}
.ct-ring-inner { position: relative; text-align: center; line-height: 1.05; }
.ct-ring-inner b { display: block; font-size: 1.15rem; font-weight: 800; color: var(--ct-heading); }
.ct-ring-inner small { font-size: .62rem; color: var(--ct-muted); text-transform: uppercase; letter-spacing: .04em; }
.ct-ring.gold { --ring: var(--ct-gold-400); --track: var(--ct-gold-100); }

/* ============================ Learn hero =============================== */
.ct-learn-hero {
    position: relative; overflow: hidden; border-radius: var(--ct-radius-lg);
    background: linear-gradient(135deg, var(--ct-emerald-700), var(--ct-emerald-500) 55%, var(--ct-emerald-400));
    color: #fff; padding: 1.25rem 1.4rem; box-shadow: var(--ct-shadow);
}
.ct-learn-hero::after {
    content: ""; position: absolute; right: -40px; top: -40px; width: 180px; height: 180px;
    border-radius: 50%; background: rgba(255,255,255,.12);
}
.ct-learn-hero::before {
    content: ""; position: absolute; right: 60px; bottom: -60px; width: 120px; height: 120px;
    border-radius: 50%; background: rgba(255,213,79,.22);
}
.ct-learn-hero h1, .ct-learn-hero h2, .ct-learn-hero h3,
.ct-learn-hero h4, .ct-learn-hero h5, .ct-learn-hero h6 { color: #fff; position: relative; }
.ct-learn-hero .lead { color: rgba(255,255,255,.9); }
.ct-learn-hero-inner { position: relative; z-index: 1; }

/* ============================ Lesson path ============================== */
.ct-path { position: relative; padding: 1rem .25rem 2rem; }
.ct-path::before {
    content: ""; position: absolute; top: 0; bottom: 1rem; left: 50%; width: 6px;
    transform: translateX(-50%); background: var(--ct-emerald-100); border-radius: 999px;
}
.ct-node-wrap { position: relative; display: flex; justify-content: center; margin: 1.6rem 0; }
.ct-node-wrap:nth-child(odd)  .ct-node { transform: translateX(-46px); }
.ct-node-wrap:nth-child(even) .ct-node { transform: translateX(46px); }
.ct-node {
    position: relative; z-index: 1;
    width: 78px; height: 78px; border-radius: 50%;
    display: grid; place-items: center; cursor: pointer;
    background: var(--ct-emerald-500); color: #fff; font-size: 1.7rem;
    box-shadow: 0 .35rem 0 var(--ct-emerald-800);
    border: none; transition: transform .1s ease, box-shadow .1s ease;
}
.ct-node:active { transform: translateX(-46px) translateY(.35rem) !important; box-shadow: 0 0 0 var(--ct-emerald-800); }
.ct-node-wrap:nth-child(even) .ct-node:active { transform: translateX(46px) translateY(.35rem) !important; }
.ct-node.done    { background: var(--ct-gold-400); color: #4a3200; box-shadow: 0 .35rem 0 var(--ct-gold-600); }
.ct-node.current { background: var(--ct-emerald-500); color: #fff; box-shadow: 0 .35rem 0 var(--ct-emerald-800), 0 0 0 6px var(--ct-emerald-100); animation: ct-node-pulse 1.8s infinite; }
.ct-node.locked  { background: var(--ct-surface-2); color: var(--ct-muted); box-shadow: 0 .35rem 0 var(--ct-border-strong); cursor: not-allowed; }
.ct-node-label {
    position: absolute; top: 84px; left: 50%; transform: translateX(-50%);
    white-space: nowrap; font-size: .72rem; font-weight: 700; color: var(--ct-heading);
    background: var(--ct-surface); border: 1px solid var(--ct-border); border-radius: 999px; padding: .1rem .55rem;
}
.ct-node-star { position: absolute; top: -6px; right: -4px; font-size: .95rem; color: var(--ct-gold-500); text-shadow: 0 1px 2px rgba(0,0,0,.2); }
@keyframes ct-node-pulse { 0%,100% { box-shadow: 0 .35rem 0 var(--ct-emerald-800), 0 0 0 6px var(--ct-emerald-100); } 50% { box-shadow: 0 .35rem 0 var(--ct-emerald-800), 0 0 0 12px rgba(46,158,95,.18); } }

/* =========================== Section headers =========================== */
.ct-sec-head { display: flex; align-items: center; gap: .6rem; margin: 1.4rem 0 .8rem; }
.ct-sec-head h2, .ct-sec-head h3 { margin: 0; font-size: 1.05rem; }
.ct-sec-head .ct-sec-ico {
    width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
    background: var(--ct-emerald-50); color: var(--ct-emerald-700); font-size: .95rem;
}
.ct-sec-head .ct-sec-ico.gold   { background: var(--ct-gold-50); color: var(--ct-gold-600); }
.ct-sec-head .ct-sec-ico.sky    { background: #e6f3fb; color: var(--ct-learn-sky); }
.ct-sec-head .ct-sec-ico.violet { background: #efe9fb; color: var(--ct-learn-violet); }

/* =========================== Home dashboard =========================== */
.ct-dash-grid { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 768px) { .ct-dash-grid { grid-template-columns: 1.4fr 1fr; } }
.ct-dash-card { background: var(--ct-surface); border: 1px solid var(--ct-border); border-radius: var(--ct-radius); padding: 1rem 1.1rem; box-shadow: var(--ct-shadow-sm); }
.ct-continue { display: flex; align-items: center; gap: 1rem; }

.ct-action-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .7rem; }
@media (min-width: 576px) { .ct-action-grid { grid-template-columns: repeat(4, 1fr); } }
.ct-action {
    display: flex; flex-direction: column; align-items: flex-start; gap: .5rem;
    padding: .9rem; border-radius: var(--ct-radius); text-decoration: none;
    color: var(--ct-heading); background: var(--ct-surface); border: 1px solid var(--ct-border);
    box-shadow: var(--ct-shadow-sm); transition: transform .15s ease, box-shadow .15s ease;
}
.ct-action:hover { transform: translateY(-3px); box-shadow: var(--ct-shadow); color: var(--ct-heading); }
.ct-action .ct-action-ico { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; font-size: 1.1rem; color: #fff; }
.ct-action b { font-size: .92rem; }
.ct-action small { color: var(--ct-muted); font-size: .74rem; }
.ct-action.emerald .ct-action-ico { background: linear-gradient(150deg, var(--ct-emerald-500), var(--ct-emerald-700)); }
.ct-action.sky     .ct-action-ico { background: linear-gradient(150deg, var(--ct-learn-sky-2), var(--ct-learn-sky)); }
.ct-action.gold    .ct-action-ico { background: linear-gradient(150deg, var(--ct-gold-300), var(--ct-gold-500)); }
.ct-action.violet  .ct-action-ico { background: linear-gradient(150deg, #a487e8, var(--ct-learn-violet)); }

/* =========================== Translator =============================== */
.ct-tr-wrap { background: var(--ct-surface); border: 1px solid var(--ct-border); border-radius: var(--ct-radius-lg); box-shadow: var(--ct-shadow); overflow: hidden; }
.ct-tr-langbar { display: flex; align-items: center; gap: .25rem; border-bottom: 1px solid var(--ct-border); background: var(--ct-surface-2); padding: .35rem .5rem; }
.ct-tr-langbar .ct-tr-lang { flex: 1; }
.ct-tr-lang select {
    width: 100%; border: none; background: transparent; font-weight: 700; color: var(--ct-emerald-700);
    font-size: .9rem; padding: .45rem .5rem; cursor: pointer;
}
.ct-tr-swap {
    width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--ct-border); flex: 0 0 auto;
    background: var(--ct-surface); color: var(--ct-emerald-700); display: grid; place-items: center; cursor: pointer;
    transition: transform .3s ease;
}
.ct-tr-swap:hover { transform: rotate(180deg); color: var(--ct-gold-600); }
.ct-tr-grid { display: grid; grid-template-columns: 1fr; }
@media (min-width: 768px) { .ct-tr-grid { grid-template-columns: 1fr 1fr; } }
.ct-tr-pane { padding: 1rem 1.1rem; min-height: 180px; display: flex; flex-direction: column; }
.ct-tr-pane + .ct-tr-pane { border-top: 1px solid var(--ct-border); }
@media (min-width: 768px) { .ct-tr-pane + .ct-tr-pane { border-top: 0; border-left: 1px solid var(--ct-border); } }
.ct-tr-pane textarea {
    flex: 1; border: none; resize: none; font-size: 1.15rem; line-height: 1.5; color: var(--ct-text);
    background: transparent; min-height: 120px; outline: none; font-family: var(--ct-font-body);
}
.ct-tr-pane textarea::placeholder { color: var(--ct-muted); }
.ct-tr-out { flex: 1; font-size: 1.15rem; line-height: 1.5; color: var(--ct-heading); word-break: break-word; }
.ct-tr-out .ct-tr-placeholder { color: var(--ct-muted); }
.ct-tr-tools { display: flex; align-items: center; gap: .35rem; margin-top: .5rem; }
.ct-tr-tool {
    width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--ct-border); background: var(--ct-surface);
    color: var(--ct-emerald-700); display: grid; place-items: center; cursor: pointer; transition: background .15s, color .15s;
}
.ct-tr-tool:hover { background: var(--ct-emerald-50); }
.ct-tr-tool.fav.on { background: var(--ct-gold-100); color: var(--ct-gold-600); border-color: var(--ct-gold-300); }
.ct-tr-count { font-size: .72rem; color: var(--ct-muted); margin-left: auto; }
.ct-tr-matches { margin-top: 1rem; }
.ct-tr-match {
    display: flex; align-items: center; gap: .7rem; padding: .65rem .8rem; border: 1px solid var(--ct-border);
    border-radius: var(--ct-radius-sm); background: var(--ct-surface); margin-bottom: .5rem;
}
.ct-tr-match .ct-tm-term { font-weight: 800; color: var(--ct-heading); }
.ct-tr-match .ct-tm-sub { font-size: .78rem; color: var(--ct-muted); }
.ct-tr-match .ct-tm-audio { margin-left: auto; }
.ct-tr-source { font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ct-muted); margin-top: .4rem; }
.ct-tr-chips { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .6rem; }

/* =========================== Phrasebook =============================== */
.ct-flash { perspective: 1200px; }
.ct-flashcard {
    position: relative; min-height: 210px; border-radius: var(--ct-radius-lg); cursor: pointer;
    transform-style: preserve-3d; transition: transform .5s cubic-bezier(.4,.2,.2,1); width: 100%;
}
.ct-flashcard.flipped { transform: rotateY(180deg); }
.ct-flashface {
    position: absolute; inset: 0; backface-visibility: hidden; border-radius: var(--ct-radius-lg);
    display: grid; place-items: center; text-align: center; padding: 1.5rem; box-shadow: var(--ct-shadow);
}
.ct-flashface.front { background: linear-gradient(150deg, var(--ct-emerald-600), var(--ct-emerald-800)); color: #fff; }
.ct-flashface.back  { background: var(--ct-surface); border: 1px solid var(--ct-border); transform: rotateY(180deg); }
.ct-flashface .ct-flash-term { font-size: 1.9rem; font-weight: 800; font-family: var(--ct-font-display); }
.ct-flashface .ct-flash-sub { color: rgba(255,255,255,.85); font-size: .85rem; margin-top: .4rem; }
.ct-flashface.back .ct-flash-term { color: var(--ct-heading); }
.ct-flash-nav { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-top: 1rem; }

/* =========================== Practice / speech ======================== */
.ct-mic-stage { text-align: center; padding: 1rem 0; }
.ct-mic {
    width: 110px; height: 110px; border-radius: 50%; border: none; cursor: pointer; margin: 0 auto;
    display: grid; place-items: center; font-size: 2.2rem; color: #fff;
    background: linear-gradient(150deg, var(--ct-learn-violet), #553a9c);
    box-shadow: 0 .4rem 0 #553a9c; transition: transform .1s ease, box-shadow .1s ease;
}
.ct-mic:active { transform: translateY(.4rem); box-shadow: 0 0 0 #553a9c; }
.ct-mic.recording { background: linear-gradient(150deg, #ff5f7a, #d61f45); box-shadow: 0 .4rem 0 #a01533; animation: ct-mic-pulse 1.1s infinite; }
@keyframes ct-mic-pulse { 0% { box-shadow: 0 .4rem 0 #a01533, 0 0 0 0 rgba(229,86,143,.5); } 100% { box-shadow: 0 .4rem 0 #a01533, 0 0 0 26px rgba(229,86,143,0); } }
.ct-mic-hint { color: var(--ct-muted); font-size: .85rem; margin-top: .8rem; }
.ct-practice-target { font-size: 2rem; font-weight: 800; font-family: var(--ct-font-display); color: var(--ct-heading); }

/* ==========================================================================
   SPEAKING v2 — studio-grade pronunciation practice
   A minimal, camera-free studio with waveform, glowing mic, and clear
   scoring. Works hand-in-glove with includes/learn.js.
   ========================================================================== */
.ct-studio {
    position: relative;
    border-radius: var(--ct-radius-lg);
    border: 1px solid var(--ct-border);
    background:
        radial-gradient(420px 220px at 50% 20%, rgba(15,122,65,.14) 0%, rgba(15,122,65,0) 60%),
        linear-gradient(180deg, var(--ct-surface) 0%, var(--ct-surface-2) 120%);
    box-shadow: var(--ct-shadow);
    overflow: hidden;
    text-align: center;
    padding: 1.25rem 1.15rem 1.4rem;
}
.ct-studio-head { margin-bottom: 1rem; }
.ct-studio-eyebrow {
    display: inline-flex; align-items: center; gap: .4rem;
    font-size: .68rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase;
    color: var(--ct-emerald-600);
    margin-bottom: .45rem;
}
.ct-studio-title {
    font-family: var(--ct-font-display);
    font-size: clamp(1.5rem, 5.2vw, 2.25rem);
    font-weight: 800; margin: 0 0 .25rem;
}
.ct-studio-sub { color: var(--ct-muted); font-size: .92rem; margin: 0; }

.ct-studio-target {
    font-family: var(--ct-font-display);
    font-size: clamp(2rem, 9vw, 3.6rem);
    font-weight: 800; letter-spacing: -.02em;
    color: var(--ct-heading); margin: .35rem 0 .25rem;
    word-break: break-word;
}
.ct-studio-meta { color: var(--ct-muted); font-size: .9rem; }

.ct-studio-wave {
    display: flex; align-items: flex-end; justify-content: center; gap: 6px;
    height: 84px; margin: 1rem 0 1.2rem;
}
.ct-studio-wave span {
    width: 6px; border-radius: 999px;
    background: linear-gradient(180deg, var(--ct-emerald-400), var(--ct-emerald-600));
    animation: ct-studio-wave 1.05s infinite ease-in-out;
    opacity: .85;
}
.ct-studio-wave span:nth-child(2n) { animation-delay: .16s; }
.ct-studio-wave span:nth-child(3n) { animation-delay: .32s; }
.ct-studio-wave span:nth-child(4n) { animation-delay: .48s; }
.ct-studio-wave span:nth-child(5n) { animation-delay: .64s; }
.ct-studio-wave span:nth-child(6n) { animation-delay: .8s; }
.ct-studio-wave span:nth-child(7n) { animation-delay: .96s; }
@keyframes ct-studio-wave { 0%,100% { height: 18%; } 40% { height: 94%; } }

.ct-studio-mic-wrap { position: relative; display: inline-grid; place-items: center; margin: .4rem 0 .6rem; }
.ct-studio-mic-glow {
    position: absolute; width: 164px; height: 164px; border-radius: 50%;
    background: radial-gradient(circle, rgba(15,122,65,.22) 0%, rgba(15,122,65,0) 70%);
    transition: transform .2s ease, opacity .2s ease;
    opacity: 0; pointer-events: none;
}
.ct-studio-mic-wrap.recording .ct-studio-mic-glow {
    opacity: 1; animation: ct-studio-glow 1.4s infinite;
}
@keyframes ct-studio-glow { 0%,100% { transform: scale(1); } 50% { transform: scale(1.14); } }

.ct-studio-mic {
    position: relative;
    width: 118px; height: 118px; border-radius: 50%; border: 0; cursor: pointer;
    display: grid; place-items: center; font-size: 2.4rem; color: #fff;
    background: radial-gradient(circle at 30% 25%, #3fa36c, var(--ct-emerald-600));
    box-shadow: 0 12px 26px rgba(15,122,65,.28), 0 4px 0 var(--ct-emerald-900);
    transition: transform .12s ease, box-shadow .12s ease;
}
.ct-studio-mic:active { transform: translateY(4px); box-shadow: 0 8px 20px rgba(15,122,65,.24), 0 0 0 var(--ct-emerald-900); }
.ct-studio-mic-wrap.recording .ct-studio-mic {
    background: radial-gradient(circle at 30% 25%, #ff7d93, #d61f45);
    box-shadow: 0 12px 26px rgba(214,31,69,.26), 0 4px 0 #7a162a;
    animation: ct-studio-mic 1.2s infinite;
}
@keyframes ct-studio-mic { 0%,100% { transform: scale(1); } 50% { transform: scale(1.05); } }

.ct-studio-hint { color: var(--ct-muted); font-size: .88rem; margin: .6rem 0 0; }

.ct-studio-score { display: flex; flex-direction: column; align-items: center; gap: .2rem; margin: .6rem 0 1rem; }
.ct-studio-score-num { font-size: clamp(2.8rem, 10vw, 4.4rem); font-weight: 800; line-height: 1; }
.ct-studio-score-num.great { color: var(--ct-emerald-600); }
.ct-studio-score-num.ok    { color: var(--ct-gold-600); }
.ct-studio-score-num.bad   { color: var(--ct-danger); }
.ct-studio-score-label { color: var(--ct-muted); font-size: .85rem; }

.ct-studio-meta-row { display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem; color: var(--ct-muted); font-size: .82rem; margin: .2rem 0 .8rem; }
.ct-studio-meta-pill {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .3rem .7rem; border-radius: 999px;
    background: var(--ct-surface); border: 1px solid var(--ct-border);
}

.ct-studio-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; }
.ct-studio-progress {
    margin-top: 1rem; color: var(--ct-muted); font-size: .8rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
}

html[data-theme="dark"] .ct-studio { background: linear-gradient(180deg, #16201a 0%, #111a15 120%); }
html[data-theme="dark"] .ct-studio-mic-glow { background: radial-gradient(circle, rgba(63,163,108,.18) 0%, rgba(63,163,108,0) 70%); }
html[data-theme="dark"] .ct-studio-wave span { background: linear-gradient(180deg, #6fc277, #2f8a3a); }
html[data-theme="dark"] .ct-studio-meta-pill { background: #16201a; }
.ct-practice-sub { color: var(--ct-muted); }
.ct-score { font-size: 2.4rem; font-weight: 800; }
.ct-score.great { color: var(--ct-emerald-600); }
.ct-score.ok    { color: var(--ct-gold-600); }
.ct-score.bad   { color: var(--ct-danger); }
.ct-wave { display: flex; align-items: flex-end; justify-content: center; gap: 4px; height: 46px; margin: 1rem 0; }
.ct-wave span { width: 5px; border-radius: 999px; background: var(--ct-emerald-400); animation: ct-wave .9s infinite ease-in-out; }
.ct-wave span:nth-child(2n) { animation-delay: .15s; }
.ct-wave span:nth-child(3n) { animation-delay: .3s; }
@keyframes ct-wave { 0%,100% { height: 25%; } 50% { height: 100%; } }

/* =========================== Exercise player ========================== */
.ct-ex-topbar { display: flex; align-items: center; gap: .8rem; margin-bottom: 1rem; }
.ct-ex-bar { flex: 1; height: 14px; border-radius: 999px; background: var(--ct-emerald-100); overflow: hidden; }
.ct-ex-bar > span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--ct-emerald-400), var(--ct-emerald-600)); border-radius: 999px; transition: width .3s ease; }
.ct-ex-prompt { text-align: center; margin: 1.2rem 0; }
.ct-ex-prompt .ct-ex-speaker { font-size: 2.6rem; font-weight: 800; font-family: var(--ct-font-display); color: var(--ct-heading); }
.ct-ex-prompt .ct-ex-instruction { color: var(--ct-muted); font-size: .88rem; margin-bottom: .6rem; }
.ct-ex-options { display: grid; gap: .7rem; grid-template-columns: 1fr; }
@media (min-width: 576px) { .ct-ex-options.two { grid-template-columns: 1fr 1fr; } }
.ct-ex-option {
    text-align: left; padding: .85rem 1rem; border-radius: var(--ct-radius); cursor: pointer;
    background: var(--ct-surface); border: 2px solid var(--ct-border); color: var(--ct-text);
    font-weight: 600; font-size: .95rem; transition: border-color .12s, background .12s, transform .1s;
}
.ct-ex-option:hover { border-color: var(--ct-emerald-300); }
.ct-ex-option.selected { border-color: var(--ct-emerald-500); background: var(--ct-emerald-50); color: var(--ct-emerald-800); }
.ct-ex-option.correct { border-color: var(--ct-emerald-500); background: var(--ct-emerald-100); color: var(--ct-emerald-800); }
.ct-ex-option.wrong   { border-color: var(--ct-danger); background: #fdecea; color: #8f2f23; }
.ct-ex-feedback {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1040;
    padding: .9rem 1rem calc(.9rem + var(--ct-safe-b)); transform: translateY(120%);
    transition: transform .25s ease; border-top: 1px solid var(--ct-border);
    background: var(--ct-surface); display: flex; align-items: center; gap: .8rem;
}
.ct-ex-feedback.show { transform: translateY(0); }
.ct-ex-feedback .ct-ex-fb-ico { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-size: 1.2rem; color: #fff; flex: 0 0 auto; }
.ct-ex-feedback.good .ct-ex-fb-ico { background: var(--ct-emerald-500); }
.ct-ex-feedback.bad  .ct-ex-fb-ico { background: var(--ct-danger); }
.ct-ex-feedback.good { background: #eefaf1; }
.ct-ex-feedback.bad  { background: #fdeeec; }
.ct-ex-feedback .ct-ex-fb-text b { display: block; color: var(--ct-heading); }
.ct-ex-feedback .ct-ex-fb-text small { color: var(--ct-muted); }
.ct-ex-typed { display: flex; gap: .5rem; }
.ct-ex-typed input { flex: 1; }

.ct-result { text-align: center; padding: 1.5rem 1rem; }
.ct-result .ct-result-ico { font-size: 3.4rem; }
.ct-result.win .ct-result-ico { color: var(--ct-gold-400); }
.ct-result.lose .ct-result-ico { color: var(--ct-muted); }
.ct-result-stats { display: flex; justify-content: center; gap: 1.6rem; margin: 1.2rem 0; }
.ct-result-stat b { display: block; font-size: 1.5rem; font-weight: 800; color: var(--ct-heading); }
.ct-result-stat small { color: var(--ct-muted); text-transform: uppercase; font-size: .68rem; letter-spacing: .05em; }

/* =========================== Leaderboard ============================== */
.ct-podium { display: flex; align-items: flex-end; justify-content: center; gap: .8rem; margin: 1rem 0 1.6rem; }
.ct-podium .ct-pod { text-align: center; flex: 0 1 30%; }
.ct-podium .ct-pod-avatar { width: 62px; height: 62px; border-radius: 50%; margin: 0 auto .4rem; display: grid; place-items: center; overflow: hidden; font-weight: 800; color: #fff; background: var(--ct-emerald-600); border: 3px solid var(--ct-gold-300); }
.ct-podium .ct-pod-avatar img { width: 100%; height: 100%; object-fit: cover; }
.ct-podium .ct-pod-base { border-radius: .7rem .7rem 0 0; color: #fff; font-weight: 800; padding: .5rem .4rem; }
.ct-pod.p1 .ct-pod-base { background: linear-gradient(180deg, var(--ct-gold-400), var(--ct-gold-600)); height: 96px; }
.ct-pod.p2 .ct-pod-base { background: linear-gradient(180deg, #b8c4c0, #8d9a95); height: 72px; }
.ct-pod.p3 .ct-pod-base { background: linear-gradient(180deg, #d69a5f, #b06f34); height: 58px; }
.ct-lb-row { display: flex; align-items: center; gap: .8rem; padding: .7rem .85rem; border-radius: var(--ct-radius-sm); background: var(--ct-surface); border: 1px solid var(--ct-border); margin-bottom: .5rem; }
.ct-lb-row.me { border-color: var(--ct-emerald-400); background: var(--ct-emerald-50); }
.ct-lb-rank { width: 30px; text-align: center; font-weight: 800; color: var(--ct-muted); flex: 0 0 auto; }
.ct-lb-avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; overflow: hidden; font-weight: 700; color: #fff; background: var(--ct-emerald-600); flex: 0 0 auto; }
.ct-lb-avatar img { width: 100%; height: 100%; object-fit: cover; }
.ct-lb-name { font-weight: 700; color: var(--ct-heading); }
.ct-lb-sub { font-size: .74rem; color: var(--ct-muted); }
.ct-lb-xp { margin-left: auto; font-weight: 800; color: var(--ct-gold-600); white-space: nowrap; }
.ct-league-tabs { display: flex; gap: .4rem; }

/* =========================== Streak calendar ========================== */
.ct-streak-week { display: flex; gap: .4rem; justify-content: space-between; }
.ct-streak-day { flex: 1; text-align: center; }
.ct-streak-day .ct-sd-dot {
    width: 100%; aspect-ratio: 1; border-radius: 12px; display: grid; place-items: center;
    background: var(--ct-surface-2); border: 1px solid var(--ct-border); color: var(--ct-muted); font-size: .9rem;
}
.ct-streak-day .ct-sd-dot.on { background: linear-gradient(150deg, var(--ct-gold-300), var(--ct-gold-500)); color: #4a3200; border-color: var(--ct-gold-400); }
.ct-streak-day small { display: block; font-size: .62rem; color: var(--ct-muted); margin-top: .25rem; text-transform: uppercase; }

/* =========================== Toasts =================================== */
.ct-toast-wrap { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--ct-tabbar-h) + 1rem); z-index: 1080; display: flex; flex-direction: column; gap: .5rem; align-items: center; pointer-events: none; }
.ct-toast {
    background: var(--ct-emerald-900); color: #fff; padding: .6rem 1rem; border-radius: 999px;
    font-weight: 600; font-size: .85rem; box-shadow: var(--ct-shadow); display: flex; align-items: center; gap: .5rem;
    animation: ct-toast-in .25s ease;
}
.ct-toast.gold { background: linear-gradient(150deg, var(--ct-gold-400), var(--ct-gold-600)); color: #3d2900; }
@keyframes ct-toast-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* =========================== Misc ===================================== */
.ct-empty-soft { text-align: center; padding: 2.4rem 1rem; color: var(--ct-muted); }
.ct-empty-soft i { font-size: 2.4rem; color: var(--ct-emerald-300); display: block; margin-bottom: .6rem; }
.ct-hr-soft { border-color: var(--ct-border); opacity: 1; margin: 1.2rem 0; }
.ct-flagchip { display: inline-flex; align-items: center; gap: .4rem; padding: .25rem .6rem; border-radius: 999px; background: var(--ct-surface-2); border: 1px solid var(--ct-border); font-size: .75rem; font-weight: 600; color: var(--ct-heading); }

/* =========================== Dark theme =============================== */
html[data-theme="dark"] {
    --ct-learn-sky: #3d9fe0;
    --ct-ring: var(--ct-emerald-500);
}
html[data-theme="dark"] .ct-pill-stat { background: #1c281f; border-color: #2d5238; color: var(--ct-heading); }
html[data-theme="dark"] .ct-pill-stat.flame { background: #2a1c08; border-color: #5a3c12; color: #ffcf8f; }
html[data-theme="dark"] .ct-pill-stat.heart { background: #2a121a; border-color: #5a2436; color: #ff9fb6; }
html[data-theme="dark"] .ct-ring::before { background: #16201a; }
html[data-theme="dark"] .ct-ring { --track: #223a2b; }
html[data-theme="dark"] .ct-ring.gold { --track: #3a2f12; }
html[data-theme="dark"] .ct-path::before { background: #223a2b; }
html[data-theme="dark"] .ct-node { background: #2f8a3a; box-shadow: 0 .35rem 0 #1b4a1e; }
html[data-theme="dark"] .ct-node.locked { background: #1c281f; color: #5a6b60; box-shadow: 0 .35rem 0 #29382f; }
html[data-theme="dark"] .ct-node.current { box-shadow: 0 .35rem 0 #1b4a1e, 0 0 0 6px rgba(47,138,58,.28); }
html[data-theme="dark"] .ct-node-label { background: #1c281f; border-color: #29382f; color: var(--ct-heading); }
html[data-theme="dark"] .ct-dash-card,
html[data-theme="dark"] .ct-action,
html[data-theme="dark"] .ct-lb-row,
html[data-theme="dark"] .ct-tr-match { background: #16201a; border-color: #29382f; }
html[data-theme="dark"] .ct-action:hover { color: var(--ct-heading); }
html[data-theme="dark"] .ct-tr-wrap,
html[data-theme="dark"] .ct-tr-langbar { background: #16201a; border-color: #29382f; }
html[data-theme="dark"] .ct-tr-langbar { background: #1c281f; }
html[data-theme="dark"] .ct-tr-swap { background: #111a15; border-color: #3a4f42; color: #8ad392; }
html[data-theme="dark"] .ct-tr-tool { background: #16201a; border-color: #3a4f42; color: #8ad392; }
html[data-theme="dark"] .ct-tr-tool:hover { background: #1c281f; }
html[data-theme="dark"] .ct-flashface.back { background: #16201a; border-color: #29382f; }
html[data-theme="dark"] .ct-lb-row.me { background: #12281a; border-color: #2f8a3a; }
html[data-theme="dark"] .ct-ex-option { background: #16201a; border-color: #29382f; color: var(--ct-text); }
html[data-theme="dark"] .ct-ex-option.selected { background: #12281a; border-color: #2f8a3a; color: #cdeecd; }
html[data-theme="dark"] .ct-ex-option.correct { background: #12281a; border-color: #2f8a3a; color: #cdeecd; }
html[data-theme="dark"] .ct-ex-option.wrong { background: #2c1512; border-color: #c0392b; color: #f2c3bc; }
html[data-theme="dark"] .ct-ex-feedback { background: #16201a; border-color: #29382f; }
html[data-theme="dark"] .ct-ex-feedback.good { background: #12281a; }
html[data-theme="dark"] .ct-ex-feedback.bad { background: #2c1512; }
html[data-theme="dark"] .ct-ex-bar { background: #223a2b; }
html[data-theme="dark"] .ct-streak-day .ct-sd-dot { background: #1c281f; border-color: #29382f; }
html[data-theme="dark"] .ct-sec-head .ct-sec-ico { background: #12281a; color: #8ad392; }
html[data-theme="dark"] .ct-sec-head .ct-sec-ico.gold { background: #2a2306; color: #ffd76b; }
html[data-theme="dark"] .ct-sec-head .ct-sec-ico.sky { background: #0f2622; color: #4fd6c9; }
html[data-theme="dark"] .ct-sec-head .ct-sec-ico.violet { background: #1e1830; color: #b9a3f0; }
html[data-theme="dark"] .ct-empty-soft i { color: #2f8a3a; }
html[data-theme="dark"] .ct-flagchip { background: #1c281f; border-color: #29382f; color: var(--ct-heading); }
html[data-theme="dark"] .ct-toast { background: #0a140d; }
html[data-theme="dark"] .ct-podium .ct-pod-avatar { border-color: var(--ct-gold-500); }

@media (max-width: 480px) {
    .ct-ex-prompt .ct-ex-speaker { font-size: 2rem; }
    .ct-flashface .ct-flash-term { font-size: 1.5rem; }
}

/* Keep the (now seven-item) top nav comfortable on mid-size desktops */
@media (min-width: 992px) and (max-width: 1240px) {
    .ct-appnav { gap: .05rem; margin-left: .5rem; }
    .ct-appnav a { padding: .5rem .55rem; font-size: .84rem; gap: .3rem; }
}

/* ============================ Home: ad strip (replaces counters) ================= */
.ct-adstrip { display: grid; gap: .75rem; grid-template-columns: 1fr; }
@media (min-width: 576px) { .ct-adstrip { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (min-width: 1200px) { .ct-adstrip { grid-template-columns: repeat(3, minmax(0,1fr)); } }

.ct-ad-mini {
    display: flex; align-items: center; gap: .75rem;
    padding: .6rem .8rem; text-decoration: none; color: inherit;
    background: var(--ct-surface); border: 1px solid var(--ct-border);
    border-radius: var(--ct-radius-lg); box-shadow: var(--ct-shadow-sm);
    transition: transform .14s ease, box-shadow .14s ease; min-width: 0;
}
.ct-ad-mini:hover { transform: translateY(-2px); box-shadow: var(--ct-shadow); text-decoration: none; }
.ct-ad-mini-media {
    width: 52px; height: 52px; flex: 0 0 auto; border-radius: 12px; overflow: hidden;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--ct-emerald-50); color: var(--ct-emerald-600);
}
.ct-ad-mini-media img { width: 100%; height: 100%; object-fit: cover; }
.ct-ad-mini-body { min-width: 0; flex: 1 1 auto; }
.ct-ad-mini-body b { display: block; font-weight: 700; color: var(--ct-heading); font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ct-ad-mini-body small { color: var(--ct-muted); font-size: .78rem; }
.ct-ad-mini-price { flex: 0 0 auto; font-weight: 800; color: var(--ct-emerald-700); font-size: .82rem; }

.ct-ad-banner {
    display: flex; align-items: center; gap: 1rem;
    padding: .7rem 1rem; text-decoration: none; color: inherit;
    background: linear-gradient(120deg, var(--ct-emerald-50), var(--ct-surface));
    border: 1px solid var(--ct-border); border-radius: var(--ct-radius-lg);
    box-shadow: var(--ct-shadow-sm);
    transition: transform .14s ease, box-shadow .14s ease;
}
.ct-ad-banner:hover { transform: translateY(-2px); box-shadow: var(--ct-shadow); text-decoration: none; }
.ct-ad-banner-media {
    width: 64px; height: 56px; flex: 0 0 auto; border-radius: 12px; overflow: hidden;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--ct-emerald-100, #d6f0da); color: var(--ct-emerald-600);
}
.ct-ad-banner-media img { width: 100%; height: 100%; object-fit: cover; }
.ct-ad-banner-body { min-width: 0; flex: 1 1 auto; }
.ct-ad-banner-body b { display: block; font-weight: 800; color: var(--ct-heading); }
.ct-ad-banner-body small { color: var(--ct-muted); }
.ct-ad-banner-price { flex: 0 0 auto; font-weight: 800; color: var(--ct-emerald-700); }
.ct-ad-banner-cta {
    flex: 0 0 auto; display: inline-flex; align-items: center; gap: .35rem;
    font-weight: 700; color: #fff; background: var(--ct-emerald-600);
    padding: .45rem .9rem; border-radius: 999px; font-size: .85rem;
}
@media (max-width: 575.98px) { .ct-ad-banner-cta, .ct-ad-banner-price { display: none; } }

/* ============================ Home: regions grid =================== */
.ct-region-grid { display: grid; gap: .75rem; grid-template-columns: 1fr; }
@media (min-width: 768px) { .ct-region-grid { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (min-width: 1200px) { .ct-region-grid { grid-template-columns: repeat(3, minmax(0,1fr)); } }
.ct-region-grid .ct-list-item {
    background: var(--ct-surface); border: 1px solid var(--ct-border);
    border-radius: var(--ct-radius-lg); box-shadow: var(--ct-shadow-sm);
    transition: transform .14s ease, box-shadow .14s ease;
}
.ct-region-grid .ct-list-item:hover { transform: translateY(-2px); box-shadow: var(--ct-shadow); }

html[data-theme="dark"] .ct-ad-mini-media,
html[data-theme="dark"] .ct-ad-banner-media { background: #16281c; color: #8ad392; }
html[data-theme="dark"] .ct-ad-banner { background: linear-gradient(120deg, #16281c, var(--ct-surface)); }
.ct-region-grid .ct-list-item:last-child { border-bottom: 1px solid var(--ct-border); }

/* Admin quick-access button in the top app bar (admins only) */
.ct-appbar-actions .ct-iconbtn-admin { color: var(--ct-gold-300); }
.ct-appbar-actions .ct-iconbtn-admin:hover { background: rgba(255,213,79,.22); color: #fff; }
