/* ============================================
   Integer Pyramid Activity Styles
   ============================================ */

.pyramid-page-header {
    background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%);
    color: white;
    padding: 2rem 0;
}

.pyramid-page-header .header-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.pyramid-page-header .back-link {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.pyramid-page-header .back-link:hover {
    color: white;
}

.pyramid-page-header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.pyramid-page-header p {
    opacity: 0.9;
    font-size: 1rem;
}

/* Pyramid State Container */
.pyramid-state {
    padding: 2rem 0;
}

/* Loading */
.pyramid-state .loading-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    gap: 1rem;
}

/* Pyramid Game Layout */
.pyramid-game {
    max-width: 1000px;
    margin: 0 auto;
}

.pyramid-progress {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 12px;
}

.stage-indicator {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
}

.stage-dots {
    display: flex;
    gap: 0.5rem;
}

.stage-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
    background: #e0e0e0;
    color: #666;
    transition: all 0.3s ease;
}

.stage-dot.active {
    background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%);
    color: white;
    transform: scale(1.1);
}

.stage-dot.completed {
    background: #16a34a;
    color: white;
}

.stage-dot.locked {
    opacity: 0.5;
}

/* Main Game Layout */
.pyramid-game-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 2rem;
    align-items: start;
}

@media (max-width: 900px) {
    .pyramid-game-layout {
        grid-template-columns: 1fr;
    }
}

/* Pyramid Container */
.pyramid-container {
    display: flex;
    justify-content: center;
    padding: 2rem;
    background: #f8f9fa;
    border-radius: 16px;
    overflow-x: auto;
}

.pyramid-grid {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.pyramid-row {
    display: flex;
    gap: 4px;
    justify-content: center;
}

/* Pyramid Cells */
.pyramid-cell {
    width: 48px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    background: white;
    transition: all 0.2s ease;
    user-select: none;
}

.pyramid-cell.seed {
    background: #f0f0f0;
    border-color: #999;
    color: #333;
}

.pyramid-cell.editable {
    cursor: pointer;
    border-style: dashed;
}

.pyramid-cell.editable:hover {
    border-color: #7c3aed;
    background: #faf5ff;
}

.pyramid-cell.selected {
    border-color: #7c3aed;
    border-style: solid;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.2);
    background: #faf5ff;
}

.pyramid-cell.filled {
    background: #dcfce7;
    border-color: #16a34a;
    border-style: solid;
    color: #166534;
}

.pyramid-cell.locked {
    background: #f5f5f5;
    border-color: #e0e0e0;
    color: #ccc;
}

/* Input Panel */
.pyramid-input-panel {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid #e0e0e0;
}

.stage-info {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e0e0e0;
}

.stage-info h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: #333;
}

.stage-info p {
    font-size: 0.9rem;
    color: #666;
}

.cell-input-area {
    margin-bottom: 1rem;
}

.selected-cell-display {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.cell-label {
    color: #666;
}

#selected-cell-info {
    font-weight: 600;
    color: #333;
}

.cell-equation {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 1.2rem;
    font-weight: 600;
}

.equation-op,
.equation-eq {
    color: #666;
}

.answer-input {
    width: 70px;
    height: 40px;
    border: 2px solid #7c3aed;
    border-radius: 8px;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
    outline: none;
    transition: border-color 0.2s;
}

.answer-input:focus {
    border-color: #5b21b6;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.2);
}

.input-actions {
    display: flex;
    gap: 0.75rem;
}

.input-actions .btn-primary,
.input-actions .btn-secondary {
    flex: 1;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.input-actions .btn-primary {
    background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%);
    color: white;
    border: none;
}

.input-actions .btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

.input-actions .btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.input-actions .btn-secondary {
    background: white;
    color: #666;
    border: 2px solid #e0e0e0;
}

.input-actions .btn-secondary:hover {
    border-color: #999;
    color: #333;
}

/* Feedback */
.pyramid-feedback {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-top: 1rem;
    font-weight: 500;
}

.pyramid-feedback.success {
    background: #dcfce7;
    color: #166534;
}

.pyramid-feedback.error {
    background: #fee2e2;
    color: #991b1b;
}

/* Stage Complete Message */
.stage-complete-msg {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    background: #dcfce7;
    border-radius: 12px;
    text-align: center;
    margin-top: 1rem;
}

.stage-complete-msg .complete-icon {
    color: #16a34a;
}

.stage-complete-msg span {
    font-weight: 600;
    color: #166534;
    font-size: 1.1rem;
}

.stage-complete-msg .btn-primary {
    background: #16a34a;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
}

.stage-complete-msg .btn-primary:hover {
    background: #15803d;
}

/* Instructions */
.pyramid-instructions {
    margin-top: 2rem;
}

.pyramid-instructions details {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
}

.pyramid-instructions summary {
    font-weight: 600;
    cursor: pointer;
    color: #333;
}

.pyramid-instructions ul {
    margin-top: 1rem;
    padding-left: 1.5rem;
    color: #666;
}

.pyramid-instructions li {
    margin-bottom: 0.5rem;
}

/* Winner State */
.pyramid-winner {
    text-align: center;
    padding: 2rem 0;
}

.pyramid-winner .winner-announcement {
    margin-bottom: 2rem;
    position: relative;
}

.pyramid-winner .winner-trophy {
    color: #f59e0b;
    margin-bottom: 1rem;
}

.pyramid-winner h1 {
    font-size: 2.5rem;
    color: #333;
    margin-bottom: 0.5rem;
}

.pyramid-winner > p {
    color: #666;
    font-size: 1.1rem;
}

.pyramid-winner .pyramid-final {
    margin: 2rem auto;
    max-width: 500px;
}

.pyramid-winner .pyramid-final .pyramid-cell {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    border-color: #16a34a;
    color: #166534;
}

.winner-stats {
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin-bottom: 2rem;
}

.winner-stats .stat {
    text-align: center;
}

.winner-stats .stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: #7c3aed;
}

.winner-stats .stat-label {
    color: #666;
    font-size: 0.9rem;
}

.winner-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.winner-actions .btn-primary {
    background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%);
    color: white;
    border: none;
    padding: 0.875rem 2rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s;
}

.winner-actions .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

.winner-actions .btn-secondary {
    background: white;
    color: #666;
    border: 2px solid #e0e0e0;
    padding: 0.875rem 2rem;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    transition: border-color 0.2s, color 0.2s;
}

.winner-actions .btn-secondary:hover {
    border-color: #999;
    color: #333;
}

/* Confetti Animation */
.confetti-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    top: -10px;
    animation: confetti-fall 3s ease-out forwards;
}

@keyframes confetti-fall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(400px) rotate(720deg);
        opacity: 0;
    }
}

/* Error State */
.pyramid-error {
    text-align: center;
    padding: 4rem 2rem;
}

.pyramid-error svg {
    color: #dc2626;
    margin-bottom: 1rem;
}

.pyramid-error h2 {
    color: #333;
    margin-bottom: 0.5rem;
}

.pyramid-error p {
    color: #666;
    margin-bottom: 1.5rem;
}

/* Responsive */
@media (max-width: 600px) {
    .pyramid-cell {
        width: 36px;
        height: 34px;
        font-size: 0.8rem;
    }

    .pyramid-progress {
        flex-direction: column;
        gap: 1rem;
    }

    .cell-equation {
        font-size: 1rem;
    }

    .answer-input {
        width: 60px;
        height: 36px;
    }
}

