/* =============================================
   iCoder Academy – Codey Activities
   ============================================= */

/* ──── Hero ──── */
.act-hero {
    background: linear-gradient(135deg, #E8772B 0%, #E85555 40%, #8A4FD8 100%);
    padding: 70px 0 55px;
    position: relative;
    overflow: hidden;
}

.act-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.act-hero-mascot {
    font-size: 4rem;
    margin-bottom: 12px;
    animation: act-bounce 2s ease-in-out infinite;
}

@keyframes act-bounce {
    0%,100% { transform: translateY(0); }
    50%     { transform: translateY(-10px); }
}

.act-hero-title {
    font-size: 2.2rem;
    font-weight: 800;
    color: white;
    margin: 0 0 10px;
}

.act-hero-desc {
    font-size: 1.05rem;
    color: rgba(255,255,255,.85);
    margin: 0;
}

/* ──── Section ──── */
.act-section {
    padding: 50px 0 80px;
    background: #F4F8FF;
    min-height: 60vh;
}

/* ──── Chapters Grid ──── */
.act-chapters {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 18px;
}

.act-ch-card {
    background: white;
    border: 2px solid #e8edf5;
    border-radius: 18px;
    padding: 24px;
    text-decoration: none;
    transition: all .25s;
    position: relative;
    overflow: hidden;
}

.act-ch-card:hover {
    border-color: var(--ch-color);
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,.08);
}

.act-ch-num {
    position: absolute;
    top: 16px;
    inset-inline-end: 16px;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: color-mix(in srgb, var(--ch-color) 12%, transparent);
    color: var(--ch-color);
    font-weight: 800;
    font-size: .85rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.act-ch-emoji {
    font-size: 2.4rem;
    margin-bottom: 10px;
}

.act-ch-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1B2845;
    margin: 0 0 6px;
}

.act-ch-desc {
    font-size: .82rem;
    color: #5a6a80;
    margin: 0 0 12px;
    line-height: 1.5;
}

.act-ch-count {
    font-size: .78rem;
    color: var(--ch-color);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ──── Player ──── */
.act-player {
    max-width: 720px;
    margin: 0 auto;
}

.act-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #5a6a80;
    font-size: .88rem;
    font-weight: 600;
    text-decoration: none;
    margin-bottom: 20px;
}

