/* ============================================================
   Learn the Pathways — drag-and-drop matching game styles.
   ============================================================ */

.learn-main { max-width: 1300px; padding-bottom: 4rem; }
.learn-back-link { margin: 0.5rem 0 1rem; }
.learn-back-link a { color: var(--blue); text-decoration: none; font-weight: 600; }
.learn-back-link a:hover { text-decoration: underline; }

/* ============================================================
   Pathway picker
   ============================================================ */
.picker-screen h2 { margin-bottom: 0.25rem; }
.picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin-top: 1rem;
}
.picker-card {
    position: relative;
    background: white;
    border: 2px solid var(--lgray);
    border-radius: 10px;
    padding: 18px 16px 16px;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.12s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 110px;
}
.picker-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(2, 106, 176, 0.18);
    border-color: var(--sky);
}
.picker-card.picker-card-new      { border-color: var(--new); }
.picker-card.picker-card-expanded { border-color: var(--amber); }
.picker-card.picker-card-new:hover      { box-shadow: 0 6px 18px rgba(232, 98, 10, 0.25); }
.picker-card.picker-card-expanded:hover { box-shadow: 0 6px 18px rgba(196, 125, 14, 0.25); }

.picker-num {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 700;
}
.picker-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--blue-dark);
    line-height: 1.3;
}
.picker-badge {
    position: absolute;
    top: 10px; right: 10px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 7px;
    border-radius: 999px;
    color: white;
}
.picker-badge-new      { background: var(--new); }
.picker-badge-expanded { background: var(--amber); }

/* Completed-this-session marker — sits at the bottom of the card */
.picker-card-done { background: #f4fbf6; }
.picker-done {
    margin-top: auto;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #1f9d55;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.picker-done .done-star {
    color: #eab308;
    font-size: 1.05rem;
    line-height: 1;
}

/* ============================================================
   Game screen
   ============================================================ */
.game-screen { padding-top: 0.5rem; }

.game-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 8px;
}
.btn-secondary {
    background: var(--lgray);
    color: var(--navy);
    border: none;
    border-radius: 6px;
    padding: 0.5rem 1rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
}
.btn-secondary:hover { background: var(--sky); color: white; }

.game-stats { display: flex; gap: 16px; }
.stat {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    background: white;
    border-radius: 6px;
    padding: 6px 12px;
    border: 1px solid var(--lgray);
    font-size: 0.85rem;
}
.stat-label {
    font-size: 0.7rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.04em;
    color: var(--text-muted);
}
.stat-value {
    font-size: 1.1rem; font-weight: 800;
    color: var(--navy);
}

.game-board {
    display: flex;
    flex-direction: column;
    gap: 24px;
    align-items: center;
}

/* Side-by-side layout once the viewport is wide enough to fit both.
   Below 1100px we keep the stacked (centered, scroll-down) layout. */
@media (min-width: 1100px) {
    .game-board {
        flex-direction: row;
        align-items: flex-start;
        justify-content: center;
        gap: 28px;
    }
    .game-board > .target-card { flex-shrink: 0; }
    .game-board > .chip-pool {
        flex: 1 1 0;
        width: auto;
        max-width: 1200px;
    }
}

/* Target pathway card — centered, 20% larger than original 360px */
.target-card {
    width: 432px;
    max-width: 100%;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 18px rgba(0,0,0,0.08);
    position: sticky;
    top: 12px;
    z-index: 5;
}
.target-head {
    padding: 16px 18px;
    color: white;
    text-align: center;
}
.target-head.existing { background: var(--sky); }
.target-head.expanded { background: var(--sky); border: 2px solid var(--gold); border-bottom: none; }
.target-head.is-new   { background: var(--new); border: 2px solid var(--amber); border-bottom: none; }
.target-title {
    font-size: 1.1rem; font-weight: 900;
    text-transform: uppercase; letter-spacing: 0.4px;
    line-height: 1.3;
}
.target-badge {
    display: inline-block;
    margin-top: 6px;
    font-size: 0.7rem; font-weight: 800;
    background: var(--gold); color: var(--navy);
    padding: 2px 8px; border-radius: 4px;
    text-transform: uppercase;
}
.target-badge:empty { display: none; }

.target-body {
    padding: 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 22px;
}
.dropzone-section {
    background: white;
    border: 1.5px solid var(--lgray);
    border-radius: 7px;
    overflow: hidden;
}
.dropzone-section .dropzone-slots { padding: 12px; }

.zone-label {
    font-size: 0.85rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: white;
    background: var(--blue-dark);
    padding: 8px 12px;
    text-align: center;
    margin: 0;
    border-bottom: 3px solid var(--gold);
}
.zone-label.plus {
    background: var(--gold);
    color: var(--blue-dark);
    border-bottom-color: var(--blue-dark);
}

.dropzone-slots {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 8px;
}
/* Force-1-per-row when there's only one slot so it doesn't look like a half card */
.dropzone-slots[data-slot-count="1"] { grid-template-columns: 1fr; }
/* For 2 or 3 slots, lock the count so visual learners see the exact number of options */
.dropzone-slots[data-slot-count="2"] { grid-template-columns: repeat(2, 1fr); }
.dropzone-slots[data-slot-count="3"] { grid-template-columns: repeat(3, 1fr); }