.act-back:hover { color: #1B2845; }

/* -- Chapter Header -- */
.act-ch-header {
    display: flex;
    align-items: center;
    gap: 18px;
    background: white;
    border-radius: 16px;
    padding: 24px;
    border: 2px solid #e8edf5;
    margin-bottom: 20px;
}

.act-ch-header-emoji { font-size: 2.8rem; }
.act-ch-header-label { font-size: .8rem; font-weight: 700; color: var(--ch-color); text-transform: uppercase; letter-spacing: .06em; }
.act-ch-header-title { font-size: 1.4rem; font-weight: 800; color: #1B2845; margin: 2px 0 0; }

/* -- Story -- */
.act-story {
    display: flex;
    gap: 16px;
    background: white;
    border-radius: 16px;
    padding: 20px;
    border: 2px solid #e8edf5;
    margin-bottom: 20px;
    font-size: .92rem;
    color: #3a4a5f;
    line-height: 1.7;
}

.act-story-avatar {
    font-size: 2.2rem;
    flex-shrink: 0;
    animation: act-bounce 2s ease-in-out infinite;
}

.act-story p { margin: 0; }

/* -- Progress -- */
.act-progress-bar {
    height: 8px;
    background: #e8edf5;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 6px;
}

.act-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #2E7D32, #66BB6A);
    border-radius: 10px;
    transition: width .5s ease;
}

.act-progress-text {
    font-size: .78rem;
    color: #5a6a80;
    font-weight: 600;
    margin-bottom: 24px;
    text-align: end;
}

/* ──── Activity Card ──── */
.act-activity {
    background: white;
    border-radius: 18px;
    padding: 28px;
    border: 2px solid #e8edf5;
    margin-bottom: 18px;
    transition: border-color .3s;
}

.act-activity.completed { border-color: #66BB6A; }

.act-activity-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
}

.act-activity-num {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    color: white;
    font-weight: 800;
    font-size: .9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.act-activity-type { font-size: .75rem; font-weight: 700; color: #5a6a80; }
.act-activity-title { font-size: 1.1rem; font-weight: 800; color: #1B2845; margin: 2px 0 0; }
.act-activity-instruction { font-size: .92rem; color: #3a4a5f; margin: 0 0 20px; }

/* ──── Multiple Choice ──── */
.act-choices {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.act-choice {
    background: #f8fafd;
    border: 2px solid #e8edf5;
    border-radius: 14px;
    padding: 20px 14px;
    text-align: center;
    cursor: pointer;
    transition: all .2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    position: relative;
    font-family: inherit;
}

.act-choice:hover:not(:disabled) {
    border-color: #1976D2;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,.06);
}

.act-choice.correct {
    border-color: #2E7D32;
    background: rgba(46,125,50,.06);
    box-shadow: 0 0 0 3px rgba(46,125,50,.12);
}

.act-choice.wrong {
    border-color: #E85555;
    background: rgba(232,85,85,.04);
}

.act-choice-emoji { font-size: 2.2rem; }
.act-choice-label { font-size: .88rem; font-weight: 700; color: #1B2845; }
.act-choice-icon { position: absolute; top: 8px; inset-inline-end: 8px; font-size: 1rem; }
.act-choice.correct .act-choice-icon { color: #2E7D32; }
.act-choice.wrong .act-choice-icon { color: #E85555; }

/* ──── Order ──── */
.act-order-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.act-order-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f8fafd;
    border: 2px solid #e8edf5;
    border-radius: 14px;
    padding: 14px 16px;
    transition: all .2s;
}

.act-order-item.locked { border-color: #66BB6A; background: rgba(46,125,50,.04); }

.act-order-pos {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #e0e7f1;
    color: #5a6a80;
    font-weight: 800;
    font-size: .85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.act-order-emoji { font-size: 1.6rem; }
.act-order-label { font-size: .92rem; font-weight: 600; color: #1B2845; flex: 1; }

.act-order-btns {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-inline-start: auto;
}

.act-order-btn {
    width: 30px;
    height: 26px;
    border-radius: 8px;
    border: 1px solid #d0d9e6;
    background: white;
    color: #5a6a80;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .7rem;
    transition: all .15s;
}

.act-order-btn:hover:not(:disabled) { background: #e8edf5; color: #1B2845; }
.act-order-btn:disabled { opacity: .3; cursor: not-allowed; }

/* ──── Pattern ──── */
.act-pattern-seq {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.act-pattern-cell {
    width: 64px;
    height: 64px;
    border-radius: 14px;
    background: #f8fafd;
    border: 2px solid #e8edf5;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
}

.act-pattern-cell.question {
    border-style: dashed;
    border-color: #1976D2;
    color: #1976D2;
    font-size: 1.4rem;
    animation: act-pulse 1.5s ease-in-out infinite;
}

@keyframes act-pulse {
    0%,100% { box-shadow: 0 0 0 0 rgba(25,118,210,.15); }
    50%     { box-shadow: 0 0 0 8px rgba(25,118,210,.05); }
}

/* ──── Count ──── */
.act-count-items {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
    font-size: 2.8rem;
}

.act-count-emoji { animation: act-bounce 2s ease-in-out infinite; }
.act-count-emoji:nth-child(2) { animation-delay: .2s; }
.act-count-emoji:nth-child(3) { animation-delay: .4s; }
.act-count-emoji:nth-child(4) { animation-delay: .6s; }
.act-count-emoji:nth-child(5) { animation-delay: .8s; }
.act-count-emoji:nth-child(6) { animation-delay: 1s; }

.act-count-input {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: .95rem;
    font-weight: 700;
    color: #1B2845;
}

.act-count-field {
    width: 70px;
    height: 50px;
    border-radius: 12px;
    border: 2px solid #e8edf5;
    text-align: center;
    font-size: 1.3rem;
    font-weight: 800;
    color: #1B2845;
    background: #f8fafd;
    font-family: inherit;
    transition: border-color .2s;
}

.act-count-field:focus { outline: none; border-color: #1976D2; }
.act-count-field.correct { border-color: #2E7D32; background: rgba(46,125,50,.06); color: #2E7D32; }

/* ──── Check Button ──── */
.act-check-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    border-radius: 12px;
    color: white;
    font-weight: 700;
    font-size: .88rem;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: all .2s;
    text-decoration: none;
}

.act-check-btn:hover { opacity: .9; transform: translateY(-1px); color: white; }

/* ──── Feedback ──── */
.act-feedback {
    padding: 12px 18px;
    border-radius: 12px;
    font-size: .88rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
}

.act-feedback.success {
    background: rgba(46,125,50,.08);
    border: 1px solid rgba(46,125,50,.2);
    color: #2E7D32;
}

.act-feedback.error {
    background: rgba(232,85,85,.06);
    border: 1px solid rgba(232,85,85,.2);
    color: #E85555;
}

/* ──── Complete ──── */
.act-complete {
    background: white;
    border: 2px solid #66BB6A;
    border-radius: 20px;
    padding: 48px 32px;
    text-align: center;
    margin-top: 24px;
}

.act-complete-stars { font-size: 3rem; margin-bottom: 16px; animation: act-bounce 1.5s ease-in-out infinite; }
.act-complete h2 { font-size: 1.6rem; font-weight: 800; color: #2E7D32; margin: 0 0 8px; }
.act-complete p { font-size: .95rem; color: #5a6a80; margin: 0 0 24px; }

.act-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    border-radius: 12px;
    background: #f0f3f8;
    color: #5a6a80;
    font-weight: 700;
    font-size: .88rem;
    text-decoration: none;
    transition: all .2s;
}

.act-back-btn:hover { background: #e4e9f0; color: #1B2845; }

/* ──── Week Tabs ──── */
.ca-weeks {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.ca-week-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 12px;
    border: 2px solid #e8edf5;
    background: white;
    font-size: .85rem;
    font-weight: 700;
    color: #5a6a80;
    cursor: pointer;
    transition: all .2s;
    font-family: inherit;
}

.ca-week-tab:hover { border-color: var(--ch-color); color: var(--ch-color); }

.ca-week-tab.active {
    background: var(--ch-color);
    border-color: var(--ch-color);
    color: white;
}

.ca-week-tab.done {
    border-color: #2E7D32;
    color: #2E7D32;
}

.ca-week-tab.done.active {
    background: #2E7D32;
    color: white;
}

.ca-week-num {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #e0e7f1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .75rem;
}

.ca-week-tab.active .ca-week-num {
    background: rgba(255,255,255,.25);
    color: white;
}

/* ──── Language Toggle ──── */
.act-lang-toggle {
    background: #f0f3f8;
    border: 2px solid #e0e7f1;
    border-radius: 10px;
    padding: 6px 14px;
    font-size: .78rem;
    font-weight: 700;
    color: #5a6a80;
    cursor: pointer;
    transition: all .2s;
    flex-shrink: 0;
    font-family: inherit;
}

.act-lang-toggle:hover {
    background: #e4e9f0;
    border-color: #1976D2;
    color: #1976D2;
}

/* ──── Attempts Counter ──── */
.act-attempts {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 700;
    color: #E8772B;
    background: rgba(232,119,43,.08);
    border: 1px solid rgba(232,119,43,.2);
    margin-bottom: 14px;
}

/* ──── Shake Animation ──── */
.act-activity.shake {
    animation: act-shake .5s ease;
}

@keyframes act-shake {
    0%, 100% { transform: translateX(0); }
    15% { transform: translateX(-8px); }
    30% { transform: translateX(8px); }
    45% { transform: translateX(-6px); }
    60% { transform: translateX(6px); }
    75% { transform: translateX(-3px); }
    90% { transform: translateX(3px); }
}

.act-activity.completed {
    animation: act-celebrate .6s ease;
}

@keyframes act-celebrate {
    0% { transform: scale(1); }
    30% { transform: scale(1.02); }
    60% { transform: scale(0.99); }
    100% { transform: scale(1); }
}

/* ──── Responsive ──── */
@media (max-width: 768px) {
    .act-hero-title { font-size: 1.6rem; }
    .act-chapters { grid-template-columns: repeat(2, 1fr); }
    .act-activity { padding: 20px 16px; }
    .act-ch-header { flex-direction: column; text-align: center; }
    .act-story { flex-direction: column; text-align: center; }
    .act-choices { grid-template-columns: 1fr; }
    .act-pattern-cell { width: 52px; height: 52px; font-size: 1.4rem; }
    .act-count-items { font-size: 2.2rem; }
}

@media (max-width: 480px) {
    .act-chapters { grid-template-columns: 1fr; }
}