.dropslot {
    min-height: 80px;
    border: 2px dashed var(--lgray);
    border-radius: 8px;
    background: #fbfcfd;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    position: relative;
}
.dropslot.zone-hover {
    border-color: var(--sky);
    background: var(--ltblue);
    border-style: solid;
}
.dropslot.filled {
    border-style: solid;
    border-color: #1f9d55;
    background: #f1faf2;
}
.dropslot .slot-num {
    position: absolute;
    top: 4px;
    left: 6px;
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--text-muted);
    background: white;
    padding: 1px 6px;
    border-radius: 8px;
    line-height: 1.4;
    border: 1px solid var(--lgray);
}
.dropslot.filled .slot-num {
    color: white;
    background: #1f9d55;
    border-color: #1f9d55;
}
.dropslot .slot-placeholder {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.78rem;
    text-align: center;
    padding: 14px 6px 6px;
}

@media (max-width: 600px) {
    .dropzone-slots[data-slot-count="3"] { grid-template-columns: 1fr; }
    .dropzone-slots[data-slot-count="2"] { grid-template-columns: 1fr; }
}

/* Chip pool — sits below the centered target card */
.chip-pool {
    background: white;
    border-radius: 10px;
    padding: 16px 22px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    width: 100%;
    max-width: 1100px;
}
.chip-pool-title {
    margin: 0 0 0.25rem;
    font-size: 1.1rem;
    color: var(--blue-dark);
    text-align: center;
}
.chip-pool-hint {
    margin: 0 0 14px;
    font-size: 0.9rem;
    color: var(--text-muted);
    text-align: center;
    min-height: 1.5rem;
    transition: color 0.2s ease;
}
.chip-pool-hint.pulse {
    color: #1f9d55;
    font-weight: 700;
    animation: hintPulse 0.55s ease;
}
.chip-pool-hint.shake-text {
    color: #d64545;
    font-weight: 700;
    animation: hintShake 0.45s ease;
}
@keyframes hintPulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.06); }
}
@keyframes hintShake {
    0%, 100% { transform: translateX(0); }
    25%      { transform: translateX(-4px); }
    75%      { transform: translateX(4px); }
}
/* Grid columns set by JS as ceil(sqrt(N)) so the chip pool is
   as close to a perfect square as possible for any chip count. */
.chip-pool-grid {
    display: grid;
    gap: 10px;
    justify-content: center;
}

/* Chips */
.chip {
    background: white;
    border: 2px solid var(--sky);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 0.85rem;
    line-height: 1.4;
    color: var(--text-dark);
    cursor: grab;
    user-select: none;
    min-height: 64px;
    display: flex;
    align-items: center;
    text-align: left;
    transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}
.chip:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(58, 143, 212, 0.25);
}
.chip:active, .chip.dragging {
    cursor: grabbing;
    opacity: 0.6;
}
.chip.correct {
    background: #e6f6ee;
    border-color: #1f9d55;
    color: var(--text-dark);
    cursor: default;
}
.chip.correct::before {
    content: '✓ ';
    color: #1f9d55;
    font-weight: 800;
}
.chip.shake {
    animation: shake 0.45s ease;
    border-color: #d64545;
    background: #ffeaea;
}
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    15% { transform: translateX(-8px); }
    30% { transform: translateX(8px); }
    45% { transform: translateX(-6px); }
    60% { transform: translateX(6px); }
    80% { transform: translateX(-3px); }
}

/* Chips inside a slot — tighter padding so they fit */
.dropslot .chip {
    max-width: 100%;
    padding: 7px 10px;
    min-height: 48px;
    font-size: 0.78rem;
}

/* ============================================================
   Celebration overlay
   ============================================================ */
.celebration {
    position: fixed;
    inset: 0;
    background: rgba(10, 25, 45, 0.5);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.celebration[hidden] { display: none; }
#confetti-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}
.celebration-card {
    background: white;
    border-radius: 16px;
    padding: 36px 40px;
    text-align: center;
    max-width: 480px;
    box-shadow: 0 24px 60px rgba(0,0,0,0.35);
    animation: popIn 0.3s ease;
    position: relative;
    z-index: 1;
}
.celebration-emoji {
    font-size: 4rem;
    margin-bottom: 0.5rem;
    animation: bounce 0.6s ease;
}
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    25% { transform: translateY(-12px); }
    50% { transform: translateY(0); }
    75% { transform: translateY(-6px); }
}
@keyframes popIn {
    from { transform: scale(0.85); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}
.celebration-title {
    margin: 0 0 0.5rem;
    font-size: 1.75rem;
    color: var(--navy);
}
.celebration-msg {
    font-size: 1.05rem;
    margin: 0 0 0.4rem;
    color: var(--text-dark);
}
.celebration-stats {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0 0 1.25rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}
.celebration-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}
.big-btn {
    background: var(--yellow);
    color: var(--text-dark);
    border: none;
    border-radius: 50px;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.12s ease, box-shadow 0.15s ease;
    box-shadow: 0 3px 8px rgba(0,0,0,0.2);
}
.big-btn:hover { transform: translateY(-2px); box-shadow: 0 5px 12px rgba(0,0,0,0.3); }
.big-btn.alt {
    background: white;
    color: var(--blue-dark);
    border: 2px solid var(--blue);
    box-shadow: none;
}
.big-btn.alt:hover { background: var(--blue); color: white; }
